/*! For license information please see ../../LICENSES */ (window.webpackJsonp=window.webpackJsonp||[]).push([[73],{47:function(e,t,n){"use strict";(function(e){for(var r,o=n(0),l=n.n(o),d=n(6),c=n.n(d),h=n(66),f=n.n(h),m=n(13),v=n.n(m),_=n(11),y=n.n(_),T=n(7),S=n.n(T),k=n(173),C=n.n(k),E=n(328),w=n.n(E),I=n(329),x=n.n(I),P=n(323),A=n.n(P),L=n(574),O=n.n(L),D=n(151),M=n(575),R=n(22),U=n(330),B=n(2),N=n(107),F=n(578),j=n.n(F),H=n(129),V=n(176),W=n(175),z=n(579),G=n.n(z),K="7.21.7",Q={},X=function(e,t){return Q[e]=Q[e]||[],t&&(Q[e]=Q[e].concat(t)),Q[e]},Y=function(e,t){var n=X(e).indexOf(t);return!(n<=-1)&&(Q[e]=Q[e].slice(),Q[e].splice(n,1),!0)},$={prefixed:!0},J=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],Z=J[0],i=0;i0?h:0)}if(l.a.console){var f=l.a.console[n];f||"debug"!==n||(f=l.a.console.info||l.a.console.log),f&&d&&c.test(n)&&f[Array.isArray(o)?"apply":"call"](l.a.console,o)}}}(t,o),o.createLogger=function(n){return e(t+": "+n)},o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:r},o.level=function(e){if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');r=e}return r},(o.history=function(){return te?[].concat(te):[]}).filter=function(e){return(te||[]).filter(function(t){return new RegExp(".*"+e+".*").test(t[0])})},o.history.clear=function(){te&&(te.length=0)},o.history.disable=function(){null!==te&&(te.length=0,te=null)},o.history.enable=function(){null===te&&(te=[])},o.error=function(){for(var e=arguments.length,t=new Array(e),o=0;o1?t-1:0),r=1;r=0)throw new Error("class has illegal whitespace characters")}function Re(){return c.a===l.a.document}function Ue(e){return le(e)&&1===e.nodeType}function Be(){try{return l.a.parent!==l.a.self}catch(e){return!0}}function Ne(e){return function(t,n){if(!De(t))return c.a[e](null);De(n)&&(n=c.a.querySelector(n));var r=Ue(n)?n:c.a;return r[e]&&r[e](t)}}function Fe(e,t,n,content){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===n&&(n={});var r=c.a.createElement(e);return Object.getOwnPropertyNames(t).forEach(function(e){var n=t[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(ie.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+n+"."),r.setAttribute(e,n)):"textContent"===e?je(r,n):r[e]===n&&"tabIndex"!==e||(r[e]=n)}),Object.getOwnPropertyNames(n).forEach(function(e){r.setAttribute(e,n[e])}),content&&st(r,content),r}function je(e,text){return void 0===e.textContent?e.innerText=text:e.textContent=text,e}function He(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function qe(element,e){return Me(e),element.classList?element.classList.contains(e):(t=e,new RegExp("(^|\\s)"+t+"($|\\s)")).test(element.className);var t}function Ve(element,e){return element.classList?element.classList.add(e):qe(element,e)||(element.className=(element.className+" "+e).trim()),element}function We(element,e){return element?(element.classList?element.classList.remove(e):(Me(e),element.className=element.className.split(/\s+/).filter(function(t){return t!==e}).join(" ")),element):(ie.warn("removeClass was called with an element that doesn't exist"),null)}function ze(element,e,t){var n=qe(element,e);if("function"==typeof t&&(t=t(element,e)),"boolean"!=typeof t&&(t=!n),t!==n)return t?Ve(element,e):We(element,e),element}function Ge(e,t){Object.getOwnPropertyNames(t).forEach(function(n){var r=t[n];null==r||!1===r?e.removeAttribute(n):e.setAttribute(n,!0===r?"":r)})}function Ke(e){var t={},n=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0)for(var r=e.attributes,i=r.length-1;i>=0;i--){var o=r[i].name,l=r[i].value;"boolean"!=typeof e[o]&&-1===n.indexOf(","+o+",")||(l=null!==l),t[o]=l}return t}function Qe(e,t){return e.getAttribute(t)}function Xe(e,t,n){e.setAttribute(t,n)}function Ye(e,t){e.removeAttribute(t)}function $e(){c.a.body.focus(),c.a.onselectstart=function(){return!1}}function Je(){c.a.onselectstart=function(){return!0}}function Ze(e){if(e&&e.getBoundingClientRect&&e.parentNode){var rect=e.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(function(e){void 0!==rect[e]&&(t[e]=rect[e])}),t.height||(t.height=parseFloat(de(e,"height"))),t.width||(t.width=parseFloat(de(e,"width"))),t}}function et(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,n=e.offsetHeight,r=0,o=0;e.offsetParent&&e!==c.a[$.fullscreenElement];)r+=e.offsetLeft,o+=e.offsetTop,e=e.offsetParent;return{left:r,top:o,width:t,height:n}}function tt(e,t){var n={x:0,y:0};if(Ae)for(var r=e;r&&"html"!==r.nodeName.toLowerCase();){var o=de(r,"transform");if(/^matrix/.test(o)){var l=o.slice(7,-1).split(/,\s/).map(Number);n.x+=l[4],n.y+=l[5]}else if(/^matrix3d/.test(o)){var d=o.slice(9,-1).split(/,\s/).map(Number);n.x+=d[12],n.y+=d[13]}r=r.parentNode}var c={},h=et(t.target),f=et(e),m=f.width,v=f.height,_=t.offsetY-(f.top-h.top),y=t.offsetX-(f.left-h.left);return t.changedTouches&&(y=t.changedTouches[0].pageX-f.left,_=t.changedTouches[0].pageY+f.top,Ae&&(y-=n.x,_-=n.y)),c.y=1-Math.max(0,Math.min(1,_/v)),c.x=Math.max(0,Math.min(1,y/m)),c}function it(e){return le(e)&&3===e.nodeType}function nt(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function at(content){return"function"==typeof content&&(content=content()),(Array.isArray(content)?content:[content]).map(function(e){return"function"==typeof e&&(e=e()),Ue(e)||it(e)?e:"string"==typeof e&&/\S/.test(e)?c.a.createTextNode(e):void 0}).filter(function(e){return e})}function st(e,content){return at(content).forEach(function(t){return e.appendChild(t)}),e}function ot(e,content){return st(nt(e),content)}function lt(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}var ut,ct=Ne("querySelector"),ht=Ne("querySelectorAll"),pt=Object.freeze({__proto__:null,isReal:Re,isEl:Ue,isInFrame:Be,createEl:Fe,textContent:je,prependTo:He,hasClass:qe,addClass:Ve,removeClass:We,toggleClass:ze,setAttributes:Ge,getAttributes:Ke,getAttribute:Qe,setAttribute:Xe,removeAttribute:Ye,blockTextSelection:$e,unblockTextSelection:Je,getBoundingClientRect:Ze,findPosition:et,getPointerPosition:tt,isTextNode:it,emptyEl:nt,normalizeContent:at,appendContent:st,insertContent:ot,isSingleLeftClick:lt,$:ct,$$:ht}),ft=!1,mt=function(){if(!1!==ut.options.autoSetup){var e=Array.prototype.slice.call(c.a.getElementsByTagName("video")),t=Array.prototype.slice.call(c.a.getElementsByTagName("audio")),n=Array.prototype.slice.call(c.a.getElementsByTagName("video-js")),r=e.concat(t,n);if(r&&r.length>0)for(var i=0,o=r.length;i-1&&(r={passive:!0}),e.addEventListener(t,data.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,data.dispatcher)}function At(e,t,n){if(Ct.has(e)){var data=Ct.get(e);if(data.handlers){if(Array.isArray(t))return wt(At,e,t,n);var r=function(e,t){data.handlers[t]=[],Et(e,t)};if(void 0!==t){var o=data.handlers[t];if(o)if(n){if(n.guid)for(var l=0;l=t&&(e.apply(void 0,arguments),n=r)}},Ft=function(){};Ft.prototype.allowedEvents_={},Ft.prototype.on=function(e,t){var n=this.addEventListener;this.addEventListener=function(){},Pt(this,e,t),this.addEventListener=n},Ft.prototype.addEventListener=Ft.prototype.on,Ft.prototype.off=function(e,t){At(this,e,t)},Ft.prototype.removeEventListener=Ft.prototype.off,Ft.prototype.one=function(e,t){var n=this.addEventListener;this.addEventListener=function(){},Ot(this,e,t),this.addEventListener=n},Ft.prototype.any=function(e,t){var n=this.addEventListener;this.addEventListener=function(){},Dt(this,e,t),this.addEventListener=n},Ft.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=It(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Lt(this,e)},Ft.prototype.dispatchEvent=Ft.prototype.trigger,Ft.prototype.queueTrigger=function(e){var t=this;Mt||(Mt=new Map);var n=e.type||e,map=Mt.get(this);map||(map=new Map,Mt.set(this,map));var r=map.get(n);map.delete(n),l.a.clearTimeout(r);var o=l.a.setTimeout(function(){map.delete(n),0===map.size&&(map=null,Mt.delete(t)),t.trigger(e)},0);map.set(n,o)};var jt=function(e){return"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e},Ht=function(object){return object instanceof Ft||!!object.eventBusEl_&&["on","one","off","trigger"].every(function(e){return"function"==typeof object[e]})},qt=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},Vt=function(e,t,n){if(!e||!e.nodeName&&!Ht(e))throw new Error("Invalid target for "+jt(t)+"#"+n+"; must be a DOM node or evented object.")},Wt=function(e,t,n){if(!qt(e))throw new Error("Invalid event type for "+jt(t)+"#"+n+"; must be a non-empty string or array.")},zt=function(e,t,n){if("function"!=typeof e)throw new Error("Invalid listener for "+jt(t)+"#"+n+"; must be a function.")},Gt=function(e,t,n){var r,o,l,d=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return d?(r=e.eventBusEl_,t.length>=3&&t.shift(),o=t[0],l=t[1]):(r=t[0],o=t[1],l=t[2]),Vt(r,e,n),Wt(o,e,n),zt(l,e,n),{isTargetingSelf:d,target:r,type:o,listener:l=Bt(e,l)}},Kt=function(e,t,n,r){Vt(e,e,t),e.nodeName?Rt[t](e,n,r):e[t](n,r)},Qt={on:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r=0;i--)this.children_[i].dispose&&this.children_[i].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(e){return e?(this.options_=ei(this.options_,e),this.options_):this.options_},t.el=function(){return this.el_},t.createEl=function(e,t,n){return Fe(e,t,n)},t.localize=function(e,t,n){void 0===n&&(n=e);var code=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),o=r&&r[code],l=code&&code.split("-")[0],d=r&&r[l],c=n;return o&&o[e]?c=o[e]:d&&d[e]&&(c=d[e]),t&&(c=c.replace(/\{(\d+)\}/g,function(e,n){var r=t[n-1],o=r;return void 0===r&&(o=e),o})),c},t.handleLanguagechange=function(){},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(e){return this.childIndex_[e]},t.getChild=function(e){if(e)return this.childNameIndex_[e]},t.getDescendant=function(){for(var e=arguments.length,t=new Array(e),n=0;n=0;i--)if(this.children_[i]===component){e=!0,this.children_.splice(i,1);break}if(e){component.parentComponent_=null,this.childIndex_[component.id()]=null,this.childNameIndex_[Zt(component.name())]=null,this.childNameIndex_[Jt(component.name())]=null;var t=component.el();t&&t.parentNode===this.contentEl()&&this.contentEl().removeChild(component.el())}}},t.initChildren=function(){var t=this,n=this.options_.children;if(n){var r,o=this.options_,l=e.getComponent("Tech");(r=Array.isArray(n)?n:Object.keys(n)).concat(Object.keys(this.options_).filter(function(e){return!r.some(function(t){return"string"==typeof t?e===t:e===t.name})})).map(function(e){var r,o;return"string"==typeof e?o=n[r=e]||t.options_[r]||{}:(r=e.name,o=e),{name:r,opts:o}}).filter(function(t){var n=e.getComponent(t.opts.componentClass||Zt(t.name));return n&&!l.isTech(n)}).forEach(function(e){var n=e.name,r=e.opts;if(void 0!==o[n]&&(r=o[n]),!1!==r){!0===r&&(r={}),r.playerOptions=t.options_.playerOptions;var l=t.addChild(n,r);l&&(t[n]=l)}})}},t.buildCSSClass=function(){return""},t.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},t.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)},t.$=function(e,t){return ct(e,t||this.contentEl())},t.$$=function(e,t){return ht(e,t||this.contentEl())},t.hasClass=function(e){return qe(this.el_,e)},t.addClass=function(e){Ve(this.el_,e)},t.removeClass=function(e){We(this.el_,e)},t.toggleClass=function(e,t){ze(this.el_,e,t)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(e){return Qe(this.el_,e)},t.setAttribute=function(e,t){Xe(this.el_,e,t)},t.removeAttribute=function(e){Ye(this.el_,e)},t.width=function(e,t){return this.dimension("width",e,t)},t.height=function(e,t){return this.dimension("height",e,t)},t.dimensions=function(e,t){this.width(e,!0),this.height(t)},t.dimension=function(e,t,n){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(n||this.trigger("componentresize"));if(!this.el_)return 0;var r=this.el_.style[e],o=r.indexOf("px");return-1!==o?parseInt(r.slice(0,o),10):parseInt(this.el_["offset"+Zt(e)],10)},t.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=de(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var n="offset"+Zt(e);t=this.el_[n]}return t},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.handleKeyDown=function(e){this.player_&&(v.a.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))},t.handleKeyPress=function(e){this.handleKeyDown(e)},t.emitTapEvents=function(){var e,t=0,n=null;this.on("touchstart",function(r){1===r.touches.length&&(n={pageX:r.touches[0].pageX,pageY:r.touches[0].pageY},t=l.a.performance.now(),e=!0)}),this.on("touchmove",function(t){if(t.touches.length>1)e=!1;else if(n){var r=t.touches[0].pageX-n.pageX,o=t.touches[0].pageY-n.pageY;Math.sqrt(r*r+o*o)>10&&(e=!1)}});var r=function(){e=!1};this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",function(r){(n=null,!0===e)&&(l.a.performance.now()-t<200&&(r.preventDefault(),this.trigger("tap")))})},t.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=Bt(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});var n=function(n){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",n),this.on("touchcancel",n)}},t.setTimeout=function(e,t){var n,r=this;return e=Bt(this,e),this.clearTimersOnDispose_(),n=l.a.setTimeout(function(){r.setTimeoutIds_.has(n)&&r.setTimeoutIds_.delete(n),e()},t),this.setTimeoutIds_.add(n),n},t.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),l.a.clearTimeout(e)),e},t.setInterval=function(e,t){e=Bt(this,e),this.clearTimersOnDispose_();var n=l.a.setInterval(e,t);return this.setIntervalIds_.add(n),n},t.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),l.a.clearInterval(e)),e},t.requestAnimationFrame=function(e){var t,n=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=Bt(this,e),t=l.a.requestAnimationFrame(function(){n.rafIds_.has(t)&&n.rafIds_.delete(t),e()}),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},t.requestNamedAnimationFrame=function(e,t){var n=this;if(!this.namedRafs_.has(e)){this.clearTimersOnDispose_(),t=Bt(this,t);var r=this.requestAnimationFrame(function(){t(),n.namedRafs_.has(e)&&n.namedRafs_.delete(e)});return this.namedRafs_.set(e,r),e}},t.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},t.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),l.a.cancelAnimationFrame(e)),e):this.clearTimeout(e)},t.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(t){var n=t[0],r=t[1];e[n].forEach(function(t,n){return e[r](n)})}),e.clearingTimersOnDispose_=!1}))},e.registerComponent=function(t,n){if("string"!=typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var r,o=e.getComponent("Tech"),l=o&&o.isTech(n),d=e===n||e.prototype.isPrototypeOf(n.prototype);if(l||!d)throw r=l?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+t+'"; '+r+".");t=Zt(t),e.components_||(e.components_={});var c=e.getComponent("Player");if("Player"===t&&c&&c.players){var h=c.players,f=Object.keys(h);if(h&&f.length>0&&f.map(function(e){return h[e]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=n,e.components_[Jt(t)]=n,n},e.getComponent=function(t){if(t&&e.components_)return e.components_[t]},e}();function si(e,t,n,r){return function(e,t,n){if("number"!=typeof t||t<0||t>n)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+n+").")}(e,r,n.length-1),n[r][t]}function oi(e){var t;return t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:si.bind(null,"start",0,e),end:si.bind(null,"end",1,e)},l.a.Symbol&&l.a.Symbol.iterator&&(t[l.a.Symbol.iterator]=function(){return(e||[]).values()}),t}function ui(e,t){return Array.isArray(e)?oi(e):void 0===e||void 0===t?oi():oi([[e,t]])}function di(e,t){var n,r,o=0;if(!t)return 0;e&&e.length||(e=ui(0,0));for(var i=0;it&&(r=t),o+=r-n;return o/t}function ci(e){if(e instanceof ci)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:le(e)&&("number"==typeof e.code&&(this.code=e.code),oe(this,e)),this.message||(this.message=ci.defaultMessages[this.code]||"")}ai.prototype.supportsRaf_="function"==typeof l.a.requestAnimationFrame&&"function"==typeof l.a.cancelAnimationFrame,ai.registerComponent("Component",ai),ci.prototype.code=0,ci.prototype.message="",ci.prototype.status=null,ci.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],ci.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(var hi=0;hi=0;i--)if(t[i].enabled){Si(t,t[i]);break}return(n=e.call(this,t)||this).changing_=!1,n}S()(t,e);var n=t.prototype;return n.addTrack=function(track){var t=this;track.enabled&&Si(this,track),e.prototype.addTrack.call(this,track),track.addEventListener&&(track.enabledChange_=function(){t.changing_||(t.changing_=!0,Si(t,track),t.changing_=!1,t.trigger("change"))},track.addEventListener("enabledchange",track.enabledChange_))},n.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(Ti),Ci=function(e,track){for(var i=0;i=0;i--)if(t[i].selected){Ci(t,t[i]);break}return(n=e.call(this,t)||this).changing_=!1,Object.defineProperty(y()(n),"selectedIndex",{get:function(){for(var e=0;e0&&(l.a.console&&l.a.console.groupCollapsed&&l.a.console.groupCollapsed("Text Track parsing errors for "+track.src),n.forEach(function(e){return ie.error(e)}),l.a.console&&l.a.console.groupEnd&&l.a.console.groupEnd()),t.flush()},ji=function(e,track){var t={uri:e},n=Bi(e);n&&(t.cors=n);var r="use-credentials"===track.tech_.crossOrigin();r&&(t.withCredentials=r),w()(t,Bt(this,function(e,t,n){if(e)return ie.error(e,t);track.loaded_=!0,"function"!=typeof l.a.WebVTT?track.tech_&&track.tech_.any(["vttjsloaded","vttjserror"],function(e){if("vttjserror"!==e.type)return Fi(n,track);ie.error("vttjs failed to load, stopping trying to process "+track.src)}):Fi(n,track)}))},Hi=function(e){function t(t){var n;if(void 0===t&&(t={}),!t.tech)throw new Error("A tech was not provided.");var r=ei(t,{kind:Li[t.kind]||"subtitles",language:t.language||t.srclang||""}),o=Oi[r.mode]||"disabled",l=r.default;"metadata"!==r.kind&&"chapters"!==r.kind||(o="hidden"),(n=e.call(this,r)||this).tech_=r.tech,n.cues_=[],n.activeCues_=[],n.preload_=!1!==n.tech_.preloadTextTracks;var d=new xi(n.cues_),c=new xi(n.activeCues_),h=!1;n.timeupdateHandler=Bt(y()(n),function(e){void 0===e&&(e={}),this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,h&&(this.trigger("cuechange"),h=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))):"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});return n.tech_.one("dispose",function(){n.stopTracking()}),"disabled"!==o&&n.startTracking(),Object.defineProperties(y()(n),{default:{get:function(){return l},set:function(){}},mode:{get:function(){return o},set:function(e){Oi[e]&&o!==e&&(o=e,this.preload_||"disabled"===o||0!==this.cues.length||ji(this.src,this),this.stopTracking(),"disabled"!==o&&this.startTracking(),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?d:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return c;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(h=!1,t.length!==this.activeCues_.length)h=!0;else for(var o=0;o0)return void this.trigger("vttjsloaded");var script=c.a.createElement("script");script.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",script.onload=function(){e.trigger("vttjsloaded")},script.onerror=function(){e.trigger("vttjserror")},this.on("dispose",function(){script.onload=null,script.onerror=null}),l.a.WebVTT=!0,this.el().parentNode.appendChild(script)}else this.ready(this.addWebVttScript_)},n.emulateTextTracks=function(){var e=this,t=this.textTracks(),n=this.remoteTextTracks(),r=function(e){return t.addTrack(e.track)},o=function(e){return t.removeTrack(e.track)};n.on("addtrack",r),n.on("removetrack",o),this.addWebVttScript_();var l=function(){return e.trigger("texttrackchange")},d=function(){l();for(var i=0;i=0;i--){var o=e[i];o[t]&&o[t](r,n)}}(e,n,c,d),c}var en={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},tn={setCurrentTime:1,setMuted:1,setVolume:1},nn={play:1,pause:1};function rn(e){return function(t,n){return t===$i?$i:n[e]?n[e](t):t}}function an(e,t,n,r,o,l){void 0===e&&(e={}),void 0===t&&(t=[]),void 0===o&&(o=[]),void 0===l&&(l=!1);var d=t,c=d[0],h=d.slice(1);if("string"==typeof c)an(e,Xi[c],n,r,o,l);else if(c){var f=function(e,t){var n=Yi[e.id()],r=null;if(null==n)return r=t(e),Yi[e.id()]=[[t,r]],r;for(var i=0;i0;!this.player_.tech(!0)||(Ce||be)&&t||this.player_.tech(!0).focus(),this.player_.paused()?fi(this.player_.play()):this.player_.pause()}},t}(cn);ai.registerComponent("PosterImage",hn);var pn="#222",fn={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 mn(e,t){var n;if(4===e.length)n=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");n=e.slice(1)}return"rgba("+parseInt(n.slice(0,2),16)+","+parseInt(n.slice(2,4),16)+","+parseInt(n.slice(4,6),16)+","+t+")"}function gn(e,style,t){try{e.style[style]=t}catch(e){return}}var vn=function(e){function t(t,n,r){var o;o=e.call(this,t,n,r)||this;var d=function(e){return o.updateDisplay(e)};return t.on("loadstart",function(e){return o.toggleDisplay(e)}),t.on("texttrackchange",d),t.on("loadedmetadata",function(e){return o.preselectTrack(e)}),t.ready(Bt(y()(o),function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",d),t.on("playerresize",d),l.a.addEventListener("orientationchange",d),t.on("dispose",function(){return l.a.removeEventListener("orientationchange",d)});for(var e=this.options_.playerOptions.tracks||[],i=0;i0;return fi(t),void(!this.player_.tech(!0)||(Ce||be)&&n||this.player_.tech(!0).focus())}var r=this.player_.getChild("controlBar"),o=r&&r.getChild("playToggle");if(o){var l=function(){return o.focus()};pi(t)?t.then(l,function(){}):this.setTimeout(l,1)}else this.player_.tech(!0).focus()},n.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},n.handleMouseDown=function(e){this.mouseused_=!0},t}(yn);Tn.prototype.controlText_="Play Video",ai.registerComponent("BigPlayButton",Tn);var bn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).controlText(n&&n.controlText||r.localize("Close")),r}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},n.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},n.handleKeyDown=function(t){v.a.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(yn);ai.registerComponent("CloseButton",bn);var Sn=function(e){function t(t,n){var r;return void 0===n&&(n={}),r=e.call(this,t,n)||this,n.replay=void 0===n.replay||n.replay,r.on(t,"play",function(e){return r.handlePlay(e)}),r.on(t,"pause",function(e){return r.handlePause(e)}),n.replay&&r.on(t,"ended",function(e){return r.handleEnded(e)}),r}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},n.handleClick=function(e){this.player_.paused()?fi(this.player_.play()):this.player_.pause()},n.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},n.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},n.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},n.handleEnded=function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",function(e){return t.handleSeeked(e)})},t}(yn);Sn.prototype.controlText_="Play",ai.registerComponent("PlayToggle",Sn);var kn=function(e,t){e=e<0?0:e;var s=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),o=Math.floor(t/60%60),l=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=s="-"),(r=r>0||l>0?r+":":"")+(n=((r||o>=10)&&n<10?"0"+n:n)+":")+(s=s<10?"0"+s:s)},Cn=kn;function En(e,t){return void 0===t&&(t=e),Cn(e,t)}var wn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).on(t,["timeupdate","ended"],function(e){return r.updateContent(e)}),r.updateTextNode_(),r}S()(t,e);var n=t.prototype;return n.createEl=function(){var t=this.buildCSSClass(),n=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control"}),span=Fe("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return n.appendChild(span),this.contentEl_=Fe("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),n.appendChild(this.contentEl_),n},n.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},n.updateTextNode_=function(time){var e=this;void 0===time&&(time=0),time=En(time),this.formattedTime_!==time&&(this.formattedTime_=time,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",function(){if(e.contentEl_){var t=e.textNode_;t&&e.contentEl_.firstChild!==t&&(t=null,ie.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),e.textNode_=c.a.createTextNode(e.formattedTime_),e.textNode_&&(t?e.contentEl_.replaceChild(e.textNode_,t):e.contentEl_.appendChild(e.textNode_))}}))},n.updateContent=function(e){},t}(ai);wn.prototype.labelText_="Time",wn.prototype.controlText_="Time",ai.registerComponent("TimeDisplay",wn);var In=function(e){function t(){return e.apply(this,arguments)||this}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-current-time"},n.updateContent=function(e){var time;time=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(time)},t}(wn);In.prototype.labelText_="Current Time",In.prototype.controlText_="Current Time",ai.registerComponent("CurrentTimeDisplay",In);var xn=function(e){function t(t,n){var r,o=function(e){return r.updateContent(e)};return(r=e.call(this,t,n)||this).on(t,"durationchange",o),r.on(t,"loadstart",o),r.on(t,"loadedmetadata",o),r}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-duration"},n.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},t}(wn);xn.prototype.labelText_="Duration",xn.prototype.controlText_="Duration",ai.registerComponent("DurationDisplay",xn);var Pn=function(e){function t(){return e.apply(this,arguments)||this}return S()(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),div=e.prototype.createEl.call(this,"div"),span=e.prototype.createEl.call(this,"span",{textContent:"/"});return div.appendChild(span),t.appendChild(div),t},t}(ai);ai.registerComponent("TimeDivider",Pn);var An=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).on(t,"durationchange",function(e){return r.updateContent(e)}),r}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-remaining-time"},n.createEl=function(){var t=e.prototype.createEl.call(this);return!1!==this.options_.displayNegative&&t.insertBefore(Fe("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},n.updateContent=function(e){var time;"number"==typeof this.player_.duration()&&(time=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(time))},t}(wn);An.prototype.labelText_="Remaining Time",An.prototype.controlText_="Remaining Time",ai.registerComponent("RemainingTimeDisplay",An);var Ln=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).updateShowing(),r.on(r.player(),"durationchange",function(e){return r.updateShowing(e)}),r}S()(t,e);var n=t.prototype;return n.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=Fe("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(Fe("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(c.a.createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t},n.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},n.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(ai);ai.registerComponent("LiveDisplay",Ln);var On=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).updateLiveEdgeStatus(),r.player_.liveTracker&&(r.updateLiveEdgeStatusHandler_=function(e){return r.updateLiveEdgeStatus(e)},r.on(r.player_.liveTracker,"liveedgechange",r.updateLiveEdgeStatusHandler_)),r}S()(t,e);var n=t.prototype;return n.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=Fe("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},n.updateLiveEdgeStatus=function(){!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"))},n.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},n.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,e.prototype.dispose.call(this)},t}(yn);On.prototype.controlText_="Seek to live, currently playing live",ai.registerComponent("SeekToLive",On);var Dn=function(e,t,n){return e=Number(e),Math.min(n,Math.max(t,isNaN(e)?t:e))},Mn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).handleMouseDown_=function(e){return r.handleMouseDown(e)},r.handleMouseUp_=function(e){return r.handleMouseUp(e)},r.handleKeyDown_=function(e){return r.handleKeyDown(e)},r.handleClick_=function(e){return r.handleClick(e)},r.handleMouseMove_=function(e){return r.handleMouseMove(e)},r.update_=function(e){return r.update(e)},r.bar=r.getChild(r.options_.barName),r.vertical(!!r.options_.vertical),r.enable(),r}S()(t,e);var n=t.prototype;return n.enabled=function(){return this.enabled_},n.enable=function(){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)},n.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},n.createEl=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),n.className=n.className+" vjs-slider",n=oe({tabIndex:0},n),r=oe({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},r),e.prototype.createEl.call(this,t,n,r)},n.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Se||e.preventDefault(),$e(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)},n.handleMouseMove=function(e){},n.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;Je(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.update()},n.update=function(){var e=this;if(this.el_&&this.bar){var progress=this.getProgress();return progress===this.progress_||(this.progress_=progress,this.requestNamedAnimationFrame("Slider#update",function(){var t=e.vertical()?"height":"width";e.bar.el().style[t]=(100*progress).toFixed(2)+"%"})),progress}},n.getProgress=function(){return Number(Dn(this.getPercent(),0,1).toFixed(4))},n.calculateDistance=function(e){var t=tt(this.el_,e);return this.vertical()?t.y:t.x},n.handleKeyDown=function(t){v.a.isEventKey(t,"Left")||v.a.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):v.a.isEventKey(t,"Right")||v.a.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},n.handleClick=function(e){e.stopPropagation(),e.preventDefault()},n.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(ai);ai.registerComponent("Slider",Mn);var Rn=function(time,e){return Dn(time/e*100,0,100).toFixed(2)+"%"},Un=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).partEls_=[],r.on(t,"progress",function(e){return r.update(e)}),r}S()(t,e);var n=t.prototype;return n.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),n=Fe("span",{className:"vjs-control-text"}),r=Fe("span",{textContent:this.localize("Loaded")}),o=c.a.createTextNode(": ");return this.percentageEl_=Fe("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(n),n.appendChild(r),n.appendChild(o),n.appendChild(this.percentageEl_),t},n.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},n.update=function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",function(){var e=t.player_.liveTracker,n=t.player_.buffered(),r=e&&e.isLive()?e.seekableEnd():t.player_.duration(),o=t.player_.bufferedEnd(),l=t.partEls_,d=Rn(o,r);t.percent_!==d&&(t.el_.style.width=d,je(t.percentageEl_,d),t.percent_=d);for(var i=0;in.length;m--)t.el_.removeChild(l[m-1]);l.length=n.length})},t}(ai);ai.registerComponent("LoadProgressBar",Un);var Bn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).update=Nt(Bt(y()(r),r.update),Ut),r}S()(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},n.update=function(e,t,content){var n=et(this.el_),r=Ze(this.player_.el()),o=e.width*t;if(r&&n){var l=e.left-r.left+o,d=e.width-o+(r.right-e.right),c=n.width/2;ln.width&&(c=n.width),c=Math.round(c),this.el_.style.right="-"+c+"px",this.write(content)}},n.write=function(content){je(this.el_,content)},n.updateTime=function(e,t,time,n){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",function(){var content,o=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var l=r.player_.liveTracker.liveWindow(),d=l-t*l;content=(d<1?"":"-")+En(d,l)}else content=En(time,o);r.update(e,t,content),n&&n()})},t}(ai);ai.registerComponent("TimeTooltip",Bn);var Nn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).update=Nt(Bt(y()(r),r.update),Ut),r}S()(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},n.update=function(e,t){var n=this.getChild("timeTooltip");if(n){var time=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,time)}},t}(ai);Nn.prototype.options_={children:[]},Ae||ve||Nn.prototype.options_.children.push("timeTooltip"),ai.registerComponent("PlayProgressBar",Nn);var Fn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).update=Nt(Bt(y()(r),r.update),Ut),r}S()(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},n.update=function(e,t){var n=this,time=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,time,function(){n.el_.style.left=e.width*t+"px"})},t}(ai);Fn.prototype.options_={children:["timeTooltip"]},ai.registerComponent("MouseTimeDisplay",Fn);var jn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).setEventHandlers_(),r}S()(t,e);var n=t.prototype;return n.setEventHandlers_=function(){var e=this;this.update_=Bt(this,this.update),this.update=Nt(this.update_,Ut),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_=function(t){return e.enableInterval_(t)},this.disableIntervalHandler_=function(t){return e.disableInterval_(t)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in c.a&&"visibilityState"in c.a&&this.on(c.a,"visibilitychange",this.toggleVisibility_)},n.toggleVisibility_=function(e){"hidden"===c.a.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())},n.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,Ut))},n.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},n.update=function(t){var n=this;if("hidden"!==c.a.visibilityState){var r=e.prototype.update.call(this);return this.requestNamedAnimationFrame("SeekBar#update",function(){var e=n.player_.ended()?n.player_.duration():n.getCurrentTime_(),t=n.player_.liveTracker,o=n.player_.duration();t&&t.isLive()&&(o=n.player_.liveTracker.liveCurrentTime()),n.percent_!==r&&(n.el_.setAttribute("aria-valuenow",(100*r).toFixed(2)),n.percent_=r),n.currentTime_===e&&n.duration_===o||(n.el_.setAttribute("aria-valuetext",n.localize("progress bar timing: currentTime={1} duration={2}",[En(e,o),En(o,o)],"{1} of {2}")),n.currentTime_=e,n.duration_=o),n.bar&&n.bar.update(Ze(n.el()),n.getProgress())}),r}},n.userSeek_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)},n.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},n.getPercent=function(){var e,t=this.getCurrentTime_(),n=this.player_.liveTracker;return n&&n.isLive()?(e=(t-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},n.handleMouseDown=function(t){lt(t)&&(t.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},n.handleMouseMove=function(e,t){if(void 0===t&&(t=!1),lt(e)){var n;t||this.player_.scrubbing()||this.player_.scrubbing(!0);var r=this.calculateDistance(e),o=this.player_.liveTracker;if(o&&o.isLive()){if(r>=.99)return void o.seekToLiveEdge();var l=o.seekableStart(),d=o.liveCurrentTime();if((n=l+r*o.liveWindow())>=d&&(n=d),n<=l&&(n=l+.1),n===1/0)return}else(n=r*this.player_.duration())===this.player_.duration()&&(n-=.1);this.userSeek_(n)}},n.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},n.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},n.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?fi(this.player_.play()):this.update_()},n.stepForward=function(){this.userSeek_(this.player_.currentTime()+5)},n.stepBack=function(){this.userSeek_(this.player_.currentTime()-5)},n.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},n.handleKeyDown=function(t){var n=this.player_.liveTracker;if(v.a.isEventKey(t,"Space")||v.a.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(v.a.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.userSeek_(0);else if(v.a.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),n&&n.isLive()?this.userSeek_(n.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(v()(t))){t.preventDefault(),t.stopPropagation();var r=10*(v.a.codes[v()(t)]-v.a.codes[0])/100;n&&n.isLive()?this.userSeek_(n.seekableStart()+n.liveWindow()*r):this.userSeek_(this.player_.duration()*r)}else v.a.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):v.a.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},n.dispose=function(){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 c.a&&"visibilityState"in c.a&&this.off(c.a,"visibilitychange",this.toggleVisibility_),e.prototype.dispose.call(this)},t}(Mn);jn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},Ae||ve||jn.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),ai.registerComponent("SeekBar",jn);var Hn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).handleMouseMove=Nt(Bt(y()(r),r.handleMouseMove),Ut),r.throttledHandleMouseSeek=Nt(Bt(y()(r),r.handleMouseSeek),Ut),r.handleMouseUpHandler_=function(e){return r.handleMouseUp(e)},r.handleMouseDownHandler_=function(e){return r.handleMouseDown(e)},r.enable(),r}S()(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},n.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var n=t.getChild("playProgressBar"),r=t.getChild("mouseTimeDisplay");if(n||r){var o=t.el(),l=et(o),d=tt(o,e).x;d=Dn(d,0,1),r&&r.update(l,d),n&&n.update(l,t.getProgress())}}},n.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},n.enabled=function(){return this.enabled_},n.disable=function(){if(this.children().forEach(function(e){return e.disable&&e.disable()}),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){var e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&fi(this.player_.play())}},n.enable=function(){this.children().forEach(function(e){return e.enable&&e.enable()}),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},n.removeListenersAddedOnMousedownAndTouchstart=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)},n.handleMouseDown=function(e){var t=this.el_.ownerDocument,n=this.getChild("seekBar");n&&n.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},n.handleMouseUp=function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()},t}(ai);Hn.prototype.options_={children:["seekBar"]},ai.registerComponent("ProgressControl",Hn);var qn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).on(t,["enterpictureinpicture","leavepictureinpicture"],function(e){return r.handlePictureInPictureChange(e)}),r.on(t,["disablepictureinpicturechanged","loadedmetadata"],function(e){return r.handlePictureInPictureEnabledChange(e)}),r.on(t,["loadedmetadata","audioonlymodechange","audiopostermodechange"],function(){"audio"===t.currentType().substring(0,5)||t.audioPosterMode()||t.audioOnlyMode()?(t.isInPictureInPicture()&&t.exitPictureInPicture(),r.hide()):r.show()}),r.disable(),r}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},n.handlePictureInPictureEnabledChange=function(){c.a.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()},n.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},n.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},t}(yn);qn.prototype.controlText_="Picture-in-Picture",ai.registerComponent("PictureInPictureToggle",qn);var Vn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).on(t,"fullscreenchange",function(e){return r.handleFullscreenChange(e)}),!1===c.a[t.fsApi_.fullscreenEnabled]&&r.disable(),r}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},n.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},n.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(yn);Vn.prototype.controlText_="Fullscreen",ai.registerComponent("FullscreenToggle",Vn);var Wn=function(e){function t(){return e.apply(this,arguments)||this}return S()(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return t.appendChild(e.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),t},t}(ai);ai.registerComponent("VolumeLevel",Wn);var zn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).update=Nt(Bt(y()(r),r.update),Ut),r}S()(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},n.update=function(e,t,n,content){if(!n){var r=Ze(this.el_),o=Ze(this.player_.el()),l=e.width*t;if(!o||!r)return;var d=e.left-o.left+l,c=e.width-l+(o.right-e.right),h=r.width/2;dr.width&&(h=r.width),this.el_.style.right="-"+h+"px"}this.write(content+"%")},n.write=function(content){je(this.el_,content)},n.updateVolume=function(e,t,n,r,o){var l=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",function(){l.update(e,t,n,r.toFixed(0)),o&&o()})},t}(ai);ai.registerComponent("VolumeLevelTooltip",zn);var Gn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).update=Nt(Bt(y()(r),r.update),Ut),r}S()(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},n.update=function(e,t,n){var r=this,o=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,n,o,function(){n?r.el_.style.bottom=e.height*t+"px":r.el_.style.left=e.width*t+"px"})},t}(ai);Gn.prototype.options_={children:["volumeLevelTooltip"]},ai.registerComponent("MouseVolumeLevelDisplay",Gn);var Kn=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).on("slideractive",function(e){return r.updateLastVolume_(e)}),r.on(t,"volumechange",function(e){return r.updateARIAAttributes(e)}),t.ready(function(){return r.updateARIAAttributes()}),r}S()(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},n.handleMouseDown=function(t){lt(t)&&e.prototype.handleMouseDown.call(this,t)},n.handleMouseMove=function(e){var t=this.getChild("mouseVolumeLevelDisplay");if(t){var n=this.el(),r=Ze(n),o=this.vertical(),l=tt(n,e);l=o?l.y:l.x,l=Dn(l,0,1),t.update(r,l,o)}lt(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},n.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},n.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},n.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},n.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},n.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},n.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},n.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",function(){0===e.player_.volume()&&e.player_.lastVolume_(t)})},t}(Mn);Kn.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},Ae||ve||Kn.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),Kn.prototype.playerEvent="volumechange",ai.registerComponent("VolumeBar",Kn);var Qn=function(e){function t(t,n){var r;return void 0===n&&(n={}),n.vertical=n.vertical||!1,(void 0===n.volumeBar||ue(n.volumeBar))&&(n.volumeBar=n.volumeBar||{},n.volumeBar.vertical=n.vertical),r=e.call(this,t,n)||this,function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})}(y()(r),t),r.throttledHandleMouseMove=Nt(Bt(y()(r),r.handleMouseMove),Ut),r.handleMouseUpHandler_=function(e){return r.handleMouseUp(e)},r.on("mousedown",function(e){return r.handleMouseDown(e)}),r.on("touchstart",function(e){return r.handleMouseDown(e)}),r.on("mousemove",function(e){return r.handleMouseMove(e)}),r.on(r.volumeBar,["focus","slideractive"],function(){r.volumeBar.addClass("vjs-slider-active"),r.addClass("vjs-slider-active"),r.trigger("slideractive")}),r.on(r.volumeBar,["blur","sliderinactive"],function(){r.volumeBar.removeClass("vjs-slider-active"),r.removeClass("vjs-slider-active"),r.trigger("sliderinactive")}),r}S()(t,e);var n=t.prototype;return n.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},n.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},n.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)},n.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(ai);Qn.prototype.options_={children:["volumeBar"]},ai.registerComponent("VolumeControl",Qn);var Xn=function(e){function t(t,n){var r;return r=e.call(this,t,n)||this,function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})}(y()(r),t),r.on(t,["loadstart","volumechange"],function(e){return r.update(e)}),r}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},n.handleClick=function(e){var t=this.player_.volume(),n=this.player_.lastVolume_();if(0===t){var r=n<.1?.1:n;this.player_.volume(r),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},n.update=function(e){this.updateIcon_(),this.updateControlText_()},n.updateIcon_=function(){var e=this.player_.volume(),t=3;Ae&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)We(this.el_,"vjs-vol-"+i);Ve(this.el_,"vjs-vol-"+t)},n.updateControlText_=function(){var text=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==text&&this.controlText(text)},t}(yn);Xn.prototype.controlText_="Mute",ai.registerComponent("MuteToggle",Xn);var Yn=function(e){function t(t,n){var r;return void 0===n&&(n={}),void 0!==n.inline?n.inline=n.inline:n.inline=!0,(void 0===n.volumeControl||ue(n.volumeControl))&&(n.volumeControl=n.volumeControl||{},n.volumeControl.vertical=!n.inline),(r=e.call(this,t,n)||this).handleKeyPressHandler_=function(e){return r.handleKeyPress(e)},r.on(t,["loadstart"],function(e){return r.volumePanelState_(e)}),r.on(r.muteToggle,"keyup",function(e){return r.handleKeyPress(e)}),r.on(r.volumeControl,"keyup",function(e){return r.handleVolumeControlKeyUp(e)}),r.on("keydown",function(e){return r.handleKeyPress(e)}),r.on("mouseover",function(e){return r.handleMouseOver(e)}),r.on("mouseout",function(e){return r.handleMouseOut(e)}),r.on(r.volumeControl,["slideractive"],r.sliderActive_),r.on(r.volumeControl,["sliderinactive"],r.sliderInactive_),r}S()(t,e);var n=t.prototype;return n.sliderActive_=function(){this.addClass("vjs-slider-active")},n.sliderInactive_=function(){this.removeClass("vjs-slider-active")},n.volumePanelState_=function(){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")},n.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},n.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},n.handleVolumeControlKeyUp=function(e){v.a.isEventKey(e,"Esc")&&this.muteToggle.focus()},n.handleMouseOver=function(e){this.addClass("vjs-hover"),Pt(c.a,"keyup",this.handleKeyPressHandler_)},n.handleMouseOut=function(e){this.removeClass("vjs-hover"),At(c.a,"keyup",this.handleKeyPressHandler_)},n.handleKeyPress=function(e){v.a.isEventKey(e,"Esc")&&this.handleMouseOut()},t}(ai);Yn.prototype.options_={children:["muteToggle","volumeControl"]},ai.registerComponent("VolumePanel",Yn);var $n=function(e){function t(t,n){var r;return r=e.call(this,t,n)||this,n&&(r.menuButton_=n.menuButton),r.focusedChild_=-1,r.on("keydown",function(e){return r.handleKeyDown(e)}),r.boundHandleBlur_=function(e){return r.handleBlur(e)},r.boundHandleTapClick_=function(e){return r.handleTapClick(e)},r}S()(t,e);var n=t.prototype;return n.addEventListenerForItem=function(component){component instanceof ai&&(this.on(component,"blur",this.boundHandleBlur_),this.on(component,["tap","click"],this.boundHandleTapClick_))},n.removeEventListenerForItem=function(component){component instanceof ai&&(this.off(component,"blur",this.boundHandleBlur_),this.off(component,["tap","click"],this.boundHandleTapClick_))},n.removeChild=function(component){"string"==typeof component&&(component=this.getChild(component)),this.removeEventListenerForItem(component),e.prototype.removeChild.call(this,component)},n.addItem=function(component){var e=this.addChild(component);e&&this.addEventListenerForItem(e)},n.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=Fe(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var n=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return n.appendChild(this.contentEl_),Pt(n,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),n},n.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},n.handleBlur=function(e){var t=e.relatedTarget||c.a.activeElement;if(!this.children().some(function(element){return element.el()===t})){var n=this.menuButton_;n&&n.buttonPressed_&&t!==n.el().firstChild&&n.unpressButton()}},n.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var n=t.filter(function(component){return component.el()===e.target})[0];if(!n)return;"CaptionSettingsMenuItem"!==n.name()&&this.menuButton_.focus()}},n.handleKeyDown=function(e){v.a.isEventKey(e,"Left")||v.a.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(v.a.isEventKey(e,"Right")||v.a.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},n.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},n.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},n.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())},t}(ai);ai.registerComponent("Menu",$n);var Jn=function(e){function t(t,n){var r;void 0===n&&(n={}),(r=e.call(this,t,n)||this).menuButton_=new yn(t,n),r.menuButton_.controlText(r.controlText_),r.menuButton_.el_.setAttribute("aria-haspopup","true");var o=yn.prototype.buildCSSClass();r.menuButton_.el_.className=r.buildCSSClass()+" "+o,r.menuButton_.removeClass("vjs-control"),r.addChild(r.menuButton_),r.update(),r.enabled_=!0;var l=function(e){return r.handleClick(e)};return r.handleMenuKeyUp_=function(e){return r.handleMenuKeyUp(e)},r.on(r.menuButton_,"tap",l),r.on(r.menuButton_,"click",l),r.on(r.menuButton_,"keydown",function(e){return r.handleKeyDown(e)}),r.on(r.menuButton_,"mouseenter",function(){r.addClass("vjs-hover"),r.menu.show(),Pt(c.a,"keyup",r.handleMenuKeyUp_)}),r.on("mouseleave",function(e){return r.handleMouseLeave(e)}),r.on("keydown",function(e){return r.handleSubmenuKeyDown(e)}),r}S()(t,e);var n=t.prototype;return n.update=function(){var 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"))},n.createMenu=function(){var menu=new $n(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var e=Fe("li",{className:"vjs-menu-title",textContent:Zt(this.options_.title),tabIndex:-1}),t=new ai(this.player_,{el:e});menu.addItem(t)}if(this.items=this.createItems(),this.items)for(var i=0;i-1&&"showing"===track.mode){n=!1;break}}n!==this.isSelected_&&this.selected(n)},n.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),n=!0,i=0,r=t.length;i-1&&"showing"===track.mode){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(nr);ai.registerComponent("OffTextTrackMenuItem",rr);var ar=function(e){function t(t,n){return void 0===n&&(n={}),n.tracks=t.textTracks(),e.call(this,t,n)||this}return S()(t,e),t.prototype.createItems=function(e,t){var label;void 0===e&&(e=[]),void 0===t&&(t=nr),this.label_&&(label=this.label_+" off"),e.push(new rr(this.player_,{kinds:this.kinds_,kind:this.kind_,label:label})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var i=0;i-1){var r=new t(this.player_,{track:track,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});r.addClass("vjs-"+track.kind+"-menu-item"),e.push(r)}}return e},t}(Zn);ai.registerComponent("TextTrackButton",ar);var sr=function(e){function t(t,n){var r,track=n.track,o=n.cue,l=t.currentTime();return n.selectable=!0,n.multiSelectable=!1,n.label=o.text,n.selected=o.startTime<=l&&l=0;i--){var track=e[i];if(track.kind===this.kind_)return track}},n.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Zt(this.kind_))},n.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},n.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i-1&&(r.label_="captions"),r.menuButton_.controlText(Zt(r.label_)),r}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},n.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},n.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new dr(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=e.prototype.createItems.call(this,t,pr)},t}(ar);fr.prototype.kinds_=["captions","subtitles"],fr.prototype.controlText_="Subtitles",ai.registerComponent("SubsCapsButton",fr);var mr=function(e){function t(t,n){var r,track=n.track,o=t.audioTracks();n.label=track.label||track.language||"Unknown",n.selected=track.enabled,(r=e.call(this,t,n)||this).track=track,r.addClass("vjs-"+track.kind+"-menu-item");var l=function(){for(var e=arguments.length,t=new Array(e),n=0;n=0;i--)t.push(new vr(this.player(),{rate:e[i]+"x"}));return t},n.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},n.handleClick=function(e){var t=this.player().playbackRate(),n=this.playbackRates(),r=(n.indexOf(t)+1)%n.length;this.player().playbackRate(n[r])},n.handlePlaybackRateschange=function(e){this.update()},n.playbackRates=function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]},n.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},n.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},n.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")},t}(Jn);_r.prototype.controlText_="Playback Rate",ai.registerComponent("PlaybackRateMenuButton",_r);var yr=function(e){function t(){return e.apply(this,arguments)||this}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},n.createEl=function(t,n,r){return void 0===t&&(t="div"),void 0===n&&(n={}),void 0===r&&(r={}),n.className||(n.className=this.buildCSSClass()),e.prototype.createEl.call(this,t,n,r)},t}(ai);ai.registerComponent("Spacer",yr);var Tr=function(e){function t(){return e.apply(this,arguments)||this}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:" "})},t}(yr);ai.registerComponent("CustomControlSpacer",Tr);var Sr=function(e){function t(){return e.apply(this,arguments)||this}return S()(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(ai);Sr.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in c.a&&Sr.prototype.options_.children.splice(Sr.prototype.options_.children.length-1,0,"pictureInPictureToggle"),ai.registerComponent("ControlBar",Sr);var kr=function(e){function t(t,n){var r;return(r=e.call(this,t,n)||this).on(t,"error",function(e){return r.open(e)}),r}S()(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},n.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(yi);kr.prototype.options_=f()({},yi.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),ai.registerComponent("ErrorDisplay",kr);var Cr="vjs-text-track-settings",Er=["#000","Black"],wr=["#00F","Blue"],Ir=["#0FF","Cyan"],xr=["#0F0","Green"],Pr=["#F0F","Magenta"],Ar=["#F00","Red"],Lr=["#FFF","White"],Or=["#FF0","Yellow"],Dr=["1","Opaque"],Mr=["0.5","Semi-Transparent"],Rr=["0","Transparent"],Ur={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Er,Lr,Ar,xr,wr,Or,Pr,Ir]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Dr,Mr,Rr]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Lr,Er,Ar,xr,wr,Or,Pr,Ir]},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:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Dr,Mr]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[Rr,Mr,Dr]}};function Br(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}Ur.windowColor.options=Ur.backgroundColor.options;var Nr=function(e){function t(t,n){var r;return n.temporary=!1,(r=e.call(this,t,n)||this).updateDisplay=r.updateDisplay.bind(y()(r)),r.fill(),r.hasBeenOpened_=r.hasBeenFilled_=!0,r.endDialog=Fe("p",{className:"vjs-control-text",textContent:r.localize("End of dialog window.")}),r.el().appendChild(r.endDialog),r.setDefaults(),void 0===n.persistTextTrackSettings&&(r.options_.persistTextTrackSettings=r.options_.playerOptions.persistTextTrackSettings),r.on(r.$(".vjs-done-button"),"click",function(){r.saveSettings(),r.close()}),r.on(r.$(".vjs-default-button"),"click",function(){r.setDefaults(),r.updateDisplay()}),se(Ur,function(e){r.on(r.$(e.selector),"change",r.updateDisplay)}),r.options_.persistTextTrackSettings&&r.restoreSettings(),r}S()(t,e);var n=t.prototype;return n.dispose=function(){this.endDialog=null,e.prototype.dispose.call(this)},n.createElSelect_=function(e,t,n){var r=this;void 0===t&&(t=""),void 0===n&&(n="label");var o=Ur[e],l=o.id.replace("%s",this.id_),d=[t,l].join(" ").trim();return["<"+n+' id="'+l+'" class="'+("label"===n?"vjs-label":"")+'">',this.localize(o.label),"",'").join("")},n.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['
','',this.localize("Text"),"",this.createElSelect_("color",e),'',this.createElSelect_("textOpacity",e),"","
"].join("")},n.createElBgColor_=function(){var e="captions-background-"+this.id_;return['
','',this.localize("Background"),"",this.createElSelect_("backgroundColor",e),'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")},n.createElWinColor_=function(){var e="captions-window-"+this.id_;return['
','',this.localize("Window"),"",this.createElSelect_("windowColor",e),'',this.createElSelect_("windowOpacity",e),"","
"].join("")},n.createElColors_=function(){return Fe("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},n.createElFont_=function(){return Fe("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})},n.createElControls_=function(){var e=this.localize("restore all settings to the default values");return Fe("div",{className:"vjs-track-settings-controls",innerHTML:['",'"].join("")})},n.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},n.label=function(){return this.localize("Caption Settings Dialog")},n.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},n.buildCSSClass=function(){return e.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},n.getValues=function(){var object,e,t,n=this;return e=function(e,t,r){var o,l,d=(o=n.$(t.selector),l=t.parser,Br(o.options[o.options.selectedIndex].value,l));return void 0!==d&&(e[r]=d),e},void 0===(t={})&&(t=0),ae(object=Ur).reduce(function(t,n){return e(t,object[n],n)},t)},n.setValues=function(e){var t=this;se(Ur,function(n,r){!function(e,t,n){if(t)for(var i=0;ithis.options_.liveTolerance;this.timeupdateSeen_&&r!==1/0||(d=!1),d!==this.behindLiveEdge_&&(this.behindLiveEdge_=d,this.trigger("liveedgechange"))}},n.handleDurationchange=function(){this.toggleTracking()},n.toggleTracking=function(){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())},n.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Ut),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_)))},n.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)},n.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()},n.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},n.reset_=function(){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_)},n.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},n.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},n.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},n.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},n.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()},n.isLive=function(){return this.isTracking()},n.atLiveEdge=function(){return!this.behindLiveEdge()},n.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},n.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},n.behindLiveEdge=function(){return this.behindLiveEdge_},n.isTracking=function(){return"number"==typeof this.trackingInterval_},n.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},n.dispose=function(){this.off(c.a,"visibilitychange",this.handleVisibilityChange_),this.stopTracking(),e.prototype.dispose.call(this)},t}(ai);ai.registerComponent("LiveTracker",Hr);var qr,Vr=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var n=e.$$("source"),r=[],o="";if(!n.length)return!1;for(var i=0;i=2&&o.push("loadeddata"),e.readyState>=3&&o.push("canplay"),e.readyState>=4&&o.push("canplaythrough"),this.ready(function(){o.forEach(function(e){this.trigger(e)},this)})}},n.setScrubbing=function(e){this.isScrubbing_=e},n.scrubbing=function(){return this.isScrubbing_},n.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&Le?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){ie(e,"Video is not ready. (Video.js)")}},n.duration=function(){var e=this;if(this.el_.duration===1/0&&ve&&Se&&0===this.el_.currentTime){return this.on("timeupdate",function t(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))}),NaN}return this.el_.duration||NaN},n.width=function(){return this.el_.offsetWidth},n.height=function(){return this.el_.offsetHeight},n.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},n=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",n),this.on("dispose",function(){e.off("webkitbeginfullscreen",n),e.off("webkitendfullscreen",t)})}},n.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var e=l.a.navigator&&l.a.navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},n.enterFullScreen=function(){var video=this.el_;if(video.paused&&video.networkState<=video.HAVE_METADATA)fi(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)}},n.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},n.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},n.requestVideoFrameCallback=function(t){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(t):e.prototype.requestVideoFrameCallback.call(this,t)},n.cancelVideoFrameCallback=function(t){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(t):e.prototype.cancelVideoFrameCallback.call(this,t)},n.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},n.reset=function(){t.resetMediaElement(this.el_)},n.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},n.setControls=function(e){this.el_.controls=!!e},n.addTextTrack=function(t,label,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,label,n):e.prototype.addTextTrack.call(this,t,label,n)},n.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return e.prototype.createRemoteTextTrack.call(this,t);var n=c.a.createElement("track");return t.kind&&(n.kind=t.kind),t.label&&(n.label=t.label),(t.language||t.srclang)&&(n.srclang=t.language||t.srclang),t.default&&(n.default=t.default),t.id&&(n.id=t.id),t.src&&(n.src=t.src),n},n.addRemoteTextTrack=function(t,n){var r=e.prototype.addRemoteTextTrack.call(this,t,n);return this.featuresNativeTextTracks&&this.el().appendChild(r),r},n.removeRemoteTextTrack=function(track){if(e.prototype.removeRemoteTextTrack.call(this,track),this.featuresNativeTextTracks)for(var t=this.$$("track"),i=t.length;i--;)track!==t[i]&&track!==t[i].track||this.el().removeChild(t[i])},n.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),l.a.performance&&"function"==typeof l.a.performance.now?e.creationTime=l.a.performance.now():l.a.performance&&l.a.performance.timing&&"number"==typeof l.a.performance.timing.navigationStart&&(e.creationTime=l.a.Date.now()-l.a.performance.timing.navigationStart),e},t}(Qi);Xr(Yr,"TEST_VID",function(){if(Re()){var video=c.a.createElement("video"),track=c.a.createElement("track");return track.kind="captions",track.srclang="en",track.label="English",video.appendChild(track),video}}),Yr.isSupported=function(){try{Yr.TEST_VID.volume=.5}catch(e){return!1}return!(!Yr.TEST_VID||!Yr.TEST_VID.canPlayType)},Yr.canPlayType=function(e){return Yr.TEST_VID.canPlayType(e)},Yr.canPlaySource=function(e,t){return Yr.canPlayType(e.type)},Yr.canControlVolume=function(){try{var e=Yr.TEST_VID.volume;Yr.TEST_VID.volume=e/2+.1;var t=e!==Yr.TEST_VID.volume;return t&&Ae?(l.a.setTimeout(function(){Yr&&Yr.prototype&&(Yr.prototype.featuresVolumeControl=e!==Yr.TEST_VID.volume)}),!1):t}catch(e){return!1}},Yr.canMuteVolume=function(){try{var e=Yr.TEST_VID.muted;return Yr.TEST_VID.muted=!e,Yr.TEST_VID.muted?Xe(Yr.TEST_VID,"muted","muted"):Ye(Yr.TEST_VID,"muted"),e!==Yr.TEST_VID.muted}catch(e){return!1}},Yr.canControlPlaybackRate=function(){if(ve&&Se&&ke<58)return!1;try{var e=Yr.TEST_VID.playbackRate;return Yr.TEST_VID.playbackRate=e/2+.1,e!==Yr.TEST_VID.playbackRate}catch(e){return!1}},Yr.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(c.a.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(c.a.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(c.a.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(c.a.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},Yr.supportsNativeTextTracks=function(){return Le||Ae&&Se},Yr.supportsNativeVideoTracks=function(){return!(!Yr.TEST_VID||!Yr.TEST_VID.videoTracks)},Yr.supportsNativeAudioTracks=function(){return!(!Yr.TEST_VID||!Yr.TEST_VID.audioTracks)},Yr.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function(e){var t=e[0],n=e[1];Xr(Yr.prototype,t,function(){return Yr[n]()},!0)}),Yr.prototype.featuresVolumeControl=Yr.canControlVolume(),Yr.prototype.movingMediaElementInDOM=!Ae,Yr.prototype.featuresFullscreenResize=!0,Yr.prototype.featuresProgressEvents=!0,Yr.prototype.featuresTimeupdateEvents=!0,Yr.prototype.featuresVideoFrameCallback=!(!Yr.TEST_VID||!Yr.TEST_VID.requestVideoFrameCallback),Yr.patchCanPlayType=function(){_e>=4&&!Te&&!Se&&(qr=Yr.TEST_VID&&Yr.TEST_VID.constructor.prototype.canPlayType,Yr.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":qr.call(this,e)})},Yr.unpatchCanPlayType=function(){var e=Yr.TEST_VID.constructor.prototype.canPlayType;return qr&&(Yr.TEST_VID.constructor.prototype.canPlayType=qr),e},Yr.patchCanPlayType(),Yr.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},Yr.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){Yr.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){Yr.prototype["set"+Zt(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){Yr.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(e){Yr.prototype["set"+Zt(e)]=function(t){this.el_[e]=t}}),["pause","load","play"].forEach(function(e){Yr.prototype[e]=function(){return this.el_[e]()}}),Qi.withSourceHandlers(Yr),Yr.nativeSourceHandler={},Yr.nativeSourceHandler.canPlayType=function(e){try{return Yr.TEST_VID.canPlayType(e)}catch(e){return""}},Yr.nativeSourceHandler.canHandleSource=function(source,e){if(source.type)return Yr.nativeSourceHandler.canPlayType(source.type);if(source.src){var t=Ui(source.src);return Yr.nativeSourceHandler.canPlayType("video/"+t)}return""},Yr.nativeSourceHandler.handleSource=function(source,e,t){e.setSrc(source.src)},Yr.nativeSourceHandler.dispose=function(){},Yr.registerSourceHandler(Yr.nativeSourceHandler),Qi.registerTech("Html5",Yr);var $r=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Jr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Zr=["tiny","xsmall","small","medium","large","xlarge","huge"],ea={};Zr.forEach(function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;ea[e]="vjs-layout-"+t});var ta={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},ia=function(e){function t(n,r,o){var l;if(n.id=n.id||r.id||"vjs_video_"+St(),(r=oe(t.getTagSettings(n),r)).initChildren=!1,r.createEl=!1,r.evented=!1,r.reportTouchActivity=!1,!r.language)if("function"==typeof n.closest){var d=n.closest("[lang]");d&&d.getAttribute&&(r.language=d.getAttribute("lang"))}else for(var element=n;element&&1===element.nodeType;){if(Ke(element).hasOwnProperty("lang")){r.language=element.getAttribute("lang");break}element=element.parentNode}if((l=e.call(this,null,r,o)||this).boundDocumentFullscreenChange_=function(e){return l.documentFullscreenChange_(e)},l.boundFullWindowOnEscKey_=function(e){return l.fullWindowOnEscKey(e)},l.boundUpdateStyleEl_=function(e){return l.updateStyleEl_(e)},l.boundApplyInitTime_=function(e){return l.applyInitTime_(e)},l.boundUpdateCurrentBreakpoint_=function(e){return l.updateCurrentBreakpoint_(e)},l.boundHandleTechClick_=function(e){return l.handleTechClick_(e)},l.boundHandleTechDoubleClick_=function(e){return l.handleTechDoubleClick_(e)},l.boundHandleTechTouchStart_=function(e){return l.handleTechTouchStart_(e)},l.boundHandleTechTouchMove_=function(e){return l.handleTechTouchMove_(e)},l.boundHandleTechTouchEnd_=function(e){return l.handleTechTouchEnd_(e)},l.boundHandleTechTap_=function(e){return l.handleTechTap_(e)},l.isFullscreen_=!1,l.log=ne(l.id_),l.fsApi_=$,l.isPosterFromTech_=!1,l.queuedCallbacks_=[],l.isReady_=!1,l.hasStarted_=!1,l.userActive_=!1,l.debugEnabled_=!1,l.audioOnlyMode_=!1,l.audioPosterMode_=!1,l.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!l.options_||!l.options_.techOrder||!l.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(l.tag=n,l.tagAttributes=n&&Ke(n),l.language(l.options_.language),r.languages){var h={};Object.getOwnPropertyNames(r.languages).forEach(function(e){h[e.toLowerCase()]=r.languages[e]}),l.languages_=h}else l.languages_=t.prototype.options_.languages;l.resetCache_(),l.poster_=r.poster||"",l.controls_=!!r.controls,n.controls=!1,n.removeAttribute("controls"),l.changingSrc_=!1,l.playCallbacks_=[],l.playTerminatedQueue_=[],n.hasAttribute("autoplay")?l.autoplay(!0):l.autoplay(l.options_.autoplay),r.plugins&&Object.keys(r.plugins).forEach(function(e){if("function"!=typeof l[e])throw new Error('plugin "'+e+'" does not exist')}),l.scrubbing_=!1,l.el_=l.createEl(),Xt(y()(l),{eventBusKey:"el_"}),l.fsApi_.requestFullscreen&&(Pt(c.a,l.fsApi_.fullscreenchange,l.boundDocumentFullscreenChange_),l.on(l.fsApi_.fullscreenchange,l.boundDocumentFullscreenChange_)),l.fluid_&&l.on(["playerreset","resize"],l.boundUpdateStyleEl_);var f=ei(l.options_);r.plugins&&Object.keys(r.plugins).forEach(function(e){l[e](r.plugins[e])}),r.debug&&l.debug(!0),l.options_.playerOptions=f,l.middleware_=[],l.playbackRates(r.playbackRates),l.initChildren(),l.isAudio("audio"===n.nodeName.toLowerCase()),l.controls()?l.addClass("vjs-controls-enabled"):l.addClass("vjs-controls-disabled"),l.el_.setAttribute("role","region"),l.isAudio()?l.el_.setAttribute("aria-label",l.localize("Audio Player")):l.el_.setAttribute("aria-label",l.localize("Video Player")),l.isAudio()&&l.addClass("vjs-audio"),l.flexNotSupported_()&&l.addClass("vjs-no-flex"),Ie&&l.addClass("vjs-touch-enabled"),Ae||l.addClass("vjs-workinghover"),t.players[l.id_]=y()(l);var m=K.split(".")[0];return l.addClass("vjs-v"+m),l.userActive(!0),l.reportUserActivity(),l.one("play",function(e){return l.listenForUserActivity_(e)}),l.on("stageclick",function(e){return l.handleStageClick_(e)}),l.on("keydown",function(e){return l.handleKeyDown(e)}),l.on("languagechange",function(e){return l.handleLanguagechange(e)}),l.breakpoints(l.options_.breakpoints),l.responsive(l.options_.responsive),l.on("ready",function(){l.audioPosterMode(l.options_.audioPosterMode),l.audioOnlyMode(l.options_.audioOnlyMode)}),l}S()(t,e);var n=t.prototype;return n.dispose=function(){var n=this;this.trigger("dispose"),this.off("dispose"),At(c.a,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),At(c.a,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),t.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),Yi[this.id()]=null,Ki.names.forEach(function(e){var t=Ki[e],r=n[t.getterName]();r&&r.off&&r.off()}),e.prototype.dispose.call(this,{restoreEl:this.options_.restoreEl})},n.createEl=function(){var t,n=this.tag,r=this.playerElIngest_=n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player"),o="video-js"===this.tag.tagName.toLowerCase();r?t=this.el_=n.parentNode:o||(t=this.el_=e.prototype.createEl.call(this,"div"));var d=Ke(n);if(o){for(t=this.el_=n,n=this.tag=c.a.createElement("video");t.children.length;)n.appendChild(t.firstChild);qe(t,"video-js")||Ve(t,"video-js"),t.appendChild(n),r=this.playerElIngest_=t,Object.keys(t).forEach(function(e){try{n[e]=t[e]}catch(e){}})}if(n.setAttribute("tabindex","-1"),d.tabindex="-1",(Ce||Se&&we)&&(n.setAttribute("role","application"),d.role="application"),n.removeAttribute("width"),n.removeAttribute("height"),"width"in d&&delete d.width,"height"in d&&delete d.height,Object.getOwnPropertyNames(d).forEach(function(e){o&&"class"===e||t.setAttribute(e,d[e]),o&&n.setAttribute(e,d[e])}),n.playerId=n.id,n.id+="_html5_api",n.className="vjs-tech",n.player=t.player=this,this.addClass("vjs-paused"),!0!==l.a.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=yt("vjs-styles-dimensions");var h=ct(".vjs-styles-defaults"),head=ct("head");head.insertBefore(this.styleEl_,h?h.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);for(var f=n.getElementsByTagName("a"),i=0;i0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),o=r[1]/r[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/o:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*o,n=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(n),Tt(this.styleEl_,"\n ."+n+" {\n width: "+e+"px;\n height: "+t+"px;\n }\n\n ."+n+".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: "+100*o+"%;\n }\n ")}else{var d="number"==typeof this.width_?this.width_:this.options_.width,c="number"==typeof this.height_?this.height_:this.options_.height,h=this.tech_&&this.tech_.el();h&&(d>=0&&(h.width=d),c>=0&&(h.height=c))}},n.loadTech_=function(e,source){var t=this;this.tech_&&this.unloadTech_();var n=Zt(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(Qi.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var o=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(o=!1);var l={source:source,autoplay:o,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset,Promise:this.options_.Promise};Ki.names.forEach(function(e){var n=Ki[e];l[n.getterName]=t[n.privateName]}),oe(l,this.options_[n]),oe(l,this.options_[r]),oe(l,this.options_[e.toLowerCase()]),this.tag&&(l.tag=this.tag),source&&source.src===this.cache_.src&&this.cache_.currentTime>0&&(l.startTime=this.cache_.currentTime);var d=Qi.getTech(e);if(!d)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new d(l),this.tech_.ready(Bt(this,this.handleTechReady_),!0),vi(this.textTracksJson_||[],this.tech_),$r.forEach(function(e){t.on(t.tech_,e,function(n){return t["handleTech"+Zt(e)+"_"](n)})}),Object.keys(Jr).forEach(function(e){t.on(t.tech_,e,function(n){0===t.tech_.playbackRate()&&t.tech_.seeking()?t.queuedCallbacks_.push({callback:t["handleTech"+Jr[e]+"_"].bind(t),event:n}):t["handleTech"+Jr[e]+"_"](n)})}),this.on(this.tech_,"loadstart",function(e){return t.handleTechLoadStart_(e)}),this.on(this.tech_,"sourceset",function(e){return t.handleTechSourceset_(e)}),this.on(this.tech_,"waiting",function(e){return t.handleTechWaiting_(e)}),this.on(this.tech_,"ended",function(e){return t.handleTechEnded_(e)}),this.on(this.tech_,"seeking",function(e){return t.handleTechSeeking_(e)}),this.on(this.tech_,"play",function(e){return t.handleTechPlay_(e)}),this.on(this.tech_,"firstplay",function(e){return t.handleTechFirstPlay_(e)}),this.on(this.tech_,"pause",function(e){return t.handleTechPause_(e)}),this.on(this.tech_,"durationchange",function(e){return t.handleTechDurationChange_(e)}),this.on(this.tech_,"fullscreenchange",function(e,data){return t.handleTechFullscreenChange_(e,data)}),this.on(this.tech_,"fullscreenerror",function(e,n){return t.handleTechFullscreenError_(e,n)}),this.on(this.tech_,"enterpictureinpicture",function(e){return t.handleTechEnterPictureInPicture_(e)}),this.on(this.tech_,"leavepictureinpicture",function(e){return t.handleTechLeavePictureInPicture_(e)}),this.on(this.tech_,"error",function(e){return t.handleTechError_(e)}),this.on(this.tech_,"posterchange",function(e){return t.handleTechPosterChange_(e)}),this.on(this.tech_,"textdata",function(e){return t.handleTechTextData_(e)}),this.on(this.tech_,"ratechange",function(e){return t.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"===n&&this.tag||He(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},n.unloadTech_=function(){var e=this;Ki.names.forEach(function(t){var n=Ki[t];e[n.privateName]=e[n.getterName]()}),this.textTracksJson_=gi(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},n.tech=function(e){return void 0===e&&ie.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_},n.addTechControlsListeners_=function(){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_)},n.removeTechControlsListeners_=function(){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_)},n.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},n.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())},n.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"==typeof e){var n,r=function(){var e=t.muted();t.muted(!0);var n=function(){t.muted(e)};t.playTerminatedQueue_.push(n);var r=t.play();if(pi(r))return r.catch(function(e){throw n(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};if("any"!==e||this.muted()?n="muted"!==e||this.muted()?this.play():r():pi(n=this.play())&&(n=n.catch(r)),pi(n))return n.then(function(){t.trigger({type:"autoplay-success",autoplay:e})}).catch(function(){t.trigger({type:"autoplay-failure",autoplay:e})})}},n.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,n="";"string"!=typeof t&&(t=e.src,n=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!n&&(n=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var n=e.cache_.sources.filter(function(s){return s.src===t});if(n.length)return n[0].type;for(var r=e.$$("source"),i=0;i0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach(function(e){return e.callback(e.event)}),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},n.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",function n(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",n))})},n.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},n.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},n.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},n.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},n.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},n.handleTechFirstPlay_=function(){this.options_.starttime&&(ie.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},n.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},n.handleTechEnded_=function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},n.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},n.handleTechClick_=function(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?fi(this.play()):this.pause()))},n.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(t){return t.contains(e.target)})||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},n.handleTechTap_=function(){this.userActive(!this.userActive())},n.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},n.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},n.handleTechTouchEnd_=function(e){e.cancelable&&e.preventDefault()},n.handleStageClick_=function(){this.reportUserActivity()},n.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},n.documentFullscreenChange_=function(e){var t=e.target.player;if(!t||t===this){var n=this.el(),r=c.a[this.fsApi_.fullscreenElement]===n;!r&&n.matches?r=n.matches(":"+this.fsApi_.fullscreen):!r&&n.msMatchesSelector&&(r=n.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(r)}},n.handleTechFullscreenChange_=function(e,data){var t=this;data&&(data.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",function(){t.removeClass("vjs-ios-native-fs")})),this.isFullscreen(data.isFullscreen))},n.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},n.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},n.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},n.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},n.handleTechError_=function(){var e=this.tech_.error();this.error(e)},n.handleTechTextData_=function(){var data=null;arguments.length>1&&(data=arguments[1]),this.trigger("textdata",data)},n.getCache=function(){return this.cache_},n.resetCache_=function(){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}},n.techCall_=function(e,t){this.ready(function(){if(e in tn)return function(e,t,n,r){return t[n](e.reduce(rn(n),r))}(this.middleware_,this.tech_,e,t);if(e in nn)return Zi(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw ie(e),e}},!0)},n.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in en)return function(e,t,n){return e.reduceRight(rn(n),t[n]())}(this.middleware_,this.tech_,e);if(e in nn)return Zi(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw ie("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw ie("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw ie(t),t}}},n.play=function(){var e=this,t=this.options_.Promise||l.a.Promise;return t?new t(function(t){e.play_(t)}):this.play_()},n.play_=function(e){var t=this;void 0===e&&(e=fi),this.playCallbacks_.push(e);var n=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),r=Boolean(Le||Ae);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!n)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(!n&&r&&this.load());var o=this.techGet_("play");r&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===o?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(o)},n.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(q){q()})},n.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(t){t(e)})},n.pause=function(){this.techCall_("pause")},n.paused=function(){return!1!==this.techGet_("paused")},n.played=function(){return this.techGet_("played")||ui(0,0)},n.scrubbing=function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},n.currentTime=function(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},n.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},n.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))},n.remainingTime=function(){return this.duration()-this.currentTime()},n.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},n.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=ui(0,0)),e},n.bufferedPercent=function(){return di(this.buffered(),this.duration())},n.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),n=e.end(e.length-1);return n>t&&(n=t),n},n.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},n.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},n.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},n.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},n.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},n.isFullscreen=function(e){if(void 0!==e){var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_},n.requestFullscreen=function(e){var t=this.options_.Promise||l.a.Promise;if(t){var n=this;return new t(function(t,r){function o(){n.off("fullscreenerror",d),n.off("fullscreenchange",l)}function l(){o(),t()}function d(e,t){o(),r(t)}n.one("fullscreenchange",l),n.one("fullscreenerror",d);var c=n.requestFullscreenHelper_(e);c&&(c.then(o,o),c.then(t,r))})}return this.requestFullscreenHelper_()},n.requestFullscreenHelper_=function(e){var t,n=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var r=this.el_[this.fsApi_.requestFullscreen](t);return r&&r.then(function(){return n.isFullscreen(!0)},function(){return n.isFullscreen(!1)}),r}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()},n.exitFullscreen=function(){var e=this.options_.Promise||l.a.Promise;if(e){var t=this;return new e(function(e,n){function r(){t.off("fullscreenerror",l),t.off("fullscreenchange",o)}function o(){r(),e()}function l(e,t){r(),n(t)}t.one("fullscreenchange",o),t.one("fullscreenerror",l);var d=t.exitFullscreenHelper_();d&&(d.then(r,r),d.then(e,n))})}return this.exitFullscreenHelper_()},n.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var t=c.a[this.fsApi_.exitFullscreen]();return t&&fi(t.then(function(){return e.isFullscreen(!1)})),t}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()},n.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=c.a.documentElement.style.overflow,Pt(c.a,"keydown",this.boundFullWindowOnEscKey_),c.a.documentElement.style.overflow="hidden",Ve(c.a.body,"vjs-full-window"),this.trigger("enterFullWindow")},n.fullWindowOnEscKey=function(e){v.a.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},n.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,At(c.a,"keydown",this.boundFullWindowOnEscKey_),c.a.documentElement.style.overflow=this.docOrigOverflow,We(c.a.body,"vjs-full-window"),this.trigger("exitFullWindow")},n.disablePictureInPicture=function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},n.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},n.requestPictureInPicture=function(){if("pictureInPictureEnabled"in c.a&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")},n.exitPictureInPicture=function(){if("pictureInPictureEnabled"in c.a)return c.a.exitPictureInPicture()},n.handleKeyDown=function(e){var t=this.options_.userActions;if(t&&t.hotkeys){(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}},n.handleHotkeys=function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},n=t.fullscreenKey,r=void 0===n?function(e){return v.a.isEventKey(e,"f")}:n,o=t.muteKey,l=void 0===o?function(e){return v.a.isEventKey(e,"m")}:o,d=t.playPauseKey,h=void 0===d?function(e){return v.a.isEventKey(e,"k")||v.a.isEventKey(e,"Space")}:d;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();var f=ai.getComponent("FullscreenToggle");!1!==c.a[this.fsApi_.fullscreenEnabled]&&f.prototype.handleClick.call(this,e)}else if(l.call(this,e)){e.preventDefault(),e.stopPropagation(),ai.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(h.call(this,e)){e.preventDefault(),e.stopPropagation(),ai.getComponent("PlayToggle").prototype.handleClick.call(this,e)}},n.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i1?t.handleSrc_(n.slice(1)):(t.changingSrc_=!1,t.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),void t.triggerReady());l=o,d=t.tech_,l.forEach(function(e){return e.setTech&&e.setTech(d)})}),this.options_.retryOnError&&n.length>1){var r=function(){t.error(null),t.handleSrc_(n.slice(1),!0)},o=function(){t.off("error",r)};this.one("error",r),this.one("playing",o),this.resetRetryOnError_=function(){t.off("error",r),t.off("playing",o)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)},n.src=function(source){return this.handleSrc_(source,!1)},n.src_=function(source){var e,t,n=this,r=this.selectSource([source]);return!r||(e=r.tech,t=this.techName_,Zt(e)!==Zt(t)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready(function(){n.changingSrc_=!1}),!1):(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",source):this.techCall_("src",source.src),this.changingSrc_=!1},!0),!1))},n.load=function(){this.techCall_("load")},n.reset=function(){var e=this,t=this.options_.Promise||l.a.Promise;this.paused()||!t?this.doReset_():fi(this.play().then(function(){return e.doReset_()}))},n.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),Ht(this)&&this.trigger("playerreset")},n.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},n.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar||{},t=e.durationDisplay,n=e.remainingTimeDisplay;t&&t.updateContent(),n&&n.updateContent()},n.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},n.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},n.currentSources=function(){var source=this.currentSource(),e=[];return 0!==Object.keys(source).length&&e.push(source),this.cache_.sources||e},n.currentSource=function(){return this.cache_.source||{}},n.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},n.currentType=function(){return this.currentSource()&&this.currentSource().type||""},n.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},n.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},n.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},n.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},n.poster=function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},n.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},n.controls=function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},n.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},n.error=function(e){var t=this;if(void 0===e)return this.error_||null;if(X("beforeerror").forEach(function(n){var r=n(t,e);le(r)&&!Array.isArray(r)||"string"==typeof r||"number"==typeof r||null===r?e=r:t.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&e&&4===e.code){var n=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],n),void this.one("loadstart",function(){this.off(["click","touchstart"],n)})}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new ci(e),this.addClass("vjs-error"),ie.error("(CODE:"+this.error_.code+" "+ci.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),X("error").forEach(function(e){return e(t,t.error_)})},n.reportUserActivity=function(e){this.userActivity_=!0},n.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},n.listenForUserActivity_=function(){var e,t,n,r=Bt(this,this.reportUserActivity),o=function(t){r(),this.clearInterval(e)};this.on("mousedown",function(){r(),this.clearInterval(e),e=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===t&&e.screenY===n||(t=e.screenX,n=e.screenY,r())}),this.on("mouseup",o),this.on("mouseleave",o);var l,d=this.getChild("controlBar");!d||Ae||ve||(d.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),d.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r),this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(l);var e=this.options_.inactivityTimeout;e<=0||(l=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e))}},250)},n.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},n.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},n.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},n.enableAudioOnlyUI_=function(){var e=this;this.addClass("vjs-audio-only-mode");var t=this.children(),n=this.getChild("ControlBar"),r=n&&n.currentHeight();t.forEach(function(t){t!==n&&t.el_&&!t.hasClass("vjs-hidden")&&(t.hide(),e.audioOnlyCache_.hiddenChildren.push(t))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(r),this.trigger("audioonlymodechange")},n.disableAudioOnlyUI_=function(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(function(e){return e.show()}),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")},n.audioOnlyMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;this.audioOnlyMode_=e;var n=this.options_.Promise||l.a.Promise;if(n){if(e){var r=[];return this.isInPictureInPicture()&&r.push(this.exitPictureInPicture()),this.isFullscreen()&&r.push(this.exitFullscreen()),this.audioPosterMode()&&r.push(this.audioPosterMode(!1)),n.all(r).then(function(){return t.enableAudioOnlyUI_()})}return n.resolve().then(function(){return t.disableAudioOnlyUI_()})}e?(this.isInPictureInPicture()&&this.exitPictureInPicture(),this.isFullscreen()&&this.exitFullscreen(),this.enableAudioOnlyUI_()):this.disableAudioOnlyUI_()},n.enablePosterModeUI_=function(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},n.disablePosterModeUI_=function(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},n.audioPosterMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioPosterMode_)return this.audioPosterMode_;this.audioPosterMode_=e;var n=this.options_.Promise||l.a.Promise;return n?e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(function(){t.enablePosterModeUI_()}):n.resolve().then(function(){t.enablePosterModeUI_()}):n.resolve().then(function(){t.disablePosterModeUI_()}):e?(this.audioOnlyMode()&&this.audioOnlyMode(!1),void this.enablePosterModeUI_()):void this.disablePosterModeUI_()},n.addTextTrack=function(e,label,t){if(this.tech_)return this.tech_.addTextTrack(e,label,t)},n.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},n.removeRemoteTextTrack=function(e){void 0===e&&(e={});var track=e.track;if(track||(track=e),this.tech_)return this.tech_.removeRemoteTextTrack(track)},n.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},n.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},n.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},n.language=function(code){if(void 0===code)return this.language_;this.language_!==String(code).toLowerCase()&&(this.language_=String(code).toLowerCase(),Ht(this)&&this.trigger("languagechange"))},n.languages=function(){return ei(t.prototype.options_.languages,this.languages_)},n.toJSON=function(){var e=ei(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i"):function(){}},ya=1/30,Ta=.1,ba=function(e,t){var i,n=[];if(e&&e.length)for(i=0;i=time})},ka=function(e,time){return ba(e,function(e){return e-ya>=time})},Ca=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i "+e.end(i));return t.join(", ")},Ea=function(e){for(var t=[],i=0;ir||(time+=t>n&&t<=r?r-t:r-n)}return time},xa=ma.createTimeRange,Pa=function(e,t){if(!t.preload)return t.duration;var n=0;return(t.parts||[]).forEach(function(p){n+=p.duration}),(t.preloadHints||[]).forEach(function(p){"PART"===p.type&&(n+=e.partTargetDuration)}),n},Aa=function(e){return(e.segments||[]).reduce(function(e,t,n){return t.parts?t.parts.forEach(function(r,o){e.push({duration:r.duration,segmentIndex:n,partIndex:o,part:r,segment:t})}):e.push({duration:t.duration,segmentIndex:n,partIndex:null,segment:t,part:null}),e},[])},La=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},Oa=function(e){var t=e.preloadSegment;if(t){var n=t.parts,r=(t.preloadHints||[]).reduce(function(e,t){return e+("PART"===t.type?1:0)},0);return r+=n&&n.length?n.length:0}},Da=function(e,t){if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;var n=La(t).length>0;return n&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:n&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},Ma=function(e,t,n){if(void 0===t&&(t=e.mediaSequence+e.segments.length),to){var d=[o,r];r=d[0],o=d[1]}if(r<0){for(var i=r;iDate.now()},Fa=function(e){return e.excludeUntil&&e.excludeUntil===1/0},ja=function(e){var t=Na(e);return!e.disabled&&!t},Ha=function(e,t){return t.attributes&&t.attributes[e]},qa=function(e,t){if(1===e.playlists.length)return!0;var n=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(function(e){return!!ja(e)&&(e.attributes.BANDWIDTH||0)0)for(var m=h-1;m>=0;m--){var v=c[m];if(time+=v.duration,d){if(time<0)continue}else if(time+ya<=0)continue;return{partIndex:v.partIndex,segmentIndex:v.segmentIndex,startTime:l-Ua({defaultDuration:t.targetDuration,durationList:c,startIndex:h,endIndex:m})}}return{partIndex:c[0]&&c[0].partIndex||null,segmentIndex:c[0]&&c[0].segmentIndex||0,startTime:n}}if(h<0){for(var _=h;_<0;_++)if((time-=t.targetDuration)<0)return{partIndex:c[0]&&c[0].partIndex||null,segmentIndex:c[0]&&c[0].segmentIndex||0,startTime:n};h=0}for(var y=h;y0)continue}else if(time-ya>=0)continue;return{partIndex:T.partIndex,segmentIndex:T.segmentIndex,startTime:l+Ua({defaultDuration:t.targetDuration,durationList:c,startIndex:h,endIndex:y})}}return{segmentIndex:c[c.length-1].segmentIndex,partIndex:c[c.length-1].partIndex,startTime:n}},isEnabled:ja,isDisabled:function(e){return e.disabled},isBlacklisted:Na,isIncompatible:Fa,playlistEnd:Ba,isAes:function(e){for(var i=0;i-1&&c!==d.length-1&&(n._HLS_part=c),(c>-1||d.length)&&o--}n._HLS_msn=o}if(t.serverControl&&t.serverControl.canSkipUntil&&(n._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(n).length){var h=new l.a.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(e){n.hasOwnProperty(e)&&h.searchParams.set(e,n[e])}),e=h.toString()}return e}(n,t)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:n,withCredentials:this.withCredentials},function(t,n){if(e.request)return t?e.playlistRequestError(e.request,e.media(),"HAVE_METADATA"):void e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})})}},n.playlistRequestError=function(e,t,n){var r=t.uri,o=t.id;this.request=null,n&&(this.state=n),this.error={playlist:this.master.playlists[o],status:e.status,message:"HLS playlist request error at URL: "+r+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")},n.parseManifest_=function(e){var t=this,n=e.url;return function(e){var t=e.onwarn,n=e.oninfo,r=e.manifestString,o=e.customTagParsers,l=void 0===o?[]:o,d=e.customTagMappers,c=void 0===d?[]:d,h=e.experimentalLLHLS,f=new M.a;t&&f.on("warn",t),n&&f.on("info",n),l.forEach(function(e){return f.addParser(e)}),c.forEach(function(e){return f.addTagMapper(e)}),f.push(r),f.end();var m=f.manifest;if(h||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){m.hasOwnProperty(e)&&delete m[e]}),m.segments&&m.segments.forEach(function(e){["parts","preloadHints"].forEach(function(t){e.hasOwnProperty(t)&&delete e[t]})})),!m.targetDuration){var v=10;m.segments&&m.segments.length&&(v=m.segments.reduce(function(e,s){return Math.max(e,s.duration)},0)),t&&t("manifest has no targetDuration defaulting to "+v),m.targetDuration=v}var _=La(m);if(_.length&&!m.partTargetDuration){var y=_.reduce(function(e,p){return Math.max(e,p.duration)},0);t&&(t("manifest has no partTargetDuration defaulting to "+y),Ka.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),m.partTargetDuration=y}return m}({onwarn:function(e){var r=e.message;return t.logger_("m3u8-parser warn for "+n+": "+r)},oninfo:function(e){var r=e.message;return t.logger_("m3u8-parser info for "+n+": "+r)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},n.haveMetadata=function(e){var t=e.playlistString,n=e.playlistObject,r=e.url,o=e.id;this.request=null,this.state="HAVE_METADATA";var l=n||this.parseManifest_({url:r,manifestString:t});l.lastRequest=Date.now(),$a({playlist:l,uri:r,id:o});var d=as(this.master,l);this.targetDuration=l.partTargetDuration||l.targetDuration,this.pendingMedia_=null,d?(this.master=d,this.media_=this.master.playlists[o]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(ss(this.media(),!!d)),this.trigger("loadedplaylist")},n.dispose=function(){this.trigger("dispose"),this.stopRequest(),l.a.clearTimeout(this.mediaUpdateTimeout),l.a.clearTimeout(this.finalRenditionTimeout),this.off()},n.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},n.media=function(e,t){var n=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(l.a.clearTimeout(this.finalRenditionTimeout),t){var r=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=l.a.setTimeout(this.media.bind(this,e,!1),r)}else{var o=this.state,d=!this.media_||e.id!==this.media_.id,c=this.master.playlists[e.id];if(c&&c.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(d&&(this.trigger("mediachanging"),"HAVE_MASTER"===o?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(ss(e,!0)),d){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},function(t,r){if(n.request){if(e.lastRequest=Date.now(),e.resolvedUri=va(n.handleManifestRedirects,e.resolvedUri,r),t)return n.playlistRequestError(n.request,e,o);n.haveMetadata({playlistString:r.responseText,url:e.uri,id:e.id}),"HAVE_MASTER"===o?n.trigger("loadedmetadata"):n.trigger("mediachange")}})}}},n.pause=function(){this.mediaUpdateTimeout&&(l.a.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},n.load=function(e){var t=this;this.mediaUpdateTimeout&&(l.a.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var n=this.media();if(e){var r=n?(n.partTargetDuration||n.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=l.a.setTimeout(function(){t.mediaUpdateTimeout=null,t.load()},r)}else this.started?n&&!n.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},n.updateMediaUpdateTimeout_=function(e){var t=this;this.mediaUpdateTimeout&&(l.a.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=l.a.setTimeout(function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)},e))},n.start=function(){var e=this;if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=l.a.location.href),this.src.resolvedUri=this.src.uri,void setTimeout(function(){e.setupInitialPlaylist(e.src)},0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},function(t,n){if(e.request){if(e.request=null,t)return e.error={status:n.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:n.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.src=va(e.handleManifestRedirects,e.src,n);var r=e.parseManifest_({manifestString:n.responseText,url:e.src});e.setupInitialPlaylist(r)}})},n.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri},n.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists)return this.master=e,Ja(this.master,this.srcUri()),e.playlists.forEach(function(e){e.segments=ns(e),e.segments.forEach(function(t){is(t,e.resolvedUri)})}),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var t=this.srcUri()||l.a.location.href;this.master=function(e,t){var n=Qa(0,t),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:l.a.location.href,resolvedUri:l.a.location.href,playlists:[{uri:t,id:n,resolvedUri:t,attributes:{}}]};return r.playlists[n]=r.playlists[0],r.playlists[t]=r.playlists[0],r}(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},t}(es),ls=ma.xhr,us=ma.mergeOptions,ds=function(e,t,n,r){var o="arraybuffer"===e.responseType?e.response:e.responseText;!t&&o&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=o.byteLength||o.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),n.headers&&(e.responseHeaders=n.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===n.statusCode||206===n.statusCode||0===n.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(o||e.responseText)))),r(t,e)},cs=function(){var e=function e(t,n){t=us({timeout:45e3},t);var r=e.beforeRequest||ma.Vhs.xhr.beforeRequest;if(r&&"function"==typeof r){var o=r(t);o&&(t=o)}var l=(!0===ma.Vhs.xhr.original?ls:ma.Vhs.xhr)(t,function(e,t){return ds(l,e,t,n)}),d=l.abort;return l.abort=function(){return l.aborted=!0,d.apply(l,arguments)},l.uri=t.uri,l.requestTime=Date.now(),l};return e.original=!0,e},hs=function(e){var t,n={};return e.byterange&&(n.Range="bytes="+(t=e.byterange).offset+"-"+("bigint"==typeof t.offset||"bigint"==typeof t.length?l.a.BigInt(t.offset)+l.a.BigInt(t.length)-l.a.BigInt(1):t.offset+t.length-1)),n},ps=function(e,i){return e.start(i)+"-"+e.end(i)},fs=function(e,i){var t=e.toString(16);return"00".substring(0,2-t.length)+t+(i%2?" ":"")},ms=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},gs=function(e){var t={};return Object.keys(e).forEach(function(n){var r=e[n];Object(B.e)(r)?t[n]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[n]=r}),t},vs=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},_s=function(e){return e.resolvedUri},ys=function(data){for(var e=Array.prototype.slice.call(data),t=16,n="",r=0;rn){if(time>n+.25*r.duration)return null;t=r}return{segment:t,estimatedStart:t.videoTimingInfo?t.videoTimingInfo.transmuxedPresentationStart:n-t.duration,type:t.videoTimingInfo?"accurate":"estimate"}}(time,t);if(!o)return r({message:"valid programTime was not found"});if("estimate"===o.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:o.estimatedStart});var l={mediaSeconds:time},d=function(e,t){if(!t.dateTimeObject)return null;var n=t.videoTimingInfo.transmuxerPrependedSeconds,r=e-(t.videoTimingInfo.transmuxedPresentationStart+n);return new Date(t.dateTimeObject.getTime()+1e3*r)}(time,o.segment);return d&&(l.programDateTime=d.toISOString()),r(null,l)},Ss=function e(t){var n=t.programTime,r=t.playlist,o=t.retryCount,l=void 0===o?2:o,d=t.seekTo,c=t.pauseAfterSeek,h=void 0===c||c,f=t.tech,m=t.callback;if(!m)throw new Error("seekToProgramTime: callback must be provided");if(void 0===n||!r||!d)return m({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!r.endList&&!f.hasStarted_)return m({message:"player must be playing a live stream to start buffering"});if(!function(e){if(!e.segments||0===e.segments.length)return!1;for(var i=0;inew Date(d.getTime()+1e3*c)?null:(n>d&&(r=l),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:Ga.duration(t,t.mediaSequence+t.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})}(n,r);if(!v)return m({message:n+" was not found in the stream"});var _=v.segment,y=function(e,t){var n,r;try{n=new Date(e),r=new Date(t)}catch(e){}var o=n.getTime();return(r.getTime()-o)/1e3}(_.dateTimeObject,n);if("estimate"===v.type)return 0===l?m({message:n+" is not buffered yet. Try again"}):(d(v.estimatedStart+y),void f.one("seeked",function(){e({programTime:n,playlist:r,retryCount:l-1,seekTo:d,pauseAfterSeek:h,tech:f,callback:m})}));var T=_.start+y;f.one("seeked",function(){return m(null,f.currentTime())}),h&&f.pause(),d(T)},ks=function(e,t){if(4===e.readyState)return t()},Cs=ma.EventTarget,Es=ma.mergeOptions,ws=function(a,b){if(!rs(a,b))return!1;if(a.sidx&&b.sidx&&(a.sidx.offset!==b.sidx.offset||a.sidx.length!==b.sidx.length))return!1;if(!a.sidx&&b.sidx||a.sidx&&!b.sidx)return!1;if(a.segments&&!b.segments||!a.segments&&b.segments)return!1;if(!a.segments&&!b.segments)return!0;for(var i=0;i=m+f)return c(t,{response:l.subarray(f,f+m),status:n.status,uri:n.uri});r.request=r.vhs_.xhr({uri:d,responseType:"arraybuffer",headers:hs({byterange:e.sidx.byterange})},c)})}else this.mediaRequest_=l.a.setTimeout(function(){return n(!1)},0)},n.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},l.a.clearTimeout(this.minimumUpdatePeriodTimeout_),l.a.clearTimeout(this.mediaRequest_),l.a.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.off()},n.hasPendingRequest=function(){return this.request||this.mediaRequest_},n.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},n.media=function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var n=this.state;if("string"==typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.masterPlaylistLoader_.master.playlists[e]}var r=!this.media_||e.id!==this.media_.id;if(r&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(r&&(this.trigger("mediachanging"),this.trigger("mediachange")));r&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,n,function(r){t.haveMetadata({startingState:n,playlist:e})}))},n.haveMetadata=function(e){var t=e.startingState,n=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[n.id]=n,this.mediaRequest_=null,this.refreshMedia_(n.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},n.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),l.a.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(l.a.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)},n.load=function(e){var t=this;l.a.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var n=this.media();if(e){var r=n?n.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=l.a.setTimeout(function(){return t.load()},r)}else this.started?n&&!n.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()},n.start=function(){var e=this;this.started=!0,this.isMaster_?this.requestMaster_(function(t,n){e.haveMaster_(),e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])}):this.mediaRequest_=l.a.setTimeout(function(){return e.haveMaster_()},0)},n.requestMaster_=function(e){var t=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},function(n,r){if(!t.requestErrored_(n,r)){var o=r.responseText!==t.masterPlaylistLoader_.masterXml_;return t.masterPlaylistLoader_.masterXml_=r.responseText,r.responseHeaders&&r.responseHeaders.date?t.masterLoaded_=Date.parse(r.responseHeaders.date):t.masterLoaded_=Date.now(),t.masterPlaylistLoader_.srcUrl=va(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,r),o?(t.handleMaster_(),void t.syncClientServerClock_(function(){return e(r,o)})):e(r,o)}"HAVE_NOTHING"===t.state&&(t.started=!1)})},n.syncClientServerClock_=function(e){var t=this,n=Object(N.d)(this.masterPlaylistLoader_.masterXml_);return null===n?(this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===n.method?(this.masterPlaylistLoader_.clientOffset_=n.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:ga(this.masterPlaylistLoader_.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials},function(r,o){if(t.request){if(r)return t.masterPlaylistLoader_.clientOffset_=t.masterLoaded_-Date.now(),e();var l;l="HEAD"===n.method?o.responseHeaders&&o.responseHeaders.date?Date.parse(o.responseHeaders.date):t.masterLoaded_:Date.parse(o.responseText),t.masterPlaylistLoader_.clientOffset_=l-Date.now(),e()}}))},n.haveMaster_=function(){this.state="HAVE_MASTER",this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},n.handleMaster_=function(){this.mediaRequest_=null;var e,t,n,r,o,l,d,c=this.masterPlaylistLoader_.master,h=(e={masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:c},t=e.masterXml,n=e.srcUrl,r=e.clientOffset,o=e.sidxMapping,l=e.previousManifest,d=Object(N.c)(t,{manifestUri:n,clientOffset:r,sidxMapping:o,previousManifest:l}),Ja(d,n,Is),d);c&&(h=xs(c,h,this.masterPlaylistLoader_.sidxMapping_)),this.masterPlaylistLoader_.master=h||c;var f=this.masterPlaylistLoader_.master.locations&&this.masterPlaylistLoader_.master.locations[0];return f&&f!==this.masterPlaylistLoader_.srcUrl&&(this.masterPlaylistLoader_.srcUrl=f),(!c||h&&h.minimumUpdatePeriod!==c.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(h)},n.updateMinimumUpdatePeriodTimeout_=function(){var e=this.masterPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(l.a.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);var t=e.master&&e.master.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_("found invalid minimumUpdatePeriod of "+t+", not setting a timeout"):this.createMUPTimeout_(t)},n.createMUPTimeout_=function(e){var t=this.masterPlaylistLoader_;t.minimumUpdatePeriodTimeout_=l.a.setTimeout(function(){t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)},n.refreshXml_=function(){var e=this;this.requestMaster_(function(t,n){var r,o,l;n&&(e.media_&&(e.media_=e.masterPlaylistLoader_.master.playlists[e.media_.id]),e.masterPlaylistLoader_.sidxMapping_=(r=e.masterPlaylistLoader_.master,o=e.masterPlaylistLoader_.sidxMapping_,l=As(r.playlists,o),Ya(r,function(e,t,n,r){if(e.playlists&&e.playlists.length){var d=e.playlists;l=Es(l,As(d,o))}}),l),e.addSidxSegments_(e.media(),e.state,function(t){e.refreshMedia_(e.media().id)}))})},n.refreshMedia_=function(e){var t=this;if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMaster_&&this.handleMaster_();var n=this.masterPlaylistLoader_.master.playlists,r=!this.media_||this.media_!==n[e];if(r?this.media_=n[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){!function e(){t.media().endList||(t.mediaUpdateTimeout=l.a.setTimeout(function(){t.trigger("mediaupdatetimeout"),e()},ss(t.media(),Boolean(r))))}()}this.trigger("loadedplaylist")},t}(Cs),Os={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30},Ds=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},Ms=function(code){return function(){var e=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(n){var t=new BlobBuilder;return t.append(e),URL.createObjectURL(t.getBlob())}}(code),t=Ds(new Worker(e));t.objURL=e;var n=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),n.call(this)},t}},Rs=function(code){return"var browserWorkerPolyFill = "+Ds.toString()+";\nbrowserWorkerPolyFill(self);\n"+code},Us=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},Bs=Rs(Us(function(){var t=function(){this.init=function(){var e={};this.on=function(t,n){e[t]||(e[t]=[]),e[t]=e[t].concat(n)},this.off=function(t,n){var r;return!!e[t]&&(r=e[t].indexOf(n),e[t]=e[t].slice(),e[t].splice(r,1),r>-1)},this.trigger=function(t){var n,i,r,o;if(n=e[t])if(2===arguments.length)for(r=n.length,i=0;i>>1,track.samplingfrequencyindex<<7|track.channelcount<<3,6,1,2]))},k=function(e){return n(A.hdlr,U[e])},S=function(track){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,track.duration>>>24&255,track.duration>>>16&255,track.duration>>>8&255,255&track.duration,85,196,0,0]);return track.samplerate&&(e[12]=track.samplerate>>>24&255,e[13]=track.samplerate>>>16&255,e[14]=track.samplerate>>>8&255,e[15]=255&track.samplerate),n(A.mdhd,e)},T=function(track){return n(A.mdia,S(track),k(track.type),c(track))},d=function(e){return n(A.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},c=function(track){return n(A.minf,"video"===track.type?n(A.vmhd,B):n(A.smhd,N),r(),E(track))},h=function(e,t){for(var r=[],i=t.length;i--;)r[i]=I(t[i]);return n.apply(null,[A.moof,d(e)].concat(r))},f=function(e){for(var i=e.length,t=[];i--;)t[i]=_(e[i]);return n.apply(null,[A.moov,v(4294967295)].concat(t).concat(m(e)))},m=function(e){for(var i=e.length,t=[];i--;)t[i]=x(e[i]);return n.apply(null,[A.mvex].concat(t))},v=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return n(A.mvhd,t)},C=function(track){var e,i,t=track.samples||[],r=new Uint8Array(4+t.length);for(i=0;i>>8),o.push(255&t[i].byteLength),o=o.concat(Array.prototype.slice.call(t[i]));for(i=0;i>>8),l.push(255&r[i].byteLength),l=l.concat(Array.prototype.slice.call(r[i]));if(e=[A.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&track.width)>>8,255&track.width,(65280&track.height)>>8,255&track.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n(A.avcC,new Uint8Array([1,track.profileIdc,track.profileCompatibility,track.levelIdc,255].concat([t.length],o,[r.length],l))),n(A.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],track.sarRatio){var d=track.sarRatio[0],c=track.sarRatio[1];e.push(n(A.pasp,new Uint8Array([(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d,(4278190080&c)>>24,(16711680&c)>>16,(65280&c)>>8,255&c])))}return n.apply(null,e)},G=function(track){return n(A.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&track.channelcount)>>8,255&track.channelcount,(65280&track.samplesize)>>8,255&track.samplesize,0,0,0,0,(65280&track.samplerate)>>8,255&track.samplerate,0,0]),o(track))},y=function(track){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&track.id)>>24,(16711680&track.id)>>16,(65280&track.id)>>8,255&track.id,0,0,0,0,(4278190080&track.duration)>>24,(16711680&track.duration)>>16,(65280&track.duration)>>8,255&track.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&track.width)>>8,255&track.width,0,0,(65280&track.height)>>8,255&track.height,0,0]);return n(A.tkhd,e)},I=function(track){var e,t,r,o,l,d;return e=n(A.tfhd,new Uint8Array([0,0,0,58,(4278190080&track.id)>>24,(16711680&track.id)>>16,(65280&track.id)>>8,255&track.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),l=Math.floor(track.baseMediaDecodeTime/Z),d=Math.floor(track.baseMediaDecodeTime%Z),t=n(A.tfdt,new Uint8Array([1,0,0,0,l>>>24&255,l>>>16&255,l>>>8&255,255&l,d>>>24&255,d>>>16&255,d>>>8&255,255&d])),"audio"===track.type?(r=P(track,92),n(A.traf,e,t,r)):(o=C(track),r=P(track,o.length+92),n(A.traf,e,t,r,o))},_=function(track){return track.duration=track.duration||4294967295,n(A.trak,y(track),T(track))},x=function(track){var e=new Uint8Array([0,0,0,0,(4278190080&track.id)>>24,(16711680&track.id)>>16,(65280&track.id)>>8,255&track.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==track.type&&(e[e.length-1]=0),n(A.trex,e)},X=function(e,t){var n=0,r=0,o=0,l=0;return e.length&&(void 0!==e[0].duration&&(n=1),void 0!==e[0].size&&(r=2),void 0!==e[0].flags&&(o=4),void 0!==e[0].compositionTimeOffset&&(l=8)),[0,0,n|r|o|l,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},Q=function(track,e){var t,r,header,o,l,i;for(e+=20+16*(o=track.samples||[]).length,header=X(o,e),(r=new Uint8Array(header.length+16*o.length)).set(header),t=header.length,i=0;i>>24,r[t++]=(16711680&l.duration)>>>16,r[t++]=(65280&l.duration)>>>8,r[t++]=255&l.duration,r[t++]=(4278190080&l.size)>>>24,r[t++]=(16711680&l.size)>>>16,r[t++]=(65280&l.size)>>>8,r[t++]=255&l.size,r[t++]=l.flags.isLeading<<2|l.flags.dependsOn,r[t++]=l.flags.isDependedOn<<6|l.flags.hasRedundancy<<4|l.flags.paddingValue<<1|l.flags.isNonSyncSample,r[t++]=61440&l.flags.degradationPriority,r[t++]=15&l.flags.degradationPriority,r[t++]=(4278190080&l.compositionTimeOffset)>>>24,r[t++]=(16711680&l.compositionTimeOffset)>>>16,r[t++]=(65280&l.compositionTimeOffset)>>>8,r[t++]=255&l.compositionTimeOffset;return n(A.trun,r)},K=function(track,e){var t,r,header,o,l,i;for(e+=20+8*(o=track.samples||[]).length,header=X(o,e),(t=new Uint8Array(header.length+8*o.length)).set(header),r=header.length,i=0;i>>24,t[r++]=(16711680&l.duration)>>>16,t[r++]=(65280&l.duration)>>>8,t[r++]=255&l.duration,t[r++]=(4278190080&l.size)>>>24,t[r++]=(16711680&l.size)>>>16,t[r++]=(65280&l.size)>>>8,t[r++]=255&l.size;return n(A.trun,t)},P=function(track,e){return"audio"===track.type?K(track,e):Q(track,e)};l=function(){return n(A.ftyp,L,O,L,D)};var ee,te,ie,ne,re,ae,se,oe,le=function(data){return n(A.mdat,data)},ue=h,de=function(e){var t,n=l(),r=f(e);return(t=new Uint8Array(n.byteLength+r.byteLength)).set(n),t.set(r,n.byteLength),t},ce=function(e,t){var n={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return n.dataOffset=t,n.compositionTimeOffset=e.pts-e.dts,n.duration=e.duration,n.size=4*e.length,n.size+=e.byteLength,e.keyFrame&&(n.flags.dependsOn=2,n.flags.isNonSyncSample=0),n},he=function(e){var i,t,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,n.byteLength=0,i=0;i1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},me=function(e,t){var n,i,r,o,l,d=t||0,c=[];for(n=0;nSe/2))){for((l=Te()[track.samplerate])||(l=e[0].data),i=0;i=t?e:(track.minSegmentDts=1/0,e.filter(function(e){return e.dts>=t&&(track.minSegmentDts=Math.min(track.minSegmentDts,e.dts),track.minSegmentPts=track.minSegmentDts,!0)}))},Ae=function(e){var i,t,n=[];for(i=0;i=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},We.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},We.prototype.addText=function(text){this.rows[this.rowIdx]+=text},We.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var ze=function(e,t,n){this.serviceNum=e,this.text="",this.currentWindow=new We(-1),this.windows=[],this.stream=n,"string"==typeof t&&this.createTextDecoder(t)};ze.prototype.init=function(e,t){this.startPts=e;for(var n=0;n<8;n++)this.windows[n]=new We(n),"function"==typeof t&&(this.windows[n].beforeRowOverflow=t)},ze.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},ze.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var Ge=function e(t){t=t||{},e.prototype.init.call(this);var n,r=this,o=t.captionServices||{},l={};Object.keys(o).forEach(function(e){n=o[e],/^SERVICE/.test(e)&&(l[e]=n.encoding)}),this.serviceEncodings=l,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(r.new708Packet(),r.add708Bytes(e)):(null===r.current708Packet&&r.new708Packet(),r.add708Bytes(e))}};Ge.prototype=new Y,Ge.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ge.prototype.add708Bytes=function(e){var data=e.ccData,t=data>>>8,n=255&data;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(t),this.current708Packet.data.push(n)},Ge.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,n=null,r=null,i=0,b=t[i++];for(e.seq=b>>6,e.sizeCode=63&b;i>5)&&r>0&&(n=b=t[i++]),this.pushServiceBlock(n,i,r),r>0&&(i+=r-1)},Ge.prototype.pushServiceBlock=function(e,t,n){var b,i=t,r=this.current708Packet.data,o=this.services[e];for(o||(o=this.initService(e,i));i>5,r.rowLock=(16&b)>>4,r.columnLock=(8&b)>>3,r.priority=7&b,b=t[++i],r.relativePositioning=(128&b)>>7,r.anchorVertical=127&b,b=t[++i],r.anchorHorizontal=b,b=t[++i],r.anchorPoint=(240&b)>>4,r.rowCount=15&b,b=t[++i],r.columnCount=63&b,b=t[++i],r.windowStyle=(56&b)>>3,r.penStyle=7&b,r.virtualRowCount=r.rowCount+1,i},Ge.prototype.setWindowAttributes=function(i,e){var t=this.current708Packet.data,b=t[i],n=e.currentWindow.winAttr;return b=t[++i],n.fillOpacity=(192&b)>>6,n.fillRed=(48&b)>>4,n.fillGreen=(12&b)>>2,n.fillBlue=3&b,b=t[++i],n.borderType=(192&b)>>6,n.borderRed=(48&b)>>4,n.borderGreen=(12&b)>>2,n.borderBlue=3&b,b=t[++i],n.borderType+=(128&b)>>5,n.wordWrap=(64&b)>>6,n.printDirection=(48&b)>>4,n.scrollDirection=(12&b)>>2,n.justify=3&b,b=t[++i],n.effectSpeed=(240&b)>>4,n.effectDirection=(12&b)>>2,n.displayEffect=3&b,i},Ge.prototype.flushDisplayed=function(e,t){for(var n=[],r=0;r<8;r++)t.windows[r].visible&&!t.windows[r].isEmpty()&&n.push(t.windows[r].getText());t.endPts=e,t.text=n.join("\n\n"),this.pushCaption(t),t.startPts=e},Ge.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},Ge.prototype.displayWindows=function(i,e){var b=this.current708Packet.data[++i],t=this.getPts(i);this.flushDisplayed(t,e);for(var n=0;n<8;n++)b&1<>4,n.offset=(12&b)>>2,n.penSize=3&b,b=t[++i],n.italics=(128&b)>>7,n.underline=(64&b)>>6,n.edgeType=(56&b)>>3,n.fontStyle=7&b,i},Ge.prototype.setPenColor=function(i,e){var t=this.current708Packet.data,b=t[i],n=e.currentWindow.penColor;return b=t[++i],n.fgOpacity=(192&b)>>6,n.fgRed=(48&b)>>4,n.fgGreen=(12&b)>>2,n.fgBlue=3&b,b=t[++i],n.bgOpacity=(192&b)>>6,n.bgRed=(48&b)>>4,n.bgGreen=(12&b)>>2,n.bgBlue=3&b,b=t[++i],n.edgeRed=(48&b)>>4,n.edgeGreen=(12&b)>>2,n.edgeBlue=3&b,i},Ge.prototype.setPenLocation=function(i,e){var t=this.current708Packet.data,b=t[i],n=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,b=t[++i],n.row=15&b,b=t[++i],n.column=63&b,i},Ge.prototype.reset=function(i,e){var t=this.getPts(i);return this.flushDisplayed(t,e),this.initService(e.serviceNum,i)};var Ke={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Qe=function(code){return null===code?"":(code=Ke[code]||code,String.fromCharCode(code))},Xe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ye=function(){for(var e=[],i=15;i--;)e.push("");return e},$e=function e(t,n){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=n||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var data,t,n,r,text;if((data=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&data)?this.lastControlCode_=data:data!==this.PADDING_&&(this.lastControlCode_=null),n=data>>>8,r=255&data,data!==this.PADDING_)if(data===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(data===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),t=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=t,this.startPts_=e.pts;else if(data===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(data===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(data===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(data===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(data===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(data===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Ye();else if(data===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ye();else if(data===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Ye()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))text=Qe((n=(3&n)<<8)|r),this[this.mode_](e.pts,text),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),text=Qe((n=(3&n)<<8)|r),this[this.mode_](e.pts,text),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14&~r||this.addFormatting(e.pts,["i"]),1&~r||this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var o=Xe.indexOf(7968&data);"rollUp"===this.mode_&&(o-this.rollUpRows_+1<0&&(o=this.rollUpRows_-1),this.setRollUp(e.pts,o)),o!==this.row_&&(this.clearFormatting(e.pts),this.row_=o),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16&~data||(this.column_=4*((14&data)>>1)),this.isColorPAC(r)&&(14&~r||this.addFormatting(e.pts,["i"]))}else this.isNormalChar(n)&&(0===r&&(r=null),text=Qe(n),text+=Qe(r),this[this.mode_](e.pts,text),this.column_+=text.length)}else this.lastControlCode_=null}};$e.prototype=new Y,$e.prototype.flushDisplayed=function(e){var content=this.displayed_.map(function(e,t){try{return e.trim()}catch(e){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}},this).join("\n").replace(/^\n+|\n+$/g,"");content.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:content,stream:this.name_})},$e.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ye(),this.nonDisplayed_=Ye(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},$e.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},$e.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},$e.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},$e.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},$e.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},$e.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},$e.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},$e.prototype.isNormalChar=function(e){return e>=32&&e<=127},$e.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Ye(),this.displayed_=Ye()),void 0!==t&&t!==this.row_)for(var i=0;i"},"");this[this.mode_](e,text)},$e.prototype.clearFormatting=function(e){if(this.formatting_.length){var text=this.formatting_.reverse().reduce(function(text,e){return text+""},"");this.formatting_=[],this[this.mode_](e,text)}},$e.prototype.popOn=function(e,text){var t=this.nonDisplayed_[this.row_];t+=text,this.nonDisplayed_[this.row_]=t},$e.prototype.rollUp=function(e,text){var t=this.displayed_[this.row_];t+=text,this.displayed_[this.row_]=t},$e.prototype.shiftRowsUp_=function(){var i;for(i=0;it&&(n=-1);Math.abs(t-e)>4294967296;)e+=8589934592*n;return e},it=function e(t){var n,r;e.prototype.init.call(this),this.type_=t||et,this.push=function(data){this.type_!==et&&data.type!==this.type_||(void 0===r&&(r=data.dts),data.dts=tt(data.dts,r),data.pts=tt(data.pts,r),n=data.dts,this.trigger("data",data))},this.flush=function(){r=n,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){r=void 0,n=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};it.prototype=new Y;var nt,at=it,st=tt,ot=function(e,t,n){var i,r="";for(i=t;i>>2;f*=4,f+=3&h[7],c.timeStamp=f,void 0===t.pts&&void 0===t.dts&&(t.pts=c.timeStamp,t.dts=c.timeStamp),this.trigger("timestamp",c)}t.frames.push(c),l+=10,l+=d}while(l>>4>1&&(r+=t[r]+1),0===n.pid)n.type="pat",e(t.subarray(r),n),this.trigger("data",n);else if(n.pid===this.pmtPid)for(n.type="pmt",e(t.subarray(r),n),this.trigger("data",n);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,r,n]):this.processPes_(t,r,n)},this.processPes_=function(e,t,n){n.pid===this.programMapTable.video?n.streamType=Ze.H264_STREAM_TYPE:n.pid===this.programMapTable.audio?n.streamType=Ze.ADTS_STREAM_TYPE:n.streamType=this.programMapTable["timed-metadata"][n.pid],n.type="pes",n.data=e.subarray(t),this.trigger("data",n)}},ft.prototype=new Y,ft.STREAM_TYPES={h264:27,adts:15},mt=function(){var e,t=this,n=!1,video={data:[],size:0},audio={data:[],size:0},r={data:[],size:0},o=function(e,n,r){var o,l,d=new Uint8Array(e.size),c={type:n},i=0,h=0;if(e.data.length&&!(e.size<9)){for(c.trackId=e.data[0].pid,i=0;i>>3,m.pts*=4,m.pts+=(6&f[13])>>>1,m.dts=m.pts,64&v&&(m.dts=(14&f[14])<<27|(255&f[15])<<20|(254&f[16])<<12|(255&f[17])<<5|(254&f[18])>>>3,m.dts*=4,m.dts+=(6&f[18])>>>1)),m.data=f.subarray(9+f[8])),o="video"===n||c.packetLength<=e.size,(r||o)&&(e.size=0,e.data.length=0),o&&t.trigger("data",c)}};mt.prototype.init.call(this),this.push=function(data){({pat:function(){},pes:function(){var e,t;switch(data.streamType){case Ze.H264_STREAM_TYPE:e=video,t="video";break;case Ze.ADTS_STREAM_TYPE:e=audio,t="audio";break;case Ze.METADATA_STREAM_TYPE:e=r,t="timed-metadata";break;default:return}data.payloadUnitStartIndicator&&o(e,t,!0),e.data.push(data),e.size+=data.data.byteLength},pmt:function(){var r={type:"metadata",tracks:[]};null!==(e=data.programMapTable).video&&r.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&r.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),n=!0,t.trigger("data",r)}})[data.type]()},this.reset=function(){video.size=0,video.data.length=0,audio.size=0,audio.data.length=0,this.trigger("reset")},this.flushStreams_=function(){o(video,"video"),o(audio,"audio"),o(r,"timed-metadata")},this.flush=function(){if(!n&&e){var r={type:"metadata",tracks:[]};null!==e.video&&r.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&r.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",r)}n=!1,this.flushStreams_(),this.trigger("done")}},mt.prototype=new Y;var yt={PAT_PID:0,MP2T_PACKET_LENGTH:_t,TransportPacketStream:pt,TransportParseStream:ft,ElementaryStream:mt,TimestampRolloverStream:vt,CaptionStream:Je.CaptionStream,Cea608Stream:Je.Cea608Stream,Cea708Stream:Je.Cea708Stream,MetadataStream:gt};for(var Tt in Ze)Ze.hasOwnProperty(Tt)&&(yt[Tt]=Ze[Tt]);var bt,St=yt,kt=Se,Ct=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];bt=function(e){var t,n=0;bt.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes "+e+" to "+t+" in frame "+n+" outside syncword"})},this.push=function(r){var o,l,d,c,h,i=0;if(e||(n=0),"audio"===r.type){var f;for(t&&t.length?(d=t,(t=new Uint8Array(d.byteLength+r.data.byteLength)).set(d),t.set(r.data,d.byteLength)):t=r.data;i+7>5,h=(c=1024*(1+(3&t[i+6])))*kt/Ct[(60&t[i+2])>>>2],t.byteLength-i>>6&3),channelcount:(1&t[i+2])<<2|(192&t[i+3])>>>6,samplerate:Ct[(60&t[i+2])>>>2],samplingfrequencyindex:(60&t[i+2])>>>2,samplesize:16,data:t.subarray(i+7+l,i+o)}),n++,i+=o}else"number"!=typeof f&&(f=i),i++;"number"==typeof f&&(this.skipWarn_(f,i),f=null),t=t.subarray(i)}},this.flush=function(){n=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}},bt.prototype=new Y;var Et,wt,It,xt=bt,Pt=function(e){var t=e.byteLength,n=0,r=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+r},this.loadWord=function(){var o=e.byteLength-t,l=new Uint8Array(4),d=Math.min(4,t);if(0===d)throw new Error("no bytes available");l.set(e.subarray(o,o+d)),n=new DataView(l.buffer).getUint32(0),r=8*d,t-=d},this.skipBits=function(e){var o;r>e?(n<<=e,r-=e):(e-=r,e-=8*(o=Math.floor(e/8)),t-=o,this.loadWord(),n<<=e,r-=e)},this.readBits=function(e){var o=Math.min(r,e),l=n>>>32-o;return(r-=o)>0?n<<=o:t>0&&this.loadWord(),(o=e-o)>0?l<>>e)return n<<=e,r-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};wt=function(){var i,e,t=0;wt.prototype.init.call(this),this.push=function(data){var n;e?((n=new Uint8Array(e.byteLength+data.data.byteLength)).set(e),n.set(data.data,e.byteLength),e=n):e=data.data;for(var r=e.byteLength;t3&&this.trigger("data",e.subarray(t+3)),e=null,t=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},wt.prototype=new Y,It={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Et=function(){var e,t,n,r,o,l,d,c=new wt;Et.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,n=e.pts,r=e.dts,c.push(e))},c.on("data",function(data){var d={trackId:t,pts:n,dts:r,data:data,nalUnitTypeCode:31&data[0]};switch(d.nalUnitTypeCode){case 5:d.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:d.nalUnitType="sei_rbsp",d.escapedRBSP=o(data.subarray(1));break;case 7:d.nalUnitType="seq_parameter_set_rbsp",d.escapedRBSP=o(data.subarray(1)),d.config=l(d.escapedRBSP);break;case 8:d.nalUnitType="pic_parameter_set_rbsp";break;case 9:d.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",d)}),c.on("done",function(){e.trigger("done")}),c.on("partialdone",function(){e.trigger("partialdone")}),c.on("reset",function(){e.trigger("reset")}),c.on("endedtimeline",function(){e.trigger("endedtimeline")}),this.flush=function(){c.flush()},this.partialFlush=function(){c.partialFlush()},this.reset=function(){c.reset()},this.endTimeline=function(){c.endTimeline()},d=function(e,t){var n,r=8,o=8;for(n=0;n=0?t:0,(16&header[e+5])>>4?t+20:t+10},Mt=function e(data,t){return data.length-t<10||data[t]!=="I".charCodeAt(0)||data[t+1]!=="D".charCodeAt(0)||data[t+2]!=="3".charCodeAt(0)?t:e(data,t+=Dt(data,t))},Rt=function(data){return data[0]<<21|data[1]<<14|data[2]<<7|data[3]},Ut=function(e,t,n){return unescape(function(e,t,n){var i,r="";for(i=t;i=e+2&&!(255&~data[e])&&!(240&~data[e+1])&&16==(22&data[e+1])},parseId3TagSize:Dt,parseAdtsSize:function(header,e){var t=(224&header[e+5])>>5,n=header[e+4]<<3;return 6144&header[e+3]|n|t},parseType:function(header,e){return header[e]==="I".charCodeAt(0)&&header[e+1]==="D".charCodeAt(0)&&header[e+2]==="3".charCodeAt(0)?"timed-metadata":!0&header[e]&&!(240&~header[e+1])?"audio":null},parseSampleRate:function(e){for(var i=0;i+5>>2];i++}return null},parseAacTimestamp:function(e){var t,n,r;t=10,64&e[5]&&(t+=4,t+=Rt(e.subarray(10,14)));do{if((n=Rt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){r=e.subarray(t+10,t+n+10);for(var i=0;i>>2;return l*=4,l+=3&o[7]}break}}t+=10,t+=n}while(t=3;)if(e[h]!=="I".charCodeAt(0)||e[h+1]!=="D".charCodeAt(0)||e[h+2]!=="3".charCodeAt(0))if(255&~e[h]||240&~e[h+1])h++;else{if(e.length-h<7)break;if(h+(c=Bt.parseAdtsSize(e,h))>e.length)break;l={type:"audio",data:e.subarray(h,h+c),pts:t,dts:t},this.trigger("data",l),h+=c}else{if(e.length-h<10)break;if(h+(c=Bt.parseId3TagSize(e,h))>e.length)break;o={type:"timed-metadata",data:e.subarray(h,h+c)},this.trigger("data",o),h+=c}r=e.length-h,e=r>0?e.subarray(h):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new Y;var Nt,Ft,jt,Ht,qt=At,Vt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Wt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],zt=Lt.H264Stream,Gt=Bt.isLikelyAacData,Kt=Se,Qt=function(e,t){t.stream=e,this.trigger("log",t)},Xt=function(e,t){for(var n=Object.keys(t),i=0;i=-1e4&&t<=45e3&&(!n||l>t)&&(n=o,l=t));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,n,r,o,d,c,h,f;for(d=e.byteLength,c=e.nalCount,h=e.duration,t=n=0;tr.pts?t++:(n++,d-=o.byteLength,c-=o.nalCount,h-=o.duration);return 0===n?e:n===e.length?null:((f=e.slice(n)).byteLength=d,f.duration=h,f.nalCount=c,f.pts=f[0].pts,f.dts=f[0].dts,f)},this.alignGopsAtEnd_=function(e){var t,n,r,o,d,c,h;for(t=l.length-1,n=e.length-1,d=null,c=!1;t>=0&&n>=0;){if(r=l[t],o=e[n],r.pts===o.pts){c=!0;break}r.pts>o.pts?t--:(t===l.length-1&&(d=n),n--)}if(!c&&null===d)return null;if(0===(h=c?n:d))return e;var f=e.slice(h),m=f.reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0});return f.byteLength=m.byteLength,f.duration=m.duration,f.nalCount=m.nalCount,f.pts=f[0].pts,f.dts=f[0].dts,f},this.alignGopsWith=function(e){l=e}},Nt.prototype=new Y,Ht=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ht.prototype.init.call(this),this.push=function(output){return output.text?this.pendingCaptions.push(output):output.frames?this.pendingMetadata.push(output):(this.pendingTracks.push(output.track),this.pendingBytes+=output.boxes.byteLength,"video"===output.track.type&&(this.videoTrack=output.track,this.pendingBoxes.push(output.boxes)),void("audio"===output.track.type&&(this.audioTrack=output.track,this.pendingBoxes.unshift(output.boxes))))}},Ht.prototype=new Y,Ht.prototype.flush=function(e){var caption,t,n,i,r=0,o={captions:[],captionStreams:{},metadata:[],info:{}},l=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(l=this.videoTrack.timelineStartInfo.pts,Wt.forEach(function(e){o.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(l=this.audioTrack.timelineStartInfo.pts,Vt.forEach(function(e){o.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?o.type=this.pendingTracks[0].type:o.type="combined",this.emittedTracks+=this.pendingTracks.length,n=de(this.pendingTracks),o.initSegment=new Uint8Array(n.byteLength),o.initSegment.set(n),o.data=new Uint8Array(this.pendingBytes),i=0;i=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ht.prototype.setRemux=function(e){this.remuxTracks=e},jt=function(e){var t,n,r=this,o=!0;jt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var o={};this.transmuxPipeline_=o,o.type="aac",o.metadataStream=new St.MetadataStream,o.aacStream=new qt,o.audioTimestampRolloverStream=new St.TimestampRolloverStream("audio"),o.timedMetadataTimestampRolloverStream=new St.TimestampRolloverStream("timed-metadata"),o.adtsStream=new xt,o.coalesceStream=new Ht(e,o.metadataStream),o.headOfPipeline=o.aacStream,o.aacStream.pipe(o.audioTimestampRolloverStream).pipe(o.adtsStream),o.aacStream.pipe(o.timedMetadataTimestampRolloverStream).pipe(o.metadataStream).pipe(o.coalesceStream),o.metadataStream.on("timestamp",function(e){o.aacStream.setTimestamp(e.timeStamp)}),o.aacStream.on("data",function(data){"timed-metadata"!==data.type&&"audio"!==data.type||o.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:r.baseMediaDecodeTime},codec:"adts",type:"audio"},o.coalesceStream.numberOfTracks++,o.audioSegmentStream=new Ft(n,e),o.audioSegmentStream.on("log",r.getLogTrigger_("audioSegmentStream")),o.audioSegmentStream.on("timingInfo",r.trigger.bind(r,"audioTimingInfo")),o.adtsStream.pipe(o.audioSegmentStream).pipe(o.coalesceStream),r.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!t}))}),o.coalesceStream.on("data",this.trigger.bind(this,"data")),o.coalesceStream.on("done",this.trigger.bind(this,"done")),Xt(this,o)},this.setupTsPipeline=function(){var o={};this.transmuxPipeline_=o,o.type="ts",o.metadataStream=new St.MetadataStream,o.packetStream=new St.TransportPacketStream,o.parseStream=new St.TransportParseStream,o.elementaryStream=new St.ElementaryStream,o.timestampRolloverStream=new St.TimestampRolloverStream,o.adtsStream=new xt,o.h264Stream=new zt,o.captionStream=new St.CaptionStream(e),o.coalesceStream=new Ht(e,o.metadataStream),o.headOfPipeline=o.packetStream,o.packetStream.pipe(o.parseStream).pipe(o.elementaryStream).pipe(o.timestampRolloverStream),o.timestampRolloverStream.pipe(o.h264Stream),o.timestampRolloverStream.pipe(o.adtsStream),o.timestampRolloverStream.pipe(o.metadataStream).pipe(o.coalesceStream),o.h264Stream.pipe(o.captionStream).pipe(o.coalesceStream),o.elementaryStream.on("data",function(data){var i;if("metadata"===data.type){for(i=data.tracks.length;i--;)t||"video"!==data.tracks[i].type?n||"audio"!==data.tracks[i].type||((n=data.tracks[i]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime):(t=data.tracks[i]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime;t&&!o.videoSegmentStream&&(o.coalesceStream.numberOfTracks++,o.videoSegmentStream=new Nt(t,e),o.videoSegmentStream.on("log",r.getLogTrigger_("videoSegmentStream")),o.videoSegmentStream.on("timelineStartInfo",function(t){n&&!e.keepOriginalTimestamps&&(n.timelineStartInfo=t,o.audioSegmentStream.setEarliestDts(t.dts-r.baseMediaDecodeTime))}),o.videoSegmentStream.on("processedGopsInfo",r.trigger.bind(r,"gopInfo")),o.videoSegmentStream.on("segmentTimingInfo",r.trigger.bind(r,"videoSegmentTimingInfo")),o.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&o.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),o.videoSegmentStream.on("timingInfo",r.trigger.bind(r,"videoTimingInfo")),o.h264Stream.pipe(o.videoSegmentStream).pipe(o.coalesceStream)),n&&!o.audioSegmentStream&&(o.coalesceStream.numberOfTracks++,o.audioSegmentStream=new Ft(n,e),o.audioSegmentStream.on("log",r.getLogTrigger_("audioSegmentStream")),o.audioSegmentStream.on("timingInfo",r.trigger.bind(r,"audioTimingInfo")),o.audioSegmentStream.on("segmentTimingInfo",r.trigger.bind(r,"audioSegmentTimingInfo")),o.adtsStream.pipe(o.audioSegmentStream).pipe(o.coalesceStream)),r.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!t})}}),o.coalesceStream.on("data",this.trigger.bind(this,"data")),o.coalesceStream.on("id3Frame",function(e){e.dispatchType=o.metadataStream.dispatchType,r.trigger("id3Frame",e)}),o.coalesceStream.on("caption",this.trigger.bind(this,"caption")),o.coalesceStream.on("done",this.trigger.bind(this,"done")),Xt(this,o)},this.setBaseMediaDecodeTime=function(r){var o=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=r),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,De(n),o.audioTimestampRolloverStream&&o.audioTimestampRolloverStream.discontinuity()),t&&(o.videoSegmentStream&&(o.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,De(t),o.captionStream.reset()),o.timestampRolloverStream&&o.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var n=this.transmuxPipeline_;e.remux=t,n&&n.coalesceStream&&n.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(n){n.stream=e,t.trigger("log",n)}},this.push=function(data){if(o){var e=Gt(data);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),o=!1}this.transmuxPipeline_.headOfPipeline.push(data)},this.flush=function(){o=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},jt.prototype=new Y;var Jt,Zt,ei,ti={Transmuxer:jt,VideoSegmentStream:Nt,AudioSegmentStream:Ft,AUDIO_PROPERTIES:Vt,VIDEO_PROPERTIES:Wt,generateSegmentTimingInfo:$t},ii=function(e){return e>>>0},ni=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},ri=ii,ai=function e(data,path){var i,t,n,r,o,l=[];if(!path.length)return null;for(i=0;i1?i+t:data.byteLength,n===path[0]&&(1===path.length?l.push(data.subarray(i+8,r)):(o=e(data.subarray(i+8,r),path.slice(1))).length&&(l=l.concat(o))),i=r;return l},si=ii,oi=J.getUint64,ui=function(data){var e={version:data[0],flags:new Uint8Array(data.subarray(1,4))};return 1===e.version?e.baseMediaDecodeTime=oi(data.subarray(4)):e.baseMediaDecodeTime=si(data[4]<<24|data[5]<<16|data[6]<<8|data[7]),e},di=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},ci=function(data){var e,t={version:data[0],flags:new Uint8Array(data.subarray(1,4)),samples:[]},view=new DataView(data.buffer,data.byteOffset,data.byteLength),n=1&t.flags[2],r=4&t.flags[2],o=1&t.flags[1],l=2&t.flags[1],d=4&t.flags[1],c=8&t.flags[1],h=view.getUint32(4),f=8;for(n&&(t.dataOffset=view.getInt32(f),f+=4),r&&h&&(e={flags:di(data.subarray(f,f+4))},f+=4,o&&(e.duration=view.getUint32(f),f+=4),l&&(e.size=view.getUint32(f),f+=4),c&&(1===t.version?e.compositionTimeOffset=view.getInt32(f):e.compositionTimeOffset=view.getUint32(f),f+=4),t.samples.push(e),h--);h--;)e={},o&&(e.duration=view.getUint32(f),f+=4),l&&(e.size=view.getUint32(f),f+=4),d&&(e.flags=di(data.subarray(f,f+4)),f+=4),c&&(1===t.version?e.compositionTimeOffset=view.getInt32(f):e.compositionTimeOffset=view.getUint32(f),f+=4),t.samples.push(e);return t},hi=function(data){var i,view=new DataView(data.buffer,data.byteOffset,data.byteLength),e={version:data[0],flags:new Uint8Array(data.subarray(1,4)),trackId:view.getUint32(4)},t=1&e.flags[2],n=2&e.flags[2],r=8&e.flags[2],o=16&e.flags[2],l=32&e.flags[2],d=65536&e.flags[0],c=131072&e.flags[0];return i=8,t&&(i+=4,e.baseDataOffset=view.getUint32(12),i+=4),n&&(e.sampleDescriptionIndex=view.getUint32(i),i+=4),r&&(e.defaultSampleDuration=view.getUint32(i),i+=4),o&&(e.defaultSampleSize=view.getUint32(i),i+=4),l&&(e.defaultSampleFlags=view.getUint32(i)),d&&(e.durationIsEmpty=!0),!t&&c&&(e.baseDataOffsetIsMoof=!0),e},pi="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},fi="undefined"!=typeof window?window:void 0!==pi?pi:"undefined"!=typeof self?self:{},mi=Fe,gi=Je.CaptionStream,vi=function(e,t){for(var n=e,i=0;i0?ui(m[0]).baseMediaDecodeTime:0,_=ai(d,["trun"]);t===f&&_.length>0&&(n=function(e,t,n){var r=t,o=n.defaultSampleDuration||0,l=n.defaultSampleSize||0,d=n.trackId,c=[];return e.forEach(function(e){var t=ci(e).samples;t.forEach(function(e){void 0===e.duration&&(e.duration=o),void 0===e.size&&(e.size=l),e.trackId=d,e.dts=r,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof r?(e.pts=r+fi.BigInt(e.compositionTimeOffset),r+=fi.BigInt(e.duration)):(e.pts=r+e.compositionTimeOffset,r+=e.duration)}),c=c.concat(t)}),c}(_,v,h),r=function(e,t,n){var r,i,o,l,d=new DataView(e.buffer,e.byteOffset,e.byteLength),c={logs:[],seiNals:[]};for(i=0;i+40;){var h=t.shift();this.parse(h,l,d)}return c=function(e,t,n){if(null===t)return null;var r=_i(e,t)[t]||{};return{seiNals:r.seiNals,logs:r.logs,timescale:n}}(e,n,r),c&&c.logs&&(o.logs=o.logs.concat(c.logs)),null!==c&&c.seiNals?(this.pushNals(c.seiNals),this.flushStream(),o):o.logs.length?{logs:o.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach(function(t){e.push(t)})},this.flushStream=function(){if(!this.isInitialized())return null;l?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){o.captions=[],o.captionStreams={},o.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],n=null,r=null,o?this.clearParsedCaptions():o={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Ti=ii,bi=function(e){return("00"+e.toString(16)).slice(-2)},Si=J.getUint64;Jt=function(e,t){var n=ai(t,["moof","traf"]).reduce(function(t,n){var r,o,l=ai(n,["tfhd"])[0],d=Ti(l[4]<<24|l[5]<<16|l[6]<<8|l[7]),c=e[d]||9e4,h=ai(n,["tfdt"])[0],f=new DataView(h.buffer,h.byteOffset,h.byteLength);return"bigint"==typeof(r=1===h[0]?Si(h.subarray(4,12)):f.getUint32(4))?o=r/fi.BigInt(c):"number"!=typeof r||isNaN(r)||(o=r/c),o11?(track.codec+=".",track.codec+=bi(h[9]),track.codec+=bi(h[10]),track.codec+=bi(h[11])):track.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(track.codec)?(h=f.subarray(28),"esds"===ni(h.subarray(4,8))&&h.length>20&&0!==h[19]?(track.codec+="."+bi(h[19]),track.codec+="."+bi(h[20]>>>2&63).replace(/^0/,"")):track.codec="mp4a.40.2"):track.codec=track.codec.toLowerCase())}var m=ai(e,["mdia","mdhd"])[0];m&&(track.timescale=ei(m)),n.push(track)}),n};var ki=Jt,Ci=Zt,Ei=function(e){var t=31&e[1];return t<<=8,t|=e[2]},wi=function(e){return!!(64&e[1])},Ii=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},xi=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Pi={parseType:function(e,t){var n=Ei(e);return 0===n?"pat":n===t?"pmt":t?"pes":null},parsePat:function(e){var t=wi(e),n=4+Ii(e);return t&&(n+=e[n]+1),(31&e[n+10])<<8|e[n+11]},parsePmt:function(e){var t={},n=wi(e),r=4+Ii(e);if(n&&(r+=e[r]+1),1&e[r+5]){var o;o=3+((15&e[r+1])<<8|e[r+2])-4;for(var l=12+((15&e[r+10])<<8|e[r+11]);l=e.byteLength)return null;var n,r=null;return 192&(n=e[t+7])&&((r={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,r.pts*=4,r.pts+=(6&e[t+13])>>>1,r.dts=r.pts,64&n&&(r.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,r.dts*=4,r.dts+=(6&e[t+18])>>>1)),r},videoPacketContainsKeyFrame:function(e){for(var t=4+Ii(e),n=e.subarray(t),r=0,o=0,l=!1;o3&&"slice_layer_without_partitioning_rbsp_idr"===xi(31&n[o+3])&&(l=!0),l}},Ai=st,Li={};Li.ts=Pi,Li.aac=Bt;var Oi=Se,Di=188,Mi=71,Ri=function(e,t,n){for(var r,o,l,d,c=0,h=Di,f=!1;h<=e.byteLength;)if(e[c]!==Mi||e[h]!==Mi&&h!==e.byteLength)c++,h++;else{if(r=e.subarray(c,h),"pes"===Li.ts.parseType(r,t.pid))o=Li.ts.parsePesType(r,t.table),l=Li.ts.parsePayloadUnitStartIndicator(r),"audio"===o&&l&&(d=Li.ts.parsePesTime(r))&&(d.type="audio",n.audio.push(d),f=!0);if(f)break;c+=Di,h+=Di}for(c=(h=e.byteLength)-Di,f=!1;c>=0;)if(e[c]!==Mi||e[h]!==Mi&&h!==e.byteLength)c--,h--;else{if(r=e.subarray(c,h),"pes"===Li.ts.parseType(r,t.pid))o=Li.ts.parsePesType(r,t.table),l=Li.ts.parsePayloadUnitStartIndicator(r),"audio"===o&&l&&(d=Li.ts.parsePesTime(r))&&(d.type="audio",n.audio.push(d),f=!0);if(f)break;c-=Di,h-=Di}},Ui=function(e,t,n){for(var r,o,l,d,c,i,h,f=0,m=Di,v=!1,_={data:[],size:0};m=0;)if(e[f]!==Mi||e[m]!==Mi)f--,m--;else{if(r=e.subarray(f,m),"pes"===Li.ts.parseType(r,t.pid))o=Li.ts.parsePesType(r,t.table),l=Li.ts.parsePayloadUnitStartIndicator(r),"video"===o&&l&&(d=Li.ts.parsePesTime(r))&&(d.type="video",n.video.push(d),v=!0);if(v)break;f-=Di,m-=Di}},Bi=function(e){var t={pid:null,table:null},n={};for(var r in function(e,t){for(var n,r=0,o=Di;o=3;){switch(Li.aac.parseType(e,c)){case"timed-metadata":if(e.length-c<10){n=!0;break}if((d=Li.aac.parseId3TagSize(e,c))>e.length){n=!0;break}null===l&&(t=e.subarray(c,c+d),l=Li.aac.parseAacTimestamp(t)),c+=d;break;case"audio":if(e.length-c<7){n=!0;break}if((d=Li.aac.parseAdtsSize(e,c))>e.length){n=!0;break}null===o&&(t=e.subarray(c,c+d),o=Li.aac.parseSampleRate(t)),r++,c+=d;break;default:c++}if(n)return null}if(null===o||null===l)return null;var h=Oi/o;return{audio:[{type:"audio",dts:l,pts:l},{type:"audio",dts:l+1024*r*h,pts:l+1024*r*h}]}}(e):Bi(e),n&&(n.audio||n.video)?(function(e,t){if(e.audio&&e.audio.length){var n=t;(void 0===n||isNaN(n))&&(n=e.audio[0].dts),e.audio.forEach(function(e){e.dts=Ai(e.dts,n),e.pts=Ai(e.pts,n),e.dtsTime=e.dts/Oi,e.ptsTime=e.pts/Oi})}if(e.video&&e.video.length){var r=t;if((void 0===r||isNaN(r))&&(r=e.video[0].dts),e.video.forEach(function(e){e.dts=Ai(e.dts,r),e.pts=Ai(e.pts,r),e.dtsTime=e.dts/Oi,e.ptsTime=e.pts/Oi}),e.firstKeyFrame){var o=e.firstKeyFrame;o.dts=Ai(o.dts,r),o.pts=Ai(o.pts,r),o.dtsTime=o.dts/Oi,o.ptsTime=o.pts/Oi}}}(n,t),n):null},Fi=function(){function e(e,t){this.options=t||{},this.self=e,this.init()}var t=e.prototype;return t.init=function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new ti.Transmuxer(this.options),function(e,t){t.on("data",function(t){var n=t.initSegment;t.initSegment={data:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength};var r=t.data;t.data=r.buffer,e.postMessage({action:"data",segment:t,byteOffset:r.byteOffset,byteLength:r.byteLength},[t.data])}),t.on("done",function(data){e.postMessage({action:"done"})}),t.on("gopInfo",function(t){e.postMessage({action:"gopInfo",gopInfo:t})}),t.on("videoSegmentTimingInfo",function(t){var n={start:{decode:Ce(t.start.dts),presentation:Ce(t.start.pts)},end:{decode:Ce(t.end.dts),presentation:Ce(t.end.pts)},baseMediaDecodeTime:Ce(t.baseMediaDecodeTime)};t.prependedContentDuration&&(n.prependedContentDuration=Ce(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:n})}),t.on("audioSegmentTimingInfo",function(t){var n={start:{decode:Ce(t.start.dts),presentation:Ce(t.start.pts)},end:{decode:Ce(t.end.dts),presentation:Ce(t.end.pts)},baseMediaDecodeTime:Ce(t.baseMediaDecodeTime)};t.prependedContentDuration&&(n.prependedContentDuration=Ce(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:n})}),t.on("id3Frame",function(t){e.postMessage({action:"id3Frame",id3Frame:t})}),t.on("caption",function(caption){e.postMessage({action:"caption",caption:caption})}),t.on("trackinfo",function(t){e.postMessage({action:"trackinfo",trackInfo:t})}),t.on("audioTimingInfo",function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:Ce(t.start),end:Ce(t.end)}})}),t.on("videoTimingInfo",function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Ce(t.start),end:Ce(t.end)}})}),t.on("log",function(t){e.postMessage({action:"log",log:t})})}(this.self,this.transmuxer)},t.pushMp4Captions=function(data){this.captionParser||(this.captionParser=new yi,this.captionParser.init());var e=new Uint8Array(data.data,data.byteOffset,data.byteLength),t=this.captionParser.parse(e,data.trackIds,data.timescales);this.self.postMessage({action:"mp4Captions",captions:t&&t.captions||[],logs:t&&t.logs||[],data:e.buffer},[e.buffer])},t.probeMp4StartTime=function(e){var t=e.timescales,data=e.data,n=ki(t,data);this.self.postMessage({action:"probeMp4StartTime",startTime:n,data:data},[data.buffer])},t.probeMp4Tracks=function(e){var data=e.data,t=Ci(data);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:data},[data.buffer])},t.probeTs=function(e){var data=e.data,t=e.baseStartTime,n="number"!=typeof t||isNaN(t)?void 0:t*Se,r=Ni(data,n),o=null;r&&((o={hasVideo:r.video&&2===r.video.length||!1,hasAudio:r.audio&&2===r.audio.length||!1}).hasVideo&&(o.videoStart=r.video[0].ptsTime),o.hasAudio&&(o.audioStart=r.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:o,data:data},[data.buffer])},t.clearAllMp4Captions=function(){this.captionParser&&this.captionParser.clearAllCaptions()},t.clearParsedMp4Captions=function(){this.captionParser&&this.captionParser.clearParsedCaptions()},t.push=function(data){var e=new Uint8Array(data.data,data.byteOffset,data.byteLength);this.transmuxer.push(e)},t.reset=function(){this.transmuxer.reset()},t.setTimestampOffset=function(data){var e=data.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(ke(e)))},t.setAudioAppendStart=function(data){this.transmuxer.setAudioAppendStart(Math.ceil(ke(data.appendStart)))},t.setRemux=function(data){this.transmuxer.setRemux(data.remux)},t.flush=function(data){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})},t.endTimeline=function(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})},t.alignGopsWith=function(data){this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice())},e}();self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new Fi(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new Fi(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})),Ns=Ms(Bs),Fs=function(e){var t=e.transmuxer,n=e.bytes,r=e.audioAppendStart,o=e.gopsToAlignWith,l=e.remux,d=e.onData,c=e.onTrackInfo,h=e.onAudioTimingInfo,f=e.onVideoTimingInfo,m=e.onVideoSegmentTimingInfo,v=e.onAudioSegmentTimingInfo,_=e.onId3,y=e.onCaptions,T=e.onDone,S=e.onEndedTimeline,k=e.onTransmuxerLog,C=e.isEndOfTimeline,E={buffer:[]},w=C;if(t.onmessage=function(n){t.currentTransmux===e&&("data"===n.data.action&&function(e,t,n){var r=e.data.segment,o=r.type,l=r.initSegment,d=r.captions,c=r.captionStreams,h=r.metadata,f=r.videoFrameDtsTime,m=r.videoFramePtsTime;t.buffer.push({captions:d,captionStreams:c,metadata:h});var v=e.data.segment.boxes||{data:e.data.segment.data},_={type:o,data:new Uint8Array(v.data,v.data.byteOffset,v.data.byteLength),initSegment:new Uint8Array(l.data,l.byteOffset,l.byteLength)};void 0!==f&&(_.videoFrameDtsTime=f),void 0!==m&&(_.videoFramePtsTime=m),n(_)}(n,E,d),"trackinfo"===n.data.action&&c(n.data.trackInfo),"gopInfo"===n.data.action&&function(e,t){t.gopInfo=e.data.gopInfo}(n,E),"audioTimingInfo"===n.data.action&&h(n.data.audioTimingInfo),"videoTimingInfo"===n.data.action&&f(n.data.videoTimingInfo),"videoSegmentTimingInfo"===n.data.action&&m(n.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===n.data.action&&v(n.data.audioSegmentTimingInfo),"id3Frame"===n.data.action&&_([n.data.id3Frame],n.data.id3Frame.dispatchType),"caption"===n.data.action&&y(n.data.caption),"endedtimeline"===n.data.action&&(w=!1,S()),"log"===n.data.action&&k(n.data.log),"transmuxed"===n.data.type&&(w||(t.onmessage=null,function(e){var t=e.transmuxedData,n=e.callback;t.buffer=[],n(t)}({transmuxedData:E,callback:T}),js(t))))},r&&t.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(o)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:o}),void 0!==l&&t.postMessage({action:"setRemux",remux:l}),n.byteLength){var I=n instanceof ArrayBuffer?n:n.buffer,x=n instanceof ArrayBuffer?0:n.byteOffset;t.postMessage({action:"push",data:I,byteOffset:x,byteLength:n.byteLength},[I])}C&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},js=function(e){e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():Fs(e.currentTransmux))},Hs=function(e,t){e.postMessage({action:t}),js(e)},qs=function(e,t){if(!t.currentTransmux)return t.currentTransmux=e,void Hs(t,e);t.transmuxQueue.push(Hs.bind(null,t,e))},Vs=function(e){if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void Fs(e);e.transmuxer.transmuxQueue.push(e)},Ws=function(e){qs("reset",e)},zs=function(e){var t=new Ns;t.currentTransmux=null,t.transmuxQueue=[];var n=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,n.call(t)},t.postMessage({action:"init",options:e}),t},Gs=function(e){var t=e.transmuxer,n=e.endAction||e.action,r=e.callback,o=f()({},e,{endAction:null,transmuxer:null,callback:null});if(t.addEventListener("message",function o(l){l.data.action===n&&(t.removeEventListener("message",o),l.data.data&&(l.data.data=new Uint8Array(l.data.data,e.byteOffset||0,e.byteLength||l.data.data.byteLength),e.data&&(e.data=l.data.data)),r(l.data))}),e.data){var l=e.data instanceof ArrayBuffer;o.byteOffset=l?0:e.data.byteOffset,o.byteLength=e.data.byteLength;var d=[l?e.data:e.data.buffer];t.postMessage(o,d)}else t.postMessage(o)},Ks=2,Qs=-101,Xs=-102,Ys=function(e){e.forEach(function(e){e.abort()})},$s=function(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Qs,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Xs,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Ks,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:Ks,xhr:t}:null},Js=function(e,t,n){return function(r,o){var l=o.response,d=$s(r,o);if(d)return n(d,e);if(16!==l.byteLength)return n({status:o.status,message:"Invalid HLS key at URL: "+o.uri,code:Ks,xhr:o},e);for(var view=new DataView(l),c=new Uint32Array([view.getUint32(0),view.getUint32(4),view.getUint32(8),view.getUint32(12)]),i=0;i1)return oo("multiple "+e+" codecs found as attributes: "+t[e].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),void(t[e]=null);t[e]=t[e][0]}),t},co=function(e){var t=0;return e.audio&&t++,e.video&&t++,t},ho=function(e,t){var n=t.attributes||{},r=uo(function(e){var t=e.attributes||{};if(t.CODECS)return Object(R.h)(t.CODECS)}(t)||[]);if(lo(e,t)&&!r.audio&&!function(e,t){if(!lo(e,t))return!0;var n=t.attributes||{},r=e.mediaGroups.AUDIO[n.AUDIO];for(var o in r)if(!r[o].uri&&!r[o].playlists)return!0;return!1}(e,t)){var o=uo(Object(R.d)(e,n.AUDIO)||[]);o.audio&&(r.audio=o.audio)}return r},po=_a("PlaylistSelector"),fo=function(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}},mo=function(e,t){if(!e)return"";var n=l.a.getComputedStyle(e);return n?n[t]:""},go=function(e,t){var n=e.slice();e.sort(function(e,r){var o=t(e,r);return 0===o?n.indexOf(e)-n.indexOf(r):o})},vo=function(e,t){var n,r;return e.attributes.BANDWIDTH&&(n=e.attributes.BANDWIDTH),n=n||l.a.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(r=t.attributes.BANDWIDTH),n-(r=r||l.a.Number.MAX_VALUE)},_o=function(e,t,n,r,o,d){if(e){var c={bandwidth:t,width:n,height:r,limitRenditionByPlayerDimensions:o},h=e.playlists;Ga.isAudioOnly(e)&&(h=d.getAudioTrackPlaylists_(),c.audioOnly=!0);var f=h.map(function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,n=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||l.a.Number.MAX_VALUE,width:t,height:n,playlist:e}});go(f,function(e,t){return e.bandwidth-t.bandwidth});var m=(f=f.filter(function(e){return!Ga.isIncompatible(e.playlist)})).filter(function(e){return Ga.isEnabled(e.playlist)});m.length||(m=f.filter(function(e){return!Ga.isDisabled(e.playlist)}));var v=m.filter(function(e){return e.bandwidth*Os.BANDWIDTH_VARIANCEn||e.height>r})).filter(function(e){return e.width===E[0].width&&e.height===E[0].height}),_=w[w.length-1],I=w.filter(function(e){return e.bandwidth===_.bandwidth})[0]),d.experimentalLeastPixelDiffSelector){var A=k.map(function(e){return e.pixelDiff=Math.abs(e.width-n)+Math.abs(e.height-r),e});go(A,function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff}),x=A[0]}var L=x||I||P||y||m[0]||f[0];if(L&&L.playlist){var O="sortedPlaylistReps";return x?O="leastPixelDiffRep":I?O="resolutionPlusOneRep":P?O="resolutionBestRep":y?O="bandwidthBestRep":m[0]&&(O="enabledPlaylistReps"),po("choosing "+fo(L)+" using "+O+" with options",c),L.playlist}return po("could not choose a playlist with options",c),null}},yo=function(){var e=this.useDevicePixelRatio&&l.a.devicePixelRatio||1;return _o(this.playlists.master,this.systemBandwidth,parseInt(mo(this.tech_.el(),"width"),10)*e,parseInt(mo(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},To=function(e){var t=e.inbandTextTracks,n=e.metadataArray,r=e.timestampOffset,o=e.videoDuration;if(n){var d=l.a.WebKitDataCue||l.a.VTTCue,c=t.metadataTrack_;if(c&&(n.forEach(function(e){var time=e.cueTime+r;!("number"!=typeof time||l.a.isNaN(time)||time<0)&&time<1/0&&e.frames.forEach(function(e){var t=new d(time,time,e.value||e.url||e.data||"");t.frame=e,t.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return ma.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return ma.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return ma.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(t),c.addCue(t)})}),c.cues&&c.cues.length)){for(var h=c.cues,f=[],i=0;i=e&&n.endTime<=t&&track.removeCue(n)},So=function(e){return"number"==typeof e&&isFinite(e)},ko=1/60,Co=function(e){var t=e.startOfSegment,n=e.duration,r=e.segment,o=e.part,l=e.playlist,d=l.mediaSequence,c=l.id,h=l.segments,f=void 0===h?[]:h,m=e.mediaIndex,v=e.partIndex,_=e.timeline,y=f.length-1,T="mediaIndex/partIndex increment";e.getMediaInfoForTime?T="getMediaInfoForTime ("+e.getMediaInfoForTime+")":e.isSyncRequest&&(T="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(T+=" with independent "+e.independent);var S="number"==typeof v,k=e.segment.uri?"segment":"pre-segment",C=S?Oa({preloadSegment:r})-1:0;return k+" ["+(d+m)+"/"+(d+y)+"]"+(S?" part ["+v+"/"+C+"]":"")+" segment start/end ["+r.start+" => "+r.end+"]"+(S?" part start/end ["+o.start+" => "+o.end+"]":"")+" startOfSegment ["+t+"] duration ["+n+"] timeline ["+_+"] selected by ["+T+"] playlist ["+c+"]"},Eo=function(e){return e+"TimingInfo"},wo=function(e){var t=e.timelineChangeController,n=e.currentTimeline,r=e.segmentTimeline,o=e.loaderType,l=e.audioDisabled;if(n===r)return!1;if("audio"===o){var d=t.lastTimelineChange({type:"main"});return!d||d.to!==r}if("main"===o&&l){var c=t.pendingTimelineChange({type:"audio"});return!c||c.to!==r}return!1},Io=function(e){var t=e.segmentDuration,n=e.maxDuration;return!!t&&Math.round(t)>n+ya},xo=function(e,t){if("hls"!==t)return null;var n,r,o=(n={audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo},r=0,["video","audio"].forEach(function(e){var t=n[e+"TimingInfo"];if(t){var o,d=t.start,c=t.end;"bigint"==typeof d||"bigint"==typeof c?o=l.a.BigInt(c)-l.a.BigInt(d):"number"==typeof d&&"number"==typeof c&&(o=c-d),void 0!==o&&o>r&&(r=o)}}),"bigint"==typeof r&&r=11,r.appendInitSegment_={audio:!0,video:!0},r.playlistOfLastInitSegment_={audio:null,video:null},r.callQueue_=[],r.loadQueue_=[],r.metadataQueue_={id3:[],caption:[]},r.waitingOnRemove_=!1,r.quotaExceededErrorRetryTimeout_=null,r.activeInitSegmentId_=null,r.initSegments_={},r.cacheEncryptionKeys_=t.cacheEncryptionKeys,r.keyCache_={},r.decrypter_=t.decrypter,r.syncController_=t.syncController,r.syncPoint_={segmentIndex:0,time:0},r.transmuxer_=r.createTransmuxer_(),r.triggerSyncInfoUpdate_=function(){return r.trigger("syncinfoupdate")},r.syncController_.on("syncinfoupdate",r.triggerSyncInfoUpdate_),r.mediaSource_.addEventListener("sourceopen",function(){r.isEndOfStream_()||(r.ended_=!1)}),r.fetchAtBuffer_=!1,r.logger_=_a("SegmentLoader["+r.loaderType_+"]"),Object.defineProperty(y()(r),"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),r.sourceUpdater_.on("ready",function(){r.hasEnoughInfoToAppend_()&&r.processCallQueue_()}),"main"===r.loaderType_&&r.timelineChangeController_.on("pendingtimelinechange",function(){r.hasEnoughInfoToAppend_()&&r.processCallQueue_()}),"audio"===r.loaderType_&&r.timelineChangeController_.on("timelinechange",function(){r.hasEnoughInfoToLoad_()&&r.processLoadQueue_(),r.hasEnoughInfoToAppend_()&&r.processCallQueue_()}),r}S()(t,e);var n=t.prototype;return n.createTransmuxer_=function(){return zs({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})},n.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},n.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&l.a.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},n.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},n.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},n.abort_=function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,l.a.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null},n.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},n.error=function(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},n.endOfStream=function(){this.ended_=!0,this.transmuxer_&&Ws(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},n.buffered_=function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return ma.createTimeRanges();if("main"===this.loaderType_){var t=e.hasAudio,n=e.hasVideo,r=e.isMuxed;if(n&&t&&!this.audioDisabled_&&!r)return this.sourceUpdater_.buffered();if(n)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},n.initSegmentForMap=function(map,e){if(void 0===e&&(e=!1),!map)return null;var t=vs(map),n=this.initSegments_[t];return e&&!n&&map.bytes&&(this.initSegments_[t]=n={resolvedUri:map.resolvedUri,byterange:map.byterange,bytes:map.bytes,tracks:map.tracks,timescales:map.timescales}),n||map},n.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var n=_s(e),r=this.keyCache_[n];this.cacheEncryptionKeys_&&t&&!r&&e.bytes&&(this.keyCache_[n]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});var o={resolvedUri:(r||e).resolvedUri};return r&&(o.bytes=r.bytes),o},n.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},n.load=function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))},n.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},n.playlist=function(e,t){if(void 0===t&&(t={}),e){var n=this.playlist_,r=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var o=null;if(n&&(n.id?o=n.id:n.uri&&(o=n.uri)),this.logger_("playlist update ["+o+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!n||n.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");var l=e.mediaSequence-n.mediaSequence;if(this.logger_("live window shift ["+l+"]"),null!==this.mediaIndex)if(this.mediaIndex-=l,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var d=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!d.parts||!d.parts.length||!d.parts[this.partIndex])){var c=this.mediaIndex;this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=c}}r&&(r.mediaIndex-=l,r.mediaIndex<0?(r.mediaIndex=null,r.partIndex=null):(r.mediaIndex>=0&&(r.segment=e.segments[r.mediaIndex]),r.partIndex>=0&&r.segment.parts&&(r.part=r.segment.parts[r.partIndex]))),this.syncController_.saveExpiredSegmentInfo(n,e)}},n.pause=function(){this.checkBufferTimeout_&&(l.a.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},n.paused=function(){return null===this.checkBufferTimeout_},n.resetEverything=function(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))},n.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},n.resyncLoader=function(){this.transmuxer_&&Ws(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},n.remove=function(e,t,n,r){if(void 0===n&&(n=function(){}),void 0===r&&(r=!1),t===1/0&&(t=this.duration_()),t<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var o=1,l=function(){0===--o&&n()};for(var track in!r&&this.audioDisabled_||(o++,this.sourceUpdater_.removeAudio(e,t,l)),(r||"main"===this.loaderType_)&&(this.gopBuffer_=function(e,t,n,r){for(var o=Math.ceil((t-r)*W.ONE_SECOND_IN_TS),l=Math.ceil((n-r)*W.ONE_SECOND_IN_TS),d=e.slice(),i=e.length;i--&&!(e[i].pts<=l););if(-1===i)return d;for(var c=i+1;c--&&!(e[c].pts<=o););return c=Math.max(c,0),d.splice(c,i-c+1),d}(this.gopBuffer_,e,t,this.timeMapping_),o++,this.sourceUpdater_.removeVideo(e,t,l)),this.inbandTextTracks_)bo(e,t,this.inbandTextTracks_[track]);bo(e,t,this.segmentMetadataTrack_),l()}else this.logger_("skipping remove because no source updater or starting media info")},n.monitorBuffer_=function(){this.checkBufferTimeout_&&l.a.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=l.a.setTimeout(this.monitorBufferTick_.bind(this),1)},n.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&l.a.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=l.a.setTimeout(this.monitorBufferTick_.bind(this),500)},n.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}},n.isEndOfStream_=function(e,t,n){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),void 0===n&&(n=this.partIndex),!t||!this.mediaSource_)return!1;var r="number"==typeof e&&t.segments[e],o=e+1===t.segments.length,l=!r||!r.parts||n+1===r.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&o&&l},n.chooseNextRequest_=function(){var e=this.buffered_(),t=wa(e)||0,n=Ia(e,this.currentTime_()),r=!this.hasPlayed_()&&n>=1,o=n>=this.goalBufferLength_(),l=this.playlist_.segments;if(!l.length||r||o)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var d={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(d.isSyncRequest)d.mediaIndex=function(e,t,n){t=t||[];for(var r=[],time=0,i=0;in))return i}return 0===r.length?0:r[r.length-1]}(this.currentTimeline_,l,t);else if(null!==this.mediaIndex){var c=l[this.mediaIndex],h="number"==typeof this.partIndex?this.partIndex:-1;d.startOfSegment=c.end?c.end:t,c.parts&&c.parts[h+1]?(d.mediaIndex=this.mediaIndex,d.partIndex=h+1):d.mediaIndex=this.mediaIndex+1}else{var f=Ga.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),m=f.segmentIndex,v=f.startTime,_=f.partIndex;d.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),d.mediaIndex=m,d.startOfSegment=v,d.partIndex=_}var y=l[d.mediaIndex],T=y&&"number"==typeof d.partIndex&&y.parts&&y.parts[d.partIndex];if(!y||"number"==typeof d.partIndex&&!T)return null;if("number"!=typeof d.partIndex&&y.parts&&(d.partIndex=0,T=y.parts[0]),!n&&T&&!T.independent)if(0===d.partIndex){var S=l[d.mediaIndex-1],k=S.parts&&S.parts.length&&S.parts[S.parts.length-1];k&&k.independent&&(d.mediaIndex-=1,d.partIndex=S.parts.length-1,d.independent="previous segment")}else y.parts[d.partIndex-1].independent&&(d.partIndex-=1,d.independent="previous part");var C=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return d.mediaIndex>=l.length-1&&C&&!this.seeking_()?null:this.generateSegmentInfo_(d)},n.generateSegmentInfo_=function(e){var t=e.independent,n=e.playlist,r=e.mediaIndex,o=e.startOfSegment,l=e.isSyncRequest,d=e.partIndex,c=e.forceTimestampOffset,h=e.getMediaInfoForTime,f=n.segments[r],m="number"==typeof d&&f.parts[d],v={requestId:"segment-loader-"+Math.random(),uri:m&&m.resolvedUri||f.resolvedUri,mediaIndex:r,partIndex:m?d:null,isSyncRequest:l,startOfSegment:o,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:f.timeline,duration:m&&m.duration||f.duration,segment:f,part:m,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:h,independent:t},_=void 0!==c?c:this.isPendingTimestampOffset_;v.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:f.timeline,currentTimeline:this.currentTimeline_,startOfSegment:o,buffered:this.buffered_(),overrideCheck:_});var y=wa(this.sourceUpdater_.audioBuffered());return"number"==typeof y&&(v.audioAppendStart=y-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(v.gopsToAlignWith=function(e,t,n){if(null==t||!e.length)return[];var i,r=Math.ceil((t-n+3)*W.ONE_SECOND_IN_TS);for(i=0;ir);i++);return e.slice(i)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),v},n.timestampOffsetForSegment_=function(e){return n=(t=e).segmentTimeline,r=t.currentTimeline,o=t.startOfSegment,l=t.buffered,t.overrideCheck||n!==r?n "+c+" for "+e),function(e,t,n){if(!e[n]){t.trigger({type:"usage",name:"vhs-608"}),t.trigger({type:"usage",name:"hls-608"});var r=n;/^cc708_/.test(n)&&(r="SERVICE"+n.split("_")[1]);var track=t.textTracks().getTrackById(r);if(track)e[n]=track;else{var label=n,o=n,l=!1,d=(t.options_.vhs&&t.options_.vhs.captionServices||{})[r];d&&(label=d.label,o=d.language,l=d.default),e[n]=t.addRemoteTextTrack({kind:"captions",id:r,default:l,label:label,language:o},!1).track}}}(f,n.vhs_.tech_,e),bo(d,c,f[e]),function(e){var t=e.inbandTextTracks,n=e.captionArray,r=e.timestampOffset;if(n){var o=l.a.WebKitDataCue||l.a.VTTCue;n.forEach(function(caption){var track=caption.stream;t[track].addCue(new o(caption.startTime+r,caption.endTime+r,caption.text))})}}({captionArray:h,inbandTextTracks:f,timestampOffset:r})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));else this.logger_("SegmentLoader received no captions from a caption event")},n.handleId3_=function(e,t,n){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(this.pendingSegment_.hasAppendedData_){var r=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();!function(e,t,n){e.metadataTrack_||(e.metadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)}(this.inbandTextTracks_,n,this.vhs_.tech_),To({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:r,videoDuration:this.duration_()})}else this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,n))},n.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach(function(e){return e()}),this.metadataQueue_.caption.forEach(function(e){return e()}),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]},n.processCallQueue_=function(){var e=this.callQueue_;this.callQueue_=[],e.forEach(function(e){return e()})},n.processLoadQueue_=function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(function(e){return e()})},n.hasEnoughInfoToLoad_=function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!wo({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},n.getCurrentMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),e&&e.trackInfo||this.currentMediaInfo_},n.getMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),this.getCurrentMediaInfo_(e)||this.startingMediaInfo_},n.getPendingSegmentPlaylist=function(){return this.pendingSegment_?this.pendingSegment_.playlist:null},n.hasEnoughInfoToAppend_=function(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;var n=t.hasAudio,r=t.hasVideo,o=t.isMuxed;return!(r&&!e.videoTimingInfo)&&(!(n&&!this.audioDisabled_&&!o&&!e.audioTimingInfo)&&!wo({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},n.handleData_=function(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(!this.callQueue_.length&&this.hasEnoughInfoToAppend_()){var n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),n.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),n.isFmp4=e.isFmp4,n.timingInfo=n.timingInfo||{},n.isFmp4)this.trigger("fmp4"),n.timingInfo.start=n[Eo(t.type)].start;else{var r,o=this.getCurrentMediaInfo_(),l="main"===this.loaderType_&&o&&o.hasVideo;l&&(r=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:l,firstVideoFrameTimeForData:r,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(n,t.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:"main"===this.loaderType_});var d=this.chooseNextRequest_();if(d.mediaIndex!==n.mediaIndex||d.partIndex!==n.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,t)}}else this.callQueue_.push(this.handleData_.bind(this,e,t))},n.updateAppendInitSegmentStatus=function(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)},n.getInitSegmentAndUpdateState_=function(e){var t=e.type,n=e.initSegment,map=e.map,r=e.playlist;if(map){var o=vs(map);if(this.activeInitSegmentId_===o)return null;n=this.initSegmentForMap(map,!0).bytes,this.activeInitSegmentId_=o}return n&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,n):null},n.handleQuotaExceededError_=function(e,t){var n=this,r=e.segmentInfo,o=e.type,d=e.bytes,c=this.sourceUpdater_.audioBuffered(),h=this.sourceUpdater_.videoBuffered();c.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Ea(c).join(", ")),h.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Ea(h).join(", "));var f=c.length?c.start(0):0,m=c.length?c.end(c.length-1):0,v=h.length?h.start(0):0,_=h.length?h.end(h.length-1):0;if(m-f<=1&&_-v<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: "+d.byteLength+", audio buffer: "+Ea(c).join(", ")+", video buffer: "+Ea(h).join(", ")+", "),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:r,type:o,bytes:d}));var y=this.currentTime_()-1;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+y),this.remove(0,y,function(){n.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=l.a.setTimeout(function(){n.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),n.quotaExceededErrorRetryTimeout_=null,n.processCallQueue_()},1e3)},!0)},n.handleAppendError_=function(e,t){var n=e.segmentInfo,r=e.type,o=e.bytes;t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error(r+" append of "+o.length+"b failed for segment #"+n.mediaIndex+" in playlist "+n.playlist.id),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:n,type:r,bytes:o}))},n.appendToSourceBuffer_=function(e){var t,n,r,o=e.segmentInfo,l=e.type,d=e.initSegment,data=e.data,c=e.bytes;if(!c){var h=[data],f=data.byteLength;d&&(h.unshift(d),f+=d.byteLength),r=0,(t={bytes:f,segments:h}).bytes&&(n=new Uint8Array(t.bytes),t.segments.forEach(function(e){n.set(e,r),r+=e.byteLength})),c=n}this.sourceUpdater_.appendBuffer({segmentInfo:o,type:l,bytes:c},this.handleAppendError_.bind(this,{segmentInfo:o,type:l,bytes:c}))},n.handleSegmentTimingInfo_=function(e,t,n){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var r=this.pendingSegment_.segment,o=e+"TimingInfo";r[o]||(r[o]={}),r[o].transmuxerPrependedSeconds=n.prependedContentDuration||0,r[o].transmuxedPresentationStart=n.start.presentation,r[o].transmuxedDecodeStart=n.start.decode,r[o].transmuxedPresentationEnd=n.end.presentation,r[o].transmuxedDecodeEnd=n.end.decode,r[o].baseMediaDecodeTime=n.baseMediaDecodeTime}},n.appendData_=function(e,t){var n=t.type,data=t.data;if(data&&data.byteLength&&("audio"!==n||!this.audioDisabled_)){var r=this.getInitSegmentAndUpdateState_({type:n,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:r,data:data})}},n.loadSegment_=function(e){var t=this;this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push(function(){var n=f()({},e,{forceTimestampOffset:!0});f()(e,t.generateSegmentInfo_(n)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)})},n.updateTransmuxerAndRequestSegment_=function(e){var t=this;this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var n=this.createSimplifiedSegmentObj_(e),r=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),o=null!==this.mediaIndex,l=e.timeline!==this.currentTimeline_&&e.timeline>0,d=r||o&&l;this.logger_("Requesting "+Co(e)),n.map&&!n.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=so({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:n,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:d,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(n){var r=n.message,o=n.level,l=n.stream;t.logger_(Co(e)+" logged from transmuxer stream "+l+" as a "+o+": "+r)}})},n.trimBackBuffer_=function(e){var t=function(e,t,n){var r=t-Os.BACK_BUFFER_LENGTH;e.length&&(r=Math.max(r,e.start(0)));var o=t-n;return Math.min(o,r)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)},n.createSimplifiedSegmentObj_=function(e){var t=e.segment,n=e.part,r={resolvedUri:n?n.resolvedUri:t.resolvedUri,byterange:n?n.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},o=e.playlist.segments[e.mediaIndex-1];if(o&&o.timeline===t.timeline&&(o.videoTimingInfo?r.baseStartTime=o.videoTimingInfo.transmuxedDecodeEnd:o.audioTimingInfo&&(r.baseStartTime=o.audioTimingInfo.transmuxedDecodeEnd)),t.key){var l=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);r.key=this.segmentKey(t.key),r.key.iv=l}return t.map&&(r.map=this.initSegmentForMap(t.map)),r},n.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},n.saveBandwidthRelatedStats_=function(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e=r);i++);return e.slice(0,i).concat(t)}(this.gopBuffer_,n.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(r)}},n.setTimeMapping_=function(e){var t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)},n.updateMediaSecondsLoaded_=function(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration},n.shouldUpdateTransmuxerTimestampOffset_=function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())},n.trueSegmentStart_=function(e){var t=e.currentStart,n=e.playlist,r=e.mediaIndex,o=e.firstVideoFrameTimeForData,l=e.currentVideoTimestampOffset,d=e.useVideoTimingInfo,c=e.videoTimingInfo,h=e.audioTimingInfo;if(void 0!==t)return t;if(!d)return h.start;var f=n.segments[r-1];return 0!==r&&f&&void 0!==f.start&&f.end===o+l?c.start:o},n.waitForAppendsToComplete_=function(e){var t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:1/0}),void this.trigger("error");var n=t.hasAudio,r=t.hasVideo,o=t.isMuxed,l="main"===this.loaderType_&&r,d=!this.audioDisabled_&&n&&!o;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);l&&e.waitingOnAppends++,d&&e.waitingOnAppends++,l&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),d&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))},n.checkAppendsDone_=function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())},n.checkForIllegalMediaSwitch=function(e){var t=function(e,t,n){return"main"===e&&t&&n?n.hasAudio||n.hasVideo?t.hasVideo&&!n.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&n.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null}(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,blacklistDuration:1/0}),this.trigger("error"),!0)},n.updateSourceBufferTimestampOffset_=function(e){if(null!==e.timestampOffset&&"number"==typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){var t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}},n.getSegmentStartTimeForTimestampOffsetCalculation_=function(e){var t=e.videoTimingInfo,n=e.audioTimingInfo,r=e.timingInfo;return this.useDtsForTimestampOffset_?t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:n&&"number"==typeof n.transmuxedDecodeStart?n.transmuxedDecodeStart:r.start:r.start},n.updateTimingInfoEnd_=function(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),n="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;n&&(e.timingInfo.end="number"==typeof n.end?n.end:n.start+e.duration)},n.handleAppendsDone_=function(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});var t=xo(e,this.sourceType_);if(t&&("warn"===t.severity?ma.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",!e.isSyncRequest||(this.trigger("syncinfoupdate"),e.hasAppendedData_)){this.logger_("Appended "+Co(e)),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");var n=e.segment,r=e.part,o=n.end&&this.currentTime_()-n.end>3*e.playlist.targetDuration,l=r&&r.end&&this.currentTime_()-r.end>3*e.playlist.partTargetDuration;if(o||l)return this.logger_("bad "+(o?"segment":"part")+" "+Co(e)),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}else this.logger_("Throwing away un-appended sync request "+Co(e))},n.recordThroughput_=function(e){if(e.duration=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e},n.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},n.segmentRequestFinished_=function(e,t,n){var r=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===Qs&&this.handleTimeout_(),e.code===Xs?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var o=this.pendingSegment_;this.saveBandwidthRelatedStats_(o.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");var d=o.segment;if(d.map&&(d.map.bytes=t.map.bytes),o.bytes=t.bytes,"function"!=typeof l.a.WebVTT&&"function"==typeof this.loadVttJs)return this.state="WAITING_ON_VTTJS",void this.loadVttJs().then(function(){return r.segmentRequestFinished_(e,t,n)},function(){return r.stopForError({message:"Error loading vtt.js"})});d.requested=!0;try{this.parseVTTCues_(o)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(o,this.syncController_.timelines[o.timeline],this.playlist_),o.cues.length?o.timingInfo={start:o.cues[0].startTime,end:o.cues[o.cues.length-1].endTime}:o.timingInfo={start:o.startOfSegment,end:o.startOfSegment+o.duration},o.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");o.byteLength=o.bytes.byteLength,this.mediaSecondsLoaded+=d.duration,o.cues.forEach(function(e){r.subtitlesTrack_.addCue(r.featuresNativeTextTracks_?new l.a.VTTCue(e.startTime,e.endTime,e.text):e)}),function(track){var e=track.cues;if(e)for(var i=0;i1&&t.push(e[r]);t.length&&t.forEach(function(e){return track.removeCue(e)})}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"},n.handleData_=function(){},n.updateTimingInfoEnd_=function(){},n.parseVTTCues_=function(e){var t,n=!1;if("function"!=typeof l.a.WebVTT)throw new Zo;"function"==typeof l.a.TextDecoder?t=new l.a.TextDecoder("utf8"):(t=l.a.WebVTT.StringDecoder(),n=!0);var r=new l.a.WebVTT.Parser(l.a,l.a.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},r.oncue=e.cues.push.bind(e.cues),r.ontimestampmap=function(map){e.timestampmap=map},r.onparsingerror=function(e){ma.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var o=e.segment.map.bytes;n&&(o=$o(o)),r.parse(o)}var d=e.bytes;n&&(d=$o(d)),r.parse(d),r.flush()},n.updateTimeMapping_=function(e,t,n){var r=e.segment;if(t)if(e.cues.length){var o=e.timestampmap,l=o.MPEGTS/W.ONE_SECOND_IN_TS-o.LOCAL+t.mapping;if(e.cues.forEach(function(e){e.startTime+=l,e.endTime+=l}),!n.syncInfo){var d=e.cues[0].startTime,c=e.cues[e.cues.length-1].startTime;n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:Math.min(d,c-r.duration)}}}else r.empty=!0},t}(Po),tl=function(track,e){for(var t=track.cues,i=0;i=n.adStartTime&&e<=n.adEndTime)return n}return null},il=[{name:"VOD",run:function(e,t,n,r,o){if(n!==1/0){return{time:0,segmentIndex:0,partIndex:null}}return null}},{name:"ProgramDateTime",run:function(e,t,n,r,o){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var l=null,d=null,c=Aa(t);o=o||0;for(var i=0;i=v)&&(d=v,l={time:m,segmentIndex:h.segmentIndex,partIndex:h.partIndex})}}return l}},{name:"Discontinuity",run:function(e,t,n,r,o){var l=null;if(o=o||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var d=null,i=0;i=m)&&(d=m,l={time:f.time,segmentIndex:c,partIndex:null})}}return l}},{name:"Playlist",run:function(e,t,n,r,o){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],nl=function(e){function t(t){var n;return(n=e.call(this)||this).timelines=[],n.discontinuities=[],n.timelineToDatetimeMappings={},n.logger_=_a("SyncController"),n}S()(t,e);var n=t.prototype;return n.getSyncPoint=function(e,t,n,r){var o=this.runStrategies_(e,t,n,r);return o.length?this.selectSyncPoint_(o,{key:"time",value:r}):null},n.getExpiredTime=function(e,t){if(!e||!e.segments)return null;var n=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!n.length)return null;var r=this.selectSyncPoint_(n,{key:"segmentIndex",value:0});return r.segmentIndex>0&&(r.time*=-1),Math.abs(r.time+Ua({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))},n.runStrategies_=function(e,t,n,r){for(var o=[],i=0;i86400)ma.log.warn("Not saving expired segment info. Media sequence gap "+n+" is too large.");else for(var i=n-1;i>=0;i--){var r=e.segments[i];if(r&&void 0!==r.start){t.syncInfo={mediaSequence:e.mediaSequence+i,time:r.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}},n.setDateTimeMappingForStart=function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],n=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-n}},n.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,n=e.shouldSaveTimelineMapping,r=this.calculateSegmentTimeMapping_(t,t.timingInfo,n),o=t.segment;r&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:o.start}));var l=o.dateTimeObject;o.discontinuity&&n&&l&&(this.timelineToDatetimeMappings[o.timeline]=-l.getTime()/1e3)},n.timestampOffsetForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].time},n.mappingForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping},n.calculateSegmentTimeMapping_=function(e,t,n){var r,o,l=e.segment,d=e.part,c=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)c={time:e.startOfSegment,mapping:e.startOfSegment-t.start},n&&(this.timelines[e.timeline]=c,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+c.time+"] [mapping: "+c.mapping+"]")),r=e.startOfSegment,o=t.end+c.mapping;else{if(!c)return!1;r=t.start+c.mapping,o=t.end+c.mapping}return d&&(d.start=r,d.end=o),(!l.start||rd){var time=void 0;time=l<0?n.start-Ua({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):n.end+Ua({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[o]={time:time,accuracy:d}}}},n.dispose=function(){this.trigger("dispose"),this.off()},t}(ma.EventTarget),rl=function(e){function t(){var t;return(t=e.call(this)||this).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}S()(t,e);var n=t.prototype;return n.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},n.pendingTimelineChange=function(e){var t=e.type,n=e.from,r=e.to;return"number"==typeof n&&"number"==typeof r&&(this.pendingTimelineChanges_[t]={type:t,from:n,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},n.lastTimelineChange=function(e){var t=e.type,n=e.from,r=e.to;return"number"==typeof n&&"number"==typeof r&&(this.lastTimelineChanges_[t]={type:t,from:n,to:r},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},n.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}(ma.EventTarget),al=Rs(Us(function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};function n(e,t,n){return e(n={path:t,exports:{},require:function(path,base){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==base&&n.path)}},n.exports),n.exports}var r=n(function(e){function t(e,t){for(var i=0;i-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var n=t.length,i=0;i>7))^i]=i;for(e=t=0;!f[e];e^=n||1,t=th[t]||1)for(s=(s=t^t<<1^t<<2^t<<3^t<<4)>>8^255&s^99,f[e]=s,m[s]=e,l=16843009*v[r=v[n=v[e]]]^65537*r^257*n^16843008*e,o=257*v[s]^16843008*s,i=0;i<4;i++)c[i][e]=o=o<<24^o>>>8,h[i][s]=l=l<<24^l>>>8;for(i=0;i<5;i++)c[i]=c[i].slice(0),h[i]=h[i].slice(0);return d}()),this._tables=[[h[0][0].slice(),h[0][1].slice(),h[0][2].slice(),h[0][3].slice(),h[0][4].slice()],[h[1][0].slice(),h[1][1].slice(),h[1][2].slice(),h[1][3].slice(),h[1][4].slice()]];var r=this._tables[0][4],o=this._tables[1],l=e.length,d=1;if(4!==l&&6!==l&&8!==l)throw new Error("Invalid aes key size");var c=e.slice(0),f=[];for(this._key=[c,f],i=l;i<4*l+28;i++)n=c[i-1],(i%l===0||8===l&&i%l===4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],i%l===0&&(n=n<<8^n>>>24^d<<24,d=d<<1^283*(d>>7))),c[i]=c[i-l]^n;for(t=0;i;t++,i--)n=c[3&t?i:i-4],f[t]=i<=4||t<4?n:o[0][r[n>>>24]]^o[1][r[n>>16&255]]^o[2][r[n>>8&255]]^o[3][r[255&n]]}return e.prototype.decrypt=function(e,t,n,r,o,l){var d,c,h,i,f=this._key[1],a=e^f[0],b=r^f[1],m=n^f[2],v=t^f[3],_=f.length/4-2,y=4,table=this._tables[1],T=table[0],S=table[1],k=table[2],C=table[3],E=table[4];for(i=0;i<_;i++)d=T[a>>>24]^S[b>>16&255]^k[m>>8&255]^C[255&v]^f[y],c=T[b>>>24]^S[m>>16&255]^k[v>>8&255]^C[255&a]^f[y+1],h=T[m>>>24]^S[v>>16&255]^k[a>>8&255]^C[255&b]^f[y+2],v=T[v>>>24]^S[a>>16&255]^k[b>>8&255]^C[255&m]^f[y+3],y+=4,a=d,b=c,m=h;for(i=0;i<4;i++)o[(3&-i)+l]=E[a>>>24]<<24^E[b>>16&255]<<16^E[m>>8&255]<<8^E[255&v]^f[y++],d=a,a=b,b=m,m=v,v=d},e}(),m=function(e){function t(){var t;return(t=e.call(this,d)||this).jobs=[],t.delay=1,t.timeout_=null,t}l(t,e);var n=t.prototype;return n.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},n.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(d),v=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},_=function(){function e(t,n,r,o){var l=e.STEP,d=new Int32Array(t.buffer),c=new Uint8Array(t.byteLength),i=0;for(this.asyncStream_=new m,this.asyncStream_.push(this.decryptChunk_(d.subarray(i,i+l),n,r,c)),i=l;i>2),S=new f(Array.prototype.slice.call(t)),k=new Uint8Array(e.byteLength),C=new Int32Array(k.buffer);for(r=n[0],o=n[1],l=n[2],d=n[3],y=0;y=0&&(t="main-desc"),t},cl=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},hl=function(e,t){t.activePlaylistLoader=e,e.load()},pl={AUDIO:function(e,t){return function(){var n=t.segmentLoaders[e],r=t.mediaTypes[e],o=t.blacklistCurrentPlaylist;cl(n,r);var l=r.activeTrack(),d=r.activeGroup(),c=(d.filter(function(e){return e.default})[0]||d[0]).id,h=r.tracks[c];if(l!==h){for(var f in ma.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),r.tracks)r.tracks[f].enabled=r.tracks[f]===h;r.onTrackChanged()}else o({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var n=t.segmentLoaders[e],r=t.mediaTypes[e];ma.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),cl(n,r);var track=r.activeTrack();track&&(track.mode="disabled"),r.onTrackChanged()}}},fl={AUDIO:function(e,t,n){if(t){var r=n.tech,o=n.requestOptions,l=n.segmentLoaders[e];t.on("loadedmetadata",function(){var e=t.media();l.playlist(e,o),(!r.paused()||e.endList&&"none"!==r.preload())&&l.load()}),t.on("loadedplaylist",function(){l.playlist(t.media(),o),r.paused()||l.load()}),t.on("error",pl[e](e,n))}},SUBTITLES:function(e,t,n){var r=n.tech,o=n.requestOptions,l=n.segmentLoaders[e],d=n.mediaTypes[e];t.on("loadedmetadata",function(){var e=t.media();l.playlist(e,o),l.track(d.activeTrack()),(!r.paused()||e.endList&&"none"!==r.preload())&&l.load()}),t.on("loadedplaylist",function(){l.playlist(t.media(),o),r.paused()||l.load()}),t.on("error",pl[e](e,n))}},ml={AUDIO:function(e,t){var n=t.vhs,r=t.sourceType,o=t.segmentLoaders[e],l=t.requestOptions,d=t.master.mediaGroups,c=t.mediaTypes[e],h=c.groups,f=c.tracks,m=c.logger_,v=t.masterPlaylistLoader,_=za(v.master);for(var y in d[e]&&0!==Object.keys(d[e]).length||(d[e]={main:{default:{default:!0}}},_&&(d[e].main.default.playlists=v.master.playlists)),d[e])for(var T in h[y]||(h[y]=[]),d[e][y]){var S=d[e][y][T],k=void 0;if(_?(m("AUDIO group '"+y+"' label '"+T+"' is a master playlist"),S.isMasterPlaylist=!0,k=null):k="vhs-json"===r&&S.playlists?new os(S.playlists[0],n,l):S.resolvedUri?new os(S.resolvedUri,n,l):S.playlists&&"dash"===r?new Ls(S.playlists[0],n,l,v):null,S=ma.mergeOptions({id:T,playlistLoader:k},S),fl[e](e,S.playlistLoader,t),h[y].push(S),void 0===f[T]){var track=new ma.AudioTrack({id:T,kind:ll(S),enabled:!1,language:S.language,default:S.default,label:T});f[T]=track}}o.on("error",pl[e](e,t))},SUBTITLES:function(e,t){var n=t.tech,r=t.vhs,o=t.sourceType,l=t.segmentLoaders[e],d=t.requestOptions,c=t.master.mediaGroups,h=t.mediaTypes[e],f=h.groups,m=h.tracks,v=t.masterPlaylistLoader;for(var _ in c[e])for(var y in f[_]||(f[_]=[]),c[e][_])if(!c[e][_][y].forced){var T=c[e][_][y],S=void 0;if("hls"===o)S=new os(T.resolvedUri,r,d);else if("dash"===o){if(!T.playlists.filter(function(p){return p.excludeUntil!==1/0}).length)return;S=new Ls(T.playlists[0],r,d,v)}else"vhs-json"===o&&(S=new os(T.playlists?T.playlists[0]:T.resolvedUri,r,d));if(T=ma.mergeOptions({id:y,playlistLoader:S},T),fl[e](e,T.playlistLoader,t),f[_].push(T),void 0===m[y]){var track=n.addRemoteTextTrack({id:y,kind:"subtitles",default:T.default&&T.autoselect,language:T.language,label:y},!1).track;m[y]=track}}l.on("error",pl[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var n=t.tech,r=t.master.mediaGroups,o=t.mediaTypes[e],l=o.groups,d=o.tracks;for(var c in r[e])for(var h in l[c]||(l[c]=[]),r[e][c]){var f=r[e][c][h];if(/^(?:CC|SERVICE)/.test(f.instreamId)){var m=n.options_.vhs&&n.options_.vhs.captionServices||{},v={label:h,language:f.language,instreamId:f.instreamId,default:f.default&&f.autoselect};if(m[v.instreamId]&&(v=ma.mergeOptions(v,m[v.instreamId])),void 0===v.default&&delete v.default,l[c].push(ma.mergeOptions({id:h},f)),void 0===d[h]){var track=n.addRemoteTextTrack({id:v.instreamId,kind:"captions",default:v.default,language:v.language,label:v.label},!1).track;d[h]=track}}}}},gl=function e(t,n){for(var i=0;i1&&za(t.master))for(var i=0;i "+l+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.masterPlaylistLoader_.media(e,n)},n.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=l.a.setInterval(function(){return e.checkABR_()},250)},n.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(l.a.clearInterval(this.abrTimer_),this.abrTimer_=null)},n.getAudioTrackPlaylists_=function(){var e=this.master(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var track,n=e.mediaGroups.AUDIO,r=Object.keys(n);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)track=this.mediaTypes_.AUDIO.activeTrack();else{var o=n.main||r.length&&n[r[0]];for(var label in o)if(o[label].default){track={label:label};break}}if(!track)return t;var l=[];for(var d in n)if(n[d][track.label]){var c=n[d][track.label];if(c.playlists&&c.playlists.length)l.push.apply(l,c.playlists);else if(c.uri)l.push(c);else if(e.playlists.length)for(var i=0;i1&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},n.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,n=this.tech_.currentTime(),r=this.bufferLowWaterLine(),o=this.bufferHighWaterLine();return function(e){var t=e.currentPlaylist,n=e.buffered,r=e.currentTime,o=e.nextPlaylist,l=e.bufferLowWaterLine,d=e.bufferHighWaterLine,c=e.duration,h=e.experimentalBufferBasedABR,f=e.log;if(!o)return ma.log.warn("We received no playlist to switch to. Please check your stream."),!1;var m="allowing switch "+(t&&t.id||"null")+" -> "+o.id;if(!t)return f(m+" as current playlist is not set"),!0;if(o.id===t.id)return!1;var v=Boolean(Sa(n,r).length);if(!t.endList)return v||"number"!=typeof t.partTargetDuration?(f(m+" as current playlist is live"),!0):(f("not "+m+" as current playlist is live llhls, but currentTime isn't in buffered."),!1);var _=Ia(n,r),y=h?Os.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Os.MAX_BUFFER_LOW_WATER_LINE;if(cS)&&_>=l){var C=m+" as forwardBuffer >= bufferLowWaterLine ("+_+" >= "+l+")";return h&&(C+=" and next bandwidth > current bandwidth ("+T+" > "+S+")"),f(C),!0}return f("not "+m+" as no switching criteria met"),!1}({buffered:this.tech_.buffered(),currentTime:n,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:r,bufferHighWaterLine:o,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},n.setupSegmentLoaderListeners_=function(){var e=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){e.checkABR_("bandwidthupdate"),e.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",function(){e.experimentalBufferBasedABR&&e.mainSegmentLoader_.load()}),this.experimentalBufferBasedABR||this.mainSegmentLoader_.on("progress",function(){e.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())}),this.mainSegmentLoader_.on("appenderror",function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"}),e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")}),this.mainSegmentLoader_.on("ended",function(){e.logger_("main segment loader ended"),e.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",function(t){e.experimentalBufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120))});var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()})},n.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},n.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},n.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},n.fastQualityChange_=function(e){var t=this;void 0===e&&(e=this.selectPlaylist()),e!==this.masterPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything(function(){ma.browser.IE_VERSION||ma.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())})):this.logger_("skipping fastQualityChange because new media is same as old")},n.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()this.maxPlaylistRetries?1/0:Date.now()+1e3*t,n.excludeUntil=r,e.reason&&(n.lastExcludeReason_=e.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});var h=this.selectPlaylist();if(!h)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var f=e.internal?this.logger_:ma.log.warn,m=e.message?" "+e.message:"";f((e.internal?"Internal problem":"Problem")+" encountered with playlist "+n.id+"."+m+" Switching to playlist "+h.id+"."),h.attributes.AUDIO!==n.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),h.attributes.SUBTITLES!==n.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var v=h.targetDuration/2*1e3||5e3,_="number"==typeof h.lastRequest&&Date.now()-h.lastRequest<=v;return this.switchMedia_(h,"exclude",d||_)},n.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},n.delegateLoaders_=function(filter,e){var t=this,n=[],r="all"===filter;(r||"main"===filter)&&n.push(this.masterPlaylistLoader_);var o=[];(r||"audio"===filter)&&o.push("AUDIO"),(r||"subtitle"===filter)&&(o.push("CLOSED-CAPTIONS"),o.push("SUBTITLES")),o.forEach(function(e){var r=t.mediaTypes_[e]&&t.mediaTypes_[e].activePlaylistLoader;r&&n.push(r)}),["main","audio","subtitle"].forEach(function(e){var r=t[e+"SegmentLoader_"];!r||filter!==e&&"all"!==filter||n.push(r)}),n.forEach(function(t){return e.forEach(function(e){"function"==typeof t[e]&&t[e]()})})},n.setCurrentTime=function(e){var t=Sa(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0},n.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Lo.Playlist.duration(e):1/0:0},n.seekable=function(){return this.seekable_},n.onSyncInfoUpdate_=function(){var e;if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media();if(t){var n=this.syncController_.getExpiredTime(t,this.duration());if(null!==n){var r=this.masterPlaylistLoader_.master,o=Lo.Playlist.seekable(t,n,Lo.Playlist.liveEdgeDelay(r,t));if(0!==o.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(n=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=Lo.Playlist.seekable(t,n,Lo.Playlist.liveEdgeDelay(r,t))).length)return}var l,d;this.seekable_&&this.seekable_.length&&(l=this.seekable_.end(0),d=this.seekable_.start(0)),e?e.start(0)>o.end(0)||o.start(0)>e.end(0)?this.seekable_=o:this.seekable_=ma.createTimeRanges([[e.start(0)>o.start(0)?e.start(0):o.start(0),e.end(0)0&&(r=Math.max(r,n.end(n.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}},n.dispose=function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(function(t){var n=e.mediaTypes_[t].groups;for(var r in n)n[r].forEach(function(e){e.playlistLoader&&e.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()},n.master=function(){return this.masterPlaylistLoader_.master},n.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},n.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),n=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!n)},n.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},n=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();t.video=t.main;var r=ho(this.master(),n),o={},l=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(o.video=r.video||t.main.videoCodec||R.b),t.main.isMuxed&&(o.video+=","+(r.audio||t.main.audioCodec||R.a)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||l)&&(o.audio=r.audio||t.main.audioCodec||t.audio.audioCodec||R.a,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),o.audio||o.video){var d,c={};if(["video","audio"].forEach(function(e){if(o.hasOwnProperty(e)&&(r=t[e].isFmp4,l=o[e],!(r?Object(R.c)(l):Object(R.g)(l)))){var n=t[e].isFmp4?"browser":"muxer";c[n]=c[n]||[],c[n].push(o[e]),"audio"===e&&(d=n)}var r,l}),l&&d&&n.attributes.AUDIO){var h=n.attributes.AUDIO;this.master().playlists.forEach(function(e){(e.attributes&&e.attributes.AUDIO)===h&&e!==n&&(e.excludeUntil=1/0)}),this.logger_("excluding audio group "+h+" as "+d+' does not support codec(s): "'+o.audio+'"')}if(!Object.keys(c).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var f=[];if(["video","audio"].forEach(function(t){var n=(Object(R.h)(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(Object(R.h)(o[t]||"")[0]||{}).type;n&&r&&n.toLowerCase()!==r.toLowerCase()&&f.push('"'+e.sourceUpdater_.codecs[t]+'" -> "'+o[t]+'"')}),f.length)return void this.blacklistCurrentPlaylist({playlist:n,message:"Codec switching not supported: "+f.join(", ")+".",blacklistDuration:1/0,internal:!0})}return o}var m=Object.keys(c).reduce(function(e,t){return e&&(e+=", "),e+=t+' does not support codec(s): "'+c[t].join(",")+'"'},"")+".";this.blacklistCurrentPlaylist({playlist:n,internal:!0,message:m,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:n,message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},n.tryToCreateSourceBuffers_=function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}},n.excludeUnsupportedVariants_=function(){var e=this,t=this.master().playlists,n=[];Object.keys(t).forEach(function(r){var o=t[r];if(-1===n.indexOf(o.id)){n.push(o.id);var l=ho(e.master,o),d=[];!l.audio||Object(R.g)(l.audio)||Object(R.c)(l.audio)||d.push("audio codec "+l.audio),!l.video||Object(R.g)(l.video)||Object(R.c)(l.video)||d.push("video codec "+l.video),l.text&&"stpp.ttml.im1t"===l.text&&d.push("text codec "+l.text),d.length&&(o.excludeUntil=1/0,e.logger_("excluding "+o.id+" for unsupported: "+d.join(", ")))}})},n.excludeIncompatibleVariants_=function(e){var t=this,n=[],r=this.master().playlists,o=uo(Object(R.h)(e)),l=co(o),d=o.video&&Object(R.h)(o.video)[0]||null,c=o.audio&&Object(R.h)(o.audio)[0]||null;Object.keys(r).forEach(function(e){var o=r[e];if(-1===n.indexOf(o.id)&&o.excludeUntil!==1/0){n.push(o.id);var h=[],f=ho(t.masterPlaylistLoader_.master,o),m=co(f);if(f.audio||f.video){if(m!==l&&h.push('codec count "'+m+'" !== "'+l+'"'),!t.sourceUpdater_.canChangeType()){var v=f.video&&Object(R.h)(f.video)[0]||null,_=f.audio&&Object(R.h)(f.audio)[0]||null;v&&d&&v.type.toLowerCase()!==d.type.toLowerCase()&&h.push('video codec "'+v.type+'" !== "'+d.type+'"'),_&&c&&_.type.toLowerCase()!==c.type.toLowerCase()&&h.push('audio codec "'+_.type+'" !== "'+c.type+'"')}h.length&&(o.excludeUntil=1/0,t.logger_("blacklisting "+o.id+": "+h.join(" && ")))}}})},n.updateAdCues_=function(e){var t=0,n=this.seekable();n.length&&(t=n.start(0)),function(e,track,t){if(void 0===t&&(t=0),e.segments)for(var n,r=t,i=0;i0&&this.logger_("resetting possible stalled download count for "+e+" loader"),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()},t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,n=t[e+"SegmentLoader_"],r=n.buffered_(),o=function(a,b){if(a===b)return!1;if(!a&&b||!b&&a)return!0;if(a.length!==b.length)return!0;for(var i=0;i=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),n=this.tech_.currentTime();this.afterSeekableWindow_(t,n,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1));if(this.beforeSeekableWindow_(t,n)){var r=t.start(0);e=r+(r===t.end(0)?0:Ta)}if(void 0!==e)return this.logger_("Trying to seek outside of seekable at time "+n+" with seekable range "+Ca(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;for(var o=this.masterPlaylistController_.sourceUpdater_,l=this.tech_.buffered(),d=o.audioBuffer?o.audioBuffered():null,c=o.videoBuffer?o.videoBuffered():null,h=this.media(),f=h.partTargetDuration?h.partTargetDuration:2*(h.targetDuration-ya),m=[d,c],i=0;i "+n.end(0)+"]. Attempting to resume playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"}),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}},t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var n=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+n),this.cancelTimer_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var r=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,o=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:t}))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;var l=ka(o,t);if(l.length>0){var d=l.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+d+", seeking to "+l.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*d,t),!0}return!1},t.afterSeekableWindow_=function(e,t,n,r){if(void 0===r&&(r=!1),!e.length)return!1;var o=e.end(e.length-1)+Ta;return!n.endList&&r&&(o=e.end(e.length-1)+3*n.targetDuration),t>o},t.beforeSeekableWindow_=function(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:o}}return null},e}(),El={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},wl=function e(t,n){var r=0,o=0,l=ma.mergeOptions(El,n);t.ready(function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"}),t.trigger({type:"usage",name:"hls-error-reload-initialized"})});var d=function(){o&&t.currentTime(o)},c=function(e){null!=e&&(o=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",d),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},h=function(){return Date.now()-r<1e3*l.errorInterval?(t.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void t.trigger({type:"usage",name:"hls-error-reload-canceled"})):l.getSource&&"function"==typeof l.getSource?(r=Date.now(),l.getSource.call(t,c)):void ma.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},f=function e(){t.off("loadedmetadata",d),t.off("error",h),t.off("dispose",e)};t.on("error",h),t.on("dispose",f),t.reloadSourceOnError=function(n){f(),e(t,n)}},Il="2.16.3",xl={PlaylistLoader:os,Playlist:Ga,utils:Ts,STANDARD_PLAYLIST_SELECTOR:yo,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.master.playlists.filter(Ga.isEnabled);return go(t,function(a,b){return vo(a,b)}),t.filter(function(t){return!!ho(e.playlists.master,t).video})[0]||null},lastBandwidthSelector:yo,movingAverageBandwidthSelector:function(e){var t=-1,n=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var r=this.useDevicePixelRatio&&l.a.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,n=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==n&&(t=e*this.systemBandwidth+(1-e)*t,n=this.systemBandwidth),_o(this.playlists.master,t,parseInt(mo(this.tech_.el(),"width"),10)*r,parseInt(mo(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},comparePlaylistBandwidth:vo,comparePlaylistResolution:function(e,t){var n,r;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(n=e.attributes.RESOLUTION.width),n=n||l.a.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(r=t.attributes.RESOLUTION.width),n===(r=r||l.a.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:n-r},xhr:cs()};Object.keys(Os).forEach(function(e){Object.defineProperty(xl,e,{get:function(){return ma.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),Os[e]},set:function(t){ma.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?ma.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):Os[e]=t}})});var Pl="videojs-vhs",Al=function(e,t){for(var n=t.media(),r=-1,i=0;i=n&&e>=n?Math.max(e,r):r}return e},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e,t=1/(this.bandwidth||1);return e=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){ma.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return n.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return n.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return n.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return n.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return n.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return n.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return n.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return n.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return n.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return n.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return n.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return n.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return n.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return Ea(n.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return n.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return n.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return n.tech_.name_},enumerable:!0},duration:{get:function(){return n.tech_.duration()},enumerable:!0},master:{get:function(){return n.playlists.master},enumerable:!0},playerDimensions:{get:function(){return n.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return Ea(n.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return n.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",function(){n.options_.useBandwidthFromLocalStorage&&function(e){if(!l.a.localStorage)return!1;var t=Dl();t=t?ma.mergeOptions(t,e):e;try{l.a.localStorage.setItem(Pl,JSON.stringify(t))}catch(e){return!1}}({bandwidth:n.bandwidth,throughput:Math.round(n.throughput)})}),this.masterPlaylistController_.on("selectedinitialmedia",function(){var e;(e=n).representations=function(){var t=e.masterPlaylistController_.master(),n=za(t)?e.masterPlaylistController_.getAudioTrackPlaylists_():t.playlists;return n?n.filter(function(e){return!Fa(e)}).map(function(t,i){return new Sl(e,t,t.id)}):[]}}),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",function(){n.setupEme_()}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.masterPlaylistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=l.a.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}},n.createKeySessions_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Ll({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.master.playlists}).then(function(){e.logger_("created EME key session"),e.masterPlaylistController_.sourceUpdater_.initializedEme()}).catch(function(t){e.logger_("error while creating EME key session",t),e.player_.error({message:"Failed to initialize media keys for EME",code:3})})},n.handleWaitingForKey_=function(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()},n.setupEme_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,n=Ol({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});this.player_.tech_.on("keystatuschange",function(t){if("output-restricted"===t.status){var n=e.masterPlaylistController_.master();if(n&&n.playlists){var r,o=[];if(n.playlists.forEach(function(e){e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height>=720&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,o.push(e))}),o.length)(r=ma.log).warn.apply(r,['DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.'].concat(o)),e.masterPlaylistController_.fastQualityChange_()}}}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==ma.browser.IE_VERSION&&n?this.createKeySessions_():this.masterPlaylistController_.sourceUpdater_.initializedEme()},n.setupQualityLevels_=function(){var e=this,t=ma.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",function(){var t,n;t=e.qualityLevels_,(n=e).representations().forEach(function(e){t.addQualityLevel(e)}),Al(t,n.playlists)}),this.playlists.on("mediachange",function(){Al(e.qualityLevels_,e.playlists)}))},t.version=function(){return{"@videojs/http-streaming":Il,"mux.js":"6.0.1","mpd-parser":"0.22.1","m3u8-parser":"4.8.0","aes-decrypter":"3.1.3"}},n.version=function(){return this.constructor.version()},n.canChangeType=function(){return Yo.canChangeType()},n.play=function(){this.masterPlaylistController_.play()},n.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},n.duration=function(){return this.masterPlaylistController_.duration()},n.seekable=function(){return this.masterPlaylistController_.seekable()},n.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&l.a.URL.revokeObjectURL&&(l.a.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),e.prototype.dispose.call(this)},n.convertToProgramTime=function(time,e){return bs({playlist:this.masterPlaylistController_.media(),time:time,callback:e})},n.seekToProgramTime=function(e,t,n,r){return void 0===n&&(n=!0),void 0===r&&(r=2),Ss({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:r,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},t}(ma.getComponent("Component")),Rl={name:"videojs-http-streaming",VERSION:Il,canHandleSource:function(e,t){void 0===t&&(t={});var n=ma.mergeOptions(ma.options,t);return Rl.canPlayType(e.type,n)},handleSource:function(source,e,t){void 0===t&&(t={});var n=ma.mergeOptions(ma.options,t);return e.vhs=new Ml(source,e,n),ma.hasOwnProperty("hls")||Object.defineProperty(e,"hls",{get:function(){return ma.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),e.vhs},configurable:!0}),e.vhs.xhr=cs(),e.vhs.src(source.src,source.type),e.vhs},canPlayType:function(e,t){var n=Object(U.a)(e);if(!n)return"";var r=Rl.getOverrideNative(t);return!xl.supportsTypeNatively(n)||r?"maybe":""},getOverrideNative:function(e){void 0===e&&(e={});var t=e,n=t.vhs,r=void 0===n?{}:n,o=t.hls,l=void 0===o?{}:o,d=!(ma.browser.IS_ANY_SAFARI||ma.browser.IS_IOS),c=r.overrideNative,h=void 0===c?d:c,f=l.overrideNative;return void 0!==f&&f||h}};(Object(R.c)("avc1.4d400d,mp4a.40.2")&&ma.getTech("Html5").registerSourceHandler(Rl,0),ma.VhsHandler=Ml,Object.defineProperty(ma,"HlsHandler",{get:function(){return ma.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),Ml},configurable:!0}),ma.VhsSourceHandler=Rl,Object.defineProperty(ma,"HlsSourceHandler",{get:function(){return ma.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),Rl},configurable:!0}),ma.Vhs=xl,Object.defineProperty(ma,"Hls",{get:function(){return ma.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),xl},configurable:!0}),ma.use||(ma.registerComponent("Hls",xl),ma.registerComponent("Vhs",xl)),ma.options.vhs=ma.options.vhs||{},ma.options.hls=ma.options.hls||{},ma.getPlugin&&ma.getPlugin("reloadSourceOnError"))||(ma.registerPlugin||ma.plugin)("reloadSourceOnError",function(e){wl(this,e)});t.a=ma}).call(this,n(30))}}]);