diff --git a/media/player/videojs/amd/build/video-lazy.min.js b/media/player/videojs/amd/build/video-lazy.min.js
index 72bad06d90a..fd1913983af 100644
--- a/media/player/videojs/amd/build/video-lazy.min.js
+++ b/media/player/videojs/amd/build/video-lazy.min.js
@@ -1,6 +1,6 @@
/**
* @license
- * Video.js 8.3.0
+ * Video.js 8.10.0
* Copyright Brightcove, Inc.
* Available under Apache License Version 2.0
*
@@ -9,7 +9,7 @@
* Available under Apache License Version 2.0
*
*/
-!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define("media_videojs/video-lazy",factory):(global="undefined"!=typeof globalThis?globalThis:global||self).videojs=factory()}(window,(function(){const hooks_={},hooks=function(type,fn){return hooks_[type]=hooks_[type]||[],fn&&(hooks_[type]=hooks_[type].concat(fn)),hooks_[type]},removeHook=function(type,fn){const index=hooks(type).indexOf(fn);return!(index<=-1)&&(hooks_[type]=hooks_[type].slice(),hooks_[type].splice(index,1),!0)},FullscreenApi={prefixed:!0},apiMap=[["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"]],specApi=apiMap[0];let browserApi;for(let i=0;i(type,level,args)=>{const lvl=log.levels[level],lvlRegExp=new RegExp("^(".concat(lvl,")$"));if("log"!==type&&args.unshift(type.toUpperCase()+":"),args.unshift(name+":"),history){history.push([].concat(args));const splice=history.length-1e3;history.splice(0,splice>0?splice:0)}if(!window.console)return;let fn=window.console[type];fn||"debug"!==type||(fn=window.console.info||window.console.log),fn&&lvl&&lvlRegExp.test(type)&&fn[Array.isArray(args)?"apply":"call"](window.console,args)})(name,log),log.createLogger=subname=>createLogger$1(name+": "+subname),log.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:level},log.level=lvl=>{if("string"==typeof lvl){if(!log.levels.hasOwnProperty(lvl))throw new Error('"'.concat(lvl,'" in not a valid log level'));level=lvl}return level},(log.history=()=>history?[].concat(history):[]).filter=fname=>(history||[]).filter((historyItem=>new RegExp(".*".concat(fname,".*")).test(historyItem[0]))),log.history.clear=()=>{history&&(history.length=0)},log.history.disable=()=>{null!==history&&(history.length=0,history=null)},log.history.enable=()=>{null===history&&(history=[])},log.error=function(){for(var _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++)args[_key3]=arguments[_key3];return logByType("error",level,args)},log.warn=function(){for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++)args[_key4]=arguments[_key4];return logByType("warn",level,args)},log.debug=function(){for(var _len5=arguments.length,args=new Array(_len5),_key5=0;_key5<_len5;_key5++)args[_key5]=arguments[_key5];return logByType("debug",level,args)},log}("VIDEOJS"),createLogger=log$1.createLogger,toString$1=Object.prototype.toString,keys=function(object){return isObject$1(object)?Object.keys(object):[]};function each(object,fn){keys(object).forEach((key=>fn(object[key],key)))}function reduce(object,fn){let initial=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return keys(object).reduce(((accum,key)=>fn(accum,object[key],key)),initial)}function isObject$1(value){return!!value&&"object"==typeof value}function isPlain(value){return isObject$1(value)&&"[object Object]"===toString$1.call(value)&&value.constructor===Object}function merge$2(){const result={};for(var _len6=arguments.length,sources=new Array(_len6),_key6=0;_key6<_len6;_key6++)sources[_key6]=arguments[_key6];return sources.forEach((source=>{source&&each(source,((value,key)=>{isPlain(value)?(isPlain(result[key])||(result[key]={}),result[key]=merge$2(result[key],value)):result[key]=value}))})),result}function defineLazyProperty(obj,key,getValue){let setter=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const set=value=>Object.defineProperty(obj,key,{value:value,enumerable:!0,writable:!0}),options={configurable:!0,enumerable:!0,get(){const value=getValue();return set(value),value}};return setter&&(options.set=set),Object.defineProperty(obj,key,options)}var Obj=Object.freeze({__proto__:null,each:each,reduce:reduce,isObject:isObject$1,isPlain:isPlain,merge:merge$2,defineLazyProperty:defineLazyProperty});let ANDROID_VERSION,IS_IPOD=!1,IOS_VERSION=null,IS_ANDROID=!1,IS_FIREFOX=!1,IS_EDGE=!1,IS_CHROMIUM=!1,IS_CHROME=!1,CHROMIUM_VERSION=null,CHROME_VERSION=null,IE_VERSION=null,IS_SAFARI=!1,IS_WINDOWS=!1,IS_IPAD=!1,IS_IPHONE=!1;const TOUCH_ENABLED=Boolean(isReal()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch)),UAD=window.navigator&&window.navigator.userAgentData;if(UAD&&(IS_ANDROID="Android"===UAD.platform,IS_EDGE=Boolean(UAD.brands.find((b=>"Microsoft Edge"===b.brand))),IS_CHROMIUM=Boolean(UAD.brands.find((b=>"Chromium"===b.brand))),IS_CHROME=!IS_EDGE&&IS_CHROMIUM,CHROMIUM_VERSION=CHROME_VERSION=(UAD.brands.find((b=>"Chromium"===b.brand))||{}).version||null,IS_WINDOWS="Windows"===UAD.platform),!IS_CHROMIUM){const USER_AGENT=window.navigator&&window.navigator.userAgent||"";IS_IPOD=/iPod/i.test(USER_AGENT),IOS_VERSION=function(){const match=USER_AGENT.match(/OS (\d+)_/i);return match&&match[1]?match[1]:null}(),IS_ANDROID=/Android/i.test(USER_AGENT),ANDROID_VERSION=function(){const match=USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!match)return null;const major=match[1]&&parseFloat(match[1]),minor=match[2]&&parseFloat(match[2]);return major&&minor?parseFloat(match[1]+"."+match[2]):major||null}(),IS_FIREFOX=/Firefox/i.test(USER_AGENT),IS_EDGE=/Edg/i.test(USER_AGENT),IS_CHROMIUM=/Chrome/i.test(USER_AGENT)||/CriOS/i.test(USER_AGENT),IS_CHROME=!IS_EDGE&&IS_CHROMIUM,CHROMIUM_VERSION=CHROME_VERSION=function(){const match=USER_AGENT.match(/(Chrome|CriOS)\/(\d+)/);return match&&match[2]?parseFloat(match[2]):null}(),IE_VERSION=function(){const result=/MSIE\s(\d+)\.\d/.exec(USER_AGENT);let version=result&&parseFloat(result[1]);return!version&&/Trident\/7.0/i.test(USER_AGENT)&&/rv:11.0/.test(USER_AGENT)&&(version=11),version}(),IS_SAFARI=/Safari/i.test(USER_AGENT)&&!IS_CHROME&&!IS_ANDROID&&!IS_EDGE,IS_WINDOWS=/Windows/i.test(USER_AGENT),IS_IPAD=/iPad/i.test(USER_AGENT)||IS_SAFARI&&TOUCH_ENABLED&&!/iPhone/i.test(USER_AGENT),IS_IPHONE=/iPhone/i.test(USER_AGENT)&&!IS_IPAD}const IS_IOS=IS_IPHONE||IS_IPAD||IS_IPOD,IS_ANY_SAFARI=(IS_SAFARI||IS_IOS)&&!IS_CHROME;var browser=Object.freeze({__proto__:null,get IS_IPOD(){return IS_IPOD},get IOS_VERSION(){return IOS_VERSION},get IS_ANDROID(){return IS_ANDROID},get ANDROID_VERSION(){return ANDROID_VERSION},get IS_FIREFOX(){return IS_FIREFOX},get IS_EDGE(){return IS_EDGE},get IS_CHROMIUM(){return IS_CHROMIUM},get IS_CHROME(){return IS_CHROME},get CHROMIUM_VERSION(){return CHROMIUM_VERSION},get CHROME_VERSION(){return CHROME_VERSION},get IE_VERSION(){return IE_VERSION},get IS_SAFARI(){return IS_SAFARI},get IS_WINDOWS(){return IS_WINDOWS},get IS_IPAD(){return IS_IPAD},get IS_IPHONE(){return IS_IPHONE},TOUCH_ENABLED:TOUCH_ENABLED,IS_IOS:IS_IOS,IS_ANY_SAFARI:IS_ANY_SAFARI});function isNonBlankString(str){return"string"==typeof str&&Boolean(str.trim())}function isReal(){return document===window.document}function isEl(value){return isObject$1(value)&&1===value.nodeType}function isInFrame(){try{return window.parent!==window.self}catch(x){return!0}}function createQuerier(method){return function(selector,context){if(!isNonBlankString(selector))return document[method](null);isNonBlankString(context)&&(context=document.querySelector(context));const ctx=isEl(context)?context:document;return ctx[method]&&ctx[method](selector)}}function createEl(){let tagName=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",properties=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},content=arguments.length>3?arguments[3]:void 0;const el=document.createElement(tagName);return Object.getOwnPropertyNames(properties).forEach((function(propName){const val=properties[propName];"textContent"===propName?textContent(el,val):el[propName]===val&&"tabIndex"!==propName||(el[propName]=val)})),Object.getOwnPropertyNames(attributes).forEach((function(attrName){el.setAttribute(attrName,attributes[attrName])})),content&&appendContent(el,content),el}function textContent(el,text){return void 0===el.textContent?el.innerText=text:el.textContent=text,el}function prependTo(child,parent){parent.firstChild?parent.insertBefore(child,parent.firstChild):parent.appendChild(child)}function hasClass(element,classToCheck){return function(str){if(str.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}(classToCheck),element.classList.contains(classToCheck)}function addClass(element){for(var _len7=arguments.length,classesToAdd=new Array(_len7>1?_len7-1:0),_key7=1;_key7<_len7;_key7++)classesToAdd[_key7-1]=arguments[_key7];return element.classList.add(...classesToAdd.reduce(((prev,current)=>prev.concat(current.split(/\s+/))),[])),element}function removeClass(element){if(!element)return log$1.warn("removeClass was called with an element that doesn't exist"),null;for(var _len8=arguments.length,classesToRemove=new Array(_len8>1?_len8-1:0),_key8=1;_key8<_len8;_key8++)classesToRemove[_key8-1]=arguments[_key8];return element.classList.remove(...classesToRemove.reduce(((prev,current)=>prev.concat(current.split(/\s+/))),[])),element}function toggleClass(element,classToToggle,predicate){return"function"==typeof predicate&&(predicate=predicate(element,classToToggle)),"boolean"!=typeof predicate&&(predicate=void 0),classToToggle.split(/\s+/).forEach((className=>element.classList.toggle(className,predicate))),element}function setAttributes(el,attributes){Object.getOwnPropertyNames(attributes).forEach((function(attrName){const attrValue=attributes[attrName];null==attrValue||!1===attrValue?el.removeAttribute(attrName):el.setAttribute(attrName,!0===attrValue?"":attrValue)}))}function getAttributes(tag){const obj={},knownBooleans=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(tag&&tag.attributes&&tag.attributes.length>0){const attrs=tag.attributes;for(let i=attrs.length-1;i>=0;i--){const attrName=attrs[i].name;let attrVal=attrs[i].value;"boolean"!=typeof tag[attrName]&&-1===knownBooleans.indexOf(","+attrName+",")||(attrVal=null!==attrVal),obj[attrName]=attrVal}}return obj}function getAttribute(el,attribute){return el.getAttribute(attribute)}function setAttribute(el,attribute,value){el.setAttribute(attribute,value)}function removeAttribute(el,attribute){el.removeAttribute(attribute)}function blockTextSelection(){document.body.focus(),document.onselectstart=function(){return!1}}function unblockTextSelection(){document.onselectstart=function(){return!0}}function getBoundingClientRect(el){if(el&&el.getBoundingClientRect&&el.parentNode){const rect=el.getBoundingClientRect(),result={};return["bottom","height","left","right","top","width"].forEach((k=>{void 0!==rect[k]&&(result[k]=rect[k])})),result.height||(result.height=parseFloat(computedStyle(el,"height"))),result.width||(result.width=parseFloat(computedStyle(el,"width"))),result}}function findPosition(el){if(!el||el&&!el.offsetParent)return{left:0,top:0,width:0,height:0};const width=el.offsetWidth,height=el.offsetHeight;let left=0,top=0;for(;el.offsetParent&&el!==document[FullscreenApi.fullscreenElement];)left+=el.offsetLeft,top+=el.offsetTop,el=el.offsetParent;return{left:left,top:top,width:width,height:height}}function getPointerPosition(el,event){const translated={x:0,y:0};if(IS_IOS){let item=el;for(;item&&"html"!==item.nodeName.toLowerCase();){const transform=computedStyle(item,"transform");if(/^matrix/.test(transform)){const values=transform.slice(7,-1).split(/,\s/).map(Number);translated.x+=values[4],translated.y+=values[5]}else if(/^matrix3d/.test(transform)){const values=transform.slice(9,-1).split(/,\s/).map(Number);translated.x+=values[12],translated.y+=values[13]}item=item.parentNode}}const position={},boxTarget=findPosition(event.target),box=findPosition(el),boxW=box.width,boxH=box.height;let offsetY=event.offsetY-(box.top-boxTarget.top),offsetX=event.offsetX-(box.left-boxTarget.left);return event.changedTouches&&(offsetX=event.changedTouches[0].pageX-box.left,offsetY=event.changedTouches[0].pageY+box.top,IS_IOS&&(offsetX-=translated.x,offsetY-=translated.y)),position.y=1-Math.max(0,Math.min(1,offsetY/boxH)),position.x=Math.max(0,Math.min(1,offsetX/boxW)),position}function isTextNode$1(value){return isObject$1(value)&&3===value.nodeType}function emptyEl(el){for(;el.firstChild;)el.removeChild(el.firstChild);return el}function normalizeContent(content){return"function"==typeof content&&(content=content()),(Array.isArray(content)?content:[content]).map((value=>("function"==typeof value&&(value=value()),isEl(value)||isTextNode$1(value)?value:"string"==typeof value&&/\S/.test(value)?document.createTextNode(value):void 0))).filter((value=>value))}function appendContent(el,content){return normalizeContent(content).forEach((node=>el.appendChild(node))),el}function insertContent(el,content){return appendContent(emptyEl(el),content)}function isSingleLeftClick(event){return void 0===event.button&&void 0===event.buttons||(0===event.button&&void 0===event.buttons||("mouseup"===event.type&&0===event.button&&0===event.buttons||0===event.button&&1===event.buttons))}const $=createQuerier("querySelector"),$$=createQuerier("querySelectorAll");function computedStyle(el,prop){if(!el||!prop)return"";if("function"==typeof window.getComputedStyle){let computedStyleValue;try{computedStyleValue=window.getComputedStyle(el)}catch(e){return""}return computedStyleValue?computedStyleValue.getPropertyValue(prop)||computedStyleValue[prop]:""}return""}var Dom=Object.freeze({__proto__:null,isReal:isReal,isEl:isEl,isInFrame:isInFrame,createEl:createEl,textContent:textContent,prependTo:prependTo,hasClass:hasClass,addClass:addClass,removeClass:removeClass,toggleClass:toggleClass,setAttributes:setAttributes,getAttributes:getAttributes,getAttribute:getAttribute,setAttribute:setAttribute,removeAttribute:removeAttribute,blockTextSelection:blockTextSelection,unblockTextSelection:unblockTextSelection,getBoundingClientRect:getBoundingClientRect,findPosition:findPosition,getPointerPosition:getPointerPosition,isTextNode:isTextNode$1,emptyEl:emptyEl,normalizeContent:normalizeContent,appendContent:appendContent,insertContent:insertContent,isSingleLeftClick:isSingleLeftClick,$:$,$$:$$,computedStyle:computedStyle});let videojs$1,_windowLoaded=!1;const autoSetup=function(){if(!1===videojs$1.options.autoSetup)return;const vids=Array.prototype.slice.call(document.getElementsByTagName("video")),audios=Array.prototype.slice.call(document.getElementsByTagName("audio")),divs=Array.prototype.slice.call(document.getElementsByTagName("video-js")),mediaEls=vids.concat(audios,divs);if(mediaEls&&mediaEls.length>0)for(let i=0,e=mediaEls.length;i-1&&(options={passive:!0}),elem.addEventListener(type,data.dispatcher,options)}else elem.attachEvent&&elem.attachEvent("on"+type,data.dispatcher)}function off(elem,type,fn){if(!DomData.has(elem))return;const data=DomData.get(elem);if(!data.handlers)return;if(Array.isArray(type))return _handleMultipleEvents(off,elem,type,fn);const removeType=function(el,t){data.handlers[t]=[],_cleanUpEvents(el,t)};if(void 0===type){for(const t in data.handlers)Object.prototype.hasOwnProperty.call(data.handlers||{},t)&&removeType(elem,t);return}const handlers=data.handlers[type];if(handlers)if(fn){if(fn.guid)for(let n=0;n=wait&&(fn(...arguments),last=now)}},debounce=function(func,wait,immediate){let timeout,context=arguments.length>3&&void 0!==arguments[3]?arguments[3]:window;const cancel=()=>{context.clearTimeout(timeout),timeout=null},debounced=function(){const self=this,args=arguments;let later=function(){timeout=null,later=null,immediate||func.apply(self,args)};!timeout&&immediate&&func.apply(self,args),context.clearTimeout(timeout),timeout=context.setTimeout(later,wait)};return debounced.cancel=cancel,debounced};var Fn=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:bind_,throttle:throttle,debounce:debounce});let EVENT_MAP;class EventTarget$2{on(type,fn){const ael=this.addEventListener;this.addEventListener=()=>{},on(this,type,fn),this.addEventListener=ael}off(type,fn){off(this,type,fn)}one(type,fn){const ael=this.addEventListener;this.addEventListener=()=>{},one(this,type,fn),this.addEventListener=ael}any(type,fn){const ael=this.addEventListener;this.addEventListener=()=>{},any(this,type,fn),this.addEventListener=ael}trigger(event){const type=event.type||event;"string"==typeof event&&(event={type:type}),event=fixEvent(event),this.allowedEvents_[type]&&this["on"+type]&&this["on"+type](event),trigger(this,event)}queueTrigger(event){EVENT_MAP||(EVENT_MAP=new Map);const type=event.type||event;let map=EVENT_MAP.get(this);map||(map=new Map,EVENT_MAP.set(this,map));const oldTimeout=map.get(type);map.delete(type),window.clearTimeout(oldTimeout);const timeout=window.setTimeout((()=>{map.delete(type),0===map.size&&(map=null,EVENT_MAP.delete(this)),this.trigger(event)}),0);map.set(type,timeout)}}EventTarget$2.prototype.allowedEvents_={},EventTarget$2.prototype.addEventListener=EventTarget$2.prototype.on,EventTarget$2.prototype.removeEventListener=EventTarget$2.prototype.off,EventTarget$2.prototype.dispatchEvent=EventTarget$2.prototype.trigger;const objName=obj=>"function"==typeof obj.name?obj.name():"string"==typeof obj.name?obj.name:obj.name_?obj.name_:obj.constructor&&obj.constructor.name?obj.constructor.name:typeof obj,isEvented=object=>object instanceof EventTarget$2||!!object.eventBusEl_&&["on","one","off","trigger"].every((k=>"function"==typeof object[k])),isValidEventType=type=>"string"==typeof type&&/\S/.test(type)||Array.isArray(type)&&!!type.length,validateTarget=(target,obj,fnName)=>{if(!target||!target.nodeName&&!isEvented(target))throw new Error("Invalid target for ".concat(objName(obj),"#").concat(fnName,"; must be a DOM node or evented object."))},validateEventType=(type,obj,fnName)=>{if(!isValidEventType(type))throw new Error("Invalid event type for ".concat(objName(obj),"#").concat(fnName,"; must be a non-empty string or array."))},validateListener=(listener,obj,fnName)=>{if("function"!=typeof listener)throw new Error("Invalid listener for ".concat(objName(obj),"#").concat(fnName,"; must be a function."))},normalizeListenArgs=(self,args,fnName)=>{const isTargetingSelf=args.length<3||args[0]===self||args[0]===self.eventBusEl_;let target,type,listener;return isTargetingSelf?(target=self.eventBusEl_,args.length>=3&&args.shift(),[type,listener]=args):[target,type,listener]=args,validateTarget(target,self,fnName),validateEventType(type,self,fnName),validateListener(listener,self,fnName),listener=bind_(self,listener),{isTargetingSelf:isTargetingSelf,target:target,type:type,listener:listener}},listen=(target,method,type,listener)=>{validateTarget(target,target,method),target.nodeName?Events[method](target,type,listener):target[method](type,listener)},EventedMixin={on(){for(var _len9=arguments.length,args=new Array(_len9),_key9=0;_key9<_len9;_key9++)args[_key9]=arguments[_key9];const{isTargetingSelf:isTargetingSelf,target:target,type:type,listener:listener}=normalizeListenArgs(this,args,"on");if(listen(target,"on",type,listener),!isTargetingSelf){const removeListenerOnDispose=()=>this.off(target,type,listener);removeListenerOnDispose.guid=listener.guid;const removeRemoverOnTargetDispose=()=>this.off("dispose",removeListenerOnDispose);removeRemoverOnTargetDispose.guid=listener.guid,listen(this,"on","dispose",removeListenerOnDispose),listen(target,"on","dispose",removeRemoverOnTargetDispose)}},one(){for(var _this=this,_len10=arguments.length,args=new Array(_len10),_key10=0;_key10<_len10;_key10++)args[_key10]=arguments[_key10];const{isTargetingSelf:isTargetingSelf,target:target,type:type,listener:listener}=normalizeListenArgs(this,args,"one");if(isTargetingSelf)listen(target,"one",type,listener);else{const wrapper=function(){_this.off(target,type,wrapper);for(var _len11=arguments.length,largs=new Array(_len11),_key11=0;_key11<_len11;_key11++)largs[_key11]=arguments[_key11];listener.apply(null,largs)};wrapper.guid=listener.guid,listen(target,"one",type,wrapper)}},any(){for(var _this2=this,_len12=arguments.length,args=new Array(_len12),_key12=0;_key12<_len12;_key12++)args[_key12]=arguments[_key12];const{isTargetingSelf:isTargetingSelf,target:target,type:type,listener:listener}=normalizeListenArgs(this,args,"any");if(isTargetingSelf)listen(target,"any",type,listener);else{const wrapper=function(){_this2.off(target,type,wrapper);for(var _len13=arguments.length,largs=new Array(_len13),_key13=0;_key13<_len13;_key13++)largs[_key13]=arguments[_key13];listener.apply(null,largs)};wrapper.guid=listener.guid,listen(target,"any",type,wrapper)}},off(targetOrType,typeOrListener,listener){if(!targetOrType||isValidEventType(targetOrType))off(this.eventBusEl_,targetOrType,typeOrListener);else{const target=targetOrType,type=typeOrListener;validateTarget(target,this,"off"),validateEventType(type,this,"off"),validateListener(listener,this,"off"),listener=bind_(this,listener),this.off("dispose",listener),target.nodeName?(off(target,type,listener),off(target,"dispose",listener)):isEvented(target)&&(target.off(type,listener),target.off("dispose",listener))}},trigger(event,hash){validateTarget(this.eventBusEl_,this,"trigger");const type=event&&"string"!=typeof event?event.type:event;if(!isValidEventType(type))throw new Error("Invalid event type for ".concat(objName(this),"#trigger; ")+"must be a non-empty string or object with a type key that has a non-empty value.");return trigger(this.eventBusEl_,event,hash)}};function evented(target){let options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{eventBusKey:eventBusKey}=options;if(eventBusKey){if(!target[eventBusKey].nodeName)throw new Error('The eventBusKey "'.concat(eventBusKey,'" does not refer to an element.'));target.eventBusEl_=target[eventBusKey]}else target.eventBusEl_=createEl("span",{className:"vjs-event-bus"});return Object.assign(target,EventedMixin),target.eventedCallbacks&&target.eventedCallbacks.forEach((callback=>{callback()})),target.on("dispose",(()=>{target.off(),[target,target.el_,target.eventBusEl_].forEach((function(val){val&&DomData.has(val)&&DomData.delete(val)})),window.setTimeout((()=>{target.eventBusEl_=null}),0)})),target}const StatefulMixin={state:{},setState(stateUpdates){let changes;return"function"==typeof stateUpdates&&(stateUpdates=stateUpdates()),each(stateUpdates,((value,key)=>{this.state[key]!==value&&(changes=changes||{},changes[key]={from:this.state[key],to:value}),this.state[key]=value})),changes&&isEvented(this)&&this.trigger({changes:changes,type:"statechanged"}),changes}};function stateful(target,defaultState){return Object.assign(target,StatefulMixin),target.state=Object.assign({},target.state,defaultState),"function"==typeof target.handleStateChanged&&isEvented(target)&&target.on("statechanged",target.handleStateChanged),target}const toLowerCase=function(string){return"string"!=typeof string?string:string.replace(/./,(w=>w.toLowerCase()))},toTitleCase$1=function(string){return"string"!=typeof string?string:string.replace(/./,(w=>w.toUpperCase()))},titleCaseEquals=function(str1,str2){return toTitleCase$1(str1)===toTitleCase$1(str2)};var Str=Object.freeze({__proto__:null,toLowerCase:toLowerCase,toTitleCase:toTitleCase$1,titleCaseEquals:titleCaseEquals}),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(fn,module){return fn(module={exports:{}},module.exports),module.exports}var keycode=createCommonjsModule((function(module,exports){function keyCode(searchInput){if(searchInput&&"object"==typeof searchInput){var hasKeyCode=searchInput.which||searchInput.keyCode||searchInput.charCode;hasKeyCode&&(searchInput=hasKeyCode)}if("number"==typeof searchInput)return names[searchInput];var foundNamedKey,search=String(searchInput);return(foundNamedKey=codes[search.toLowerCase()])?foundNamedKey:(foundNamedKey=aliases[search.toLowerCase()])||(1===search.length?search.charCodeAt(0):void 0)}keyCode.isEventKey=function(event,nameOrCode){if(event&&"object"==typeof event){var keyCode=event.which||event.keyCode||event.charCode;if(null==keyCode)return!1;if("string"==typeof nameOrCode){var foundNamedKey;if(foundNamedKey=codes[nameOrCode.toLowerCase()])return foundNamedKey===keyCode;if(foundNamedKey=aliases[nameOrCode.toLowerCase()])return foundNamedKey===keyCode}else if("number"==typeof nameOrCode)return nameOrCode===keyCode;return!1}};var codes=(exports=module.exports=keyCode).code=exports.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},aliases=exports.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(i=97;i<123;i++)codes[String.fromCharCode(i)]=i-32;for(var i=48;i<58;i++)codes[i-48]=i;for(i=1;i<13;i++)codes["f"+i]=i+111;for(i=0;i<10;i++)codes["numpad "+i]=i+96;var names=exports.names=exports.title={};for(i in codes)names[codes[i]]=i;for(var alias in aliases)codes[alias]=aliases[alias]}));keycode.code,keycode.codes,keycode.aliases,keycode.names,keycode.title;class Component$1{constructor(player,options,ready){if(!player&&this.play?this.player_=player=this:this.player_=player,this.isDisposed_=!1,this.parentComponent_=null,this.options_=merge$2({},this.options_),options=this.options_=merge$2(this.options_,options),this.id_=options.id||options.el&&options.el.id,!this.id_){const id=player&&player.id&&player.id()||"no_player";this.id_="".concat(id,"_component_").concat(newGUID())}this.name_=options.name||null,options.el?this.el_=options.el:!1!==options.createEl&&(this.el_=this.createEl()),options.className&&this.el_&&options.className.split(" ").forEach((c=>this.addClass(c))),["on","off","one","any","trigger"].forEach((fn=>{this[fn]=void 0})),!1!==options.evented&&(evented(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),stateful(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!==options.initChildren&&this.initChildren(),this.ready(ready),!1!==options.reportTouchActivity&&this.enableTouchActivity()}on(type,fn){}off(type,fn){}one(type,fn){}any(type,fn){}trigger(event){}dispose(){let options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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&&(options.restoreEl?this.el_.parentNode.replaceChild(options.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(obj){return obj?(this.options_=merge$2(this.options_,obj),this.options_):this.options_}el(){return this.el_}createEl(tagName,properties,attributes){return createEl(tagName,properties,attributes)}localize(string,tokens){let defaultValue=arguments.length>2&&void 0!==arguments[2]?arguments[2]:string;const code=this.player_.language&&this.player_.language(),languages=this.player_.languages&&this.player_.languages(),language=languages&&languages[code],primaryCode=code&&code.split("-")[0],primaryLang=languages&&languages[primaryCode];let localizedString=defaultValue;return language&&language[string]?localizedString=language[string]:primaryLang&&primaryLang[string]&&(localizedString=primaryLang[string]),tokens&&(localizedString=localizedString.replace(/\{(\d+)\}/g,(function(match,index){const value=tokens[index-1];let ret=value;return void 0===value&&(ret=match),ret}))),localizedString}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(id){return this.childIndex_[id]}getChild(name){if(name)return this.childNameIndex_[name]}getDescendant(){for(var _len14=arguments.length,names=new Array(_len14),_key14=0;_key14<_len14;_key14++)names[_key14]=arguments[_key14];names=names.reduce(((acc,n)=>acc.concat(n)),[]);let currentChild=this;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:{},index=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.children_.length;if("string"==typeof child){componentName=toTitleCase$1(child);const componentClassName=options.componentClass||componentName;options.name=componentName;const ComponentClass=Component$1.getComponent(componentClassName);if(!ComponentClass)throw new Error("Component ".concat(componentClassName," does not exist"));if("function"!=typeof ComponentClass)return null;component=new ComponentClass(this.player_||this,options)}else component=child;if(component.parentComponent_&&component.parentComponent_.removeChild(component),this.children_.splice(index,0,component),component.parentComponent_=this,"function"==typeof component.id&&(this.childIndex_[component.id()]=component),componentName=componentName||component.name&&toTitleCase$1(component.name()),componentName&&(this.childNameIndex_[componentName]=component,this.childNameIndex_[toLowerCase(componentName)]=component),"function"==typeof component.el&&component.el()){let refNode=null;this.children_[index+1]&&(this.children_[index+1].el_?refNode=this.children_[index+1].el_:isEl(this.children_[index+1])&&(refNode=this.children_[index+1])),this.contentEl().insertBefore(component.el(),refNode)}return component}removeChild(component){if("string"==typeof component&&(component=this.getChild(component)),!component||!this.children_)return;let childFound=!1;for(let i=this.children_.length-1;i>=0;i--)if(this.children_[i]===component){childFound=!0,this.children_.splice(i,1);break}if(!childFound)return;component.parentComponent_=null,this.childIndex_[component.id()]=null,this.childNameIndex_[toTitleCase$1(component.name())]=null,this.childNameIndex_[toLowerCase(component.name())]=null;const compEl=component.el();compEl&&compEl.parentNode===this.contentEl()&&this.contentEl().removeChild(component.el())}initChildren(){const children=this.options_.children;if(children){const parentOptions=this.options_,handleAdd=child=>{const name=child.name;let opts=child.opts;if(void 0!==parentOptions[name]&&(opts=parentOptions[name]),!1===opts)return;!0===opts&&(opts={}),opts.playerOptions=this.options_.playerOptions;const newChild=this.addChild(name,opts);newChild&&(this[name]=newChild)};let workingChildren;const Tech=Component$1.getComponent("Tech");workingChildren=Array.isArray(children)?children:Object.keys(children),workingChildren.concat(Object.keys(this.options_).filter((function(child){return!workingChildren.some((function(wchild){return"string"==typeof wchild?child===wchild:child===wchild.name}))}))).map((child=>{let name,opts;return"string"==typeof child?(name=child,opts=children[name]||this.options_[name]||{}):(name=child.name,opts=child),{name:name,opts:opts}})).filter((child=>{const c=Component$1.getComponent(child.opts.componentClass||toTitleCase$1(child.name));return c&&!Tech.isTech(c)})).forEach(handleAdd)}}buildCSSClass(){return""}ready(fn){let sync=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(fn)return this.isReady_?void(sync?fn.call(this):this.setTimeout(fn,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(fn))}triggerReady(){this.isReady_=!0,this.setTimeout((function(){const readyQueue=this.readyQueue_;this.readyQueue_=[],readyQueue&&readyQueue.length>0&&readyQueue.forEach((function(fn){fn.call(this)}),this),this.trigger("ready")}),1)}$(selector,context){return $(selector,context||this.contentEl())}$$(selector,context){return $$(selector,context||this.contentEl())}hasClass(classToCheck){return hasClass(this.el_,classToCheck)}addClass(){for(var _len15=arguments.length,classesToAdd=new Array(_len15),_key15=0;_key15<_len15;_key15++)classesToAdd[_key15]=arguments[_key15];addClass(this.el_,...classesToAdd)}removeClass(){for(var _len16=arguments.length,classesToRemove=new Array(_len16),_key16=0;_key16<_len16;_key16++)classesToRemove[_key16]=arguments[_key16];removeClass(this.el_,...classesToRemove)}toggleClass(classToToggle,predicate){toggleClass(this.el_,classToToggle,predicate)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(attribute){return getAttribute(this.el_,attribute)}setAttribute(attribute,value){setAttribute(this.el_,attribute,value)}removeAttribute(attribute){removeAttribute(this.el_,attribute)}width(num,skipListeners){return this.dimension("width",num,skipListeners)}height(num,skipListeners){return this.dimension("height",num,skipListeners)}dimensions(width,height){this.width(width,!0),this.height(height)}dimension(widthOrHeight,num,skipListeners){if(void 0!==num)return null!==num&&num==num||(num=0),-1!==(""+num).indexOf("%")||-1!==(""+num).indexOf("px")?this.el_.style[widthOrHeight]=num:this.el_.style[widthOrHeight]="auto"===num?"":num+"px",void(skipListeners||this.trigger("componentresize"));if(!this.el_)return 0;const val=this.el_.style[widthOrHeight],pxIndex=val.indexOf("px");return-1!==pxIndex?parseInt(val.slice(0,pxIndex),10):parseInt(this.el_["offset"+toTitleCase$1(widthOrHeight)],10)}currentDimension(widthOrHeight){let computedWidthOrHeight=0;if("width"!==widthOrHeight&&"height"!==widthOrHeight)throw new Error("currentDimension only accepts width or height value");if(computedWidthOrHeight=computedStyle(this.el_,widthOrHeight),computedWidthOrHeight=parseFloat(computedWidthOrHeight),0===computedWidthOrHeight||isNaN(computedWidthOrHeight)){const rule="offset".concat(toTitleCase$1(widthOrHeight));computedWidthOrHeight=this.el_[rule]}return computedWidthOrHeight}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(event){this.player_&&(keycode.isEventKey(event,"Tab")||event.stopPropagation(),this.player_.handleKeyDown(event))}handleKeyPress(event){this.handleKeyDown(event)}emitTapEvents(){let touchStart=0,firstTouch=null;let couldBeTap;this.on("touchstart",(function(event){1===event.touches.length&&(firstTouch={pageX:event.touches[0].pageX,pageY:event.touches[0].pageY},touchStart=window.performance.now(),couldBeTap=!0)})),this.on("touchmove",(function(event){if(event.touches.length>1)couldBeTap=!1;else if(firstTouch){const xdiff=event.touches[0].pageX-firstTouch.pageX,ydiff=event.touches[0].pageY-firstTouch.pageY;Math.sqrt(xdiff*xdiff+ydiff*ydiff)>10&&(couldBeTap=!1)}}));const noTap=function(){couldBeTap=!1};this.on("touchleave",noTap),this.on("touchcancel",noTap),this.on("touchend",(function(event){if(firstTouch=null,!0===couldBeTap){window.performance.now()-touchStart<200&&(event.preventDefault(),this.trigger("tap"))}}))}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const report=bind_(this.player(),this.player().reportUserActivity);let touchHolding;this.on("touchstart",(function(){report(),this.clearInterval(touchHolding),touchHolding=this.setInterval(report,250)}));const touchEnd=function(event){report(),this.clearInterval(touchHolding)};this.on("touchmove",report),this.on("touchend",touchEnd),this.on("touchcancel",touchEnd)}setTimeout(fn,timeout){var timeoutId;return fn=bind_(this,fn),this.clearTimersOnDispose_(),timeoutId=window.setTimeout((()=>{this.setTimeoutIds_.has(timeoutId)&&this.setTimeoutIds_.delete(timeoutId),fn()}),timeout),this.setTimeoutIds_.add(timeoutId),timeoutId}clearTimeout(timeoutId){return this.setTimeoutIds_.has(timeoutId)&&(this.setTimeoutIds_.delete(timeoutId),window.clearTimeout(timeoutId)),timeoutId}setInterval(fn,interval){fn=bind_(this,fn),this.clearTimersOnDispose_();const intervalId=window.setInterval(fn,interval);return this.setIntervalIds_.add(intervalId),intervalId}clearInterval(intervalId){return this.setIntervalIds_.has(intervalId)&&(this.setIntervalIds_.delete(intervalId),window.clearInterval(intervalId)),intervalId}requestAnimationFrame(fn){var id;return this.clearTimersOnDispose_(),fn=bind_(this,fn),id=window.requestAnimationFrame((()=>{this.rafIds_.has(id)&&this.rafIds_.delete(id),fn()})),this.rafIds_.add(id),id}requestNamedAnimationFrame(name,fn){if(this.namedRafs_.has(name))return;this.clearTimersOnDispose_(),fn=bind_(this,fn);const id=this.requestAnimationFrame((()=>{fn(),this.namedRafs_.has(name)&&this.namedRafs_.delete(name)}));return this.namedRafs_.set(name,id),name}cancelNamedAnimationFrame(name){this.namedRafs_.has(name)&&(this.cancelAnimationFrame(this.namedRafs_.get(name)),this.namedRafs_.delete(name))}cancelAnimationFrame(id){return this.rafIds_.has(id)&&(this.rafIds_.delete(id),window.cancelAnimationFrame(id)),id}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((_ref4=>{let[idName,cancelName]=_ref4;this[idName].forEach(((val,key)=>this[cancelName](key)))})),this.clearingTimersOnDispose_=!1})))}static registerComponent(name,ComponentToRegister){if("string"!=typeof name||!name)throw new Error('Illegal component name, "'.concat(name,'"; must be a non-empty string.'));const Tech=Component$1.getComponent("Tech"),isTech=Tech&&Tech.isTech(ComponentToRegister),isComp=Component$1===ComponentToRegister||Component$1.prototype.isPrototypeOf(ComponentToRegister.prototype);if(isTech||!isComp){let reason;throw reason=isTech?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'.concat(name,'"; ').concat(reason,"."))}name=toTitleCase$1(name),Component$1.components_||(Component$1.components_={});const Player=Component$1.getComponent("Player");if("Player"===name&&Player&&Player.players){const players=Player.players,playerNames=Object.keys(players);if(players&&playerNames.length>0&&playerNames.map((pname=>players[pname])).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return Component$1.components_[name]=ComponentToRegister,Component$1.components_[toLowerCase(name)]=ComponentToRegister,ComponentToRegister}static getComponent(name){if(name&&Component$1.components_)return Component$1.components_[name]}}function getRange(fnName,valueIndex,ranges,rangeIndex){return function(fnName,index,maxIndex){if("number"!=typeof index||index<0||index>maxIndex)throw new Error("Failed to execute '".concat(fnName,"' on 'TimeRanges': The index provided (").concat(index,") is non-numeric or out of bounds (0-").concat(maxIndex,")."))}(fnName,rangeIndex,ranges.length-1),ranges[rangeIndex][valueIndex]}function createTimeRangesObj(ranges){let timeRangesObj;return timeRangesObj=void 0===ranges||0===ranges.length?{length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:{length:ranges.length,start:getRange.bind(null,"start",0,ranges),end:getRange.bind(null,"end",1,ranges)},window.Symbol&&window.Symbol.iterator&&(timeRangesObj[window.Symbol.iterator]=()=>(ranges||[]).values()),timeRangesObj}function createTimeRanges$1(start,end){return Array.isArray(start)?createTimeRangesObj(start):void 0===start||void 0===end?createTimeRangesObj():createTimeRangesObj([[start,end]])}Component$1.registerComponent("Component",Component$1);const defaultImplementation=function(seconds,guide){seconds=seconds<0?0:seconds;let s=Math.floor(seconds%60),m=Math.floor(seconds/60%60),h=Math.floor(seconds/3600);const gm=Math.floor(guide/60%60),gh=Math.floor(guide/3600);return(isNaN(seconds)||seconds===1/0)&&(h=m=s="-"),h=h>0||gh>0?h+":":"",m=((h||gm>=10)&&m<10?"0"+m:m)+":",s=s<10?"0"+s:s,h+m+s};let implementation=defaultImplementation;function setFormatTime(customImplementation){implementation=customImplementation}function resetFormatTime(){implementation=defaultImplementation}function formatTime(seconds){let guide=arguments.length>1&&void 0!==arguments[1]?arguments[1]:seconds;return implementation(seconds,guide)}var Time=Object.freeze({__proto__:null,createTimeRanges:createTimeRanges$1,createTimeRange:createTimeRanges$1,setFormatTime:setFormatTime,resetFormatTime:resetFormatTime,formatTime:formatTime});function bufferedPercent(buffered,duration){let start,end,bufferedDuration=0;if(!duration)return 0;buffered&&buffered.length||(buffered=createTimeRanges$1(0,0));for(let i=0;iduration&&(end=duration),bufferedDuration+=end-start;return bufferedDuration/duration}function MediaError(value){if(value instanceof MediaError)return value;"number"==typeof value?this.code=value:"string"==typeof value?this.message=value:isObject$1(value)&&("number"==typeof value.code&&(this.code=value.code),Object.assign(this,value)),this.message||(this.message=MediaError.defaultMessages[this.code]||"")}MediaError.prototype.code=0,MediaError.prototype.message="",MediaError.prototype.status=null,MediaError.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],MediaError.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 errNum=0;errNum{}))}const trackToJson_=function(track){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(((acc,prop,i)=>(track[prop]&&(acc[prop]=track[prop]),acc)),{cues:track.cues&&Array.prototype.map.call(track.cues,(function(cue){return{startTime:cue.startTime,endTime:cue.endTime,text:cue.text,id:cue.id}}))})};var textTrackConverter_textTracksToJson=function(tech){const trackEls=tech.$$("track"),trackObjs=Array.prototype.map.call(trackEls,(t=>t.track));return Array.prototype.map.call(trackEls,(function(trackEl){const json=trackToJson_(trackEl.track);return trackEl.src&&(json.src=trackEl.src),json})).concat(Array.prototype.filter.call(tech.textTracks(),(function(track){return-1===trackObjs.indexOf(track)})).map(trackToJson_))},textTrackConverter_jsonToTextTracks=function(json,tech){return json.forEach((function(track){const addedTrack=tech.addRemoteTextTrack(track).track;!track.src&&track.cues&&track.cues.forEach((cue=>addedTrack.addCue(cue)))})),tech.textTracks()};class ModalDialog extends Component$1{constructor(player,options){super(player,options),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_=createEl("div",{className:"".concat("vjs-modal-dialog","-content")},{role:"document"}),this.descEl_=createEl("p",{className:"".concat("vjs-modal-dialog","-description vjs-control-text"),id:this.el().getAttribute("aria-describedby")}),textContent(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":"".concat(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"".concat("vjs-modal-dialog"," vjs-hidden ").concat(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 player=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!player.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&player.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=player.controls(),player.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}}opened(value){return"boolean"==typeof value&&this[value?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const player=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&player.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&player.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(value){if("boolean"==typeof value){const closeable=this.closeable_=!!value;let close=this.getChild("closeButton");if(closeable&&!close){const temp=this.contentEl_;this.contentEl_=this.el_,close=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=temp,this.on(close,"close",this.close_)}!closeable&&close&&(this.off(close,"close",this.close_),this.removeChild(close),close.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(content){const contentEl=this.contentEl(),parentEl=contentEl.parentNode,nextSiblingEl=contentEl.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,parentEl.removeChild(contentEl),this.empty(),insertContent(contentEl,content),this.trigger("modalfill"),nextSiblingEl?parentEl.insertBefore(contentEl,nextSiblingEl):parentEl.appendChild(contentEl);const closeButton=this.getChild("closeButton");closeButton&&parentEl.appendChild(closeButton.el_)}empty(){this.trigger("beforemodalempty"),emptyEl(this.contentEl()),this.trigger("modalempty")}content(value){return void 0!==value&&(this.content_=value),this.content_}conditionalFocus_(){const activeEl=document.activeElement,playerEl=this.player_.el_;this.previouslyActiveEl_=null,(playerEl.contains(activeEl)||playerEl===activeEl)&&(this.previouslyActiveEl_=activeEl,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(event){if(event.stopPropagation(),keycode.isEventKey(event,"Escape")&&this.closeable())return event.preventDefault(),void this.close();if(!keycode.isEventKey(event,"Tab"))return;const focusableEls=this.focusableEls_(),activeEl=this.el_.querySelector(":focus");let focusIndex;for(let i=0;i(child instanceof window.HTMLAnchorElement||child instanceof window.HTMLAreaElement)&&child.hasAttribute("href")||(child instanceof window.HTMLInputElement||child instanceof window.HTMLSelectElement||child instanceof window.HTMLTextAreaElement||child instanceof window.HTMLButtonElement)&&!child.hasAttribute("disabled")||child instanceof window.HTMLIFrameElement||child instanceof window.HTMLObjectElement||child instanceof window.HTMLEmbedElement||child.hasAttribute("tabindex")&&-1!==child.getAttribute("tabindex")||child.hasAttribute("contenteditable")))}}ModalDialog.prototype.options_={pauseOnOpen:!0,temporary:!0},Component$1.registerComponent("ModalDialog",ModalDialog);class TrackList extends EventTarget$2{constructor(){let tracks=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let i=0;i{this.trigger({track:track,type:"labelchange",target:this})},isEvented(track)&&track.addEventListener("labelchange",track.labelchange_)}removeTrack(rtrack){let track;for(let i=0,l=this.length;ithis.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(rtrack){super.removeTrack(rtrack),rtrack.removeEventListener&&(this.queueChange_&&rtrack.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&rtrack.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class TextTrackCueList{constructor(cues){TextTrackCueList.prototype.setCues_.call(this,cues),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(cues){const oldLength=this.length||0;let i=0;const l=cues.length;this.cues_=cues,this.length_=cues.length;const defineProp=function(index){""+index in this||Object.defineProperty(this,""+index,{get(){return this.cues_[index]}})};if(oldLength0&&void 0!==arguments[0]?arguments[0]:{};super();const trackProps={id:options.id||"vjs_track_"+newGUID(),kind:options.kind||"",language:options.language||""};let label=options.label||"";for(const key in trackProps)Object.defineProperty(this,key,{get:()=>trackProps[key],set(){}});Object.defineProperty(this,"label",{get:()=>label,set(newLabel){newLabel!==label&&(label=newLabel,this.trigger("labelchange"))}})}}const parseUrl=function(url){const props=["protocol","hostname","port","pathname","search","hash","host"],a=document.createElement("a");a.href=url;const details={};for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:window.location;const urlInfo=parseUrl(url),srcProtocol=":"===urlInfo.protocol?winLoc.protocol:urlInfo.protocol,crossOrigin=srcProtocol+urlInfo.host!==winLoc.protocol+winLoc.host;return crossOrigin};var x,Url=Object.freeze({__proto__:null,parseUrl:parseUrl,getAbsoluteURL:getAbsoluteURL,getFileExtension:getFileExtension,isCrossOrigin:isCrossOrigin}),window_1="undefined"!=typeof window?window:void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{},_extends_1=createCommonjsModule((function(module){function _extends(){return module.exports=_extends=Object.assign?Object.assign.bind():function(target){for(var i=1;i=400&&response.statusCode<=599){var cause=responseBody;if(decodeResponseBody)if(window_1.TextDecoder){var charset=function(contentTypeHeader){void 0===contentTypeHeader&&(contentTypeHeader="");return contentTypeHeader.toLowerCase().split(";").reduce((function(charset,contentType){var _contentType$split=contentType.split("="),type=_contentType$split[0],value=_contentType$split[1];return"charset"===type.trim()?value.trim():charset}),"utf-8")}(response.headers&&response.headers["content-type"]);try{cause=new TextDecoder(charset).decode(responseBody)}catch(e){}}else cause=String.fromCharCode.apply(null,new Uint8Array(responseBody));callback({cause:cause})}else callback(null,responseBody)}};createXHR.httpHandler=httpHandler;
+!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define("media_videojs/video-lazy",factory):(global="undefined"!=typeof globalThis?globalThis:global||self).videojs=factory()}(window,(function(){const hooks_={},hooks=function(type,fn){return hooks_[type]=hooks_[type]||[],fn&&(hooks_[type]=hooks_[type].concat(fn)),hooks_[type]},removeHook=function(type,fn){const index=hooks(type).indexOf(fn);return!(index<=-1)&&(hooks_[type]=hooks_[type].slice(),hooks_[type].splice(index,1),!0)},FullscreenApi={prefixed:!0},apiMap=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],specApi=apiMap[0];let browserApi;for(let i=0;i(type,level,args)=>{const lvl=log.levels[level],lvlRegExp=new RegExp("^(".concat(lvl,")$"));let resultName=name;if("log"!==type&&args.unshift(type.toUpperCase()+":"),styles&&(resultName="%c".concat(name),args.unshift(styles)),args.unshift(resultName+":"),history){history.push([].concat(args));const splice=history.length-1e3;history.splice(0,splice>0?splice:0)}if(!window.console)return;let fn=window.console[type];fn||"debug"!==type||(fn=window.console.info||window.console.log),fn&&lvl&&lvlRegExp.test(type)&&fn[Array.isArray(args)?"apply":"call"](window.console,args)};const log$1=function createLogger$1(name){let logByType,delimiter=arguments.length>1&&void 0!==arguments[1]?arguments[1]:":",styles=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",level="info";const log=function(){for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++)args[_key2]=arguments[_key2];logByType("log",level,args)};return logByType=LogByTypeFactory(name,log,styles),log.createLogger=(subName,subDelimiter,subStyles)=>{const resultDelimiter=void 0!==subDelimiter?subDelimiter:delimiter,resultStyles=void 0!==subStyles?subStyles:styles;return createLogger$1("".concat(name," ").concat(resultDelimiter," ").concat(subName),resultDelimiter,resultStyles)},log.createNewLogger=(newName,newDelimiter,newStyles)=>createLogger$1(newName,newDelimiter,newStyles),log.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:level},log.level=lvl=>{if("string"==typeof lvl){if(!log.levels.hasOwnProperty(lvl))throw new Error('"'.concat(lvl,'" in not a valid log level'));level=lvl}return level},log.history=()=>history?[].concat(history):[],log.history.filter=fname=>(history||[]).filter((historyItem=>new RegExp(".*".concat(fname,".*")).test(historyItem[0]))),log.history.clear=()=>{history&&(history.length=0)},log.history.disable=()=>{null!==history&&(history.length=0,history=null)},log.history.enable=()=>{null===history&&(history=[])},log.error=function(){for(var _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++)args[_key3]=arguments[_key3];return logByType("error",level,args)},log.warn=function(){for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++)args[_key4]=arguments[_key4];return logByType("warn",level,args)},log.debug=function(){for(var _len5=arguments.length,args=new Array(_len5),_key5=0;_key5<_len5;_key5++)args[_key5]=arguments[_key5];return logByType("debug",level,args)},log}("VIDEOJS"),createLogger=log$1.createLogger,toString$1=Object.prototype.toString,keys=function(object){return isObject$1(object)?Object.keys(object):[]};function each(object,fn){keys(object).forEach((key=>fn(object[key],key)))}function reduce(object,fn){let initial=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return keys(object).reduce(((accum,key)=>fn(accum,object[key],key)),initial)}function isObject$1(value){return!!value&&"object"==typeof value}function isPlain(value){return isObject$1(value)&&"[object Object]"===toString$1.call(value)&&value.constructor===Object}function merge$2(){const result={};for(var _len6=arguments.length,sources=new Array(_len6),_key6=0;_key6<_len6;_key6++)sources[_key6]=arguments[_key6];return sources.forEach((source=>{source&&each(source,((value,key)=>{isPlain(value)?(isPlain(result[key])||(result[key]={}),result[key]=merge$2(result[key],value)):result[key]=value}))})),result}function values$1(){let source=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const result=[];for(const key in source)if(source.hasOwnProperty(key)){const value=source[key];result.push(value)}return result}function defineLazyProperty(obj,key,getValue){let setter=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const set=value=>Object.defineProperty(obj,key,{value:value,enumerable:!0,writable:!0}),options={configurable:!0,enumerable:!0,get(){const value=getValue();return set(value),value}};return setter&&(options.set=set),Object.defineProperty(obj,key,options)}var Obj=Object.freeze({__proto__:null,each:each,reduce:reduce,isObject:isObject$1,isPlain:isPlain,merge:merge$2,values:values$1,defineLazyProperty:defineLazyProperty});let ANDROID_VERSION,IS_IPOD=!1,IOS_VERSION=null,IS_ANDROID=!1,IS_FIREFOX=!1,IS_EDGE=!1,IS_CHROMIUM=!1,IS_CHROME=!1,CHROMIUM_VERSION=null,CHROME_VERSION=null,IE_VERSION=null,IS_SAFARI=!1,IS_WINDOWS=!1,IS_IPAD=!1,IS_IPHONE=!1;const TOUCH_ENABLED=Boolean(isReal()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch)),UAD=window.navigator&&window.navigator.userAgentData;if(UAD&&UAD.platform&&UAD.brands&&(IS_ANDROID="Android"===UAD.platform,IS_EDGE=Boolean(UAD.brands.find((b=>"Microsoft Edge"===b.brand))),IS_CHROMIUM=Boolean(UAD.brands.find((b=>"Chromium"===b.brand))),IS_CHROME=!IS_EDGE&&IS_CHROMIUM,CHROMIUM_VERSION=CHROME_VERSION=(UAD.brands.find((b=>"Chromium"===b.brand))||{}).version||null,IS_WINDOWS="Windows"===UAD.platform),!IS_CHROMIUM){const USER_AGENT=window.navigator&&window.navigator.userAgent||"";IS_IPOD=/iPod/i.test(USER_AGENT),IOS_VERSION=function(){const match=USER_AGENT.match(/OS (\d+)_/i);return match&&match[1]?match[1]:null}(),IS_ANDROID=/Android/i.test(USER_AGENT),ANDROID_VERSION=function(){const match=USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!match)return null;const major=match[1]&&parseFloat(match[1]),minor=match[2]&&parseFloat(match[2]);return major&&minor?parseFloat(match[1]+"."+match[2]):major||null}(),IS_FIREFOX=/Firefox/i.test(USER_AGENT),IS_EDGE=/Edg/i.test(USER_AGENT),IS_CHROMIUM=/Chrome/i.test(USER_AGENT)||/CriOS/i.test(USER_AGENT),IS_CHROME=!IS_EDGE&&IS_CHROMIUM,CHROMIUM_VERSION=CHROME_VERSION=function(){const match=USER_AGENT.match(/(Chrome|CriOS)\/(\d+)/);return match&&match[2]?parseFloat(match[2]):null}(),IE_VERSION=function(){const result=/MSIE\s(\d+)\.\d/.exec(USER_AGENT);let version=result&&parseFloat(result[1]);return!version&&/Trident\/7.0/i.test(USER_AGENT)&&/rv:11.0/.test(USER_AGENT)&&(version=11),version}(),IS_SAFARI=/Safari/i.test(USER_AGENT)&&!IS_CHROME&&!IS_ANDROID&&!IS_EDGE,IS_WINDOWS=/Windows/i.test(USER_AGENT),IS_IPAD=/iPad/i.test(USER_AGENT)||IS_SAFARI&&TOUCH_ENABLED&&!/iPhone/i.test(USER_AGENT),IS_IPHONE=/iPhone/i.test(USER_AGENT)&&!IS_IPAD}const IS_IOS=IS_IPHONE||IS_IPAD||IS_IPOD,IS_ANY_SAFARI=(IS_SAFARI||IS_IOS)&&!IS_CHROME;var browser=Object.freeze({__proto__:null,get IS_IPOD(){return IS_IPOD},get IOS_VERSION(){return IOS_VERSION},get IS_ANDROID(){return IS_ANDROID},get ANDROID_VERSION(){return ANDROID_VERSION},get IS_FIREFOX(){return IS_FIREFOX},get IS_EDGE(){return IS_EDGE},get IS_CHROMIUM(){return IS_CHROMIUM},get IS_CHROME(){return IS_CHROME},get CHROMIUM_VERSION(){return CHROMIUM_VERSION},get CHROME_VERSION(){return CHROME_VERSION},get IE_VERSION(){return IE_VERSION},get IS_SAFARI(){return IS_SAFARI},get IS_WINDOWS(){return IS_WINDOWS},get IS_IPAD(){return IS_IPAD},get IS_IPHONE(){return IS_IPHONE},TOUCH_ENABLED:TOUCH_ENABLED,IS_IOS:IS_IOS,IS_ANY_SAFARI:IS_ANY_SAFARI});function isNonBlankString(str){return"string"==typeof str&&Boolean(str.trim())}function isReal(){return document===window.document}function isEl(value){return isObject$1(value)&&1===value.nodeType}function isInFrame(){try{return window.parent!==window.self}catch(x){return!0}}function createQuerier(method){return function(selector,context){if(!isNonBlankString(selector))return document[method](null);isNonBlankString(context)&&(context=document.querySelector(context));const ctx=isEl(context)?context:document;return ctx[method]&&ctx[method](selector)}}function createEl(){let tagName=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",properties=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},content=arguments.length>3?arguments[3]:void 0;const el=document.createElement(tagName);return Object.getOwnPropertyNames(properties).forEach((function(propName){const val=properties[propName];"textContent"===propName?textContent(el,val):el[propName]===val&&"tabIndex"!==propName||(el[propName]=val)})),Object.getOwnPropertyNames(attributes).forEach((function(attrName){el.setAttribute(attrName,attributes[attrName])})),content&&appendContent(el,content),el}function textContent(el,text){return void 0===el.textContent?el.innerText=text:el.textContent=text,el}function prependTo(child,parent){parent.firstChild?parent.insertBefore(child,parent.firstChild):parent.appendChild(child)}function hasClass(element,classToCheck){return function(str){if(str.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}(classToCheck),element.classList.contains(classToCheck)}function addClass(element){for(var _len7=arguments.length,classesToAdd=new Array(_len7>1?_len7-1:0),_key7=1;_key7<_len7;_key7++)classesToAdd[_key7-1]=arguments[_key7];return element.classList.add(...classesToAdd.reduce(((prev,current)=>prev.concat(current.split(/\s+/))),[])),element}function removeClass(element){if(!element)return log$1.warn("removeClass was called with an element that doesn't exist"),null;for(var _len8=arguments.length,classesToRemove=new Array(_len8>1?_len8-1:0),_key8=1;_key8<_len8;_key8++)classesToRemove[_key8-1]=arguments[_key8];return element.classList.remove(...classesToRemove.reduce(((prev,current)=>prev.concat(current.split(/\s+/))),[])),element}function toggleClass(element,classToToggle,predicate){return"function"==typeof predicate&&(predicate=predicate(element,classToToggle)),"boolean"!=typeof predicate&&(predicate=void 0),classToToggle.split(/\s+/).forEach((className=>element.classList.toggle(className,predicate))),element}function setAttributes(el,attributes){Object.getOwnPropertyNames(attributes).forEach((function(attrName){const attrValue=attributes[attrName];null==attrValue||!1===attrValue?el.removeAttribute(attrName):el.setAttribute(attrName,!0===attrValue?"":attrValue)}))}function getAttributes(tag){const obj={},knownBooleans=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(tag&&tag.attributes&&tag.attributes.length>0){const attrs=tag.attributes;for(let i=attrs.length-1;i>=0;i--){const attrName=attrs[i].name;let attrVal=attrs[i].value;knownBooleans.includes(attrName)&&(attrVal=null!==attrVal),obj[attrName]=attrVal}}return obj}function getAttribute(el,attribute){return el.getAttribute(attribute)}function setAttribute(el,attribute,value){el.setAttribute(attribute,value)}function removeAttribute(el,attribute){el.removeAttribute(attribute)}function blockTextSelection(){document.body.focus(),document.onselectstart=function(){return!1}}function unblockTextSelection(){document.onselectstart=function(){return!0}}function getBoundingClientRect(el){if(el&&el.getBoundingClientRect&&el.parentNode){const rect=el.getBoundingClientRect(),result={};return["bottom","height","left","right","top","width"].forEach((k=>{void 0!==rect[k]&&(result[k]=rect[k])})),result.height||(result.height=parseFloat(computedStyle(el,"height"))),result.width||(result.width=parseFloat(computedStyle(el,"width"))),result}}function findPosition(el){if(!el||el&&!el.offsetParent)return{left:0,top:0,width:0,height:0};const width=el.offsetWidth,height=el.offsetHeight;let left=0,top=0;for(;el.offsetParent&&el!==document[FullscreenApi.fullscreenElement];)left+=el.offsetLeft,top+=el.offsetTop,el=el.offsetParent;return{left:left,top:top,width:width,height:height}}function getPointerPosition(el,event){const translated={x:0,y:0};if(IS_IOS){let item=el;for(;item&&"html"!==item.nodeName.toLowerCase();){const transform=computedStyle(item,"transform");if(/^matrix/.test(transform)){const values=transform.slice(7,-1).split(/,\s/).map(Number);translated.x+=values[4],translated.y+=values[5]}else if(/^matrix3d/.test(transform)){const values=transform.slice(9,-1).split(/,\s/).map(Number);translated.x+=values[12],translated.y+=values[13]}item=item.parentNode}}const position={},boxTarget=findPosition(event.target),box=findPosition(el),boxW=box.width,boxH=box.height;let offsetY=event.offsetY-(box.top-boxTarget.top),offsetX=event.offsetX-(box.left-boxTarget.left);return event.changedTouches&&(offsetX=event.changedTouches[0].pageX-box.left,offsetY=event.changedTouches[0].pageY+box.top,IS_IOS&&(offsetX-=translated.x,offsetY-=translated.y)),position.y=1-Math.max(0,Math.min(1,offsetY/boxH)),position.x=Math.max(0,Math.min(1,offsetX/boxW)),position}function isTextNode$1(value){return isObject$1(value)&&3===value.nodeType}function emptyEl(el){for(;el.firstChild;)el.removeChild(el.firstChild);return el}function normalizeContent(content){return"function"==typeof content&&(content=content()),(Array.isArray(content)?content:[content]).map((value=>("function"==typeof value&&(value=value()),isEl(value)||isTextNode$1(value)?value:"string"==typeof value&&/\S/.test(value)?document.createTextNode(value):void 0))).filter((value=>value))}function appendContent(el,content){return normalizeContent(content).forEach((node=>el.appendChild(node))),el}function insertContent(el,content){return appendContent(emptyEl(el),content)}function isSingleLeftClick(event){return void 0===event.button&&void 0===event.buttons||(0===event.button&&void 0===event.buttons||("mouseup"===event.type&&0===event.button&&0===event.buttons||0===event.button&&1===event.buttons))}const $=createQuerier("querySelector"),$$=createQuerier("querySelectorAll");function computedStyle(el,prop){if(!el||!prop)return"";if("function"==typeof window.getComputedStyle){let computedStyleValue;try{computedStyleValue=window.getComputedStyle(el)}catch(e){return""}return computedStyleValue?computedStyleValue.getPropertyValue(prop)||computedStyleValue[prop]:""}return""}function copyStyleSheetsToWindow(win){[...document.styleSheets].forEach((styleSheet=>{try{const cssRules=[...styleSheet.cssRules].map((rule=>rule.cssText)).join(""),style=document.createElement("style");style.textContent=cssRules,win.document.head.appendChild(style)}catch(e){const link=document.createElement("link");link.rel="stylesheet",link.type=styleSheet.type,link.media=styleSheet.media.mediaText,link.href=styleSheet.href,win.document.head.appendChild(link)}}))}var Dom=Object.freeze({__proto__:null,isReal:isReal,isEl:isEl,isInFrame:isInFrame,createEl:createEl,textContent:textContent,prependTo:prependTo,hasClass:hasClass,addClass:addClass,removeClass:removeClass,toggleClass:toggleClass,setAttributes:setAttributes,getAttributes:getAttributes,getAttribute:getAttribute,setAttribute:setAttribute,removeAttribute:removeAttribute,blockTextSelection:blockTextSelection,unblockTextSelection:unblockTextSelection,getBoundingClientRect:getBoundingClientRect,findPosition:findPosition,getPointerPosition:getPointerPosition,isTextNode:isTextNode$1,emptyEl:emptyEl,normalizeContent:normalizeContent,appendContent:appendContent,insertContent:insertContent,isSingleLeftClick:isSingleLeftClick,$:$,$$:$$,computedStyle:computedStyle,copyStyleSheetsToWindow:copyStyleSheetsToWindow});let videojs$1,_windowLoaded=!1;const autoSetup=function(){if(!1===videojs$1.options.autoSetup)return;const vids=Array.prototype.slice.call(document.getElementsByTagName("video")),audios=Array.prototype.slice.call(document.getElementsByTagName("audio")),divs=Array.prototype.slice.call(document.getElementsByTagName("video-js")),mediaEls=vids.concat(audios,divs);if(mediaEls&&mediaEls.length>0)for(let i=0,e=mediaEls.length;i-1&&(options={passive:!0}),elem.addEventListener(type,data.dispatcher,options)}else elem.attachEvent&&elem.attachEvent("on"+type,data.dispatcher)}function off(elem,type,fn){if(!DomData.has(elem))return;const data=DomData.get(elem);if(!data.handlers)return;if(Array.isArray(type))return _handleMultipleEvents(off,elem,type,fn);const removeType=function(el,t){data.handlers[t]=[],_cleanUpEvents(el,t)};if(void 0===type){for(const t in data.handlers)Object.prototype.hasOwnProperty.call(data.handlers||{},t)&&removeType(elem,t);return}const handlers=data.handlers[type];if(handlers)if(fn){if(fn.guid)for(let n=0;n=wait&&(fn(...arguments),last=now)}},debounce=function(func,wait,immediate){let timeout,context=arguments.length>3&&void 0!==arguments[3]?arguments[3]:window;const cancel=()=>{context.clearTimeout(timeout),timeout=null},debounced=function(){const self=this,args=arguments;let later=function(){timeout=null,later=null,immediate||func.apply(self,args)};!timeout&&immediate&&func.apply(self,args),context.clearTimeout(timeout),timeout=context.setTimeout(later,wait)};return debounced.cancel=cancel,debounced};var Fn=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:bind_,throttle:throttle,debounce:debounce});let EVENT_MAP;class EventTarget$2{on(type,fn){const ael=this.addEventListener;this.addEventListener=()=>{},on(this,type,fn),this.addEventListener=ael}off(type,fn){off(this,type,fn)}one(type,fn){const ael=this.addEventListener;this.addEventListener=()=>{},one(this,type,fn),this.addEventListener=ael}any(type,fn){const ael=this.addEventListener;this.addEventListener=()=>{},any(this,type,fn),this.addEventListener=ael}trigger(event){const type=event.type||event;"string"==typeof event&&(event={type:type}),event=fixEvent(event),this.allowedEvents_[type]&&this["on"+type]&&this["on"+type](event),trigger(this,event)}queueTrigger(event){EVENT_MAP||(EVENT_MAP=new Map);const type=event.type||event;let map=EVENT_MAP.get(this);map||(map=new Map,EVENT_MAP.set(this,map));const oldTimeout=map.get(type);map.delete(type),window.clearTimeout(oldTimeout);const timeout=window.setTimeout((()=>{map.delete(type),0===map.size&&(map=null,EVENT_MAP.delete(this)),this.trigger(event)}),0);map.set(type,timeout)}}EventTarget$2.prototype.allowedEvents_={},EventTarget$2.prototype.addEventListener=EventTarget$2.prototype.on,EventTarget$2.prototype.removeEventListener=EventTarget$2.prototype.off,EventTarget$2.prototype.dispatchEvent=EventTarget$2.prototype.trigger;const objName=obj=>"function"==typeof obj.name?obj.name():"string"==typeof obj.name?obj.name:obj.name_?obj.name_:obj.constructor&&obj.constructor.name?obj.constructor.name:typeof obj,isEvented=object=>object instanceof EventTarget$2||!!object.eventBusEl_&&["on","one","off","trigger"].every((k=>"function"==typeof object[k])),isValidEventType=type=>"string"==typeof type&&/\S/.test(type)||Array.isArray(type)&&!!type.length,validateTarget=(target,obj,fnName)=>{if(!target||!target.nodeName&&!isEvented(target))throw new Error("Invalid target for ".concat(objName(obj),"#").concat(fnName,"; must be a DOM node or evented object."))},validateEventType=(type,obj,fnName)=>{if(!isValidEventType(type))throw new Error("Invalid event type for ".concat(objName(obj),"#").concat(fnName,"; must be a non-empty string or array."))},validateListener=(listener,obj,fnName)=>{if("function"!=typeof listener)throw new Error("Invalid listener for ".concat(objName(obj),"#").concat(fnName,"; must be a function."))},normalizeListenArgs=(self,args,fnName)=>{const isTargetingSelf=args.length<3||args[0]===self||args[0]===self.eventBusEl_;let target,type,listener;return isTargetingSelf?(target=self.eventBusEl_,args.length>=3&&args.shift(),[type,listener]=args):[target,type,listener]=args,validateTarget(target,self,fnName),validateEventType(type,self,fnName),validateListener(listener,self,fnName),listener=bind_(self,listener),{isTargetingSelf:isTargetingSelf,target:target,type:type,listener:listener}},listen=(target,method,type,listener)=>{validateTarget(target,target,method),target.nodeName?Events[method](target,type,listener):target[method](type,listener)},EventedMixin={on(){for(var _len9=arguments.length,args=new Array(_len9),_key9=0;_key9<_len9;_key9++)args[_key9]=arguments[_key9];const{isTargetingSelf:isTargetingSelf,target:target,type:type,listener:listener}=normalizeListenArgs(this,args,"on");if(listen(target,"on",type,listener),!isTargetingSelf){const removeListenerOnDispose=()=>this.off(target,type,listener);removeListenerOnDispose.guid=listener.guid;const removeRemoverOnTargetDispose=()=>this.off("dispose",removeListenerOnDispose);removeRemoverOnTargetDispose.guid=listener.guid,listen(this,"on","dispose",removeListenerOnDispose),listen(target,"on","dispose",removeRemoverOnTargetDispose)}},one(){for(var _this=this,_len10=arguments.length,args=new Array(_len10),_key10=0;_key10<_len10;_key10++)args[_key10]=arguments[_key10];const{isTargetingSelf:isTargetingSelf,target:target,type:type,listener:listener}=normalizeListenArgs(this,args,"one");if(isTargetingSelf)listen(target,"one",type,listener);else{const wrapper=function(){_this.off(target,type,wrapper);for(var _len11=arguments.length,largs=new Array(_len11),_key11=0;_key11<_len11;_key11++)largs[_key11]=arguments[_key11];listener.apply(null,largs)};wrapper.guid=listener.guid,listen(target,"one",type,wrapper)}},any(){for(var _this2=this,_len12=arguments.length,args=new Array(_len12),_key12=0;_key12<_len12;_key12++)args[_key12]=arguments[_key12];const{isTargetingSelf:isTargetingSelf,target:target,type:type,listener:listener}=normalizeListenArgs(this,args,"any");if(isTargetingSelf)listen(target,"any",type,listener);else{const wrapper=function(){_this2.off(target,type,wrapper);for(var _len13=arguments.length,largs=new Array(_len13),_key13=0;_key13<_len13;_key13++)largs[_key13]=arguments[_key13];listener.apply(null,largs)};wrapper.guid=listener.guid,listen(target,"any",type,wrapper)}},off(targetOrType,typeOrListener,listener){if(!targetOrType||isValidEventType(targetOrType))off(this.eventBusEl_,targetOrType,typeOrListener);else{const target=targetOrType,type=typeOrListener;validateTarget(target,this,"off"),validateEventType(type,this,"off"),validateListener(listener,this,"off"),listener=bind_(this,listener),this.off("dispose",listener),target.nodeName?(off(target,type,listener),off(target,"dispose",listener)):isEvented(target)&&(target.off(type,listener),target.off("dispose",listener))}},trigger(event,hash){validateTarget(this.eventBusEl_,this,"trigger");const type=event&&"string"!=typeof event?event.type:event;if(!isValidEventType(type))throw new Error("Invalid event type for ".concat(objName(this),"#trigger; ")+"must be a non-empty string or object with a type key that has a non-empty value.");return trigger(this.eventBusEl_,event,hash)}};function evented(target){let options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{eventBusKey:eventBusKey}=options;if(eventBusKey){if(!target[eventBusKey].nodeName)throw new Error('The eventBusKey "'.concat(eventBusKey,'" does not refer to an element.'));target.eventBusEl_=target[eventBusKey]}else target.eventBusEl_=createEl("span",{className:"vjs-event-bus"});return Object.assign(target,EventedMixin),target.eventedCallbacks&&target.eventedCallbacks.forEach((callback=>{callback()})),target.on("dispose",(()=>{target.off(),[target,target.el_,target.eventBusEl_].forEach((function(val){val&&DomData.has(val)&&DomData.delete(val)})),window.setTimeout((()=>{target.eventBusEl_=null}),0)})),target}const StatefulMixin={state:{},setState(stateUpdates){let changes;return"function"==typeof stateUpdates&&(stateUpdates=stateUpdates()),each(stateUpdates,((value,key)=>{this.state[key]!==value&&(changes=changes||{},changes[key]={from:this.state[key],to:value}),this.state[key]=value})),changes&&isEvented(this)&&this.trigger({changes:changes,type:"statechanged"}),changes}};function stateful(target,defaultState){return Object.assign(target,StatefulMixin),target.state=Object.assign({},target.state,defaultState),"function"==typeof target.handleStateChanged&&isEvented(target)&&target.on("statechanged",target.handleStateChanged),target}const toLowerCase=function(string){return"string"!=typeof string?string:string.replace(/./,(w=>w.toLowerCase()))},toTitleCase$1=function(string){return"string"!=typeof string?string:string.replace(/./,(w=>w.toUpperCase()))},titleCaseEquals=function(str1,str2){return toTitleCase$1(str1)===toTitleCase$1(str2)};var Str=Object.freeze({__proto__:null,toLowerCase:toLowerCase,toTitleCase:toTitleCase$1,titleCaseEquals:titleCaseEquals}),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(fn,module){return fn(module={exports:{}},module.exports),module.exports}var keycode=createCommonjsModule((function(module,exports){function keyCode(searchInput){if(searchInput&&"object"==typeof searchInput){var hasKeyCode=searchInput.which||searchInput.keyCode||searchInput.charCode;hasKeyCode&&(searchInput=hasKeyCode)}if("number"==typeof searchInput)return names[searchInput];var foundNamedKey,search=String(searchInput);return(foundNamedKey=codes[search.toLowerCase()])?foundNamedKey:(foundNamedKey=aliases[search.toLowerCase()])||(1===search.length?search.charCodeAt(0):void 0)}keyCode.isEventKey=function(event,nameOrCode){if(event&&"object"==typeof event){var keyCode=event.which||event.keyCode||event.charCode;if(null==keyCode)return!1;if("string"==typeof nameOrCode){var foundNamedKey;if(foundNamedKey=codes[nameOrCode.toLowerCase()])return foundNamedKey===keyCode;if(foundNamedKey=aliases[nameOrCode.toLowerCase()])return foundNamedKey===keyCode}else if("number"==typeof nameOrCode)return nameOrCode===keyCode;return!1}};var codes=(exports=module.exports=keyCode).code=exports.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},aliases=exports.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(i=97;i<123;i++)codes[String.fromCharCode(i)]=i-32;for(var i=48;i<58;i++)codes[i-48]=i;for(i=1;i<13;i++)codes["f"+i]=i+111;for(i=0;i<10;i++)codes["numpad "+i]=i+96;var names=exports.names=exports.title={};for(i in codes)names[codes[i]]=i;for(var alias in aliases)codes[alias]=aliases[alias]}));keycode.code,keycode.codes,keycode.aliases,keycode.names,keycode.title;class Component$1{constructor(player,options,ready){if(!player&&this.play?this.player_=player=this:this.player_=player,this.isDisposed_=!1,this.parentComponent_=null,this.options_=merge$2({},this.options_),options=this.options_=merge$2(this.options_,options),this.id_=options.id||options.el&&options.el.id,!this.id_){const id=player&&player.id&&player.id()||"no_player";this.id_="".concat(id,"_component_").concat(newGUID())}this.name_=options.name||null,options.el?this.el_=options.el:!1!==options.createEl&&(this.el_=this.createEl()),options.className&&this.el_&&options.className.split(" ").forEach((c=>this.addClass(c))),["on","off","one","any","trigger"].forEach((fn=>{this[fn]=void 0})),!1!==options.evented&&(evented(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),stateful(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!==options.initChildren&&this.initChildren(),this.ready(ready),!1!==options.reportTouchActivity&&this.enableTouchActivity()}on(type,fn){}off(type,fn){}one(type,fn){}any(type,fn){}trigger(event,hash){}dispose(){let options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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&&(options.restoreEl?this.el_.parentNode.replaceChild(options.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(obj){return obj?(this.options_=merge$2(this.options_,obj),this.options_):this.options_}el(){return this.el_}createEl(tagName,properties,attributes){return createEl(tagName,properties,attributes)}localize(string,tokens){let defaultValue=arguments.length>2&&void 0!==arguments[2]?arguments[2]:string;const code=this.player_.language&&this.player_.language(),languages=this.player_.languages&&this.player_.languages(),language=languages&&languages[code],primaryCode=code&&code.split("-")[0],primaryLang=languages&&languages[primaryCode];let localizedString=defaultValue;return language&&language[string]?localizedString=language[string]:primaryLang&&primaryLang[string]&&(localizedString=primaryLang[string]),tokens&&(localizedString=localizedString.replace(/\{(\d+)\}/g,(function(match,index){const value=tokens[index-1];let ret=value;return void 0===value&&(ret=match),ret}))),localizedString}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(id){return this.childIndex_[id]}getChild(name){if(name)return this.childNameIndex_[name]}getDescendant(){for(var _len14=arguments.length,names=new Array(_len14),_key14=0;_key14<_len14;_key14++)names[_key14]=arguments[_key14];names=names.reduce(((acc,n)=>acc.concat(n)),[]);let currentChild=this;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:this.el();if(!this.player_.options_.experimentalSvgIcons)return;const xmlnsURL="http://www.w3.org/2000/svg",iconContainer=createEl("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),svgEl=document.createElementNS(xmlnsURL,"svg");svgEl.setAttributeNS(null,"viewBox","0 0 512 512");const useEl=document.createElementNS(xmlnsURL,"use");return svgEl.appendChild(useEl),useEl.setAttributeNS(null,"href","#vjs-icon-".concat(iconName)),iconContainer.appendChild(svgEl),this.iconIsSet_?el.replaceChild(iconContainer,el.querySelector(".vjs-icon-placeholder")):el.appendChild(iconContainer),this.iconIsSet_=!0,iconContainer}addChild(child){let component,componentName,options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},index=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.children_.length;if("string"==typeof child){componentName=toTitleCase$1(child);const componentClassName=options.componentClass||componentName;options.name=componentName;const ComponentClass=Component$1.getComponent(componentClassName);if(!ComponentClass)throw new Error("Component ".concat(componentClassName," does not exist"));if("function"!=typeof ComponentClass)return null;component=new ComponentClass(this.player_||this,options)}else component=child;if(component.parentComponent_&&component.parentComponent_.removeChild(component),this.children_.splice(index,0,component),component.parentComponent_=this,"function"==typeof component.id&&(this.childIndex_[component.id()]=component),componentName=componentName||component.name&&toTitleCase$1(component.name()),componentName&&(this.childNameIndex_[componentName]=component,this.childNameIndex_[toLowerCase(componentName)]=component),"function"==typeof component.el&&component.el()){let refNode=null;this.children_[index+1]&&(this.children_[index+1].el_?refNode=this.children_[index+1].el_:isEl(this.children_[index+1])&&(refNode=this.children_[index+1])),this.contentEl().insertBefore(component.el(),refNode)}return component}removeChild(component){if("string"==typeof component&&(component=this.getChild(component)),!component||!this.children_)return;let childFound=!1;for(let i=this.children_.length-1;i>=0;i--)if(this.children_[i]===component){childFound=!0,this.children_.splice(i,1);break}if(!childFound)return;component.parentComponent_=null,this.childIndex_[component.id()]=null,this.childNameIndex_[toTitleCase$1(component.name())]=null,this.childNameIndex_[toLowerCase(component.name())]=null;const compEl=component.el();compEl&&compEl.parentNode===this.contentEl()&&this.contentEl().removeChild(component.el())}initChildren(){const children=this.options_.children;if(children){const parentOptions=this.options_,handleAdd=child=>{const name=child.name;let opts=child.opts;if(void 0!==parentOptions[name]&&(opts=parentOptions[name]),!1===opts)return;!0===opts&&(opts={}),opts.playerOptions=this.options_.playerOptions;const newChild=this.addChild(name,opts);newChild&&(this[name]=newChild)};let workingChildren;const Tech=Component$1.getComponent("Tech");workingChildren=Array.isArray(children)?children:Object.keys(children),workingChildren.concat(Object.keys(this.options_).filter((function(child){return!workingChildren.some((function(wchild){return"string"==typeof wchild?child===wchild:child===wchild.name}))}))).map((child=>{let name,opts;return"string"==typeof child?(name=child,opts=children[name]||this.options_[name]||{}):(name=child.name,opts=child),{name:name,opts:opts}})).filter((child=>{const c=Component$1.getComponent(child.opts.componentClass||toTitleCase$1(child.name));return c&&!Tech.isTech(c)})).forEach(handleAdd)}}buildCSSClass(){return""}ready(fn){let sync=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(fn)return this.isReady_?void(sync?fn.call(this):this.setTimeout(fn,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(fn))}triggerReady(){this.isReady_=!0,this.setTimeout((function(){const readyQueue=this.readyQueue_;this.readyQueue_=[],readyQueue&&readyQueue.length>0&&readyQueue.forEach((function(fn){fn.call(this)}),this),this.trigger("ready")}),1)}$(selector,context){return $(selector,context||this.contentEl())}$$(selector,context){return $$(selector,context||this.contentEl())}hasClass(classToCheck){return hasClass(this.el_,classToCheck)}addClass(){for(var _len15=arguments.length,classesToAdd=new Array(_len15),_key15=0;_key15<_len15;_key15++)classesToAdd[_key15]=arguments[_key15];addClass(this.el_,...classesToAdd)}removeClass(){for(var _len16=arguments.length,classesToRemove=new Array(_len16),_key16=0;_key16<_len16;_key16++)classesToRemove[_key16]=arguments[_key16];removeClass(this.el_,...classesToRemove)}toggleClass(classToToggle,predicate){toggleClass(this.el_,classToToggle,predicate)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(attribute){return getAttribute(this.el_,attribute)}setAttribute(attribute,value){setAttribute(this.el_,attribute,value)}removeAttribute(attribute){removeAttribute(this.el_,attribute)}width(num,skipListeners){return this.dimension("width",num,skipListeners)}height(num,skipListeners){return this.dimension("height",num,skipListeners)}dimensions(width,height){this.width(width,!0),this.height(height)}dimension(widthOrHeight,num,skipListeners){if(void 0!==num)return null!==num&&num==num||(num=0),-1!==(""+num).indexOf("%")||-1!==(""+num).indexOf("px")?this.el_.style[widthOrHeight]=num:this.el_.style[widthOrHeight]="auto"===num?"":num+"px",void(skipListeners||this.trigger("componentresize"));if(!this.el_)return 0;const val=this.el_.style[widthOrHeight],pxIndex=val.indexOf("px");return-1!==pxIndex?parseInt(val.slice(0,pxIndex),10):parseInt(this.el_["offset"+toTitleCase$1(widthOrHeight)],10)}currentDimension(widthOrHeight){let computedWidthOrHeight=0;if("width"!==widthOrHeight&&"height"!==widthOrHeight)throw new Error("currentDimension only accepts width or height value");if(computedWidthOrHeight=computedStyle(this.el_,widthOrHeight),computedWidthOrHeight=parseFloat(computedWidthOrHeight),0===computedWidthOrHeight||isNaN(computedWidthOrHeight)){const rule="offset".concat(toTitleCase$1(widthOrHeight));computedWidthOrHeight=this.el_[rule]}return computedWidthOrHeight}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(event){this.player_&&(keycode.isEventKey(event,"Tab")||event.stopPropagation(),this.player_.handleKeyDown(event))}handleKeyPress(event){this.handleKeyDown(event)}emitTapEvents(){let touchStart=0,firstTouch=null;let couldBeTap;this.on("touchstart",(function(event){1===event.touches.length&&(firstTouch={pageX:event.touches[0].pageX,pageY:event.touches[0].pageY},touchStart=window.performance.now(),couldBeTap=!0)})),this.on("touchmove",(function(event){if(event.touches.length>1)couldBeTap=!1;else if(firstTouch){const xdiff=event.touches[0].pageX-firstTouch.pageX,ydiff=event.touches[0].pageY-firstTouch.pageY;Math.sqrt(xdiff*xdiff+ydiff*ydiff)>10&&(couldBeTap=!1)}}));const noTap=function(){couldBeTap=!1};this.on("touchleave",noTap),this.on("touchcancel",noTap),this.on("touchend",(function(event){if(firstTouch=null,!0===couldBeTap){window.performance.now()-touchStart<200&&(event.preventDefault(),this.trigger("tap"))}}))}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const report=bind_(this.player(),this.player().reportUserActivity);let touchHolding;this.on("touchstart",(function(){report(),this.clearInterval(touchHolding),touchHolding=this.setInterval(report,250)}));const touchEnd=function(event){report(),this.clearInterval(touchHolding)};this.on("touchmove",report),this.on("touchend",touchEnd),this.on("touchcancel",touchEnd)}setTimeout(fn,timeout){var timeoutId;return fn=bind_(this,fn),this.clearTimersOnDispose_(),timeoutId=window.setTimeout((()=>{this.setTimeoutIds_.has(timeoutId)&&this.setTimeoutIds_.delete(timeoutId),fn()}),timeout),this.setTimeoutIds_.add(timeoutId),timeoutId}clearTimeout(timeoutId){return this.setTimeoutIds_.has(timeoutId)&&(this.setTimeoutIds_.delete(timeoutId),window.clearTimeout(timeoutId)),timeoutId}setInterval(fn,interval){fn=bind_(this,fn),this.clearTimersOnDispose_();const intervalId=window.setInterval(fn,interval);return this.setIntervalIds_.add(intervalId),intervalId}clearInterval(intervalId){return this.setIntervalIds_.has(intervalId)&&(this.setIntervalIds_.delete(intervalId),window.clearInterval(intervalId)),intervalId}requestAnimationFrame(fn){var id;return this.clearTimersOnDispose_(),fn=bind_(this,fn),id=window.requestAnimationFrame((()=>{this.rafIds_.has(id)&&this.rafIds_.delete(id),fn()})),this.rafIds_.add(id),id}requestNamedAnimationFrame(name,fn){if(this.namedRafs_.has(name))return;this.clearTimersOnDispose_(),fn=bind_(this,fn);const id=this.requestAnimationFrame((()=>{fn(),this.namedRafs_.has(name)&&this.namedRafs_.delete(name)}));return this.namedRafs_.set(name,id),name}cancelNamedAnimationFrame(name){this.namedRafs_.has(name)&&(this.cancelAnimationFrame(this.namedRafs_.get(name)),this.namedRafs_.delete(name))}cancelAnimationFrame(id){return this.rafIds_.has(id)&&(this.rafIds_.delete(id),window.cancelAnimationFrame(id)),id}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((_ref4=>{let[idName,cancelName]=_ref4;this[idName].forEach(((val,key)=>this[cancelName](key)))})),this.clearingTimersOnDispose_=!1})))}static registerComponent(name,ComponentToRegister){if("string"!=typeof name||!name)throw new Error('Illegal component name, "'.concat(name,'"; must be a non-empty string.'));const Tech=Component$1.getComponent("Tech"),isTech=Tech&&Tech.isTech(ComponentToRegister),isComp=Component$1===ComponentToRegister||Component$1.prototype.isPrototypeOf(ComponentToRegister.prototype);if(isTech||!isComp){let reason;throw reason=isTech?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'.concat(name,'"; ').concat(reason,"."))}name=toTitleCase$1(name),Component$1.components_||(Component$1.components_={});const Player=Component$1.getComponent("Player");if("Player"===name&&Player&&Player.players){const players=Player.players,playerNames=Object.keys(players);if(players&&playerNames.length>0&&playerNames.map((pname=>players[pname])).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return Component$1.components_[name]=ComponentToRegister,Component$1.components_[toLowerCase(name)]=ComponentToRegister,ComponentToRegister}static getComponent(name){if(name&&Component$1.components_)return Component$1.components_[name]}}function getRange(fnName,valueIndex,ranges,rangeIndex){return function(fnName,index,maxIndex){if("number"!=typeof index||index<0||index>maxIndex)throw new Error("Failed to execute '".concat(fnName,"' on 'TimeRanges': The index provided (").concat(index,") is non-numeric or out of bounds (0-").concat(maxIndex,")."))}(fnName,rangeIndex,ranges.length-1),ranges[rangeIndex][valueIndex]}function createTimeRangesObj(ranges){let timeRangesObj;return timeRangesObj=void 0===ranges||0===ranges.length?{length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:{length:ranges.length,start:getRange.bind(null,"start",0,ranges),end:getRange.bind(null,"end",1,ranges)},window.Symbol&&window.Symbol.iterator&&(timeRangesObj[window.Symbol.iterator]=()=>(ranges||[]).values()),timeRangesObj}function createTimeRanges$1(start,end){return Array.isArray(start)?createTimeRangesObj(start):void 0===start||void 0===end?createTimeRangesObj():createTimeRangesObj([[start,end]])}Component$1.registerComponent("Component",Component$1);const defaultImplementation=function(seconds,guide){seconds=seconds<0?0:seconds;let s=Math.floor(seconds%60),m=Math.floor(seconds/60%60),h=Math.floor(seconds/3600);const gm=Math.floor(guide/60%60),gh=Math.floor(guide/3600);return(isNaN(seconds)||seconds===1/0)&&(h=m=s="-"),h=h>0||gh>0?h+":":"",m=((h||gm>=10)&&m<10?"0"+m:m)+":",s=s<10?"0"+s:s,h+m+s};let implementation=defaultImplementation;function setFormatTime(customImplementation){implementation=customImplementation}function resetFormatTime(){implementation=defaultImplementation}function formatTime(seconds){let guide=arguments.length>1&&void 0!==arguments[1]?arguments[1]:seconds;return implementation(seconds,guide)}var Time=Object.freeze({__proto__:null,createTimeRanges:createTimeRanges$1,createTimeRange:createTimeRanges$1,setFormatTime:setFormatTime,resetFormatTime:resetFormatTime,formatTime:formatTime});function bufferedPercent(buffered,duration){let start,end,bufferedDuration=0;if(!duration)return 0;buffered&&buffered.length||(buffered=createTimeRanges$1(0,0));for(let i=0;iduration&&(end=duration),bufferedDuration+=end-start;return bufferedDuration/duration}function MediaError(value){if(value instanceof MediaError)return value;"number"==typeof value?this.code=value:"string"==typeof value?this.message=value:isObject$1(value)&&("number"==typeof value.code&&(this.code=value.code),Object.assign(this,value)),this.message||(this.message=MediaError.defaultMessages[this.code]||"")}MediaError.prototype.code=0,MediaError.prototype.message="",MediaError.prototype.status=null,MediaError.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],MediaError.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 errNum=0;errNum{}))}const trackToJson_=function(track){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(((acc,prop,i)=>(track[prop]&&(acc[prop]=track[prop]),acc)),{cues:track.cues&&Array.prototype.map.call(track.cues,(function(cue){return{startTime:cue.startTime,endTime:cue.endTime,text:cue.text,id:cue.id}}))})};var textTrackConverter_textTracksToJson=function(tech){const trackEls=tech.$$("track"),trackObjs=Array.prototype.map.call(trackEls,(t=>t.track));return Array.prototype.map.call(trackEls,(function(trackEl){const json=trackToJson_(trackEl.track);return trackEl.src&&(json.src=trackEl.src),json})).concat(Array.prototype.filter.call(tech.textTracks(),(function(track){return-1===trackObjs.indexOf(track)})).map(trackToJson_))},textTrackConverter_jsonToTextTracks=function(json,tech){return json.forEach((function(track){const addedTrack=tech.addRemoteTextTrack(track).track;!track.src&&track.cues&&track.cues.forEach((cue=>addedTrack.addCue(cue)))})),tech.textTracks()};class ModalDialog extends Component$1{constructor(player,options){super(player,options),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_=createEl("div",{className:"".concat("vjs-modal-dialog","-content")},{role:"document"}),this.descEl_=createEl("p",{className:"".concat("vjs-modal-dialog","-description vjs-control-text"),id:this.el().getAttribute("aria-describedby")}),textContent(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":"".concat(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"".concat("vjs-modal-dialog"," vjs-hidden ").concat(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 player=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!player.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&player.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=player.controls(),player.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}}opened(value){return"boolean"==typeof value&&this[value?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const player=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&player.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&player.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(value){if("boolean"==typeof value){const closeable=this.closeable_=!!value;let close=this.getChild("closeButton");if(closeable&&!close){const temp=this.contentEl_;this.contentEl_=this.el_,close=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=temp,this.on(close,"close",this.close_)}!closeable&&close&&(this.off(close,"close",this.close_),this.removeChild(close),close.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(content){const contentEl=this.contentEl(),parentEl=contentEl.parentNode,nextSiblingEl=contentEl.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,parentEl.removeChild(contentEl),this.empty(),insertContent(contentEl,content),this.trigger("modalfill"),nextSiblingEl?parentEl.insertBefore(contentEl,nextSiblingEl):parentEl.appendChild(contentEl);const closeButton=this.getChild("closeButton");closeButton&&parentEl.appendChild(closeButton.el_)}empty(){this.trigger("beforemodalempty"),emptyEl(this.contentEl()),this.trigger("modalempty")}content(value){return void 0!==value&&(this.content_=value),this.content_}conditionalFocus_(){const activeEl=document.activeElement,playerEl=this.player_.el_;this.previouslyActiveEl_=null,(playerEl.contains(activeEl)||playerEl===activeEl)&&(this.previouslyActiveEl_=activeEl,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(event){if(event.stopPropagation(),keycode.isEventKey(event,"Escape")&&this.closeable())return event.preventDefault(),void this.close();if(!keycode.isEventKey(event,"Tab"))return;const focusableEls=this.focusableEls_(),activeEl=this.el_.querySelector(":focus");let focusIndex;for(let i=0;i(child instanceof window.HTMLAnchorElement||child instanceof window.HTMLAreaElement)&&child.hasAttribute("href")||(child instanceof window.HTMLInputElement||child instanceof window.HTMLSelectElement||child instanceof window.HTMLTextAreaElement||child instanceof window.HTMLButtonElement)&&!child.hasAttribute("disabled")||child instanceof window.HTMLIFrameElement||child instanceof window.HTMLObjectElement||child instanceof window.HTMLEmbedElement||child.hasAttribute("tabindex")&&-1!==child.getAttribute("tabindex")||child.hasAttribute("contenteditable")))}}ModalDialog.prototype.options_={pauseOnOpen:!0,temporary:!0},Component$1.registerComponent("ModalDialog",ModalDialog);class TrackList extends EventTarget$2{constructor(){let tracks=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let i=0;i{this.trigger({track:track,type:"labelchange",target:this})},isEvented(track)&&track.addEventListener("labelchange",track.labelchange_)}removeTrack(rtrack){let track;for(let i=0,l=this.length;ithis.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(rtrack){super.removeTrack(rtrack),rtrack.removeEventListener&&(this.queueChange_&&rtrack.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&rtrack.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class TextTrackCueList{constructor(cues){TextTrackCueList.prototype.setCues_.call(this,cues),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(cues){const oldLength=this.length||0;let i=0;const l=cues.length;this.cues_=cues,this.length_=cues.length;const defineProp=function(index){""+index in this||Object.defineProperty(this,""+index,{get(){return this.cues_[index]}})};if(oldLength0&&void 0!==arguments[0]?arguments[0]:{};super();const trackProps={id:options.id||"vjs_track_"+newGUID(),kind:options.kind||"",language:options.language||""};let label=options.label||"";for(const key in trackProps)Object.defineProperty(this,key,{get:()=>trackProps[key],set(){}});Object.defineProperty(this,"label",{get:()=>label,set(newLabel){newLabel!==label&&(label=newLabel,this.trigger("labelchange"))}})}}const parseUrl=function(url){const props=["protocol","hostname","port","pathname","search","hash","host"],a=document.createElement("a");a.href=url;const details={};for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:window.location;const urlInfo=parseUrl(url),srcProtocol=":"===urlInfo.protocol?winLoc.protocol:urlInfo.protocol,crossOrigin=srcProtocol+urlInfo.host!==winLoc.protocol+winLoc.host;return crossOrigin};var x,Url=Object.freeze({__proto__:null,parseUrl:parseUrl,getAbsoluteURL:getAbsoluteURL,getFileExtension:getFileExtension,isCrossOrigin:isCrossOrigin}),window_1="undefined"!=typeof window?window:void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{},_extends_1=createCommonjsModule((function(module){function _extends(){return module.exports=_extends=Object.assign?Object.assign.bind():function(target){for(var i=1;i=400&&response.statusCode<=599){var cause=responseBody;if(decodeResponseBody)if(window_1.TextDecoder){var charset=function(contentTypeHeader){void 0===contentTypeHeader&&(contentTypeHeader="");return contentTypeHeader.toLowerCase().split(";").reduce((function(charset,contentType){var _contentType$split=contentType.split("="),type=_contentType$split[0],value=_contentType$split[1];return"charset"===type.trim()?value.trim():charset}),"utf-8")}(response.headers&&response.headers["content-type"]);try{cause=new TextDecoder(charset).decode(responseBody)}catch(e){}}else cause=String.fromCharCode.apply(null,new Uint8Array(responseBody));callback({cause:cause})}else callback(null,responseBody)}};createXHR.httpHandler=httpHandler;
/**
* @license
* slighly modified parse-headers 2.0.2
@@ -17,15 +17,15 @@
* Available under the MIT license
*
*/
-var lib=createXHR,default_1=createXHR;function initParams(uri,options,callback){var params=uri;return isFunction_1(options)?(callback=options,"string"==typeof uri&&(params={uri:uri})):params=_extends_1({},options,{uri:uri}),params.callback=callback,params}function createXHR(uri,options,callback){return _createXHR(options=initParams(uri,options,callback))}function _createXHR(options){if(void 0===options.callback)throw new Error("callback argument missing");var called=!1,callback=function(err,response,body){called||(called=!0,options.callback(err,response,body))};function getBody(){var body=void 0;if(body=xhr.response?xhr.response:xhr.responseText||function(xhr){try{if("document"===xhr.responseType)return xhr.responseXML;var firefoxBugTakenEffect=xhr.responseXML&&"parsererror"===xhr.responseXML.documentElement.nodeName;if(""===xhr.responseType&&!firefoxBugTakenEffect)return xhr.responseXML}catch(e){}return null}(xhr),isJson)try{body=JSON.parse(body)}catch(e){}return body}function errorFunc(evt){return clearTimeout(timeoutTimer),evt instanceof Error||(evt=new Error(""+(evt||"Unknown XMLHttpRequest Error"))),evt.statusCode=0,callback(evt,failureResponse)}function loadFunc(){if(!aborted){var status;clearTimeout(timeoutTimer),status=options.useXDR&&void 0===xhr.status?200:1223===xhr.status?204:xhr.status;var response=failureResponse,err=null;return 0!==status?(response={body:getBody(),statusCode:status,method:method,headers:{},url:uri,rawRequest:xhr},xhr.getAllResponseHeaders&&(response.headers=function(headers){var result={};return headers?(headers.trim().split("\n").forEach((function(row){var index=row.indexOf(":"),key=row.slice(0,index).trim().toLowerCase(),value=row.slice(index+1).trim();void 0===result[key]?result[key]=value:Array.isArray(result[key])?result[key].push(value):result[key]=[result[key],value]})),result):result}(xhr.getAllResponseHeaders()))):err=new Error("Internal XMLHttpRequest Error"),callback(err,response,response.body)}}var key,aborted,xhr=options.xhr||null;xhr||(xhr=options.cors||options.useXDR?new createXHR.XDomainRequest:new createXHR.XMLHttpRequest);var timeoutTimer,uri=xhr.url=options.uri||options.url,method=xhr.method=options.method||"GET",body=options.body||options.data,headers=xhr.headers=options.headers||{},sync=!!options.sync,isJson=!1,failureResponse={body:void 0,headers:{},statusCode:0,method:method,url:uri,rawRequest:xhr};if("json"in options&&!1!==options.json&&(isJson=!0,headers.accept||headers.Accept||(headers.Accept="application/json"),"GET"!==method&&"HEAD"!==method&&(headers["content-type"]||headers["Content-Type"]||(headers["Content-Type"]="application/json"),body=JSON.stringify(!0===options.json?body:options.json))),xhr.onreadystatechange=function(){4===xhr.readyState&&setTimeout(loadFunc,0)},xhr.onload=loadFunc,xhr.onerror=errorFunc,xhr.onprogress=function(){},xhr.onabort=function(){aborted=!0},xhr.ontimeout=errorFunc,xhr.open(method,uri,!sync,options.username,options.password),sync||(xhr.withCredentials=!!options.withCredentials),!sync&&options.timeout>0&&(timeoutTimer=setTimeout((function(){if(!aborted){aborted=!0,xhr.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",errorFunc(e)}}),options.timeout)),xhr.setRequestHeader)for(key in headers)headers.hasOwnProperty(key)&&xhr.setRequestHeader(key,headers[key]);else if(options.headers&&!function(obj){for(var i in obj)if(obj.hasOwnProperty(i))return!1;return!0}(options.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in options&&(xhr.responseType=options.responseType),"beforeSend"in options&&"function"==typeof options.beforeSend&&options.beforeSend(xhr),xhr.send(body||null),xhr}createXHR.XMLHttpRequest=window_1.XMLHttpRequest||function(){},createXHR.XDomainRequest="withCredentials"in new createXHR.XMLHttpRequest?createXHR.XMLHttpRequest:window_1.XDomainRequest,function(array,iterator){for(var i=0;i0&&(window.console&&window.console.groupCollapsed&&window.console.groupCollapsed("Text Track parsing errors for ".concat(track.src)),errors.forEach((error=>log$1.error(error))),window.console&&window.console.groupEnd&&window.console.groupEnd()),parser.flush()},loadTrack=function(src,track){const opts={uri:src},crossOrigin=isCrossOrigin(src);crossOrigin&&(opts.cors=crossOrigin);const withCredentials="use-credentials"===track.tech_.crossOrigin();withCredentials&&(opts.withCredentials=withCredentials),lib(opts,bind_(this,(function(err,response,responseBody){if(err)return log$1.error(err,response);track.loaded_=!0,"function"!=typeof window.WebVTT?track.tech_&&track.tech_.any(["vttjsloaded","vttjserror"],(event=>{if("vttjserror"!==event.type)return parseCues(responseBody,track);log$1.error("vttjs failed to load, stopping trying to process ".concat(track.src))})):parseCues(responseBody,track)})))};class TextTrack extends Track{constructor(){let options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!options.tech)throw new Error("A tech was not provided.");const settings=merge$2(options,{kind:TextTrackKind[options.kind]||"subtitles",language:options.language||options.srclang||""});let mode=TextTrackMode[settings.mode]||"disabled";const default_=settings.default;"metadata"!==settings.kind&&"chapters"!==settings.kind||(mode="hidden"),super(settings),this.tech_=settings.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks;const cues=new TextTrackCueList(this.cues_),activeCues=new TextTrackCueList(this.activeCues_);let changed=!1;this.timeupdateHandler=bind_(this,(function(){let event=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,changed&&(this.trigger("cuechange"),changed=!1),"timeupdate"!==event.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))):"timeupdate"!==event.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))}));this.tech_.one("dispose",(()=>{this.stopTracking()})),"disabled"!==mode&&this.startTracking(),Object.defineProperties(this,{default:{get:()=>default_,set(){}},mode:{get:()=>mode,set(newMode){TextTrackMode[newMode]&&mode!==newMode&&(mode=newMode,this.preload_||"disabled"===mode||0!==this.cues.length||loadTrack(this.src,this),this.stopTracking(),"disabled"!==mode&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?cues:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0===this.cues.length)return activeCues;const ct=this.tech_.currentTime(),active=[];for(let i=0,l=this.cues.length;i=ct&&active.push(cue)}if(changed=!1,active.length!==this.activeCues_.length)changed=!0;else for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};const settings=merge$2(options,{kind:AudioTrackKind[options.kind]||""});super(settings);let enabled=!1;Object.defineProperty(this,"enabled",{get:()=>enabled,set(newEnabled){"boolean"==typeof newEnabled&&newEnabled!==enabled&&(enabled=newEnabled,this.trigger("enabledchange"))}}),settings.enabled&&(this.enabled=settings.enabled),this.loaded_=!0}}class VideoTrack extends Track{constructor(){let options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const settings=merge$2(options,{kind:VideoTrackKind[options.kind]||""});super(settings);let selected=!1;Object.defineProperty(this,"selected",{get:()=>selected,set(newSelected){"boolean"==typeof newSelected&&newSelected!==selected&&(selected=newSelected,this.trigger("selectedchange"))}}),settings.selected&&(this.selected=settings.selected)}}class HTMLTrackElement extends EventTarget$2{constructor(){let readyState,options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();const track=new TextTrack(options);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:()=>readyState},track:{get:()=>track}}),readyState=HTMLTrackElement.NONE,track.addEventListener("loadeddata",(()=>{readyState=HTMLTrackElement.LOADED,this.trigger({type:"load",target:this})}))}}HTMLTrackElement.prototype.allowedEvents_={load:"load"},HTMLTrackElement.NONE=0,HTMLTrackElement.LOADING=1,HTMLTrackElement.LOADED=2,HTMLTrackElement.ERROR=3;const NORMAL={audio:{ListClass:class extends TrackList{constructor(){let tracks=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];for(let i=tracks.length-1;i>=0;i--)if(tracks[i].enabled){disableOthers$1(tracks,tracks[i]);break}super(tracks),this.changing_=!1}addTrack(track){track.enabled&&disableOthers$1(this,track),super.addTrack(track),track.addEventListener&&(track.enabledChange_=()=>{this.changing_||(this.changing_=!0,disableOthers$1(this,track),this.changing_=!1,this.trigger("change"))},track.addEventListener("enabledchange",track.enabledChange_))}removeTrack(rtrack){super.removeTrack(rtrack),rtrack.removeEventListener&&rtrack.enabledChange_&&(rtrack.removeEventListener("enabledchange",rtrack.enabledChange_),rtrack.enabledChange_=null)}},TrackClass:AudioTrack,capitalName:"Audio"},video:{ListClass:class extends TrackList{constructor(){let tracks=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];for(let i=tracks.length-1;i>=0;i--)if(tracks[i].selected){disableOthers(tracks,tracks[i]);break}super(tracks),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let i=0;i{this.changing_||(this.changing_=!0,disableOthers(this,track),this.changing_=!1,this.trigger("change"))},track.addEventListener("selectedchange",track.selectedChange_))}removeTrack(rtrack){super.removeTrack(rtrack),rtrack.removeEventListener&&rtrack.selectedChange_&&(rtrack.removeEventListener("selectedchange",rtrack.selectedChange_),rtrack.selectedChange_=null)}},TrackClass:VideoTrack,capitalName:"Video"},text:{ListClass:TextTrackList,TrackClass:TextTrack,capitalName:"Text"}};Object.keys(NORMAL).forEach((function(type){NORMAL[type].getterName="".concat(type,"Tracks"),NORMAL[type].privateName="".concat(type,"Tracks_")}));const REMOTE={remoteText:{ListClass:TextTrackList,TrackClass:TextTrack,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(){let trackElements=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let i=0,length=trackElements.length;i59?computeSeconds(m[1],m[2],0,m[4]):computeSeconds(0,m[1],m[2],m[4]):null}function Settings(){this.values=_objCreate(null)}function parseOptions(input,callback,keyValueDelim,groupDelim){var groups=groupDelim?input.split(groupDelim):[input];for(var i in groups)if("string"==typeof groups[i]){var kv=groups[i].split(keyValueDelim);if(2===kv.length)callback(kv[0].trim(),kv[1].trim())}}function parseCue(input,cue,regionList){var oInput=input;function consumeTimeStamp(){var ts=parseTimeStamp(input);if(null===ts)throw new ParsingError(ParsingError.Errors.BadTimeStamp,"Malformed timestamp: "+oInput);return input=input.replace(/^[^\sa-zA-Z-]+/,""),ts}function skipWhitespace(){input=input.replace(/^\s+/,"")}if(skipWhitespace(),cue.startTime=consumeTimeStamp(),skipWhitespace(),"--\x3e"!==input.substr(0,3))throw new ParsingError(ParsingError.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+oInput);input=input.substr(3),skipWhitespace(),cue.endTime=consumeTimeStamp(),skipWhitespace(),function(input,cue){var settings=new Settings;parseOptions(input,(function(k,v){switch(k){case"region":for(var i=regionList.length-1;i>=0;i--)if(regionList[i].id===v){settings.set(k,regionList[i].region);break}break;case"vertical":settings.alt(k,v,["rl","lr"]);break;case"line":var vals=v.split(","),vals0=vals[0];settings.integer(k,vals0),settings.percent(k,vals0)&&settings.set("snapToLines",!1),settings.alt(k,vals0,["auto"]),2===vals.length&&settings.alt("lineAlign",vals[1],["start","center","end"]);break;case"position":vals=v.split(","),settings.percent(k,vals[0]),2===vals.length&&settings.alt("positionAlign",vals[1],["start","center","end"]);break;case"size":settings.percent(k,v);break;case"align":settings.alt(k,v,["start","center","end","left","right"])}}),/:/,/\s/),cue.region=settings.get("region",null),cue.vertical=settings.get("vertical","");try{cue.line=settings.get("line","auto")}catch(e){}cue.lineAlign=settings.get("lineAlign","start"),cue.snapToLines=settings.get("snapToLines",!0),cue.size=settings.get("size",100);try{cue.align=settings.get("align","center")}catch(e){cue.align=settings.get("align","middle")}try{cue.position=settings.get("position","auto")}catch(e){cue.position=settings.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},cue.align)}cue.positionAlign=settings.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},cue.align)}(input,cue)}ParsingError.prototype=_objCreate(Error.prototype),ParsingError.prototype.constructor=ParsingError,ParsingError.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Settings.prototype={set:function(k,v){this.get(k)||""===v||(this.values[k]=v)},get:function(k,dflt,defaultKey){return defaultKey?this.has(k)?this.values[k]:dflt[defaultKey]:this.has(k)?this.values[k]:dflt},has:function(k){return k in this.values},alt:function(k,v,a){for(var n=0;n=0&&v<=100)&&(this.set(k,v),!0)}};var TEXTAREA_ELEMENT=document_1.createElement&&document_1.createElement("textarea"),TAG_NAME={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},DEFAULT_COLOR_CLASS={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},TAG_ANNOTATION={v:"title",lang:"lang"},NEEDS_PARENT={rt:"ruby"};function parseContent(window,input){function nextToken(){if(!input)return null;var result,m=input.match(/^([^<]*)(<[^>]*>?)?/);return result=m[1]?m[1]:m[2],input=input.substr(result.length),result}function shouldAdd(current,element){return!NEEDS_PARENT[element.localName]||NEEDS_PARENT[element.localName]===current.localName}function createElement(type,annotation){var tagName=TAG_NAME[type];if(!tagName)return null;var element=window.document.createElement(tagName),name=TAG_ANNOTATION[type];return name&&annotation&&(element[name]=annotation.trim()),element}for(var t,s,rootDiv=window.document.createElement("div"),current=rootDiv,tagStack=[];null!==(t=nextToken());)if("<"!==t[0])current.appendChild(window.document.createTextNode((s=t,TEXTAREA_ELEMENT.innerHTML=s,s=TEXTAREA_ELEMENT.textContent,TEXTAREA_ELEMENT.textContent="",s)));else{if("/"===t[1]){tagStack.length&&tagStack[tagStack.length-1]===t.substr(2).replace(">","")&&(tagStack.pop(),current=current.parentNode);continue}var node,ts=parseTimeStamp(t.substr(1,t.length-2));if(ts){node=window.document.createProcessingInstruction("timestamp",ts),current.appendChild(node);continue}var m=t.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!m)continue;if(!(node=createElement(m[1],m[3])))continue;if(!shouldAdd(current,node))continue;if(m[2]){var classes=m[2].split(".");classes.forEach((function(cl){var bgColor=/^bg_/.test(cl),colorName=bgColor?cl.slice(3):cl;if(DEFAULT_COLOR_CLASS.hasOwnProperty(colorName)){var propName=bgColor?"background-color":"color",propValue=DEFAULT_COLOR_CLASS[colorName];node.style[propName]=propValue}})),node.className=classes.join(" ")}tagStack.push(m[1]),current.appendChild(node),current=node}return rootDiv}var strongRTLRanges=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function isStrongRTLChar(charCode){for(var i=0;i=currentRange[0]&&charCode<=currentRange[1])return!0}return!1}function determineBidi(cueDiv){var nodeStack=[],text="";if(!cueDiv||!cueDiv.childNodes)return"ltr";function pushNodes(nodeStack,node){for(var i=node.childNodes.length-1;i>=0;i--)nodeStack.push(node.childNodes[i])}function nextTextNode(nodeStack){if(!nodeStack||!nodeStack.length)return null;var node=nodeStack.pop(),text=node.textContent||node.innerText;if(text){var m=text.match(/^.*(\n|\r)/);return m?(nodeStack.length=0,m[0]):text}return"ruby"===node.tagName?nextTextNode(nodeStack):node.childNodes?(pushNodes(nodeStack,node),nextTextNode(nodeStack)):void 0}for(pushNodes(nodeStack,cueDiv);text=nextTextNode(nodeStack);)for(var i=0;i=0&&cue.line<=100))return cue.line;if(!cue.track||!cue.track.textTrackList||!cue.track.textTrackList.mediaElement)return-1;for(var track=cue.track,trackList=track.textTrackList,count=0,i=0;imaxPosition&&(position=position<0?-1:1,position*=Math.ceil(maxPosition/step)*step),linePos<0&&(position+=""===cue.vertical?containerBox.height:containerBox.width,axis=axis.reverse()),boxPosition.move(initialAxis,position)}else{var calculatedPercentage=boxPosition.lineHeight/containerBox.height*100;switch(cue.lineAlign){case"center":linePos-=calculatedPercentage/2;break;case"end":linePos-=calculatedPercentage}switch(cue.vertical){case"":styleBox.applyStyles({top:styleBox.formatStyle(linePos,"%")});break;case"rl":styleBox.applyStyles({left:styleBox.formatStyle(linePos,"%")});break;case"lr":styleBox.applyStyles({right:styleBox.formatStyle(linePos,"%")})}axis=["+y","-x","+x","-y"],boxPosition=new BoxPosition(styleBox)}var bestPosition=function(b,axis){for(var bestPosition,specifiedPosition=new BoxPosition(b),percentage=1,i=0;ip&&(bestPosition=new BoxPosition(b),percentage=p),b=new BoxPosition(specifiedPosition)}return bestPosition||specifiedPosition}(boxPosition,axis);styleBox.move(bestPosition.toCSSCompatValues(containerBox))}function WebVTT$1(){}StyleBox.prototype.applyStyles=function(styles,div){for(var prop in div=div||this.div,styles)styles.hasOwnProperty(prop)&&(div.style[prop]=styles[prop])},StyleBox.prototype.formatStyle=function(val,unit){return 0===val?0:val+unit},CueStyleBox.prototype=_objCreate(StyleBox.prototype),CueStyleBox.prototype.constructor=CueStyleBox,BoxPosition.prototype.move=function(axis,toMove){switch(toMove=void 0!==toMove?toMove:this.lineHeight,axis){case"+x":this.left+=toMove,this.right+=toMove;break;case"-x":this.left-=toMove,this.right-=toMove;break;case"+y":this.top+=toMove,this.bottom+=toMove;break;case"-y":this.top-=toMove,this.bottom-=toMove}},BoxPosition.prototype.overlaps=function(b2){return this.leftb2.left&&this.topb2.top},BoxPosition.prototype.overlapsAny=function(boxes){for(var i=0;i=container.top&&this.bottom<=container.bottom&&this.left>=container.left&&this.right<=container.right},BoxPosition.prototype.overlapsOppositeAxis=function(container,axis){switch(axis){case"+x":return this.leftcontainer.right;case"+y":return this.topcontainer.bottom}},BoxPosition.prototype.intersectPercentage=function(b2){return Math.max(0,Math.min(this.right,b2.right)-Math.max(this.left,b2.left))*Math.max(0,Math.min(this.bottom,b2.bottom)-Math.max(this.top,b2.top))/(this.height*this.width)},BoxPosition.prototype.toCSSCompatValues=function(reference){return{top:this.top-reference.top,bottom:reference.bottom-this.bottom,left:this.left-reference.left,right:reference.right-this.right,height:this.height,width:this.width}},BoxPosition.getSimpleBoxPosition=function(obj){var height=obj.div?obj.div.offsetHeight:obj.tagName?obj.offsetHeight:0,width=obj.div?obj.div.offsetWidth:obj.tagName?obj.offsetWidth:0,top=obj.div?obj.div.offsetTop:obj.tagName?obj.offsetTop:0;return{left:(obj=obj.div?obj.div.getBoundingClientRect():obj.tagName?obj.getBoundingClientRect():obj).left,right:obj.right,top:obj.top||top,height:obj.height||height,bottom:obj.bottom||top+(obj.height||height),width:obj.width||width}},WebVTT$1.StringDecoder=function(){return{decode:function(data){if(!data)return"";if("string"!=typeof data)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(data))}}},WebVTT$1.convertCueToDOMTree=function(window,cuetext){return window&&cuetext?parseContent(window,cuetext):null};WebVTT$1.processCues=function(window,cues,overlay){if(!window||!cues||!overlay)return null;for(;overlay.firstChild;)overlay.removeChild(overlay.firstChild);var paddedOverlay=window.document.createElement("div");if(paddedOverlay.style.position="absolute",paddedOverlay.style.left="0",paddedOverlay.style.right="0",paddedOverlay.style.top="0",paddedOverlay.style.bottom="0",paddedOverlay.style.margin="1.5%",overlay.appendChild(paddedOverlay),function(cues){for(var i=0;i100)throw new Error("Position must be between 0 and 100.");_position=value,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return _positionAlign},set:function(value){var setting=findAlignSetting(value);setting?(_positionAlign=setting,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return _size},set:function(value){if(value<0||value>100)throw new Error("Size must be between 0 and 100.");_size=value,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return _align},set:function(value){var setting=findAlignSetting(value);if(!setting)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");_align=setting,this.hasBeenReset=!0}}}),this.displayState=void 0}VTTCue.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var vttcue=VTTCue,scrollSetting={"":!0,up:!0};function isValidPercentValue(value){return"number"==typeof value&&value>=0&&value<=100}var vttregion=function(){var _width=100,_lines=3,_regionAnchorX=0,_regionAnchorY=100,_viewportAnchorX=0,_viewportAnchorY=100,_scroll="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return _width},set:function(value){if(!isValidPercentValue(value))throw new Error("Width must be between 0 and 100.");_width=value}},lines:{enumerable:!0,get:function(){return _lines},set:function(value){if("number"!=typeof value)throw new TypeError("Lines must be set to a number.");_lines=value}},regionAnchorY:{enumerable:!0,get:function(){return _regionAnchorY},set:function(value){if(!isValidPercentValue(value))throw new Error("RegionAnchorX must be between 0 and 100.");_regionAnchorY=value}},regionAnchorX:{enumerable:!0,get:function(){return _regionAnchorX},set:function(value){if(!isValidPercentValue(value))throw new Error("RegionAnchorY must be between 0 and 100.");_regionAnchorX=value}},viewportAnchorY:{enumerable:!0,get:function(){return _viewportAnchorY},set:function(value){if(!isValidPercentValue(value))throw new Error("ViewportAnchorY must be between 0 and 100.");_viewportAnchorY=value}},viewportAnchorX:{enumerable:!0,get:function(){return _viewportAnchorX},set:function(value){if(!isValidPercentValue(value))throw new Error("ViewportAnchorX must be between 0 and 100.");_viewportAnchorX=value}},scroll:{enumerable:!0,get:function(){return _scroll},set:function(value){var setting=function(value){return"string"==typeof value&&!!scrollSetting[value.toLowerCase()]&&value.toLowerCase()}(value);!1===setting?console.warn("Scroll: an invalid or illegal string was specified."):_scroll=setting}}})},browserIndex=createCommonjsModule((function(module){var vttjs=module.exports={WebVTT:vtt,VTTCue:vttcue,VTTRegion:vttregion};window_1.vttjs=vttjs,window_1.WebVTT=vttjs.WebVTT;var cueShim=vttjs.VTTCue,regionShim=vttjs.VTTRegion,nativeVTTCue=window_1.VTTCue,nativeVTTRegion=window_1.VTTRegion;vttjs.shim=function(){window_1.VTTCue=cueShim,window_1.VTTRegion=regionShim},vttjs.restore=function(){window_1.VTTCue=nativeVTTCue,window_1.VTTRegion=nativeVTTRegion},window_1.VTTCue||vttjs.shim()}));browserIndex.WebVTT,browserIndex.VTTCue,browserIndex.VTTRegion;class Tech extends Component$1{constructor(){let options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},ready=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};options.reportTouchActivity=!1,super(null,options,ready),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})),ALL.names.forEach((name=>{const props=ALL[name];options&&options[props.getterName]&&(this[props.privateName]=options[props.getterName])})),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((track=>{!1===options["native".concat(track,"Tracks")]&&(this["featuresNative".concat(track,"Tracks")]=!1)})),!1===options.nativeCaptions||!1===options.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==options.nativeCaptions&&!0!==options.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==options.preloadTextTracks,this.autoRemoteTextTracks_=new ALL.text.ListClass,this.initTrackListeners(),options.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(src){this.isReady_||this.one("ready",(()=>this.setTimeout((()=>this.triggerSourceset(src)),1))),this.trigger({src:src,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(event){this.stopTrackingProgress(),this.progressInterval=this.setInterval(bind_(this,(function(){const numBufferedPercent=this.bufferedPercent();this.bufferedPercent_!==numBufferedPercent&&this.trigger("progress"),this.bufferedPercent_=numBufferedPercent,1===numBufferedPercent&&this.stopTrackingProgress()})),500)}onDurationChange(event){this.duration_=this.duration()}buffered(){return createTimeRanges$1(0,0)}bufferedPercent(){return bufferedPercent(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(NORMAL.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(types){(types=[].concat(types)).forEach((type=>{const list=this["".concat(type,"Tracks")]()||[];let i=list.length;for(;i--;){const track=list[i];"text"===type&&this.removeRemoteTextTrack(track),list.removeTrack(track)}}))}cleanupAutoTextTracks(){const list=this.autoRemoteTextTracks_||[];let i=list.length;for(;i--;){const track=list[i];this.removeRemoteTextTrack(track)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(err){return void 0!==err&&(this.error_=new MediaError(err),this.trigger("error")),this.error_}played(){return this.hasStarted_?createTimeRanges$1(0,0):createTimeRanges$1()}play(){}setScrubbing(_isScrubbing){}scrubbing(){}setCurrentTime(_seconds){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){NORMAL.names.forEach((name=>{const props=NORMAL[name],trackListChanges=()=>{this.trigger("".concat(name,"trackchange"))},tracks=this[props.getterName]();tracks.addEventListener("removetrack",trackListChanges),tracks.addEventListener("addtrack",trackListChanges),this.on("dispose",(()=>{tracks.removeEventListener("removetrack",trackListChanges),tracks.removeEventListener("addtrack",trackListChanges)}))}))}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el())){if(!this.options_["vtt.js"]&&isPlain(browserIndex)&&Object.keys(browserIndex).length>0)return void this.trigger("vttjsloaded");const script=document.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})),window.WebVTT=!0,this.el().parentNode.appendChild(script)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const tracks=this.textTracks(),remoteTracks=this.remoteTextTracks(),handleAddTrack=e=>tracks.addTrack(e.track),handleRemoveTrack=e=>tracks.removeTrack(e.track);remoteTracks.on("addtrack",handleAddTrack),remoteTracks.on("removetrack",handleRemoveTrack),this.addWebVttScript_();const updateDisplay=()=>this.trigger("texttrackchange"),textTracksChanges=()=>{updateDisplay();for(let i=0;i4&&void 0!==arguments[4]?arguments[4]:{};const tracks=self.textTracks();options.kind=kind,label&&(options.label=label),language&&(options.language=language),options.tech=self;const track=new ALL.text.TrackClass(options);return tracks.addTrack(track),track}(this,kind,label,language)}createRemoteTextTrack(options){const track=merge$2(options,{tech:this});return new REMOTE.remoteTextEl.TrackClass(track)}addRemoteTextTrack(){let options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},manualCleanup=arguments.length>1?arguments[1]:void 0;const htmlTrackElement=this.createRemoteTextTrack(options);return"boolean"!=typeof manualCleanup&&(manualCleanup=!1),this.remoteTextTrackEls().addTrackElement_(htmlTrackElement),this.remoteTextTracks().addTrack(htmlTrackElement.track),!1===manualCleanup&&this.ready((()=>this.autoRemoteTextTracks_.addTrack(htmlTrackElement.track))),htmlTrackElement}removeRemoteTextTrack(track){const trackElement=this.remoteTextTrackEls().getTrackElementByTrack_(track);this.remoteTextTrackEls().removeTrackElement_(trackElement),this.remoteTextTracks().removeTrack(track),this.autoRemoteTextTracks_.removeTrack(track)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(cb){const id=newGUID();return!this.isReady_||this.paused()?(this.queuedHanders_.add(id),this.one("playing",(()=>{this.queuedHanders_.has(id)&&(this.queuedHanders_.delete(id),cb())}))):this.requestNamedAnimationFrame(id,cb),id}cancelVideoFrameCallback(id){this.queuedHanders_.has(id)?this.queuedHanders_.delete(id):this.cancelNamedAnimationFrame(id)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(override){}overrideNativeVideoTracks(override){}canPlayType(_type){return""}static canPlayType(_type){return""}static canPlaySource(srcObj,options){return Tech.canPlayType(srcObj.type)}static isTech(component){return component.prototype instanceof Tech||component instanceof Tech||component===Tech}static registerTech(name,tech){if(Tech.techs_||(Tech.techs_={}),!Tech.isTech(tech))throw new Error("Tech ".concat(name," must be a Tech"));if(!Tech.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!Tech.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return name=toTitleCase$1(name),Tech.techs_[name]=tech,Tech.techs_[toLowerCase(name)]=tech,"Tech"!==name&&Tech.defaultTechOrder_.push(name),tech}static getTech(name){if(name)return Tech.techs_&&Tech.techs_[name]?Tech.techs_[name]:(name=toTitleCase$1(name),window&&window.videojs&&window.videojs[name]?(log$1.warn("The ".concat(name," tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)")),window.videojs[name]):void 0)}}ALL.names.forEach((function(name){const props=ALL[name];Tech.prototype[props.getterName]=function(){return this[props.privateName]=this[props.privateName]||new props.ListClass,this[props.privateName]}})),Tech.prototype.featuresVolumeControl=!0,Tech.prototype.featuresMuteControl=!0,Tech.prototype.featuresFullscreenResize=!1,Tech.prototype.featuresPlaybackRate=!1,Tech.prototype.featuresProgressEvents=!1,Tech.prototype.featuresSourceset=!1,Tech.prototype.featuresTimeupdateEvents=!1,Tech.prototype.featuresNativeTextTracks=!1,Tech.prototype.featuresVideoFrameCallback=!1,Tech.withSourceHandlers=function(_Tech){_Tech.registerSourceHandler=function(handler,index){let handlers=_Tech.sourceHandlers;handlers||(handlers=_Tech.sourceHandlers=[]),void 0===index&&(index=handlers.length),handlers.splice(index,0,handler)},_Tech.canPlayType=function(type){const handlers=_Tech.sourceHandlers||[];let can;for(let i=0;isetSourceHelper(src,middlewares[src.type],next,player)),1)}function mediate(middleware,tech,method){let arg=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const callMethod="call"+toTitleCase$1(method),middlewareValue=middleware.reduce(middlewareIterator(callMethod),arg),terminated=middlewareValue===TERMINATOR,returnValue=terminated?null:tech[method](middlewareValue);return executeRight(middleware,method,returnValue,terminated),returnValue}const allowedGetters={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},allowedSetters={setCurrentTime:1,setMuted:1,setVolume:1},allowedMediators={play:1,pause:1};function middlewareIterator(method){return(value,mw)=>value===TERMINATOR?TERMINATOR:mw[method]?mw[method](value):value}function executeRight(mws,method,value,terminated){for(let i=mws.length-1;i>=0;i--){const mw=mws[i];mw[method]&&mw[method](terminated,value)}}function getOrCreateFactory(player,mwFactory){const mws=middlewareInstances[player.id()];let mw=null;if(null==mws)return mw=mwFactory(player),middlewareInstances[player.id()]=[[mwFactory,mw]],mw;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{},middleware=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],next=arguments.length>2?arguments[2]:void 0,player=arguments.length>3?arguments[3]:void 0,acc=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],lastRun=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const[mwFactory,...mwrest]=middleware;if("string"==typeof mwFactory)setSourceHelper(src,middlewares[mwFactory],next,player,acc,lastRun);else if(mwFactory){const mw=getOrCreateFactory(player,mwFactory);if(!mw.setSource)return acc.push(mw),setSourceHelper(src,mwrest,next,player,acc,lastRun);mw.setSource(Object.assign({},src),(function(err,_src){if(err)return setSourceHelper(src,mwrest,next,player,acc,lastRun);acc.push(mw),setSourceHelper(_src,src.type===_src.type?mwrest:middlewares[_src.type],next,player,acc,lastRun)}))}else mwrest.length?setSourceHelper(src,mwrest,next,player,acc,lastRun):lastRun?next(src,acc):setSourceHelper(src,middlewares["*"],next,player,acc,!0)}const MimetypesKind={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"},getMimetype=function(){let src=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const ext=getFileExtension(src),mimetype=MimetypesKind[ext.toLowerCase()];return mimetype||""},filterSource=function(src){if(Array.isArray(src)){let newsrc=[];src.forEach((function(srcobj){srcobj=filterSource(srcobj),Array.isArray(srcobj)?newsrc=newsrc.concat(srcobj):isObject$1(srcobj)&&newsrc.push(srcobj)})),src=newsrc}else src="string"==typeof src&&src.trim()?[fixSource({src:src})]:isObject$1(src)&&"string"==typeof src.src&&src.src&&src.src.trim()?[fixSource(src)]:[];return src};function fixSource(src){if(!src.type){const mimetype=getMimetype(src.src);mimetype&&(src.type=mimetype)}return src}Component$1.registerComponent("MediaLoader",class extends Component$1{constructor(player,options,ready){if(super(player,merge$2({createEl:!1},options),ready),options.playerOptions.sources&&0!==options.playerOptions.sources.length)player.src(options.playerOptions.sources);else for(let i=0,j=options.playerOptions.techOrder;ithis.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(){let tag=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",props=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};props=Object.assign({className:this.buildCSSClass(),tabIndex:0},props),"button"===tag&&log$1.error("Creating a ClickableComponent with an HTML element of ".concat(tag," is not supported; use a Button instead.")),attributes=Object.assign({role:"button"},attributes),this.tabIndex_=props.tabIndex;const el=createEl(tag,props,attributes);return el.appendChild(createEl("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(el),el}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(el){return this.controlTextEl_=createEl("span",{className:"vjs-control-text"},{"aria-live":"polite"}),el&&el.appendChild(this.controlTextEl_),this.controlText(this.controlText_,el),this.controlTextEl_}controlText(text){let el=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.el();if(void 0===text)return this.controlText_||"Need Text";const localizedText=this.localize(text);this.controlText_=text,textContent(this.controlTextEl_,localizedText),this.nonIconControl||this.player_.options_.noUITitleAttributes||el.setAttribute("title",localizedText)}buildCSSClass(){return"vjs-control vjs-button ".concat(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(event){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(event){keycode.isEventKey(event,"Space")||keycode.isEventKey(event,"Enter")?(event.preventDefault(),event.stopPropagation(),this.trigger("click")):super.handleKeyDown(event)}}Component$1.registerComponent("ClickableComponent",ClickableComponent);class PosterImage extends ClickableComponent{constructor(player,options){super(player,options),this.update(),this.update_=e=>this.update(e),player.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return createEl("div",{className:"vjs-poster"})}crossOrigin(value){if(void 0===value)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null===value||"anonymous"===value||"use-credentials"===value?this.$("img")&&(this.$("img").crossOrigin=value):this.player_.log.warn('crossOrigin must be null, "anonymous" or "use-credentials", given "'.concat(value,'"'))}update(event){const url=this.player().poster();this.setSrc(url),url?this.show():this.hide()}setSrc(url){url?(this.$("img")||this.el_.appendChild(createEl("picture",{className:"vjs-poster",tabIndex:-1},{},createEl("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=url):this.el_.textContent=""}handleClick(event){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?silencePromise(this.player_.play()):this.player_.pause())}}PosterImage.prototype.crossorigin=PosterImage.prototype.crossOrigin,Component$1.registerComponent("PosterImage",PosterImage);const fontMap={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 constructColor(color,opacity){let hex;if(4===color.length)hex=color[1]+color[1]+color[2]+color[2]+color[3]+color[3];else{if(7!==color.length)throw new Error("Invalid color code provided, "+color+"; must be formatted as e.g. #f0e or #f604e2.");hex=color.slice(1)}return"rgba("+parseInt(hex.slice(0,2),16)+","+parseInt(hex.slice(2,4),16)+","+parseInt(hex.slice(4,6),16)+","+opacity+")"}function tryUpdateStyle(el,style,rule){try{el.style[style]=rule}catch(e){return}}Component$1.registerComponent("TextTrackDisplay",class extends Component$1{constructor(player,options,ready){super(player,options,ready);const updateDisplayHandler=e=>this.updateDisplay(e);player.on("loadstart",(e=>this.toggleDisplay(e))),player.on("texttrackchange",updateDisplayHandler),player.on("loadedmetadata",(e=>this.preselectTrack(e))),player.ready(bind_(this,(function(){if(player.tech_&&player.tech_.featuresNativeTextTracks)return void this.hide();player.on("fullscreenchange",updateDisplayHandler),player.on("playerresize",updateDisplayHandler);const screenOrientation=window.screen.orientation||window,changeOrientationEvent=window.screen.orientation?"change":"orientationchange";screenOrientation.addEventListener(changeOrientationEvent,updateDisplayHandler),player.on("dispose",(()=>screenOrientation.removeEventListener(changeOrientationEvent,updateDisplayHandler)));const tracks=this.options_.playerOptions.tracks||[];for(let i=0;i!track.activeCues)))return;const cues=[];for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};tag="button",props=Object.assign({className:this.buildCSSClass()},props),attributes=Object.assign({type:"button"},attributes);const el=createEl("button",props,attributes);return el.appendChild(createEl("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(el),el}addChild(child){let options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const className=this.constructor.name;return log$1.warn("Adding an actionable (user controllable) child to a Button (".concat(className,") is not supported; use a ClickableComponent instead.")),Component$1.prototype.addChild.call(this,child,options)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(event){keycode.isEventKey(event,"Space")||keycode.isEventKey(event,"Enter")?event.stopPropagation():super.handleKeyDown(event)}}Component$1.registerComponent("Button",Button);class BigPlayButton extends Button{constructor(player,options){super(player,options),this.mouseused_=!1,this.on("mousedown",(e=>this.handleMouseDown(e)))}buildCSSClass(){return"vjs-big-play-button"}handleClick(event){const playPromise=this.player_.play();if(this.mouseused_&&event.clientX&&event.clientY)return silencePromise(playPromise),void(this.player_.tech(!0)&&this.player_.tech(!0).focus());const cb=this.player_.getChild("controlBar"),playToggle=cb&&cb.getChild("playToggle");if(!playToggle)return void this.player_.tech(!0).focus();const playFocus=()=>playToggle.focus();isPromise(playPromise)?playPromise.then(playFocus,(()=>{})):this.setTimeout(playFocus,1)}handleKeyDown(event){this.mouseused_=!1,super.handleKeyDown(event)}handleMouseDown(event){this.mouseused_=!0}}BigPlayButton.prototype.controlText_="Play Video",Component$1.registerComponent("BigPlayButton",BigPlayButton);Component$1.registerComponent("CloseButton",class extends Button{constructor(player,options){super(player,options),this.controlText(options&&options.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button ".concat(super.buildCSSClass())}handleClick(event){this.trigger({type:"close",bubbles:!1})}handleKeyDown(event){keycode.isEventKey(event,"Esc")?(event.preventDefault(),event.stopPropagation(),this.trigger("click")):super.handleKeyDown(event)}});class PlayToggle extends Button{constructor(player){let options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(player,options),options.replay=void 0===options.replay||options.replay,this.on(player,"play",(e=>this.handlePlay(e))),this.on(player,"pause",(e=>this.handlePause(e))),options.replay&&this.on(player,"ended",(e=>this.handleEnded(e)))}buildCSSClass(){return"vjs-play-control ".concat(super.buildCSSClass())}handleClick(event){this.player_.paused()?silencePromise(this.player_.play()):this.player_.pause()}handleSeeked(event){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(event):this.handlePlay(event)}handlePlay(event){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")}handlePause(event){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")}handleEnded(event){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(e=>this.handleSeeked(e)))}}PlayToggle.prototype.controlText_="Play",Component$1.registerComponent("PlayToggle",PlayToggle);class TimeDisplay extends Component$1{constructor(player,options){super(player,options),this.on(player,["timeupdate","ended"],(e=>this.updateContent(e))),this.updateTextNode_()}createEl(){const className=this.buildCSSClass(),el=super.createEl("div",{className:"".concat(className," vjs-time-control vjs-control")}),span=createEl("span",{className:"vjs-control-text",textContent:"".concat(this.localize(this.labelText_)," ")},{role:"presentation"});return el.appendChild(span),this.contentEl_=createEl("span",{className:"".concat(className,"-display")},{role:"presentation"}),el.appendChild(this.contentEl_),el}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(){let time=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;time=formatTime(time),this.formattedTime_!==time&&(this.formattedTime_=time,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(()=>{if(!this.contentEl_)return;let oldNode=this.textNode_;oldNode&&this.contentEl_.firstChild!==oldNode&&(oldNode=null,log$1.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_=document.createTextNode(this.formattedTime_),this.textNode_&&(oldNode?this.contentEl_.replaceChild(this.textNode_,oldNode):this.contentEl_.appendChild(this.textNode_))})))}updateContent(event){}}TimeDisplay.prototype.labelText_="Time",TimeDisplay.prototype.controlText_="Time",Component$1.registerComponent("TimeDisplay",TimeDisplay);class CurrentTimeDisplay extends TimeDisplay{buildCSSClass(){return"vjs-current-time"}updateContent(event){let time;time=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(time)}}CurrentTimeDisplay.prototype.labelText_="Current Time",CurrentTimeDisplay.prototype.controlText_="Current Time",Component$1.registerComponent("CurrentTimeDisplay",CurrentTimeDisplay);class DurationDisplay extends TimeDisplay{constructor(player,options){super(player,options);const updateContent=e=>this.updateContent(e);this.on(player,"durationchange",updateContent),this.on(player,"loadstart",updateContent),this.on(player,"loadedmetadata",updateContent)}buildCSSClass(){return"vjs-duration"}updateContent(event){const duration=this.player_.duration();this.updateTextNode_(duration)}}DurationDisplay.prototype.labelText_="Duration",DurationDisplay.prototype.controlText_="Duration",Component$1.registerComponent("DurationDisplay",DurationDisplay);Component$1.registerComponent("TimeDivider",class extends Component$1{createEl(){const el=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),el.appendChild(div),el}});class RemainingTimeDisplay extends TimeDisplay{constructor(player,options){super(player,options),this.on(player,"durationchange",(e=>this.updateContent(e)))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const el=super.createEl();return!1!==this.options_.displayNegative&&el.insertBefore(createEl("span",{},{"aria-hidden":!0},"-"),this.contentEl_),el}updateContent(event){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)}}RemainingTimeDisplay.prototype.labelText_="Remaining Time",RemainingTimeDisplay.prototype.controlText_="Remaining Time",Component$1.registerComponent("RemainingTimeDisplay",RemainingTimeDisplay);Component$1.registerComponent("LiveDisplay",class extends Component$1{constructor(player,options){super(player,options),this.updateShowing(),this.on(this.player(),"durationchange",(e=>this.updateShowing(e)))}createEl(){const el=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=createEl("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(createEl("span",{className:"vjs-control-text",textContent:"".concat(this.localize("Stream Type")," ")})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),el.appendChild(this.contentEl_),el}dispose(){this.contentEl_=null,super.dispose()}updateShowing(event){this.player().duration()===1/0?this.show():this.hide()}});class SeekToLive extends Button{constructor(player,options){super(player,options),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const el=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=createEl("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),el.appendChild(this.textEl_),el}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 clamp(number,min,max){return number=Number(number),Math.min(max,Math.max(min,isNaN(number)?min:number))}SeekToLive.prototype.controlText_="Seek to live, currently playing live",Component$1.registerComponent("SeekToLive",SeekToLive);var Num=Object.freeze({__proto__:null,clamp:clamp});class Slider extends Component$1{constructor(player,options){super(player,options),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 doc=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(doc,"mousemove",this.handleMouseMove_),this.off(doc,"mouseup",this.handleMouseUp_),this.off(doc,"touchmove",this.handleMouseMove_),this.off(doc,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(type){let props=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return props.className=props.className+" vjs-slider",props=Object.assign({tabIndex:0},props),attributes=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},attributes),super.createEl(type,props,attributes)}handleMouseDown(event){const doc=this.bar.el_.ownerDocument;"mousedown"===event.type&&event.preventDefault(),"touchstart"!==event.type||IS_CHROME||event.preventDefault(),blockTextSelection(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(doc,"mousemove",this.handleMouseMove_),this.on(doc,"mouseup",this.handleMouseUp_),this.on(doc,"touchmove",this.handleMouseMove_),this.on(doc,"touchend",this.handleMouseUp_),this.handleMouseMove(event,!0)}handleMouseMove(event){}handleMouseUp(event){const doc=this.bar.el_.ownerDocument;unblockTextSelection(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(doc,"mousemove",this.handleMouseMove_),this.off(doc,"mouseup",this.handleMouseUp_),this.off(doc,"touchmove",this.handleMouseMove_),this.off(doc,"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 sizeKey=this.vertical()?"height":"width";this.bar.el().style[sizeKey]=(100*progress).toFixed(2)+"%"}))),progress}getProgress(){return Number(clamp(this.getPercent(),0,1).toFixed(4))}calculateDistance(event){const position=getPointerPosition(this.el_,event);return this.vertical()?position.y:position.x}handleKeyDown(event){keycode.isEventKey(event,"Left")||keycode.isEventKey(event,"Down")?(event.preventDefault(),event.stopPropagation(),this.stepBack()):keycode.isEventKey(event,"Right")||keycode.isEventKey(event,"Up")?(event.preventDefault(),event.stopPropagation(),this.stepForward()):super.handleKeyDown(event)}handleClick(event){event.stopPropagation(),event.preventDefault()}vertical(bool){if(void 0===bool)return this.vertical_||!1;this.vertical_=!!bool,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}Component$1.registerComponent("Slider",Slider);const percentify=(time,end)=>clamp(time/end*100,0,100).toFixed(2)+"%";Component$1.registerComponent("LoadProgressBar",class extends Component$1{constructor(player,options){super(player,options),this.partEls_=[],this.on(player,"progress",(e=>this.update(e)))}createEl(){const el=super.createEl("div",{className:"vjs-load-progress"}),wrapper=createEl("span",{className:"vjs-control-text"}),loadedText=createEl("span",{textContent:this.localize("Loaded")}),separator=document.createTextNode(": ");return this.percentageEl_=createEl("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),el.appendChild(wrapper),wrapper.appendChild(loadedText),wrapper.appendChild(separator),wrapper.appendChild(this.percentageEl_),el}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(event){this.requestNamedAnimationFrame("LoadProgressBar#update",(()=>{const liveTracker=this.player_.liveTracker,buffered=this.player_.buffered(),duration=liveTracker&&liveTracker.isLive()?liveTracker.seekableEnd():this.player_.duration(),bufferedEnd=this.player_.bufferedEnd(),children=this.partEls_,percent=percentify(bufferedEnd,duration);this.percent_!==percent&&(this.el_.style.width=percent,textContent(this.percentageEl_,percent),this.percent_=percent);for(let i=0;ibuffered.length;i--)this.el_.removeChild(children[i-1]);children.length=buffered.length}))}});Component$1.registerComponent("TimeTooltip",class extends Component$1{constructor(player,options){super(player,options),this.update=throttle(bind_(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(seekBarRect,seekBarPoint,content){const tooltipRect=findPosition(this.el_),playerRect=getBoundingClientRect(this.player_.el()),seekBarPointPx=seekBarRect.width*seekBarPoint;if(!playerRect||!tooltipRect)return;const spaceLeftOfPoint=seekBarRect.left-playerRect.left+seekBarPointPx,spaceRightOfPoint=seekBarRect.width-seekBarPointPx+(playerRect.right-seekBarRect.right);let pullTooltipBy=tooltipRect.width/2;spaceLeftOfPointtooltipRect.width&&(pullTooltipBy=tooltipRect.width),pullTooltipBy=Math.round(pullTooltipBy),this.el_.style.right="-".concat(pullTooltipBy,"px"),this.write(content)}write(content){textContent(this.el_,content)}updateTime(seekBarRect,seekBarPoint,time,cb){this.requestNamedAnimationFrame("TimeTooltip#updateTime",(()=>{let content;const duration=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const liveWindow=this.player_.liveTracker.liveWindow(),secondsBehind=liveWindow-seekBarPoint*liveWindow;content=(secondsBehind<1?"":"-")+formatTime(secondsBehind,liveWindow)}else content=formatTime(time,duration);this.update(seekBarRect,seekBarPoint,content),cb&&cb()}))}});class PlayProgressBar extends Component$1{constructor(player,options){super(player,options),this.update=throttle(bind_(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(seekBarRect,seekBarPoint){const timeTooltip=this.getChild("timeTooltip");if(!timeTooltip)return;const time=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();timeTooltip.updateTime(seekBarRect,seekBarPoint,time)}}PlayProgressBar.prototype.options_={children:[]},IS_IOS||IS_ANDROID||PlayProgressBar.prototype.options_.children.push("timeTooltip"),Component$1.registerComponent("PlayProgressBar",PlayProgressBar);class MouseTimeDisplay extends Component$1{constructor(player,options){super(player,options),this.update=throttle(bind_(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(seekBarRect,seekBarPoint){const time=seekBarPoint*this.player_.duration();this.getChild("timeTooltip").updateTime(seekBarRect,seekBarPoint,time,(()=>{this.el_.style.left="".concat(seekBarRect.width*seekBarPoint,"px")}))}}MouseTimeDisplay.prototype.options_={children:["timeTooltip"]},Component$1.registerComponent("MouseTimeDisplay",MouseTimeDisplay);class SeekBar extends Slider{constructor(player,options){super(player,options),this.setEventHandlers_()}setEventHandlers_(){this.update_=bind_(this,this.update),this.update=throttle(this.update_,30),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 document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.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,30))}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(event){if("hidden"===document.visibilityState)return;const percent=super.update();return this.requestNamedAnimationFrame("SeekBar#update",(()=>{const currentTime=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),liveTracker=this.player_.liveTracker;let duration=this.player_.duration();liveTracker&&liveTracker.isLive()&&(duration=this.player_.liveTracker.liveCurrentTime()),this.percent_!==percent&&(this.el_.setAttribute("aria-valuenow",(100*percent).toFixed(2)),this.percent_=percent),this.currentTime_===currentTime&&this.duration_===duration||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[formatTime(currentTime,duration),formatTime(duration,duration)],"{1} of {2}")),this.currentTime_=currentTime,this.duration_=duration),this.bar&&this.bar.update(getBoundingClientRect(this.el()),this.getProgress())})),percent}userSeek_(ct){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(ct)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){const currentTime=this.getCurrentTime_();let percent;const liveTracker=this.player_.liveTracker;return liveTracker&&liveTracker.isLive()?(percent=(currentTime-liveTracker.seekableStart())/liveTracker.liveWindow(),liveTracker.atLiveEdge()&&(percent=1)):percent=currentTime/this.player_.duration(),percent}handleMouseDown(event){isSingleLeftClick(event)&&(event.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(event))}handleMouseMove(event){let newTime,mouseDown=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!isSingleLeftClick(event))return;mouseDown||this.player_.scrubbing()||this.player_.scrubbing(!0);const distance=this.calculateDistance(event),liveTracker=this.player_.liveTracker;if(liveTracker&&liveTracker.isLive()){if(distance>=.99)return void liveTracker.seekToLiveEdge();const seekableStart=liveTracker.seekableStart(),seekableEnd=liveTracker.liveCurrentTime();if(newTime=seekableStart+distance*liveTracker.liveWindow(),newTime>=seekableEnd&&(newTime=seekableEnd),newTime<=seekableStart&&(newTime=seekableStart+.1),newTime===1/0)return}else newTime=distance*this.player_.duration(),newTime===this.player_.duration()&&(newTime-=.1);this.userSeek_(newTime)}enable(){super.enable();const mouseTimeDisplay=this.getChild("mouseTimeDisplay");mouseTimeDisplay&&mouseTimeDisplay.show()}disable(){super.disable();const mouseTimeDisplay=this.getChild("mouseTimeDisplay");mouseTimeDisplay&&mouseTimeDisplay.hide()}handleMouseUp(event){super.handleMouseUp(event),event&&event.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?silencePromise(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(event){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(event){const liveTracker=this.player_.liveTracker;if(keycode.isEventKey(event,"Space")||keycode.isEventKey(event,"Enter"))event.preventDefault(),event.stopPropagation(),this.handleAction(event);else if(keycode.isEventKey(event,"Home"))event.preventDefault(),event.stopPropagation(),this.userSeek_(0);else if(keycode.isEventKey(event,"End"))event.preventDefault(),event.stopPropagation(),liveTracker&&liveTracker.isLive()?this.userSeek_(liveTracker.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(keycode(event))){event.preventDefault(),event.stopPropagation();const gotoFraction=10*(keycode.codes[keycode(event)]-keycode.codes[0])/100;liveTracker&&liveTracker.isLive()?this.userSeek_(liveTracker.seekableStart()+liveTracker.liveWindow()*gotoFraction):this.userSeek_(this.player_.duration()*gotoFraction)}else keycode.isEventKey(event,"PgDn")?(event.preventDefault(),event.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):keycode.isEventKey(event,"PgUp")?(event.preventDefault(),event.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(event)}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 document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}SeekBar.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},IS_IOS||IS_ANDROID||SeekBar.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Component$1.registerComponent("SeekBar",SeekBar);class ProgressControl extends Component$1{constructor(player,options){super(player,options),this.handleMouseMove=throttle(bind_(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=throttle(bind_(this,this.handleMouseSeek),30),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(event){const seekBar=this.getChild("seekBar");if(!seekBar)return;const playProgressBar=seekBar.getChild("playProgressBar"),mouseTimeDisplay=seekBar.getChild("mouseTimeDisplay");if(!playProgressBar&&!mouseTimeDisplay)return;const seekBarEl=seekBar.el(),seekBarRect=findPosition(seekBarEl);let seekBarPoint=getPointerPosition(seekBarEl,event).x;seekBarPoint=clamp(seekBarPoint,0,1),mouseTimeDisplay&&mouseTimeDisplay.update(seekBarRect,seekBarPoint),playProgressBar&&playProgressBar.update(seekBarRect,seekBar.getProgress())}handleMouseSeek(event){const seekBar=this.getChild("seekBar");seekBar&&seekBar.handleMouseMove(event)}enabled(){return this.enabled_}disable(){if(this.children().forEach((child=>child.disable&&child.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 seekBar=this.getChild("seekBar");this.player_.scrubbing(!1),seekBar.videoWasPlaying&&silencePromise(this.player_.play())}}enable(){this.children().forEach((child=>child.enable&&child.enable())),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const doc=this.el_.ownerDocument;this.off(doc,"mousemove",this.throttledHandleMouseSeek),this.off(doc,"touchmove",this.throttledHandleMouseSeek),this.off(doc,"mouseup",this.handleMouseUpHandler_),this.off(doc,"touchend",this.handleMouseUpHandler_)}handleMouseDown(event){const doc=this.el_.ownerDocument,seekBar=this.getChild("seekBar");seekBar&&seekBar.handleMouseDown(event),this.on(doc,"mousemove",this.throttledHandleMouseSeek),this.on(doc,"touchmove",this.throttledHandleMouseSeek),this.on(doc,"mouseup",this.handleMouseUpHandler_),this.on(doc,"touchend",this.handleMouseUpHandler_)}handleMouseUp(event){const seekBar=this.getChild("seekBar");seekBar&&seekBar.handleMouseUp(event),this.removeListenersAddedOnMousedownAndTouchstart()}}ProgressControl.prototype.options_={children:["seekBar"]},Component$1.registerComponent("ProgressControl",ProgressControl);class PictureInPictureToggle extends Button{constructor(player,options){super(player,options),this.on(player,["enterpictureinpicture","leavepictureinpicture"],(e=>this.handlePictureInPictureChange(e))),this.on(player,["disablepictureinpicturechanged","loadedmetadata"],(e=>this.handlePictureInPictureEnabledChange(e))),this.on(player,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(()=>{"audio"===player.currentType().substring(0,5)||player.audioPosterMode()||player.audioOnlyMode()?(player.isInPictureInPicture()&&player.exitPictureInPicture(),this.hide()):this.show()})),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control ".concat(super.buildCSSClass())}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(event){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()}handleClick(event){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}}PictureInPictureToggle.prototype.controlText_="Picture-in-Picture",Component$1.registerComponent("PictureInPictureToggle",PictureInPictureToggle);class FullscreenToggle extends Button{constructor(player,options){super(player,options),this.on(player,"fullscreenchange",(e=>this.handleFullscreenChange(e))),!1===document[player.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control ".concat(super.buildCSSClass())}handleFullscreenChange(event){this.player_.isFullscreen()?this.controlText("Exit Fullscreen"):this.controlText("Fullscreen")}handleClick(event){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}FullscreenToggle.prototype.controlText_="Fullscreen",Component$1.registerComponent("FullscreenToggle",FullscreenToggle);Component$1.registerComponent("VolumeLevel",class extends Component$1{createEl(){const el=super.createEl("div",{className:"vjs-volume-level"});return el.appendChild(super.createEl("span",{className:"vjs-control-text"})),el}});Component$1.registerComponent("VolumeLevelTooltip",class extends Component$1{constructor(player,options){super(player,options),this.update=throttle(bind_(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(rangeBarRect,rangeBarPoint,vertical,content){if(!vertical){const tooltipRect=getBoundingClientRect(this.el_),playerRect=getBoundingClientRect(this.player_.el()),volumeBarPointPx=rangeBarRect.width*rangeBarPoint;if(!playerRect||!tooltipRect)return;const spaceLeftOfPoint=rangeBarRect.left-playerRect.left+volumeBarPointPx,spaceRightOfPoint=rangeBarRect.width-volumeBarPointPx+(playerRect.right-rangeBarRect.right);let pullTooltipBy=tooltipRect.width/2;spaceLeftOfPointtooltipRect.width&&(pullTooltipBy=tooltipRect.width),this.el_.style.right="-".concat(pullTooltipBy,"px")}this.write("".concat(content,"%"))}write(content){textContent(this.el_,content)}updateVolume(rangeBarRect,rangeBarPoint,vertical,volume,cb){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(()=>{this.update(rangeBarRect,rangeBarPoint,vertical,volume.toFixed(0)),cb&&cb()}))}});class MouseVolumeLevelDisplay extends Component$1{constructor(player,options){super(player,options),this.update=throttle(bind_(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(rangeBarRect,rangeBarPoint,vertical){const volume=100*rangeBarPoint;this.getChild("volumeLevelTooltip").updateVolume(rangeBarRect,rangeBarPoint,vertical,volume,(()=>{vertical?this.el_.style.bottom="".concat(rangeBarRect.height*rangeBarPoint,"px"):this.el_.style.left="".concat(rangeBarRect.width*rangeBarPoint,"px")}))}}MouseVolumeLevelDisplay.prototype.options_={children:["volumeLevelTooltip"]},Component$1.registerComponent("MouseVolumeLevelDisplay",MouseVolumeLevelDisplay);class VolumeBar extends Slider{constructor(player,options){super(player,options),this.on("slideractive",(e=>this.updateLastVolume_(e))),this.on(player,"volumechange",(e=>this.updateARIAAttributes(e))),player.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(event){isSingleLeftClick(event)&&super.handleMouseDown(event)}handleMouseMove(event){const mouseVolumeLevelDisplay=this.getChild("mouseVolumeLevelDisplay");if(mouseVolumeLevelDisplay){const volumeBarEl=this.el(),volumeBarRect=getBoundingClientRect(volumeBarEl),vertical=this.vertical();let volumeBarPoint=getPointerPosition(volumeBarEl,event);volumeBarPoint=vertical?volumeBarPoint.y:volumeBarPoint.x,volumeBarPoint=clamp(volumeBarPoint,0,1),mouseVolumeLevelDisplay.update(volumeBarRect,volumeBarPoint,vertical)}isSingleLeftClick(event)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(event)))}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(event){const ariaValue=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",ariaValue),this.el_.setAttribute("aria-valuetext",ariaValue+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const volumeBeforeDrag=this.player_.volume();this.one("sliderinactive",(()=>{0===this.player_.volume()&&this.player_.lastVolume_(volumeBeforeDrag)}))}}VolumeBar.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},IS_IOS||IS_ANDROID||VolumeBar.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),VolumeBar.prototype.playerEvent="volumechange",Component$1.registerComponent("VolumeBar",VolumeBar);class VolumeControl extends Component$1{constructor(player){let options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};options.vertical=options.vertical||!1,(void 0===options.volumeBar||isPlain(options.volumeBar))&&(options.volumeBar=options.volumeBar||{},options.volumeBar.vertical=options.vertical),super(player,options),function(self,player){player.tech_&&!player.tech_.featuresVolumeControl&&self.addClass("vjs-hidden"),self.on(player,"loadstart",(function(){player.tech_.featuresVolumeControl?self.removeClass("vjs-hidden"):self.addClass("vjs-hidden")}))}(this,player),this.throttledHandleMouseMove=throttle(bind_(this,this.handleMouseMove),30),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 orientationClass="vjs-volume-horizontal";return this.options_.vertical&&(orientationClass="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control ".concat(orientationClass)})}handleMouseDown(event){const doc=this.el_.ownerDocument;this.on(doc,"mousemove",this.throttledHandleMouseMove),this.on(doc,"touchmove",this.throttledHandleMouseMove),this.on(doc,"mouseup",this.handleMouseUpHandler_),this.on(doc,"touchend",this.handleMouseUpHandler_)}handleMouseUp(event){const doc=this.el_.ownerDocument;this.off(doc,"mousemove",this.throttledHandleMouseMove),this.off(doc,"touchmove",this.throttledHandleMouseMove),this.off(doc,"mouseup",this.handleMouseUpHandler_),this.off(doc,"touchend",this.handleMouseUpHandler_)}handleMouseMove(event){this.volumeBar.handleMouseMove(event)}}VolumeControl.prototype.options_={children:["volumeBar"]},Component$1.registerComponent("VolumeControl",VolumeControl);class MuteToggle extends Button{constructor(player,options){super(player,options),function(self,player){player.tech_&&!player.tech_.featuresMuteControl&&self.addClass("vjs-hidden"),self.on(player,"loadstart",(function(){player.tech_.featuresMuteControl?self.removeClass("vjs-hidden"):self.addClass("vjs-hidden")}))}(this,player),this.on(player,["loadstart","volumechange"],(e=>this.update(e)))}buildCSSClass(){return"vjs-mute-control ".concat(super.buildCSSClass())}handleClick(event){const vol=this.player_.volume(),lastVolume=this.player_.lastVolume_();if(0===vol){const volumeToSet=lastVolume<.1?.1:lastVolume;this.player_.volume(volumeToSet),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(event){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const vol=this.player_.volume();let level=3;IS_IOS&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===vol||this.player_.muted()?level=0:vol<.33?level=1:vol<.67&&(level=2),removeClass(this.el_,[0,1,2,3].reduce(((str,i)=>str+"".concat(i?" ":"","vjs-vol-").concat(i)),"")),addClass(this.el_,"vjs-vol-".concat(level))}updateControlText_(){const text=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==text&&this.controlText(text)}}MuteToggle.prototype.controlText_="Mute",Component$1.registerComponent("MuteToggle",MuteToggle);class VolumePanel extends Component$1{constructor(player){let options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0!==options.inline?options.inline=options.inline:options.inline=!0,(void 0===options.volumeControl||isPlain(options.volumeControl))&&(options.volumeControl=options.volumeControl||{},options.volumeControl.vertical=!options.inline),super(player,options),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(player,["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 orientationClass="vjs-volume-panel-horizontal";return this.options_.inline||(orientationClass="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control ".concat(orientationClass)})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(event){keycode.isEventKey(event,"Esc")&&this.muteToggle.focus()}handleMouseOver(event){this.addClass("vjs-hover"),on(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(event){this.removeClass("vjs-hover"),off(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(event){keycode.isEventKey(event,"Esc")&&this.handleMouseOut()}}VolumePanel.prototype.options_={children:["muteToggle","volumeControl"]},Component$1.registerComponent("VolumePanel",VolumePanel);Component$1.registerComponent("SkipForward",class extends Button{constructor(player,options){super(player,options),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){const playerOptions=this.options_.playerOptions;return playerOptions.controlBar&&playerOptions.controlBar.skipButtons&&playerOptions.controlBar.skipButtons.forward}buildCSSClass(){return"vjs-skip-forward-".concat(this.getSkipForwardTime()," ").concat(super.buildCSSClass())}handleClick(event){const currentVideoTime=this.player_.currentTime(),liveTracker=this.player_.liveTracker,duration=liveTracker&&liveTracker.isLive()?liveTracker.seekableEnd():this.player_.duration();let newTime;newTime=currentVideoTime+this.skipTime<=duration?currentVideoTime+this.skipTime:duration,this.player_.currentTime(newTime)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}});class SkipBackward extends Button{constructor(player,options){super(player,options),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){const playerOptions=this.options_.playerOptions;return playerOptions.controlBar&&playerOptions.controlBar.skipButtons&&playerOptions.controlBar.skipButtons.backward}buildCSSClass(){return"vjs-skip-backward-".concat(this.getSkipBackwardTime()," ").concat(super.buildCSSClass())}handleClick(event){const currentVideoTime=this.player_.currentTime(),liveTracker=this.player_.liveTracker,seekableStart=liveTracker&&liveTracker.isLive()&&liveTracker.seekableStart();let newTime;newTime=seekableStart&¤tVideoTime-this.skipTime<=seekableStart?seekableStart:currentVideoTime>=this.skipTime?currentVideoTime-this.skipTime:0,this.player_.currentTime(newTime)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}SkipBackward.prototype.controlText_="Skip Backward",Component$1.registerComponent("SkipBackward",SkipBackward);class Menu extends Component$1{constructor(player,options){super(player,options),options&&(this.menuButton_=options.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 Component$1&&(this.on(component,"blur",this.boundHandleBlur_),this.on(component,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(component){component instanceof Component$1&&(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 childComponent=this.addChild(component);childComponent&&this.addEventListenerForItem(childComponent)}createEl(){const contentElType=this.options_.contentElType||"ul";this.contentEl_=createEl(contentElType,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const el=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return el.appendChild(this.contentEl_),on(el,"click",(function(event){event.preventDefault(),event.stopImmediatePropagation()})),el}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(event){const relatedTarget=event.relatedTarget||document.activeElement;if(!this.children().some((element=>element.el()===relatedTarget))){const btn=this.menuButton_;btn&&btn.buttonPressed_&&relatedTarget!==btn.el().firstChild&&btn.unpressButton()}}handleTapClick(event){if(this.menuButton_){this.menuButton_.unpressButton();const childComponents=this.children();if(!Array.isArray(childComponents))return;const foundComponent=childComponents.filter((component=>component.el()===event.target))[0];if(!foundComponent)return;"CaptionSettingsMenuItem"!==foundComponent.name()&&this.menuButton_.focus()}}handleKeyDown(event){keycode.isEventKey(event,"Left")||keycode.isEventKey(event,"Down")?(event.preventDefault(),event.stopPropagation(),this.stepForward()):(keycode.isEventKey(event,"Right")||keycode.isEventKey(event,"Up"))&&(event.preventDefault(),event.stopPropagation(),this.stepBack())}stepForward(){let stepChild=0;void 0!==this.focusedChild_&&(stepChild=this.focusedChild_+1),this.focus(stepChild)}stepBack(){let stepChild=0;void 0!==this.focusedChild_&&(stepChild=this.focusedChild_-1),this.focus(stepChild)}focus(){let item=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const children=this.children().slice();children.length&&children[0].hasClass("vjs-menu-title")&&children.shift(),children.length>0&&(item<0?item=0:item>=children.length&&(item=children.length-1),this.focusedChild_=item,children[item].el_.focus())}}Component$1.registerComponent("Menu",Menu);class MenuButton extends Component$1{constructor(player){let options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(player,options),this.menuButton_=new Button(player,options),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const buttonClass=Button.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+buttonClass,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const handleClick=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",handleClick),this.on(this.menuButton_,"click",handleClick),this.on(this.menuButton_,"keydown",(e=>this.handleKeyDown(e))),this.on(this.menuButton_,"mouseenter",(()=>{this.addClass("vjs-hover"),this.menu.show(),on(document,"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 Menu(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const titleEl=createEl("li",{className:"vjs-menu-title",textContent:toTitleCase$1(this.options_.title),tabIndex:-1}),titleComponent=new Component$1(this.player_,{el:titleEl});menu.addItem(titleComponent)}if(this.items=this.createItems(),this.items)for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:this.menuButton_.el();return this.menuButton_.controlText(text,el)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(event){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(event){this.removeClass("vjs-hover"),off(document,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(event){keycode.isEventKey(event,"Esc")||keycode.isEventKey(event,"Tab")?(this.buttonPressed_&&this.unpressButton(),keycode.isEventKey(event,"Tab")||(event.preventDefault(),this.menuButton_.focus())):(keycode.isEventKey(event,"Up")||keycode.isEventKey(event,"Down"))&&(this.buttonPressed_||(event.preventDefault(),this.pressButton()))}handleMenuKeyUp(event){(keycode.isEventKey(event,"Esc")||keycode.isEventKey(event,"Tab"))&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(event){this.handleSubmenuKeyDown(event)}handleSubmenuKeyDown(event){(keycode.isEventKey(event,"Esc")||keycode.isEventKey(event,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),keycode.isEventKey(event,"Tab")||(event.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"),IS_IOS&&isInFrame())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()}}Component$1.registerComponent("MenuButton",MenuButton);class TrackButton extends MenuButton{constructor(player,options){const tracks=options.tracks;if(super(player,options),this.items.length<=1&&this.hide(),!tracks)return;const updateHandler=bind_(this,this.update);tracks.addEventListener("removetrack",updateHandler),tracks.addEventListener("addtrack",updateHandler),tracks.addEventListener("labelchange",updateHandler),this.player_.on("ready",updateHandler),this.player_.on("dispose",(function(){tracks.removeEventListener("removetrack",updateHandler),tracks.removeEventListener("addtrack",updateHandler),tracks.removeEventListener("labelchange",updateHandler)}))}}Component$1.registerComponent("TrackButton",TrackButton);const MenuKeys=["Tab","Esc","Up","Down","Right","Left"];class MenuItem extends ClickableComponent{constructor(player,options){super(player,options),this.selectable=options.selectable,this.isSelected_=options.selected||!1,this.multiSelectable=options.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(type,props,attrs){this.nonIconControl=!0;const el=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},props),attrs);return el.replaceChild(createEl("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),el.querySelector(".vjs-icon-placeholder")),el}handleKeyDown(event){MenuKeys.some((key=>keycode.isEventKey(event,key)))||super.handleKeyDown(event)}handleClick(event){this.selected(!0)}selected(selected){this.selectable&&(selected?(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))}}Component$1.registerComponent("MenuItem",MenuItem);class TextTrackMenuItem extends MenuItem{constructor(player,options){var _this3;const track=options.track,tracks=player.textTracks();options.label=track.label||track.language||"Unknown",options.selected="showing"===track.mode,super(player,options),_this3=this,this.track=track,this.kinds=(options.kinds||[options.kind||this.track.kind]).filter(Boolean);const changeHandler=function(){for(var _len17=arguments.length,args=new Array(_len17),_key17=0;_key17<_len17;_key17++)args[_key17]=arguments[_key17];_this3.handleTracksChange.apply(_this3,args)},selectedLanguageChangeHandler=function(){for(var _len18=arguments.length,args=new Array(_len18),_key18=0;_key18<_len18;_key18++)args[_key18]=arguments[_key18];_this3.handleSelectedLanguageChange.apply(_this3,args)};if(player.on(["loadstart","texttrackchange"],changeHandler),tracks.addEventListener("change",changeHandler),tracks.addEventListener("selectedlanguagechange",selectedLanguageChangeHandler),this.on("dispose",(function(){player.off(["loadstart","texttrackchange"],changeHandler),tracks.removeEventListener("change",changeHandler),tracks.removeEventListener("selectedlanguagechange",selectedLanguageChangeHandler)})),void 0===tracks.onchange){let event;this.on(["tap","click"],(function(){if("object"!=typeof window.Event)try{event=new window.Event("change")}catch(err){}event||(event=document.createEvent("Event"),event.initEvent("change",!0,!0)),tracks.dispatchEvent(event)}))}this.handleTracksChange()}handleClick(event){const referenceTrack=this.track,tracks=this.player_.textTracks();if(super.handleClick(event),tracks)for(let i=0;i-1&&"showing"===track.mode){shouldBeSelected=!1;break}}shouldBeSelected!==this.isSelected_&&this.selected(shouldBeSelected)}handleSelectedLanguageChange(event){const tracks=this.player().textTracks();let allHidden=!0;for(let i=0,l=tracks.length;i-1&&"showing"===track.mode){allHidden=!1;break}}allHidden&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}Component$1.registerComponent("OffTextTrackMenuItem",OffTextTrackMenuItem);class TextTrackButton extends TrackButton{constructor(player){let options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};options.tracks=player.textTracks(),super(player,options)}createItems(){let label,items=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],TrackMenuItem=arguments.length>1&&void 0!==arguments[1]?arguments[1]:TextTrackMenuItem;this.label_&&(label="".concat(this.label_," off")),items.push(new OffTextTrackMenuItem(this.player_,{kinds:this.kinds_,kind:this.kind_,label:label})),this.hideThreshold_+=1;const tracks=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let i=0;i-1){const item=new TrackMenuItem(this.player_,{track:track,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});item.addClass("vjs-".concat(track.kind,"-menu-item")),items.push(item)}}return items}}Component$1.registerComponent("TextTrackButton",TextTrackButton);class ChaptersTrackMenuItem extends MenuItem{constructor(player,options){const track=options.track,cue=options.cue,currentTime=player.currentTime();options.selectable=!0,options.multiSelectable=!1,options.label=cue.text,options.selected=cue.startTime<=currentTime&¤tTime{this.items.forEach((item=>{item.selected(this.track_.activeCues[0]===item.cue)}))}}buildCSSClass(){return"vjs-chapters-button ".concat(super.buildCSSClass())}buildWrapperCSSClass(){return"vjs-chapters-button ".concat(super.buildWrapperCSSClass())}update(event){if(event&&event.track&&"chapters"!==event.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 remoteTextTrackEl=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);remoteTextTrackEl&&remoteTextTrackEl.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=track,this.track_){this.track_.mode="hidden";const remoteTextTrackEl=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);remoteTextTrackEl&&remoteTextTrackEl.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const tracks=this.player_.textTracks()||[];for(let i=tracks.length-1;i>=0;i--){const track=tracks[i];if(track.kind===this.kind_)return track}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(toTitleCase$1(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const items=[];if(!this.track_)return items;const cues=this.track_.cues;if(!cues)return items;for(let i=0,l=cues.length;i1&&void 0!==arguments[1]?arguments[1]:{}),this.label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions"),this.menuButton_.controlText(toTitleCase$1(this.label_))}buildCSSClass(){return"vjs-subs-caps-button ".concat(super.buildCSSClass())}buildWrapperCSSClass(){return"vjs-subs-caps-button ".concat(super.buildWrapperCSSClass())}createItems(){let items=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(items.push(new CaptionSettingsMenuItem(this.player_,{kind:this.label_})),this.hideThreshold_+=1),items=super.createItems(items,SubsCapsMenuItem),items}}SubsCapsButton.prototype.kinds_=["captions","subtitles"],SubsCapsButton.prototype.controlText_="Subtitles",Component$1.registerComponent("SubsCapsButton",SubsCapsButton);class AudioTrackMenuItem extends MenuItem{constructor(player,options){var _this4;const track=options.track,tracks=player.audioTracks();options.label=track.label||track.language||"Unknown",options.selected=track.enabled,super(player,options),_this4=this,this.track=track,this.addClass("vjs-".concat(track.kind,"-menu-item"));const changeHandler=function(){for(var _len19=arguments.length,args=new Array(_len19),_key19=0;_key19<_len19;_key19++)args[_key19]=arguments[_key19];_this4.handleTracksChange.apply(_this4,args)};tracks.addEventListener("change",changeHandler),this.on("dispose",(()=>{tracks.removeEventListener("change",changeHandler)}))}createEl(type,props,attrs){const el=super.createEl(type,props,attrs),parentSpan=el.querySelector(".vjs-menu-item-text");return"main-desc"===this.options_.track.kind&&(parentSpan.appendChild(createEl("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),parentSpan.appendChild(createEl("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),el}handleClick(event){if(super.handleClick(event),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const tracks=this.player_.audioTracks();for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:{};options.tracks=player.audioTracks(),super(player,options)}buildCSSClass(){return"vjs-audio-button ".concat(super.buildCSSClass())}buildWrapperCSSClass(){return"vjs-audio-button ".concat(super.buildWrapperCSSClass())}createItems(){let items=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.hideThreshold_=1;const tracks=this.player_.audioTracks();for(let i=0;ithis.update(e)))}handleClick(event){super.handleClick(),this.player().playbackRate(this.rate)}update(event){this.selected(this.player().playbackRate()===this.rate)}}PlaybackRateMenuItem.prototype.contentElType="button",Component$1.registerComponent("PlaybackRateMenuItem",PlaybackRateMenuItem);class PlaybackRateMenuButton extends MenuButton{constructor(player,options){super(player,options),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(player,"loadstart",(e=>this.updateVisibility(e))),this.on(player,"ratechange",(e=>this.updateLabel(e))),this.on(player,"playbackrateschange",(e=>this.handlePlaybackRateschange(e)))}createEl(){const el=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=createEl("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),el.appendChild(this.labelEl_),el}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate ".concat(super.buildCSSClass())}buildWrapperCSSClass(){return"vjs-playback-rate ".concat(super.buildWrapperCSSClass())}createItems(){const rates=this.playbackRates(),items=[];for(let i=rates.length-1;i>=0;i--)items.push(new PlaybackRateMenuItem(this.player(),{rate:rates[i]+"x"}));return items}handlePlaybackRateschange(event){this.update()}playbackRates(){const player=this.player();return player.playbackRates&&player.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(event){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(event){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}PlaybackRateMenuButton.prototype.controlText_="Playback Rate",Component$1.registerComponent("PlaybackRateMenuButton",PlaybackRateMenuButton);class Spacer extends Component$1{buildCSSClass(){return"vjs-spacer ".concat(super.buildCSSClass())}createEl(){let tag=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",props=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return props.className||(props.className=this.buildCSSClass()),super.createEl(tag,props,attributes)}}Component$1.registerComponent("Spacer",Spacer);Component$1.registerComponent("CustomControlSpacer",class extends Spacer{buildCSSClass(){return"vjs-custom-control-spacer ".concat(super.buildCSSClass())}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}});class ControlBar extends Component$1{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}ControlBar.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in document&&ControlBar.prototype.options_.children.splice(ControlBar.prototype.options_.children.length-1,0,"pictureInPictureToggle"),Component$1.registerComponent("ControlBar",ControlBar);class ErrorDisplay extends ModalDialog{constructor(player,options){super(player,options),this.on(player,"error",(e=>this.open(e)))}buildCSSClass(){return"vjs-error-display ".concat(super.buildCSSClass())}content(){const error=this.player().error();return error?this.localize(error.message):""}}ErrorDisplay.prototype.options_=Object.assign({},ModalDialog.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Component$1.registerComponent("ErrorDisplay",ErrorDisplay);const COLOR_BLACK=["#000","Black"],COLOR_BLUE=["#00F","Blue"],COLOR_CYAN=["#0FF","Cyan"],COLOR_GREEN=["#0F0","Green"],COLOR_MAGENTA=["#F0F","Magenta"],COLOR_RED=["#F00","Red"],COLOR_WHITE=["#FFF","White"],COLOR_YELLOW=["#FF0","Yellow"],OPACITY_OPAQUE=["1","Opaque"],OPACITY_SEMI=["0.5","Semi-Transparent"],OPACITY_TRANS=["0","Transparent"],selectConfigs={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[COLOR_BLACK,COLOR_WHITE,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[OPACITY_OPAQUE,OPACITY_SEMI,OPACITY_TRANS]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[COLOR_WHITE,COLOR_BLACK,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},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:v=>"1.00"===v?null:Number(v)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[OPACITY_OPAQUE,OPACITY_SEMI]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[OPACITY_TRANS,OPACITY_SEMI,OPACITY_OPAQUE]}};function parseOptionValue(value,parser){if(parser&&(value=parser(value)),value&&"none"!==value)return value}selectConfigs.windowColor.options=selectConfigs.backgroundColor.options;Component$1.registerComponent("TextTrackSettings",class extends ModalDialog{constructor(player,options){options.temporary=!1,super(player,options),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=createEl("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===options.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()})),each(selectConfigs,(config=>{this.on(this.$(config.selector),"change",this.updateDisplay)})),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(key){let legendId=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",type=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"label";const config=selectConfigs[key],id=config.id.replace("%s",this.id_),selectLabelledbyIds=[legendId,id].join(" ").trim();return["<".concat(type,' id="').concat(id,'" class="').concat("label"===type?"vjs-label":"",'">'),this.localize(config.label),"".concat(type,">"),'").join("")}createElFgColor_(){const legendId="captions-text-legend-".concat(this.id_);return['"].join("")}createElBgColor_(){const legendId="captions-background-".concat(this.id_);return['"].join("")}createElWinColor_(){const legendId="captions-window-".concat(this.id_);return['"].join("")}createElColors_(){return createEl("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return createEl("div",{className:"vjs-track-settings-font",innerHTML:['",'",'"].join("")})}createElControls_(){const defaultsDescription=this.localize("restore all settings to the default values");return createEl("div",{className:"vjs-track-settings-controls",innerHTML:['",'")].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return reduce(selectConfigs,((accum,config,key)=>{const value=(el=this.$(config.selector),parser=config.parser,parseOptionValue(el.options[el.options.selectedIndex].value,parser));var el,parser;return void 0!==value&&(accum[key]=value),accum}),{})}setValues(values){each(selectConfigs,((config,key)=>{!function(el,value,parser){if(value)for(let i=0;i{const index=config.hasOwnProperty("default")?config.default:0;this.$(config.selector).selectedIndex=index}))}restoreSettings(){let values;try{values=JSON.parse(window.localStorage.getItem("vjs-text-track-settings"))}catch(err){log$1.warn(err)}values&&this.setValues(values)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const values=this.getValues();try{Object.keys(values).length?window.localStorage.setItem("vjs-text-track-settings",JSON.stringify(values)):window.localStorage.removeItem("vjs-text-track-settings")}catch(err){log$1.warn(err)}}updateDisplay(){const ttDisplay=this.player_.getChild("textTrackDisplay");ttDisplay&&ttDisplay.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;const cb=this.player_.controlBar,subsCapsBtn=cb&&cb.subsCapsButton,ccBtn=cb&&cb.captionsButton;subsCapsBtn?subsCapsBtn.focus():ccBtn&&ccBtn.focus()}handleLanguagechange(){this.fill()}});Component$1.registerComponent("ResizeManager",class extends Component$1{constructor(player,options){let RESIZE_OBSERVER_AVAILABLE=options.ResizeObserver||window.ResizeObserver;null===options.ResizeObserver&&(RESIZE_OBSERVER_AVAILABLE=!1);super(player,merge$2({createEl:!RESIZE_OBSERVER_AVAILABLE,reportTouchActivity:!1},options)),this.ResizeObserver=options.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=debounce((()=>{this.resizeHandler()}),100,!1,this),RESIZE_OBSERVER_AVAILABLE?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(player.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const debouncedHandler_=this.debouncedHandler_;let unloadListener_=this.unloadListener_=function(){off(this,"resize",debouncedHandler_),off(this,"unload",unloadListener_),unloadListener_=null};on(this.el_.contentWindow,"unload",unloadListener_),on(this.el_.contentWindow,"resize",debouncedHandler_)},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 defaults={trackingThreshold:20,liveTolerance:15};Component$1.registerComponent("LiveTracker",class extends Component$1{constructor(player,options){super(player,merge$2(defaults,options,{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 seekable=this.player_.seekable();if(!seekable||!seekable.length)return;const newTime=Number(window.performance.now().toFixed(4)),deltaTime=-1===this.lastTime_?0:(newTime-this.lastTime_)/1e3;this.lastTime_=newTime,this.pastSeekEnd_=this.pastSeekEnd()+deltaTime;const liveCurrentTime=this.liveCurrentTime(),currentTime=this.player_.currentTime();let isBehind=this.player_.paused()||this.seekedBehindLive_||Math.abs(liveCurrentTime-currentTime)>this.options_.liveTolerance;this.timeupdateSeen_&&liveCurrentTime!==1/0||(isBehind=!1),isBehind!==this.behindLiveEdge_&&(this.behindLiveEdge_=isBehind,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_,30),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 timeDiff=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&timeDiff>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 seekable=this.player_.seekable(),seekableEnds=[];let i=seekable?seekable.length:0;for(;i--;)seekableEnds.push(seekable.end(i));return seekableEnds.length?seekableEnds.sort()[seekableEnds.length-1]:1/0}seekableStart(){const seekable=this.player_.seekable(),seekableStarts=[];let i=seekable?seekable.length:0;for(;i--;)seekableStarts.push(seekable.start(i));return seekableStarts.length?seekableStarts.sort()[0]:0}liveWindow(){const liveCurrentTime=this.liveCurrentTime();return liveCurrentTime===1/0?0:liveCurrentTime-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const seekableEnd=this.seekableEnd();return-1!==this.lastSeekEnd_&&seekableEnd!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=seekableEnd,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()}});Component$1.registerComponent("TitleBar",class extends Component$1{constructor(player,options){super(player,options),this.on("statechanged",(e=>this.updateDom_())),this.updateDom_()}createEl(){return this.els={title:createEl("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-".concat(newGUID())}),description:createEl("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-".concat(newGUID())})},createEl("div",{className:"vjs-title-bar"},{},Object.values(this.els))}updateDom_(){const tech=this.player_.tech_,techEl=tech&&tech.el_,techAriaAttrs={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach((k=>{const value=this.state[k],el=this.els[k],techAriaAttr=techAriaAttrs[k];emptyEl(el),value&&textContent(el,value),techEl&&(techEl.removeAttribute(techAriaAttr),value&&techEl.setAttribute(techAriaAttr,el.id))})),this.state.title||this.state.description?this.show():this.hide()}update(options){this.setState(options)}dispose(){const tech=this.player_.tech_,techEl=tech&&tech.el_;techEl&&(techEl.removeAttribute("aria-labelledby"),techEl.removeAttribute("aria-describedby")),super.dispose(),this.els=null}});const sourcesetLoad=tech=>{const el=tech.el();if(el.hasAttribute("src"))return tech.triggerSourceset(el.src),!0;const sources=tech.$$("source"),srcUrls=[];let src="";if(!sources.length)return!1;for(let i=0;i{let descriptor={};for(let i=0;igetDescriptor([tech.el(),window.HTMLMediaElement.prototype,window.Element.prototype,innerHTMLDescriptorPolyfill],"innerHTML"))(tech),appendWrapper=appendFn=>function(){for(var _len20=arguments.length,args=new Array(_len20),_key20=0;_key20<_len20;_key20++)args[_key20]=arguments[_key20];const retval=appendFn.apply(el,args);return sourcesetLoad(tech),retval};["append","appendChild","insertAdjacentHTML"].forEach((k=>{el[k]&&(old[k]=el[k],el[k]=appendWrapper(old[k]))})),Object.defineProperty(el,"innerHTML",merge$2(innerDescriptor,{set:appendWrapper(innerDescriptor.set)})),el.resetSourceWatch_=()=>{el.resetSourceWatch_=null,Object.keys(old).forEach((k=>{el[k]=old[k]})),Object.defineProperty(el,"innerHTML",innerDescriptor)},tech.one("sourceset",el.resetSourceWatch_)},srcDescriptorPolyfill=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?getAbsoluteURL(window.Element.prototype.getAttribute.call(this,"src")):""},set(v){return window.Element.prototype.setAttribute.call(this,"src",v),v}}),setupSourceset=function(tech){if(!tech.featuresSourceset)return;const el=tech.el();if(el.resetSourceset_)return;const srcDescriptor=(tech=>getDescriptor([tech.el(),window.HTMLMediaElement.prototype,srcDescriptorPolyfill],"src"))(tech),oldSetAttribute=el.setAttribute,oldLoad=el.load;Object.defineProperty(el,"src",merge$2(srcDescriptor,{set:v=>{const retval=srcDescriptor.set.call(el,v);return tech.triggerSourceset(el.src),retval}})),el.setAttribute=(n,v)=>{const retval=oldSetAttribute.call(el,n,v);return/src/i.test(n)&&tech.triggerSourceset(el.src),retval},el.load=()=>{const retval=oldLoad.call(el);return sourcesetLoad(tech)||(tech.triggerSourceset(""),firstSourceWatch(tech)),retval},el.currentSrc?tech.triggerSourceset(el.currentSrc):sourcesetLoad(tech)||firstSourceWatch(tech),el.resetSourceset_=()=>{el.resetSourceset_=null,el.load=oldLoad,el.setAttribute=oldSetAttribute,Object.defineProperty(el,"src",srcDescriptor),el.resetSourceWatch_&&el.resetSourceWatch_()}};class Html5 extends Tech{constructor(options,ready){super(options,ready);const source=options.source;let crossoriginTracks=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,source&&(this.el_.currentSrc!==source.src||options.tag&&3===options.tag.initNetworkState_)?this.setSource(source):this.handleLateInit_(this.el_),options.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const nodes=this.el_.childNodes;let nodesLength=nodes.length;const removeNodes=[];for(;nodesLength--;){const node=nodes[nodesLength];"track"===node.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(node),this.remoteTextTracks().addTrack(node.track),this.textTracks().addTrack(node.track),crossoriginTracks||this.el_.hasAttribute("crossorigin")||!isCrossOrigin(node.src)||(crossoriginTracks=!0)):removeNodes.push(node))}for(let i=0;i{metadataTracksPreFullscreenState=[];for(let i=0;itextTracks.removeEventListener("change",takeMetadataTrackSnapshot)));const restoreTrackMode=()=>{for(let i=0;i{textTracks.removeEventListener("change",takeMetadataTrackSnapshot),textTracks.removeEventListener("change",restoreTrackMode),textTracks.addEventListener("change",restoreTrackMode)})),this.on("webkitendfullscreen",(()=>{textTracks.removeEventListener("change",takeMetadataTrackSnapshot),textTracks.addEventListener("change",takeMetadataTrackSnapshot),textTracks.removeEventListener("change",restoreTrackMode)}))}overrideNative_(type,override){if(override!==this["featuresNative".concat(type,"Tracks")])return;const lowerCaseType=type.toLowerCase();this["".concat(lowerCaseType,"TracksListeners_")]&&Object.keys(this["".concat(lowerCaseType,"TracksListeners_")]).forEach((eventName=>{this.el()["".concat(lowerCaseType,"Tracks")].removeEventListener(eventName,this["".concat(lowerCaseType,"TracksListeners_")][eventName])})),this["featuresNative".concat(type,"Tracks")]=!override,this["".concat(lowerCaseType,"TracksListeners_")]=null,this.proxyNativeTracksForType_(lowerCaseType)}overrideNativeAudioTracks(override){this.overrideNative_("Audio",override)}overrideNativeVideoTracks(override){this.overrideNative_("Video",override)}proxyNativeTracksForType_(name){const props=NORMAL[name],elTracks=this.el()[props.getterName],techTracks=this[props.getterName]();if(!this["featuresNative".concat(props.capitalName,"Tracks")]||!elTracks||!elTracks.addEventListener)return;const listeners={change:e=>{const event={type:"change",target:techTracks,currentTarget:techTracks,srcElement:techTracks};techTracks.trigger(event),"text"===name&&this[REMOTE.remoteText.getterName]().trigger(event)},addtrack(e){techTracks.addTrack(e.track)},removetrack(e){techTracks.removeTrack(e.track)}},removeOldTracks=function(){const removeTracks=[];for(let i=0;i{const listener=listeners[eventName];elTracks.addEventListener(eventName,listener),this.on("dispose",(e=>elTracks.removeEventListener(eventName,listener)))})),this.on("loadstart",removeOldTracks),this.on("dispose",(e=>this.off("loadstart",removeOldTracks)))}proxyNativeTracks_(){NORMAL.names.forEach((name=>{this.proxyNativeTracksForType_(name)}))}createEl(){let el=this.options_.tag;if(!el||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(el){const clone=el.cloneNode(!0);el.parentNode&&el.parentNode.insertBefore(clone,el),Html5.disposeMediaElement(el),el=clone}else{el=document.createElement("video");const attributes=merge$2({},this.options_.tag&&getAttributes(this.options_.tag));TOUCH_ENABLED&&!0===this.options_.nativeControlsForTouch||delete attributes.controls,setAttributes(el,Object.assign(attributes,{id:this.options_.techId,class:"vjs-tech"}))}el.playerId=this.options_.playerId}void 0!==this.options_.preload&&setAttribute(el,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(el.disablePictureInPicture=this.options_.disablePictureInPicture);const settingsAttrs=["loop","muted","playsinline","autoplay"];for(let i=0;i=2&&eventsToTrigger.push("loadeddata"),el.readyState>=3&&eventsToTrigger.push("canplay"),el.readyState>=4&&eventsToTrigger.push("canplaythrough"),this.ready((function(){eventsToTrigger.forEach((function(type){this.trigger(type)}),this)}))}setScrubbing(isScrubbing){this.isScrubbing_=isScrubbing}scrubbing(){return this.isScrubbing_}setCurrentTime(seconds){try{this.isScrubbing_&&this.el_.fastSeek&&IS_ANY_SAFARI?this.el_.fastSeek(seconds):this.el_.currentTime=seconds}catch(e){log$1(e,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&IS_ANDROID&&IS_CHROME&&0===this.el_.currentTime){const checkProgress=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",checkProgress))};return this.on("timeupdate",checkProgress),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const endFn=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},beginFn=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",endFn),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",beginFn),this.on("dispose",(()=>{this.off("webkitbeginfullscreen",beginFn),this.off("webkitendfullscreen",endFn)}))}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const video=this.el_;if(video.paused&&video.networkState<=video.HAVE_METADATA)silencePromise(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(cb){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(cb):super.requestVideoFrameCallback(cb)}cancelVideoFrameCallback(id){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(id):super.cancelVideoFrameCallback(id)}src(src){if(void 0===src)return this.el_.src;this.setSrc(src)}reset(){Html5.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(val){this.el_.controls=!!val}addTextTrack(kind,label,language){return this.featuresNativeTextTracks?this.el_.addTextTrack(kind,label,language):super.addTextTrack(kind,label,language)}createRemoteTextTrack(options){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(options);const htmlTrackElement=document.createElement("track");return options.kind&&(htmlTrackElement.kind=options.kind),options.label&&(htmlTrackElement.label=options.label),(options.language||options.srclang)&&(htmlTrackElement.srclang=options.language||options.srclang),options.default&&(htmlTrackElement.default=options.default),options.id&&(htmlTrackElement.id=options.id),options.src&&(htmlTrackElement.src=options.src),htmlTrackElement}addRemoteTextTrack(options,manualCleanup){const htmlTrackElement=super.addRemoteTextTrack(options,manualCleanup);return this.featuresNativeTextTracks&&this.el().appendChild(htmlTrackElement),htmlTrackElement}removeRemoteTextTrack(track){if(super.removeRemoteTextTrack(track),this.featuresNativeTextTracks){const tracks=this.$$("track");let i=tracks.length;for(;i--;)track!==tracks[i]&&track!==tracks[i].track||this.el().removeChild(tracks[i])}}getVideoPlaybackQuality(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();const videoPlaybackQuality={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(videoPlaybackQuality.droppedVideoFrames=this.el().webkitDroppedFrameCount,videoPlaybackQuality.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(videoPlaybackQuality.creationTime=window.performance.now()),videoPlaybackQuality}}defineLazyProperty(Html5,"TEST_VID",(function(){if(!isReal())return;const video=document.createElement("video"),track=document.createElement("track");return track.kind="captions",track.srclang="en",track.label="English",video.appendChild(track),video})),Html5.isSupported=function(){try{Html5.TEST_VID.volume=.5}catch(e){return!1}return!(!Html5.TEST_VID||!Html5.TEST_VID.canPlayType)},Html5.canPlayType=function(type){return Html5.TEST_VID.canPlayType(type)},Html5.canPlaySource=function(srcObj,options){return Html5.canPlayType(srcObj.type)},Html5.canControlVolume=function(){try{const volume=Html5.TEST_VID.volume;Html5.TEST_VID.volume=volume/2+.1;const canControl=volume!==Html5.TEST_VID.volume;return canControl&&IS_IOS?(window.setTimeout((()=>{Html5&&Html5.prototype&&(Html5.prototype.featuresVolumeControl=volume!==Html5.TEST_VID.volume)})),!1):canControl}catch(e){return!1}},Html5.canMuteVolume=function(){try{const muted=Html5.TEST_VID.muted;return Html5.TEST_VID.muted=!muted,Html5.TEST_VID.muted?setAttribute(Html5.TEST_VID,"muted","muted"):removeAttribute(Html5.TEST_VID,"muted"),muted!==Html5.TEST_VID.muted}catch(e){return!1}},Html5.canControlPlaybackRate=function(){if(IS_ANDROID&&IS_CHROME&&CHROME_VERSION<58)return!1;try{const playbackRate=Html5.TEST_VID.playbackRate;return Html5.TEST_VID.playbackRate=playbackRate/2+.1,playbackRate!==Html5.TEST_VID.playbackRate}catch(e){return!1}},Html5.canOverrideAttributes=function(){try{const noop=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:noop,set:noop}),Object.defineProperty(document.createElement("audio"),"src",{get:noop,set:noop}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:noop,set:noop}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:noop,set:noop})}catch(e){return!1}return!0},Html5.supportsNativeTextTracks=function(){return IS_ANY_SAFARI||IS_IOS&&IS_CHROME},Html5.supportsNativeVideoTracks=function(){return!(!Html5.TEST_VID||!Html5.TEST_VID.videoTracks)},Html5.supportsNativeAudioTracks=function(){return!(!Html5.TEST_VID||!Html5.TEST_VID.audioTracks)},Html5.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(_ref5){let[key,fn]=_ref5;defineLazyProperty(Html5.prototype,key,(()=>Html5[fn]()),!0)})),Html5.prototype.featuresVolumeControl=Html5.canControlVolume(),Html5.prototype.movingMediaElementInDOM=!IS_IOS,Html5.prototype.featuresFullscreenResize=!0,Html5.prototype.featuresProgressEvents=!0,Html5.prototype.featuresTimeupdateEvents=!0,Html5.prototype.featuresVideoFrameCallback=!(!Html5.TEST_VID||!Html5.TEST_VID.requestVideoFrameCallback),Html5.disposeMediaElement=function(el){if(el){for(el.parentNode&&el.parentNode.removeChild(el);el.hasChildNodes();)el.removeChild(el.firstChild);el.removeAttribute("src"),"function"==typeof el.load&&function(){try{el.load()}catch(e){}}()}},Html5.resetMediaElement=function(el){if(!el)return;const sources=el.querySelectorAll("source");let i=sources.length;for(;i--;)el.removeChild(sources[i]);el.removeAttribute("src"),"function"==typeof el.load&&function(){try{el.load()}catch(e){}}()},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(prop){Html5.prototype[prop]=function(){return this.el_[prop]||this.el_.hasAttribute(prop)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(prop){Html5.prototype["set"+toTitleCase$1(prop)]=function(v){this.el_[prop]=v,v?this.el_.setAttribute(prop,prop):this.el_.removeAttribute(prop)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(prop){Html5.prototype[prop]=function(){return this.el_[prop]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(prop){Html5.prototype["set"+toTitleCase$1(prop)]=function(v){this.el_[prop]=v}})),["pause","load","play"].forEach((function(prop){Html5.prototype[prop]=function(){return this.el_[prop]()}})),Tech.withSourceHandlers(Html5),Html5.nativeSourceHandler={},Html5.nativeSourceHandler.canPlayType=function(type){try{return Html5.TEST_VID.canPlayType(type)}catch(e){return""}},Html5.nativeSourceHandler.canHandleSource=function(source,options){if(source.type)return Html5.nativeSourceHandler.canPlayType(source.type);if(source.src){const ext=getFileExtension(source.src);return Html5.nativeSourceHandler.canPlayType("video/".concat(ext))}return""},Html5.nativeSourceHandler.handleSource=function(source,tech,options){tech.setSrc(source.src)},Html5.nativeSourceHandler.dispose=function(){},Html5.registerSourceHandler(Html5.nativeSourceHandler),Tech.registerTech("Html5",Html5);const TECH_EVENTS_RETRIGGER=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],TECH_EVENTS_QUEUE={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},BREAKPOINT_ORDER=["tiny","xsmall","small","medium","large","xlarge","huge"],BREAKPOINT_CLASSES={};BREAKPOINT_ORDER.forEach((k=>{const v="x"===k.charAt(0)?"x-".concat(k.substring(1)):k;BREAKPOINT_CLASSES[k]="vjs-layout-".concat(v)}));const DEFAULT_BREAKPOINTS={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Player extends Component$1{constructor(tag,options,ready){if(tag.id=tag.id||options.id||"vjs_video_".concat(newGUID()),(options=Object.assign(Player.getTagSettings(tag),options)).initChildren=!1,options.createEl=!1,options.evented=!1,options.reportTouchActivity=!1,!options.language){const closest=tag.closest("[lang]");closest&&(options.language=closest.getAttribute("lang"))}if(super(null,options,ready),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=createLogger(this.id_),this.fsApi_=FullscreenApi,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=tag,this.tagAttributes=tag&&getAttributes(tag),this.language(this.options_.language),options.languages){const languagesToLower={};Object.getOwnPropertyNames(options.languages).forEach((function(name){languagesToLower[name.toLowerCase()]=options.languages[name]})),this.languages_=languagesToLower}else this.languages_=Player.prototype.options_.languages;this.resetCache_(),this.poster_=options.poster||"",this.controls_=!!options.controls,tag.controls=!1,tag.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],tag.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),options.plugins&&Object.keys(options.plugins).forEach((name=>{if("function"!=typeof this[name])throw new Error('plugin "'.concat(name,'" does not exist'))})),this.scrubbing_=!1,this.el_=this.createEl(),evented(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(on(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const playerOptionsCopy=merge$2(this.options_);options.plugins&&Object.keys(options.plugins).forEach((name=>{this[name](options.plugins[name])})),options.debug&&this.debug(!0),this.options_.playerOptions=playerOptionsCopy,this.middleware_=[],this.playbackRates(options.playbackRates),this.initChildren(),this.isAudio("audio"===tag.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"),TOUCH_ENABLED&&this.addClass("vjs-touch-enabled"),IS_IOS||this.addClass("vjs-workinghover"),Player.players[this.id_]=this;const majorVersion="8.3.0".split(".")[0];this.addClass("vjs-v".concat(majorVersion)),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"),off(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),off(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Player.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),middlewareInstances[this.id()]=null,ALL.names.forEach((name=>{const list=this[ALL[name].getterName]();list&&list.off&&list.off()})),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let el,tag=this.tag,playerElIngest=this.playerElIngest_=tag.parentNode&&tag.parentNode.hasAttribute&&tag.parentNode.hasAttribute("data-vjs-player");const divEmbed="video-js"===this.tag.tagName.toLowerCase();playerElIngest?el=this.el_=tag.parentNode:divEmbed||(el=this.el_=super.createEl("div"));const attrs=getAttributes(tag);if(divEmbed){for(el=this.el_=tag,tag=this.tag=document.createElement("video");el.children.length;)tag.appendChild(el.firstChild);hasClass(el,"video-js")||addClass(el,"video-js"),el.appendChild(tag),playerElIngest=this.playerElIngest_=el,Object.keys(el).forEach((k=>{try{tag[k]=el[k]}catch(e){}}))}if(tag.setAttribute("tabindex","-1"),attrs.tabindex="-1",IS_CHROME&&IS_WINDOWS&&(tag.setAttribute("role","application"),attrs.role="application"),tag.removeAttribute("width"),tag.removeAttribute("height"),"width"in attrs&&delete attrs.width,"height"in attrs&&delete attrs.height,Object.getOwnPropertyNames(attrs).forEach((function(attr){divEmbed&&"class"===attr||el.setAttribute(attr,attrs[attr]),divEmbed&&tag.setAttribute(attr,attrs[attr])})),tag.playerId=tag.id,tag.id+="_html5_api",tag.className="vjs-tech",tag.player=el.player=this,this.addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=createStyleElement("vjs-styles-dimensions");const defaultsStyleEl=$(".vjs-styles-defaults"),head=$("head");head.insertBefore(this.styleEl_,defaultsStyleEl?defaultsStyleEl.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 links=tag.getElementsByTagName("a");for(let i=0;i{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},isEvented(target=this)?callback():(target.eventedCallbacks||(target.eventedCallbacks=[]),target.eventedCallbacks.push(callback))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(bool){if(void 0===bool)return!!this.fill_;this.fill_=!!bool,bool?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(ratio){if(void 0===ratio)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(ratio))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=ratio,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){const width="number"==typeof this.width_?this.width_:this.options_.width,height="number"==typeof this.height_?this.height_:this.options_.height,techEl=this.tech_&&this.tech_.el();return void(techEl&&(width>=0&&(techEl.width=width),height>=0&&(techEl.height=height)))}let width,height,aspectRatio,idClass;aspectRatio=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9";const ratioParts=aspectRatio.split(":"),ratioMultiplier=ratioParts[1]/ratioParts[0];width=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/ratioMultiplier:this.videoWidth()||300,height=void 0!==this.height_?this.height_:width*ratioMultiplier,idClass=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(idClass),setTextContent(this.styleEl_,"\n .".concat(idClass," {\n width: ").concat(width,"px;\n height: ").concat(height,"px;\n }\n\n .").concat(idClass,".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: ").concat(100*ratioMultiplier,"%;\n }\n "))}loadTech_(techName,source){this.tech_&&this.unloadTech_();const titleTechName=toTitleCase$1(techName),camelTechName=techName.charAt(0).toLowerCase()+techName.slice(1);"Html5"!==titleTechName&&this.tag&&(Tech.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=titleTechName,this.isReady_=!1;let autoplay=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(autoplay=!1);const techOptions={source:source,autoplay:autoplay,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:"".concat(this.id(),"_").concat(camelTechName,"_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};ALL.names.forEach((name=>{const props=ALL[name];techOptions[props.getterName]=this[props.privateName]})),Object.assign(techOptions,this.options_[titleTechName]),Object.assign(techOptions,this.options_[camelTechName]),Object.assign(techOptions,this.options_[techName.toLowerCase()]),this.tag&&(techOptions.tag=this.tag),source&&source.src===this.cache_.src&&this.cache_.currentTime>0&&(techOptions.startTime=this.cache_.currentTime);const TechClass=Tech.getTech(techName);if(!TechClass)throw new Error("No Tech named '".concat(titleTechName,"' exists! '").concat(titleTechName,"' should be registered using videojs.registerTech()'"));this.tech_=new TechClass(techOptions),this.tech_.ready(bind_(this,this.handleTechReady_),!0),textTrackConverter_jsonToTextTracks(this.textTracksJson_||[],this.tech_),TECH_EVENTS_RETRIGGER.forEach((event=>{this.on(this.tech_,event,(e=>this["handleTech".concat(toTitleCase$1(event),"_")](e)))})),Object.keys(TECH_EVENTS_QUEUE).forEach((event=>{this.on(this.tech_,event,(eventObj=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this["handleTech".concat(TECH_EVENTS_QUEUE[event],"_")].bind(this),event:eventObj}):this["handleTech".concat(TECH_EVENTS_QUEUE[event],"_")](eventObj)}))})),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,err)=>this.handleTechFullscreenError_(e,err))),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"===titleTechName&&this.tag||prependTo(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){ALL.names.forEach((name=>{const props=ALL[name];this[props.privateName]=this[props.getterName]()})),this.textTracksJson_=textTrackConverter_textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(safety){return void 0===safety&&log$1.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_(type){if(!this.tech_||"string"!=typeof type)return;const resolveMuted=()=>{const previouslyMuted=this.muted();this.muted(!0);const restoreMuted=()=>{this.muted(previouslyMuted)};this.playTerminatedQueue_.push(restoreMuted);const mutedPromise=this.play();if(isPromise(mutedPromise))return mutedPromise.catch((err=>{throw restoreMuted(),new Error("Rejection at manualAutoplay. Restoring muted value. ".concat(err||""))}))};let promise;return"any"!==type||this.muted()?promise="muted"!==type||this.muted()?this.play():resolveMuted():(promise=this.play(),isPromise(promise)&&(promise=promise.catch(resolveMuted))),isPromise(promise)?promise.then((()=>{this.trigger({type:"autoplay-success",autoplay:type})})).catch((()=>{this.trigger({type:"autoplay-failure",autoplay:type})})):void 0}updateSourceCaches_(){let srcObj=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",src=srcObj,type="";"string"!=typeof src&&(src=srcObj.src,type=srcObj.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],src&&!type&&(type=((player,src)=>{if(!src)return"";if(player.cache_.source.src===src&&player.cache_.source.type)return player.cache_.source.type;const matchingSources=player.cache_.sources.filter((s=>s.src===src));if(matchingSources.length)return matchingSources[0].type;const sources=player.$$("source");for(let i=0;is.src&&s.src===src)),sourceElSources=[],sourceEls=this.$$("source"),matchingSourceEls=[];for(let i=0;ithis.updateSourceCaches_(src);const playerSrc=this.currentSource().src,eventSrc=event.src;playerSrc&&!/^blob:/.test(playerSrc)&&/^blob:/.test(eventSrc)&&(!this.lastSource_||this.lastSource_.tech!==eventSrc&&this.lastSource_.player!==playerSrc)&&(updateSourceCaches=()=>{}),updateSourceCaches(eventSrc),event.src||this.tech_.any(["sourceset","loadstart"],(e=>{if("sourceset"===e.type)return;const techSrc=this.techGet("currentSrc");this.lastSource_.tech=techSrc,this.updateSourceCaches_(techSrc)}))}this.lastSource_={player:this.currentSource().src,tech:event.src},this.trigger({src:event.src,type:"sourceset"})}hasStarted(request){if(void 0===request)return this.hasStarted_;request!==this.hasStarted_&&(this.hasStarted_=request,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((queued=>queued.callback(queued.event))),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const timeWhenWaiting=this.currentTime(),timeUpdateListener=()=>{timeWhenWaiting!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",timeUpdateListener))};this.on("timeupdate",timeUpdateListener)}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_(event){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,event):this.paused()?silencePromise(this.play()):this.pause()))}handleTechDoubleClick_(event){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(el=>el.contains(event.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,event):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(event){event.cancelable&&event.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const targetPlayer=e.target.player;if(targetPlayer&&targetPlayer!==this)return;const el=this.el();let isFs=document[this.fsApi_.fullscreenElement]===el;!isFs&&el.matches?isFs=el.matches(":"+this.fsApi_.fullscreen):!isFs&&el.msMatchesSelector&&(isFs=el.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(isFs)}handleTechFullscreenChange_(event,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_(event,err){this.trigger("fullscreenerror",err)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(event){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(event){this.isInPictureInPicture(!1)}handleTechError_(){const error=this.tech_.error();this.error(error)}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_(method,arg){this.ready((function(){if(method in allowedSetters)return function(middleware,tech,method,arg){return tech[method](middleware.reduce(middlewareIterator(method),arg))}(this.middleware_,this.tech_,method,arg);if(method in allowedMediators)return mediate(this.middleware_,this.tech_,method,arg);try{this.tech_&&this.tech_[method](arg)}catch(e){throw log$1(e),e}}),!0)}techGet_(method){if(this.tech_&&this.tech_.isReady_){if(method in allowedGetters)return function(middleware,tech,method){return middleware.reduceRight(middlewareIterator(method),tech[method]())}(this.middleware_,this.tech_,method);if(method in allowedMediators)return mediate(this.middleware_,this.tech_,method);try{return this.tech_[method]()}catch(e){if(void 0===this.tech_[method])throw log$1("Video.js: ".concat(method," method not defined for ").concat(this.techName_," playback technology."),e),e;if("TypeError"===e.name)throw log$1("Video.js: ".concat(method," unavailable on ").concat(this.techName_," playback technology element."),e),this.tech_.isReady_=!1,e;throw log$1(e),e}}}play(){return new Promise((resolve=>{this.play_(resolve)}))}play_(){let callback=arguments.length>0&&void 0!==arguments[0]?arguments[0]:silencePromise;this.playCallbacks_.push(callback);const isSrcReady=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),isSafariOrIOS=Boolean(IS_ANY_SAFARI||IS_IOS);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!isSrcReady)return this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(!isSrcReady&&isSafariOrIOS&&this.load());const val=this.techGet_("play");isSafariOrIOS&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===val?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(val)}runPlayTerminatedQueue_(){const queue=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],queue.forEach((function(q){q()}))}runPlayCallbacks_(val){const callbacks=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],callbacks.forEach((function(cb){cb(val)}))}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||createTimeRanges$1(0,0)}scrubbing(isScrubbing){if(void 0===isScrubbing)return this.scrubbing_;this.scrubbing_=!!isScrubbing,this.techCall_("setScrubbing",this.scrubbing_),isScrubbing?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(seconds){return void 0!==seconds?(seconds<0&&(seconds=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",seconds),void(this.cache_.initTime=0)):(this.cache_.initTime=seconds,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(seconds){if(void 0===seconds)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(seconds=parseFloat(seconds))<0&&(seconds=1/0),seconds!==this.cache_.duration&&(this.cache_.duration=seconds,seconds===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(seconds)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let buffered=this.techGet_("buffered");return buffered&&buffered.length||(buffered=createTimeRanges$1(0,0)),buffered}bufferedPercent(){return bufferedPercent(this.buffered(),this.duration())}bufferedEnd(){const buffered=this.buffered(),duration=this.duration();let end=buffered.end(buffered.length-1);return end>duration&&(end=duration),end}volume(percentAsDecimal){let vol;return void 0!==percentAsDecimal?(vol=Math.max(0,Math.min(1,parseFloat(percentAsDecimal))),this.cache_.volume=vol,this.techCall_("setVolume",vol),void(vol>0&&this.lastVolume_(vol))):(vol=parseFloat(this.techGet_("volume")),isNaN(vol)?1:vol)}muted(muted){if(void 0===muted)return this.techGet_("muted")||!1;this.techCall_("setMuted",muted)}defaultMuted(defaultMuted){return void 0!==defaultMuted?this.techCall_("setDefaultMuted",defaultMuted):this.techGet_("defaultMuted")||!1}lastVolume_(percentAsDecimal){if(void 0===percentAsDecimal||0===percentAsDecimal)return this.cache_.lastVolume;this.cache_.lastVolume=percentAsDecimal}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(isFS){if(void 0!==isFS){const oldValue=this.isFullscreen_;return this.isFullscreen_=Boolean(isFS),this.isFullscreen_!==oldValue&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_}requestFullscreen(fullscreenOptions){this.isInPictureInPicture()&&this.exitPictureInPicture();const self=this;return new Promise(((resolve,reject)=>{function offHandler(){self.off("fullscreenerror",errorHandler),self.off("fullscreenchange",changeHandler)}function changeHandler(){offHandler(),resolve()}function errorHandler(e,err){offHandler(),reject(err)}self.one("fullscreenchange",changeHandler),self.one("fullscreenerror",errorHandler);const promise=self.requestFullscreenHelper_(fullscreenOptions);promise&&(promise.then(offHandler,offHandler),promise.then(resolve,reject))}))}requestFullscreenHelper_(fullscreenOptions){let fsOptions;if(this.fsApi_.prefixed||(fsOptions=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==fullscreenOptions&&(fsOptions=fullscreenOptions)),this.fsApi_.requestFullscreen){const promise=this.el_[this.fsApi_.requestFullscreen](fsOptions);return promise&&promise.then((()=>this.isFullscreen(!0)),(()=>this.isFullscreen(!1))),promise}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const self=this;return new Promise(((resolve,reject)=>{function offHandler(){self.off("fullscreenerror",errorHandler),self.off("fullscreenchange",changeHandler)}function changeHandler(){offHandler(),resolve()}function errorHandler(e,err){offHandler(),reject(err)}self.one("fullscreenchange",changeHandler),self.one("fullscreenerror",errorHandler);const promise=self.exitFullscreenHelper_();promise&&(promise.then(offHandler,offHandler),promise.then(resolve,reject))}))}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const promise=document[this.fsApi_.exitFullscreen]();return promise&&silencePromise(promise.then((()=>this.isFullscreen(!1)))),promise}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,on(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",addClass(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(event){keycode.isEventKey(event,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,off(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,removeClass(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(value){if(void 0===value)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",value),this.options_.disablePictureInPicture=value,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(isPiP){return void 0!==isPiP?(this.isInPictureInPicture_=!!isPiP,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){const pipContainer=document.createElement(this.el().tagName);return pipContainer.classList=this.el().classList,pipContainer.classList.add("vjs-pip-container"),this.posterImage&&pipContainer.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&pipContainer.appendChild(this.titleBar.el().cloneNode(!0)),pipContainer.appendChild(createEl("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({initialAspectRatio:this.videoWidth()/this.videoHeight(),copyStyleSheets:!0}).then((pipWindow=>(this.el_.parentNode.insertBefore(pipContainer,this.el_),pipWindow.document.body.append(this.el_),pipWindow.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),pipWindow.addEventListener("unload",(event=>{const pipVideo=event.target.querySelector(".video-js");pipContainer.replaceWith(pipVideo),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")})),pipWindow)))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(event){const{userActions:userActions}=this.options_;if(!userActions||!userActions.hotkeys)return;(el=>{const tagName=el.tagName.toLowerCase();if(el.isContentEditable)return!0;if("input"===tagName)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(el.type);return-1!==["textarea"].indexOf(tagName)})(this.el_.ownerDocument.activeElement)||("function"==typeof userActions.hotkeys?userActions.hotkeys.call(this,event):this.handleHotkeys(event))}handleHotkeys(event){const hotkeys=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:fullscreenKey=(keydownEvent=>keycode.isEventKey(keydownEvent,"f")),muteKey:muteKey=(keydownEvent=>keycode.isEventKey(keydownEvent,"m")),playPauseKey:playPauseKey=(keydownEvent=>keycode.isEventKey(keydownEvent,"k")||keycode.isEventKey(keydownEvent,"Space"))}=hotkeys;if(fullscreenKey.call(this,event)){event.preventDefault(),event.stopPropagation();const FSToggle=Component$1.getComponent("FullscreenToggle");!1!==document[this.fsApi_.fullscreenEnabled]&&FSToggle.prototype.handleClick.call(this,event)}else if(muteKey.call(this,event)){event.preventDefault(),event.stopPropagation();Component$1.getComponent("MuteToggle").prototype.handleClick.call(this,event)}else if(playPauseKey.call(this,event)){event.preventDefault(),event.stopPropagation();Component$1.getComponent("PlayToggle").prototype.handleClick.call(this,event)}}canPlayType(type){let can;for(let i=0,j=this.options_.techOrder;i[techName,Tech.getTech(techName)])).filter((_ref6=>{let[techName,tech]=_ref6;return tech?tech.isSupported():(log$1.error('The "'.concat(techName,'" tech is undefined. Skipped browser support check for that tech.')),!1)})),findFirstPassingTechSourcePair=function(outerArray,innerArray,tester){let found;return outerArray.some((outerChoice=>innerArray.some((innerChoice=>{if(found=tester(outerChoice,innerChoice),found)return!0})))),found};let foundSourceAndTech;const finder=(_ref7,source)=>{let[techName,tech]=_ref7;if(tech.canPlaySource(source,this.options_[techName.toLowerCase()]))return{source:source,tech:techName}};var fn;return foundSourceAndTech=this.options_.sourceOrder?findFirstPassingTechSourcePair(sources,techs,(fn=finder,(a,b)=>fn(b,a))):findFirstPassingTechSourcePair(techs,sources,finder),foundSourceAndTech||!1}handleSrc_(source,isRetry){if(void 0===source)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const sources=filterSource(source);if(sources.length){if(this.changingSrc_=!0,isRetry||(this.cache_.sources=sources),this.updateSourceCaches_(sources[0]),setSource(this,sources[0],((middlewareSource,mws)=>{this.middleware_=mws,isRetry||(this.cache_.sources=sources),this.updateSourceCaches_(middlewareSource);if(this.src_(middlewareSource))return sources.length>1?this.handleSrc_(sources.slice(1)):(this.changingSrc_=!1,this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0),void this.triggerReady());var middleware,tech;middleware=mws,tech=this.tech_,middleware.forEach((mw=>mw.setTech&&mw.setTech(tech)))})),sources.length>1){const retry=()=>{this.error(null),this.handleSrc_(sources.slice(1),!0)},stopListeningForErrors=()=>{this.off("error",retry)};this.one("error",retry),this.one("playing",stopListeningForErrors),this.resetRetryOnError_=()=>{this.off("error",retry),this.off("playing",stopListeningForErrors)}}}else this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0)}src(source){return this.handleSrc_(source,!1)}src_(source){const sourceTech=this.selectSource([source]);return!sourceTech||(titleCaseEquals(sourceTech.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_(sourceTech.tech,sourceTech.source),this.tech_.ready((()=>{this.changingSrc_=!1})),!1))}load(){this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{silencePromise(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_(),isEvented(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:currentTimeDisplay,durationDisplay:durationDisplay,progressControl:progressControl,remainingTimeDisplay:remainingTimeDisplay}=this.controlBar||{},{seekBar:seekBar}=progressControl||{};currentTimeDisplay&¤tTimeDisplay.updateContent(),durationDisplay&&durationDisplay.updateContent(),remainingTimeDisplay&&remainingTimeDisplay.updateContent(),seekBar&&(seekBar.update(),seekBar.loadProgressBar&&seekBar.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const source=this.currentSource(),sources=[];return 0!==Object.keys(source).length&&sources.push(source),this.cache_.sources||sources}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(value){return void 0!==value?(this.techCall_("setPreload",value),void(this.options_.preload=value)):this.techGet_("preload")}autoplay(value){if(void 0===value)return this.options_.autoplay||!1;let techAutoplay;"string"==typeof value&&/(any|play|muted)/.test(value)||!0===value&&this.options_.normalizeAutoplay?(this.options_.autoplay=value,this.manualAutoplay_("string"==typeof value?value:"play"),techAutoplay=!1):this.options_.autoplay=!!value,techAutoplay=void 0===techAutoplay?this.options_.autoplay:techAutoplay,this.tech_&&this.techCall_("setAutoplay",techAutoplay)}playsinline(value){return void 0!==value?(this.techCall_("setPlaysinline",value),this.options_.playsinline=value,this):this.techGet_("playsinline")}loop(value){return void 0!==value?(this.techCall_("setLoop",value),void(this.options_.loop=value)):this.techGet_("loop")}poster(src){if(void 0===src)return this.poster_;src||(src=""),src!==this.poster_&&(this.poster_=src,this.techCall_("setPoster",src),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const newPoster=this.tech_.poster()||"";newPoster!==this.poster_&&(this.poster_=newPoster,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(bool){if(void 0===bool)return!!this.controls_;bool=!!bool,this.controls_!==bool&&(this.controls_=bool,this.usingNativeControls()&&this.techCall_("setControls",bool),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(bool){if(void 0===bool)return!!this.usingNativeControls_;bool=!!bool,this.usingNativeControls_!==bool&&(this.usingNativeControls_=bool,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(err){if(void 0===err)return this.error_||null;if(hooks("beforeerror").forEach((hookFunction=>{const newErr=hookFunction(this,err);isObject$1(newErr)&&!Array.isArray(newErr)||"string"==typeof newErr||"number"==typeof newErr||null===newErr?err=newErr:this.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&err&&4===err.code){const triggerSuppressedError=function(){this.error(err)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],triggerSuppressedError),void this.one("loadstart",(function(){this.off(["click","touchstart"],triggerSuppressedError)}))}if(null===err)return this.error_=err,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new MediaError(err),this.addClass("vjs-error"),log$1.error("(CODE:".concat(this.error_.code," ").concat(MediaError.errorTypes[this.error_.code],")"),this.error_.message,this.error_),this.trigger("error"),hooks("error").forEach((hookFunction=>hookFunction(this,this.error_)))}reportUserActivity(event){this.userActivity_=!0}userActive(bool){if(void 0===bool)return this.userActive_;if((bool=!!bool)!==this.userActive_){if(this.userActive_=bool,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 mouseInProgress,lastMoveX,lastMoveY;const handleActivity=bind_(this,this.reportUserActivity),handleMouseUpAndMouseLeave=function(event){handleActivity(),this.clearInterval(mouseInProgress)};this.on("mousedown",(function(){handleActivity(),this.clearInterval(mouseInProgress),mouseInProgress=this.setInterval(handleActivity,250)})),this.on("mousemove",(function(e){e.screenX===lastMoveX&&e.screenY===lastMoveY||(lastMoveX=e.screenX,lastMoveY=e.screenY,handleActivity())})),this.on("mouseup",handleMouseUpAndMouseLeave),this.on("mouseleave",handleMouseUpAndMouseLeave);const controlBar=this.getChild("controlBar");let inactivityTimeout;!controlBar||IS_IOS||IS_ANDROID||(controlBar.on("mouseenter",(function(event){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),controlBar.on("mouseleave",(function(event){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",handleActivity),this.on("keyup",handleActivity),this.setInterval((function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(inactivityTimeout);const timeout=this.options_.inactivityTimeout;timeout<=0||(inactivityTimeout=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),timeout))}),250)}playbackRate(rate){if(void 0===rate)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",rate)}defaultPlaybackRate(rate){return void 0!==rate?this.techCall_("setDefaultPlaybackRate",rate):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(bool){if(void 0===bool)return!!this.isAudio_;this.isAudio_=!!bool}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const playerChildren=this.children(),controlBar=this.getChild("ControlBar"),controlBarHeight=controlBar&&controlBar.currentHeight();playerChildren.forEach((child=>{child!==controlBar&&child.el_&&!child.hasClass("vjs-hidden")&&(child.hide(),this.audioOnlyCache_.hiddenChildren.push(child))})),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(controlBarHeight),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach((child=>child.show())),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(value){if("boolean"!=typeof value||value===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=value,value){const exitPromises=[];return this.isInPictureInPicture()&&exitPromises.push(this.exitPictureInPicture()),this.isFullscreen()&&exitPromises.push(this.exitFullscreen()),this.audioPosterMode()&&exitPromises.push(this.audioPosterMode(!1)),Promise.all(exitPromises).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(value){if("boolean"!=typeof value||value===this.audioPosterMode_)return this.audioPosterMode_;if(this.audioPosterMode_=value,value){if(this.audioOnlyMode()){return this.audioOnlyMode(!1).then((()=>{this.enablePosterModeUI_()}))}return Promise.resolve().then((()=>{this.enablePosterModeUI_()}))}return Promise.resolve().then((()=>{this.disablePosterModeUI_()}))}addTextTrack(kind,label,language){if(this.tech_)return this.tech_.addTextTrack(kind,label,language)}addRemoteTextTrack(options,manualCleanup){if(this.tech_)return this.tech_.addRemoteTextTrack(options,manualCleanup)}removeRemoteTextTrack(){let obj=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{track:track}=obj;if(track||(track=obj),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(),isEvented(this)&&this.trigger("languagechange"))}languages(){return merge$2(Player.prototype.options_.languages,this.languages_)}toJSON(){const options=merge$2(this.options_),tracks=options.tracks;options.tracks=[];for(let i=0;i{this.removeChild(modal)})),modal.open(),modal}updateCurrentBreakpoint_(){if(!this.responsive())return;const currentBreakpoint=this.currentBreakpoint(),currentWidth=this.currentWidth();for(let i=0;ithis.addRemoteTextTrack(tt,!1))),this.titleBar&&this.titleBar.update({title:title,description:description||artist||""}),this.ready(ready)}getMedia(){if(!this.cache_.media){const poster=this.poster(),media={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),(tt=>({kind:tt.kind,label:tt.label,language:tt.language,src:tt.src})))};return poster&&(media.poster=poster,media.artwork=[{src:media.poster,type:getMimetype(media.poster)}]),media}return merge$2(this.cache_.media)}static getTagSettings(tag){const baseOptions={sources:[],tracks:[]},tagOptions=getAttributes(tag),dataSetup=tagOptions["data-setup"];if(hasClass(tag,"vjs-fill")&&(tagOptions.fill=!0),hasClass(tag,"vjs-fluid")&&(tagOptions.fluid=!0),null!==dataSetup){const[err,data]=tuple(dataSetup||"{}");err&&log$1.error(err),Object.assign(tagOptions,data)}if(Object.assign(baseOptions,tagOptions),tag.hasChildNodes()){const children=tag.childNodes;for(let i=0,j=children.length;i"number"==typeof rate))&&(this.cache_.playbackRates=newRates,this.trigger("playbackrateschange"))}}ALL.names.forEach((function(name){const props=ALL[name];Player.prototype[props.getterName]=function(){return this.tech_?this.tech_[props.getterName]():(this[props.privateName]=this[props.privateName]||new props.ListClass,this[props.privateName])}})),Player.prototype.crossorigin=Player.prototype.crossOrigin,Player.players={};const navigator=window.navigator;Player.prototype.options_={techOrder:Tech.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:navigator&&(navigator.languages&&navigator.languages[0]||navigator.userLanguage||navigator.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(fn){Player.prototype[fn]=function(){return this.techGet_(fn)}})),TECH_EVENTS_RETRIGGER.forEach((function(event){Player.prototype["handleTech".concat(toTitleCase$1(event),"_")]=function(){return this.trigger(event)}})),Component$1.registerComponent("Player",Player);const pluginStorage={},pluginExists=name=>pluginStorage.hasOwnProperty(name),getPlugin=name=>pluginExists(name)?pluginStorage[name]:void 0,markPluginAsActive=(player,name)=>{player.activePlugins_=player.activePlugins_||{},player.activePlugins_[name]=!0},triggerSetupEvent=(player,hash,before)=>{const eventName=(before?"before":"")+"pluginsetup";player.trigger(eventName,hash),player.trigger(eventName+":"+hash.name,hash)},createPluginFactory=(name,PluginSubClass)=>(PluginSubClass.prototype.name=name,function(){triggerSetupEvent(this,{name:name,plugin:PluginSubClass,instance:null},!0);for(var _len21=arguments.length,args=new Array(_len21),_key21=0;_key21<_len21;_key21++)args[_key21]=arguments[_key21];const instance=new PluginSubClass(...[this,...args]);return this[name]=()=>instance,triggerSetupEvent(this,instance.getEventHash()),instance});class Plugin{constructor(player){if(this.constructor===Plugin)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=player,this.log||(this.log=this.player.log.createLogger(this.name)),evented(this),delete this.trigger,stateful(this,this.constructor.defaultState),markPluginAsActive(player,this.name),this.dispose=this.dispose.bind(this),player.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(){let hash=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return hash.name=this.name,hash.plugin=this.constructor,hash.instance=this,hash}trigger(event){let hash=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return trigger(this.eventBusEl_,event,this.getEventHash(hash))}handleStateChanged(e){}dispose(){const{name:name,player:player}=this;this.trigger("dispose"),this.off(),player.off("dispose",this.dispose),player.activePlugins_[name]=!1,this.player=this.state=null,player[name]=createPluginFactory(name,pluginStorage[name])}static isBasic(plugin){const p="string"==typeof plugin?getPlugin(plugin):plugin;return"function"==typeof p&&!Plugin.prototype.isPrototypeOf(p.prototype)}static registerPlugin(name,plugin){if("string"!=typeof name)throw new Error('Illegal plugin name, "'.concat(name,'", must be a string, was ').concat(typeof name,"."));if(pluginExists(name))log$1.warn('A plugin named "'.concat(name,'" already exists. You may want to avoid re-registering plugins!'));else if(Player.prototype.hasOwnProperty(name))throw new Error('Illegal plugin name, "'.concat(name,'", cannot share a name with an existing player method!'));if("function"!=typeof plugin)throw new Error('Illegal plugin for "'.concat(name,'", must be a function, was ').concat(typeof plugin,"."));return pluginStorage[name]=plugin,"plugin"!==name&&(Plugin.isBasic(plugin)?Player.prototype[name]=function(name,plugin){const basicPluginWrapper=function(){triggerSetupEvent(this,{name:name,plugin:plugin,instance:null},!0);const instance=plugin.apply(this,arguments);return markPluginAsActive(this,name),triggerSetupEvent(this,{name:name,plugin:plugin,instance:instance}),instance};return Object.keys(plugin).forEach((function(prop){basicPluginWrapper[prop]=plugin[prop]})),basicPluginWrapper}(name,plugin):Player.prototype[name]=createPluginFactory(name,plugin)),plugin}static deregisterPlugin(name){if("plugin"===name)throw new Error("Cannot de-register base plugin.");pluginExists(name)&&(delete pluginStorage[name],delete Player.prototype[name])}static getPlugins(){let result;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Object.keys(pluginStorage)).forEach((name=>{const plugin=getPlugin(name);plugin&&(result=result||{},result[name]=plugin)})),result}static getPluginVersion(name){const plugin=getPlugin(name);return plugin&&plugin.VERSION||""}}function deprecateForMajor(major,oldName,newName,fn){return function(message,fn){let warned=!1;return function(){warned||log$1.warn(message),warned=!0;for(var _len22=arguments.length,args=new Array(_len22),_key22=0;_key22<_len22;_key22++)args[_key22]=arguments[_key22];return fn.apply(this,args)}}("".concat(oldName," is deprecated and will be removed in ").concat(major,".0; please use ").concat(newName," instead."),fn)}Plugin.getPlugin=getPlugin,Plugin.BASE_PLUGIN_NAME="plugin",Plugin.registerPlugin("plugin",Plugin),Player.prototype.usingPlugin=function(name){return!!this.activePlugins_&&!0===this.activePlugins_[name]},Player.prototype.hasPlugin=function(name){return!!pluginExists(name)};const normalizeId=id=>0===id.indexOf("#")?id.slice(1):id;function videojs(id,options,ready){let player=videojs.getPlayer(id);if(player)return options&&log$1.warn('Player "'.concat(id,'" is already initialised. Options will not be applied.')),ready&&player.ready(ready),player;const el="string"==typeof id?$("#"+normalizeId(id)):id;if(!isEl(el))throw new TypeError("The element or ID supplied is not valid. (videojs)");el.ownerDocument.defaultView&&el.ownerDocument.body.contains(el)||log$1.warn("The element supplied is not included in the DOM"),!0===(options=options||{}).restoreEl&&(options.restoreEl=(el.parentNode&&el.parentNode.hasAttribute("data-vjs-player")?el.parentNode:el).cloneNode(!0)),hooks("beforesetup").forEach((hookFunction=>{const opts=hookFunction(el,merge$2(options));isObject$1(opts)&&!Array.isArray(opts)?options=merge$2(options,opts):log$1.error("please return an object in beforesetup hooks")}));const PlayerComponent=Component$1.getComponent("Player");return player=new PlayerComponent(el,options,ready),hooks("setup").forEach((hookFunction=>hookFunction(player))),player}if(videojs.hooks_=hooks_,videojs.hooks=hooks,videojs.hook=function(type,fn){hooks(type,fn)},videojs.hookOnce=function(type,fn){hooks(type,[].concat(fn).map((original=>{const wrapper=function(){return removeHook(type,wrapper),original(...arguments)};return wrapper})))},videojs.removeHook=removeHook,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&isReal()){let style=$(".vjs-styles-defaults");if(!style){style=createStyleElement("vjs-styles-defaults");const head=$("head");head&&head.insertBefore(style,head.firstChild),setTextContent(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 ")}}autoSetupTimeout(1,videojs),videojs.VERSION="8.3.0",videojs.options=Player.prototype.options_,videojs.getPlayers=()=>Player.players,videojs.getPlayer=id=>{const players=Player.players;let tag;if("string"==typeof id){const nId=normalizeId(id),player=players[nId];if(player)return player;tag=$("#"+nId)}else tag=id;if(isEl(tag)){const{player:player,playerId:playerId}=tag;if(player||players[playerId])return player||players[playerId]}},videojs.getAllPlayers=()=>Object.keys(Player.players).map((k=>Player.players[k])).filter(Boolean),videojs.players=Player.players,videojs.getComponent=Component$1.getComponent,videojs.registerComponent=(name,comp)=>{Tech.isTech(comp)&&log$1.warn("The ".concat(name," tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)")),Component$1.registerComponent.call(Component$1,name,comp)},videojs.getTech=Tech.getTech,videojs.registerTech=Tech.registerTech,videojs.use=function(type,middleware){middlewares[type]=middlewares[type]||[],middlewares[type].push(middleware)},Object.defineProperty(videojs,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(videojs.middleware,"TERMINATOR",{value:TERMINATOR,writeable:!1,enumerable:!0}),videojs.browser=browser,videojs.obj=Obj,videojs.mergeOptions=deprecateForMajor(9,"videojs.mergeOptions","videojs.obj.merge",merge$2),videojs.defineLazyProperty=deprecateForMajor(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",defineLazyProperty),videojs.bind=deprecateForMajor(9,"videojs.bind","native Function.prototype.bind",bind_),videojs.registerPlugin=Plugin.registerPlugin,videojs.deregisterPlugin=Plugin.deregisterPlugin,videojs.plugin=(name,plugin)=>(log$1.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Plugin.registerPlugin(name,plugin)),videojs.getPlugins=Plugin.getPlugins,videojs.getPlugin=Plugin.getPlugin,videojs.getPluginVersion=Plugin.getPluginVersion,videojs.addLanguage=function(code,data){return code=(""+code).toLowerCase(),videojs.options.languages=merge$2(videojs.options.languages,{[code]:data}),videojs.options.languages[code]},videojs.log=log$1,videojs.createLogger=createLogger,videojs.time=Time,videojs.createTimeRange=deprecateForMajor(9,"videojs.createTimeRange","videojs.time.createTimeRanges",createTimeRanges$1),videojs.createTimeRanges=deprecateForMajor(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",createTimeRanges$1),videojs.formatTime=deprecateForMajor(9,"videojs.formatTime","videojs.time.formatTime",formatTime),videojs.setFormatTime=deprecateForMajor(9,"videojs.setFormatTime","videojs.time.setFormatTime",setFormatTime),videojs.resetFormatTime=deprecateForMajor(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",resetFormatTime),videojs.parseUrl=deprecateForMajor(9,"videojs.parseUrl","videojs.url.parseUrl",parseUrl),videojs.isCrossOrigin=deprecateForMajor(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",isCrossOrigin),videojs.EventTarget=EventTarget$2,videojs.any=any,videojs.on=on,videojs.one=one,videojs.off=off,videojs.trigger=trigger,videojs.xhr=lib,videojs.TextTrack=TextTrack,videojs.AudioTrack=AudioTrack,videojs.VideoTrack=VideoTrack,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((k=>{videojs[k]=function(){return log$1.warn("videojs.".concat(k,"() is deprecated; use videojs.dom.").concat(k,"() instead")),Dom[k].apply(null,arguments)}})),videojs.computedStyle=deprecateForMajor(9,"videojs.computedStyle","videojs.dom.computedStyle",computedStyle),videojs.dom=Dom,videojs.fn=Fn,videojs.num=Num,videojs.str=Str,videojs.url=Url,createCommonjsModule((function(module,exports){
-/*! @name videojs-contrib-quality-levels @version 3.0.0 @license Apache-2.0 */
-module.exports=function(videojs){function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var videojs__default=_interopDefaultLegacy(videojs);class QualityLevel{constructor(representation){let level=this;return level.id=representation.id,level.label=level.id,level.width=representation.width,level.height=representation.height,level.bitrate=representation.bandwidth,level.frameRate=representation.frameRate,level.enabled_=representation.enabled,Object.defineProperty(level,"enabled",{get:()=>level.enabled_(),set(enable){level.enabled_(enable)}}),level}}class QualityLevelList extends videojs__default.default.EventTarget{constructor(){super();let list=this;return list.levels_=[],list.selectedIndex_=-1,Object.defineProperty(list,"selectedIndex",{get:()=>list.selectedIndex_}),Object.defineProperty(list,"length",{get:()=>list.levels_.length}),list}addQualityLevel(representation){let qualityLevel=this.getQualityLevelById(representation.id);if(qualityLevel)return qualityLevel;const index=this.levels_.length;return qualityLevel=new QualityLevel(representation),""+index in this||Object.defineProperty(this,index,{get(){return this.levels_[index]}}),this.levels_.push(qualityLevel),this.trigger({qualityLevel:qualityLevel,type:"addqualitylevel"}),qualityLevel}removeQualityLevel(qualityLevel){let removed=null;for(let i=0,l=this.length;ii&&this.selectedIndex_--;break}return removed&&this.trigger({qualityLevel:qualityLevel,type:"removequalitylevel"}),removed}getQualityLevelById(id){for(let i=0,l=this.length;iqualityLevelList,player.qualityLevels.VERSION=version,qualityLevelList},qualityLevels=function(options){return initPlugin(this,videojs__default.default.mergeOptions({},options))};return registerPlugin("qualityLevels",qualityLevels),qualityLevels.VERSION=version,qualityLevels}(videojs)}));var urlToolkit=createCommonjsModule((function(module,exports){var URL_REGEX,FIRST_SEGMENT_REGEX,SLASH_DOT_REGEX,SLASH_DOT_DOT_REGEX,URLToolkit;URL_REGEX=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,FIRST_SEGMENT_REGEX=/^(?=([^\/?#]*))\1([^]*)$/,SLASH_DOT_REGEX=/(?:\/|^)\.(?=\/)/g,SLASH_DOT_DOT_REGEX=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,URLToolkit={buildAbsoluteURL:function(baseURL,relativeURL,opts){if(opts=opts||{},baseURL=baseURL.trim(),!(relativeURL=relativeURL.trim())){if(!opts.alwaysNormalize)return baseURL;var basePartsForNormalise=URLToolkit.parseURL(baseURL);if(!basePartsForNormalise)throw new Error("Error trying to parse base URL.");return basePartsForNormalise.path=URLToolkit.normalizePath(basePartsForNormalise.path),URLToolkit.buildURLFromParts(basePartsForNormalise)}var relativeParts=URLToolkit.parseURL(relativeURL);if(!relativeParts)throw new Error("Error trying to parse relative URL.");if(relativeParts.scheme)return opts.alwaysNormalize?(relativeParts.path=URLToolkit.normalizePath(relativeParts.path),URLToolkit.buildURLFromParts(relativeParts)):relativeURL;var baseParts=URLToolkit.parseURL(baseURL);if(!baseParts)throw new Error("Error trying to parse base URL.");if(!baseParts.netLoc&&baseParts.path&&"/"!==baseParts.path[0]){var pathParts=FIRST_SEGMENT_REGEX.exec(baseParts.path);baseParts.netLoc=pathParts[1],baseParts.path=pathParts[2]}baseParts.netLoc&&!baseParts.path&&(baseParts.path="/");var builtParts={scheme:baseParts.scheme,netLoc:relativeParts.netLoc,path:null,params:relativeParts.params,query:relativeParts.query,fragment:relativeParts.fragment};if(!relativeParts.netLoc&&(builtParts.netLoc=baseParts.netLoc,"/"!==relativeParts.path[0]))if(relativeParts.path){var baseURLPath=baseParts.path,newPath=baseURLPath.substring(0,baseURLPath.lastIndexOf("/")+1)+relativeParts.path;builtParts.path=URLToolkit.normalizePath(newPath)}else builtParts.path=baseParts.path,relativeParts.params||(builtParts.params=baseParts.params,relativeParts.query||(builtParts.query=baseParts.query));return null===builtParts.path&&(builtParts.path=opts.alwaysNormalize?URLToolkit.normalizePath(relativeParts.path):relativeParts.path),URLToolkit.buildURLFromParts(builtParts)},parseURL:function(url){var parts=URL_REGEX.exec(url);return parts?{scheme:parts[1]||"",netLoc:parts[2]||"",path:parts[3]||"",params:parts[4]||"",query:parts[5]||"",fragment:parts[6]||""}:null},normalizePath:function(path){for(path=path.split("").reverse().join("").replace(SLASH_DOT_REGEX,"");path.length!==(path=path.replace(SLASH_DOT_DOT_REGEX,"")).length;);return path.split("").reverse().join("")},buildURLFromParts:function(parts){return parts.scheme+parts.netLoc+parts.path+parts.params+parts.query+parts.fragment}},module.exports=URLToolkit})),Stream=function(){function Stream(){this.listeners={}}var _proto=Stream.prototype;return _proto.on=function(type,listener){this.listeners[type]||(this.listeners[type]=[]),this.listeners[type].push(listener)},_proto.off=function(type,listener){if(!this.listeners[type])return!1;var index=this.listeners[type].indexOf(listener);return this.listeners[type]=this.listeners[type].slice(0),this.listeners[type].splice(index,1),index>-1},_proto.trigger=function(type){var callbacks=this.listeners[type];if(callbacks)if(2===arguments.length)for(var length=callbacks.length,i=0;i-1;nextNewline=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,nextNewline)),this.buffer=this.buffer.substring(nextNewline+1)}}const TAB=String.fromCharCode(9),parseByterange=function(byterangeString){const match=/([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString||""),result={};return match[1]&&(result.length=parseInt(match[1],10)),match[2]&&(result.offset=parseInt(match[2],10)),result},parseAttributes$1=function(attributes){const result={};if(!attributes)return result;const attrs=attributes.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))'));let attr,i=attrs.length;for(;i--;)""!==attrs[i]&&(attr=/([^=]*)=(.*)/.exec(attrs[i]).slice(1),attr[0]=attr[0].replace(/^\s+|\s+$/g,""),attr[1]=attr[1].replace(/^\s+|\s+$/g,""),attr[1]=attr[1].replace(/^['"](.*)['"]$/g,"$1"),result[attr[0]]=attr[1]);return result};class ParseStream extends Stream{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(line){let match,event;if(0===(line=line.trim()).length)return;if("#"!==line[0])return void this.trigger("data",{type:"uri",uri:line});this.tagMappers.reduce(((acc,mapper)=>{const mappedLine=mapper(line);return mappedLine===line?acc:acc.concat([mappedLine])}),[line]).forEach((newLine=>{for(let i=0;iline),this.customParsers.push((line=>{if(expression.exec(line))return this.trigger("data",{type:"custom",data:dataParser(line),customType:customType,segment:segment}),!0}))}addTagMapper(_ref9){let{expression:expression,map:map}=_ref9;this.tagMappers.push((line=>expression.test(line)?map(line):line))}}const camelCaseKeys=function(attributes){const result={};return Object.keys(attributes).forEach((function(key){var str;result[(str=key,str.toLowerCase().replace(/-(\w)/g,(a=>a[1].toUpperCase())))]=attributes[key]})),result},setHoldBack=function(manifest){const{serverControl:serverControl,targetDuration:targetDuration,partTargetDuration:partTargetDuration}=manifest;if(!serverControl)return;const tag="#EXT-X-SERVER-CONTROL",hb="holdBack",phb="partHoldBack",minTargetDuration=targetDuration&&3*targetDuration,minPartDuration=partTargetDuration&&2*partTargetDuration;targetDuration&&!serverControl.hasOwnProperty(hb)&&(serverControl[hb]=minTargetDuration,this.trigger("info",{message:"".concat(tag," defaulting HOLD-BACK to targetDuration * 3 (").concat(minTargetDuration,").")})),minTargetDuration&&serverControl[hb]{currentUri.uri||!currentUri.parts&&!currentUri.preloadHints||(!currentUri.map&¤tMap&&(currentUri.map=currentMap),!currentUri.key&&key&&(currentUri.key=key),currentUri.timeline||"number"!=typeof currentTimeline||(currentUri.timeline=currentTimeline),this.manifest.preloadSegment=currentUri)})),this.parseStream.on("data",(function(entry){let mediaGroup,rendition;({tag(){({version(){entry.version&&(this.manifest.version=entry.version)},"allow-cache"(){this.manifest.allowCache=entry.allowed,"allowed"in entry||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const byterange={};"length"in entry&&(currentUri.byterange=byterange,byterange.length=entry.length,"offset"in entry||(entry.offset=lastByterangeEnd)),"offset"in entry&&(currentUri.byterange=byterange,byterange.offset=entry.offset),lastByterangeEnd=byterange.offset+byterange.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),entry.duration>0&&(currentUri.duration=entry.duration),0===entry.duration&&(currentUri.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=uris},key(){if(entry.attributes)if("NONE"!==entry.attributes.METHOD)if(entry.attributes.URI){if("com.apple.streamingkeydelivery"===entry.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:entry.attributes});if("com.microsoft.playready"===entry.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:entry.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===entry.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(entry.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===entry.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==entry.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):entry.attributes.KEYID&&"0x"===entry.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:entry.attributes.KEYFORMAT,keyId:entry.attributes.KEYID.substring(2)},pssh:decodeB64ToUint8Array$1(entry.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}entry.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),key={method:entry.attributes.METHOD||"AES-128",uri:entry.attributes.URI},void 0!==entry.attributes.IV&&(key.iv=entry.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else key=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence"(){isFinite(entry.number)?this.manifest.mediaSequence=entry.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+entry.number})},"discontinuity-sequence"(){isFinite(entry.number)?(this.manifest.discontinuitySequence=entry.number,currentTimeline=entry.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+entry.number})},"playlist-type"(){/VOD|EVENT/.test(entry.playlistType)?this.manifest.playlistType=entry.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+entry.playlist})},map(){currentMap={},entry.uri&&(currentMap.uri=entry.uri),entry.byterange&&(currentMap.byterange=entry.byterange),key&&(currentMap.key=key)},"stream-inf"(){this.manifest.playlists=uris,this.manifest.mediaGroups=this.manifest.mediaGroups||defaultMediaGroups,entry.attributes?(currentUri.attributes||(currentUri.attributes={}),_extends$1(currentUri.attributes,entry.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||defaultMediaGroups,!(entry.attributes&&entry.attributes.TYPE&&entry.attributes["GROUP-ID"]&&entry.attributes.NAME))return void this.trigger("warn",{message:"ignoring incomplete or missing media group"});const mediaGroupType=this.manifest.mediaGroups[entry.attributes.TYPE];mediaGroupType[entry.attributes["GROUP-ID"]]=mediaGroupType[entry.attributes["GROUP-ID"]]||{},mediaGroup=mediaGroupType[entry.attributes["GROUP-ID"]],rendition={default:/yes/i.test(entry.attributes.DEFAULT)},rendition.default?rendition.autoselect=!0:rendition.autoselect=/yes/i.test(entry.attributes.AUTOSELECT),entry.attributes.LANGUAGE&&(rendition.language=entry.attributes.LANGUAGE),entry.attributes.URI&&(rendition.uri=entry.attributes.URI),entry.attributes["INSTREAM-ID"]&&(rendition.instreamId=entry.attributes["INSTREAM-ID"]),entry.attributes.CHARACTERISTICS&&(rendition.characteristics=entry.attributes.CHARACTERISTICS),entry.attributes.FORCED&&(rendition.forced=/yes/i.test(entry.attributes.FORCED)),mediaGroup[entry.attributes.NAME]=rendition},discontinuity(){currentTimeline+=1,currentUri.discontinuity=!0,this.manifest.discontinuityStarts.push(uris.length)},"program-date-time"(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=entry.dateTimeString,this.manifest.dateTimeObject=entry.dateTimeObject),currentUri.dateTimeString=entry.dateTimeString,currentUri.dateTimeObject=entry.dateTimeObject},targetduration(){!isFinite(entry.duration)||entry.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+entry.duration}):(this.manifest.targetDuration=entry.duration,setHoldBack.call(this,this.manifest))},start(){entry.attributes&&!isNaN(entry.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:entry.attributes["TIME-OFFSET"],precise:entry.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out"(){currentUri.cueOut=entry.data},"cue-out-cont"(){currentUri.cueOutCont=entry.data},"cue-in"(){currentUri.cueIn=entry.data},skip(){this.manifest.skip=camelCaseKeys(entry.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",entry.attributes,["SKIPPED-SEGMENTS"])},part(){hasParts=!0;const segmentIndex=this.manifest.segments.length,part=camelCaseKeys(entry.attributes);currentUri.parts=currentUri.parts||[],currentUri.parts.push(part),part.byterange&&(part.byterange.hasOwnProperty("offset")||(part.byterange.offset=lastPartByterangeEnd),lastPartByterangeEnd=part.byterange.offset+part.byterange.length);const partIndex=currentUri.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #".concat(partIndex," for segment #").concat(segmentIndex),entry.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(((r,i)=>{r.hasOwnProperty("lastPart")||this.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #".concat(i," lacks required attribute(s): LAST-PART")})}))},"server-control"(){const attrs=this.manifest.serverControl=camelCaseKeys(entry.attributes);attrs.hasOwnProperty("canBlockReload")||(attrs.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),setHoldBack.call(this,this.manifest),attrs.canSkipDateranges&&!attrs.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const segmentIndex=this.manifest.segments.length,hint=camelCaseKeys(entry.attributes),isPart=hint.type&&"PART"===hint.type;currentUri.preloadHints=currentUri.preloadHints||[],currentUri.preloadHints.push(hint),hint.byterange&&(hint.byterange.hasOwnProperty("offset")||(hint.byterange.offset=isPart?lastPartByterangeEnd:0,isPart&&(lastPartByterangeEnd=hint.byterange.offset+hint.byterange.length)));const index=currentUri.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #".concat(index," for segment #").concat(segmentIndex),entry.attributes,["TYPE","URI"]),hint.type)for(let i=0;imax&&(number-=max,number-=max,number-=BigInt(2))}return Number(number)},numberToBytes=function(number,_temp2){var _ref2$le=(void 0===_temp2?{}:_temp2).le,le=void 0!==_ref2$le&&_ref2$le;("bigint"!=typeof number&&"number"!=typeof number||"number"==typeof number&&number!=number)&&(number=0);for(var byteCount=function(x){return Math.ceil(function(x){return x.toString(2).length}(x)/8)}(number=BigInt(number)),bytes=new Uint8Array(new ArrayBuffer(byteCount)),i=0;i=b.length&&fn.call(b,(function(bByte,i){return bByte===(mask[i]?mask[i]&a[offset+i]:a[offset+i])}))},resolveUrl$1=function(baseUrl,relativeUrl){if(/^[a-z]+:/i.test(relativeUrl))return relativeUrl;/^data:/.test(baseUrl)&&(baseUrl=window.location&&window.location.href||"");var nativeURL="function"==typeof window.URL,protocolLess=/^\/\//.test(baseUrl),removeLocation=!window.location&&!/\/\//i.test(baseUrl);if(nativeURL?baseUrl=new window.URL(baseUrl,window.location||"http://example.com"):/\/\//i.test(baseUrl)||(baseUrl=urlToolkit.buildAbsoluteURL(window.location&&window.location.href||"",baseUrl)),nativeURL){var newUrl=new URL(relativeUrl,baseUrl);return removeLocation?newUrl.href.slice("http://example.com".length):protocolLess?newUrl.href.slice(newUrl.protocol.length):newUrl.href}return urlToolkit.buildAbsoluteURL(baseUrl,relativeUrl)};function decodeB64ToUint8Array(b64Text){for(var s,decodedString=(s=b64Text,window.atob?window.atob(s):Buffer.from(s,"base64").toString("binary")),array=new Uint8Array(decodedString.length),i=0;i=0))throw new DOMException(NOT_FOUND_ERR,new Error(el.tagName+"@"+attr));for(var lastIndex=list.length-1;i"==c&&">")||"&"==c&&"&"||'"'==c&&"""||""+c.charCodeAt()+";"}function _visitNode(node,callback){if(callback(node))return!0;if(node=node.firstChild)do{if(_visitNode(node,callback))return!0}while(node=node.nextSibling)}function Document(){this.ownerDocument=this}function _onRemoveAttribute(doc,el,newAttr,remove){doc&&doc._inc++,newAttr.namespaceURI===NAMESPACE$2.XMLNS&&delete el._nsMap[newAttr.prefix?newAttr.localName:""]}function _onUpdateChild(doc,el,newChild){if(doc&&doc._inc){doc._inc++;var cs=el.childNodes;if(newChild)cs[cs.length++]=newChild;else{for(var child=el.firstChild,i=0;child;)cs[i++]=child,child=child.nextSibling;cs.length=i,delete cs[cs.length]}}}function _removeChild(parentNode,child){var previous=child.previousSibling,next=child.nextSibling;return previous?previous.nextSibling=next:parentNode.firstChild=next,next?next.previousSibling=previous:parentNode.lastChild=previous,child.parentNode=null,child.previousSibling=null,child.nextSibling=null,_onUpdateChild(parentNode.ownerDocument,parentNode),child}function isDocTypeNode(node){return node&&node.nodeType===Node.DOCUMENT_TYPE_NODE}function isElementNode(node){return node&&node.nodeType===Node.ELEMENT_NODE}function isTextNode(node){return node&&node.nodeType===Node.TEXT_NODE}function isElementInsertionPossible(doc,child){var parentChildNodes=doc.childNodes||[];if(find(parentChildNodes,isElementNode)||isDocTypeNode(child))return!1;var docTypeNode=find(parentChildNodes,isDocTypeNode);return!(child&&docTypeNode&&parentChildNodes.indexOf(docTypeNode)>parentChildNodes.indexOf(child))}function isElementReplacementPossible(doc,child){var parentChildNodes=doc.childNodes||[];if(find(parentChildNodes,(function(node){return isElementNode(node)&&node!==child})))return!1;var docTypeNode=find(parentChildNodes,isDocTypeNode);return!(child&&docTypeNode&&parentChildNodes.indexOf(docTypeNode)>parentChildNodes.indexOf(child))}function assertPreInsertionValidity1to5(parent,node,child){if(!function(node){return node&&(node.nodeType===Node.DOCUMENT_NODE||node.nodeType===Node.DOCUMENT_FRAGMENT_NODE||node.nodeType===Node.ELEMENT_NODE)}(parent))throw new DOMException(HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+parent.nodeType);if(child&&child.parentNode!==parent)throw new DOMException(NOT_FOUND_ERR,"child not in parent");if(!function(node){return node&&(isElementNode(node)||isTextNode(node)||isDocTypeNode(node)||node.nodeType===Node.DOCUMENT_FRAGMENT_NODE||node.nodeType===Node.COMMENT_NODE||node.nodeType===Node.PROCESSING_INSTRUCTION_NODE)}(node)||isDocTypeNode(node)&&parent.nodeType!==Node.DOCUMENT_NODE)throw new DOMException(HIERARCHY_REQUEST_ERR,"Unexpected node type "+node.nodeType+" for parent node type "+parent.nodeType)}function assertPreInsertionValidityInDocument(parent,node,child){var parentChildNodes=parent.childNodes||[],nodeChildNodes=node.childNodes||[];if(node.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var nodeChildElements=nodeChildNodes.filter(isElementNode);if(nodeChildElements.length>1||find(nodeChildNodes,isTextNode))throw new DOMException(HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===nodeChildElements.length&&!isElementInsertionPossible(parent,child))throw new DOMException(HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(isElementNode(node)&&!isElementInsertionPossible(parent,child))throw new DOMException(HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(isDocTypeNode(node)){if(find(parentChildNodes,isDocTypeNode))throw new DOMException(HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var parentElementChild=find(parentChildNodes,isElementNode);if(child&&parentChildNodes.indexOf(parentElementChild)1||find(nodeChildNodes,isTextNode))throw new DOMException(HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===nodeChildElements.length&&!isElementReplacementPossible(parent,child))throw new DOMException(HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(isElementNode(node)&&!isElementReplacementPossible(parent,child))throw new DOMException(HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(isDocTypeNode(node)){function hasDoctypeChildThatIsNotChild(node){return isDocTypeNode(node)&&node!==child}if(find(parentChildNodes,hasDoctypeChildThatIsNotChild))throw new DOMException(HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var parentElementChild=find(parentChildNodes,isElementNode);if(child&&parentChildNodes.indexOf(parentElementChild)&"\t\n\r]/g,_xmlEncoder),'"')}function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){if(visibleNamespaces||(visibleNamespaces=[]),nodeFilter){if(!(node=nodeFilter(node)))return;if("string"==typeof node)return void buf.push(node)}switch(node.nodeType){case ELEMENT_NODE:var attrs=node.attributes,len=attrs.length,child=node.firstChild,nodeName=node.tagName,prefixedNodeName=nodeName;if(!(isHTML=NAMESPACE$2.isHTML(node.namespaceURI)||isHTML)&&!node.prefix&&node.namespaceURI){for(var defaultNS,ai=0;ai=0;nsi--){if(""===(namespace=visibleNamespaces[nsi]).prefix&&namespace.namespace===node.namespaceURI){defaultNS=namespace.namespace;break}}if(defaultNS!==node.namespaceURI)for(nsi=visibleNamespaces.length-1;nsi>=0;nsi--){var namespace;if((namespace=visibleNamespaces[nsi]).namespace===node.namespaceURI){namespace.prefix&&(prefixedNodeName=namespace.prefix+":"+nodeName);break}}}buf.push("<",prefixedNodeName);for(var i=0;i"),isHTML&&/^script$/i.test(nodeName))for(;child;)child.data?buf.push(child.data):serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces.slice()),child=child.nextSibling;else for(;child;)serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces.slice()),child=child.nextSibling;buf.push("",prefixedNodeName,">")}else buf.push("/>");return;case DOCUMENT_NODE:case DOCUMENT_FRAGMENT_NODE:for(child=node.firstChild;child;)serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces.slice()),child=child.nextSibling;return;case ATTRIBUTE_NODE:return addSerializedAttribute(buf,node.name,node.value);case TEXT_NODE:return buf.push(node.data.replace(/[<&>]/g,_xmlEncoder));case CDATA_SECTION_NODE:return buf.push("");case COMMENT_NODE:return buf.push("\x3c!--",node.data,"--\x3e");case DOCUMENT_TYPE_NODE:var pubid=node.publicId,sysid=node.systemId;if(buf.push("");else if(sysid&&"."!=sysid)buf.push(" SYSTEM ",sysid,">");else{var sub=node.internalSubset;sub&&buf.push(" [",sub,"]"),buf.push(">")}return;case PROCESSING_INSTRUCTION_NODE:return buf.push("",node.target," ",node.data,"?>");case ENTITY_REFERENCE_NODE:return buf.push("&",node.nodeName,";");default:buf.push("??",node.nodeName)}}function importNode(doc,node,deep){var node2;switch(node.nodeType){case ELEMENT_NODE:(node2=node.cloneNode(!1)).ownerDocument=doc;case DOCUMENT_FRAGMENT_NODE:break;case ATTRIBUTE_NODE:deep=!0}if(node2||(node2=node.cloneNode(!1)),node2.ownerDocument=doc,node2.parentNode=null,deep)for(var child=node.firstChild;child;)node2.appendChild(importNode(doc,child,deep)),child=child.nextSibling;return node2}function cloneNode(doc,node,deep){var node2=new node.constructor;for(var n in node)if(Object.prototype.hasOwnProperty.call(node,n)){var v=node[n];"object"!=typeof v&&v!=node2[n]&&(node2[n]=v)}switch(node.childNodes&&(node2.childNodes=new NodeList),node2.ownerDocument=doc,node2.nodeType){case ELEMENT_NODE:var attrs=node.attributes,attrs2=node2.attributes=new NamedNodeMap,len=attrs.length;attrs2._ownerElement=node2;for(var i=0;i0},lookupPrefix:function(namespaceURI){for(var el=this;el;){var map=el._nsMap;if(map)for(var n in map)if(Object.prototype.hasOwnProperty.call(map,n)&&map[n]===namespaceURI)return n;el=el.nodeType==ATTRIBUTE_NODE?el.ownerDocument:el.parentNode}return null},lookupNamespaceURI:function(prefix){for(var el=this;el;){var map=el._nsMap;if(map&&Object.prototype.hasOwnProperty.call(map,prefix))return map[prefix];el=el.nodeType==ATTRIBUTE_NODE?el.ownerDocument:el.parentNode}return null},isDefaultNamespace:function(namespaceURI){return null==this.lookupPrefix(namespaceURI)}},copy(NodeType,Node),copy(NodeType,Node.prototype),Document.prototype={nodeName:"#document",nodeType:DOCUMENT_NODE,doctype:null,documentElement:null,_inc:1,insertBefore:function(newChild,refChild){if(newChild.nodeType==DOCUMENT_FRAGMENT_NODE){for(var child=newChild.firstChild;child;){var next=child.nextSibling;this.insertBefore(child,refChild),child=next}return newChild}return _insertBefore(this,newChild,refChild),newChild.ownerDocument=this,null===this.documentElement&&newChild.nodeType===ELEMENT_NODE&&(this.documentElement=newChild),newChild},removeChild:function(oldChild){return this.documentElement==oldChild&&(this.documentElement=null),_removeChild(this,oldChild)},replaceChild:function(newChild,oldChild){_insertBefore(this,newChild,oldChild,assertPreReplacementValidityInDocument),newChild.ownerDocument=this,oldChild&&this.removeChild(oldChild),isElementNode(newChild)&&(this.documentElement=newChild)},importNode:function(importedNode,deep){return importNode(this,importedNode,deep)},getElementById:function(id){var rtv=null;return _visitNode(this.documentElement,(function(node){if(node.nodeType==ELEMENT_NODE&&node.getAttribute("id")==id)return rtv=node,!0})),rtv},getElementsByClassName:function(classNames){var classNamesSet=toOrderedSet(classNames);return new LiveNodeList(this,(function(base){var ls=[];return classNamesSet.length>0&&_visitNode(base.documentElement,(function(node){if(node!==base&&node.nodeType===ELEMENT_NODE){var nodeClassNames=node.getAttribute("class");if(nodeClassNames){var matches=classNames===nodeClassNames;if(!matches){var nodeClassNamesSet=toOrderedSet(nodeClassNames);matches=classNamesSet.every((list=nodeClassNamesSet,function(element){return list&&-1!==list.indexOf(element)}))}matches&&ls.push(node)}}var list})),ls}))},createElement:function(tagName){var node=new Element;return node.ownerDocument=this,node.nodeName=tagName,node.tagName=tagName,node.localName=tagName,node.childNodes=new NodeList,(node.attributes=new NamedNodeMap)._ownerElement=node,node},createDocumentFragment:function(){var node=new DocumentFragment;return node.ownerDocument=this,node.childNodes=new NodeList,node},createTextNode:function(data){var node=new Text;return node.ownerDocument=this,node.appendData(data),node},createComment:function(data){var node=new Comment;return node.ownerDocument=this,node.appendData(data),node},createCDATASection:function(data){var node=new CDATASection;return node.ownerDocument=this,node.appendData(data),node},createProcessingInstruction:function(target,data){var node=new ProcessingInstruction;return node.ownerDocument=this,node.tagName=node.target=target,node.nodeValue=node.data=data,node},createAttribute:function(name){var node=new Attr;return node.ownerDocument=this,node.name=name,node.nodeName=name,node.localName=name,node.specified=!0,node},createEntityReference:function(name){var node=new EntityReference;return node.ownerDocument=this,node.nodeName=name,node},createElementNS:function(namespaceURI,qualifiedName){var node=new Element,pl=qualifiedName.split(":"),attrs=node.attributes=new NamedNodeMap;return node.childNodes=new NodeList,node.ownerDocument=this,node.nodeName=qualifiedName,node.tagName=qualifiedName,node.namespaceURI=namespaceURI,2==pl.length?(node.prefix=pl[0],node.localName=pl[1]):node.localName=qualifiedName,attrs._ownerElement=node,node},createAttributeNS:function(namespaceURI,qualifiedName){var node=new Attr,pl=qualifiedName.split(":");return node.ownerDocument=this,node.nodeName=qualifiedName,node.name=qualifiedName,node.namespaceURI=namespaceURI,node.specified=!0,2==pl.length?(node.prefix=pl[0],node.localName=pl[1]):node.localName=qualifiedName,node}},_extends(Document,Node),Element.prototype={nodeType:ELEMENT_NODE,hasAttribute:function(name){return null!=this.getAttributeNode(name)},getAttribute:function(name){var attr=this.getAttributeNode(name);return attr&&attr.value||""},getAttributeNode:function(name){return this.attributes.getNamedItem(name)},setAttribute:function(name,value){var attr=this.ownerDocument.createAttribute(name);attr.value=attr.nodeValue=""+value,this.setAttributeNode(attr)},removeAttribute:function(name){var attr=this.getAttributeNode(name);attr&&this.removeAttributeNode(attr)},appendChild:function(newChild){return newChild.nodeType===DOCUMENT_FRAGMENT_NODE?this.insertBefore(newChild,null):function(parentNode,newChild){return newChild.parentNode&&newChild.parentNode.removeChild(newChild),newChild.parentNode=parentNode,newChild.previousSibling=parentNode.lastChild,newChild.nextSibling=null,newChild.previousSibling?newChild.previousSibling.nextSibling=newChild:parentNode.firstChild=newChild,parentNode.lastChild=newChild,_onUpdateChild(parentNode.ownerDocument,parentNode,newChild),newChild}(this,newChild)},setAttributeNode:function(newAttr){return this.attributes.setNamedItem(newAttr)},setAttributeNodeNS:function(newAttr){return this.attributes.setNamedItemNS(newAttr)},removeAttributeNode:function(oldAttr){return this.attributes.removeNamedItem(oldAttr.nodeName)},removeAttributeNS:function(namespaceURI,localName){var old=this.getAttributeNodeNS(namespaceURI,localName);old&&this.removeAttributeNode(old)},hasAttributeNS:function(namespaceURI,localName){return null!=this.getAttributeNodeNS(namespaceURI,localName)},getAttributeNS:function(namespaceURI,localName){var attr=this.getAttributeNodeNS(namespaceURI,localName);return attr&&attr.value||""},setAttributeNS:function(namespaceURI,qualifiedName,value){var attr=this.ownerDocument.createAttributeNS(namespaceURI,qualifiedName);attr.value=attr.nodeValue=""+value,this.setAttributeNode(attr)},getAttributeNodeNS:function(namespaceURI,localName){return this.attributes.getNamedItemNS(namespaceURI,localName)},getElementsByTagName:function(tagName){return new LiveNodeList(this,(function(base){var ls=[];return _visitNode(base,(function(node){node===base||node.nodeType!=ELEMENT_NODE||"*"!==tagName&&node.tagName!=tagName||ls.push(node)})),ls}))},getElementsByTagNameNS:function(namespaceURI,localName){return new LiveNodeList(this,(function(base){var ls=[];return _visitNode(base,(function(node){node===base||node.nodeType!==ELEMENT_NODE||"*"!==namespaceURI&&node.namespaceURI!==namespaceURI||"*"!==localName&&node.localName!=localName||ls.push(node)})),ls}))}},Document.prototype.getElementsByTagName=Element.prototype.getElementsByTagName,Document.prototype.getElementsByTagNameNS=Element.prototype.getElementsByTagNameNS,_extends(Element,Node),Attr.prototype.nodeType=ATTRIBUTE_NODE,_extends(Attr,Node),CharacterData.prototype={data:"",substringData:function(offset,count){return this.data.substring(offset,offset+count)},appendData:function(text){text=this.data+text,this.nodeValue=this.data=text,this.length=text.length},insertData:function(offset,text){this.replaceData(offset,0,text)},appendChild:function(newChild){throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR])},deleteData:function(offset,count){this.replaceData(offset,count,"")},replaceData:function(offset,count,text){text=this.data.substring(0,offset)+text+this.data.substring(offset+count),this.nodeValue=this.data=text,this.length=text.length}},_extends(CharacterData,Node),Text.prototype={nodeName:"#text",nodeType:TEXT_NODE,splitText:function(offset){var text=this.data,newText=text.substring(offset);text=text.substring(0,offset),this.data=this.nodeValue=text,this.length=text.length;var newNode=this.ownerDocument.createTextNode(newText);return this.parentNode&&this.parentNode.insertBefore(newNode,this.nextSibling),newNode}},_extends(Text,CharacterData),Comment.prototype={nodeName:"#comment",nodeType:COMMENT_NODE},_extends(Comment,CharacterData),CDATASection.prototype={nodeName:"#cdata-section",nodeType:CDATA_SECTION_NODE},_extends(CDATASection,CharacterData),DocumentType.prototype.nodeType=DOCUMENT_TYPE_NODE,_extends(DocumentType,Node),Notation.prototype.nodeType=NOTATION_NODE,_extends(Notation,Node),Entity.prototype.nodeType=ENTITY_NODE,_extends(Entity,Node),EntityReference.prototype.nodeType=ENTITY_REFERENCE_NODE,_extends(EntityReference,Node),DocumentFragment.prototype.nodeName="#document-fragment",DocumentFragment.prototype.nodeType=DOCUMENT_FRAGMENT_NODE,_extends(DocumentFragment,Node),ProcessingInstruction.prototype.nodeType=PROCESSING_INSTRUCTION_NODE,_extends(ProcessingInstruction,Node),XMLSerializer.prototype.serializeToString=function(node,isHtml,nodeFilter){return nodeSerializeToString.call(node,isHtml,nodeFilter)},Node.prototype.toString=nodeSerializeToString;try{if(Object.defineProperty){function getTextContent(node){switch(node.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:var buf=[];for(node=node.firstChild;node;)7!==node.nodeType&&8!==node.nodeType&&buf.push(getTextContent(node)),node=node.nextSibling;return buf.join("");default:return node.nodeValue}}Object.defineProperty(LiveNodeList.prototype,"length",{get:function(){return _updateLiveList(this),this.$$length}}),Object.defineProperty(Node.prototype,"textContent",{get:function(){return getTextContent(this)},set:function(data){switch(this.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:for(;this.firstChild;)this.removeChild(this.firstChild);(data||String(data))&&this.appendChild(this.ownerDocument.createTextNode(data));break;default:this.data=data,this.value=data,this.nodeValue=data}}}),__set__=function(object,key,value){object["$$"+key]=value}}}catch(e){}var dom={DocumentType:DocumentType,DOMException:DOMException,DOMImplementation:DOMImplementation$1,Element:Element,Node:Node,NodeList:NodeList,XMLSerializer:XMLSerializer},entities=createCommonjsModule((function(module,exports){var freeze=conventions.freeze;exports.XML_ENTITIES=freeze({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),exports.HTML_ENTITIES=freeze({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),exports.entityMap=exports.HTML_ENTITIES}));entities.XML_ENTITIES,entities.HTML_ENTITIES,entities.entityMap;var NAMESPACE$1=conventions.NAMESPACE,nameStartChar=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,nameChar=new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),tagNamePattern=new RegExp("^"+nameStartChar.source+nameChar.source+"*(?::"+nameStartChar.source+nameChar.source+"*)?$");function ParseError$1(message,locator){this.message=message,this.locator=locator,Error.captureStackTrace&&Error.captureStackTrace(this,ParseError$1)}function XMLReader$1(){}function copyLocator(f,t){return t.lineNumber=f.lineNumber,t.columnNumber=f.columnNumber,t}function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){function addAttribute(qname,value,startIndex){el.attributeNames.hasOwnProperty(qname)&&errorHandler.fatalError("Attribute "+qname+" redefined"),el.addValue(qname,value.replace(/[\t\n\r]/g," ").replace(/?\w+;/g,entityReplacer),startIndex)}for(var attrName,p=++start,s=0;;){var c=source.charAt(p);switch(c){case"=":if(1===s)attrName=source.slice(start,p),s=3;else{if(2!==s)throw new Error("attribute equal must after attrName");s=3}break;case"'":case'"':if(3===s||1===s){if(1===s&&(errorHandler.warning('attribute value must after "="'),attrName=source.slice(start,p)),start=p+1,!((p=source.indexOf(c,start))>0))throw new Error("attribute value no end '"+c+"' match");addAttribute(attrName,value=source.slice(start,p),start-1),s=5}else{if(4!=s)throw new Error('attribute value must after "="');addAttribute(attrName,value=source.slice(start,p),start),errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+")!!"),start=p+1,s=5}break;case"/":switch(s){case 0:el.setTagName(source.slice(start,p));case 5:case 6:case 7:s=7,el.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return errorHandler.error("unexpected end of input"),0==s&&el.setTagName(source.slice(start,p)),p;case">":switch(s){case 0:el.setTagName(source.slice(start,p));case 5:case 6:case 7:break;case 4:case 1:"/"===(value=source.slice(start,p)).slice(-1)&&(el.closed=!0,value=value.slice(0,-1));case 2:2===s&&(value=attrName),4==s?(errorHandler.warning('attribute "'+value+'" missed quot(")!'),addAttribute(attrName,value,start)):(NAMESPACE$1.isHTML(currentNSMap[""])&&value.match(/^(?:disabled|checked|selected)$/i)||errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!'),addAttribute(value,value,start));break;case 3:throw new Error("attribute value missed!!")}return p;case"":c=" ";default:if(c<=" ")switch(s){case 0:el.setTagName(source.slice(start,p)),s=6;break;case 1:attrName=source.slice(start,p),s=2;break;case 4:var value=source.slice(start,p);errorHandler.warning('attribute "'+value+'" missed quot(")!!'),addAttribute(attrName,value,start);case 5:s=6}else switch(s){case 2:el.tagName,NAMESPACE$1.isHTML(currentNSMap[""])&&attrName.match(/^(?:disabled|checked|selected)$/i)||errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!'),addAttribute(attrName,attrName,start),start=p,s=1;break;case 5:errorHandler.warning('attribute space is required"'+attrName+'"!!');case 6:s=1,start=p;break;case 3:s=4,start=p;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}p++}}function appendElement$1(el,domBuilder,currentNSMap){for(var tagName=el.tagName,localNSMap=null,i=el.length;i--;){var a=el[i],qName=a.qName,value=a.value;if((nsp=qName.indexOf(":"))>0)var prefix=a.prefix=qName.slice(0,nsp),localName=qName.slice(nsp+1),nsPrefix="xmlns"===prefix&&localName;else localName=qName,prefix=null,nsPrefix="xmlns"===qName&&"";a.localName=localName,!1!==nsPrefix&&(null==localNSMap&&(localNSMap={},_copy(currentNSMap,currentNSMap={})),currentNSMap[nsPrefix]=localNSMap[nsPrefix]=value,a.uri=NAMESPACE$1.XMLNS,domBuilder.startPrefixMapping(nsPrefix,value))}for(i=el.length;i--;){(prefix=(a=el[i]).prefix)&&("xml"===prefix&&(a.uri=NAMESPACE$1.XML),"xmlns"!==prefix&&(a.uri=currentNSMap[prefix||""]))}var nsp;(nsp=tagName.indexOf(":"))>0?(prefix=el.prefix=tagName.slice(0,nsp),localName=el.localName=tagName.slice(nsp+1)):(prefix=null,localName=el.localName=tagName);var ns=el.uri=currentNSMap[prefix||""];if(domBuilder.startElement(ns,localName,tagName,el),!el.closed)return el.currentNSMap=currentNSMap,el.localNSMap=localNSMap,!0;if(domBuilder.endElement(ns,localName,tagName),localNSMap)for(prefix in localNSMap)Object.prototype.hasOwnProperty.call(localNSMap,prefix)&&domBuilder.endPrefixMapping(prefix)}function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){if(/^(?:script|textarea)$/i.test(tagName)){var elEndStart=source.indexOf(""+tagName+">",elStartEnd),text=source.substring(elStartEnd+1,elEndStart);if(/[&<]/.test(text))return/^script$/i.test(tagName)?(domBuilder.characters(text,0,text.length),elEndStart):(text=text.replace(/?\w+;/g,entityReplacer),domBuilder.characters(text,0,text.length),elEndStart)}return elStartEnd+1}function fixSelfClosed(source,elStartEnd,tagName,closeMap){var pos=closeMap[tagName];return null==pos&&((pos=source.lastIndexOf(""+tagName+">"))start?(domBuilder.comment(source,start+4,end-start-4),end+3):(errorHandler.error("Unclosed comment"),-1):-1;if("CDATA["==source.substr(start+3,6)){var end=source.indexOf("]]>",start+9);return domBuilder.startCDATA(),domBuilder.characters(source,start+9,end-start-9),domBuilder.endCDATA(),end+3}var matchs=function(source,start){var match,buf=[],reg=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;reg.lastIndex=start,reg.exec(source);for(;match=reg.exec(source);)if(buf.push(match),match[1])return buf}(source,start),len=matchs.length;if(len>1&&/!doctype/i.test(matchs[0][0])){var name=matchs[1][0],pubid=!1,sysid=!1;len>3&&(/^public$/i.test(matchs[2][0])?(pubid=matchs[3][0],sysid=len>4&&matchs[4][0]):/^system$/i.test(matchs[2][0])&&(sysid=matchs[3][0]));var lastMatch=matchs[len-1];return domBuilder.startDTD(name,pubid,sysid),domBuilder.endDTD(),lastMatch.index+lastMatch[0].length}return-1}function parseInstruction(source,start,domBuilder){var end=source.indexOf("?>",start);if(end){var match=source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return match?(match[0].length,domBuilder.processingInstruction(match[1],match[2]),end+2):-1}return-1}function ElementAttributes(){this.attributeNames={}}ParseError$1.prototype=new Error,ParseError$1.prototype.name=ParseError$1.name,XMLReader$1.prototype={parse:function(source,defaultNSMap,entityMap){var domBuilder=this.domBuilder;domBuilder.startDocument(),_copy(defaultNSMap,defaultNSMap={}),function(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){function fixedFromCharCode(code){if(code>65535){var surrogate1=55296+((code-=65536)>>10),surrogate2=56320+(1023&code);return String.fromCharCode(surrogate1,surrogate2)}return String.fromCharCode(code)}function entityReplacer(a){var k=a.slice(1,-1);return Object.hasOwnProperty.call(entityMap,k)?entityMap[k]:"#"===k.charAt(0)?fixedFromCharCode(parseInt(k.substr(1).replace("x","0x"))):(errorHandler.error("entity not found:"+a),a)}function appendText(end){if(end>start){var xt=source.substring(start,end).replace(/?\w+;/g,entityReplacer);locator&&position(start),domBuilder.characters(xt,0,end-start),start=end}}function position(p,m){for(;p>=lineEnd&&(m=linePattern.exec(source));)lineStart=m.index,lineEnd=lineStart+m[0].length,locator.lineNumber++;locator.columnNumber=p-lineStart+1}var lineStart=0,lineEnd=0,linePattern=/.*(?:\r\n?|\n)|.*$/g,locator=domBuilder.locator,parseStack=[{currentNSMap:defaultNSMapCopy}],closeMap={},start=0;for(;;){try{var tagStart=source.indexOf("<",start);if(tagStart<0){if(!source.substr(start).match(/^\s*$/)){var doc=domBuilder.doc,text=doc.createTextNode(source.substr(start));doc.appendChild(text),domBuilder.currentElement=text}return}switch(tagStart>start&&appendText(tagStart),source.charAt(tagStart+1)){case"/":var end=source.indexOf(">",tagStart+3),tagName=source.substring(tagStart+2,end).replace(/[ \t\n\r]+$/g,""),config=parseStack.pop();end<0?(tagName=source.substring(tagStart+2).replace(/[\s<].*/,""),errorHandler.error("end tag name: "+tagName+" is not complete:"+config.tagName),end=tagStart+1+tagName.length):tagName.match(/\s)&&(tagName=tagName.replace(/[\s<].*/,""),errorHandler.error("end tag name: "+tagName+" maybe not complete"),end=tagStart+1+tagName.length);var localNSMap=config.localNSMap,endMatch=config.tagName==tagName;if(endMatch||config.tagName&&config.tagName.toLowerCase()==tagName.toLowerCase()){if(domBuilder.endElement(config.uri,config.localName,tagName),localNSMap)for(var prefix in localNSMap)Object.prototype.hasOwnProperty.call(localNSMap,prefix)&&domBuilder.endPrefixMapping(prefix);endMatch||errorHandler.fatalError("end tag name: "+tagName+" is not match the current start tagName:"+config.tagName)}else parseStack.push(config);end++;break;case"?":locator&&position(tagStart),end=parseInstruction(source,tagStart,domBuilder);break;case"!":locator&&position(tagStart),end=parseDCC(source,tagStart,domBuilder,errorHandler);break;default:locator&&position(tagStart);var el=new ElementAttributes,currentNSMap=parseStack[parseStack.length-1].currentNSMap,len=(end=parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler),el.length);if(!el.closed&&fixSelfClosed(source,end,el.tagName,closeMap)&&(el.closed=!0,entityMap.nbsp||errorHandler.warning("unclosed xml attribute")),locator&&len){for(var locator2=copyLocator(locator,{}),i=0;istart?start=end:appendText(Math.max(tagStart,start)+1)}}(source,defaultNSMap,entityMap,domBuilder,this.errorHandler),domBuilder.endDocument()}},ElementAttributes.prototype={setTagName:function(tagName){if(!tagNamePattern.test(tagName))throw new Error("invalid tagName:"+tagName);this.tagName=tagName},addValue:function(qName,value,offset){if(!tagNamePattern.test(qName))throw new Error("invalid attribute:"+qName);this.attributeNames[qName]=this.length,this[this.length++]={qName:qName,value:value,offset:offset}},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};var sax={XMLReader:XMLReader$1,ParseError:ParseError$1},DOMImplementation=dom.DOMImplementation,NAMESPACE=conventions.NAMESPACE,ParseError=sax.ParseError,XMLReader=sax.XMLReader;function normalizeLineEndings(input){return input.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function DOMParser$1(options){this.options=options||{locator:{}}}function DOMHandler(){this.cdata=!1}function position(locator,node){node.lineNumber=locator.lineNumber,node.columnNumber=locator.columnNumber}function _locator(l){if(l)return"\n@"+(l.systemId||"")+"#[line:"+l.lineNumber+",col:"+l.columnNumber+"]"}function _toString(chars,start,length){return"string"==typeof chars?chars.substr(start,length):chars.length>=start+length||start?new java.lang.String(chars,start,length)+"":chars}function appendElement(hander,node){hander.currentElement?hander.currentElement.appendChild(node):hander.doc.appendChild(node)}DOMParser$1.prototype.parseFromString=function(source,mimeType){var options=this.options,sax=new XMLReader,domBuilder=options.domBuilder||new DOMHandler,errorHandler=options.errorHandler,locator=options.locator,defaultNSMap=options.xmlns||{},isHTML=/\/x?html?$/.test(mimeType),entityMap=isHTML?entities.HTML_ENTITIES:entities.XML_ENTITIES;locator&&domBuilder.setDocumentLocator(locator),sax.errorHandler=function(errorImpl,domBuilder,locator){if(!errorImpl){if(domBuilder instanceof DOMHandler)return domBuilder;errorImpl=domBuilder}var errorHandler={},isCallback=errorImpl instanceof Function;function build(key){var fn=errorImpl[key];!fn&&isCallback&&(fn=2==errorImpl.length?function(msg){errorImpl(key,msg)}:errorImpl),errorHandler[key]=fn&&function(msg){fn("[xmldom "+key+"]\t"+msg+_locator(locator))}||function(){}}return locator=locator||{},build("warning"),build("error"),build("fatalError"),errorHandler}(errorHandler,domBuilder,locator),sax.domBuilder=options.domBuilder||domBuilder,isHTML&&(defaultNSMap[""]=NAMESPACE.HTML),defaultNSMap.xml=defaultNSMap.xml||NAMESPACE.XML;var normalize=options.normalizeLineEndings||normalizeLineEndings;return source&&"string"==typeof source?sax.parse(normalize(source),defaultNSMap,entityMap):sax.errorHandler.error("invalid doc source"),domBuilder.doc},DOMHandler.prototype={startDocument:function(){this.doc=(new DOMImplementation).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(namespaceURI,localName,qName,attrs){var doc=this.doc,el=doc.createElementNS(namespaceURI,qName||localName),len=attrs.length;appendElement(this,el),this.currentElement=el,this.locator&&position(this.locator,el);for(var i=0;i!!obj&&"object"==typeof obj,merge$1=function(){for(var _len23=arguments.length,objects=new Array(_len23),_key23=0;_key23<_len23;_key23++)objects[_key23]=arguments[_key23];return objects.reduce(((result,source)=>("object"!=typeof source||Object.keys(source).forEach((key=>{Array.isArray(result[key])&&Array.isArray(source[key])?result[key]=result[key].concat(source[key]):isObject(result[key])&&isObject(source[key])?result[key]=merge$1(result[key],source[key]):result[key]=source[key]})),result)),{})},values=o=>Object.keys(o).map((k=>o[k])),flatten=lists=>lists.reduce(((x,y)=>x.concat(y)),[]),from=list=>{if(!list.length)return[];const result=[];for(let i=0;i{let{baseUrl:baseUrl="",source:source="",range:range="",indexRange:indexRange=""}=_ref10;const segment={uri:source,resolvedUri:resolveUrl$1(baseUrl||"",source)};if(range||indexRange){const ranges=(range||indexRange).split("-");let length,startRange=window.BigInt?window.BigInt(ranges[0]):parseInt(ranges[0],10),endRange=window.BigInt?window.BigInt(ranges[1]):parseInt(ranges[1],10);startRange(endNumber&&"number"!=typeof endNumber&&(endNumber=parseInt(endNumber,10)),isNaN(endNumber)?null:endNumber),segmentRange={static(attributes){const{duration:duration,timescale:timescale=1,sourceDuration:sourceDuration,periodDuration:periodDuration}=attributes,endNumber=parseEndNumber(attributes.endNumber),segmentDuration=duration/timescale;return"number"==typeof endNumber?{start:0,end:endNumber}:"number"==typeof periodDuration?{start:0,end:periodDuration/segmentDuration}:{start:0,end:sourceDuration/segmentDuration}},dynamic(attributes){const{NOW:NOW,clientOffset:clientOffset,availabilityStartTime:availabilityStartTime,timescale:timescale=1,duration:duration,periodStart:periodStart=0,minimumUpdatePeriod:minimumUpdatePeriod=0,timeShiftBufferDepth:timeShiftBufferDepth=1/0}=attributes,endNumber=parseEndNumber(attributes.endNumber),now=(NOW+clientOffset)/1e3,periodStartWC=availabilityStartTime+periodStart,periodDuration=now+minimumUpdatePeriod-periodStartWC,segmentCount=Math.ceil(periodDuration*timescale/duration),availableStart=Math.floor((now-periodStartWC-timeShiftBufferDepth)*timescale/duration),availableEnd=Math.floor((now-periodStartWC)*timescale/duration);return{start:Math.max(0,availableStart),end:"number"==typeof endNumber?endNumber:Math.min(segmentCount,availableEnd)}}},parseByDuration=attributes=>{const{type:type,duration:duration,timescale:timescale=1,periodDuration:periodDuration,sourceDuration:sourceDuration}=attributes,{start:start,end:end}=segmentRange[type](attributes),segments=((start,end)=>{const result=[];for(let i=start;inumber=>{const{duration:duration,timescale:timescale=1,periodStart:periodStart,startNumber:startNumber=1}=attributes;return{number:startNumber+number,duration:duration/timescale,timeline:periodStart,time:number*duration}})(attributes));if("static"===type){const index=segments.length-1,sectionDuration="number"==typeof periodDuration?periodDuration:sourceDuration;segments[index].duration=sectionDuration-duration/timescale*index}return segments},segmentsFromBase=attributes=>{const{baseUrl:baseUrl,initialization:initialization={},sourceDuration:sourceDuration,indexRange:indexRange="",periodStart:periodStart,presentationTime:presentationTime,number:number=0,duration:duration}=attributes;if(!baseUrl)throw new Error(errors_NO_BASE_URL);const initSegment=urlTypeToSegment({baseUrl:baseUrl,source:initialization.sourceURL,range:initialization.range}),segment=urlTypeToSegment({baseUrl:baseUrl,source:baseUrl,indexRange:indexRange});if(segment.map=initSegment,duration){const segmentTimeInfo=parseByDuration(attributes);segmentTimeInfo.length&&(segment.duration=segmentTimeInfo[0].duration,segment.timeline=segmentTimeInfo[0].timeline)}else sourceDuration&&(segment.duration=sourceDuration,segment.timeline=periodStart);return segment.presentationTime=presentationTime||periodStart,segment.number=number,[segment]},addSidxSegmentsToPlaylist$1=(playlist,sidx,baseUrl)=>{const initSegment=playlist.sidx.map?playlist.sidx.map:null,sourceDuration=playlist.sidx.duration,timeline=playlist.timeline||0,sidxByteRange=playlist.sidx.byterange,sidxEnd=sidxByteRange.offset+sidxByteRange.length,timescale=sidx.timescale,mediaReferences=sidx.references.filter((r=>1!==r.referenceType)),segments=[],type=playlist.endList?"static":"dynamic",periodStart=playlist.sidx.timeline;let startIndex,presentationTime=periodStart,number=playlist.mediaSequence||0;startIndex="bigint"==typeof sidx.firstOffset?window.BigInt(sidxEnd)+sidx.firstOffset:sidxEnd+sidx.firstOffset;for(let i=0;i{return(lists=timelineStarts,keyFunction=_ref11=>{let{timeline:timeline}=_ref11;return timeline},values(lists.reduce(((acc,list)=>(list.forEach((el=>{acc[keyFunction(el)]=el})),acc)),{}))).sort(((a,b)=>a.timeline>b.timeline?1:-1));var lists,keyFunction},getMediaGroupPlaylists=manifest=>{let mediaGroupPlaylists=[];var master,callback;return master=manifest,callback=(properties,type,group,label)=>{mediaGroupPlaylists=mediaGroupPlaylists.concat(properties.playlists||[])},SUPPORTED_MEDIA_TYPES.forEach((function(mediaType){for(var groupKey in master.mediaGroups[mediaType])for(var labelKey in master.mediaGroups[mediaType][groupKey]){var mediaProperties=master.mediaGroups[mediaType][groupKey][labelKey];callback(mediaProperties,mediaType,groupKey,labelKey)}})),mediaGroupPlaylists},updateMediaSequenceForPlaylist=_ref12=>{let{playlist:playlist,mediaSequence:mediaSequence}=_ref12;playlist.mediaSequence=mediaSequence,playlist.segments.forEach(((segment,index)=>{segment.number=playlist.mediaSequence+index}))},positionManifestOnTimeline=_ref15=>{let{oldManifest:oldManifest,newManifest:newManifest}=_ref15;const oldPlaylists=oldManifest.playlists.concat(getMediaGroupPlaylists(oldManifest)),newPlaylists=newManifest.playlists.concat(getMediaGroupPlaylists(newManifest));return newManifest.timelineStarts=getUniqueTimelineStarts([oldManifest.timelineStarts,newManifest.timelineStarts]),(_ref13=>{let{oldPlaylists:oldPlaylists,newPlaylists:newPlaylists,timelineStarts:timelineStarts}=_ref13;newPlaylists.forEach((playlist=>{playlist.discontinuitySequence=timelineStarts.findIndex((function(_ref14){let{timeline:timeline}=_ref14;return timeline===playlist.timeline}));const oldPlaylist=((playlists,name)=>{for(let i=0;ioldPlaylist.timeline||oldPlaylist.segments.length&&playlist.timeline>oldPlaylist.segments[oldPlaylist.segments.length-1].timeline)&&playlist.discontinuitySequence--);oldPlaylist.segments[oldMatchingSegmentIndex].discontinuity&&!firstNewSegment.discontinuity&&(firstNewSegment.discontinuity=!0,playlist.discontinuityStarts.unshift(0),playlist.discontinuitySequence--),updateMediaSequenceForPlaylist({playlist:playlist,mediaSequence:oldPlaylist.segments[oldMatchingSegmentIndex].number})}))})({oldPlaylists:oldPlaylists,newPlaylists:newPlaylists,timelineStarts:newManifest.timelineStarts}),newManifest},generateSidxKey=sidx=>sidx&&sidx.uri+"-"+(byterange=>{let endRange;return endRange="bigint"==typeof byterange.offset||"bigint"==typeof byterange.length?window.BigInt(byterange.offset)+window.BigInt(byterange.length)-window.BigInt(1):byterange.offset+byterange.length-1,"".concat(byterange.offset,"-").concat(endRange)})(sidx.byterange),mergeDiscontiguousPlaylists=playlists=>values(playlists.reduce(((acc,playlist)=>{const name=playlist.attributes.id+(playlist.attributes.lang||"");return acc[name]?(playlist.segments&&(playlist.segments[0]&&(playlist.segments[0].discontinuity=!0),acc[name].segments.push(...playlist.segments)),playlist.attributes.contentProtection&&(acc[name].attributes.contentProtection=playlist.attributes.contentProtection)):(acc[name]=playlist,acc[name].attributes.timelineStarts=[]),acc[name].attributes.timelineStarts.push({start:playlist.attributes.periodStart,timeline:playlist.attributes.periodStart}),acc}),{})).map((playlist=>{var l,key;return playlist.discontinuityStarts=(l=playlist.segments||[],key="discontinuity",l.reduce(((a,e,i)=>(e[key]&&a.push(i),a)),[])),playlist})),addSidxSegmentsToPlaylist=(playlist,sidxMapping)=>{const sidxKey=generateSidxKey(playlist.sidx),sidxMatch=sidxKey&&sidxMapping[sidxKey]&&sidxMapping[sidxKey].sidx;return sidxMatch&&addSidxSegmentsToPlaylist$1(playlist,sidxMatch,playlist.sidx.resolvedUri),playlist},addSidxSegmentsToPlaylists=function(playlists){let sidxMapping=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Object.keys(sidxMapping).length)return playlists;for(const i in playlists)playlists[i]=addSidxSegmentsToPlaylist(playlists[i],sidxMapping);return playlists},formatAudioPlaylist=(_ref16,isAudioOnly)=>{let{attributes:attributes,segments:segments,sidx:sidx,mediaSequence:mediaSequence,discontinuitySequence:discontinuitySequence,discontinuityStarts:discontinuityStarts}=_ref16;const playlist={attributes:{NAME:attributes.id,BANDWIDTH:attributes.bandwidth,CODECS:attributes.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===attributes.type,timeline:attributes.periodStart,resolvedUri:"",targetDuration:attributes.duration,discontinuitySequence:discontinuitySequence,discontinuityStarts:discontinuityStarts,timelineStarts:attributes.timelineStarts,mediaSequence:mediaSequence,segments:segments};return attributes.contentProtection&&(playlist.contentProtection=attributes.contentProtection),sidx&&(playlist.sidx=sidx),isAudioOnly&&(playlist.attributes.AUDIO="audio",playlist.attributes.SUBTITLES="subs"),playlist},formatVttPlaylist=_ref17=>{let{attributes:attributes,segments:segments,mediaSequence:mediaSequence,discontinuityStarts:discontinuityStarts,discontinuitySequence:discontinuitySequence}=_ref17;void 0===segments&&(segments=[{uri:attributes.baseUrl,timeline:attributes.periodStart,resolvedUri:attributes.baseUrl||"",duration:attributes.sourceDuration,number:0}],attributes.duration=attributes.sourceDuration);const m3u8Attributes={NAME:attributes.id,BANDWIDTH:attributes.bandwidth,"PROGRAM-ID":1};return attributes.codecs&&(m3u8Attributes.CODECS=attributes.codecs),{attributes:m3u8Attributes,uri:"",endList:"static"===attributes.type,timeline:attributes.periodStart,resolvedUri:attributes.baseUrl||"",targetDuration:attributes.duration,timelineStarts:attributes.timelineStarts,discontinuityStarts:discontinuityStarts,discontinuitySequence:discontinuitySequence,mediaSequence:mediaSequence,segments:segments}},formatVideoPlaylist=_ref18=>{let{attributes:attributes,segments:segments,sidx:sidx,discontinuityStarts:discontinuityStarts}=_ref18;const playlist={attributes:{NAME:attributes.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:attributes.width,height:attributes.height},CODECS:attributes.codecs,BANDWIDTH:attributes.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===attributes.type,timeline:attributes.periodStart,resolvedUri:"",targetDuration:attributes.duration,discontinuityStarts:discontinuityStarts,timelineStarts:attributes.timelineStarts,segments:segments};return attributes.frameRate&&(playlist.attributes["FRAME-RATE"]=attributes.frameRate),attributes.contentProtection&&(playlist.contentProtection=attributes.contentProtection),sidx&&(playlist.sidx=sidx),playlist},videoOnly=_ref19=>{let{attributes:attributes}=_ref19;return"video/mp4"===attributes.mimeType||"video/webm"===attributes.mimeType||"video"===attributes.contentType},audioOnly=_ref20=>{let{attributes:attributes}=_ref20;return"audio/mp4"===attributes.mimeType||"audio/webm"===attributes.mimeType||"audio"===attributes.contentType},vttOnly=_ref21=>{let{attributes:attributes}=_ref21;return"text/vtt"===attributes.mimeType||"text"===attributes.contentType},flattenMediaGroupPlaylists=mediaGroupObject=>mediaGroupObject?Object.keys(mediaGroupObject).reduce(((acc,label)=>{const labelContents=mediaGroupObject[label];return acc.concat(labelContents.playlists)}),[]):[],toM3u8=_ref23=>{let{dashPlaylists:dashPlaylists,locations:locations,sidxMapping:sidxMapping={},previousManifest:previousManifest}=_ref23;if(!dashPlaylists.length)return{};const{sourceDuration:duration,type:type,suggestedPresentationDelay:suggestedPresentationDelay,minimumUpdatePeriod:minimumUpdatePeriod}=dashPlaylists[0].attributes,videoPlaylists=mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist),audioPlaylists=mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly)),vttPlaylists=mergeDiscontiguousPlaylists(dashPlaylists.filter(vttOnly)),captions=dashPlaylists.map((playlist=>playlist.attributes.captionServices)).filter(Boolean),manifest={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:duration,playlists:addSidxSegmentsToPlaylists(videoPlaylists,sidxMapping)};minimumUpdatePeriod>=0&&(manifest.minimumUpdatePeriod=1e3*minimumUpdatePeriod),locations&&(manifest.locations=locations),"dynamic"===type&&(manifest.suggestedPresentationDelay=suggestedPresentationDelay);const isAudioOnly=0===manifest.playlists.length,organizedAudioGroup=audioPlaylists.length?function(playlists){let mainPlaylist,sidxMapping=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},isAudioOnly=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const formattedPlaylists=playlists.reduce(((a,playlist)=>{const role=playlist.attributes.role&&playlist.attributes.role.value||"",language=playlist.attributes.lang||"";let label=playlist.attributes.label||"main";if(language&&!playlist.attributes.label){const roleLabel=role?" (".concat(role,")"):"";label="".concat(playlist.attributes.lang).concat(roleLabel)}a[label]||(a[label]={language:language,autoselect:!0,default:"main"===role,playlists:[],uri:""});const formatted=addSidxSegmentsToPlaylist(formatAudioPlaylist(playlist,isAudioOnly),sidxMapping);return a[label].playlists.push(formatted),void 0===mainPlaylist&&"main"===role&&(mainPlaylist=playlist,mainPlaylist.default=!0),a}),{});mainPlaylist||(formattedPlaylists[Object.keys(formattedPlaylists)[0]].default=!0);return formattedPlaylists}(audioPlaylists,sidxMapping,isAudioOnly):null,organizedVttGroup=vttPlaylists.length?function(playlists){let sidxMapping=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return playlists.reduce(((a,playlist)=>{const label=playlist.attributes.lang||"text";return a[label]||(a[label]={language:label,default:!1,autoselect:!1,playlists:[],uri:""}),a[label].playlists.push(addSidxSegmentsToPlaylist(formatVttPlaylist(playlist),sidxMapping)),a}),{})}(vttPlaylists,sidxMapping):null,formattedPlaylists=videoPlaylists.concat(flattenMediaGroupPlaylists(organizedAudioGroup),flattenMediaGroupPlaylists(organizedVttGroup)),playlistTimelineStarts=formattedPlaylists.map((_ref24=>{let{timelineStarts:timelineStarts}=_ref24;return timelineStarts}));var playlists,timelineStarts;return manifest.timelineStarts=getUniqueTimelineStarts(playlistTimelineStarts),playlists=formattedPlaylists,timelineStarts=manifest.timelineStarts,playlists.forEach((playlist=>{playlist.mediaSequence=0,playlist.discontinuitySequence=timelineStarts.findIndex((function(_ref22){let{timeline:timeline}=_ref22;return timeline===playlist.timeline})),playlist.segments&&playlist.segments.forEach(((segment,index)=>{segment.number=index}))})),organizedAudioGroup&&(manifest.mediaGroups.AUDIO.audio=organizedAudioGroup),organizedVttGroup&&(manifest.mediaGroups.SUBTITLES.subs=organizedVttGroup),captions.length&&(manifest.mediaGroups["CLOSED-CAPTIONS"].cc=captions.reduce(((svcObj,svc)=>svc?(svc.forEach((service=>{const{channel:channel,language:language}=service;svcObj[language]={autoselect:!1,default:!1,instreamId:channel,language:language},service.hasOwnProperty("aspectRatio")&&(svcObj[language].aspectRatio=service.aspectRatio),service.hasOwnProperty("easyReader")&&(svcObj[language].easyReader=service.easyReader),service.hasOwnProperty("3D")&&(svcObj[language]["3D"]=service["3D"])})),svcObj):svcObj),{})),previousManifest?positionManifestOnTimeline({oldManifest:previousManifest,newManifest:manifest}):manifest},getLiveRValue=(attributes,time,duration)=>{const{NOW:NOW,clientOffset:clientOffset,availabilityStartTime:availabilityStartTime,timescale:timescale=1,periodStart:periodStart=0,minimumUpdatePeriod:minimumUpdatePeriod=0}=attributes,periodDuration=(NOW+clientOffset)/1e3+minimumUpdatePeriod-(availabilityStartTime+periodStart);return Math.ceil((periodDuration*timescale-time)/duration)},parseByTimeline=(attributes,segmentTimeline)=>{const{type:type,minimumUpdatePeriod:minimumUpdatePeriod=0,media:media="",sourceDuration:sourceDuration,timescale:timescale=1,startNumber:startNumber=1,periodStart:timeline}=attributes,segments=[];let time=-1;for(let sIndex=0;sIndextime&&(time=segmentTime),repeat<0){const nextS=sIndex+1;count=nextS===segmentTimeline.length?"dynamic"===type&&minimumUpdatePeriod>0&&media.indexOf("$Number$")>0?getLiveRValue(attributes,time,duration):(sourceDuration*timescale-time)/duration:(segmentTimeline[nextS].t-time)/duration}else count=repeat+1;const end=startNumber+segments.length+count;let number=startNumber+segments.length;for(;numberurl.replace(identifierPattern,(values=>(match,identifier,format,width)=>{if("$$"===match)return"$";if(void 0===values[identifier])return match;const value=""+values[identifier];return"RepresentationID"===identifier?value:(width=format?parseInt(width,10):1,value.length>=width?value:"".concat(new Array(width-value.length+1).join("0")).concat(value))})(values)),segmentsFromTemplate=(attributes,segmentTimeline)=>{const templateValues={RepresentationID:attributes.id,Bandwidth:attributes.bandwidth||0},{initialization:initialization={sourceURL:"",range:""}}=attributes,mapSegment=urlTypeToSegment({baseUrl:attributes.baseUrl,source:constructTemplateUrl(initialization.sourceURL,templateValues),range:initialization.range}),segments=((attributes,segmentTimeline)=>attributes.duration||segmentTimeline?attributes.duration?parseByDuration(attributes):parseByTimeline(attributes,segmentTimeline):[{number:attributes.startNumber||1,duration:attributes.sourceDuration,time:0,timeline:attributes.periodStart}])(attributes,segmentTimeline);return segments.map((segment=>{templateValues.Number=segment.number,templateValues.Time=segment.time;const uri=constructTemplateUrl(attributes.media||"",templateValues),timescale=attributes.timescale||1,presentationTimeOffset=attributes.presentationTimeOffset||0,presentationTime=attributes.periodStart+(segment.time-presentationTimeOffset)/timescale;return{uri:uri,timeline:segment.timeline,duration:segment.duration,resolvedUri:resolveUrl$1(attributes.baseUrl||"",uri),map:mapSegment,number:segment.number,presentationTime:presentationTime}}))},segmentsFromList=(attributes,segmentTimeline)=>{const{duration:duration,segmentUrls:segmentUrls=[],periodStart:periodStart}=attributes;if(!duration&&!segmentTimeline||duration&&segmentTimeline)throw new Error(errors_SEGMENT_TIME_UNSPECIFIED);const segmentUrlMap=segmentUrls.map((segmentUrlObject=>((attributes,segmentUrl)=>{const{baseUrl:baseUrl,initialization:initialization={}}=attributes,initSegment=urlTypeToSegment({baseUrl:baseUrl,source:initialization.sourceURL,range:initialization.range}),segment=urlTypeToSegment({baseUrl:baseUrl,source:segmentUrl.media,range:segmentUrl.mediaRange});return segment.map=initSegment,segment})(attributes,segmentUrlObject)));let segmentTimeInfo;duration&&(segmentTimeInfo=parseByDuration(attributes)),segmentTimeline&&(segmentTimeInfo=parseByTimeline(attributes,segmentTimeline));return segmentTimeInfo.map(((segmentTime,index)=>{if(segmentUrlMap[index]){const segment=segmentUrlMap[index],timescale=attributes.timescale||1,presentationTimeOffset=attributes.presentationTimeOffset||0;return segment.timeline=segmentTime.timeline,segment.duration=segmentTime.duration,segment.number=segmentTime.number,segment.presentationTime=periodStart+(segmentTime.time-presentationTimeOffset)/timescale,segment}})).filter((segment=>segment))},generateSegments=_ref25=>{let segmentAttributes,segmentsFn,{attributes:attributes,segmentInfo:segmentInfo}=_ref25;segmentInfo.template?(segmentsFn=segmentsFromTemplate,segmentAttributes=merge$1(attributes,segmentInfo.template)):segmentInfo.base?(segmentsFn=segmentsFromBase,segmentAttributes=merge$1(attributes,segmentInfo.base)):segmentInfo.list&&(segmentsFn=segmentsFromList,segmentAttributes=merge$1(attributes,segmentInfo.list));const segmentsInfo={attributes:attributes};if(!segmentsFn)return segmentsInfo;const segments=segmentsFn(segmentAttributes,segmentInfo.segmentTimeline);if(segmentAttributes.duration){const{duration:duration,timescale:timescale=1}=segmentAttributes;segmentAttributes.duration=duration/timescale}else segments.length?segmentAttributes.duration=segments.reduce(((max,segment)=>Math.max(max,Math.ceil(segment.duration))),0):segmentAttributes.duration=0;return segmentsInfo.attributes=segmentAttributes,segmentsInfo.segments=segments,segmentInfo.base&&segmentAttributes.indexRange&&(segmentsInfo.sidx=segments[0],segmentsInfo.segments=[]),segmentsInfo},toPlaylists=representations=>representations.map(generateSegments),findChildren=(element,name)=>from(element.childNodes).filter((_ref26=>{let{tagName:tagName}=_ref26;return tagName===name})),getContent=element=>element.textContent.trim(),parseDuration=str=>{const match=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(str);if(!match)return 0;const[year,month,day,hour,minute,second]=match.slice(1);return 31536e3*parseFloat(year||0)+2592e3*parseFloat(month||0)+86400*parseFloat(day||0)+3600*parseFloat(hour||0)+60*parseFloat(minute||0)+parseFloat(second||0)},parsers={mediaPresentationDuration:value=>parseDuration(value),availabilityStartTime(value){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(str=value)&&(str+="Z"),Date.parse(str)/1e3;var str},minimumUpdatePeriod:value=>parseDuration(value),suggestedPresentationDelay:value=>parseDuration(value),type:value=>value,timeShiftBufferDepth:value=>parseDuration(value),start:value=>parseDuration(value),width:value=>parseInt(value,10),height:value=>parseInt(value,10),bandwidth:value=>parseInt(value,10),frameRate:value=>(value=>parseFloat(value.split("/").reduce(((prev,current)=>prev/current))))(value),startNumber:value=>parseInt(value,10),timescale:value=>parseInt(value,10),presentationTimeOffset:value=>parseInt(value,10),duration(value){const parsedValue=parseInt(value,10);return isNaN(parsedValue)?parseDuration(value):parsedValue},d:value=>parseInt(value,10),t:value=>parseInt(value,10),r:value=>parseInt(value,10),DEFAULT:value=>value},parseAttributes=el=>el&&el.attributes?from(el.attributes).reduce(((a,e)=>{const parseFn=parsers[e.name]||parsers.DEFAULT;return a[e.name]=parseFn(e.value),a}),{}):{},keySystemsMap={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},buildBaseUrls=(referenceUrls,baseUrlElements)=>baseUrlElements.length?flatten(referenceUrls.map((function(reference){return baseUrlElements.map((function(baseUrlElement){return resolveUrl$1(reference,getContent(baseUrlElement))}))}))):referenceUrls,getSegmentInformation=adaptationSet=>{const segmentTemplate=findChildren(adaptationSet,"SegmentTemplate")[0],segmentList=findChildren(adaptationSet,"SegmentList")[0],segmentUrls=segmentList&&findChildren(segmentList,"SegmentURL").map((s=>merge$1({tag:"SegmentURL"},parseAttributes(s)))),segmentBase=findChildren(adaptationSet,"SegmentBase")[0],segmentTimelineParentNode=segmentList||segmentTemplate,segmentTimeline=segmentTimelineParentNode&&findChildren(segmentTimelineParentNode,"SegmentTimeline")[0],segmentInitializationParentNode=segmentList||segmentBase||segmentTemplate,segmentInitialization=segmentInitializationParentNode&&findChildren(segmentInitializationParentNode,"Initialization")[0],template=segmentTemplate&&parseAttributes(segmentTemplate);template&&segmentInitialization?template.initialization=segmentInitialization&&parseAttributes(segmentInitialization):template&&template.initialization&&(template.initialization={sourceURL:template.initialization});const segmentInfo={template:template,segmentTimeline:segmentTimeline&&findChildren(segmentTimeline,"S").map((s=>parseAttributes(s))),list:segmentList&&merge$1(parseAttributes(segmentList),{segmentUrls:segmentUrls,initialization:parseAttributes(segmentInitialization)}),base:segmentBase&&merge$1(parseAttributes(segmentBase),{initialization:parseAttributes(segmentInitialization)})};return Object.keys(segmentInfo).forEach((key=>{segmentInfo[key]||delete segmentInfo[key]})),segmentInfo},toRepresentations=(periodAttributes,periodBaseUrls,periodSegmentInfo)=>adaptationSet=>{const adaptationSetAttributes=parseAttributes(adaptationSet),adaptationSetBaseUrls=buildBaseUrls(periodBaseUrls,findChildren(adaptationSet,"BaseURL")),role=findChildren(adaptationSet,"Role")[0],roleAttributes={role:parseAttributes(role)};let attrs=merge$1(periodAttributes,adaptationSetAttributes,roleAttributes);const accessibility=findChildren(adaptationSet,"Accessibility")[0],captionServices=(service=>{if("urn:scte:dash:cc:cea-608:2015"===service.schemeIdUri)return("string"!=typeof service.value?[]:service.value.split(";")).map((value=>{let channel,language;return language=value,/^CC\d=/.test(value)?[channel,language]=value.split("="):/^CC\d$/.test(value)&&(channel=value),{channel:channel,language:language}}));if("urn:scte:dash:cc:cea-708:2015"===service.schemeIdUri)return("string"!=typeof service.value?[]:service.value.split(";")).map((value=>{const flags={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(value)){const[channel,opts=""]=value.split("=");flags.channel=channel,flags.language=value,opts.split(",").forEach((opt=>{const[name,val]=opt.split(":");"lang"===name?flags.language=val:"er"===name?flags.easyReader=Number(val):"war"===name?flags.aspectRatio=Number(val):"3D"===name&&(flags["3D"]=Number(val))}))}else flags.language=value;return flags.channel&&(flags.channel="SERVICE"+flags.channel),flags}))})(parseAttributes(accessibility));captionServices&&(attrs=merge$1(attrs,{captionServices:captionServices}));const label=findChildren(adaptationSet,"Label")[0];if(label&&label.childNodes.length){const labelVal=label.childNodes[0].nodeValue.trim();attrs=merge$1(attrs,{label:labelVal})}const contentProtection=findChildren(adaptationSet,"ContentProtection").reduce(((acc,node)=>{const attributes=parseAttributes(node);attributes.schemeIdUri&&(attributes.schemeIdUri=attributes.schemeIdUri.toLowerCase());const keySystem=keySystemsMap[attributes.schemeIdUri];if(keySystem){acc[keySystem]={attributes:attributes};const psshNode=findChildren(node,"cenc:pssh")[0];if(psshNode){const pssh=getContent(psshNode);acc[keySystem].pssh=pssh&&decodeB64ToUint8Array(pssh)}}return acc}),{});Object.keys(contentProtection).length&&(attrs=merge$1(attrs,{contentProtection:contentProtection}));const segmentInfo=getSegmentInformation(adaptationSet),representations=findChildren(adaptationSet,"Representation"),adaptationSetSegmentInfo=merge$1(periodSegmentInfo,segmentInfo);return flatten(representations.map(((adaptationSetAttributes,adaptationSetBaseUrls,adaptationSetSegmentInfo)=>representation=>{const repBaseUrlElements=findChildren(representation,"BaseURL"),repBaseUrls=buildBaseUrls(adaptationSetBaseUrls,repBaseUrlElements),attributes=merge$1(adaptationSetAttributes,parseAttributes(representation)),representationSegmentInfo=getSegmentInformation(representation);return repBaseUrls.map((baseUrl=>({segmentInfo:merge$1(adaptationSetSegmentInfo,representationSegmentInfo),attributes:merge$1(attributes,{baseUrl:baseUrl})})))})(attrs,adaptationSetBaseUrls,adaptationSetSegmentInfo)))},toAdaptationSets=(mpdAttributes,mpdBaseUrls)=>(period,index)=>{const periodBaseUrls=buildBaseUrls(mpdBaseUrls,findChildren(period.node,"BaseURL")),periodAttributes=merge$1(mpdAttributes,{periodStart:period.attributes.start});"number"==typeof period.attributes.duration&&(periodAttributes.periodDuration=period.attributes.duration);const adaptationSets=findChildren(period.node,"AdaptationSet"),periodSegmentInfo=getSegmentInformation(period.node);return flatten(adaptationSets.map(toRepresentations(periodAttributes,periodBaseUrls,periodSegmentInfo)))},getPeriodStart=_ref27=>{let{attributes:attributes,priorPeriodAttributes:priorPeriodAttributes,mpdType:mpdType}=_ref27;return"number"==typeof attributes.start?attributes.start:priorPeriodAttributes&&"number"==typeof priorPeriodAttributes.start&&"number"==typeof priorPeriodAttributes.duration?priorPeriodAttributes.start+priorPeriodAttributes.duration:priorPeriodAttributes||"static"!==mpdType?null:0},inheritAttributes=function(mpd){let options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{manifestUri:manifestUri="",NOW:NOW=Date.now(),clientOffset:clientOffset=0}=options,periodNodes=findChildren(mpd,"Period");if(!periodNodes.length)throw new Error(errors_INVALID_NUMBER_OF_PERIOD);const locations=findChildren(mpd,"Location"),mpdAttributes=parseAttributes(mpd),mpdBaseUrls=buildBaseUrls([manifestUri],findChildren(mpd,"BaseURL"));mpdAttributes.type=mpdAttributes.type||"static",mpdAttributes.sourceDuration=mpdAttributes.mediaPresentationDuration||0,mpdAttributes.NOW=NOW,mpdAttributes.clientOffset=clientOffset,locations.length&&(mpdAttributes.locations=locations.map(getContent));const periods=[];return periodNodes.forEach(((node,index)=>{const attributes=parseAttributes(node),priorPeriod=periods[index-1];attributes.start=getPeriodStart({attributes:attributes,priorPeriodAttributes:priorPeriod?priorPeriod.attributes:null,mpdType:mpdAttributes.type}),periods.push({node:node,attributes:attributes})})),{locations:mpdAttributes.locations,representationInfo:flatten(periods.map(toAdaptationSets(mpdAttributes,mpdBaseUrls)))}},stringToMpdXml=manifestString=>{if(""===manifestString)throw new Error(errors_DASH_EMPTY_MANIFEST);const parser=new DOMParser;let xml,mpd;try{xml=parser.parseFromString(manifestString,"application/xml"),mpd=xml&&"MPD"===xml.documentElement.tagName?xml.documentElement:null}catch(e){}if(!mpd||mpd&&mpd.getElementsByTagName("parsererror").length>0)throw new Error(errors_DASH_INVALID_XML);return mpd},parseUTCTiming=manifestString=>(mpd=>{const UTCTimingNode=findChildren(mpd,"UTCTiming")[0];if(!UTCTimingNode)return null;const attributes=parseAttributes(UTCTimingNode);switch(attributes.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":attributes.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":attributes.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":attributes.method="DIRECT",attributes.value=Date.parse(attributes.value);break;default:throw new Error(errors_UNSUPPORTED_UTC_TIMING_SCHEME)}return attributes})(stringToMpdXml(manifestString));var MAX_UINT32=Math.pow(2,32),getUint64=function(uint8){var value,dv=new DataView(uint8.buffer,uint8.byteOffset,uint8.byteLength);return dv.getBigUint64?(value=dv.getBigUint64(0))0;i+=12,referenceCount--)result.references.push({referenceType:(128&data[i])>>>7,referencedSize:2147483647&view.getUint32(i),subsegmentDuration:view.getUint32(i+4),startsWithSap:!!(128&data[i+8]),sapType:(112&data[i+8])>>>4,sapDeltaTime:268435455&view.getUint32(i+8)});return result},ID3=toUint8([73,68,51]),getId3Offset=function getId3Offset(bytes,offset){return void 0===offset&&(offset=0),(bytes=toUint8(bytes)).length-offset<10||!bytesMatch(bytes,ID3,{offset:offset})?offset:(offset+=function(bytes,offset){void 0===offset&&(offset=0);var flags=(bytes=toUint8(bytes))[offset+5],returnSize=bytes[offset+6]<<21|bytes[offset+7]<<14|bytes[offset+8]<<7|bytes[offset+9];return(16&flags)>>4?returnSize+20:returnSize+10}(bytes,offset),getId3Offset(bytes,offset))},normalizePath$1=function(path){return"string"==typeof path?stringToBytes(path):path},findBox=function findBox(bytes,paths,complete){void 0===complete&&(complete=!1),paths=function(paths){return Array.isArray(paths)?paths.map((function(p){return normalizePath$1(p)})):[normalizePath$1(paths)]}(paths),bytes=toUint8(bytes);var results=[];if(!paths.length)return results;for(var i=0;i>>0,type=bytes.subarray(i+4,i+8);if(0===size)break;var end=i+size;if(end>bytes.length){if(complete)break;end=bytes.length}var data=bytes.subarray(i+8,end);bytesMatch(type,paths[0])&&(1===paths.length?results.push(data):results.push.apply(results,findBox(data,paths.slice(1),complete))),i=end}return results},EBML_TAGS={EBML:toUint8([26,69,223,163]),DocType:toUint8([66,130]),Segment:toUint8([24,83,128,103]),SegmentInfo:toUint8([21,73,169,102]),Tracks:toUint8([22,84,174,107]),Track:toUint8([174]),TrackNumber:toUint8([215]),DefaultDuration:toUint8([35,227,131]),TrackEntry:toUint8([174]),TrackType:toUint8([131]),FlagDefault:toUint8([136]),CodecID:toUint8([134]),CodecPrivate:toUint8([99,162]),VideoTrack:toUint8([224]),AudioTrack:toUint8([225]),Cluster:toUint8([31,67,182,117]),Timestamp:toUint8([231]),TimestampScale:toUint8([42,215,177]),BlockGroup:toUint8([160]),BlockDuration:toUint8([155]),Block:toUint8([161]),SimpleBlock:toUint8([163])},LENGTH_TABLE=[128,64,32,16,8,4,2,1],getvint=function(bytes,offset,removeLength,signed){void 0===removeLength&&(removeLength=!0),void 0===signed&&(signed=!1);var length=function(byte){for(var len=1,i=0;i=bytes.length)return bytes.length;var innerid=getvint(bytes,offset,!1);if(bytesMatch(id.bytes,innerid.bytes))return offset;var dataHeader=getvint(bytes,offset+innerid.length);return getInfinityDataSize(id,bytes,offset+dataHeader.length+dataHeader.value+innerid.length)},findEbml=function findEbml(bytes,paths){paths=function(paths){return Array.isArray(paths)?paths.map((function(p){return normalizePath(p)})):[normalizePath(paths)]}(paths),bytes=toUint8(bytes);var results=[];if(!paths.length)return results;for(var i=0;i