mediacms/static/lib/video-js/7.7.5/video.js

2 wiersze
459 KiB
JavaScript
Czysty Wina Historia

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

/*! For license information please see video.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("global/window"),require("global/document")):"function"==typeof define&&define.amd?define(["global/window","global/document"],t):(e=e||self).videojs=t(e.window,e.document)}(this,(function(e,t){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,t=t&&t.hasOwnProperty("default")?t.default:t;var i="7.7.5",n=[],r=function t(i){var r,s="info",a=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r("log",s,t)};return r=function(t,i){return function(r,s,a){var o=i.levels[s],u=new RegExp("^("+o+")$");if("log"!==r&&a.unshift(r.toUpperCase()+":"),a.unshift(t+":"),n){n.push([].concat(a));var l=n.length-1e3;n.splice(0,l>0?l:0)}if(e.console){var c=e.console[r];c||"debug"!==r||(c=e.console.info||e.console.log),c&&o&&u.test(r)&&c[Array.isArray(a)?"apply":"call"](e.console,a)}}}(i,a),a.createLogger=function(e){return t(i+": "+e)},a.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:s},a.level=function(e){if("string"==typeof e){if(!a.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');s=e}return s},(a.history=function(){return n?[].concat(n):[]}).filter=function(e){return(n||[]).filter((function(t){return new RegExp(".*"+e+".*").test(t[0])}))},a.history.clear=function(){n&&(n.length=0)},a.history.disable=function(){null!==n&&(n.length=0,n=null)},a.history.enable=function(){null===n&&(n=[])},a.error=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r("error",s,t)},a.warn=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r("warn",s,t)},a.debug=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r("debug",s,t)},a}("VIDEOJS"),s=r.createLogger;function a(e,t){return e(t={exports:{}},t.exports),t.exports}var o=a((function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},t.apply(this,arguments)}e.exports=t})),u=Object.prototype.toString,l=function(e){return d(e)?Object.keys(e):[]};function c(e,t){l(e).forEach((function(i){return t(e[i],i)}))}function h(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return Object.assign?o.apply(void 0,[e].concat(i)):(i.forEach((function(t){t&&c(t,(function(t,i){e[i]=t}))})),e)}function d(e){return!!e&&"object"==typeof e}function p(e){return d(e)&&"[object Object]"===u.call(e)&&e.constructor===Object}function f(t,i){if(!t||!i)return"";if("function"==typeof e.getComputedStyle){var n=e.getComputedStyle(t);return n?n.getPropertyValue(i)||n[i]:""}return""}function m(e){return"string"==typeof e&&Boolean(e.trim())}function g(e){if(e.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function v(){return t===e.document}function y(e){return d(e)&&1===e.nodeType}function _(){try{return e.parent!==e.self}catch(e){return!0}}function b(e){return function(i,n){if(!m(i))return t[e](null);m(n)&&(n=t.querySelector(n));var r=y(n)?n:t;return r[e]&&r[e](i)}}function T(e,i,n,s){void 0===e&&(e="div"),void 0===i&&(i={}),void 0===n&&(n={});var a=t.createElement(e);return Object.getOwnPropertyNames(i).forEach((function(e){var t=i[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(r.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 "+t+"."),a.setAttribute(e,t)):"textContent"===e?S(a,t):a[e]!==t&&(a[e]=t)})),Object.getOwnPropertyNames(n).forEach((function(e){a.setAttribute(e,n[e])})),s&&H(a,s),a}function S(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function k(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function C(e,t){return g(t),e.classList?e.classList.contains(t):(i=t,new RegExp("(^|\\s)"+i+"($|\\s)")).test(e.className);var i}function E(e,t){return e.classList?e.classList.add(t):C(e,t)||(e.className=(e.className+" "+t).trim()),e}function w(e,t){return e.classList?e.classList.remove(t):(g(t),e.className=e.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")),e}function P(e,t,i){var n=C(e,t);if("function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=!n),i!==n)return i?E(e,t):w(e,t),e}function L(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var n=t[i];null==n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)}))}function A(e){var t={};if(e&&e.attributes&&e.attributes.length>0)for(var i=e.attributes,n=i.length-1;n>=0;n--){var r=i[n].name,s=i[n].value;"boolean"!=typeof e[r]&&-1===",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+r+",")||(s=null!==s),t[r]=s}return t}function I(e,t){return e.getAttribute(t)}function x(e,t,i){e.setAttribute(t,i)}function O(e,t){e.removeAttribute(t)}function D(){t.body.focus(),t.onselectstart=function(){return!1}}function R(){t.onselectstart=function(){return!0}}function U(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((function(e){void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(f(e,"height"))),i.width||(i.width=parseFloat(f(e,"width"))),i}}function M(i){var n;if(i.getBoundingClientRect&&i.parentNode&&(n=i.getBoundingClientRect()),!n)return{left:0,top:0};var r=t.documentElement,s=t.body,a=r.clientLeft||s.clientLeft||0,o=e.pageXOffset||s.scrollLeft,u=n.left+o-a,l=r.clientTop||s.clientTop||0,c=e.pageYOffset||s.scrollTop,h=n.top+c-l;return{left:Math.round(u),top:Math.round(h)}}function N(e,t){var i={},n=M(e),r=e.offsetWidth,s=e.offsetHeight,a=n.top,o=n.left,u=t.pageY,l=t.pageX;return t.changedTouches&&(l=t.changedTouches[0].pageX,u=t.changedTouches[0].pageY),i.y=Math.max(0,Math.min(1,(a-u+s)/s)),i.x=Math.max(0,Math.min(1,(l-o)/r)),i}function B(e){return d(e)&&3===e.nodeType}function j(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function F(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((function(e){return"function"==typeof e&&(e=e()),y(e)||B(e)?e:"string"==typeof e&&/\S/.test(e)?t.createTextNode(e):void 0})).filter((function(e){return e}))}function H(e,t){return F(t).forEach((function(t){return e.appendChild(t)})),e}function V(e,t){return H(j(e),t)}function q(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 W,z=b("querySelector"),G=b("querySelectorAll"),K=Object.freeze({isReal:v,isEl:y,isInFrame:_,createEl:T,textContent:S,prependTo:k,hasClass:C,addClass:E,removeClass:w,toggleClass:P,setAttributes:L,getAttributes:A,getAttribute:I,setAttribute:x,removeAttribute:O,blockTextSelection:D,unblockTextSelection:R,getBoundingClientRect:U,findPosition:M,getPointerPosition:N,isTextNode:B,emptyEl:j,normalizeContent:F,appendContent:H,insertContent:V,isSingleLeftClick:q,$:z,$$:G}),X=!1,Y=function(){if(v()&&!1!==W.options.autoSetup){var e=Array.prototype.slice.call(t.getElementsByTagName("video")),i=Array.prototype.slice.call(t.getElementsByTagName("audio")),n=Array.prototype.slice.call(t.getElementsByTagName("video-js")),r=e.concat(i,n);if(r&&r.length>0)for(var s=0,a=r.length;s<a;s++){var o=r[s];if(!o||!o.getAttribute){$(1);break}void 0===o.player&&null!==o.getAttribute("data-setup")&&W(o)}else X||$(1)}};function $(t,i){i&&(W=i),e.setTimeout(Y,t)}function Q(){X=!0,e.removeEventListener("load",Q)}v()&&("complete"===t.readyState?Q():e.addEventListener("load",Q));var J,Z=function(e){var i=t.createElement("style");return i.className=e,i},ee=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t},te=3;function ie(){return te++}e.WeakMap||(J=function(){function t(){this.vdata="vdata"+Math.floor(e.performance&&e.performance.now()||Date.now()),this.data={}}var i=t.prototype;return i.set=function(e,t){var i=e[this.vdata]||ie();return e[this.vdata]||(e[this.vdata]=i),this.data[i]=t,this},i.get=function(e){var t=e[this.vdata];if(t)return this.data[t];r("We have no data for this element",e)},i.has=function(e){return e[this.vdata]in this.data},i.delete=function(e){var t=e[this.vdata];t&&(delete this.data[t],delete e[this.vdata])},t}());var ne,re=e.WeakMap?new WeakMap:new J;function se(e,t){if(re.has(e)){var i=re.get(e);0===i.handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&re.delete(e)}}function ae(e,t,i,n){i.forEach((function(i){e(t,i,n)}))}function oe(i){if(i.fixed_)return i;function n(){return!0}function r(){return!1}if(!i||!i.isPropagationStopped){var s=i||e.event;for(var a in i={},s)"layerX"!==a&&"layerY"!==a&&"keyLocation"!==a&&"webkitMovementX"!==a&&"webkitMovementY"!==a&&("returnValue"===a&&s.preventDefault||(i[a]=s[a]));if(i.target||(i.target=i.srcElement||t),i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement),i.preventDefault=function(){s.preventDefault&&s.preventDefault(),i.returnValue=!1,s.returnValue=!1,i.defaultPrevented=!0},i.defaultPrevented=!1,i.stopPropagation=function(){s.stopPropagation&&s.stopPropagation(),i.cancelBubble=!0,s.cancelBubble=!0,i.isPropagationStopped=n},i.isPropagationStopped=r,i.stopImmediatePropagation=function(){s.stopImmediatePropagation&&s.stopImmediatePropagation(),i.isImmediatePropagationStopped=n,i.stopPropagation()},i.isImmediatePropagationStopped=r,null!==i.clientX&&void 0!==i.clientX){var o=t.documentElement,u=t.body;i.pageX=i.clientX+(o&&o.scrollLeft||u&&u.scrollLeft||0)-(o&&o.clientLeft||u&&u.clientLeft||0),i.pageY=i.clientY+(o&&o.scrollTop||u&&u.scrollTop||0)-(o&&o.clientTop||u&&u.clientTop||0)}i.which=i.charCode||i.keyCode,null!==i.button&&void 0!==i.button&&(i.button=1&i.button?0:4&i.button?1:2&i.button?2:0)}return i.fixed_=!0,i}var ue=["touchstart","touchmove"];function le(t,i,n){if(Array.isArray(i))return ae(le,t,i,n);re.has(t)||re.set(t,{});var s=re.get(t);if(s.handlers||(s.handlers={}),s.handlers[i]||(s.handlers[i]=[]),n.guid||(n.guid=ie()),s.handlers[i].push(n),s.dispatcher||(s.disabled=!1,s.dispatcher=function(e,i){if(!s.disabled){e=oe(e);var n=s.handlers[e.type];if(n)for(var a=n.slice(0),o=0,u=a.length;o<u&&!e.isImmediatePropagationStopped();o++)try{a[o].call(t,e,i)}catch(e){r.error(e)}}}),1===s.handlers[i].length)if(t.addEventListener){var a=!1;(function(){if("boolean"!=typeof ne){ne=!1;try{var t=Object.defineProperty({},"passive",{get:function(){ne=!0}});e.addEventListener("test",null,t),e.removeEventListener("test",null,t)}catch(e){}}return ne})()&&ue.indexOf(i)>-1&&(a={passive:!0}),t.addEventListener(i,s.dispatcher,a)}else t.attachEvent&&t.attachEvent("on"+i,s.dispatcher)}function ce(e,t,i){if(re.has(e)){var n=re.get(e);if(n.handlers){if(Array.isArray(t))return ae(ce,e,t,i);var r=function(e,t){n.handlers[t]=[],se(e,t)};if(void 0!==t){var s=n.handlers[t];if(s)if(i){if(i.guid)for(var a=0;a<s.length;a++)s[a].guid===i.guid&&s.splice(a--,1);se(e,t)}else r(e,t)}else for(var o in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},o)&&r(e,o)}}}function he(e,t,i){var n=re.has(e)?re.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=oe(t),n.dispatcher&&n.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles)he.call(null,r,t,i);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){re.has(t.target)||re.set(t.target,{});var s=re.get(t.target);t.target[t.type]&&(s.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),s.disabled=!1)}return!t.defaultPrevented}function de(e,t,i){if(Array.isArray(t))return ae(de,e,t,i);var n=function n(){ce(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||ie(),le(e,t,n)}function pe(e,t,i){var n=function n(){ce(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||ie(),le(e,t,n)}var fe,me=Object.freeze({fixEvent:oe,on:le,off:ce,trigger:he,one:de,any:pe}),ge=30,ve=function(e,t,i){t.guid||(t.guid=ie());var n=t.bind(e);return n.guid=i?i+"_"+t.guid:t.guid,n},ye=function(t,i){var n=e.performance.now();return function(){var r=e.performance.now();r-n>=i&&(t.apply(void 0,arguments),n=r)}},_e=function(){};_e.prototype.allowedEvents_={},_e.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},le(this,e,t),this.addEventListener=i},_e.prototype.addEventListener=_e.prototype.on,_e.prototype.off=function(e,t){ce(this,e,t)},_e.prototype.removeEventListener=_e.prototype.off,_e.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},de(this,e,t),this.addEventListener=i},_e.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},pe(this,e,t),this.addEventListener=i},_e.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=oe(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),he(this,e)},_e.prototype.dispatchEvent=_e.prototype.trigger,_e.prototype.queueTrigger=function(t){var i=this;fe||(fe=new Map);var n=t.type||t,r=fe.get(this);r||(r=new Map,fe.set(this,r));var s=r.get(n);r.delete(n),e.clearTimeout(s);var a=e.setTimeout((function(){0===r.size&&(r=null,fe.delete(i)),i.trigger(t)}),0);r.set(n,a)};var be=function(e){return e instanceof _e||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"==typeof e[t]}))},Te=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},Se=function(e){if(!e.nodeName&&!be(e))throw new Error("Invalid target; must be a DOM node or evented object.")},ke=function(e){if(!Te(e))throw new Error("Invalid event type; must be a non-empty string or array.")},Ce=function(e){if("function"!=typeof e)throw new Error("Invalid listener; must be a function.")},Ee=function(e,t){var i,n,r,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return s?(i=e.eventBusEl_,t.length>=3&&t.shift(),n=t[0],r=t[1]):(i=t[0],n=t[1],r=t[2]),Se(i),ke(n),Ce(r),{isTargetingSelf:s,target:i,type:n,listener:r=ve(e,r)}},we=function(e,t,i,n){Se(e),e.nodeName?me[t](e,i,n):e[t](i,n)},Pe={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Ee(this,i),s=r.isTargetingSelf,a=r.target,o=r.type,u=r.listener;if(we(a,"on",o,u),!s){var l=function(){return e.off(a,o,u)};l.guid=u.guid;var c=function(){return e.off("dispose",l)};c.guid=u.guid,we(this,"on","dispose",l),we(a,"on","dispose",c)}},one:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Ee(this,i),s=r.isTargetingSelf,a=r.target,o=r.type,u=r.listener;if(s)we(a,"one",o,u);else{var l=function t(){e.off(a,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)};l.guid=u.guid,we(a,"one",o,l)}},any:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Ee(this,i),s=r.isTargetingSelf,a=r.target,o=r.type,u=r.listener;if(s)we(a,"any",o,u);else{var l=function t(){e.off(a,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)};l.guid=u.guid,we(a,"any",o,l)}},off:function(e,t,i){if(!e||Te(e))ce(this.eventBusEl_,e,t);else{var n=e,r=t;Se(n),ke(r),Ce(i),i=ve(this,i),this.off("dispose",i),n.nodeName?(ce(n,r,i),ce(n,"dispose",i)):be(n)&&(n.off(r,i),n.off("dispose",i))}},trigger:function(e,t){return he(this.eventBusEl_,e,t)}};function Le(t,i){void 0===i&&(i={});var n=i.eventBusKey;if(n){if(!t[n].nodeName)throw new Error('The eventBusKey "'+n+'" does not refer to an element.');t.eventBusEl_=t[n]}else t.eventBusEl_=T("span",{className:"vjs-event-bus"});return h(t,Pe),t.eventedCallbacks&&t.eventedCallbacks.forEach((function(e){e()})),t.on("dispose",(function(){t.off(),e.setTimeout((function(){t.eventBusEl_=null}),0)})),t}var Ae={state:{},setState:function(e){var t,i=this;return"function"==typeof e&&(e=e()),c(e,(function(e,n){i.state[n]!==e&&((t=t||{})[n]={from:i.state[n],to:e}),i.state[n]=e})),t&&be(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function Ie(e,t){return h(e,Ae),e.state=h({},e.state,t),"function"==typeof e.handleStateChanged&&be(e)&&e.on("statechanged",e.handleStateChanged),e}var xe=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toLowerCase()}))},Oe=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))};function De(){for(var e={},t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.forEach((function(t){t&&c(t,(function(t,i){p(t)?(p(e[i])||(e[i]={}),e[i]=De(e[i],t)):e[i]=t}))})),e}var Re=function(){function t(t,i,n){if(!t&&this.play?this.player_=t=this:this.player_=t,this.isDisposed_=!1,this.parentComponent_=null,this.options_=De({},this.options_),i=this.options_=De(this.options_,i),this.id_=i.id||i.el&&i.el.id,!this.id_){var r=t&&t.id&&t.id()||"no_player";this.id_=r+"_component_"+ie()}var s;this.name_=i.name||null,i.el?this.el_=i.el:!1!==i.createEl&&(this.el_=this.createEl()),!1!==i.evented&&Le(this,{eventBusKey:this.el_?"el_":null}),Ie(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},e.Set||(s=function(){function e(){this.set_={}}var t=e.prototype;return t.has=function(e){return e in this.set_},t.delete=function(e){var t=this.has(e);return delete this.set_[e],t},t.add=function(e){return this.set_[e]=1,this},t.forEach=function(e,t){for(var i in this.set_)e.call(t,i,i,this)},e}()),this.setTimeoutIds_=e.Set?new Set:new s,this.setIntervalIds_=e.Set?new Set:new s,this.rafIds_=e.Set?new Set:new s,this.clearingTimersOnDispose_=!1,!1!==i.initChildren&&this.initChildren(),this.ready(n),!1!==i.reportTouchActivity&&this.enableTouchActivity()}var i=t.prototype;return i.dispose=function(){if(!this.isDisposed_){if(this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var e=this.children_.length-1;e>=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),re.has(this.el_)&&re.delete(this.el_),this.el_=null),this.player_=null}},i.isDisposed=function(){return Boolean(this.isDisposed_)},i.player=function(){return this.player_},i.options=function(e){return e?(this.options_=De(this.options_,e),this.options_):this.options_},i.el=function(){return this.el_},i.createEl=function(e,t,i){return T(e,t,i)},i.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),s=r&&r[n],a=n&&n.split("-")[0],o=r&&r[a],u=i;return s&&s[e]?u=s[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,(function(e,i){var n=t[i-1],r=n;return void 0===n&&(r=e),r}))),u},i.contentEl=function(){return this.contentEl_||this.el_},i.id=function(){return this.id_},i.name=function(){return this.name_},i.children=function(){return this.children_},i.getChildById=function(e){return this.childIndex_[e]},i.getChild=function(e){if(e)return this.childNameIndex_[e]},i.addChild=function(e,i,n){var r,s;if(void 0===i&&(i={}),void 0===n&&(n=this.children_.length),"string"==typeof e){s=Oe(e);var a=i.componentClass||s;i.name=s;var o=t.getComponent(a);if(!o)throw new Error("Component "+a+" does not exist");if("function"!=typeof o)return null;r=new o(this.player_||this,i)}else r=e;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(n,0,r),r.parentComponent_=this,"function"==typeof r.id&&(this.childIndex_[r.id()]=r),(s=s||r.name&&Oe(r.name()))&&(this.childNameIndex_[s]=r,this.childNameIndex_[xe(s)]=r),"function"==typeof r.el&&r.el()){var u=null;this.children_[n+1]&&this.children_[n+1].el_&&(u=this.children_[n+1].el_),this.contentEl().insertBefore(r.el(),u)}return r},i.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,i=this.children_.length-1;i>=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Oe(e.name())]=null,this.childNameIndex_[xe(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},i.initChildren=function(){var e=this,i=this.options_.children;if(i){var n,r=this.options_,s=t.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter((function(e){return!n.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((function(t){var n,r;return"string"==typeof t?r=i[n=t]||e.options_[n]||{}:(n=t.name,r=t),{name:n,opts:r}})).filter((function(e){var i=t.getComponent(e.opts.componentClass||Oe(e.name));return i&&!s.isTech(i)})).forEach((function(t){var i=t.name,n=t.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=e.options_.playerOptions;var s=e.addChild(i,n);s&&(e[i]=s)}}))}},i.buildCSSClass=function(){return""},i.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))},i.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)},i.$=function(e,t){return z(e,t||this.contentEl())},i.$$=function(e,t){return G(e,t||this.contentEl())},i.hasClass=function(e){return C(this.el_,e)},i.addClass=function(e){E(this.el_,e)},i.removeClass=function(e){w(this.el_,e)},i.toggleClass=function(e,t){P(this.el_,e,t)},i.show=function(){this.removeClass("vjs-hidden")},i.hide=function(){this.addClass("vjs-hidden")},i.lockShowing=function(){this.addClass("vjs-lock-showing")},i.unlockShowing=function(){this.removeClass("vjs-lock-showing")},i.getAttribute=function(e){return I(this.el_,e)},i.setAttribute=function(e,t){x(this.el_,e,t)},i.removeAttribute=function(e){O(this.el_,e)},i.width=function(e,t){return this.dimension("width",e,t)},i.height=function(e,t){return this.dimension("height",e,t)},i.dimensions=function(e,t){this.width(e,!0),this.height(t)},i.dimension=function(e,t,i){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(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+Oe(e)],10)},i.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=f(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+Oe(e);t=this.el_[i]}return t},i.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},i.currentWidth=function(){return this.currentDimension("width")},i.currentHeight=function(){return this.currentDimension("height")},i.focus=function(){this.el_.focus()},i.blur=function(){this.el_.blur()},i.handleKeyDown=function(e){this.player_&&(e.stopPropagation(),this.player_.handleKeyDown(e))},i.handleKeyPress=function(e){this.handleKeyDown(e)},i.emitTapEvents=function(){var t,i=0,n=null;this.on("touchstart",(function(r){1===r.touches.length&&(n={pageX:r.touches[0].pageX,pageY:r.touches[0].pageY},i=e.performance.now(),t=!0)})),this.on("touchmove",(function(e){if(e.touches.length>1)t=!1;else if(n){var i=e.touches[0].pageX-n.pageX,r=e.touches[0].pageY-n.pageY;Math.sqrt(i*i+r*r)>10&&(t=!1)}}));var r=function(){t=!1};this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",(function(r){n=null,!0===t&&e.performance.now()-i<200&&(r.preventDefault(),this.trigger("tap"))}))},i.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=ve(this.player(),this.player().reportUserActivity);this.on("touchstart",(function(){t(),this.clearInterval(e),e=this.setInterval(t,250)}));var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},i.setTimeout=function(t,i){var n,r=this;return t=ve(this,t),this.clearTimersOnDispose_(),n=e.setTimeout((function(){r.setTimeoutIds_.has(n)&&r.setTimeoutIds_.delete(n),t()}),i),this.setTimeoutIds_.add(n),n},i.clearTimeout=function(t){return this.setTimeoutIds_.has(t)&&(this.setTimeoutIds_.delete(t),e.clearTimeout(t)),t},i.setInterval=function(t,i){t=ve(this,t),this.clearTimersOnDispose_();var n=e.setInterval(t,i);return this.setIntervalIds_.add(n),n},i.clearInterval=function(t){return this.setIntervalIds_.has(t)&&(this.setIntervalIds_.delete(t),e.clearInterval(t)),t},i.requestAnimationFrame=function(t){var i,n=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),t=ve(this,t),i=e.requestAnimationFrame((function(){n.rafIds_.has(i)&&n.rafIds_.delete(i),t()})),this.rafIds_.add(i),i):this.setTimeout(t,1e3/60)},i.cancelAnimationFrame=function(t){return this.supportsRaf_?(this.rafIds_.has(t)&&(this.rafIds_.delete(t),e.cancelAnimationFrame(t)),t):this.clearTimeout(t)},i.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(function(){[["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((function(t){var i=t[0],n=t[1];e[i].forEach(e[n],e)})),e.clearingTimersOnDispose_=!1})))},t.registerComponent=function(e,i){if("string"!=typeof e||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var n=t.getComponent("Tech"),r=n&&n.isTech(i),s=t===i||t.prototype.isPrototypeOf(i.prototype);if(r||!s)throw new Error('Illegal component, "'+e+'"; '+(r?"techs must be registered using Tech.registerTech()":"must be a Component subclass")+".");e=Oe(e),t.components_||(t.components_={});var a=t.getComponent("Player");if("Player"===e&&a&&a.players){var o=a.players,u=Object.keys(o);if(o&&u.length>0&&u.map((function(e){return o[e]})).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return t.components_[e]=i,t.components_[xe(e)]=i,i},t.getComponent=function(e){if(e&&t.components_)return t.components_[e]},t}();Re.prototype.supportsRaf_="function"==typeof e.requestAnimationFrame&&"function"==typeof e.cancelAnimationFrame,Re.registerComponent("Component",Re);var Ue,Me=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},Ne=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t},Be=e.navigator&&e.navigator.userAgent||"",je=/AppleWebKit\/([\d.]+)/i.exec(Be),Fe=je?parseFloat(je.pop()):null,He=/iPod/i.test(Be),Ve=(Ue=Be.match(/OS (\d+)_/i))&&Ue[1]?Ue[1]:null,qe=/Android/i.test(Be),We=function(){var e=Be.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),ze=qe&&We<5&&Fe<537,Ge=/Firefox/i.test(Be),Ke=/Edge/i.test(Be),Xe=!Ke&&(/Chrome/i.test(Be)||/CriOS/i.test(Be)),Ye=function(){var e=Be.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),$e=function(){var e=/MSIE\s(\d+)\.\d/.exec(Be),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(Be)&&/rv:11.0/.test(Be)&&(t=11),t}(),Qe=/Safari/i.test(Be)&&!Xe&&!qe&&!Ke,Je=/Windows/i.test(Be),Ze=v()&&("ontouchstart"in e||e.navigator.maxTouchPoints||e.DocumentTouch&&e.document instanceof e.DocumentTouch),et=/iPad/i.test(Be)||Qe&&Ze&&!/iPhone/i.test(Be),tt=/iPhone/i.test(Be)&&!et,it=tt||et||He,nt=(Qe||it)&&!Xe,rt=Object.freeze({IS_IPOD:He,IOS_VERSION:Ve,IS_ANDROID:qe,ANDROID_VERSION:We,IS_NATIVE_ANDROID:ze,IS_FIREFOX:Ge,IS_EDGE:Ke,IS_CHROME:Xe,CHROME_VERSION:Ye,IE_VERSION:$e,IS_SAFARI:Qe,IS_WINDOWS:Je,TOUCH_ENABLED:Ze,IS_IPAD:et,IS_IPHONE:tt,IS_IOS:it,IS_ANY_SAFARI:nt});function st(e,t,i,n){return function(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function at(e){return 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:st.bind(null,"start",0,e),end:st.bind(null,"end",1,e)}}function ot(e,t){return Array.isArray(e)?at(e):void 0===e||void 0===t?at():at([[e,t]])}function ut(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=ot(0,0));for(var s=0;s<e.length;s++)i=e.start(s),(n=e.end(s))>t&&(n=t),r+=n-i;return r/t}for(var lt,ct={prefixed:!0},ht=[["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"]],dt=ht[0],pt=0;pt<ht.length;pt++)if(ht[pt][1]in t){lt=ht[pt];break}if(lt){for(var ft=0;ft<lt.length;ft++)ct[dt[ft]]=lt[ft];ct.prefixed=lt[0]!==dt[0]}function mt(e){if(e instanceof mt)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:d(e)&&("number"==typeof e.code&&(this.code=e.code),h(this,e)),this.message||(this.message=mt.defaultMessages[this.code]||"")}mt.prototype.code=0,mt.prototype.message="",mt.prototype.status=null,mt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],mt.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 gt=0;gt<mt.errorTypes.length;gt++)mt[mt.errorTypes[gt]]=gt,mt.prototype[mt.errorTypes[gt]]=gt;function vt(e){return null!=e&&"function"==typeof e.then}function yt(e){vt(e)&&e.then(null,(function(e){}))}var _t=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((function(t,i,n){return e[i]&&(t[i]=e[i]),t}),{cues:e.cues&&Array.prototype.map.call(e.cues,(function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}}))})},bt=a((function(e,t){function i(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return a[e];var i,s=String(e);return(i=n[s.toLowerCase()])?i:(i=r[s.toLowerCase()])||(1===s.length?s.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null==i)return!1;if("string"==typeof t){var s;if(s=n[t.toLowerCase()])return s===i;if(s=r[t.toLowerCase()])return s===i}else if("number"==typeof t)return t===i;return!1}};var n=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(s=97;s<123;s++)n[String.fromCharCode(s)]=s-32;for(var s=48;s<58;s++)n[s-48]=s;for(s=1;s<13;s++)n["f"+s]=s+111;for(s=0;s<10;s++)n["numpad "+s]=s+96;var a=t.names=t.title={};for(s in n)a[n[s]]=s;for(var o in r)n[o]=r[o]})),Tt=(bt.code,bt.codes,bt.aliases,bt.names,bt.title,function(i){function n(e,t){var n;return(n=i.call(this,e,t)||this).opened_=n.hasBeenOpened_=n.hasBeenFilled_=!1,n.closeable(!n.options_.uncloseable),n.content(n.options_.content),n.contentEl_=T("div",{className:"vjs-modal-dialog-content"},{role:"document"}),n.descEl_=T("p",{className:"vjs-modal-dialog-description vjs-control-text",id:n.el().getAttribute("aria-describedby")}),S(n.descEl_,n.description()),n.el_.appendChild(n.descEl_),n.el_.appendChild(n.contentEl_),n}Ne(n,i);var r=n.prototype;return r.createEl=function(){return i.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},r.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,i.prototype.dispose.call(this)},r.buildCSSClass=function(){return"vjs-modal-dialog vjs-hidden "+i.prototype.buildCSSClass.call(this)},r.label=function(){return this.localize(this.options_.label||"Modal Window")},r.description=function(){var e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e},r.open=function(){if(!this.opened_){var e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}},r.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},r.close=function(){if(this.opened_){var e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}},r.closeable=function(e){if("boolean"==typeof e){var t=this.closeable_=!!e,i=this.getChild("closeButton");if(t&&!i){var n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close)}!t&&i&&(this.off(i,"close",this.close),this.removeChild(i),i.dispose())}return this.closeable_},r.fill=function(){this.fillWith(this.content())},r.fillWith=function(e){var t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),V(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);var r=this.getChild("closeButton");r&&i.appendChild(r.el_)},r.empty=function(){this.trigger("beforemodalempty"),j(this.contentEl()),this.trigger("modalempty")},r.content=function(e){return void 0!==e&&(this.content_=e),this.content_},r.conditionalFocus_=function(){var e=t.activeElement,i=this.player_.el_;this.previouslyActiveEl_=null,(i.contains(e)||i===e)&&(this.previouslyActiveEl_=e,this.focus())},r.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},r.handleKeyDown=function(e){if(e.stopPropagation(),bt.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(bt.isEventKey(e,"Tab")){for(var i,n=this.focusableEls_(),r=this.el_.querySelector(":focus"),s=0;s<n.length;s++)if(r===n[s]){i=s;break}t.activeElement===this.el_&&(i=0),e.shiftKey&&0===i?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||i!==n.length-1||(n[0].focus(),e.preventDefault())}},r.focusableEls_=function(){var t=this.el_.querySelectorAll("*");return Array.prototype.filter.call(t,(function(t){return(t instanceof e.HTMLAnchorElement||t instanceof e.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof e.HTMLInputElement||t instanceof e.HTMLSelectElement||t instanceof e.HTMLTextAreaElement||t instanceof e.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof e.HTMLIFrameElement||t instanceof e.HTMLObjectElement||t instanceof e.HTMLEmbedElement||t.hasAttribute("tabindex")&&-1!==t.getAttribute("tabindex")||t.hasAttribute("contenteditable")}))},n}(Re));Tt.prototype.options_={pauseOnOpen:!0,temporary:!0},Re.registerComponent("ModalDialog",Tt);var St=function(e){function t(t){var i;void 0===t&&(t=[]),(i=e.call(this)||this).tracks_=[],Object.defineProperty(Me(i),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<t.length;n++)i.addTrack(t[n]);return i}Ne(t,e);var i=t.prototype;return i.addTrack=function(e){var t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.tracks_[t]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this}))},i.removeTrack=function(e){for(var t,i=0,n=this.length;i<n;i++)if(this[i]===e){(t=this[i]).off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},i.getTrackById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},t}(_e);for(var kt in St.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"},St.prototype.allowedEvents_)St.prototype["on"+kt]=null;var Ct=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)},Et=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].enabled){Ct(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}Ne(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&Ct(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,Ct(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(St),wt=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)},Pt=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].selected){wt(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(Me(i),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),i}Ne(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.selected&&wt(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,wt(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)},t}(St),Lt=function(e){function t(){return e.apply(this,arguments)||this}Ne(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;e.prototype.addTrack.call(this,t),this.queueChange_||(this.queueChange_=function(){return i.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return i.trigger("selectedlanguagechange")}),t.addEventListener("modechange",this.queueChange_),-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&(this.queueChange_&&t.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&t.removeEventListener("modechange",this.triggerSelectedlanguagechange_))},t}(St),At=function(){function e(e){void 0===e&&(e=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}var t=e.prototype;return t.addTrackElement_=function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)},t.getTrackElementByTrack_=function(e){for(var t,i=0,n=this.trackElements_.length;i<n;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t},t.removeTrackElement_=function(e){for(var t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}},e}(),It=function(){function e(t){e.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var t=e.prototype;return t.setCues_=function(e){var t=this.length||0,i=0,n=e.length;this.cues_=e,this.length_=e.length;var r=function(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})};if(t<n)for(i=t;i<n;i++)r.call(this,i)},t.getCueById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},e}(),xt={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Ot={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Dt={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Rt={disabled:"disabled",hidden:"hidden",showing:"showing"},Ut=function(e){function t(t){var i;void 0===t&&(t={}),i=e.call(this)||this;var n={id:t.id||"vjs_track_"+ie(),kind:t.kind||"",label:t.label||"",language:t.language||""},r=function(e){Object.defineProperty(Me(i),e,{get:function(){return n[e]},set:function(){}})};for(var s in n)r(s);return i}return Ne(t,e),t}(_e),Mt=function(i){var n=["protocol","hostname","port","pathname","search","hash","host"],r=t.createElement("a");r.href=i;var s,a=""===r.host&&"file:"!==r.protocol;a&&((s=t.createElement("div")).innerHTML='<a href="'+i+'"></a>',r=s.firstChild,s.setAttribute("style","display:none; position:absolute;"),t.body.appendChild(s));for(var o={},u=0;u<n.length;u++)o[n[u]]=r[n[u]];return"http:"===o.protocol&&(o.host=o.host.replace(/:80$/,"")),"https:"===o.protocol&&(o.host=o.host.replace(/:443$/,"")),o.protocol||(o.protocol=e.location.protocol),a&&t.body.removeChild(s),o},Nt=function(e){if(!e.match(/^https?:\/\//)){var i=t.createElement("div");i.innerHTML='<a href="'+e+'">x</a>',e=i.firstChild.href}return e},Bt=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},jt=function(t,i){void 0===i&&(i=e.location);var n=Mt(t);return(":"===n.protocol?i.protocol:n.protocol)+n.host!==i.protocol+i.host},Ft=Object.freeze({parseUrl:Mt,getAbsoluteURL:Nt,getFileExtension:Bt,isCrossOrigin:jt}),Ht=Object.prototype.toString,Vt=zt,qt=zt;function Wt(e,t,i){var n,r,s=e;return n=t,"[object Function]"===(r=Ht.call(n))||"function"==typeof n&&"[object RegExp]"!==r||"undefined"!=typeof window&&(n===window.setTimeout||n===window.alert||n===window.confirm||n===window.prompt)?(i=t,"string"==typeof e&&(s={uri:e})):s=o({},t,{uri:e}),s.callback=i,s}function zt(e,t,i){return Gt(t=Wt(e,t,i))}function Gt(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,n,r){t||(t=!0,e.callback(i,n,r))};function n(){var e=void 0;if(e=u.response?u.response:u.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(u),m)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(l),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,g)}function s(){if(!o){var t;clearTimeout(l),t=e.useXDR&&void 0===u.status?200:1223===u.status?204:u.status;var r=g,s=null;return 0!==t?(r={body:n(),statusCode:t,method:h,headers:{},url:c,rawRequest:u},u.getAllResponseHeaders&&(r.headers=function(e){var t={};return e?(e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();void 0===t[n]?t[n]=r:Array.isArray(t[n])?t[n].push(r):t[n]=[t[n],r]})),t):t}(u.getAllResponseHeaders()))):s=new Error("Internal XMLHttpRequest Error"),i(s,r,r.body)}}var a,o,u=e.xhr||null;u||(u=e.cors||e.useXDR?new zt.XDomainRequest:new zt.XMLHttpRequest);var l,c=u.url=e.uri||e.url,h=u.method=e.method||"GET",d=e.body||e.data,p=u.headers=e.headers||{},f=!!e.sync,m=!1,g={body:void 0,headers:{},statusCode:0,method:h,url:c,rawRequest:u};if("json"in e&&!1!==e.json&&(m=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==h&&"HEAD"!==h&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),d=JSON.stringify(!0===e.json?d:e.json))),u.onreadystatechange=function(){4===u.readyState&&setTimeout(s,0)},u.onload=s,u.onerror=r,u.onprogress=function(){},u.onabort=function(){o=!0},u.ontimeout=r,u.open(h,c,!f,e.username,e.password),f||(u.withCredentials=!!e.withCredentials),!f&&e.timeout>0&&(l=setTimeout((function(){if(!o){o=!0,u.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),u.setRequestHeader)for(a in p)p.hasOwnProperty(a)&&u.setRequestHeader(a,p[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(u.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(u),u.send(d||null),u}zt.XMLHttpRequest=e.XMLHttpRequest||function(){},zt.XDomainRequest="withCredentials"in new zt.XMLHttpRequest?zt.XMLHttpRequest:e.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],(function(e){zt["delete"===e?"del":e]=function(t,i,n){return(i=Wt(t,i,n)).method=e.toUpperCase(),Gt(i)}})),Vt.default=qt;var Kt=function(t,i){var n=new e.WebVTT.Parser(e,e.vttjs,e.WebVTT.StringDecoder()),s=[];n.oncue=function(e){i.addCue(e)},n.onparsingerror=function(e){s.push(e)},n.onflush=function(){i.trigger({type:"loadeddata",target:i})},n.parse(t),s.length>0&&(e.console&&e.console.groupCollapsed&&e.console.groupCollapsed("Text Track parsing errors for "+i.src),s.forEach((function(e){return r.error(e)})),e.console&&e.console.groupEnd&&e.console.groupEnd()),n.flush()},Xt=function(t,i){var n={uri:t},s=jt(t);s&&(n.cors=s),Vt(n,ve(this,(function(t,n,s){if(t)return r.error(t,n);i.loaded_=!0,"function"!=typeof e.WebVTT?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],(function(e){if("vttjserror"!==e.type)return Kt(s,i);r.error("vttjs failed to load, stopping trying to process "+i.src)})):Kt(s,i)})))},Yt=function(t){function i(e){var i;if(void 0===e&&(e={}),!e.tech)throw new Error("A tech was not provided.");var n=De(e,{kind:Dt[e.kind]||"subtitles",language:e.language||e.srclang||""}),r=Rt[n.mode]||"disabled",s=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=t.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[],i.preload_=!1!==i.tech_.preloadTextTracks;var a=new It(i.cues_),o=new It(i.activeCues_),u=!1,l=ve(Me(i),(function(){this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1)}));return"disabled"!==r&&i.tech_.ready((function(){i.tech_.on("timeupdate",l)}),!0),Object.defineProperties(Me(i),{default:{get:function(){return s},set:function(){}},mode:{get:function(){return r},set:function(e){var t=this;Rt[e]&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||Xt(this.src,this),"disabled"!==r?this.tech_.ready((function(){t.tech_.on("timeupdate",l)}),!0):this.tech_.off("timeupdate",l),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?a:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i<n;i++){var r=this.cues[i];(r.startTime<=e&&r.endTime>=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(u=!1,t.length!==this.activeCues_.length)u=!0;else for(var s=0;s<t.length;s++)-1===this.activeCues_.indexOf(t[s])&&(u=!0);return this.activeCues_=t,o.setCues_(this.activeCues_),o},set:function(){}}}),n.src?(i.src=n.src,i.preload_||(i.loaded_=!0),(i.preload_||s||"subtitles"!==n.kind&&"captions"!==n.kind)&&Xt(i.src,Me(i))):i.loaded_=!0,i}Ne(i,t);var n=i.prototype;return n.addCue=function(t){var i=t;if(e.vttjs&&!(t instanceof e.vttjs.VTTCue)){for(var n in i=new e.vttjs.VTTCue(t.startTime,t.endTime,t.text),t)n in i||(i[n]=t[n]);i.id=t.id,i.originalCue_=t}for(var r=this.tech_.textTracks(),s=0;s<r.length;s++)r[s]!==this&&r[s].removeCue(i);this.cues_.push(i),this.cues.setCues_(this.cues_)},n.removeCue=function(e){for(var t=this.cues_.length;t--;){var i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}},i}(Ut);Yt.prototype.allowedEvents_={cuechange:"cuechange"};var $t=function(e){function t(t){var i;void 0===t&&(t={});var n=De(t,{kind:Ot[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(Me(i),"enabled",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("enabledchange"))}}),n.enabled&&(i.enabled=n.enabled),i.loaded_=!0,i}return Ne(t,e),t}(Ut),Qt=function(e){function t(t){var i;void 0===t&&(t={});var n=De(t,{kind:xt[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(Me(i),"selected",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("selectedchange"))}}),n.selected&&(i.selected=n.selected),i}return Ne(t,e),t}(Ut),Jt=function(e){function t(t){var i,n;void 0===t&&(t={}),i=e.call(this)||this;var r=new Yt(t);return i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i.default=r.default,Object.defineProperties(Me(i),{readyState:{get:function(){return n}},track:{get:function(){return r}}}),n=0,r.addEventListener("loadeddata",(function(){n=2,i.trigger({type:"load",target:Me(i)})})),i}return Ne(t,e),t}(_e);Jt.prototype.allowedEvents_={load:"load"},Jt.NONE=0,Jt.LOADING=1,Jt.LOADED=2,Jt.ERROR=3;var Zt={audio:{ListClass:Et,TrackClass:$t,capitalName:"Audio"},video:{ListClass:Pt,TrackClass:Qt,capitalName:"Video"},text:{ListClass:Lt,TrackClass:Yt,capitalName:"Text"}};Object.keys(Zt).forEach((function(e){Zt[e].getterName=e+"Tracks",Zt[e].privateName=e+"Tracks_"}));var ei={remoteText:{ListClass:Lt,TrackClass:Yt,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:At,TrackClass:Jt,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},ti=o({},Zt,ei);ei.names=Object.keys(ei),Zt.names=Object.keys(Zt),ti.names=[].concat(ei.names).concat(Zt.names);var ii=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function ni(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function ri(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function si(){this.values=ii(null)}function ai(e,t,i,n){var r=n?e.split(n):[e];for(var s in r)if("string"==typeof r[s]){var a=r[s].split(i);2===a.length&&t(a[0],a[1])}}function oi(e,t,i){var n=e;function r(){var t=ri(e);if(null===t)throw new ni(ni.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function s(){e=e.replace(/^\s+/,"")}if(s(),t.startTime=r(),s(),"--\x3e"!==e.substr(0,3))throw new ni(ni.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),s(),t.endTime=r(),s(),function(e,t){var n=new si;ai(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){n.set(e,i[r].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var s=t.split(","),a=s[0];n.integer(e,a),n.percent(e,a)&&n.set("snapToLines",!1),n.alt(e,a,["auto"]),2===s.length&&n.alt("lineAlign",s[1],["start","center","end"]);break;case"position":s=t.split(","),n.percent(e,s[0]),2===s.length&&n.alt("positionAlign",s[1],["start","center","end"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");try{t.line=n.get("line","auto")}catch(e){}t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100);try{t.align=n.get("align","center")}catch(e){t.align=n.get("align","middle")}try{t.position=n.get("position","auto")}catch(e){t.position=n.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=n.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}ni.prototype=ii(Error.prototype),ni.prototype.constructor=ni,ni.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},si.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var ui=t.createElement("textarea"),li={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},ci={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},hi={v:"title",lang:"lang"},di={rt:"ruby"};function pi(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function n(e,t){return!di[t.localName]||di[t.localName]===e.localName}function r(t,i){var n=li[t];if(!n)return null;var r=e.document.createElement(n),s=hi[t];return s&&i&&(r[s]=i.trim()),r}for(var s,a,o=e.document.createElement("div"),u=o,l=[];null!==(s=i());)if("<"!==s[0])u.appendChild(e.document.createTextNode((a=s,ui.innerHTML=a,a=ui.textContent,ui.textContent="",a)));else{if("/"===s[1]){l.length&&l[l.length-1]===s.substr(2).replace(">","")&&(l.pop(),u=u.parentNode);continue}var c,h=ri(s.substr(1,s.length-2));if(h){c=e.document.createProcessingInstruction("timestamp",h),u.appendChild(c);continue}var d=s.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!d)continue;if(!(c=r(d[1],d[3])))continue;if(!n(u,c))continue;if(d[2]){var p=d[2].split(".");p.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(ci.hasOwnProperty(i)){var n=t?"background-color":"color",r=ci[i];c.style[n]=r}})),c.className=p.join(" ")}l.push(d[1]),u.appendChild(c),u=c}return o}var fi=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function mi(e){for(var t=0;t<fi.length;t++){var i=fi[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function gi(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function n(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var s=i.match(/^.*(\n|\r)/);return s?(e.length=0,s[0]):i}return"ruby"===t.tagName?r(e):t.childNodes?(n(e,t),r(e)):void 0}for(n(t,e);i=r(t);)for(var s=0;s<i.length;s++)if(mi(i.charCodeAt(s)))return"rtl";return"ltr"}function vi(){}function yi(e,t,i){vi.call(this),this.cue=t,this.cueDiv=pi(e,t.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:gi(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function _i(e){var t,i,n,r;if(e.div){i=e.div.offsetHeight,n=e.div.offsetWidth,r=e.div.offsetTop;var s=(s=e.div.childNodes)&&(s=s[0])&&s.getClientRects&&s.getClientRects();e=e.div.getBoundingClientRect(),t=s?Math.max(s[0]&&s[0].height||0,e.height/s.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||i,this.bottom=e.bottom||r+(e.height||i),this.width=e.width||n,this.lineHeight=void 0!==t?t:e.lineHeight}function bi(e,t,i,n){var r=new _i(t),s=t.cue,a=function(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,n=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&n++;return-1*++n}(s),o=[];if(s.snapToLines){var u;switch(s.vertical){case"":o=["+y","-y"],u="height";break;case"rl":o=["+x","-x"],u="width";break;case"lr":o=["-x","+x"],u="width"}var l=r.lineHeight,c=l*Math.round(a),h=i[u]+l,d=o[0];Math.abs(c)>h&&(c=c<0?-1:1,c*=Math.ceil(h/l)*l),a<0&&(c+=""===s.vertical?i.height:i.width,o=o.reverse()),r.move(d,c)}else{var p=r.lineHeight/i.height*100;switch(s.lineAlign){case"center":a-=p/2;break;case"end":a-=p}switch(s.vertical){case"":t.applyStyles({top:t.formatStyle(a,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(a,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(a,"%")})}o=["+y","-x","+x","-y"],r=new _i(t)}var f=function(e,t){for(var r,s=new _i(e),a=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(i,t[o])||e.within(i)&&e.overlapsAny(n);)e.move(t[o]);if(e.within(i))return e;var u=e.intersectPercentage(i);a>u&&(r=new _i(e),a=u),e=new _i(s)}return r||s}(r,o);t.move(f.toCSSCompatValues(i))}function Ti(){}vi.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},vi.prototype.formatStyle=function(e,t){return 0===e?0:e+t},yi.prototype=ii(vi.prototype),yi.prototype.constructor=yi,_i.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},_i.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},_i.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},_i.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},_i.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},_i.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},_i.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},_i.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},Ti.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Ti.convertCueToDOMTree=function(e,t){return e&&t?pi(e,t):null},Ti.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}(t)){var r=[],s=_i.getSimpleBoxPosition(n),a={font:Math.round(.05*s.height*100)/100+"px sans-serif"};!function(){for(var i,o,u=0;u<t.length;u++)o=t[u],i=new yi(e,o,a),n.appendChild(i.div),bi(0,i,s,r),o.displayState=i.div,r.push(_i.getSimpleBoxPosition(i))}()}else for(var o=0;o<t.length;o++)n.appendChild(t[o].displayState)},Ti.Parser=function(e,t,i){i||(i=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]},Ti.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof ni))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t,i=this;function n(){for(var e=i.buffer,t=0;t<e.length&&"\r"!==e[t]&&"\n"!==e[t];)++t;var n=e.substr(0,t);return"\r"===e[t]&&++t,"\n"===e[t]&&++t,i.buffer=e.substr(t),n}e&&(i.buffer+=i.decoder.decode(e,{stream:!0}));try{var r;if("INITIAL"===i.state){if(!/\r\n|\n/.test(i.buffer))return this;var s=(r=n()).match(/^WEBVTT([ \t].*)?$/);if(!s||!s[0])throw new ni(ni.Errors.BadSignature);i.state="HEADER"}for(var a=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;switch(a?a=!1:r=n(),i.state){case"HEADER":/:/.test(r)?(t=r).match(/X-TIMESTAMP-MAP/)?ai(t,(function(e,t){switch(e){case"X-TIMESTAMP-MAP":!function(e){var t=new si;ai(e,(function(e,i){switch(e){case"MPEGT":t.integer(e+"S",i);break;case"LOCA":t.set(e+"L",ri(i))}}),/[^\d]:/,/,/),i.ontimestampmap&&i.ontimestampmap({MPEGTS:t.get("MPEGTS"),LOCAL:t.get("LOCAL")})}(t)}}),/=/):ai(t,(function(e,t){switch(e){case"Region":!function(e){var t=new si;if(ai(e,(function(e,i){switch(e){case"id":t.set(e,i);break;case"width":t.percent(e,i);break;case"lines":t.integer(e,i);break;case"regionanchor":case"viewportanchor":var n=i.split(",");if(2!==n.length)break;var r=new si;if(r.percent("x",n[0]),r.percent("y",n[1]),!r.has("x")||!r.has("y"))break;t.set(e+"X",r.get("x")),t.set(e+"Y",r.get("y"));break;case"scroll":t.alt(e,i,["up"])}}),/=/,/\s/),t.has("id")){var n=new(i.vttjs.VTTRegion||i.window.VTTRegion);n.width=t.get("width",100),n.lines=t.get("lines",3),n.regionAnchorX=t.get("regionanchorX",0),n.regionAnchorY=t.get("regionanchorY",100),n.viewportAnchorX=t.get("viewportanchorX",0),n.viewportAnchorY=t.get("viewportanchorY",100),n.scroll=t.get("scroll",""),i.onregion&&i.onregion(n),i.regionList.push({id:t.get("id"),region:n})}}(t)}}),/:/):r||(i.state="ID");continue;case"NOTE":r||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){i.state="NOTE";break}if(!r)continue;i.cue=new(i.vttjs.VTTCue||i.window.VTTCue)(0,0,"");try{i.cue.align="center"}catch(e){i.cue.align="middle"}if(i.state="CUE",-1===r.indexOf("--\x3e")){i.cue.id=r;continue}case"CUE":try{oi(r,i.cue,i.regionList)}catch(e){i.reportOrThrowError(e),i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(a=!0)){i.oncue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}i.cue.text&&(i.cue.text+="\n"),i.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(i.state="ID");continue}}}catch(e){i.reportOrThrowError(e),"CUETEXT"===i.state&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state="INITIAL"===i.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new ni(ni.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var Si=Ti,ki={"":1,lr:1,rl:1},Ci={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Ei(e){return"string"==typeof e&&!!Ci[e.toLowerCase()]&&e.toLowerCase()}function wi(e,t,i){this.hasBeenReset=!1;var n="",r=!1,s=e,a=t,o=i,u=null,l="",c=!0,h="auto",d="start",p="auto",f="auto",m=100,g="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(e){n=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");s=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");a=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(e){o=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(e){u=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return l},set:function(e){var t=function(e){return"string"==typeof e&&!!ki[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===t)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");l=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return h},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");h=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return d},set:function(e){var t=Ei(e);t?(d=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(e){var t=Ei(e);t?(f=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");m=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){var t=Ei(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}wi.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Pi=wi,Li={"":!0,up:!0};function Ai(e){return"number"==typeof e&&e>=0&&e<=100}var Ii=function(){var e=100,t=3,i=0,n=100,r=0,s=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!Ai(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!Ai(e))throw new Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!Ai(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(e){if(!Ai(e))throw new Error("ViewportAnchorY must be between 0 and 100.");s=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!Ai(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return a},set:function(e){var t=function(e){return"string"==typeof e&&!!Li[e.toLowerCase()]&&e.toLowerCase()}(e);!1===t?console.warn("Scroll: an invalid or illegal string was specified."):a=t}}})},xi=a((function(t){var i=t.exports={WebVTT:Si,VTTCue:Pi,VTTRegion:Ii};e.vttjs=i,e.WebVTT=i.WebVTT;var n=i.VTTCue,r=i.VTTRegion,s=e.VTTCue,a=e.VTTRegion;i.shim=function(){e.VTTCue=n,e.VTTRegion=r},i.restore=function(){e.VTTCue=s,e.VTTRegion=a},e.VTTCue||i.shim()}));xi.WebVTT,xi.VTTCue,xi.VTTRegion;var Oi=function(i){function n(e,t){var n;return void 0===e&&(e={}),void 0===t&&(t=function(){}),e.reportTouchActivity=!1,(n=i.call(this,null,e,t)||this).hasStarted_=!1,n.on("playing",(function(){this.hasStarted_=!0})),n.on("loadstart",(function(){this.hasStarted_=!1})),ti.names.forEach((function(t){var i=ti[t];e&&e[i.getterName]&&(n[i.privateName]=e[i.getterName])})),n.featuresProgressEvents||n.manualProgressOn(),n.featuresTimeupdateEvents||n.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((function(t){!1===e["native"+t+"Tracks"]&&(n["featuresNative"+t+"Tracks"]=!1)})),!1===e.nativeCaptions||!1===e.nativeTextTracks?n.featuresNativeTextTracks=!1:!0!==e.nativeCaptions&&!0!==e.nativeTextTracks||(n.featuresNativeTextTracks=!0),n.featuresNativeTextTracks||n.emulateTextTracks(),n.preloadTextTracks=!1!==e.preloadTextTracks,n.autoRemoteTextTracks_=new ti.text.ListClass,n.initTrackListeners(),e.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}Ne(n,i);var s=n.prototype;return s.triggerSourceset=function(e){var t=this;this.isReady_||this.one("ready",(function(){return t.setTimeout((function(){return t.triggerSourceset(e)}),1)})),this.trigger({src:e,type:"sourceset"})},s.manualProgressOn=function(){this.on("durationchange",this.onDurationChange),this.manualProgress=!0,this.one("ready",this.trackProgress)},s.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange)},s.trackProgress=function(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(ve(this,(function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()})),500)},s.onDurationChange=function(e){this.duration_=this.duration()},s.buffered=function(){return ot(0,0)},s.bufferedPercent=function(){return ut(this.buffered(),this.duration_)},s.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},s.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime),this.on("pause",this.stopTrackingCurrentTime)},s.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime),this.off("pause",this.stopTrackingCurrentTime)},s.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval((function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}),250)},s.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},s.dispose=function(){this.clearTracks(Zt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),i.prototype.dispose.call(this)},s.clearTracks=function(e){var t=this;(e=[].concat(e)).forEach((function(e){for(var i=t[e+"Tracks"]()||[],n=i.length;n--;){var r=i[n];"text"===e&&t.removeRemoteTextTrack(r),i.removeTrack(r)}}))},s.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var i=e[t];this.removeRemoteTextTrack(i)}},s.reset=function(){},s.error=function(e){return void 0!==e&&(this.error_=new mt(e),this.trigger("error")),this.error_},s.played=function(){return this.hasStarted_?ot(0,0):ot()},s.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},s.initTrackListeners=function(){var e=this;Zt.names.forEach((function(t){var i=Zt[t],n=function(){e.trigger(t+"trackchange")},r=e[i.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),e.on("dispose",(function(){r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)}))}))},s.addWebVttScript_=function(){var i=this;if(!e.WebVTT)if(t.body.contains(this.el())){if(!this.options_["vtt.js"]&&p(xi)&&Object.keys(xi).length>0)return void this.trigger("vttjsloaded");var n=t.createElement("script");n.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",n.onload=function(){i.trigger("vttjsloaded")},n.onerror=function(){i.trigger("vttjserror")},this.on("dispose",(function(){n.onload=null,n.onerror=null})),e.WebVTT=!0,this.el().parentNode.appendChild(n)}else this.ready(this.addWebVttScript_)},s.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),n=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();var s=function(){return e.trigger("texttrackchange")},a=function(){s();for(var e=0;e<t.length;e++){var i=t[e];i.removeEventListener("cuechange",s),"showing"===i.mode&&i.addEventListener("cuechange",s)}};a(),t.addEventListener("change",a),t.addEventListener("addtrack",a),t.addEventListener("removetrack",a),this.on("dispose",(function(){i.off("addtrack",n),i.off("removetrack",r),t.removeEventListener("change",a),t.removeEventListener("addtrack",a),t.removeEventListener("removetrack",a);for(var e=0;e<t.length;e++)t[e].removeEventListener("cuechange",s)}))},s.addTextTrack=function(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,i,n,r){void 0===r&&(r={});var s=e.textTracks();r.kind=t,i&&(r.label=i),n&&(r.language=n),r.tech=e;var a=new ti.text.TrackClass(r);return s.addTrack(a),a}(this,e,t,i)},s.createRemoteTextTrack=function(e){var t=De(e,{tech:this});return new ei.remoteTextEl.TrackClass(t)},s.addRemoteTextTrack=function(e,t){var i=this;void 0===e&&(e={});var n=this.createRemoteTextTrack(e);return!0!==t&&!1!==t&&(r.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),t=!0),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!0!==t&&this.ready((function(){return i.autoRemoteTextTracks_.addTrack(n.track)})),n},s.removeRemoteTextTrack=function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)},s.getVideoPlaybackQuality=function(){return{}},s.requestPictureInPicture=function(){var t=this.options_.Promise||e.Promise;if(t)return t.reject()},s.setPoster=function(){},s.playsinline=function(){},s.setPlaysinline=function(){},s.overrideNativeAudioTracks=function(){},s.overrideNativeVideoTracks=function(){},s.canPlayType=function(){return""},n.canPlayType=function(){return""},n.canPlaySource=function(e,t){return n.canPlayType(e.type)},n.isTech=function(e){return e.prototype instanceof n||e instanceof n||e===n},n.registerTech=function(e,t){if(n.techs_||(n.techs_={}),!n.isTech(t))throw new Error("Tech "+e+" must be a Tech");if(!n.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!n.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Oe(e),n.techs_[e]=t,n.techs_[xe(e)]=t,"Tech"!==e&&n.defaultTechOrder_.push(e),t},n.getTech=function(t){if(t)return n.techs_&&n.techs_[t]?n.techs_[t]:(t=Oe(t),e&&e.videojs&&e.videojs[t]?(r.warn("The "+t+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),e.videojs[t]):void 0)},n}(Re);ti.names.forEach((function(e){var t=ti[e];Oi.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Oi.prototype.featuresVolumeControl=!0,Oi.prototype.featuresMuteControl=!0,Oi.prototype.featuresFullscreenResize=!1,Oi.prototype.featuresPlaybackRate=!1,Oi.prototype.featuresProgressEvents=!1,Oi.prototype.featuresSourceset=!1,Oi.prototype.featuresTimeupdateEvents=!1,Oi.prototype.featuresNativeTextTracks=!1,Oi.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){var n=e.sourceHandlers;n||(n=e.sourceHandlers=[]),void 0===i&&(i=n.length),n.splice(i,0,t)},e.canPlayType=function(t){for(var i,n=e.sourceHandlers||[],r=0;r<n.length;r++)if(i=n[r].canPlayType(t))return i;return""},e.selectSourceHandler=function(t,i){for(var n=e.sourceHandlers||[],r=0;r<n.length;r++)if(n[r].canHandleSource(t,i))return n[r];return null},e.canPlaySource=function(t,i){var n=e.selectSourceHandler(t,i);return n?n.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach((function(e){var t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})}),e.prototype),e.prototype.setSource=function(t){var i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:r.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler),i!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},Re.registerComponent("Tech",Oi),Oi.registerTech("Tech",Oi),Oi.defaultTechOrder_=[];var Di={},Ri={},Ui={};function Mi(e,t,i){e.setTimeout((function(){return Vi(t,Di[t.type],i,e)}),1)}function Ni(e,t,i,n){void 0===n&&(n=null);var r="call"+Oe(i),s=e.reduce(Hi(r),n),a=s===Ui,o=a?null:t[i](s);return function(e,t,i,n){for(var r=e.length-1;r>=0;r--){var s=e[r];s[t]&&s[t](n,i)}}(e,i,o,a),o}var Bi={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1},ji={setCurrentTime:1,setMuted:1,setVolume:1},Fi={play:1,pause:1};function Hi(e){return function(t,i){return t===Ui?Ui:i[e]?i[e](t):t}}function Vi(e,t,i,n,r,s){void 0===e&&(e={}),void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===s&&(s=!1);var a=t,o=a[0],u=a.slice(1);if("string"==typeof o)Vi(e,Di[o],i,n,r,s);else if(o){var l=function(e,t){var i=Ri[e.id()],n=null;if(null==i)return n=t(e),Ri[e.id()]=[[t,n]],n;for(var r=0;r<i.length;r++){var s=i[r],a=s[0],o=s[1];a===t&&(n=o)}return null===n&&(n=t(e),i.push([t,n])),n}(n,o);if(!l.setSource)return r.push(l),Vi(e,u,i,n,r,s);l.setSource(h({},e),(function(t,a){if(t)return Vi(e,u,i,n,r,s);r.push(l),Vi(a,e.type===a.type?u:Di[a.type],i,n,r,s)}))}else u.length?Vi(e,u,i,n,r,s):s?i(e,r):Vi(e,Di["*"],i,n,r,!0)}var qi={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",oga:"audio/ogg",m3u8:"application/x-mpegURL",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Wi=function(e){void 0===e&&(e="");var t=Bt(e);return qi[t.toLowerCase()]||""},zi=function e(t){if(Array.isArray(t)){var i=[];t.forEach((function(t){t=e(t),Array.isArray(t)?i=i.concat(t):d(t)&&i.push(t)})),t=i}else t="string"==typeof t&&t.trim()?[Gi({src:t})]:d(t)&&"string"==typeof t.src&&t.src&&t.src.trim()?[Gi(t)]:[];return t};function Gi(e){if(!e.type){var t=Wi(e.src);t&&(e.type=t)}return e}var Ki=function(e){function t(t,i,n){var r,s=De({createEl:!1},i);if(r=e.call(this,t,s,n)||this,i.playerOptions.sources&&0!==i.playerOptions.sources.length)t.src(i.playerOptions.sources);else for(var a=0,o=i.playerOptions.techOrder;a<o.length;a++){var u=Oe(o[a]),l=Oi.getTech(u);if(u||(l=Re.getComponent(u)),l&&l.isSupported()){t.loadTech_(u);break}}return r}return Ne(t,e),t}(Re);Re.registerComponent("MediaLoader",Ki);var Xi=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).emitTapEvents(),n.enable(),n}Ne(t,e);var i=t.prototype;return i.createEl=function(t,i,n){void 0===t&&(t="div"),void 0===i&&(i={}),void 0===n&&(n={}),i=h({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass(),tabIndex:0},i),"button"===t&&r.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead."),n=h({role:"button"},n),this.tabIndex_=i.tabIndex;var s=e.prototype.createEl.call(this,t,i,n);return this.createControlTextEl(s),s},i.dispose=function(){this.controlTextEl_=null,e.prototype.dispose.call(this)},i.createControlTextEl=function(e){return this.controlTextEl_=T("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_},i.controlText=function(e,t){if(void 0===t&&(t=this.el()),void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,S(this.controlTextEl_,i),this.nonIconControl||t.setAttribute("title",i)},i.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)},i.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick),this.on("keydown",this.handleKeyDown))},i.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver),this.off("mouseout",this.handleMouseOut),this.off(["tap","click"],this.handleClick),this.off("keydown",this.handleKeyDown)},i.handleClick=function(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)},i.handleKeyDown=function(t){bt.isEventKey(t,"Space")||bt.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(Re);Re.registerComponent("ClickableComponent",Xi);var Yi=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update(),t.on("posterchange",ve(Me(n),n.update)),n}Ne(t,e);var i=t.prototype;return i.dispose=function(){this.player().off("posterchange",this.update),e.prototype.dispose.call(this)},i.createEl=function(){return T("div",{className:"vjs-poster",tabIndex:-1})},i.update=function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()},i.setSrc=function(e){var t="";e&&(t='url("'+e+'")'),this.el_.style.backgroundImage=t},i.handleClick=function(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?yt(this.player_.play()):this.player_.pause())},t}(Xi);Re.registerComponent("PosterImage",Yi);var $i={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 Qi(e,t){var i;if(4===e.length)i=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.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function Ji(e,t,i){try{e.style[t]=i}catch(e){return}}var Zi=function(t){function i(i,n,r){var s;s=t.call(this,i,n,r)||this;var a=ve(Me(s),s.updateDisplay);return i.on("loadstart",ve(Me(s),s.toggleDisplay)),i.on("texttrackchange",a),i.on("loadedmetadata",ve(Me(s),s.preselectTrack)),i.ready(ve(Me(s),(function(){if(i.tech_&&i.tech_.featuresNativeTextTracks)this.hide();else{i.on("fullscreenchange",a),i.on("playerresize",a),e.addEventListener("orientationchange",a),i.on("dispose",(function(){return e.removeEventListener("orientationchange",a)}));for(var t=this.options_.playerOptions.tracks||[],n=0;n<t.length;n++)this.player_.addRemoteTextTrack(t[n],!0);this.preselectTrack()}}))),s}Ne(i,t);var n=i.prototype;return n.preselectTrack=function(){for(var e,t,i,n={captions:1,subtitles:1},r=this.player_.textTracks(),s=this.player_.cache_.selectedLanguage,a=0;a<r.length;a++){var o=r[a];s&&s.enabled&&s.language&&s.language===o.language&&o.kind in n?o.kind===s.kind?i=o:i||(i=o):s&&!s.enabled?(i=null,e=null,t=null):o.default&&("descriptions"!==o.kind||e?o.kind in n&&!t&&(t=o):e=o)}i?i.mode="showing":t?t.mode="showing":e&&(e.mode="showing")},n.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},n.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},n.clearDisplay=function(){"function"==typeof e.WebVTT&&e.WebVTT.processCues(e,[],this.el_)},n.updateDisplay=function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var i=[],n=0;n<e.length;++n){var r=e[n];"showing"===r.mode&&i.push(r)}this.updateForTrack(i)}else{for(var s=null,a=null,o=e.length;o--;){var u=e[o];"showing"===u.mode&&("descriptions"===u.kind?s=u:a=u)}a?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(a)):s&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(s))}},n.updateDisplayState=function(t){for(var i=this.player_.textTrackSettings.getValues(),n=t.activeCues,r=n.length;r--;){var s=n[r];if(s){var a=s.displayState;if(i.color&&(a.firstChild.style.color=i.color),i.textOpacity&&Ji(a.firstChild,"color",Qi(i.color||"#fff",i.textOpacity)),i.backgroundColor&&(a.firstChild.style.backgroundColor=i.backgroundColor),i.backgroundOpacity&&Ji(a.firstChild,"backgroundColor",Qi(i.backgroundColor||"#000",i.backgroundOpacity)),i.windowColor&&(i.windowOpacity?Ji(a,"backgroundColor",Qi(i.windowColor,i.windowOpacity)):a.style.backgroundColor=i.windowColor),i.edgeStyle&&("dropshadow"===i.edgeStyle?a.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===i.edgeStyle?a.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===i.edgeStyle?a.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===i.edgeStyle&&(a.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),i.fontPercent&&1!==i.fontPercent){var o=e.parseFloat(a.style.fontSize);a.style.fontSize=o*i.fontPercent+"px",a.style.height="auto",a.style.top="auto",a.style.bottom="2px"}i.fontFamily&&"default"!==i.fontFamily&&("small-caps"===i.fontFamily?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=$i[i.fontFamily])}}},n.updateForTrack=function(t){if(Array.isArray(t)||(t=[t]),"function"==typeof e.WebVTT&&!t.every((function(e){return!e.activeCues}))){for(var i=[],n=0;n<t.length;++n)for(var r=t[n],s=0;s<r.activeCues.length;++s)i.push(r.activeCues[s]);e.WebVTT.processCues(e,i,this.el_);for(var a=0;a<t.length;++a){for(var o=t[a],u=0;u<o.activeCues.length;++u){var l=o.activeCues[u].displayState;E(l,"vjs-text-track-cue"),E(l,"vjs-text-track-cue-"+(o.language?o.language:a))}this.player_.textTrackSettings&&this.updateDisplayState(o)}}},i}(Re);Re.registerComponent("TextTrackDisplay",Zi);var en=function(e){function t(){return e.apply(this,arguments)||this}return Ne(t,e),t.prototype.createEl=function(){var t=this.player_.isAudio(),i=this.localize(t?"Audio Player":"Video Player"),n=T("span",{className:"vjs-control-text",innerHTML:this.localize("{1} is loading.",[i])}),r=e.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(n),r},t}(Re);Re.registerComponent("LoadingSpinner",en);var tn=function(e){function t(){return e.apply(this,arguments)||this}Ne(t,e);var i=t.prototype;return i.createEl=function(e,t,i){void 0===t&&(t={}),void 0===i&&(i={}),t=h({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass()},t),i=h({type:"button"},i);var n=Re.prototype.createEl.call(this,"button",t,i);return this.createControlTextEl(n),n},i.addChild=function(e,t){void 0===t&&(t={});var i=this.constructor.name;return r.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),Re.prototype.addChild.call(this,e,t)},i.enable=function(){e.prototype.enable.call(this),this.el_.removeAttribute("disabled")},i.disable=function(){e.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},i.handleKeyDown=function(t){bt.isEventKey(t,"Space")||bt.isEventKey(t,"Enter")?t.stopPropagation():e.prototype.handleKeyDown.call(this,t)},t}(Xi);Re.registerComponent("Button",tn);var nn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).mouseused_=!1,n.on("mousedown",n.handleMouseDown),n}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-big-play-button"},i.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY){var i=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;return yt(t),void(!this.player_.tech(!0)||($e||Ke)&&i||this.player_.tech(!0).focus())}var n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(r){var s=function(){return r.focus()};vt(t)?t.then(s,(function(){})):this.setTimeout(s,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(tn);nn.prototype.controlText_="Play Video",Re.registerComponent("BigPlayButton",nn);var rn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){bt.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(tn);Re.registerComponent("CloseButton",rn);var sn=function(e){function t(t,i){var n;return void 0===i&&(i={}),n=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,n.on(t,"play",n.handlePlay),n.on(t,"pause",n.handlePause),i.replay&&n.on(t,"ended",n.handleEnded),n}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",this.handleSeeked)},t}(tn);sn.prototype.controlText_="Play",Re.registerComponent("PlayToggle",sn);var an=function(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),s=Math.floor(t/60%60),a=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=i="-"),(r=r>0||a>0?r+":":"")+(n=((r||s>=10)&&n<10?"0"+n:n)+":")+(i<10?"0"+i:i)},on=an;function un(e,t){return void 0===t&&(t=e),on(e,t)}var ln=function(e){function i(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["timeupdate","ended"],n.updateContent),n.updateTextNode_(),n}Ne(i,e);var n=i.prototype;return n.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control",innerHTML:'<span class="vjs-control-text" role="presentation">'+this.localize(this.labelText_)+" </span>"});return this.contentEl_=T("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},n.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},n.updateTextNode_=function(e){var i=this;void 0===e&&(e=0),e=un(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestAnimationFrame((function(){if(i.contentEl_){var e=i.textNode_;i.textNode_=t.createTextNode(i.formattedTime_),i.textNode_&&(e?i.contentEl_.replaceChild(i.textNode_,e):i.contentEl_.appendChild(i.textNode_))}})))},n.updateContent=function(e){},i}(Re);ln.prototype.labelText_="Time",ln.prototype.controlText_="Time",Re.registerComponent("TimeDisplay",ln);var cn=function(e){function t(){return e.apply(this,arguments)||this}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)},t}(ln);cn.prototype.labelText_="Current Time",cn.prototype.controlText_="Current Time",Re.registerComponent("CurrentTimeDisplay",cn);var hn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",n.updateContent),n.on(t,"loadstart",n.updateContent),n.on(t,"loadedmetadata",n.updateContent),n}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},t}(ln);hn.prototype.labelText_="Duration",hn.prototype.controlText_="Duration",Re.registerComponent("DurationDisplay",hn);var dn=function(e){function t(){return e.apply(this,arguments)||this}return Ne(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"<div><span>/</span></div>"},{"aria-hidden":!0})},t}(Re);Re.registerComponent("TimeDivider",dn);var pn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",n.updateContent),n}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return t.insertBefore(T("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){var t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))},t}(ln);pn.prototype.labelText_="Remaining Time",pn.prototype.controlText_="Remaining Time",Re.registerComponent("RemainingTimeDisplay",pn);var fn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateShowing(),n.on(n.player(),"durationchange",n.updateShowing),n}Ne(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=T("div",{className:"vjs-live-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Stream Type")+" </span>"+this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(Re);Re.registerComponent("LiveDisplay",fn);var mn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateLiveEdgeStatus(),n.player_.liveTracker&&n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatus),n}Ne(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=T("span",{className:"vjs-seek-to-live-text",innerHTML:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(e){!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"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatus),this.textEl_=null,e.prototype.dispose.call(this)},t}(tn);mn.prototype.controlText_="Seek to live, currently playing live",Re.registerComponent("SeekToLive",mn);var gn=function(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))},vn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}Ne(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.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)},i.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}},i.createEl=function(t,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),i.className=i.className+" vjs-slider",i=h({tabIndex:0},i),n=h({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),e.prototype.createEl.call(this,t,i,n)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Xe||e.preventDefault(),D(),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)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;R(),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()},i.update=function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestAnimationFrame((function(){var i=e.vertical()?"height":"width";e.bar.el().style[i]=(100*t).toFixed(2)+"%"}))),t}},i.getProgress=function(){return Number(gn(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){var t=N(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){bt.isEventKey(t,"Left")||bt.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):bt.isEventKey(t,"Right")||bt.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.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}(Re);Re.registerComponent("Slider",vn);var yn=function(e,t){return gn(e/t*100,0,100).toFixed(2)+"%"},_n=function(e){function i(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",n.update),n}Ne(i,e);var n=i.prototype;return n.createEl=function(){var i=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),n=T("span",{className:"vjs-control-text"}),r=T("span",{textContent:this.localize("Loaded")}),s=t.createTextNode(": ");return this.percentageEl_=T("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),i.appendChild(n),n.appendChild(r),n.appendChild(s),n.appendChild(this.percentageEl_),i},n.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},n.update=function(e){var t=this;this.requestAnimationFrame((function(){var e=t.player_.liveTracker,i=t.player_.buffered(),n=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),s=t.partEls_,a=yn(r,n);t.percent_!==a&&(t.el_.style.width=a,S(t.percentageEl_,a),t.percent_=a);for(var o=0;o<i.length;o++){var u=i.start(o),l=i.end(o),c=s[o];c||(c=t.el_.appendChild(T()),s[o]=c),c.dataset.start===u&&c.dataset.end===l||(c.dataset.start=u,c.dataset.end=l,c.style.left=yn(u,r),c.style.width=yn(l-u,r))}for(var h=s.length;h>i.length;h--)t.el_.removeChild(s[h-1]);s.length=i.length}))},i}(Re);Re.registerComponent("LoadProgressBar",_n);var bn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=ye(ve(Me(n),n.update),ge),n}Ne(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var n=U(this.el_),r=U(this.player_.el()),s=e.width*t;if(r&&n){var a=e.left-r.left+s,o=e.width-s+(r.right-e.right),u=n.width/2;a<u?u+=u-a:o<u&&(u=o),u<0?u=0:u>n.width&&(u=n.width),this.el_.style.right="-"+u+"px",this.write(i)}},i.write=function(e){S(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame((function(){var s,a=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),u=o-t*o;s=(u<1?"":"-")+un(u,o)}else s=un(i,a);r.update(e,t,s),n&&n()}))},t}(Re);Re.registerComponent("TimeTooltip",bn);var Tn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=ye(ve(Me(n),n.update),ge),n}Ne(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}},t}(Re);Tn.prototype.options_={children:[]},it||qe||Tn.prototype.options_.children.push("timeTooltip"),Re.registerComponent("PlayProgressBar",Tn);var Sn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=ye(ve(Me(n),n.update),ge),n}Ne(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,(function(){i.el_.style.left=e.width*t+"px"}))},t}(Re);Sn.prototype.options_={children:["timeTooltip"]},Re.registerComponent("MouseTimeDisplay",Sn);var kn=function(e){function i(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}Ne(i,e);var n=i.prototype;return n.setEventHandlers_=function(){this.update_=ve(this,this.update),this.update=ye(this.update_,ge),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.on(this.player_,["playing"],this.enableInterval_),this.on(this.player_,["ended","pause","waiting"],this.disableInterval_),"hidden"in t&&"visibilityState"in t&&this.on(t,"visibilitychange",this.toggleVisibility_)},n.toggleVisibility_=function(e){t.hidden?this.disableInterval_(e):(this.enableInterval_(),this.update())},n.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,ge))},n.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&"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 i=this,n=e.prototype.update.call(this);return this.requestAnimationFrame((function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,r=i.player_.duration();t&&t.isLive()&&(r=i.player_.liveTracker.liveCurrentTime()),i.percent_!==n&&(i.el_.setAttribute("aria-valuenow",(100*n).toFixed(2)),i.percent_=n),i.currentTime_===e&&i.duration_===r||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[un(e,r),un(r,r)],"{1} of {2}")),i.currentTime_=e,i.duration_=r),i.bar&&i.bar.update(U(i.el()),i.getProgress())})),n},n.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},n.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},n.handleMouseDown=function(t){q(t)&&(t.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},n.handleMouseMove=function(e){if(q(e)){var t,i=this.calculateDistance(e),n=this.player_.liveTracker;if(n&&n.isLive()){var r=n.seekableStart(),s=n.liveCurrentTime();if((t=r+i*n.liveWindow())>=s&&(t=s),t<=r&&(t=r+.1),t===1/0)return}else(t=i*this.player_.duration())===this.player_.duration()&&(t-=.1);this.player_.currentTime(t)}},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?yt(this.player_.play()):this.update_()},n.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},n.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},n.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},n.handleKeyDown=function(t){if(bt.isEventKey(t,"Space")||bt.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(bt.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(0);else if(bt.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.duration());else if(/^[0-9]$/.test(bt(t))){t.preventDefault(),t.stopPropagation();var i=10*(bt.codes[bt(t)]-bt.codes[0])/100;this.player_.currentTime(this.player_.duration()*i)}else bt.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()-60)):bt.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i}(vn);kn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},it||qe||kn.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Re.registerComponent("SeekBar",kn);var Cn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=ye(ve(Me(n),n.handleMouseMove),ge),n.throttledHandleMouseSeek=ye(ve(Me(n),n.handleMouseSeek),ge),n.enable(),n}Ne(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(i||n){var r=t.el(),s=U(r),a=N(r,e).x;a=gn(0,1,a),n&&n.update(s,a),i&&i.update(s,t.getProgress())}}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){this.children().forEach((function(e){return e.disable&&e.disable()})),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDown),this.off(this.el_,"mousemove",this.handleMouseMove),this.handleMouseUp(),this.addClass("disabled"),this.enabled_=!1)},i.enable=function(){this.children().forEach((function(e){return e.enable&&e.enable()})),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDown),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseUp(e),this.off(t,"mousemove",this.throttledHandleMouseSeek),this.off(t,"touchmove",this.throttledHandleMouseSeek),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchend",this.handleMouseUp)},t}(Re);Cn.prototype.options_={children:["seekBar"]},Re.registerComponent("ProgressControl",Cn);var En=function(e){function i(i,n){var r;return(r=e.call(this,i,n)||this).on(i,["enterpictureinpicture","leavepictureinpicture"],r.handlePictureInPictureChange),t.pictureInPictureEnabled||r.disable(),r}Ne(i,e);var n=i.prototype;return n.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},n.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture")},n.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},i}(tn);En.prototype.controlText_="Picture-in-Picture",Re.registerComponent("PictureInPictureToggle",En);var wn=function(e){function i(i,n){var r;return(r=e.call(this,i,n)||this).on(i,"fullscreenchange",r.handleFullscreenChange),!1===t[i.fsApi_.fullscreenEnabled]&&r.disable(),r}Ne(i,e);var n=i.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()},i}(tn);wn.prototype.controlText_="Fullscreen",Re.registerComponent("FullscreenToggle",wn);var Pn=function(e){function t(){return e.apply(this,arguments)||this}return Ne(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})},t}(Re);Re.registerComponent("VolumeLevel",Pn);var Ln=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on("slideractive",n.updateLastVolume_),n.on(t,"volumechange",n.updateARIAAttributes),t.ready((function(){return n.updateARIAAttributes()})),n}Ne(t,e);var i=t.prototype;return i.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"})},i.handleMouseDown=function(t){q(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){q(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",(function(){0===e.player_.volume()&&e.player_.lastVolume_(t)}))},t}(vn);Ln.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},Ln.prototype.playerEvent="volumechange",Re.registerComponent("VolumeBar",Ln);var An=function(e){function t(t,i){var n;return void 0===i&&(i={}),i.vertical=i.vertical||!1,(void 0===i.volumeBar||p(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),n=e.call(this,t,i)||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")}))}(Me(n),t),n.throttledHandleMouseMove=ye(ve(Me(n),n.handleMouseMove),ge),n.on("mousedown",n.handleMouseDown),n.on("touchstart",n.handleMouseDown),n.on(n.volumeBar,["focus","slideractive"],(function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")})),n.on(n.volumeBar,["blur","sliderinactive"],(function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")})),n}Ne(t,e);var i=t.prototype;return i.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})},i.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.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},i.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.handleMouseUp),this.off(t,"touchend",this.handleMouseUp)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(Re);An.prototype.options_={children:["volumeBar"]},Re.registerComponent("VolumeControl",An);var In=function(e){function t(t,i){var n;return n=e.call(this,t,i)||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")}))}(Me(n),t),n.on(t,["loadstart","volumechange"],n.update),n}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;it&&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++)w(this.el_,"vjs-vol-"+i);E(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}(tn);In.prototype.controlText_="Mute",Re.registerComponent("MuteToggle",In);var xn=function(e){function i(t,i){var n;return void 0===i&&(i={}),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||p(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).on(t,["loadstart"],n.volumePanelState_),n.on(n.muteToggle,"keyup",n.handleKeyPress),n.on(n.volumeControl,"keyup",n.handleVolumeControlKeyUp),n.on("keydown",n.handleKeyPress),n.on("mouseover",n.handleMouseOver),n.on("mouseout",n.handleMouseOut),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}Ne(i,e);var n=i.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){bt.isEventKey(e,"Esc")&&this.muteToggle.focus()},n.handleMouseOver=function(e){this.addClass("vjs-hover"),le(t,"keyup",ve(this,this.handleKeyPress))},n.handleMouseOut=function(e){this.removeClass("vjs-hover"),ce(t,"keyup",ve(this,this.handleKeyPress))},n.handleKeyPress=function(e){bt.isEventKey(e,"Esc")&&this.handleMouseOut()},i}(Re);xn.prototype.options_={children:["muteToggle","volumeControl"]},Re.registerComponent("VolumePanel",xn);var On=function(e){function i(t,i){var n;return n=e.call(this,t,i)||this,i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",n.handleKeyDown),n.boundHandleBlur_=ve(Me(n),n.handleBlur),n.boundHandleTapClick_=ve(Me(n),n.handleTapClick),n}Ne(i,e);var n=i.prototype;return n.addEventListenerForItem=function(e){e instanceof Re&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},n.removeEventListenerForItem=function(e){e instanceof Re&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},n.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},n.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},n.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=T(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),le(i,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),i},n.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},n.handleBlur=function(e){var i=e.relatedTarget||t.activeElement;if(!this.children().some((function(e){return e.el()===i}))){var n=this.menuButton_;n&&n.buttonPressed_&&i!==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 i=t.filter((function(t){return t.el()===e.target}))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},n.handleKeyDown=function(e){bt.isEventKey(e,"Left")||bt.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(bt.isEventKey(e,"Right")||bt.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].className&&/vjs-menu-title/.test(t[0].className)&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())},i}(Re);Re.registerComponent("Menu",On);var Dn=function(e){function i(i,n){var r;void 0===n&&(n={}),(r=e.call(this,i,n)||this).menuButton_=new tn(i,n),r.menuButton_.controlText(r.controlText_),r.menuButton_.el_.setAttribute("aria-haspopup","true");var s=tn.prototype.buildCSSClass();return r.menuButton_.el_.className=r.buildCSSClass()+" "+s,r.menuButton_.removeClass("vjs-control"),r.addChild(r.menuButton_),r.update(),r.enabled_=!0,r.on(r.menuButton_,"tap",r.handleClick),r.on(r.menuButton_,"click",r.handleClick),r.on(r.menuButton_,"keydown",r.handleKeyDown),r.on(r.menuButton_,"mouseenter",(function(){r.addClass("vjs-hover"),r.menu.show(),le(t,"keyup",ve(Me(r),r.handleMenuKeyUp))})),r.on("mouseleave",r.handleMouseLeave),r.on("keydown",r.handleSubmenuKeyDown),r}Ne(i,e);var n=i.prototype;return n.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},n.createMenu=function(){var e=new On(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=T("li",{className:"vjs-menu-title",innerHTML:Oe(this.options_.title),tabIndex:-1});this.hideThreshold_+=1;var i=new Re(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var n=0;n<this.items.length;n++)e.addItem(this.items[n]);return e},n.createItems=function(){},n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},n.buildWrapperCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+tn.prototype.buildCSSClass()+" "+e.prototype.buildCSSClass.call(this)},n.buildCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+e.prototype.buildCSSClass.call(this)},n.controlText=function(e,t){return void 0===t&&(t=this.menuButton_.el()),this.menuButton_.controlText(e,t)},n.dispose=function(){this.handleMouseLeave(),e.prototype.dispose.call(this)},n.handleClick=function(e){this.buttonPressed_?this.unpressButton():this.pressButton()},n.handleMouseLeave=function(e){this.removeClass("vjs-hover"),ce(t,"keyup",ve(this,this.handleMenuKeyUp))},n.focus=function(){this.menuButton_.focus()},n.blur=function(){this.menuButton_.blur()},n.handleKeyDown=function(e){bt.isEventKey(e,"Esc")||bt.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),bt.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(bt.isEventKey(e,"Up")||bt.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))},n.handleMenuKeyUp=function(e){(bt.isEventKey(e,"Esc")||bt.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},n.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},n.handleSubmenuKeyDown=function(e){(bt.isEventKey(e,"Esc")||bt.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),bt.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))},n.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),it&&_())return;this.menu.focus()}},n.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},n.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},n.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},i}(Re);Re.registerComponent("MenuButton",Dn);var Rn=function(e){function t(t,i){var n,r=i.tracks;if((n=e.call(this,t,i)||this).items.length<=1&&n.hide(),!r)return Me(n);var s=ve(Me(n),n.update);return r.addEventListener("removetrack",s),r.addEventListener("addtrack",s),n.player_.on("ready",s),n.player_.on("dispose",(function(){r.removeEventListener("removetrack",s),r.removeEventListener("addtrack",s)})),n}return Ne(t,e),t}(Dn);Re.registerComponent("TrackButton",Rn);var Un=["Tab","Esc","Up","Down","Right","Left"],Mn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).selectable=i.selectable,n.isSelected_=i.selected||!1,n.multiSelectable=i.multiSelectable,n.selected(n.isSelected_),n.selectable?n.multiSelectable?n.el_.setAttribute("role","menuitemcheckbox"):n.el_.setAttribute("role","menuitemradio"):n.el_.setAttribute("role","menuitem"),n}Ne(t,e);var i=t.prototype;return i.createEl=function(t,i,n){return this.nonIconControl=!0,e.prototype.createEl.call(this,"li",h({className:"vjs-menu-item",innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+"</span>",tabIndex:-1},i),n)},i.handleKeyDown=function(t){Un.some((function(e){return bt.isEventKey(t,e)}))||e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){this.selected(!0)},i.selected=function(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))},t}(Xi);Re.registerComponent("MenuItem",Mn);var Nn=function(i){function n(n,r){var s,a=r.track,o=n.textTracks();r.label=a.label||a.language||"Unknown",r.selected="showing"===a.mode,(s=i.call(this,n,r)||this).track=a,s.kinds=(r.kinds||[r.kind||s.track.kind]).filter(Boolean);var u,l=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];s.handleTracksChange.apply(Me(s),t)},c=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];s.handleSelectedLanguageChange.apply(Me(s),t)};return n.on(["loadstart","texttrackchange"],l),o.addEventListener("change",l),o.addEventListener("selectedlanguagechange",c),s.on("dispose",(function(){n.off(["loadstart","texttrackchange"],l),o.removeEventListener("change",l),o.removeEventListener("selectedlanguagechange",c)})),void 0===o.onchange&&s.on(["tap","click"],(function(){if("object"!=typeof e.Event)try{u=new e.Event("change")}catch(e){}u||(u=t.createEvent("Event")).initEvent("change",!0,!0),o.dispatchEvent(u)})),s.handleTracksChange(),s}Ne(n,i);var r=n.prototype;return r.handleClick=function(e){var t=this.track,n=this.player_.textTracks();if(i.prototype.handleClick.call(this,e),n)for(var r=0;r<n.length;r++){var s=n[r];-1!==this.kinds.indexOf(s.kind)&&(s===t?"showing"!==s.mode&&(s.mode="showing"):"disabled"!==s.mode&&(s.mode="disabled"))}},r.handleTracksChange=function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)},r.handleSelectedLanguageChange=function(e){if("showing"===this.track.mode){var t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},r.dispose=function(){this.track=null,i.prototype.dispose.call(this)},n}(Mn);Re.registerComponent("TextTrackMenuItem",Nn);var Bn=function(e){function t(t,i){return i.track={player:t,kind:i.kind,kinds:i.kinds,default:!1,mode:"disabled"},i.kinds||(i.kinds=[i.kind]),i.label?i.track.label=i.label:i.track.label=i.kinds.join(" and ")+" off",i.selectable=!0,i.multiSelectable=!1,e.call(this,t,i)||this}Ne(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var s=t[n];if(this.options_.kinds.indexOf(s.kind)>-1&&"showing"===s.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var s=t[n];if(["captions","descriptions","subtitles"].indexOf(s.kind)>-1&&"showing"===s.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(Nn);Re.registerComponent("OffTextTrackMenuItem",Bn);var jn=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return Ne(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=Nn),this.label_&&(i=this.label_+" off"),e.push(new Bn(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<n.length;r++){var s=n[r];if(this.kinds_.indexOf(s.kind)>-1){var a=new t(this.player_,{track:s,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});a.addClass("vjs-"+s.kind+"-menu-item"),e.push(a)}}return e},t}(Rn);Re.registerComponent("TextTrackButton",jn);var Fn=function(e){function t(t,i){var n,r=i.track,s=i.cue,a=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=s.text,i.selected=s.startTime<=a&&a<s.endTime,(n=e.call(this,t,i)||this).track=r,n.cue=s,r.addEventListener("cuechange",ve(Me(n),n.update)),n}Ne(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},i.update=function(e){var t=this.cue,i=this.player_.currentTime();this.selected(t.startTime<=i&&i<t.endTime)},t}(Mn);Re.registerComponent("ChaptersTrackMenuItem",Fn);var Hn=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildWrapperCSSClass.call(this)},i.update=function(t){this.track_&&(!t||"addtrack"!==t.type&&"removetrack"!==t.type)||this.setTrack(this.findChaptersTrack()),e.prototype.update.call(this)},i.setTrack=function(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";var i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.addEventListener("load",this.updateHandler_)}}},i.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1;t>=0;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Oe(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.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<n;i++){var r=t[i],s=new Fn(this.player_,{track:this.track_,cue:r});e.push(s)}return e},t}(jn);Hn.prototype.kind_="chapters",Hn.prototype.controlText_="Chapters",Re.registerComponent("ChaptersButton",Hn);var Vn=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var s=t.textTracks(),a=ve(Me(r),r.handleTracksChange);return s.addEventListener("change",a),r.on("dispose",(function(){s.removeEventListener("change",a)})),r}Ne(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!1,n=0,r=t.length;n<r;n++){var s=t[n];if(s.kind!==this.kind_&&"showing"===s.mode){i=!0;break}}i?this.disable():this.enable()},i.buildCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(jn);Vn.prototype.kind_="descriptions",Vn.prototype.controlText_="Descriptions",Re.registerComponent("DescriptionsButton",Vn);var qn=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(jn);qn.prototype.kind_="subtitles",qn.prototype.controlText_="Subtitles",Re.registerComponent("SubtitlesButton",qn);var Wn=function(e){function t(t,i){var n;return i.track={player:t,kind:i.kind,label:i.kind+" settings",selectable:!1,default:!1,mode:"disabled"},i.selectable=!1,i.name="CaptionSettingsMenuItem",(n=e.call(this,t,i)||this).addClass("vjs-texttrack-settings"),n.controlText(", opens "+i.kind+" settings dialog"),n}return Ne(t,e),t.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},t}(Nn);Re.registerComponent("CaptionSettingsMenuItem",Wn);var zn=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-captions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-captions-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Wn(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t)},t}(jn);zn.prototype.kind_="captions",zn.prototype.controlText_="Captions",Re.registerComponent("CaptionsButton",zn);var Gn=function(e){function t(){return e.apply(this,arguments)||this}return Ne(t,e),t.prototype.createEl=function(t,i,n){var r='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"captions"===this.options_.track.kind&&(r+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Captions")+"</span>\n "),r+="</span>",e.prototype.createEl.call(this,t,h({innerHTML:r},i),n)},t}(Nn);Re.registerComponent("SubsCapsMenuItem",Gn);var Kn=function(e){function t(t,i){var n;return void 0===i&&(i={}),(n=e.call(this,t,i)||this).label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)>-1&&(n.label_="captions"),n.menuButton_.controlText(Oe(n.label_)),n}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Wn(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t,Gn)},t}(jn);Kn.prototype.kinds_=["captions","subtitles"],Kn.prototype.controlText_="Subtitles",Re.registerComponent("SubsCapsButton",Kn);var Xn=function(e){function t(t,i){var n,r=i.track,s=t.audioTracks();i.label=r.label||r.language||"Unknown",i.selected=r.enabled,(n=e.call(this,t,i)||this).track=r,n.addClass("vjs-"+r.kind+"-menu-item");var a=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(Me(n),t)};return s.addEventListener("change",a),n.on("dispose",(function(){s.removeEventListener("change",a)})),n}Ne(t,e);var i=t.prototype;return i.createEl=function(t,i,n){var r='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"main-desc"===this.options_.track.kind&&(r+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Descriptions")+"</span>\n "),r+="</span>",e.prototype.createEl.call(this,t,h({innerHTML:r},i),n)},i.handleClick=function(t){var i=this.player_.audioTracks();e.prototype.handleClick.call(this,t);for(var n=0;n<i.length;n++){var r=i[n];r.enabled=r===this.track}},i.handleTracksChange=function(e){this.selected(this.track.enabled)},t}(Mn);Re.registerComponent("AudioTrackMenuItem",Xn);var Yn=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.audioTracks(),e.call(this,t,i)||this}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-audio-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-audio-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(e){void 0===e&&(e=[]),this.hideThreshold_=1;for(var t=this.player_.audioTracks(),i=0;i<t.length;i++){var n=t[i];e.push(new Xn(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e},t}(Rn);Yn.prototype.controlText_="Audio Track",Re.registerComponent("AudioTrackButton",Yn);var $n=function(e){function t(t,i){var n,r=i.rate,s=parseFloat(r,10);return i.label=r,i.selected=1===s,i.selectable=!0,i.multiSelectable=!1,(n=e.call(this,t,i)||this).label=r,n.rate=s,n.on(t,"ratechange",n.update),n}Ne(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},i.update=function(e){this.selected(this.player().playbackRate()===this.rate)},t}(Mn);$n.prototype.contentElType="button",Re.registerComponent("PlaybackRateMenuItem",$n);var Qn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateVisibility(),n.updateLabel(),n.on(t,"loadstart",n.updateVisibility),n.on(t,"ratechange",n.updateLabel),n}Ne(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this);return this.labelEl_=T("div",{className:"vjs-playback-rate-value",innerHTML:"1x"}),t.appendChild(this.labelEl_),t},i.dispose=function(){this.labelEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildWrapperCSSClass.call(this)},i.createMenu=function(){var e=new On(this.player()),t=this.playbackRates();if(t)for(var i=t.length-1;i>=0;i--)e.addChild(new $n(this.player(),{rate:t[i]+"x"}));return e},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){for(var t=this.player().playbackRate(),i=this.playbackRates(),n=i[0],r=0;r<i.length;r++)if(i[r]>t){n=i[r];break}this.player().playbackRate(n)},i.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},t}(Dn);Qn.prototype.controlText_="Playback Rate",Re.registerComponent("PlaybackRateMenuButton",Qn);var Jn=function(e){function t(){return e.apply(this,arguments)||this}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},t}(Re);Re.registerComponent("Spacer",Jn);var Zn=function(e){function t(){return e.apply(this,arguments)||this}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){var t=e.prototype.createEl.call(this,{className:this.buildCSSClass()});return t.innerHTML=" ",t},t}(Jn);Re.registerComponent("CustomControlSpacer",Zn);var er=function(e){function t(){return e.apply(this,arguments)||this}return Ne(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(Re);er.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in t&&er.prototype.options_.children.splice(er.prototype.options_.children.length-1,0,"pictureInPictureToggle"),Re.registerComponent("ControlBar",er);var tr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",n.open),n}Ne(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(Tt);tr.prototype.options_=o({},Tt.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Re.registerComponent("ErrorDisplay",tr);var ir="vjs-text-track-settings",nr=["#000","Black"],rr=["#00F","Blue"],sr=["#0FF","Cyan"],ar=["#0F0","Green"],or=["#F0F","Magenta"],ur=["#F00","Red"],lr=["#FFF","White"],cr=["#FF0","Yellow"],hr=["1","Opaque"],dr=["0.5","Semi-Transparent"],pr=["0","Transparent"],fr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[nr,lr,ur,ar,rr,cr,or,sr]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[hr,dr,pr]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[lr,nr,ur,ar,rr,cr,or,sr]},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:[hr,dr]},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:[pr,dr,hr]}};function mr(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}fr.windowColor.options=fr.backgroundColor.options;var gr=function(t){function i(e,i){var n;return i.temporary=!1,(n=t.call(this,e,i)||this).updateDisplay=ve(Me(n),n.updateDisplay),n.fill(),n.hasBeenOpened_=n.hasBeenFilled_=!0,n.endDialog=T("p",{className:"vjs-control-text",textContent:n.localize("End of dialog window.")}),n.el().appendChild(n.endDialog),n.setDefaults(),void 0===i.persistTextTrackSettings&&(n.options_.persistTextTrackSettings=n.options_.playerOptions.persistTextTrackSettings),n.on(n.$(".vjs-done-button"),"click",(function(){n.saveSettings(),n.close()})),n.on(n.$(".vjs-default-button"),"click",(function(){n.setDefaults(),n.updateDisplay()})),c(fr,(function(e){n.on(n.$(e.selector),"change",n.updateDisplay)})),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}Ne(i,t);var n=i.prototype;return n.dispose=function(){this.endDialog=null,t.prototype.dispose.call(this)},n.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var r=fr[e],s=r.id.replace("%s",this.id_),a=[t,s].join(" ").trim();return["<"+i+' id="'+s+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(r.label),"</"+i+">",'<select aria-labelledby="'+a+'">'].concat(r.options.map((function(e){var t=s+"-"+e[1].replace(/\W+/g,"");return['<option id="'+t+'" value="'+e[0]+'" ','aria-labelledby="'+a+" "+t+'">',n.localize(e[1]),"</option>"].join("")}))).concat("</select>").join("")},n.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Text"),"</legend>",this.createElSelect_("color",e),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")},n.createElBgColor_=function(){var e="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",e),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")},n.createElWinColor_=function(){var e="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Window"),"</legend>",this.createElSelect_("windowColor",e),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")},n.createElColors_=function(){return T("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},n.createElFont_=function(){return T("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})},n.createElControls_=function(){var e=this.localize("restore all settings to the default values");return T("div",{className:"vjs-track-settings-controls",innerHTML:['<button type="button" class="vjs-default-button" title="'+e+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+e+"</span>","</button>",'<button type="button" class="vjs-done-button">'+this.localize("Done")+"</button>"].join("")})},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 t.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},n.getValues=function(){var e,t,i,n=this;return t=function(e,t,i){var r,s,a=(r=n.$(t.selector),s=t.parser,mr(r.options[r.options.selectedIndex].value,s));return void 0!==a&&(e[i]=a),e},void 0===(i={})&&(i=0),l(e=fr).reduce((function(i,n){return t(i,e[n],n)}),i)},n.setValues=function(e){var t=this;c(fr,(function(i,n){!function(e,t,i){if(t)for(var n=0;n<e.options.length;n++)if(mr(e.options[n].value,i)===t){e.selectedIndex=n;break}}(t.$(i.selector),e[n],i.parser)}))},n.setDefaults=function(){var e=this;c(fr,(function(t){var i=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=i}))},n.restoreSettings=function(){var t;try{t=JSON.parse(e.localStorage.getItem(ir))}catch(e){r.warn(e)}t&&this.setValues(t)},n.saveSettings=function(){if(this.options_.persistTextTrackSettings){var t=this.getValues();try{Object.keys(t).length?e.localStorage.setItem(ir,JSON.stringify(t)):e.localStorage.removeItem(ir)}catch(e){r.warn(e)}}},n.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},n.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,i=e&&e.captionsButton;t?t.focus():i&&i.focus()},i}(Tt);Re.registerComponent("TextTrackSettings",gr);var vr=function(t){function i(i,n){var r,s=n.ResizeObserver||e.ResizeObserver;null===n.ResizeObserver&&(s=!1);var a=De({createEl:!s,reportTouchActivity:!1},n);return(r=t.call(this,i,a)||this).ResizeObserver=n.ResizeObserver||e.ResizeObserver,r.loadListener_=null,r.resizeObserver_=null,r.debouncedHandler_=function(t,i,n,r){var s;void 0===r&&(r=e);var a=function(){var e=this,i=arguments,n=function(){s=null,n=null,t.apply(e,i)};r.clearTimeout(s),s=r.setTimeout(n,100)};return a.cancel=function(){r.clearTimeout(s),s=null},a}((function(){r.resizeHandler()}),0,0,Me(r)),s?(r.resizeObserver_=new r.ResizeObserver(r.debouncedHandler_),r.resizeObserver_.observe(i.el())):(r.loadListener_=function(){if(r.el_&&r.el_.contentWindow){var e=r.debouncedHandler_,t=r.unloadListener_=function(){ce(this,"resize",e),ce(this,"unload",t),t=null};le(r.el_.contentWindow,"unload",t),le(r.el_.contentWindow,"resize",e)}},r.one("load",r.loadListener_)),r}Ne(i,t);var n=i.prototype;return n.createEl=function(){return t.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1},{"aria-hidden":"true"})},n.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},n.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,t.prototype.dispose.call(this)},i}(Re);Re.registerComponent("ResizeManager",vr);var yr=function(e){function i(i,n){var r,s=De({createEl:!1},n);return(r=e.call(this,i,s)||this).reset_(),r.on(r.player_,"durationchange",r.handleDurationchange),$e&&"hidden"in t&&"visibilityState"in t&&r.on(t,"visibilitychange",r.handleVisibilityChange),r}Ne(i,e);var n=i.prototype;return n.handleVisibilityChange=function(){this.player_.duration()===1/0&&(t.hidden?this.stopTracking():this.startTracking())},n.isBehind_=function(){if(!this.timeupdateSeen_)return!1;var e=this.liveCurrentTime(),t=this.player_.currentTime(),i=2*this.seekableIncrement_+.07;return e!==1/0&&e-i>=t},n.trackLive_=function(){this.pastSeekEnd_=this.pastSeekEnd_;var e=this.player_.seekable();if(e&&e.length){var t,i,n,r=this.seekableEnd();r!==this.lastSeekEnd_&&(this.lastSeekEnd_&&(this.seekableIncrementList_=this.seekableIncrementList_.slice(-11),this.seekableIncrementList_.push(Math.abs(r-this.lastSeekEnd_)),this.seekableIncrementList_.length>3&&(this.seekableIncrement_=(t=this.seekableIncrementList_,i=Math.floor(t.length/2),n=[].concat(t).sort((function(e,t){return e-t})),t.length%2!=0?n[i]:(n[i-1]+n[i])/2))),this.pastSeekEnd_=0,this.lastSeekEnd_=r,this.trigger("seekableendchange")),this.pastSeekEnd()>1.5*this.seekableIncrement_?this.pastSeekEnd_=0:this.pastSeekEnd_=this.pastSeekEnd()+.03,this.isBehind_()!==this.behindLiveEdge()&&(this.behindLiveEdge_=this.isBehind_(),this.trigger("liveedgechange"))}},n.handleDurationchange=function(){this.player_.duration()===1/0?this.startTracking():this.stopTracking()},n.startTracking=function(){var e=this;this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLive_,ge),this.trackLive_(),this.on(this.player_,"play",this.trackLive_),this.on(this.player_,"pause",this.trackLive_),this.timeupdateSeen_||(this.one(this.player_,"play",this.handlePlay),this.handleTimeupdate=function(){e.timeupdateSeen_=!0,e.handleTimeupdate=null},this.one(this.player_,"timeupdate",this.handleTimeupdate)))},n.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge)},n.reset_=function(){this.pastSeekEnd_=0,this.lastSeekEnd_=null,this.behindLiveEdge_=null,this.timeupdateSeen_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.seekableIncrement_=12,this.seekableIncrementList_=[],this.off(this.player_,"play",this.trackLive_),this.off(this.player_,"pause",this.trackLive_),this.off(this.player_,"play",this.handlePlay),this.off(this.player_,"timeupdate",this.seekToLiveEdge),this.handleTimeupdate&&(this.off(this.player_,"timeupdate",this.handleTimeupdate),this.handleTimeupdate=null)},n.stopTracking=function(){this.isTracking()&&this.reset_()},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?1/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(){return this.pastSeekEnd_},n.behindLiveEdge=function(){return this.behindLiveEdge_},n.isTracking=function(){return"number"==typeof this.trackingInterval_},n.seekToLiveEdge=function(){this.atLiveEdge()||(this.player_.currentTime(this.liveCurrentTime()),this.player_.paused()&&this.player_.play())},n.dispose=function(){this.stopTracking(),e.prototype.dispose.call(this)},i}(Re);Re.registerComponent("LiveTracker",yr);var _r,br=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),n=[],r="";if(!i.length)return!1;for(var s=0;s<i.length;s++){var a=i[s].src;a&&-1===n.indexOf(a)&&n.push(a)}return!!n.length&&(1===n.length&&(r=n[0]),e.triggerSourceset(r),!0)},Tr=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(i){var n=t.createElement(this.nodeName.toLowerCase());n.innerHTML=i;for(var r=t.createDocumentFragment();n.childNodes.length;)r.appendChild(n.childNodes[0]);return this.innerText="",e.Element.prototype.appendChild.call(this,r),this.innerHTML}}),Sr=function(e,t){for(var i={},n=0;n<e.length&&!((i=Object.getOwnPropertyDescriptor(e[n],t))&&i.set&&i.get);n++);return i.enumerable=!0,i.configurable=!0,i},kr=function(t){var i=t.el();if(!i.resetSourceWatch_){var n={},r=function(t){return Sr([t.el(),e.HTMLMediaElement.prototype,e.Element.prototype,Tr],"innerHTML")}(t),s=function(e){return function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];var a=e.apply(i,r);return br(t),a}};["append","appendChild","insertAdjacentHTML"].forEach((function(e){i[e]&&(n[e]=i[e],i[e]=s(n[e]))})),Object.defineProperty(i,"innerHTML",De(r,{set:s(r.set)})),i.resetSourceWatch_=function(){i.resetSourceWatch_=null,Object.keys(n).forEach((function(e){i[e]=n[e]})),Object.defineProperty(i,"innerHTML",r)},t.one("sourceset",i.resetSourceWatch_)}},Cr=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?Nt(e.Element.prototype.getAttribute.call(this,"src")):""},set:function(t){return e.Element.prototype.setAttribute.call(this,"src",t),t}}),Er=function(e,t,i,n){void 0===n&&(n=!0);var r=function(i){return Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0})},s={configurable:!0,enumerable:!0,get:function(){var e=i();return r(e),e}};return n&&(s.set=r),Object.defineProperty(e,t,s)},wr=function(i){function n(e,t){var n;n=i.call(this,e,t)||this;var s=e.source,a=!1;if(s&&(n.el_.currentSrc!==s.src||e.tag&&3===e.tag.initNetworkState_)?n.setSource(s):n.handleLateInit_(n.el_),e.enableSourceset&&n.setupSourcesetHandling_(),n.el_.hasChildNodes()){for(var o=n.el_.childNodes,u=o.length,l=[];u--;){var c=o[u];"track"===c.nodeName.toLowerCase()&&(n.featuresNativeTextTracks?(n.remoteTextTrackEls().addTrackElement_(c),n.remoteTextTracks().addTrack(c.track),n.textTracks().addTrack(c.track),a||n.el_.hasAttribute("crossorigin")||!jt(c.src)||(a=!0)):l.push(c))}for(var h=0;h<l.length;h++)n.el_.removeChild(l[h])}return n.proxyNativeTracks_(),n.featuresNativeTextTracks&&a&&r.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),n.restoreMetadataTracksInIOSNativePlayer_(),(Ze||tt||ze)&&!0===e.nativeControlsForTouch&&n.setControls(!0),n.proxyWebkitFullscreen_(),n.triggerReady(),n}Ne(n,i);var s=n.prototype;return s.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),n.disposeMediaElement(this.el_),this.options_=null,i.prototype.dispose.call(this)},s.setupSourcesetHandling_=function(){!function(t){if(t.featuresSourceset){var i=t.el();if(!i.resetSourceset_){var n=function(t){return Sr([t.el(),e.HTMLMediaElement.prototype,Cr],"src")}(t),r=i.setAttribute,s=i.load;Object.defineProperty(i,"src",De(n,{set:function(e){var r=n.set.call(i,e);return t.triggerSourceset(i.src),r}})),i.setAttribute=function(e,n){var s=r.call(i,e,n);return/src/i.test(e)&&t.triggerSourceset(i.src),s},i.load=function(){var e=s.call(i);return br(t)||(t.triggerSourceset(""),kr(t)),e},i.currentSrc?t.triggerSourceset(i.currentSrc):br(t)||kr(t),i.resetSourceset_=function(){i.resetSourceset_=null,i.load=s,i.setAttribute=r,Object.defineProperty(i,"src",n),i.resetSourceWatch_&&i.resetSourceWatch_()}}}}(this)},s.restoreMetadataTracksInIOSNativePlayer_=function(){var e,t=this.textTracks(),i=function(){e=[];for(var i=0;i<t.length;i++){var n=t[i];"metadata"===n.kind&&e.push({track:n,storedMode:n.mode})}};i(),t.addEventListener("change",i),this.on("dispose",(function(){return t.removeEventListener("change",i)}));var n=function i(){for(var n=0;n<e.length;n++){var r=e[n];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}t.removeEventListener("change",i)};this.on("webkitbeginfullscreen",(function(){t.removeEventListener("change",i),t.removeEventListener("change",n),t.addEventListener("change",n)})),this.on("webkitendfullscreen",(function(){t.removeEventListener("change",i),t.addEventListener("change",i),t.removeEventListener("change",n)}))},s.overrideNative_=function(e,t){var i=this;if(t===this["featuresNative"+e+"Tracks"]){var n=e.toLowerCase();this[n+"TracksListeners_"]&&Object.keys(this[n+"TracksListeners_"]).forEach((function(e){i.el()[n+"Tracks"].removeEventListener(e,i[n+"TracksListeners_"][e])})),this["featuresNative"+e+"Tracks"]=!t,this[n+"TracksListeners_"]=null,this.proxyNativeTracksForType_(n)}},s.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)},s.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)},s.proxyNativeTracksForType_=function(e){var t=this,i=Zt[e],n=this.el()[i.getterName],r=this[i.getterName]();if(this["featuresNative"+i.capitalName+"Tracks"]&&n&&n.addEventListener){var s={change:function(e){r.trigger({type:"change",target:r,currentTarget:r,srcElement:r})},addtrack:function(e){r.addTrack(e.track)},removetrack:function(e){r.removeTrack(e.track)}},a=function(){for(var e=[],t=0;t<r.length;t++){for(var i=!1,s=0;s<n.length;s++)if(n[s]===r[t]){i=!0;break}i||e.push(r[t])}for(;e.length;)r.removeTrack(e.shift())};this[i.getterName+"Listeners_"]=s,Object.keys(s).forEach((function(e){var i=s[e];n.addEventListener(e,i),t.on("dispose",(function(t){return n.removeEventListener(e,i)}))})),this.on("loadstart",a),this.on("dispose",(function(e){return t.off("loadstart",a)}))}},s.proxyNativeTracks_=function(){var e=this;Zt.names.forEach((function(t){e.proxyNativeTracksForType_(t)}))},s.createEl=function(){var e=this.options_.tag;if(!e||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(e){var i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),n.disposeMediaElement(e),e=i}else{e=t.createElement("video");var r=De({},this.options_.tag&&A(this.options_.tag));Ze&&!0===this.options_.nativeControlsForTouch||delete r.controls,L(e,h(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&x(e,"preload",this.options_.preload);for(var s=["loop","muted","playsinline","autoplay"],a=0;a<s.length;a++){var o=s[a],u=this.options_[o];void 0!==u&&(u?x(e,o,o):O(e,o),e[o]=u)}return e},s.handleLateInit_=function(e){if(0!==e.networkState&&3!==e.networkState){if(0===e.readyState){var t=!1,i=function(){t=!0};this.on("loadstart",i);var n=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",n),void this.ready((function(){this.off("loadstart",i),this.off("loadedmetadata",n),t||this.trigger("loadstart")}))}var r=["loadstart"];r.push("loadedmetadata"),e.readyState>=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready((function(){r.forEach((function(e){this.trigger(e)}),this)}))}},s.setCurrentTime=function(e){try{this.el_.currentTime=e}catch(e){r(e,"Video is not ready. (Video.js)")}},s.duration=function(){var e=this;return this.el_.duration===1/0&&qe&&Xe&&0===this.el_.currentTime?(this.on("timeupdate",(function t(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))})),NaN):this.el_.duration||NaN},s.width=function(){return this.el_.offsetWidth},s.height=function(){return this.el_.offsetHeight},s.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",(function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)}))}},s.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var t=e.navigator&&e.navigator.userAgent||"";if(/Android/.test(t)||!/Chrome|Mac OS X 10.5/.test(t))return!0}return!1},s.enterFullScreen=function(){var e=this.el_;e.paused&&e.networkState<=e.HAVE_METADATA?(this.el_.play(),this.setTimeout((function(){e.pause(),e.webkitEnterFullScreen()}),0)):e.webkitEnterFullScreen()},s.exitFullScreen=function(){this.el_.webkitExitFullScreen()},s.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},s.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},s.reset=function(){n.resetMediaElement(this.el_)},s.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},s.setControls=function(e){this.el_.controls=!!e},s.addTextTrack=function(e,t,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,n):i.prototype.addTextTrack.call(this,e,t,n)},s.createRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return i.prototype.createRemoteTextTrack.call(this,e);var n=t.createElement("track");return e.kind&&(n.kind=e.kind),e.label&&(n.label=e.label),(e.language||e.srclang)&&(n.srclang=e.language||e.srclang),e.default&&(n.default=e.default),e.id&&(n.id=e.id),e.src&&(n.src=e.src),n},s.addRemoteTextTrack=function(e,t){var n=i.prototype.addRemoteTextTrack.call(this,e,t);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},s.removeRemoteTextTrack=function(e){if(i.prototype.removeRemoteTextTrack.call(this,e),this.featuresNativeTextTracks)for(var t=this.$$("track"),n=t.length;n--;)e!==t[n]&&e!==t[n].track||this.el().removeChild(t[n])},s.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var t={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(t.droppedVideoFrames=this.el().webkitDroppedFrameCount,t.totalVideoFrames=this.el().webkitDecodedFrameCount),e.performance&&"function"==typeof e.performance.now?t.creationTime=e.performance.now():e.performance&&e.performance.timing&&"number"==typeof e.performance.timing.navigationStart&&(t.creationTime=e.Date.now()-e.performance.timing.navigationStart),t},n}(Oi);Er(wr,"TEST_VID",(function(){if(v()){var e=t.createElement("video"),i=t.createElement("track");return i.kind="captions",i.srclang="en",i.label="English",e.appendChild(i),e}})),wr.isSupported=function(){try{wr.TEST_VID.volume=.5}catch(e){return!1}return!(!wr.TEST_VID||!wr.TEST_VID.canPlayType)},wr.canPlayType=function(e){return wr.TEST_VID.canPlayType(e)},wr.canPlaySource=function(e,t){return wr.canPlayType(e.type)},wr.canControlVolume=function(){try{var e=wr.TEST_VID.volume;return wr.TEST_VID.volume=e/2+.1,e!==wr.TEST_VID.volume}catch(e){return!1}},wr.canMuteVolume=function(){try{var e=wr.TEST_VID.muted;return wr.TEST_VID.muted=!e,wr.TEST_VID.muted?x(wr.TEST_VID,"muted","muted"):O(wr.TEST_VID,"muted"),e!==wr.TEST_VID.muted}catch(e){return!1}},wr.canControlPlaybackRate=function(){if(qe&&Xe&&Ye<58)return!1;try{var e=wr.TEST_VID.playbackRate;return wr.TEST_VID.playbackRate=e/2+.1,e!==wr.TEST_VID.playbackRate}catch(e){return!1}},wr.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(t.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(t.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(t.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(t.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},wr.supportsNativeTextTracks=function(){return nt||it&&Xe},wr.supportsNativeVideoTracks=function(){return!(!wr.TEST_VID||!wr.TEST_VID.videoTracks)},wr.supportsNativeAudioTracks=function(){return!(!wr.TEST_VID||!wr.TEST_VID.audioTracks)},wr.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresVolumeControl","canControlVolume"],["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function(e){var t=e[0],i=e[1];Er(wr.prototype,t,(function(){return wr[i]()}),!0)})),wr.prototype.movingMediaElementInDOM=!it,wr.prototype.featuresFullscreenResize=!0,wr.prototype.featuresProgressEvents=!0,wr.prototype.featuresTimeupdateEvents=!0,wr.patchCanPlayType=function(){We>=4&&!Ge&&!Xe&&(_r=wr.TEST_VID&&wr.TEST_VID.constructor.prototype.canPlayType,wr.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":_r.call(this,e)})},wr.unpatchCanPlayType=function(){var e=wr.TEST_VID.constructor.prototype.canPlayType;return _r&&(wr.TEST_VID.constructor.prototype.canPlayType=_r),e},wr.patchCanPlayType(),wr.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){}}()}},wr.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){wr.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){wr.prototype["set"+Oe(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","played","networkState","readyState","videoWidth","videoHeight"].forEach((function(e){wr.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach((function(e){wr.prototype["set"+Oe(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){wr.prototype[e]=function(){return this.el_[e]()}})),Oi.withSourceHandlers(wr),wr.nativeSourceHandler={},wr.nativeSourceHandler.canPlayType=function(e){try{return wr.TEST_VID.canPlayType(e)}catch(e){return""}},wr.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return wr.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=Bt(e.src);return wr.nativeSourceHandler.canPlayType("video/"+i)}return""},wr.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},wr.nativeSourceHandler.dispose=function(){},wr.registerSourceHandler(wr.nativeSourceHandler),Oi.registerTech("Html5",wr);var Pr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Lr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Ar=["tiny","xsmall","small","medium","large","xlarge","huge"],Ir={};Ar.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Ir[e]="vjs-layout-"+t}));var xr={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},Or=function(n){function a(e,r,o){var u;if(e.id=e.id||r.id||"vjs_video_"+ie(),(r=h(a.getTagSettings(e),r)).initChildren=!1,r.createEl=!1,r.evented=!1,r.reportTouchActivity=!1,!r.language)if("function"==typeof e.closest){var l=e.closest("[lang]");l&&l.getAttribute&&(r.language=l.getAttribute("lang"))}else for(var c=e;c&&1===c.nodeType;){if(A(c).hasOwnProperty("lang")){r.language=c.getAttribute("lang");break}c=c.parentNode}if((u=n.call(this,null,r,o)||this).boundDocumentFullscreenChange_=ve(Me(u),u.documentFullscreenChange_),u.boundFullWindowOnEscKey_=ve(Me(u),u.fullWindowOnEscKey),u.isFullscreen_=!1,u.log=s(u.id_),u.fsApi_=ct,u.isPosterFromTech_=!1,u.queuedCallbacks_=[],u.isReady_=!1,u.hasStarted_=!1,u.userActive_=!1,!u.options_||!u.options_.techOrder||!u.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(u.tag=e,u.tagAttributes=e&&A(e),u.language(u.options_.language),r.languages){var d={};Object.getOwnPropertyNames(r.languages).forEach((function(e){d[e.toLowerCase()]=r.languages[e]})),u.languages_=d}else u.languages_=a.prototype.options_.languages;u.resetCache_(),u.poster_=r.poster||"",u.controls_=!!r.controls,e.controls=!1,e.removeAttribute("controls"),u.changingSrc_=!1,u.playCallbacks_=[],u.playTerminatedQueue_=[],e.hasAttribute("autoplay")?u.autoplay(!0):u.autoplay(u.options_.autoplay),r.plugins&&Object.keys(r.plugins).forEach((function(e){if("function"!=typeof u[e])throw new Error('plugin "'+e+'" does not exist')})),u.scrubbing_=!1,u.el_=u.createEl(),Le(Me(u),{eventBusKey:"el_"}),u.fsApi_.requestFullscreen&&(le(t,u.fsApi_.fullscreenchange,u.boundDocumentFullscreenChange_),u.on(u.fsApi_.fullscreenchange,u.boundDocumentFullscreenChange_)),u.fluid_&&u.on("playerreset",u.updateStyleEl_);var p=De(u.options_);r.plugins&&Object.keys(r.plugins).forEach((function(e){u[e](r.plugins[e])})),u.options_.playerOptions=p,u.middleware_=[],u.initChildren(),u.isAudio("audio"===e.nodeName.toLowerCase()),u.controls()?u.addClass("vjs-controls-enabled"):u.addClass("vjs-controls-disabled"),u.el_.setAttribute("role","region"),u.isAudio()?u.el_.setAttribute("aria-label",u.localize("Audio Player")):u.el_.setAttribute("aria-label",u.localize("Video Player")),u.isAudio()&&u.addClass("vjs-audio"),u.flexNotSupported_()&&u.addClass("vjs-no-flex"),Ze&&u.addClass("vjs-touch-enabled"),it||u.addClass("vjs-workinghover"),a.players[u.id_]=Me(u);var f=i.split(".")[0];return u.addClass("vjs-v"+f),u.userActive(!0),u.reportUserActivity(),u.one("play",u.listenForUserActivity_),u.on("stageclick",u.handleStageClick_),u.on("keydown",u.handleKeyDown),u.breakpoints(u.options_.breakpoints),u.responsive(u.options_.responsive),u}Ne(a,n);var o=a.prototype;return o.dispose=function(){var e=this;this.trigger("dispose"),this.off("dispose"),ce(t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),ce(t,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),a.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),Ri[this.id()]=null,ti.names.forEach((function(t){var i=ti[t],n=e[i.getterName]();n&&n.off&&n.off()})),n.prototype.dispose.call(this)},o.createEl=function(){var i,r=this.tag,s=this.playerElIngest_=r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player"),a="video-js"===this.tag.tagName.toLowerCase();s?i=this.el_=r.parentNode:a||(i=this.el_=n.prototype.createEl.call(this,"div"));var o=A(r);if(a){for(i=this.el_=r,r=this.tag=t.createElement("video");i.children.length;)r.appendChild(i.firstChild);C(i,"video-js")||E(i,"video-js"),i.appendChild(r),s=this.playerElIngest_=i,Object.keys(i).forEach((function(e){try{r[e]=i[e]}catch(e){}}))}if(r.setAttribute("tabindex","-1"),o.tabindex="-1",($e||Xe&&Je)&&(r.setAttribute("role","application"),o.role="application"),r.removeAttribute("width"),r.removeAttribute("height"),"width"in o&&delete o.width,"height"in o&&delete o.height,Object.getOwnPropertyNames(o).forEach((function(e){a&&"class"===e||i.setAttribute(e,o[e]),a&&r.setAttribute(e,o[e])})),r.playerId=r.id,r.id+="_html5_api",r.className="vjs-tech",r.player=i.player=this,this.addClass("vjs-paused"),!0!==e.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=Z("vjs-styles-dimensions");var u=z(".vjs-styles-defaults"),l=z("head");l.insertBefore(this.styleEl_,u?u.nextSibling:l.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio);for(var c=r.getElementsByTagName("a"),h=0;h<c.length;h++){var d=c.item(h);E(d,"vjs-hidden"),d.setAttribute("hidden","hidden")}return r.initNetworkState_=r.networkState,r.parentNode&&!s&&r.parentNode.insertBefore(i,r),k(r,i),this.children_.unshift(r),this.el_.setAttribute("lang",this.language_),this.el_=i,i},o.width=function(e){return this.dimension("width",e)},o.height=function(e){return this.dimension("height",e)},o.dimension=function(e,t){var i=e+"_";if(void 0===t)return this[i]||0;if(""===t||"auto"===t)return this[i]=void 0,void this.updateStyleEl_();var n=parseFloat(t);isNaN(n)?r.error('Improper value "'+t+'" supplied for for '+e):(this[i]=n,this.updateStyleEl_())},o.fluid=function(e){if(void 0===e)return!!this.fluid_;var t,i;this.fluid_=!!e,be(this)&&this.off("playerreset",this.updateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),be(t=function(){this.on("playerreset",this.updateStyleEl_)})?i():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(i))):this.removeClass("vjs-fluid"),this.updateStyleEl_()},o.fill=function(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},o.aspectRatio=function(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()},o.updateStyleEl_=function(){if(!0!==e.VIDEOJS_NO_DYNAMIC_STYLE){var t,i,n,r=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),s=r[1]/r[0];t=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/s:this.videoWidth()||300,i=void 0!==this.height_?this.height_:t*s,n=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(n),ee(this.styleEl_,"\n ."+n+" {\n width: "+t+"px;\n height: "+i+"px;\n }\n\n ."+n+".vjs-fluid {\n padding-top: "+100*s+"%;\n }\n ")}else{var a="number"==typeof this.width_?this.width_:this.options_.width,o="number"==typeof this.height_?this.height_:this.options_.height,u=this.tech_&&this.tech_.el();u&&(a>=0&&(u.width=a),o>=0&&(u.height=o))}},o.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=Oe(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(Oi.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var s={source:t,autoplay:"string"!=typeof this.autoplay()&&this.autoplay(),nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,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};ti.names.forEach((function(e){var t=ti[e];s[t.getterName]=i[t.privateName]})),h(s,this.options_[n]),h(s,this.options_[r]),h(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var a,o,u=Oi.getTech(e);if(!u)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new u(s),this.tech_.ready(ve(this,this.handleTechReady_),!0),a=this.textTracksJson_||[],o=this.tech_,a.forEach((function(e){var t=o.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((function(e){return t.addCue(e)}))})),o.textTracks(),Pr.forEach((function(e){i.on(i.tech_,e,i["handleTech"+Oe(e)+"_"])})),Object.keys(Lr).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+Lr[e]+"_"].bind(i),event:t}):i["handleTech"+Lr[e]+"_"](t)}))})),this.on(this.tech_,"loadstart",this.handleTechLoadStart_),this.on(this.tech_,"sourceset",this.handleTechSourceset_),this.on(this.tech_,"waiting",this.handleTechWaiting_),this.on(this.tech_,"ended",this.handleTechEnded_),this.on(this.tech_,"seeking",this.handleTechSeeking_),this.on(this.tech_,"play",this.handleTechPlay_),this.on(this.tech_,"firstplay",this.handleTechFirstPlay_),this.on(this.tech_,"pause",this.handleTechPause_),this.on(this.tech_,"durationchange",this.handleTechDurationChange_),this.on(this.tech_,"fullscreenchange",this.handleTechFullscreenChange_),this.on(this.tech_,"enterpictureinpicture",this.handleTechEnterPictureInPicture_),this.on(this.tech_,"leavepictureinpicture",this.handleTechLeavePictureInPicture_),this.on(this.tech_,"error",this.handleTechError_),this.on(this.tech_,"loadedmetadata",this.updateStyleEl_),this.on(this.tech_,"posterchange",this.handleTechPosterChange_),this.on(this.tech_,"textdata",this.handleTechTextData_),this.on(this.tech_,"ratechange",this.handleTechRateChange_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||k(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},o.unloadTech_=function(){var e,t,i,n=this;ti.names.forEach((function(e){var t=ti[e];n[t.privateName]=n[t.getterName]()})),this.textTracksJson_=(e=this.tech_,t=e.$$("track"),i=Array.prototype.map.call(t,(function(e){return e.track})),Array.prototype.map.call(t,(function(e){var t=_t(e.track);return e.src&&(t.src=e.src),t})).concat(Array.prototype.filter.call(e.textTracks(),(function(e){return-1===i.indexOf(e)})).map(_t))),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},o.tech=function(e){return void 0===e&&r.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_},o.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"mouseup",this.handleTechClick_),this.on(this.tech_,"dblclick",this.handleTechDoubleClick_),this.on(this.tech_,"touchstart",this.handleTechTouchStart_),this.on(this.tech_,"touchmove",this.handleTechTouchMove_),this.on(this.tech_,"touchend",this.handleTechTouchEnd_),this.on(this.tech_,"tap",this.handleTechTap_)},o.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.handleTechTap_),this.off(this.tech_,"touchstart",this.handleTechTouchStart_),this.off(this.tech_,"touchmove",this.handleTechTouchMove_),this.off(this.tech_,"touchend",this.handleTechTouchEnd_),this.off(this.tech_,"mouseup",this.handleTechClick_),this.off(this.tech_,"dblclick",this.handleTechDoubleClick_)},o.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},o.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_(this.autoplay())},o.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"==typeof e){var i,n=function(){var e=t.muted();t.muted(!0);var i=function(){t.muted(e)};t.playTerminatedQueue_.push(i);var n=t.play();if(vt(n))return n.catch(i)};if("any"===e&&!0!==this.muted()?vt(i=this.play())&&(i=i.catch(n)):i="muted"===e&&!0!==this.muted()?n():this.play(),vt(i))return i.then((function(){t.trigger({type:"autoplay-success",autoplay:e})})).catch((function(i){t.trigger({type:"autoplay-failure",autoplay:e})}))}},o.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter((function(e){return e.src===t}));if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r<n.length;r++){var s=n[r];if(s.type&&s.src&&s.src===t)return s.type}return Wi(t)}(this,t)),this.cache_.source=De({},e,{src:t,type:i});for(var n=this.cache_.sources.filter((function(e){return e.src&&e.src===t})),r=[],s=this.$$("source"),a=[],o=0;o<s.length;o++){var u=A(s[o]);r.push(u),u.src&&u.src===t&&a.push(u.src)}a.length&&!n.length?this.cache_.sources=r:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t},o.handleTechSourceset_=function(e){var t=this;if(!this.changingSrc_){var i=function(e){return t.updateSourceCaches_(e)},n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n)&&(i=function(){}),i(r),e.src||this.tech_.any(["sourceset","loadstart"],(function(e){if("sourceset"!==e.type){var i=t.techGet("currentSrc");t.lastSource_.tech=i,t.updateSourceCaches_(i)}}))}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})},o.hasStarted=function(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},o.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},o.handleTechRateChange_=function(){this.tech_.playbackRate()>0&&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")},o.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",(function i(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))}))},o.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},o.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},o.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},o.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},o.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},o.handleTechFirstPlay_=function(){this.options_.starttime&&(r.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")},o.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},o.handleTechEnded_=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},o.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},o.handleTechClick_=function(e){q(e)&&this.controls_&&(this.paused()?yt(this.play()):this.pause())},o.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()))},o.handleTechTap_=function(){this.userActive(!this.userActive())},o.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},o.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},o.handleTechTouchEnd_=function(e){e.preventDefault()},o.handleStageClick_=function(){this.reportUserActivity()},o.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},o.documentFullscreenChange_=function(e){var i=e.target.player;if(!i||i===this){var n=this.el(),r=t[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)}},o.handleTechFullscreenChange_=function(e,t){t&&this.isFullscreen(t.isFullscreen)},o.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},o.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},o.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},o.handleTechError_=function(){var e=this.tech_.error();this.error(e)},o.handleTechTextData_=function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)},o.getCache=function(){return this.cache_},o.resetCache_=function(){this.cache_={currentTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],volume:1}},o.techCall_=function(e,t){this.ready((function(){if(e in ji)return function(e,t,i,n){return t[i](e.reduce(Hi(i),n))}(this.middleware_,this.tech_,e,t);if(e in Fi)return Ni(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw r(e),e}}),!0)},o.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in Bi)return function(e,t,i){return e.reduceRight(Hi(i),t[i]())}(this.middleware_,this.tech_,e);if(e in Fi)return Ni(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw r("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw r("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw r(t),t}}},o.play=function(){var t=this,i=this.options_.Promise||e.Promise;return i?new i((function(e){t.play_(e)})):this.play_()},o.play_=function(e){var t=this;void 0===e&&(e=yt),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!nt&&!it||this.load());var n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)},o.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))},o.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))},o.pause=function(){this.techCall_("pause")},o.paused=function(){return!1!==this.techGet_("paused")},o.played=function(){return this.techGet_("played")||ot(0,0)},o.scrubbing=function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},o.currentTime=function(e){return void 0!==e?(e<0&&(e=0),void this.techCall_("setCurrentTime",e)):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},o.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.options_.liveui&&this.player_.liveTracker&&this.addClass("vjs-liveui")):(this.removeClass("vjs-live"),this.removeClass("vjs-liveui")),isNaN(e)||this.trigger("durationchange"))},o.remainingTime=function(){return this.duration()-this.currentTime()},o.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},o.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=ot(0,0)),e},o.bufferedPercent=function(){return ut(this.buffered(),this.duration())},o.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i},o.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)},o.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},o.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},o.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},o.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},o.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_},o.requestFullscreen=function(e){var t,i=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then((function(){return i.isFullscreen(!0)}),(function(){return i.isFullscreen(!1)})),n}this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):this.enterFullWindow()},o.exitFullscreen=function(){var e=this;if(this.fsApi_.requestFullscreen){var i=t[this.fsApi_.exitFullscreen]();return i&&i.then((function(){return e.isFullscreen(!1)})),i}this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):this.exitFullWindow()},o.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=t.documentElement.style.overflow,le(t,"keydown",this.boundFullWindowOnEscKey_),t.documentElement.style.overflow="hidden",E(t.body,"vjs-full-window"),this.trigger("enterFullWindow")},o.fullWindowOnEscKey=function(e){bt.isEventKey(e,"Esc")&&(!0===this.isFullscreen()?this.exitFullscreen():this.exitFullWindow())},o.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,ce(t,"keydown",this.boundFullWindowOnEscKey_),t.documentElement.style.overflow=this.docOrigOverflow,w(t.body,"vjs-full-window"),this.trigger("exitFullWindow")},o.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},o.requestPictureInPicture=function(){if("pictureInPictureEnabled"in t)return this.techGet_("requestPictureInPicture")},o.exitPictureInPicture=function(){if("pictureInPictureEnabled"in t)return t.exitPictureInPicture()},o.handleKeyDown=function(e){var t,i,n=this.options_.userActions;n&&n.hotkeys&&(t=this.el_.ownerDocument.activeElement,i=t.tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof n.hotkeys?n.hotkeys.call(this,e):this.handleHotkeys(e)))},o.handleHotkeys=function(e){var i=this.options_.userActions?this.options_.userActions.hotkeys:{},n=i.fullscreenKey,r=void 0===n?function(e){return bt.isEventKey(e,"f")}:n,s=i.muteKey,a=void 0===s?function(e){return bt.isEventKey(e,"m")}:s,o=i.playPauseKey,u=void 0===o?function(e){return bt.isEventKey(e,"k")||bt.isEventKey(e,"Space")}:o;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();var l=Re.getComponent("FullscreenToggle");!1!==t[this.fsApi_.fullscreenEnabled]&&l.prototype.handleClick.call(this,e)}else a.call(this,e)?(e.preventDefault(),e.stopPropagation(),Re.getComponent("MuteToggle").prototype.handleClick.call(this,e)):u.call(this,e)&&(e.preventDefault(),e.stopPropagation(),Re.getComponent("PlayToggle").prototype.handleClick.call(this,e))},o.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i<n.length;i++){var s=n[i],a=Oi.getTech(s);if(a||(a=Re.getComponent(s)),a){if(a.isSupported()&&(t=a.canPlayType(e)))return t}else r.error('The "'+s+'" tech is undefined. Skipped browser support check for that tech.')}return""},o.selectSource=function(e){var t,i=this,n=this.options_.techOrder.map((function(e){return[e,Oi.getTech(e)]})).filter((function(e){var t=e[0],i=e[1];return i?i.isSupported():(r.error('The "'+t+'" tech is undefined. Skipped browser support check for that tech.'),!1)})),s=function(e,t,i){var n;return e.some((function(e){return t.some((function(t){if(n=i(e,t))return!0}))})),n},a=function(e,t){var n=e[0];if(e[1].canPlaySource(t,i.options_[n.toLowerCase()]))return{source:t,tech:n}};return(this.options_.sourceOrder?s(e,n,(t=a,function(e,i){return t(i,e)})):s(n,e,a))||!1},o.src=function(e){var t=this;if(void 0===e)return this.cache_.src||"";var i=zi(e);i.length?(this.changingSrc_=!0,this.cache_.sources=i,this.updateSourceCaches_(i[0]),Mi(this,i[0],(function(e,n){var r,s;if(t.middleware_=n,t.cache_.sources=i,t.updateSourceCaches_(e),t.src_(e))return i.length>1?t.src(i.slice(1)):(t.changingSrc_=!1,t.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0),void t.triggerReady());r=n,s=t.tech_,r.forEach((function(e){return e.setTech&&e.setTech(s)}))}))):this.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0)},o.src_=function(e){var t,i,n=this,r=this.selectSource([e]);return!r||(t=r.tech,i=this.techName_,Oe(t)!==Oe(i)?(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",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1))},o.load=function(){this.techCall_("load")},o.reset=function(){var t=this,i=this.options_.Promise||e.Promise;this.paused()||!i?this.doReset_():yt(this.play().then((function(){return t.doReset_()})))},o.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),be(this)&&this.trigger("playerreset")},o.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},o.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar,t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},o.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},o.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},o.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},o.currentSource=function(){return this.cache_.source||{}},o.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},o.currentType=function(){return this.currentSource()&&this.currentSource().type||""},o.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},o.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)?(this.options_.autoplay=e,this.manualAutoplay_(e),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},o.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},o.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},o.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"))},o.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"))}},o.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_()))},o.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")))},o.error=function(e){if(void 0===e)return this.error_||null;if(this.options_.suppressNotSupportedError&&e&&4===e.code){var t=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),void this.one("loadstart",(function(){this.off(["click","touchstart"],t)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new mt(e),this.addClass("vjs-error"),r.error("(CODE:"+this.error_.code+" "+mt.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error")},o.reportUserActivity=function(e){this.userActivity_=!0},o.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")}},o.listenForUserActivity_=function(){var e,t,i,n=ve(this,this.reportUserActivity),r=function(t){n(),this.clearInterval(e)};this.on("mousedown",(function(){n(),this.clearInterval(e),e=this.setInterval(n,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,n())})),this.on("mouseup",r),this.on("mouseleave",r);var s,a=this.getChild("controlBar");!a||it||qe||(a.on("mouseenter",(function(e){this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout,this.player().options_.inactivityTimeout=0})),a.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",n),this.on("keyup",n),this.setInterval((function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(s);var e=this.options_.inactivityTimeout;e<=0||(s=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}}),250)},o.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},o.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},o.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},o.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},o.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},o.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)},o.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},o.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},o.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},o.language=function(e){if(void 0===e)return this.language_;this.language_=String(e).toLowerCase()},o.languages=function(){return De(a.prototype.options_.languages,this.languages_)},o.toJSON=function(){var e=De(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i<t.length;i++){var n=t[i];(n=De(n)).player=void 0,e.tracks[i]=n}return e},o.createModal=function(e,t){var i=this;(t=t||{}).content=e||"";var n=new Tt(this,t);return this.addChild(n),n.on("dispose",(function(){i.removeChild(n)})),n.open(),n},o.updateCurrentBreakpoint_=function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),i=0;i<Ar.length;i++){var n=Ar[i];if(t<=this.breakpoints_[n]){if(e===n)return;e&&this.removeClass(Ir[e]),this.addClass(Ir[n]),this.breakpoint_=n;break}}},o.removeCurrentBreakpoint_=function(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)},o.breakpoints=function(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=h({},xr,e),this.updateCurrentBreakpoint_()),h(this.breakpoints_)},o.responsive=function(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?(this.responsive_=e,e?(this.on("playerresize",this.updateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.updateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0},o.currentBreakpoint=function(){return this.breakpoint_},o.currentBreakpointClass=function(){return Ir[this.breakpoint_]||""},o.loadMedia=function(e,t){var i=this;if(e&&"object"==typeof e){this.reset(),this.cache_.media=De(e);var n=this.cache_.media,r=n.artwork,s=n.poster,a=n.src,o=n.textTracks;!r&&s&&(this.cache_.media.artwork=[{src:s,type:Wi(s)}]),a&&this.src(a),s&&this.poster(s),Array.isArray(o)&&o.forEach((function(e){return i.addRemoteTextTrack(e,!1)})),this.ready(t)}},o.getMedia=function(){if(!this.cache_.media){var e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),(function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}}))};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:Wi(t.poster)}]),t}return De(this.cache_.media)},a.getTagSettings=function(e){var t={sources:[],tracks:[]},i=A(e),n=i["data-setup"];if(C(e,"vjs-fill")&&(i.fill=!0),C(e,"vjs-fluid")&&(i.fluid=!0),null!==n){var s=function(e,t){var i,n=null;try{i=JSON.parse(e,t)}catch(e){n=e}return[n,i]}(n||"{}"),a=s[0],o=s[1];a&&r.error(a),h(i,o)}if(h(t,i),e.hasChildNodes())for(var u=e.childNodes,l=0,c=u.length;l<c;l++){var d=u[l],p=d.nodeName.toLowerCase();"source"===p?t.sources.push(A(d)):"track"===p&&t.tracks.push(A(d))}return t},o.flexNotSupported_=function(){var e=t.createElement("i");return!("flexBasis"in e.style||"webkitFlexBasis"in e.style||"mozFlexBasis"in e.style||"msFlexBasis"in e.style||"msFlexOrder"in e.style)},a}(Re);ti.names.forEach((function(e){var t=ti[e];Or.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),Or.players={};var Dr=e.navigator;Or.prototype.options_={techOrder:Oi.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Dr&&(Dr.languages&&Dr.languages[0]||Dr.userLanguage||Dr.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1},["ended","seeking","seekable","networkState","readyState"].forEach((function(e){Or.prototype[e]=function(){return this.techGet_(e)}})),Pr.forEach((function(e){Or.prototype["handleTech"+Oe(e)+"_"]=function(){return this.trigger(e)}})),Re.registerComponent("Player",Or);var Rr=a((function(e){function t(i,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(i,n)}e.exports=t})),Ur=a((function(e){function t(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function i(n,r,s){return t()?e.exports=i=Reflect.construct:e.exports=i=function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&Rr(r,i.prototype),r},i.apply(null,arguments)}e.exports=i})),Mr="plugin",Nr={},Br=function(e){return Nr.hasOwnProperty(e)},jr=function(e){return Br(e)?Nr[e]:void 0},Fr=function(e,t){e.activePlugins_=e.activePlugins_||{},e.activePlugins_[t]=!0},Hr=function(e,t,i){var n=(i?"before":"")+"pluginsetup";e.trigger(n,t),e.trigger(n+":"+t.name,t)},Vr=function(e,t){return t.prototype.name=e,function(){Hr(this,{name:e,plugin:t,instance:null},!0);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];var s=Ur(t,[this].concat(n));return this[e]=function(){return s},Hr(this,s.getEventHash()),s}},qr=function(){function e(t){if(this.constructor===e)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t,Le(this),delete this.trigger,Ie(this,this.constructor.defaultState),Fr(t,this.name),this.dispose=ve(this,this.dispose),t.on("dispose",this.dispose)}var t=e.prototype;return t.version=function(){return this.constructor.VERSION},t.getEventHash=function(e){return void 0===e&&(e={}),e.name=this.name,e.plugin=this.constructor,e.instance=this,e},t.trigger=function(e,t){return void 0===t&&(t={}),he(this.eventBusEl_,e,this.getEventHash(t))},t.handleStateChanged=function(e){},t.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t.activePlugins_[e]=!1,this.player=this.state=null,t[e]=Vr(e,Nr[e])},e.isBasic=function(t){var i="string"==typeof t?jr(t):t;return"function"==typeof i&&!e.prototype.isPrototypeOf(i.prototype)},e.registerPlugin=function(t,i){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+typeof t+".");if(Br(t))r.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(Or.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'+t+'", cannot share a name with an existing player method!');if("function"!=typeof i)throw new Error('Illegal plugin for "'+t+'", must be a function, was '+typeof i+".");return Nr[t]=i,t!==Mr&&(e.isBasic(i)?Or.prototype[t]=function(e,t){var i=function(){Hr(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return Fr(this,e),Hr(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach((function(e){i[e]=t[e]})),i}(t,i):Or.prototype[t]=Vr(t,i)),i},e.deregisterPlugin=function(e){if(e===Mr)throw new Error("Cannot de-register base plugin.");Br(e)&&(delete Nr[e],delete Or.prototype[e])},e.getPlugins=function(e){var t;return void 0===e&&(e=Object.keys(Nr)),e.forEach((function(e){var i=jr(e);i&&((t=t||{})[e]=i)})),t},e.getPluginVersion=function(e){var t=jr(e);return t&&t.VERSION||""},e}();qr.getPlugin=jr,qr.BASE_PLUGIN_NAME=Mr,qr.registerPlugin(Mr,qr),Or.prototype.usingPlugin=function(e){return!!this.activePlugins_&&!0===this.activePlugins_[e]},Or.prototype.hasPlugin=function(e){return!!Br(e)};var Wr=function(e){return 0===e.indexOf("#")?e.slice(1):e};function zr(e,t,i){var n=zr.getPlayer(e);if(n)return t&&r.warn('Player "'+e+'" is already initialised. Options will not be applied.'),i&&n.ready(i),n;var s="string"==typeof e?z("#"+Wr(e)):e;if(!y(s))throw new TypeError("The element or ID supplied is not valid. (videojs)");s.ownerDocument.defaultView&&s.ownerDocument.body.contains(s)||r.warn("The element supplied is not included in the DOM"),t=t||{},zr.hooks("beforesetup").forEach((function(e){var i=e(s,De(t));d(i)&&!Array.isArray(i)?t=De(t,i):r.error("please return an object in beforesetup hooks")}));var a=Re.getComponent("Player");return n=new a(s,t,i),zr.hooks("setup").forEach((function(e){return e(n)})),n}if(zr.hooks_={},zr.hooks=function(e,t){return zr.hooks_[e]=zr.hooks_[e]||[],t&&(zr.hooks_[e]=zr.hooks_[e].concat(t)),zr.hooks_[e]},zr.hook=function(e,t){zr.hooks(e,t)},zr.hookOnce=function(e,t){zr.hooks(e,[].concat(t).map((function(t){return function i(){return zr.removeHook(e,i),t.apply(void 0,arguments)}})))},zr.removeHook=function(e,t){var i=zr.hooks(e).indexOf(t);return!(i<=-1||(zr.hooks_[e]=zr.hooks_[e].slice(),zr.hooks_[e].splice(i,1),0))},!0!==e.VIDEOJS_NO_DYNAMIC_STYLE&&v()){var Gr=z(".vjs-styles-defaults");if(!Gr){Gr=Z("vjs-styles-defaults");var Kr=z("head");Kr&&Kr.insertBefore(Gr,Kr.firstChild),ee(Gr,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}$(1,zr),zr.VERSION=i,zr.options=Or.prototype.options_,zr.getPlayers=function(){return Or.players},zr.getPlayer=function(e){var t,i=Or.players;if("string"==typeof e){var n=Wr(e),r=i[n];if(r)return r;t=z("#"+n)}else t=e;if(y(t)){var s=t,a=s.player,o=s.playerId;if(a||i[o])return a||i[o]}},zr.getAllPlayers=function(){return Object.keys(Or.players).map((function(e){return Or.players[e]})).filter(Boolean)},zr.players=Or.players,zr.getComponent=Re.getComponent,zr.registerComponent=function(e,t){Oi.isTech(t)&&r.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),Re.registerComponent.call(Re,e,t)},zr.getTech=Oi.getTech,zr.registerTech=Oi.registerTech,zr.use=function(e,t){Di[e]=Di[e]||[],Di[e].push(t)},Object.defineProperty(zr,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(zr.middleware,"TERMINATOR",{value:Ui,writeable:!1,enumerable:!0}),zr.browser=rt,zr.TOUCH_ENABLED=Ze,zr.extend=function(e,t){void 0===t&&(t={});var i=function(){e.apply(this,arguments)},n={};for(var r in"object"==typeof t?(t.constructor!==Object.prototype.constructor&&(i=t.constructor),n=t):"function"==typeof t&&(i=t),function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Rr(e,t)}(i,e),e&&(i.super_=e),n)n.hasOwnProperty(r)&&(i.prototype[r]=n[r]);return i},zr.mergeOptions=De,zr.bind=ve,zr.registerPlugin=qr.registerPlugin,zr.deregisterPlugin=qr.deregisterPlugin,zr.plugin=function(e,t){return r.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),qr.registerPlugin(e,t)},zr.getPlugins=qr.getPlugins,zr.getPlugin=qr.getPlugin,zr.getPluginVersion=qr.getPluginVersion,zr.addLanguage=function(e,t){var i;return e=(""+e).toLowerCase(),zr.options.languages=De(zr.options.languages,((i={})[e]=t,i)),zr.options.languages[e]},zr.log=r,zr.createLogger=s,zr.createTimeRange=zr.createTimeRanges=ot,zr.formatTime=un,zr.setFormatTime=function(e){on=e},zr.resetFormatTime=function(){on=an},zr.parseUrl=Mt,zr.isCrossOrigin=jt,zr.EventTarget=_e,zr.on=le,zr.one=de,zr.off=ce,zr.trigger=he,zr.xhr=Vt,zr.TextTrack=Yt,zr.AudioTrack=$t,zr.VideoTrack=Qt,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((function(e){zr[e]=function(){return r.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead"),K[e].apply(null,arguments)}})),zr.computedStyle=f,zr.dom=K,zr.url=Ft,zr.defineLazyProperty=Er;var Xr=a((function(e,t){var i,n,r,s,a;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,n=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=a.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=a.normalizePath(r.path),a.buildURLFromParts(r)}var s=a.parseURL(t);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return i.alwaysNormalize?(s.path=a.normalizePath(s.path),a.buildURLFromParts(s)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=n.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(l.netLoc=o.netLoc,"/"!==s.path[0]))if(s.path){var c=o.path,h=c.substring(0,c.lastIndexOf("/")+1)+s.path;l.path=a.normalizePath(h)}else l.path=o.path,s.params||(l.params=o.params,s.query||(l.query=o.query));return null===l.path&&(l.path=i.alwaysNormalize?a.normalizePath(s.path):s.path),a.buildURLFromParts(l)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(s,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a}));function Yr(){return(Yr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function $r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var Qr=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t,i,n,r=this.listeners[e];if(r)if(2===arguments.length)for(i=r.length,t=0;t<i;++t)r[t].call(this,arguments[1]);else for(n=Array.prototype.slice.call(arguments,1),i=r.length,t=0;t<i;++t)r[t].apply(this,n)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}(),Jr=function(e){function t(){var t;return(t=e.call(this)||this).buffer="",t}return $r(t,e),t.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(Qr),Zr=function(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),n[t[0]]=t[1]);return n},es=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}$r(t,e);var i=t.prototype;return i.push=function(e){var t,i,n=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce((function(t,i){var n=i(e);return n===e?t:t.concat([n])}),[e]).forEach((function(e){for(var r=0;r<n.customParsers.length;r++)if(n.customParsers[r].call(n,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))n.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void n.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"totalduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void n.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"byterange"},t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),void n.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"map"},t[1]){var s=Zr(t[1]);if(s.URI&&(i.uri=s.URI),s.BYTERANGE){var a=s.BYTERANGE.split("@"),o=a[0],u=a[1];i.byterange={},o&&(i.byterange.length=parseInt(o,10)),u&&(i.byterange.offset=parseInt(u,10))}}n.trigger("data",i)}else if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=Zr(t[1]),i.attributes.RESOLUTION){var l=i.attributes.RESOLUTION.split("x"),c={};l[0]&&(c.width=parseInt(l[0],10)),l[1]&&(c.height=parseInt(l[1],10)),i.attributes.RESOLUTION=c}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}n.trigger("data",i)}else{if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=Zr(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e))n.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))n.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return i={type:"tag",tagType:"key"},t[1]&&(i.attributes=Zr(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void n.trigger("data",i);if(t=/^#EXT-X-START:?(.*)$/.exec(e))return i={type:"tag",tagType:"start"},t[1]&&(i.attributes=Zr(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);n.trigger("data",{type:"tag",data:e.slice(4)})}}}else n.trigger("data",{type:"comment",text:e.slice(1)})})):this.trigger("data",{type:"uri",uri:e}))},i.addParser=function(e){var t=this,i=e.expression,n=e.customType,r=e.dataParser,s=e.segment;"function"!=typeof r&&(r=function(e){return e}),this.customParsers.push((function(e){if(i.exec(e))return t.trigger("data",{type:"custom",data:r(e),customType:n,segment:s}),!0}))},i.addTagMapper=function(e){var t=e.expression,i=e.map;this.tagMappers.push((function(e){return t.test(e)?i(e):e}))},t}(Qr);function ts(t){for(var i=e.atob(t||""),n=new Uint8Array(i.length),r=0;r<i.length;r++)n[r]=i.charCodeAt(r);return n}var is,ns,rs,ss,as,os,us,ls=function(e){function t(){var t;(t=e.call(this)||this).lineStream=new Jr,t.parseStream=new es,t.lineStream.pipe(t.parseStream);var i,n,r=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t),s=[],a={},o=function(){},u={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},l=0;return t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},t.parseStream.on("data",(function(e){var t,c;({tag:function(){({"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&(a.byterange=t,t.length=e.length,"offset"in e||(this.trigger("info",{message:"defaulting offset to zero"}),e.offset=0)),"offset"in e&&(a.byterange=t,t.offset=e.offset)},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),e.duration>0&&(a.duration=e.duration),0===e.duration&&(a.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=s},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?void(this.manifest.contentProtection={"com.widevine.alpha":{attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:ts(e.attributes.URI.split(",")[1])}}):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(n.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,l=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange)},"stream-inf":function(){this.manifest.playlists=s,this.manifest.mediaGroups=this.manifest.mediaGroups||u,e.attributes?(a.attributes||(a.attributes={}),Yr(a.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||u,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(c={default:/yes/i.test(e.attributes.DEFAULT)}).default?c.autoselect=!0:c.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(c.language=e.attributes.LANGUAGE),e.attributes.URI&&(c.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(c.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(c.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(c.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=c}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){l+=1,a.discontinuity=!0,this.manifest.discontinuityStarts.push(s.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),a.dateTimeString=e.dateTimeString,a.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):this.manifest.targetDuration=e.duration},totalduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+e.duration}):this.manifest.totalDuration=e.duration},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){a.cueOut=e.data},"cue-out-cont":function(){a.cueOutCont=e.data},"cue-in":function(){a.cueIn=e.data}}[e.tagType]||o).call(r)},uri:function(){a.uri=e.uri,s.push(a),this.manifest.targetDuration&&!("duration"in a)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),a.duration=this.manifest.targetDuration),n&&(a.key=n),a.timeline=l,i&&(a.map=i),a={}},comment:function(){},custom:function(){e.segment?(a.custom=a.custom||{},a.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(r)})),t}$r(t,e);var i=t.prototype;return i.push=function(e){this.lineStream.push(e)},i.end=function(){this.lineStream.push("\n")},i.addParser=function(e){this.parseStream.addParser(e)},i.addTagMapper=function(e){this.parseStream.addTagMapper(e)},t}(Qr),cs=function(e){return!!e&&"object"==typeof e},hs=function e(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.reduce((function(t,i){return Object.keys(i).forEach((function(n){Array.isArray(t[n])&&Array.isArray(i[n])?t[n]=t[n].concat(i[n]):cs(t[n])&&cs(i[n])?t[n]=e(t[n],i[n]):t[n]=i[n]})),t}),{})},ds=function(e){return e.reduce((function(e,t){return e.concat(t)}),[])},ps=function(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t},fs=function(e,t){return function(e,t){var i,n,r,s,a;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,n=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=a.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=a.normalizePath(r.path),a.buildURLFromParts(r)}var s=a.parseURL(t);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return i.alwaysNormalize?(s.path=a.normalizePath(s.path),a.buildURLFromParts(s)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=n.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(l.netLoc=o.netLoc,"/"!==s.path[0]))if(s.path){var c=o.path,h=c.substring(0,c.lastIndexOf("/")+1)+s.path;l.path=a.normalizePath(h)}else l.path=o.path,s.params||(l.params=o.params,s.query||(l.query=o.query));return null===l.path&&(l.path=i.alwaysNormalize?a.normalizePath(s.path):s.path),a.buildURLFromParts(l)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(s,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a}(t={exports:{}}),t.exports}(),ms=function(t,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(t)||(t=fs.buildAbsoluteURL(e.location.href,t)),fs.buildAbsoluteURL(t,i))},gs=function(e){var t=e.baseUrl,i=void 0===t?"":t,n=e.source,r=void 0===n?"":n,s=e.range,a=void 0===s?"":s,o=e.indexRange,u=void 0===o?"":o,l={uri:r,resolvedUri:ms(i||"",r)};if(a||u){var c=(a||u).split("-"),h=parseInt(c[0],10),d=parseInt(c[1],10);l.byterange={length:d-h+1,offset:h}}return l},vs={static:function(e){var t=e.duration,i=e.timescale,n=void 0===i?1:i,r=e.sourceDuration;return{start:0,end:Math.ceil(r/(t/n))}},dynamic:function(e){var t=e.NOW,i=e.clientOffset,n=e.availabilityStartTime,r=e.timescale,s=void 0===r?1:r,a=e.duration,o=e.start,u=void 0===o?0:o,l=e.minimumUpdatePeriod,c=void 0===l?0:l,h=e.timeShiftBufferDepth,d=void 0===h?1/0:h,p=(t+i)/1e3,f=n+u,m=p+c-f,g=Math.ceil(m*s/a),v=Math.floor((p-f-d)*s/a),y=Math.floor((p-f)*s/a);return{start:Math.max(0,v),end:Math.min(g,y)}}},ys=function(e){var t=e.type,i=void 0===t?"static":t,n=e.duration,r=e.timescale,s=void 0===r?1:r,a=e.sourceDuration,o=vs[i](e),u=function(e,t){for(var i=[],n=e;n<t;n++)i.push(n);return i}(o.start,o.end).map(function(e){return function(t,i){var n=e.duration,r=e.timescale,s=void 0===r?1:r,a=e.periodIndex,o=e.startNumber;return{number:(void 0===o?1:o)+t,duration:n/s,timeline:a,time:i*n}}}(e));if("static"===i){var l=u.length-1;u[l].duration=a-n/s*l}return u},_s=function(e){var t=e.baseUrl,i=e.initialization,n=void 0===i?{}:i,r=e.sourceDuration,s=e.timescale,a=void 0===s?1:s,o=e.indexRange,u=void 0===o?"":o,l=e.duration;if(!t)throw new Error("NO_BASE_URL");var c=gs({baseUrl:t,source:n.sourceURL,range:n.range}),h=gs({baseUrl:t,source:t,indexRange:u});if(h.map=c,l){var d=ys(e);d.length&&(h.duration=d[0].duration,h.timeline=d[0].timeline)}else r&&(h.duration=r/a,h.timeline=0);return h.number=0,[h]},bs=function(e,t,i){for(var n=e.sidx.map?e.sidx.map:null,r=e.sidx.duration,s=e.timeline||0,a=e.sidx.byterange,o=a.offset+a.length,u=t.timescale,l=t.references.filter((function(e){return 1!==e.referenceType})),c=[],h=o+t.firstOffset,d=0;d<l.length;d++){var p=t.references[d],f=p.referencedSize,m=p.subsegmentDuration,g=_s({baseUrl:i,timescale:u,timeline:s,periodIndex:s,duration:m,sourceDuration:r,indexRange:h+"-"+(h+f-1)})[0];n&&(g.map=n),c.push(g),h+=f}return e.segments=c,e},Ts=function(e){var t;return(t=e.reduce((function(e,t){var i,n=t.attributes.id+(t.attributes.lang||"");return e[n]?(t.segments[0]&&(t.segments[0].discontinuity=!0),(i=e[n].segments).push.apply(i,t.segments),t.attributes.contentProtection&&(e[n].attributes.contentProtection=t.attributes.contentProtection)):e[n]=t,e}),{}),Object.keys(t).map((function(e){return t[e]}))).map((function(e){var t;return e.discontinuityStarts=(t=e.segments,"discontinuity",t.reduce((function(e,t,i){return t.discontinuity&&e.push(i),e}),[])),e}))},Ss=function(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e){var n=e[i];if(n.sidx){var r=n.sidx.uri+"-"+(void 0,o=(a=n.sidx.byterange).offset+a.length-1,a.offset+"-"+o),s=t[r]&&t[r].sidx;n.sidx&&s&&bs(n,s,n.sidx.resolvedUri)}}var a,o;return e},ks=function(e){var t,i=e.attributes,n=e.segments,r=e.sidx,s={attributes:(t={NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1};return i.contentProtection&&(s.contentProtection=i.contentProtection),r&&(s.sidx=r),s},Cs=function(e){var t,i=e.attributes,n=e.segments,r=e.sidx,s={attributes:(t={NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1};return i.contentProtection&&(s.contentProtection=i.contentProtection),r&&(s.sidx=r),s},Es=function(e,t,i){var n=e.NOW,r=e.clientOffset,s=e.availabilityStartTime,a=e.timescale,o=void 0===a?1:a,u=e.start,l=void 0===u?0:u,c=e.minimumUpdatePeriod,h=(n+r)/1e3+(void 0===c?0:c)-(s+l);return Math.ceil((h*o-t)/i)},ws=function(e,t){for(var i=e.type,n=void 0===i?"static":i,r=e.minimumUpdatePeriod,s=void 0===r?0:r,a=e.media,o=void 0===a?"":a,u=e.sourceDuration,l=e.timescale,c=void 0===l?1:l,h=e.startNumber,d=void 0===h?1:h,p=e.periodIndex,f=[],m=-1,g=0;g<t.length;g++){var v=t[g],y=v.d,_=v.r||0,b=v.t||0;m<0&&(m=b),b&&b>m&&(m=b);var T=void 0;if(_<0){var S=g+1;T=S===t.length?"dynamic"===n&&s>0&&o.indexOf("$Number$")>0?Es(e,m,y):(u*c-m)/y:(t[S].t-m)/y}else T=_+1;for(var k=d+f.length+T,C=d+f.length;C<k;)f.push({number:C,duration:y/c,time:m,timeline:p}),m+=y,C++}return f},Ps=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,Ls=function(e,t){return e.replace(Ps,function(e){return function(t,i,n,r){if("$$"===t)return"$";if(void 0===e[i])return t;var s=""+e[i];return"RepresentationID"===i?s:(r=n?parseInt(r,10):1,s.length>=r?s:""+new Array(r-s.length+1).join("0")+s)}}(t))},As=function(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,s=gs({baseUrl:e.baseUrl,source:Ls(r.sourceURL,i),range:r.range});return function(e,t){return e.duration||t?e.duration?ys(e):ws(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}(e,t).map((function(t){i.Number=t.number,i.Time=t.time;var n=Ls(e.media||"",i);return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:ms(e.baseUrl||"",n),map:s,number:t.number}}))},Is=function(e,t){var i=e.duration,n=e.segmentUrls,r=void 0===n?[]:n;if(!i&&!t||i&&t)throw new Error("SEGMENT_TIME_UNSPECIFIED");var s,a=r.map((function(t){return function(e,t){var i=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,s=gs({baseUrl:i,source:r.sourceURL,range:r.range}),a=gs({baseUrl:i,source:t.media,range:t.mediaRange});return a.map=s,a}(e,t)}));return i&&(s=ys(e)),t&&(s=ws(e,t)),s.map((function(e,t){if(a[t]){var i=a[t];return i.timeline=e.timeline,i.duration=e.duration,i.number=e.number,i}})).filter((function(e){return e}))},xs=function(e){var t,i,n=e.attributes,r=e.segmentInfo;r.template?(i=As,t=hs(n,r.template)):r.base?(i=_s,t=hs(n,r.base)):r.list&&(i=Is,t=hs(n,r.list));var s={attributes:n};if(!i)return s;var a=i(t,r.timeline);if(t.duration){var o=t,u=o.duration,l=o.timescale,c=void 0===l?1:l;t.duration=u/c}else a.length?t.duration=a.reduce((function(e,t){return Math.max(e,Math.ceil(t.duration))}),0):t.duration=0;return s.attributes=t,s.segments=a,r.base&&t.indexRange&&(s.sidx=a[0],s.segments=[]),s},Os=function(e,t){return ps(e.childNodes).filter((function(e){return e.tagName===t}))},Ds=function(e){return e.textContent.trim()},Rs=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var i=t.slice(1),n=i[0],r=i[1],s=i[2],a=i[3],o=i[4],u=i[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(r||0)+86400*parseFloat(s||0)+3600*parseFloat(a||0)+60*parseFloat(o||0)+parseFloat(u||0)},Us={mediaPresentationDuration:function(e){return Rs(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return Rs(e)},timeShiftBufferDepth:function(e){return Rs(e)},start:function(e){return Rs(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?Rs(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},Ms=function(e){return e&&e.attributes?ps(e.attributes).reduce((function(e,t){var i=Us[t.name]||Us.DEFAULT;return e[t.name]=i(t.value),e}),{}):{}},Ns={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},Bs=function(e,t){return t.length?ds(e.map((function(e){return t.map((function(t){return ms(e,Ds(t))}))}))):e},js=function(e){var t=Os(e,"SegmentTemplate")[0],i=Os(e,"SegmentList")[0],n=i&&Os(i,"SegmentURL").map((function(e){return hs({tag:"SegmentURL"},Ms(e))})),r=Os(e,"SegmentBase")[0],s=i||t,a=s&&Os(s,"SegmentTimeline")[0],o=i||r||t,u=o&&Os(o,"Initialization")[0],l=t&&Ms(t);l&&u?l.initialization=u&&Ms(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var c={template:l,timeline:a&&Os(a,"S").map((function(e){return Ms(e)})),list:i&&hs(Ms(i),{segmentUrls:n,initialization:Ms(u)}),base:r&&hs(Ms(r),{initialization:Ms(u)})};return Object.keys(c).forEach((function(e){c[e]||delete c[e]})),c},Fs=function(t,i,n){return function(r){var s=Ms(r),a=Bs(i,Os(r,"BaseURL")),o=Os(r,"Role")[0],u={role:Ms(o)},l=hs(t,s,u),c=Os(r,"ContentProtection").reduce((function(t,i){var n=Ms(i),r=Ns[n.schemeIdUri];if(r){t[r]={attributes:n};var s=Os(i,"cenc:pssh")[0];if(s){var a=Ds(s),o=a&&function(t){for(var i=e.atob(t),n=new Uint8Array(i.length),r=0;r<i.length;r++)n[r]=i.charCodeAt(r);return n}(a);t[r].pssh=o}}return t}),{});Object.keys(c).length&&(l=hs(l,{contentProtection:c}));var h=js(r),d=Os(r,"Representation"),p=hs(n,h);return ds(d.map(function(e,t,i){return function(n){var r=Os(n,"BaseURL"),s=Bs(t,r),a=hs(e,Ms(n)),o=js(n);return s.map((function(e){return{segmentInfo:hs(i,o),attributes:hs(a,{baseUrl:e})}}))}}(l,a,p)))}},Hs=function(t){if(""===t)throw new Error("DASH_EMPTY_MANIFEST");var i=(new e.DOMParser).parseFromString(t,"application/xml"),n=i&&"MPD"===i.documentElement.tagName?i.documentElement:null;if(!n||n&&n.getElementsByTagName("parsererror").length>0)throw new Error("DASH_INVALID_XML");return n},Vs=function(t,i){return void 0===i&&(i={}),function(e,t){var i;if(void 0===t&&(t={}),!e.length)return{};var n=e[0].attributes,r=n.sourceDuration,s=n.minimumUpdatePeriod,a=void 0===s?0:s,o=Ts(e.filter((function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType}))).map(Cs),u=Ts(e.filter((function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio"===t.contentType}))),l=e.filter((function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType})),c={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(i={AUDIO:{},VIDEO:{}},i["CLOSED-CAPTIONS"]={},i.SUBTITLES={},i),uri:"",duration:r,playlists:Ss(o,t),minimumUpdatePeriod:1e3*a};return u.length&&(c.mediaGroups.AUDIO.audio=function(e,t){var i;void 0===t&&(t={});var n=e.reduce((function(e,n){var r=n.attributes.role&&n.attributes.role.value||"",s=n.attributes.lang||"",a="main";if(s){var o=r?" ("+r+")":"";a=""+n.attributes.lang+o}return e[a]&&e[a].playlists[0].attributes.BANDWIDTH>n.attributes.bandwidth||(e[a]={language:s,autoselect:!0,default:"main"===r,playlists:Ss([ks(n)],t),uri:""},void 0===i&&"main"===r&&((i=n).default=!0)),e}),{});return i||(n[Object.keys(n)[0]].default=!0),n}(u,t)),l.length&&(c.mediaGroups.SUBTITLES.subs=function(e,t){return void 0===t&&(t={}),e.reduce((function(e,i){var n,r,s,a,o=i.attributes.lang||"text";return e[o]||(e[o]={language:o,default:!1,autoselect:!1,playlists:Ss([(n=i,s=n.attributes,a=n.segments,void 0===a&&(a=[{uri:s.baseUrl,timeline:s.periodIndex,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration),{attributes:(r={NAME:s.id,BANDWIDTH:s.bandwidth},r["PROGRAM-ID"]=1,r),uri:"",endList:"static"===(s.type||"static"),timeline:s.periodIndex,resolvedUri:s.baseUrl||"",targetDuration:s.duration,segments:a,mediaSequence:a.length?a[0].number:1})],t),uri:""}),e}),{})}(l,t)),c}(function(t,i){void 0===i&&(i={});var n=i,r=n.manifestUri,s=void 0===r?"":r,a=n.NOW,o=void 0===a?Date.now():a,u=n.clientOffset,l=void 0===u?0:u,c=Os(t,"Period");if(!c.length)throw new Error("INVALID_NUMBER_OF_PERIOD");var h=Ms(t),d=Bs([s],Os(t,"BaseURL"));return h.sourceDuration=h.mediaPresentationDuration||0,h.NOW=o,h.clientOffset=l,ds(c.map(function(t,i){return function(n,r){var s=Bs(i,Os(n,"BaseURL")),a=Ms(n),o=parseInt(a.id,10),u=e.isNaN(o)?r:o,l=hs(t,{periodIndex:u}),c=Os(n,"AdaptationSet"),h=js(n);return ds(c.map(Fs(l,s,h)))}}(h,d)))}(Hs(t),i).map(xs),i.sidxMapping)},qs=function(e){return e>>>0},Ws=qs,zs=function(e){return new Date(1e3*e-20828448e5)},Gs=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]}},Ks=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),(t+=String.fromCharCode(e[2]))+String.fromCharCode(e[3])},Xs=function(e){var t,i,n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[];for(t=0;t+4<e.length;t+=i)if(i=n.getUint32(t),t+=4,i<=0)r.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&e[t]){case 1:r.push("slice_layer_without_partitioning_rbsp");break;case 5:r.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:r.push("sei_rbsp");break;case 7:r.push("seq_parameter_set_rbsp");break;case 8:r.push("pic_parameter_set_rbsp");break;case 9:r.push("access_unit_delimiter_rbsp");break;default:r.push("UNKNOWN NAL - "+e[t]&31)}return r},Ys={avc1:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:is(e.subarray(78,e.byteLength))}},avcC:function(e){var t,i,n,r,s=new DataView(e.buffer,e.byteOffset,e.byteLength),a={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:3&e[4],sps:[],pps:[]},o=31&e[5];for(n=6,r=0;r<o;r++)i=s.getUint16(n),n+=2,a.sps.push(new Uint8Array(e.subarray(n,n+i))),n+=i;for(t=e[n],n++,r=0;r<t;r++)i=s.getUint16(n),n+=2,a.pps.push(new Uint8Array(e.subarray(n,n+i))),n+=i;return a},btrt:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},esds:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),esId:e[6]<<8|e[7],streamPriority:31&e[8],decoderConfig:{objectProfileIndication:e[11],streamType:e[12]>>>2&63,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:e[26]>>>3&31,samplingFrequencyIndex:(7&e[26])<<1|e[27]>>>7&1,channelConfiguration:e[27]>>>3&15}}}},ftyp:function(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={majorBrand:Ks(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},n=8;n<e.byteLength;)i.compatibleBrands.push(Ks(e.subarray(n,n+4))),n+=4;return i},dinf:function(e){return{boxes:is(e)}},dref:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),dataReferences:is(e.subarray(8))}},hdlr:function(e){var t={version:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0),flags:new Uint8Array(e.subarray(1,4)),handlerType:Ks(e.subarray(8,12)),name:""},i=8;for(i=24;i<e.byteLength;i++){if(0===e[i]){i++;break}t.name+=String.fromCharCode(e[i])}return t.name=decodeURIComponent(escape(t.name)),t},mdat:function(e){return{byteLength:e.byteLength,nals:Xs(e)}},mdhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n=4,r={version:i.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};return 1===r.version?(n+=4,r.creationTime=zs(i.getUint32(n)),n+=8,r.modificationTime=zs(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=8,r.duration=i.getUint32(n)):(r.creationTime=zs(i.getUint32(n)),n+=4,r.modificationTime=zs(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=4,r.duration=i.getUint32(n)),n+=4,t=i.getUint16(n),r.language+=String.fromCharCode(96+(t>>10)),r.language+=String.fromCharCode(96+((992&t)>>5)),r.language+=String.fromCharCode(96+(31&t)),r},mdia:function(e){return{boxes:is(e)}},mfhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sequenceNumber:e[4]<<24|e[5]<<16|e[6]<<8|e[7]}},minf:function(e){return{boxes:is(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(i.streamDescriptor=is(e.subarray(28))[0]),i},moof:function(e){return{boxes:is(e)}},moov:function(e){return{boxes:is(e)}},mvex:function(e){return{boxes:is(e)}},mvhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,n={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=zs(t.getUint32(i)),i+=8,n.modificationTime=zs(t.getUint32(i)),i+=4,n.timescale=t.getUint32(i),i+=8,n.duration=t.getUint32(i)):(n.creationTime=zs(t.getUint32(i)),i+=4,n.modificationTime=zs(t.getUint32(i)),i+=4,n.timescale=t.getUint32(i),i+=4,n.duration=t.getUint32(i)),i+=4,n.rate=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,n.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,i+=8,n.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,i+=24,n.nextTrackId=t.getUint32(i),n},pdin:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t<e.byteLength;t++)i.samples.push({dependsOn:(48&e[t])>>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return i},sidx:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},r=i.getUint16(22);for(t=24;r;t+=12,r--)n.references.push({referenceType:(128&e[t])>>>7,referencedSize:2147483647&i.getUint32(t),subsegmentDuration:i.getUint32(t+4),startsWithSap:!!(128&e[t+8]),sapType:(112&e[t+8])>>>4,sapDeltaTime:268435455&i.getUint32(t+8)});return n},smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:is(e)}},stco:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},r=i.getUint32(4);for(t=8;r;t+=4,r--)n.chunkOffsets.push(i.getUint32(t));return n},stsc:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n=i.getUint32(4),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;n;t+=12,n--)r.sampleToChunks.push({firstChunk:i.getUint32(t),samplesPerChunk:i.getUint32(t+4),sampleDescriptionIndex:i.getUint32(t+8)});return r},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:is(e.subarray(8))}},stsz:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(t=12;t<e.byteLength;t+=4)n.entries.push(i.getUint32(t));return n},stts:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},r=i.getUint32(4);for(t=8;r;t+=8,r--)n.timeToSamples.push({sampleCount:i.getUint32(t),sampleDelta:i.getUint32(t+4)});return n},styp:function(e){return Ys.ftyp(e)},tfdt:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:Ws(e[4]<<24|e[5]<<16|e[6]<<8|e[7])};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=Ws(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),t},tfhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],s=2&n.flags[2],a=8&n.flags[2],o=16&n.flags[2],u=32&n.flags[2],l=65536&n.flags[0],c=131072&n.flags[0];return t=8,r&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),s&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),a&&(n.defaultSampleDuration=i.getUint32(t),t+=4),o&&(n.defaultSampleSize=i.getUint32(t),t+=4),u&&(n.defaultSampleFlags=i.getUint32(t)),l&&(n.durationIsEmpty=!0),!r&&c&&(n.baseDataOffsetIsMoof=!0),n},tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,n={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=zs(t.getUint32(i)),i+=8,n.modificationTime=zs(t.getUint32(i)),i+=4,n.trackId=t.getUint32(i),i+=4,i+=8,n.duration=t.getUint32(i)):(n.creationTime=zs(t.getUint32(i)),i+=4,n.modificationTime=zs(t.getUint32(i)),i+=4,n.trackId=t.getUint32(i),i+=4,i+=4,n.duration=t.getUint32(i)),i+=4,i+=8,n.layer=t.getUint16(i),i+=2,n.alternateGroup=t.getUint16(i),i+=2,n.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,n.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,n.width=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,n.height=t.getUint16(i)+t.getUint16(i+2)/16,n},traf:function(e){return{boxes:is(e)}},trak:function(e){return{boxes:is(e)}},trex:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:3&e[20],sampleIsDependedOn:(192&e[21])>>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],s=4&i.flags[2],a=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],c=n.getUint32(4),h=8;for(r&&(i.dataOffset=n.getInt32(h),h+=4),s&&c&&(t={flags:Gs(e.subarray(h,h+4))},h+=4,a&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),l&&(t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t),c--);c--;)t={},a&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),u&&(t.flags=Gs(e.subarray(h,h+4)),h+=4),l&&(t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t);return i},"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}},$s={inspect:is=function(e){for(var t,i,n,r,s,a=0,o=[],u=new ArrayBuffer(e.length),l=new Uint8Array(u),c=0;c<e.length;++c)l[c]=e[c];for(t=new DataView(u);a<e.byteLength;)i=t.getUint32(a),n=Ks(e.subarray(a+4,a+8)),r=i>1?a+i:e.byteLength,(s=(Ys[n]||function(e){return{data:e}})(e.subarray(a+8,r))).size=i,s.type=n,o.push(s),a=r;return o},textify:ns=function(e,t){var i;return t=t||0,i=new Array(2*t+1).join(" "),e.map((function(e,n){return i+e.type+"\n"+Object.keys(e).filter((function(e){return"type"!==e&&"boxes"!==e})).map((function(t){var n=i+" "+t+": ",r=e[t];if(r instanceof Uint8Array||r instanceof Uint32Array){var s=Array.prototype.slice.call(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map((function(e){return" "+("00"+e.toString(16)).slice(-2)})).join("").match(/.{1,24}/g);return s?1===s.length?n+"<"+s.join("").slice(1)+">":n+"<\n"+s.map((function(e){return i+" "+e})).join("\n")+"\n"+i+" >":n+"<>"}return n+JSON.stringify(r,null,2).split("\n").map((function(e,t){return 0===t?e:i+" "+e})).join("\n")})).join("\n")+(e.boxes?"\n"+ns(e.boxes,t+1):"")})).join("\n")},parseType:Ks,findBox:function e(t,i){var n,r,s,a,o,u=[];if(!i.length)return null;for(n=0;n<t.byteLength;)r=Ws(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]),s=Ks(t.subarray(n+4,n+8)),a=r>1?n+r:t.byteLength,s===i[0]&&(1===i.length?u.push(t.subarray(n+8,a)):(o=e(t.subarray(n+8,a),i.slice(1))).length&&(u=u.concat(o))),n=a;return u},parseTraf:Ys.traf,parseTfdt:Ys.tfdt,parseHdlr:Ys.hdlr,parseTfhd:Ys.tfhd,parseTrun:Ys.trun,parseSidx:Ys.sidx},Qs=qs,Js=function(e){return("00"+e.toString(16)).slice(-2)};rs=function(e){return $s.findBox(e,["moov","trak"]).reduce((function(e,t){var i,n,r,s,a;return(i=$s.findBox(t,["tkhd"])[0])?(n=i[0],s=Qs(i[r=0===n?12:20]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3]),(a=$s.findBox(t,["mdia","mdhd"])[0])?(r=0===(n=a[0])?12:20,e[s]=Qs(a[r]<<24|a[r+1]<<16|a[r+2]<<8|a[r+3]),e):null):null}),{})},ss=function(e,t){var i,n,r;return i=$s.findBox(t,["moof","traf"]),n=[].concat.apply([],i.map((function(t){return $s.findBox(t,["tfhd"]).map((function(i){var n,r;return n=Qs(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),r=e[n]||9e4,($s.findBox(t,["tfdt"]).map((function(e){var t,i;return t=e[0],i=Qs(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(i*=Math.pow(2,32),i+=Qs(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),i}))[0]||1/0)/r}))}))),r=Math.min.apply(null,n),isFinite(r)?r:0},as=function(e,t){var i,n=$s.findBox(t,["moof","traf"]),r=0,s=0;if(n&&n.length)for(var a=$s.parseTraf(n[0]),o=0;o<a.boxes.length;o++)"tfhd"===a.boxes[o].type?i=a.boxes[o].trackId:"tfdt"===a.boxes[o].type?r=a.boxes[o].baseMediaDecodeTime:"trun"===a.boxes[o].type&&a.boxes[o].samples.length&&(s=a.boxes[o].samples[0].compositionTimeOffset||0);return(r+s)/(e[i]||9e4)},os=function(e){var t=$s.findBox(e,["moov","trak"]),i=[];return t.forEach((function(e){var t=$s.findBox(e,["mdia","hdlr"]),n=$s.findBox(e,["tkhd"]);t.forEach((function(e,t){var r,s,a=$s.parseType(e.subarray(8,12)),o=n[t];"vide"===a&&(s=0===(r=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?r.getUint32(12):r.getUint32(20),i.push(s))}))})),i},us=function(e){var t=$s.findBox(e,["moov","trak"]),i=[];return t.forEach((function(e){var t,n,r={},s=$s.findBox(e,["tkhd"])[0];s&&(n=(t=new DataView(s.buffer,s.byteOffset,s.byteLength)).getUint8(0),r.id=0===n?t.getUint32(12):t.getUint32(20));var a=$s.findBox(e,["mdia","hdlr"])[0];if(a){var o=$s.parseType(a.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var u=$s.findBox(e,["mdia","minf","stbl","stsd"])[0];if(u){var l=u.subarray(8);r.codec=$s.parseType(l.subarray(4,8));var c,h=$s.findBox(l,[r.codec])[0];h&&(/^[a-z]vc[1-9]$/i.test(r.codec)?(c=h.subarray(78),"avcC"===$s.parseType(c.subarray(4,8))&&c.length>11?(r.codec+=".",r.codec+=Js(c[9]),r.codec+=Js(c[10]),r.codec+=Js(c[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)&&(c=h.subarray(28),"esds"===$s.parseType(c.subarray(4,8))&&c.length>20&&0!==c[19]?(r.codec+="."+Js(c[19]),r.codec+="."+Js(c[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"))}var d=$s.findBox(e,["mdia","mdhd"])[0];if(d&&s){var p=0===n?12:20;r.timescale=Qs(d[p]<<24|d[p+1]<<16|d[p+2]<<8|d[p+3])}i.push(r)})),i};var Zs={findBox:$s.findBox,parseType:$s.parseType,timescale:rs,startTime:ss,compositionStartTime:as,videoTrackIds:os,tracks:us},ea=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,r,s;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(s=[],n=arguments.length,n=1;n<arguments.length;++n)s.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,s)}},this.dispose=function(){e={}}}};ea.prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},ea.prototype.push=function(e){this.trigger("data",e)},ea.prototype.flush=function(e){this.trigger("done",e)},ea.prototype.partialFlush=function(e){this.trigger("partialdone",e)},ea.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},ea.prototype.reset=function(e){this.trigger("reset",e)};var ta=ea,ia=function e(){e.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new oa(0,0),new oa(0,1),new oa(1,0),new oa(1,1)],this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this)};(ia.prototype=new ta).push=function(e){var t,i,n;if("sei_rbsp"===e.nalUnitType&&4===(t=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}t+=r,n=0,r=0}return i}(e.escapedRBSP)).payloadType&&(i=function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)}(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));n=function(e,t){var i,n,r,s,a=[];if(!(64&t[0]))return a;for(n=31&t[0],i=0;i<n;i++)s={type:3&t[2+(r=3*i)],pts:e},4&t[r+2]&&(s.ccData=t[r+3]<<8|t[r+4],a.push(s));return a}(e.pts,i),this.captionPackets_=this.captionPackets_.concat(n),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},ia.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},ia.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2&&this.dispatchCea608Packet(e)}),this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},ia.prototype.flush=function(){return this.flushStream("flush")},ia.prototype.partialFlush=function(){return this.flushStream("partialFlush")},ia.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},ia.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},ia.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},ia.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},ia.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var na={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},ra=function(e){return null===e?"":(e=na[e]||e,String.fromCharCode(e))},sa=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],aa=function(){for(var e=[],t=15;t--;)e.push("");return e},oa=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,s;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===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(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=aa();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=aa();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=aa()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))s=ra((n=(3&n)<<8)|r),this[this.mode_](e.pts,s),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),s=ra((n=(3&n)<<8)|r),this[this.mode_](e.pts,s),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var a=sa.indexOf(7968&t);"rollUp"===this.mode_&&(a-this.rollUpRows_+1<0&&(a=this.rollUpRows_-1),this.setRollUp(e.pts,a)),a!==this.row_&&(this.clearFormatting(e.pts),this.row_=a),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),s=ra(n),s+=ra(r),this[this.mode_](e.pts,s),this.column_+=s.length)}else this.lastControlCode_=null}};oa.prototype=new ta,oa.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e){try{return e.trim()}catch(e){return console.error("Skipping malformed caption."),""}})).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},oa.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=aa(),this.nonDisplayed_=aa(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},oa.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_},oa.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},oa.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},oa.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},oa.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},oa.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},oa.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},oa.prototype.isNormalChar=function(e){return e>=32&&e<=127},oa.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=aa(),this.displayed_=aa()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},oa.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce((function(e,t){return e+"<"+t+">"}),"");this[this.mode_](e,i)},oa.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),"");this.formatting_=[],this[this.mode_](e,t)}},oa.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},oa.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},oa.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},oa.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var ua=function(e){for(var t,i,n=e.byteLength,r=[],s=1;s<n-2;)0===e[s]&&0===e[s+1]&&3===e[s+2]?(r.push(s+2),s+=2):s++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var a=0;for(s=0;s<t;a++,s++)a===r[0]&&(a++,r.shift()),i[s]=e[a];return i},la=ia,ca=function(e,t){for(var i=e,n=0;n<t.length;n++){var r=t[n];if(i<r.size)return r;i-=r.size}return null},ha=function(e,t){var i=Zs.findBox(e,["moof","traf"]),n=Zs.findBox(e,["mdat"]),r={},s=[];return n.forEach((function(e,t){var n=i[t];s.push({mdat:e,traf:n})})),s.forEach((function(e){var i,n=e.mdat,s=e.traf,a=Zs.findBox(s,["tfhd"]),o=$s.parseTfhd(a[0]),u=o.trackId,l=Zs.findBox(s,["tfdt"]),c=l.length>0?$s.parseTfdt(l[0]).baseMediaDecodeTime:0,h=Zs.findBox(s,["trun"]);t===u&&h.length>0&&(i=function(e,t,i){var n,r,s,a,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u=[];for(r=0;r+4<e.length;r+=s)if(s=o.getUint32(r),r+=4,!(s<=0))switch(31&e[r]){case 6:var l=e.subarray(r+1,r+1+s),c=ca(r,t);n={nalUnitType:"sei_rbsp",size:s,data:l,escapedRBSP:ua(l),trackId:i},c?(n.pts=c.pts,n.dts=c.dts,a=c):(n.pts=a.pts,n.dts=a.dts),u.push(n)}return u}(n,function(e,t,i){var n=t,r=i.defaultSampleDuration||0,s=i.defaultSampleSize||0,a=i.trackId,o=[];return e.forEach((function(e){var t=$s.parseTrun(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=s),e.trackId=a,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),e.pts=n+e.compositionTimeOffset,n+=e.duration})),o=o.concat(t)})),o}(h,c,o),u),r[u]||(r[u]=[]),r[u]=r[u].concat(i))})),r},da=function(){var e,t,i,n,r,s,a=!1;this.isInitialized=function(){return a},this.init=function(t){e=new la,a=!0,s=!!t&&t.isPartial,e.on("data",(function(e){e.startTime=e.startPts/n,e.endTime=e.endPts/n,r.captions.push(e),r.captionStreams[e.stream]=!0}))},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length||i===e[0]&&n===t[i])},this.parse=function(e,s,a){var o;if(!this.isInitialized())return null;if(!s||!a)return null;if(this.isNewInit(s,a))i=s[0],n=a[i];else if(null===i||!n)return t.push(e),null;for(;t.length>0;){var u=t.shift();this.parse(u,s,a)}return null!==(o=function(e,t,i){return null===t?null:{seiNals:ha(e,t)[t],timescale:i}}(e,i,n))&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):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;s?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()},pa=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e};new ta;var fa=function(e){var t=31&e[1];return(t<<=8)|e[2]},ma=function(e){return!!(64&e[1])},ga=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},va=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}},ya={parseType:function(e,t){var i=fa(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=ma(e),i=4+ga(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=ma(e),n=4+ga(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var s=12+((15&e[n+10])<<8|e[n+11]);s<r;){var a=n+s;t[(31&e[a+1])<<8|e[a+2]]=e[a],s+=5+((15&e[a+3])<<8|e[a+4])}return t}},parsePayloadUnitStartIndicator:ma,parsePesType:function(e,t){switch(t[fa(e)]){case 27:return"video";case 15:return"audio";case 21:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!ma(e))return null;var t=4+ga(e);if(t>=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).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,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.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,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+ga(e),i=e.subarray(t),n=0,r=0,s=!1;r<i.byteLength-3;r++)if(1===i[r+2]){n=r+5;break}for(;n<i.byteLength;)switch(i[n]){case 0:if(0!==i[n-1]){n+=2;break}if(0!==i[n-2]){n++;break}r+3!==n-2&&"slice_layer_without_partitioning_rbsp_idr"===va(31&i[r+3])&&(s=!0);do{n++}while(1!==i[n]&&n<i.length);r=n-2,n+=3;break;case 1:if(0!==i[n-1]||0!==i[n-2]){n+=3;break}"slice_layer_without_partitioning_rbsp_idr"===va(31&i[r+3])&&(s=!0),r=n-2,n+=3;break;default:n+=3}return i=i.subarray(r),n-=r,r=0,i&&i.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===va(31&i[r+3])&&(s=!0),s}},_a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ba=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},Ta={isLikelyAacData:function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},parseId3TagSize:function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?i+20:i+10},parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return _a[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=ba(e.subarray(10,14)));do{if((i=ba(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r<n.byteLength;r++)if(0===n[r]){if("com.apple.streaming.transportStreamTimestamp"===unescape(function(e,t,i){var n,r="";for(n=0;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r}(n,0,r))){var s=n.subarray(r+1),a=(1&s[3])<<30|s[4]<<22|s[5]<<14|s[6]<<6|s[7]>>>2;return(a*=4)+(3&s[7])}break}}t+=10,t+=i}while(t<e.byteLength);return null}},Sa=9e4,ka=(function(e){return e*Sa},function(e,t){return e*t},function(e){return e/Sa},function(e,t){return e/t},pa),Ca={};Ca.ts=ya,Ca.aac=Ta;var Ea=9e4,wa=188,Pa=71,La=function(e,t,i){for(var n,r,s,a,o=0,u=wa,l=!1;u<=e.byteLength;)if(e[o]!==Pa||e[u]!==Pa&&u!==e.byteLength)o++,u++;else{switch(n=e.subarray(o,u),Ca.ts.parseType(n,t.pid)){case"pes":r=Ca.ts.parsePesType(n,t.table),s=Ca.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&s&&(a=Ca.ts.parsePesTime(n))&&(a.type="audio",i.audio.push(a),l=!0)}if(l)break;o+=wa,u+=wa}for(o=(u=e.byteLength)-wa,l=!1;o>=0;)if(e[o]!==Pa||e[u]!==Pa&&u!==e.byteLength)o--,u--;else{switch(n=e.subarray(o,u),Ca.ts.parseType(n,t.pid)){case"pes":r=Ca.ts.parsePesType(n,t.table),s=Ca.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&s&&(a=Ca.ts.parsePesTime(n))&&(a.type="audio",i.audio.push(a),l=!0)}if(l)break;o-=wa,u-=wa}},Aa=function(e,t,i){for(var n,r,s,a,o,u,l,c=0,h=wa,d=!1,p={data:[],size:0};h<e.byteLength;)if(e[c]!==Pa||e[h]!==Pa)c++,h++;else{switch(n=e.subarray(c,h),Ca.ts.parseType(n,t.pid)){case"pes":if(r=Ca.ts.parsePesType(n,t.table),s=Ca.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(s&&!d&&(a=Ca.ts.parsePesTime(n))&&(a.type="video",i.video.push(a),d=!0),!i.firstKeyFrame)){if(s&&0!==p.size){for(o=new Uint8Array(p.size),u=0;p.data.length;)l=p.data.shift(),o.set(l,u),u+=l.byteLength;if(Ca.ts.videoPacketContainsKeyFrame(o)){var f=Ca.ts.parsePesTime(o);f?(i.firstKeyFrame=f,i.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}p.size=0}p.data.push(n),p.size+=n.byteLength}}if(d&&i.firstKeyFrame)break;c+=wa,h+=wa}for(c=(h=e.byteLength)-wa,d=!1;c>=0;)if(e[c]!==Pa||e[h]!==Pa)c--,h--;else{switch(n=e.subarray(c,h),Ca.ts.parseType(n,t.pid)){case"pes":r=Ca.ts.parsePesType(n,t.table),s=Ca.ts.parsePayloadUnitStartIndicator(n),"video"===r&&s&&(a=Ca.ts.parsePesTime(n))&&(a.type="video",i.video.push(a),d=!0)}if(d)break;c-=wa,h-=wa}},Ia=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},xa=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),Oa=null,Da=function(){function e(t){Ia(this,e),Oa||(Oa=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],n=t[4],r=i[4],s=void 0,a=void 0,o=void 0,u=[],l=[],c=void 0,h=void 0,d=void 0,p=void 0,f=void 0;for(s=0;s<256;s++)l[(u[s]=s<<1^283*(s>>7))^s]=s;for(a=o=0;!n[a];a^=c||1,o=l[o]||1)for(d=(d=o^o<<1^o<<2^o<<3^o<<4)>>8^255&d^99,n[a]=d,r[d]=a,f=16843009*u[h=u[c=u[a]]]^65537*h^257*c^16843008*a,p=257*u[d]^16843008*d,s=0;s<4;s++)t[s][a]=p=p<<24^p>>>8,i[s][d]=f=f<<24^f>>>8;for(s=0;s<5;s++)t[s]=t[s].slice(0),i[s]=i[s].slice(0);return e}()),this._tables=[[Oa[0][0].slice(),Oa[0][1].slice(),Oa[0][2].slice(),Oa[0][3].slice(),Oa[0][4].slice()],[Oa[1][0].slice(),Oa[1][1].slice(),Oa[1][2].slice(),Oa[1][3].slice(),Oa[1][4].slice()]];var i=void 0,n=void 0,r=void 0,s=void 0,a=void 0,o=this._tables[0][4],u=this._tables[1],l=t.length,c=1;if(4!==l&&6!==l&&8!==l)throw new Error("Invalid aes key size");for(s=t.slice(0),a=[],this._key=[s,a],i=l;i<4*l+28;i++)r=s[i-1],(i%l==0||8===l&&i%l==4)&&(r=o[r>>>24]<<24^o[r>>16&255]<<16^o[r>>8&255]<<8^o[255&r],i%l==0&&(r=r<<8^r>>>24^c<<24,c=c<<1^283*(c>>7))),s[i]=s[i-l]^r;for(n=0;i;n++,i--)r=s[3&n?i:i-4],a[n]=i<=4||n<4?r:u[0][o[r>>>24]]^u[1][o[r>>16&255]]^u[2][o[r>>8&255]]^u[3][o[255&r]]}return e.prototype.decrypt=function(e,t,i,n,r,s){var a=this._key[1],o=e^a[0],u=n^a[1],l=i^a[2],c=t^a[3],h=void 0,d=void 0,p=void 0,f=a.length/4-2,m=void 0,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],S=v[4];for(m=0;m<f;m++)h=y[o>>>24]^_[u>>16&255]^b[l>>8&255]^T[255&c]^a[g],d=y[u>>>24]^_[l>>16&255]^b[c>>8&255]^T[255&o]^a[g+1],p=y[l>>>24]^_[c>>16&255]^b[o>>8&255]^T[255&u]^a[g+2],c=y[c>>>24]^_[o>>16&255]^b[u>>8&255]^T[255&l]^a[g+3],g+=4,o=h,u=d,l=p;for(m=0;m<4;m++)r[(3&-m)+s]=S[o>>>24]<<24^S[u>>16&255]<<16^S[l>>8&255]<<8^S[255&c]^a[g++],h=o,o=u,u=l,l=c,c=h},e}(),Ra=function(){function e(){Ia(this,e),this.listeners={}}return e.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},e.prototype.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},e.prototype.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),s=t.length,a=0;a<s;++a)t[a].apply(this,r)},e.prototype.dispose=function(){this.listeners={}},e.prototype.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}(),Ua=function(e){function t(){Ia(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,Ra));return i.jobs=[],i.delay=1,i.timeout_=null,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},t.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(Ra),Ma=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},Na=function(e,t,i){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),r=new Da(Array.prototype.slice.call(t)),s=new Uint8Array(e.byteLength),a=new Int32Array(s.buffer),o=void 0,u=void 0,l=void 0,c=void 0,h=void 0,d=void 0,p=void 0,f=void 0,m=void 0;for(o=i[0],u=i[1],l=i[2],c=i[3],m=0;m<n.length;m+=4)h=Ma(n[m]),d=Ma(n[m+1]),p=Ma(n[m+2]),f=Ma(n[m+3]),r.decrypt(h,d,p,f,a,m),a[m]=Ma(a[m]^o),a[m+1]=Ma(a[m+1]^u),a[m+2]=Ma(a[m+2]^l),a[m+3]=Ma(a[m+3]^c),o=h,u=d,l=p,c=f;return s},Ba=function(){function e(t,i,n,r){Ia(this,e);var s=e.STEP,a=new Int32Array(t.buffer),o=new Uint8Array(t.byteLength),u=0;for(this.asyncStream_=new Ua,this.asyncStream_.push(this.decryptChunk_(a.subarray(u,u+s),i,n,o)),u=s;u<a.length;u+=s)n=new Uint32Array([Ma(a[u-4]),Ma(a[u-3]),Ma(a[u-2]),Ma(a[u-1])]),this.asyncStream_.push(this.decryptChunk_(a.subarray(u,u+s),i,n,o));this.asyncStream_.push((function(){var e;r(null,(e=o).subarray(0,e.byteLength-e[e.byteLength-1]))}))}return e.prototype.decryptChunk_=function(e,t,i,n){return function(){var r=Na(e,t,i);n.set(r,e.byteOffset)}},xa(e,null,[{key:"STEP",get:function(){return 32e3}}]),e}(),ja=function(t,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(t)||(t=Xr.buildAbsoluteURL(e.location.href,t)),Xr.buildAbsoluteURL(t,i))},Fa=function(e,t,i){return e&&i.responseURL&&t!==i.responseURL?i.responseURL:t},Ha=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},Va=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),qa=function e(t,i,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,i);if(void 0===r){var s=Object.getPrototypeOf(t);return null===s?void 0:e(s,i,n)}if("value"in r)return r.value;var a=r.get;return void 0!==a?a.call(n):void 0},Wa=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},za=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},Ga=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var i=[],n=!0,r=!1,s=void 0;try{for(var a,o=e[Symbol.iterator]();!(n=(a=o.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(e){r=!0,s=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw s}}return i}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},Ka=zr.mergeOptions,Xa=zr.EventTarget,Ya=zr.log,$a=function(e,t){["AUDIO","SUBTITLES"].forEach((function(i){for(var n in e.mediaGroups[i])for(var r in e.mediaGroups[i][n]){var s=e.mediaGroups[i][n][r];t(s,i,n,r)}}))},Qa=function(e,t){var i=Ka(e,{}),n=i.playlists[t.uri];if(!n)return null;if(n.segments&&t.segments&&n.segments.length===t.segments.length&&n.endList===t.endList&&n.mediaSequence===t.mediaSequence)return null;var r=Ka(n,t);n.segments&&(r.segments=function(e,t,i){var n=t.slice();i=i||0;for(var r=Math.min(e.length,t.length+i),s=i;s<r;s++)n[s-i]=Ka(e[s],n[s-i]);return n}(n.segments,t.segments,t.mediaSequence-n.mediaSequence)),r.segments.forEach((function(e){!function(e,t){e.resolvedUri||(e.resolvedUri=ja(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=ja(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=ja(t,e.map.uri))}(e,r.resolvedUri)}));for(var s=0;s<i.playlists.length;s++)i.playlists[s].uri===t.uri&&(i.playlists[s]=r);return i.playlists[t.uri]=r,i},Ja=function(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];e.playlists[i.uri]=i,i.resolvedUri=ja(e.uri,i.uri),i.id=t,i.attributes||(i.attributes={},Ya.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))}},Za=function(e){$a(e,(function(t){t.uri&&(t.resolvedUri=ja(e.uri,t.uri))}))},eo=function(e,t){var i=e.segments[e.segments.length-1];return t&&i&&i.duration?1e3*i.duration:500*(e.targetDuration||10)},to=function(t){function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ha(this,i);var r=za(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),s=n.withCredentials,a=void 0!==s&&s,o=n.handleManifestRedirects,u=void 0!==o&&o;r.srcUrl=e,r.hls_=t,r.withCredentials=a,r.handleManifestRedirects=u;var l=t.options_;if(r.customTagParsers=l&&l.customTagParsers||[],r.customTagMappers=l&&l.customTagMappers||[],!r.srcUrl)throw new Error("A non-empty playlist URL is required");return r.state="HAVE_NOTHING",r.on("mediaupdatetimeout",(function(){"HAVE_METADATA"===r.state&&(r.state="HAVE_CURRENT_METADATA",r.request=r.hls_.xhr({uri:ja(r.master.uri,r.media().uri),withCredentials:r.withCredentials},(function(e,t){if(r.request)return e?r.playlistRequestError(r.request,r.media().uri,"HAVE_METADATA"):void r.haveMetadata(r.request,r.media().uri)})))})),r}return Wa(i,t),Va(i,[{key:"playlistRequestError",value:function(e,t,i){this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[t],status:e.status,message:"HLS playlist request error at URL: "+t+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")}},{key:"haveMetadata",value:function(t,i){var n=this;this.request=null,this.state="HAVE_METADATA";var r=new ls;this.customTagParsers.forEach((function(e){return r.addParser(e)})),this.customTagMappers.forEach((function(e){return r.addTagMapper(e)})),r.push(t.responseText),r.end(),r.manifest.uri=i,r.manifest.attributes=r.manifest.attributes||{};var s=Qa(this.master,r.manifest);this.targetDuration=r.manifest.targetDuration,s?(this.master=s,this.media_=this.master.playlists[r.manifest.uri]):this.trigger("playlistunchanged"),this.media().endList||(e.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=e.setTimeout((function(){n.trigger("mediaupdatetimeout")}),eo(this.media(),!!s))),this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.finalRenditionTimeout)}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"media",value:function(t,i){var n=this;if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof t){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}if(e.clearTimeout(this.finalRenditionTimeout),i){var r=t.targetDuration/2*1e3||5e3;this.finalRenditionTimeout=e.setTimeout(this.media.bind(this,t,!1),r)}else{var s=this.state,a=!this.media_||t.uri!==this.media_.uri;if(this.master.playlists[t.uri].endList)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=t,void(a&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(a){if(this.state="SWITCHING_MEDIA",this.request){if(t.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.request=this.hls_.xhr({uri:t.resolvedUri,withCredentials:this.withCredentials},(function(e,i){if(n.request){if(t.resolvedUri=Fa(n.handleManifestRedirects,t.resolvedUri,i),e)return n.playlistRequestError(n.request,t.uri,s);n.haveMetadata(i,t.uri),"HAVE_MASTER"===s?n.trigger("loadedmetadata"):n.trigger("mediachange")}}))}}}},{key:"pause",value:function(){this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),"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")}},{key:"load",value:function(t){var i=this;e.clearTimeout(this.mediaUpdateTimeout);var n=this.media();if(t){var r=n?n.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=e.setTimeout((function(){return i.load()}),r)}else this.started?n&&!n.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}},{key:"start",value:function(){var t=this;this.started=!0,this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(t.request){if(t.request=null,i)return t.error={status:n.status,message:"HLS playlist request error at URL: "+t.srcUrl+".",responseText:n.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");var r=new ls;return t.customTagParsers.forEach((function(e){return r.addParser(e)})),t.customTagMappers.forEach((function(e){return r.addTagMapper(e)})),r.push(n.responseText),r.end(),t.state="HAVE_MASTER",t.srcUrl=Fa(t.handleManifestRedirects,t.srcUrl,n),r.manifest.uri=t.srcUrl,r.manifest.playlists?(t.master=r.manifest,Ja(t.master),Za(t.master),t.trigger("loadedplaylist"),void(t.request||t.media(r.manifest.playlists[0]))):(t.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:e.location.href,playlists:[{uri:t.srcUrl,id:0,resolvedUri:t.srcUrl,attributes:{}}]},t.master.playlists[t.srcUrl]=t.master.playlists[0],t.haveMetadata(n,t.srcUrl),t.trigger("loadedmetadata"))}}))}}]),i}(Xa),io=zr.createTimeRange,no=function(e,t,i){var n,r;return void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence?0:(n=function(e,t){var i=0,n=t-e.mediaSequence,r=e.segments[n];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if(void 0!==(r=e.segments[n]).end)return{result:i+r.end,precise:!0};if(i+=r.duration,void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(e,t)).precise?n.result:(r=function(e,t){for(var i=0,n=void 0,r=t-e.mediaSequence;r<e.segments.length;r++){if(void 0!==(n=e.segments[r]).start)return{result:n.start-i,precise:!0};if(i+=n.duration,void 0!==n.end)return{result:n.end-i,precise:!0}}return{result:-1,precise:!1}}(e,t)).precise?r.result:n.result+i},ro=function(t,i,n){if(!t)return 0;if("number"!=typeof n&&(n=0),void 0===i){if(t.totalDuration)return t.totalDuration;if(!t.endList)return e.Infinity}return no(t,i,n)},so=function(e,t,i){var n=0;if(t>i){var r=[i,t];t=r[0],i=r[1]}if(t<0){for(var s=t;s<Math.min(0,i);s++)n+=e.targetDuration;t=0}for(var a=t;a<i;a++)n+=e.segments[a].duration;return n},ao=function(e){if(!e.segments.length)return 0;for(var t=e.segments.length-1,i=e.segments[t].duration||e.targetDuration,n=i+2*e.targetDuration;t--&&!((i+=e.segments[t].duration)>=n););return Math.max(0,t)},oo=function(e,t,i){if(!e||!e.segments)return null;if(e.endList)return ro(e);if(null===t)return null;t=t||0;var n=i?ao(e):e.segments.length;return no(e,e.mediaSequence+n,t)},uo=function(e){return e-Math.floor(e)==0},lo=function(e,t){if(uo(t))return t+.1*e;for(var i=t.toString().split(".")[1].length,n=1;n<=i;n++){var r=Math.pow(10,n),s=t*r;if(uo(s)||n===i)return(s+e)/r}},co=lo.bind(null,1),ho=lo.bind(null,-1),po=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},fo=function(e){return e.excludeUntil&&e.excludeUntil===1/0},mo=function(e){var t=po(e);return!e.disabled&&!t},go=function(e,t){return t.attributes&&t.attributes[e]},vo=function(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((function(e){return!!mo(e)&&(e.attributes.BANDWIDTH||0)<i})).length},yo={duration:ro,seekable:function(e,t){var i=t||0,n=oo(e,t,!0);return null===n?io():io(i,n)},safeLiveIndex:ao,getMediaInfoForTime:function(e,t,i,n){var r=void 0,s=void 0,a=e.segments.length,o=t-n;if(o<0){if(i>0)for(r=i-1;r>=0;r--)if(s=e.segments[r],(o+=ho(s.duration))>0)return{mediaIndex:r,startTime:n-so(e,i,r)};return{mediaIndex:0,startTime:t}}if(i<0){for(r=i;r<0;r++)if((o-=e.targetDuration)<0)return{mediaIndex:0,startTime:t};i=0}for(r=i;r<a;r++)if(s=e.segments[r],(o-=co(s.duration))<0)return{mediaIndex:r,startTime:n+so(e,i,r)};return{mediaIndex:a-1,startTime:t}},isEnabled:mo,isDisabled:function(e){return e.disabled},isBlacklisted:po,isIncompatible:fo,playlistEnd:oo,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},isFmp4:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].map)return!0;return!1},hasAttribute:go,estimateSegmentRequestTime:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!go("BANDWIDTH",i))return NaN;var r=e*i.attributes.BANDWIDTH;return(r-8*n)/t},isLowestEnabledRendition:vo},_o=zr.xhr,bo=zr.mergeOptions,To=function(){return function e(t,i){t=bo({timeout:45e3},t);var n=e.beforeRequest||zr.Hls.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);r&&(t=r)}var s=_o(t,(function(e,t){var n=s.response;!e&&n&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=n.byteLength||n.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),t.headers&&(s.responseHeaders=t.headers),e&&"ETIMEDOUT"===e.code&&(s.timedout=!0),e||s.aborted||200===t.statusCode||206===t.statusCode||0===t.statusCode||(e=new Error("XHR Failed with a response of: "+(s&&(n||s.responseText)))),i(e,s)})),a=s.abort;return s.abort=function(){return s.aborted=!0,a.apply(s,arguments)},s.uri=t.uri,s.requestTime=Date.now(),s}},So=function(e){var t,i,n={};return e.byterange&&(n.Range=(i=(t=e.byterange).offset+t.length-1,"bytes="+t.offset+"-"+i)),n},ko=function(e,t){return e.start(t)+"-"+e.end(t)},Co=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Eo=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},wo=function(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},Po=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Lo=function(e){return e.resolvedUri},Ao=function(e){for(var t=Array.prototype.slice.call(e),i=16,n="",r=0;r<t.length/i;r++)n+=t.slice(r*i,r*i+i).map(Co).join("")+" "+t.slice(r*i,r*i+i).map(Eo).join("")+"\n";return n},Io=Object.freeze({createTransferableMessage:wo,initSegmentId:Po,segmentKeyId:Lo,hexDump:Ao,tagDump:function(e){var t=e.bytes;return Ao(t)},textRanges:function(e){var t="",i=void 0;for(i=0;i<e.length;i++)t+=ko(e,i)+" ";return t}}),xo=function e(t){var i=t.programTime,n=t.playlist,r=t.retryCount,s=void 0===r?2:r,a=t.seekTo,o=t.pauseAfterSeek,u=void 0===o||o,l=t.tech,c=t.callback;if(!c)throw new Error("seekToProgramTime: callback must be provided");if(void 0===i||!n||!a)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!l.hasStarted_)return c({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 t=0;t<e.segments.length;t++)if(!e.segments[t].dateTimeObject)return!1;return!0}(n))return c({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri});var h=function(e,t){var i=void 0;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;var n=t.segments[0];if(i<n.dateTimeObject)return null;for(var r=0;r<t.segments.length-1&&(n=t.segments[r],!(i<t.segments[r+1].dateTimeObject));r++);var s,a=t.segments[t.segments.length-1],o=a.dateTimeObject,u=a.videoTimingInfo?(s=a.videoTimingInfo).transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds:a.duration+.25*a.duration;return i>new Date(o.getTime()+1e3*u)?null:(i>o&&(n=a),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:yo.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(i,n);if(!h)return c({message:i+" was not found in the stream"});var d=h.segment,p=function(e,t){var i=void 0,n=void 0;try{i=new Date(e),n=new Date(t)}catch(e){}var r=i.getTime();return(n.getTime()-r)/1e3}(d.dateTimeObject,i);if("estimate"===h.type)return 0===s?c({message:i+" is not buffered yet. Try again"}):(a(h.estimatedStart+p),void l.one("seeked",(function(){e({programTime:i,playlist:n,retryCount:s-1,seekTo:a,pauseAfterSeek:u,tech:l,callback:c})})));var f=d.start+p;l.one("seeked",(function(){return c(null,l.currentTime())})),u&&l.pause(),a(f)},Oo=1/30,Do=.1,Ro=function(e,t){var i=[],n=void 0;if(e&&e.length)for(n=0;n<e.length;n++)t(e.start(n),e.end(n))&&i.push([e.start(n),e.end(n)]);return zr.createTimeRanges(i)},Uo=function(e,t){return Ro(e,(function(e,i){return e-Do<=t&&i+Do>=t}))},Mo=function(e,t){return Ro(e,(function(e){return e-Oo>=t}))},No=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},Bo=function(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t},jo=function(e,t,i){var n=void 0,r=void 0;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime<=t&&r.endTime>=e&&i.removeCue(r)},Fo=function(e){return isNaN(e)||Math.abs(e)===1/0?Number.MAX_VALUE:e},Ho="undefined"!=typeof window?window:{},Vo="undefined"==typeof Symbol?"__target":Symbol(),qo=Ho.BlobBuilder||Ho.WebKitBlobBuilder||Ho.MozBlobBuilder||Ho.MSBlobBuilder,Wo=Ho.URL||Ho.webkitURL||Wo&&Wo.msURL,zo=Ho.Worker;function Go(e,t){return function(i){var n=this;if(!t)return new zo(e);if(zo&&!i){var r=$o(t.toString().replace(/^function.+?{/,"").slice(0,-1));return this[Vo]=new zo(r),function(e,t){if(e&&t){var i=e.terminate;e.objURL=t,e.terminate=function(){e.objURL&&Wo.revokeObjectURL(e.objURL),i.call(e)}}}(this[Vo],r),this[Vo]}var s={postMessage:function(e){n.onmessage&&setTimeout((function(){n.onmessage({data:e,target:s})}))}};t.call(s),this.postMessage=function(e){setTimeout((function(){s.onmessage({data:e,target:n})}))},this.isThisThread=!0}}if(zo){var Ko,Xo=$o("self.onmessage = function () {}"),Yo=new Uint8Array(1);try{(Ko=new zo(Xo)).postMessage(Yo,[Yo.buffer])}catch(e){zo=null}finally{Wo.revokeObjectURL(Xo),Ko&&Ko.terminate()}}function $o(e){try{return Wo.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(i){var t=new qo;return t.append(e),Wo.createObjectURL(t.getBlob(type))}}var Qo=new Go("./transmuxer-worker.worker.js",(function(e,t){var i=this;!function(){var e=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,r,s;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(s=[],n=arguments.length,n=1;n<arguments.length;++n)s.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,s)}},this.dispose=function(){e={}}}};e.prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},e.prototype.push=function(e){this.trigger("data",e)},e.prototype.flush=function(e){this.trigger("done",e)},e.prototype.partialFlush=function(e){this.trigger("partialdone",e)},e.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},e.prototype.reset=function(e){this.trigger("reset",e)};var t,n,r,s,a,o,u,l,c,h,d,p,f,m,g,v,y,_,b,T,S,k,C,E,w,P,L,A,I,x,O,D,R,U,M,N,B,j,F,H,V=e,q=Math.pow(2,32)-1;!function(){var e;if(k={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in k)k.hasOwnProperty(e)&&(k[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);C=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),w=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),E=new Uint8Array([0,0,0,1]),P=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),L=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),A={video:P,audio:L},O=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0]),D=new Uint8Array([0,0,0,0,0,0,0,0]),R=D,U=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M=D,I=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),t=function(e){var t,i,n=[],r=0;for(t=1;t<arguments.length;t++)n.push(arguments[t]);for(t=n.length;t--;)r+=n[t].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,r=8;t<n.length;t++)i.set(n[t],r),r+=n[t].byteLength;return i},n=function(){return t(k.dinf,t(k.dref,O))},r=function(e){return t(k.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},g=function(e){return t(k.hdlr,A[e])},m=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(k.mdhd,i)},f=function(e){return t(k.mdia,m(e),g(e.type),o(e))},a=function(e){return t(k.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},o=function(e){return t(k.minf,"video"===e.type?t(k.vmhd,I):t(k.smhd,x),n(),y(e))},u=function(e,i){for(var n=[],r=i.length;r--;)n[r]=b(i[r]);return t.apply(null,[k.moof,a(e)].concat(n))},l=function(e){for(var i=e.length,n=[];i--;)n[i]=d(e[i]);return t.apply(null,[k.moov,h(4294967295)].concat(n).concat(c(e)))},c=function(e){for(var i=e.length,n=[];i--;)n[i]=T(e[i]);return t.apply(null,[k.mvex].concat(n))},h=function(e){var i=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 t(k.mvhd,i)},v=function(e){var i,n,r=e.samples||[],s=new Uint8Array(4+r.length);for(n=0;n<r.length;n++)i=r[n].flags,s[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return t(k.sdtp,s)},y=function(e){return t(k.stbl,_(e),t(k.stts,M),t(k.stsc,R),t(k.stsz,U),t(k.stco,D))},_=function(e){return t(k.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?N(e):B(e))},N=function(e){var i,n,r=e.sps||[],s=e.pps||[],a=[],o=[];for(i=0;i<r.length;i++)a.push((65280&r[i].byteLength)>>>8),a.push(255&r[i].byteLength),a=a.concat(Array.prototype.slice.call(r[i]));for(i=0;i<s.length;i++)o.push((65280&s[i].byteLength)>>>8),o.push(255&s[i].byteLength),o=o.concat(Array.prototype.slice.call(s[i]));if(n=[k.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&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.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]),t(k.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],a,[s.length],o))),t(k.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var u=e.sarRatio[0],l=e.sarRatio[1];n.push(t(k.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l])))}return t.apply(null,n)},B=function(e){return t(k.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),r(e))},p=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.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&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(k.tkhd,i)},b=function(e){var i,n,r,s,a,o;return i=t(k.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),a=Math.floor(e.baseMediaDecodeTime/(q+1)),o=Math.floor(e.baseMediaDecodeTime%(q+1)),n=t(k.tfdt,new Uint8Array([1,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type?(r=S(e,92),t(k.traf,i,n,r)):(s=v(e),r=S(e,s.length+92),t(k.traf,i,n,r,s))},d=function(e){return e.duration=e.duration||4294967295,t(k.trak,p(e),f(e))},T=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(k.trex,i)},H=function(e,t){var i=0,n=0,r=0,s=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(s=8)),[0,0,i|n|r|s,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]},F=function(e,i){var n,r,s,a;for(i+=20+16*(r=e.samples||[]).length,n=H(r,i),a=0;a<r.length;a++)s=r[a],n=n.concat([(4278190080&s.duration)>>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size,s.flags.isLeading<<2|s.flags.dependsOn,s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,61440&s.flags.degradationPriority,15&s.flags.degradationPriority,(4278190080&s.compositionTimeOffset)>>>24,(16711680&s.compositionTimeOffset)>>>16,(65280&s.compositionTimeOffset)>>>8,255&s.compositionTimeOffset]);return t(k.trun,new Uint8Array(n))},j=function(e,i){var n,r,s,a;for(i+=20+8*(r=e.samples||[]).length,n=H(r,i),a=0;a<r.length;a++)s=r[a],n=n.concat([(4278190080&s.duration)>>>24,(16711680&s.duration)>>>16,(65280&s.duration)>>>8,255&s.duration,(4278190080&s.size)>>>24,(16711680&s.size)>>>16,(65280&s.size)>>>8,255&s.size]);return t(k.trun,new Uint8Array(n))},S=function(e,t){return"audio"===e.type?j(e,t):F(e,t)},s=function(){return t(k.ftyp,C,E,C,w)};var W,z,G,K,X,Y,$,Q,J=function(e){return t(k.mdat,e)},Z=u,ee=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},te=[33,16,5,32,164,27],ie=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ne=function(e){for(var t=[];e--;)t.push(0);return t},re={96e3:[te,[227,64],ne(154),[56]],88200:[te,[231],ne(170),[56]],64e3:[te,[248,192],ne(240),[56]],48e3:[te,[255,192],ne(268),[55,148,128],ne(54),[112]],44100:[te,[255,192],ne(268),[55,163,128],ne(84),[112]],32e3:[te,[255,192],ne(268),[55,234],ne(226),[112]],24e3:[te,[255,192],ne(268),[55,255,128],ne(268),[111,112],ne(126),[224]],16e3:[te,[255,192],ne(268),[55,255,128],ne(268),[111,255],ne(269),[223,108],ne(195),[1,192]],12e3:[ie,ne(268),[3,127,248],ne(268),[6,255,240],ne(268),[13,255,224],ne(268),[27,253,128],ne(259),[56]],11025:[ie,ne(268),[3,127,248],ne(268),[6,255,240],ne(268),[13,255,224],ne(268),[27,255,192],ne(268),[55,175,128],ne(108),[112]],8e3:[ie,ne(268),[3,121,16],ne(47),[7]]},se=(W=re,Object.keys(W).reduce((function(e,t){return e[t]=new Uint8Array(W[t].reduce((function(e,t){return e.concat(t)}),[])),e}),{})),ae=9e4;Y=function(e,t){return z(X(e,t))},$=function(e,t){return G(K(e),t)},Q=function(e,t,i){return K(i?e:e-t)};var oe=ae,ue=(z=function(e){return e*ae},G=function(e,t){return e*t},K=function(e){return e/ae},X=function(e,t){return e/t},Y),le=$,ce=Q,he=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},de=function(e,t){var i,n=e.minSegmentDts;return t||(n-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=n,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/9e4,i=Math.floor(i)),i},pe=function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},fe=function e(){e.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new _e(0,0),new _e(0,1),new _e(1,0),new _e(1,1)],this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this)};(fe.prototype=new V).push=function(e){var t,i,n;if("sei_rbsp"===e.nalUnitType&&4===(t=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}t+=r,n=0,r=0}return i}(e.escapedRBSP)).payloadType&&(i=function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)}(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));n=function(e,t){var i,n,r,s,a=[];if(!(64&t[0]))return a;for(n=31&t[0],i=0;i<n;i++)s={type:3&t[2+(r=3*i)],pts:e},4&t[r+2]&&(s.ccData=t[r+3]<<8|t[r+4],a.push(s));return a}(e.pts,i),this.captionPackets_=this.captionPackets_.concat(n),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},fe.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},fe.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2&&this.dispatchCea608Packet(e)}),this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},fe.prototype.flush=function(){return this.flushStream("flush")},fe.prototype.partialFlush=function(){return this.flushStream("partialFlush")},fe.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},fe.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},fe.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},fe.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},fe.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var me={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},ge=function(e){return null===e?"":(e=me[e]||e,String.fromCharCode(e))},ve=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],ye=function(){for(var e=[],t=15;t--;)e.push("");return e},_e=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,s;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===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(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=ye();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=ye();else if(t===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))s=ge((n=(3&n)<<8)|r),this[this.mode_](e.pts,s),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),s=ge((n=(3&n)<<8)|r),this[this.mode_](e.pts,s),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var a=ve.indexOf(7968&t);"rollUp"===this.mode_&&(a-this.rollUpRows_+1<0&&(a=this.rollUpRows_-1),this.setRollUp(e.pts,a)),a!==this.row_&&(this.clearFormatting(e.pts),this.row_=a),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),s=ge(n),s+=ge(r),this[this.mode_](e.pts,s),this.column_+=s.length)}else this.lastControlCode_=null}};_e.prototype=new V,_e.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e){try{return e.trim()}catch(e){return console.error("Skipping malformed caption."),""}})).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,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<this.BASE_+8&&t>=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.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},_e.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce((function(e,t){return e+"<"+t+">"}),"");this[this.mode_](e,i)},_e.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),"");this.formatting_=[],this[this.mode_](e,t)}},_e.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},_e.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},_e.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},_e.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var be={CaptionStream:fe,Cea608Stream:_e},Te={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Se="shared",ke=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},Ce=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||Se,this.push=function(e){this.type_!==Se&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=ke(e.dts,n),e.pts=ke(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ce.prototype=new V;var Ee,we=Ce,Pe=function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r},Le=function(e,t,i){return decodeURIComponent(Pe(e,t,i))},Ae=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},Ie={TXXX:function(e){var t;if(3===e.data[0]){for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Le(e.data,1,t),e.value=Le(e.data,t+1,e.data.length).replace(/\0*$/,"");break}e.data=e.value}},WXXX:function(e){var t;if(3===e.data[0])for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Le(e.data,1,t),e.url=Le(e.data,t+1,e.data.length);break}},PRIV:function(e){var t,i;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(i=e.data,unescape(Pe(i,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Ee=function(e){var t,i={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},n=0,r=[],s=0;if(Ee.prototype.init.call(this),this.dispatchType=Te.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,a,o,u,l;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(s=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))i.debug&&console.log("Skipping unrecognized metadata packet");else if(r.push(e),s+=e.data.byteLength,1===r.length&&(n=Ae(e.data.subarray(6,10)),n+=10),!(s<n)){for(t={data:new Uint8Array(n),frames:[],pts:r[0].pts,dts:r[0].dts},l=0;l<n;)t.data.set(r[0].data.subarray(0,n-l),l),l+=r[0].data.byteLength,s-=r[0].data.byteLength,r.shift();a=10,64&t.data[5]&&(a+=4,a+=Ae(t.data.subarray(10,14)),n-=Ae(t.data.subarray(16,20)));do{if((o=Ae(t.data.subarray(a+4,a+8)))<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");if((u={id:String.fromCharCode(t.data[a],t.data[a+1],t.data[a+2],t.data[a+3]),data:t.data.subarray(a+10,a+o+10)}).key=u.id,Ie[u.id]&&(Ie[u.id](u),"com.apple.streaming.transportStreamTimestamp"===u.owner)){var c=u.data,h=(1&c[3])<<30|c[4]<<22|c[5]<<14|c[6]<<6|c[7]>>>2;h*=4,h+=3&c[7],u.timeStamp=h,void 0===t.pts&&void 0===t.dts&&(t.pts=u.timeStamp,t.dts=u.timeStamp),this.trigger("timestamp",u)}t.frames.push(u),a+=10,a+=o}while(a<n);this.trigger("data",t)}}}).prototype=new V;var xe,Oe,De,Re=Ee,Ue=we,Me=188;(xe=function(){var e=new Uint8Array(Me),t=0;xe.prototype.init.call(this),this.push=function(i){var n,r=0,s=Me;for(t?((n=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),n.set(i,t),t=0):n=i;s<n.byteLength;)71!==n[r]||71!==n[s]?(r++,s++):(this.trigger("data",n.subarray(r,s)),r+=Me,s+=Me);r<n.byteLength&&(e.set(n.subarray(r),0),t=n.byteLength-r)},this.flush=function(){t===Me&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}}).prototype=new V,(Oe=function(){var e,t,i,n;Oe.prototype.init.call(this),n=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,n){var r=0;n.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===n.type?t(e.subarray(r),n):i(e.subarray(r),n)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],n.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=n.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var s=e[r],a=(31&e[r+1])<<8|e[r+2];s===Te.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=a:s===Te.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=a:s===Te.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][a]=s),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=n.programMapTable}},this.push=function(t){var i={},n=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Te.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Te.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new V,Oe.STREAM_TYPES={h264:27,adts:15},(De=function(){var e,t=this,i={data:[],size:0},n={data:[],size:0},r={data:[],size:0},s=function(e,i,n){var r,s,a=new Uint8Array(e.size),o={type:i},u=0,l=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,u=0;u<e.data.length;u++)s=e.data[u],a.set(s.data,l),l+=s.data.byteLength;var c,h,d;c=a,(h=o).packetLength=6+(c[4]<<8|c[5]),h.dataAlignmentIndicator=0!=(4&c[6]),192&(d=c[7])&&(h.pts=(14&c[9])<<27|(255&c[10])<<20|(254&c[11])<<12|(255&c[12])<<5|(254&c[13])>>>3,h.pts*=4,h.pts+=(6&c[13])>>>1,h.dts=h.pts,64&d&&(h.dts=(14&c[14])<<27|(255&c[15])<<20|(254&c[16])<<12|(255&c[17])<<5|(254&c[18])>>>3,h.dts*=4,h.dts+=(6&c[18])>>>1)),h.data=c.subarray(9+c[8]),r="video"===i||o.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",o)}};De.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var e,t;switch(a.streamType){case Te.H264_STREAM_TYPE:case Te.H264_STREAM_TYPE:e=i,t="video";break;case Te.ADTS_STREAM_TYPE:e=n,t="audio";break;case Te.METADATA_STREAM_TYPE:e=r,t="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(a),e.size+=a.data.byteLength},pmt:function(){var i={type:"metadata",tracks:[]};null!==(e=a.programMapTable).video&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",i)}})[a.type]()},this.reset=function(){i.size=0,i.data.length=0,n.size=0,n.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(i,"video"),s(n,"audio"),s(r,"timed-metadata")},this.flush=function(){this.flushStreams_(),this.trigger("done")}}).prototype=new V;var Ne={PAT_PID:0,MP2T_PACKET_LENGTH:Me,TransportPacketStream:xe,TransportParseStream:Oe,ElementaryStream:De,TimestampRolloverStream:Ue,CaptionStream:be.CaptionStream,Cea608Stream:be.Cea608Stream,MetadataStream:Re};for(var Be in Te)Te.hasOwnProperty(Be)&&(Ne[Be]=Te[Be]);var je,Fe=Ne,He=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(je=function(e){var t,i=0;je.prototype.init.call(this),this.push=function(n){var r,s,a,o,u,l,c=0;if(e||(i=0),"audio"===n.type)for(t?(o=t,(t=new Uint8Array(o.byteLength+n.data.byteLength)).set(o),t.set(n.data,o.byteLength)):t=n.data;c+5<t.length;)if(255===t[c]&&240==(246&t[c+1])){if(s=2*(1&~t[c+1]),r=(3&t[c+3])<<11|t[c+4]<<3|(224&t[c+5])>>5,l=9e4*(u=1024*(1+(3&t[c+6])))/He[(60&t[c+2])>>>2],a=c+r,t.byteLength<a)return;if(this.trigger("data",{pts:n.pts+i*l,dts:n.dts+i*l,sampleCount:u,audioobjecttype:1+(t[c+2]>>>6&3),channelcount:(1&t[c+2])<<2|(192&t[c+3])>>>6,samplerate:He[(60&t[c+2])>>>2],samplingfrequencyindex:(60&t[c+2])>>>2,samplesize:16,data:t.subarray(c+7+s,a)}),i++,t.byteLength===a)return void(t=void 0);t=t.subarray(a)}else c++},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new V;var Ve,qe,We,ze=je,Ge=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,s=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");s.set(e.subarray(r,r+a)),i=new DataView(s.buffer).getUint32(0),n=8*a,t-=a},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),s=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?s<<r|this.readBits(r):s},this.skipLeadingZeros=function(){var e;for(e=0;e<n;++e)if(0!=(i&2147483648>>>e))return i<<=e,n-=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()};(qe=function(){var e,t,i=0;qe.prototype.init.call(this),this.push=function(n){var r;t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;for(var s=t.byteLength;i<s-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<s;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<s);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.reset=function(){t=null,i=0,this.trigger("reset")},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new V,We={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Ve=function(){var e,t,i,n,r,s,a,o=new qe;Ve.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(a){var o={trackId:t,pts:i,dts:n,data:a};switch(31&a[0]){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(a.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(a.subarray(1)),o.config=s(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},a=function(e,t){var i,n=8,r=8;for(i=0;i<e;i++)0!==r&&(r=(n+t.readExpGolomb()+256)%256),n=0===r?n:r},r=function(e){for(var t,i,n=e.byteLength,r=[],s=1;s<n-2;)0===e[s]&&0===e[s+1]&&3===e[s+2]?(r.push(s+2),s+=2):s++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var a=0;for(s=0;s<t;a++,s++)a===r[0]&&(a++,r.shift()),i[s]=e[a];return i},s=function(e){var t,i,n,r,s,o,u,l,c,h,d,p,f,m=0,g=0,v=0,y=0,_=1;if(i=(t=new Ge(e)).readUnsignedByte(),r=t.readUnsignedByte(),n=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),We[i]&&(3===(s=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(d=3!==s?8:12,f=0;f<d;f++)t.readBoolean()&&a(f<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),u=t.readUnsignedExpGolomb(),f=0;f<u;f++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),l=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),0===(h=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb(),y=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:p=[1,1];break;case 2:p=[12,11];break;case 3:p=[10,11];break;case 4:p=[16,11];break;case 5:p=[40,33];break;case 6:p=[24,11];break;case 7:p=[20,11];break;case 8:p=[32,11];break;case 9:p=[80,33];break;case 10:p=[18,11];break;case 11:p=[15,11];break;case 12:p=[64,33];break;case 13:p=[160,99];break;case 14:p=[4,3];break;case 15:p=[3,2];break;case 16:p=[2,1];break;case 255:p=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}p&&(_=p[0]/p[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:r,width:Math.ceil((16*(l+1)-2*m-2*g)*_),height:(2-h)*(c+1)*16-2*v-2*y,sarRatio:p}}}).prototype=new V;var Ke,Xe={H264Stream:Ve,NalByteStream:qe},Ye=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?i+20:i+10},$e=function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i};(Ke=function(){var e=new Uint8Array,t=0;Ke.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var n,r,s,a,o=0,u=0;for(e.length?(a=e.length,(e=new Uint8Array(i.byteLength+a)).set(e.subarray(0,a)),e.set(i,a)):e=i;e.length-u>=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255!=(255&e[u])||240!=(240&e[u+1]))u++;else{if(e.length-u<7)break;if(u+(o=$e(e,u))>e.length)break;s={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",s),u+=o}else{if(e.length-u<10)break;if(u+(o=Ye(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}n=e.length-u,e=n>0?e.subarray(u):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new V;var Qe,Je,Ze,et,tt=Ke,it=Xe.H264Stream,nt=function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},rt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],st=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],at=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},ot=function(e,t,i,n,r,s){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(n-t),pts:e+(r-i)},prependedContentDuration:s,baseMediaDecodeTime:e}};(Je=function(e,t){var i=[],n=0,r=0,s=0,a=1/0;t=t||{},Je.prototype.init.call(this),this.push=function(t){pe(e,t),e&&rt.forEach((function(i){e[i]=t[i]})),i.push(t)},this.setEarliestDts=function(t){r=t-e.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(e){a=e},this.setAudioAppendStart=function(e){s=e},this.flush=function(){var o,u,l,c,h;0!==i.length?(o=function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))}(i,e,r),e.baseMediaDecodeTime=de(e,t.keepOriginalTimestamps),function(e,t,i,n){var r,s,a,o,u,l=0,c=0,h=0;if(t.length&&(r=ue(e.baseMediaDecodeTime,e.samplerate),s=Math.ceil(oe/(e.samplerate/1024)),i&&n&&(l=r-Math.max(i,n),h=(c=Math.floor(l/s))*s),!(c<1||h>45e3))){for((a=se[e.samplerate])||(a=t[0].data),o=0;o<c;o++)u=t[0],t.splice(0,0,{data:a,dts:u.dts-s,pts:u.pts-s});e.baseMediaDecodeTime-=Math.floor(le(h,e.samplerate))}}(e,o,s,a),e.samples=function(e){var t,i,n=[];for(t=0;t<e.length;t++)i=e[t],n.push({size:i.data.byteLength,duration:1024});return n}(o),l=J(function(e){var t,i,n=0,r=new Uint8Array(function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i}(e));for(t=0;t<e.length;t++)i=e[t],r.set(i.data,n),n+=i.data.byteLength;return r}(o)),i=[],u=Z(n,[e]),c=new Uint8Array(u.byteLength+l.byteLength),n++,c.set(u),c.set(l,u.byteLength),he(e),h=Math.ceil(9216e4/e.samplerate),o.length&&this.trigger("timingInfo",{start:o[0].dts,end:o[0].dts+o.length*h}),this.trigger("data",{track:e,boxes:c}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")},this.reset=function(){he(e),i=[],this.trigger("reset")}}).prototype=new V,(Qe=function(e,t){var i,n,r=0,s=[],a=[];t=t||{},Qe.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){pe(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],st.forEach((function(t){e[t]=i[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.data,e.pps=[t.data]),s.push(t)},this.flush=function(){for(var i,n,o,u,l,c,h,d=0;s.length&&"access_unit_delimiter_rbsp"!==s[0].nalUnitType;)s.shift();if(0===s.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if((n=function(e){var t,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r}(function(e){var t,i,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,n.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n),r}(s)))[0][0].keyFrame||((i=this.getGopForFusion_(s[0],e))?(d=i.duration,n.unshift(i),n.byteLength+=i.byteLength,n.nalCount+=i.nalCount,n.pts=i.pts,n.dts=i.dts,n.duration+=i.duration):n=function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e}(n)),a.length){var p;if(!(p=t.alignGopsAtEnd?this.alignGopsAtEnd_(n):this.alignGopsAtStart_(n)))return this.gopCache_.unshift({gop:n.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),s=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");he(e),n=p}pe(e,n),e.samples=function(e,t){var i,n,r,s,a,o=t||0,u=[];for(i=0;i<e.length;i++)for(s=e[i],n=0;n<s.length;n++)a=s[n],o+=(r=ee(a,o)).size,u.push(r);return u}(n),u=J(function(e){var t,i,n,r,s,a,o=0,u=e.byteLength,l=e.nalCount,c=new Uint8Array(u+4*l),h=new DataView(c.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(s=r[i],n=0;n<s.length;n++)a=s[n],h.setUint32(o,a.data.byteLength),o+=4,c.set(a.data,o),o+=a.data.byteLength;return c}(n)),e.baseMediaDecodeTime=de(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",n.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),c=n[0],h=n[n.length-1],this.trigger("segmentTimingInfo",ot(e.baseMediaDecodeTime,c.dts,c.pts,h.dts+h.duration,h.pts+h.duration,d)),this.trigger("timingInfo",{start:n[0].dts,end:n[n.length-1].dts+n[n.length-1].duration}),this.gopCache_.unshift({gop:n.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),s=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),o=Z(r,[e]),l=new Uint8Array(o.byteLength+u.byteLength),r++,l.set(o),l.set(u,o.byteLength),this.trigger("data",{track:e,boxes:l}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),s=[],this.gopCache_.length=0,a.length=0,this.trigger("reset")},this.resetStream_=function(){he(e),i=void 0,n=void 0},this.getGopForFusion_=function(t){var i,n,r,s,a,o=1/0;for(a=0;a<this.gopCache_.length;a++)r=(s=this.gopCache_[a]).gop,e.pps&&at(e.pps[0],s.pps[0])&&e.sps&&at(e.sps[0],s.sps[0])&&(r.dts<e.timelineStartInfo.dts||(i=t.dts-r.dts-r.duration)>=-1e4&&i<=45e3&&(!n||o>i)&&(n=s,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,s,o,u,l;for(s=e.byteLength,o=e.nalCount,u=e.duration,t=i=0;t<a.length&&i<e.length&&(n=a[t],r=e[i],n.pts!==r.pts);)r.pts>n.pts?t++:(i++,s-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===i?e:i===e.length?null:((l=e.slice(i)).byteLength=s,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,i,n,r,s,o,u;for(t=a.length-1,i=e.length-1,s=null,o=!1;t>=0&&i>=0;){if(n=a[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===a.length-1&&(s=i),i--)}if(!o&&null===s)return null;if(0===(u=o?i:s))return e;var l=e.slice(u),c=l.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 l.byteLength=c.byteLength,l.duration=c.duration,l.nalCount=c.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){a=e}}).prototype=new V,(et=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,et.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new V,et.prototype.flush=function(e){var t,i,n,r,a,o,u,c,h=0,d={captions:[],captionStreams:{},metadata:[],info:{}},p=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(p=this.videoTrack.timelineStartInfo.pts,st.forEach((function(e){d.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(p=this.audioTrack.timelineStartInfo.pts,rt.forEach((function(e){d.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?d.type=this.pendingTracks[0].type:d.type="combined",this.emittedTracks+=this.pendingTracks.length,a=this.pendingTracks,o=void 0,u=void 0,c=void 0,u=s(),c=l(a),(o=new Uint8Array(u.byteLength+c.byteLength)).set(u),o.set(c,u.byteLength),n=o,d.initSegment=new Uint8Array(n.byteLength),d.initSegment.set(n),d.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)d.data.set(this.pendingBoxes[r],h),h+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=ce(t.startPts,p,this.keepOriginalTimestamps),t.endTime=ce(t.endPts,p,this.keepOriginalTimestamps),d.captionStreams[t.stream]=!0,d.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=ce(i.pts,p,this.keepOriginalTimestamps),d.metadata.push(i);for(d.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",d),r=0;r<d.captions.length;r++)t=d.captions[r],this.trigger("caption",t);for(r=0;r<d.metadata.length;r++)i=d.metadata[r],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},et.prototype.setRemux=function(e){this.remuxTracks=e},(Ze=function(e){var t,i,n=this,r=!0;Ze.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new Fe.MetadataStream,r.aacStream=new tt,r.audioTimestampRolloverStream=new Fe.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Fe.TimestampRolloverStream("timed-metadata"),r.adtsStream=new ze,r.coalesceStream=new et(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(s){"timed-metadata"!==s.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new Je(i,e),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new Fe.MetadataStream,r.packetStream=new Fe.TransportPacketStream,r.parseStream=new Fe.TransportParseStream,r.elementaryStream=new Fe.ElementaryStream,r.timestampRolloverStream=new Fe.TimestampRolloverStream,r.adtsStream=new ze,r.h264Stream=new it,r.captionStream=new Fe.CaptionStream,r.coalesceStream=new et(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(s){var a;if("metadata"===s.type){for(a=s.tracks.length;a--;)t||"video"!==s.tracks[a].type?i||"audio"!==s.tracks[a].type||((i=s.tracks[a]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=s.tracks[a]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new Qe(t,e),r.videoSegmentStream.on("timelineStartInfo",(function(e){i&&(i.timelineStartInfo=e,r.audioSegmentStream.setEarliestDts(e.dts))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new Je(i,e),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,he(i),e.keepOriginalTimestamps||(i.timelineStartInfo.baseMediaDecodeTime=n),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,he(t),r.captionStream.reset(),e.keepOriginalTimestamps||(t.timelineStartInfo.baseMediaDecodeTime=n)),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.push=function(e){if(r){var t=nt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new V;var ut={Transmuxer:Ze,VideoSegmentStream:Qe,AudioSegmentStream:Je,AUDIO_PROPERTIES:rt,VIDEO_PROPERTIES:st,generateVideoSegmentTimingInfo:ot},lt=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),ct=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=i||{},this.self=t,this.init()}return lt(e,[{key:"init",value:function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new ut.Transmuxer(this.options),function(e,t){t.on("data",(function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};var n=t.data;t.data=n.buffer,e.postMessage({action:"data",segment:t,byteOffset:n.byteOffset,byteLength:n.byteLength},[t.data])})),t.captionStream&&t.captionStream.on("data",(function(t){e.postMessage({action:"caption",data:t})})),t.on("done",(function(t){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}))}(this.self,this.transmuxer)}},{key:"push",value:function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}},{key:"reset",value:function(){this.init()}},{key:"setTimestampOffset",value:function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4*t))}},{key:"setAudioAppendStart",value:function(e){this.transmuxer.setAudioAppendStart(Math.ceil(9e4*e.appendStart))}},{key:"flush",value:function(e){this.transmuxer.flush()}},{key:"resetCaptions",value:function(){this.transmuxer.resetCaptions()}},{key:"alignGopsWith",value:function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}]),e}();new function(e){e.onmessage=function(t){"init"===t.data.action&&t.data.options?this.messageHandlers=new ct(e,t.data.options):(this.messageHandlers||(this.messageHandlers=new ct(e)),t.data&&t.data.action&&"init"!==t.data.action&&this.messageHandlers[t.data.action]&&this.messageHandlers[t.data.action](t.data))}}(i)}()})),Jo={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},Zo=function(e){return e.map((function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)}))}))},eu=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t={codecCount:0},i=void 0;return t.codecCount=e.split(",").length,t.codecCount=t.codecCount||2,(i=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(e))&&(t.videoCodec=i[2],t.videoObjectTypeIndicator=i[3]),t.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(e),t.audioProfile=t.audioProfile&&t.audioProfile[2],t},tu=function(e,t,i){return e+"/"+t+'; codecs="'+i.filter((function(e){return!!e})).join(", ")+'"'},iu=function(e){var t={type:"",parameters:{}},i=e.trim().split(";");return t.type=i.shift().trim(),i.forEach((function(e){var i=e.trim().split("=");if(i.length>1){var n=i[0].replace(/"/g,"").trim(),r=i[1].replace(/"/g,"").trim();t.parameters[n]=r}})),t},nu=function(e){return/mp4a\.\d+.\d+/i.test(e)},ru=function(e){return/avc1\.[\da-f]+/i.test(e)},su=function(e,t,i){if(null==t||!e.length)return[];var n=Math.ceil(9e4*(t-i+3)),r=void 0;for(r=0;r<e.length&&!(e[r].pts>n);r++);return e.slice(r)},au=9e4,ou=function(t){function i(e,t){Ha(this,i);var n=za(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,zr.EventTarget));n.timestampOffset_=0,n.pendingBuffers_=[],n.bufferUpdating_=!1,n.mediaSource_=e,n.codecs_=t,n.audioCodec_=null,n.videoCodec_=null,n.audioDisabled_=!1,n.appendAudioInitSegment_=!0,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=zr.browser.IE_VERSION>=11;var r={remux:!1,alignGopsAtEnd:n.safeAppend_};return n.codecs_.forEach((function(e){nu(e)?n.audioCodec_=e:ru(e)&&(n.videoCodec_=e)})),n.transmuxer_=new Qo,n.transmuxer_.postMessage({action:"init",options:r}),n.transmuxer_.onmessage=function(e){return"data"===e.data.action?n.data_(e):"done"===e.data.action?n.done_(e):"gopInfo"===e.data.action?n.appendGopInfo_(e):"videoSegmentTimingInfo"===e.data.action?n.videoSegmentTimingInfo_(e.data.videoSegmentTimingInfo):void 0},Object.defineProperty(n,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(e){"number"==typeof e&&e>=0&&(this.timestampOffset_=e,this.appendAudioInitSegment_=!0,this.gopBuffer_.length=0,this.timeMapping_=0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e}))}}),Object.defineProperty(n,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(e){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=e),this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=e)}}),Object.defineProperty(n,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(n,"buffered",{get:function(){return function(e,t,i){var n=null,r=null,s=0,a=[],o=[];if(!e&&!t)return zr.createTimeRange();if(!e)return t.buffered;if(!t)return e.buffered;if(i)return e.buffered;if(0===e.buffered.length&&0===t.buffered.length)return zr.createTimeRange();for(var u=e.buffered,l=t.buffered,c=u.length;c--;)a.push({time:u.start(c),type:"start"}),a.push({time:u.end(c),type:"end"});for(c=l.length;c--;)a.push({time:l.start(c),type:"start"}),a.push({time:l.end(c),type:"end"});for(a.sort((function(e,t){return e.time-t.time})),c=0;c<a.length;c++)"start"===a[c].type?2==++s&&(n=a[c].time):"end"===a[c].type&&1==--s&&(r=a[c].time),null!==n&&null!==r&&(o.push([n,r]),n=null,r=null);return zr.createTimeRanges(o)}(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}}),n}return Wa(i,t),Va(i,[{key:"data_",value:function(e){var t=e.data.segment;t.data=new Uint8Array(t.data,e.data.byteOffset,e.data.byteLength),t.initSegment=new Uint8Array(t.initSegment.data,t.initSegment.byteOffset,t.initSegment.byteLength),function(e,t,i){var n=t.player_;if(i.captions&&i.captions.length)for(var r in e.inbandTextTracks_||(e.inbandTextTracks_={}),i.captionStreams)if(!e.inbandTextTracks_[r]){n.tech_.trigger({type:"usage",name:"hls-608"});var s=n.textTracks().getTrackById(r);e.inbandTextTracks_[r]=s||n.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track}i.metadata&&i.metadata.length&&!e.metadataTrack_&&(e.metadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=i.metadata.dispatchType)}(this,this.mediaSource_,t),this.pendingBuffers_.push(t)}},{key:"done_",value:function(e){"closed"!==this.mediaSource_.readyState?this.processPendingSegments_():this.pendingBuffers_.length=0}},{key:"videoSegmentTimingInfo_",value:function(e){var t={start:{decode:e.start.dts/au,presentation:e.start.pts/au},end:{decode:e.end.dts/au,presentation:e.end.pts/au},baseMediaDecodeTime:e.baseMediaDecodeTime/au};e.prependedContentDuration&&(t.prependedContentDuration=e.prependedContentDuration/au),this.trigger({type:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}},{key:"createRealSourceBuffers_",value:function(){var e=this,t=["audio","video"];t.forEach((function(i){if(e[i+"Codec_"]&&!e[i+"Buffer_"]){var n=null;if(e.mediaSource_[i+"Buffer_"])(n=e.mediaSource_[i+"Buffer_"]).updating=!1;else{var r=i+'/mp4;codecs="'+e[i+"Codec_"]+'"';n=function(e,t){var i=e.addSourceBuffer(t),n=Object.create(null);n.updating=!1,n.realBuffer_=i;var r=function(e){"function"==typeof i[e]?n[e]=function(){return i[e].apply(i,arguments)}:void 0===n[e]&&Object.defineProperty(n,e,{get:function(){return i[e]},set:function(t){return i[e]=t}})};for(var s in i)r(s);return n}(e.mediaSource_.nativeMediaSource_,r),e.mediaSource_[i+"Buffer_"]=n}e[i+"Buffer_"]=n,["update","updatestart","updateend"].forEach((function(r){n.addEventListener(r,(function(){if("audio"!==i||!e.audioDisabled_)return"updateend"===r&&(e[i+"Buffer_"].updating=!1),t.every((function(t){return!("audio"!==t||!e.audioDisabled_)||i===t||!e[t+"Buffer_"]||!e[t+"Buffer_"].updating}))?e.trigger(r):void 0}))}))}}))}},{key:"appendBuffer",value:function(e){if(this.bufferUpdating_=!0,this.audioBuffer_&&this.audioBuffer_.buffered.length){var t=this.audioBuffer_.buffered;this.transmuxer_.postMessage({action:"setAudioAppendStart",appendStart:t.end(t.length-1)})}this.videoBuffer_&&this.transmuxer_.postMessage({action:"alignGopsWith",gopsToAlignWith:su(this.gopBuffer_,this.mediaSource_.player_?this.mediaSource_.player_.currentTime():null,this.timeMapping_)}),this.transmuxer_.postMessage({action:"push",data:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength},[e.buffer]),this.transmuxer_.postMessage({action:"flush"})}},{key:"appendGopInfo_",value:function(e){this.gopBuffer_=function(e,t,i){if(!t.length)return e;if(i)return t.slice();for(var n=t[0].pts,r=0;r<e.length&&!(e[r].pts>=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,e.data.gopInfo,this.safeAppend_)}},{key:"remove",value:function(e,t){if(this.videoBuffer_&&(this.videoBuffer_.updating=!0,this.videoBuffer_.remove(e,t),this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil(9e4*(t-n)),s=Math.ceil(9e4*(i-n)),a=e.slice(),o=e.length;o--&&!(e[o].pts<=s););if(-1===o)return a;for(var u=o+1;u--&&!(e[u].pts<=r););return u=Math.max(u,0),a.splice(u,o-u+1),a}(this.gopBuffer_,e,t,this.timeMapping_)),!this.audioDisabled_&&this.audioBuffer_&&(this.audioBuffer_.updating=!0,this.audioBuffer_.remove(e,t)),jo(e,t,this.metadataTrack_),this.inbandTextTracks_)for(var i in this.inbandTextTracks_)jo(e,t,this.inbandTextTracks_[i])}},{key:"processPendingSegments_",value:function(){var t={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]};if(!this.pendingBuffers_.length)return this.trigger("updateend"),void(this.bufferUpdating_=!1);t=this.pendingBuffers_.reduce((function(e,t){var i=t.type,n=t.data,r=t.initSegment;return e[i].segments.push(n),e[i].bytes+=n.byteLength,e[i].initSegment=r,t.captions&&(e.captions=e.captions.concat(t.captions)),t.info&&(e[i].info=t.info),t.metadata&&(e.metadata=e.metadata.concat(t.metadata)),e}),t),this.videoBuffer_||this.audioBuffer_||(0===t.video.bytes&&(this.videoCodec_=null),0===t.audio.bytes&&(this.audioCodec_=null),this.createRealSourceBuffers_()),t.audio.info&&this.mediaSource_.trigger({type:"audioinfo",info:t.audio.info}),t.video.info&&this.mediaSource_.trigger({type:"videoinfo",info:t.video.info}),this.appendAudioInitSegment_&&(!this.audioDisabled_&&this.audioBuffer_&&(t.audio.segments.unshift(t.audio.initSegment),t.audio.bytes+=t.audio.initSegment.byteLength),this.appendAudioInitSegment_=!1);var i=!1;this.videoBuffer_&&t.video.bytes?(t.video.segments.unshift(t.video.initSegment),t.video.bytes+=t.video.initSegment.byteLength,this.concatAndAppendSegments_(t.video,this.videoBuffer_)):!this.videoBuffer_||!this.audioDisabled_&&this.audioBuffer_||(i=!0),function(t,i,n){var r=e.WebKitDataCue||e.VTTCue;if(i&&i.forEach((function(e){var t=e.stream;this.inbandTextTracks_[t].addCue(new r(e.startTime+this.timestampOffset,e.endTime+this.timestampOffset,e.text))}),t),n){var s=Fo(t.mediaSource_.duration);if(n.forEach((function(t){var i=t.cueTime+this.timestampOffset;!("number"!=typeof i||e.isNaN(i)||i<0)&&i<1/0&&t.frames.forEach((function(e){var t=new r(i,i,e.value||e.url||e.data||"");t.frame=e,t.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return zr.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return zr.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return zr.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(t),this.metadataTrack_.addCue(t)}),this)}),t),t.metadataTrack_&&t.metadataTrack_.cues&&t.metadataTrack_.cues.length){for(var a=t.metadataTrack_.cues,o=[],u=0;u<a.length;u++)a[u]&&o.push(a[u]);var l=o.reduce((function(e,t){var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),c=Object.keys(l).sort((function(e,t){return Number(e)-Number(t)}));c.forEach((function(e,t){var i=l[e],n=Number(c[t+1])||s;i.forEach((function(e){e.endTime=n}))}))}}}(this,t.captions,t.metadata),!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(t.audio,this.audioBuffer_),this.pendingBuffers_.length=0,i&&this.trigger("updateend"),this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(e,t){var i=0,n=void 0;if(e.bytes){n=new Uint8Array(e.bytes),e.segments.forEach((function(e){n.set(e,i),i+=e.byteLength}));try{t.updating=!0,t.appendBuffer(n)}catch(e){this.mediaSource_.player_&&this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:e.message,originalError:e})}}}},{key:"abort",value:function(){this.videoBuffer_&&this.videoBuffer_.abort(),!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"reset"}),this.pendingBuffers_.length=0,this.bufferUpdating_=!1}}]),i}(zr.EventTarget),uu=function(i){function n(){Ha(this,n);var i=za(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),r=void 0;for(r in i.nativeMediaSource_=new e.MediaSource,i.nativeMediaSource_)r in n.prototype||"function"!=typeof i.nativeMediaSource_[r]||(i[r]=i.nativeMediaSource_[r].bind(i.nativeMediaSource_));return i.duration_=NaN,Object.defineProperty(i,"duration",{get:function(){return this.duration_===1/0?this.duration_:this.nativeMediaSource_.duration},set:function(e){this.duration_=e,e===1/0||(this.nativeMediaSource_.duration=e)}}),Object.defineProperty(i,"seekable",{get:function(){return this.duration_===1/0?zr.createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}}),Object.defineProperty(i,"readyState",{get:function(){return this.nativeMediaSource_.readyState}}),Object.defineProperty(i,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}}),i.sourceBuffers=[],i.activeSourceBuffers_=[],i.updateActiveSourceBuffers_=function(){if(i.activeSourceBuffers_.length=0,1===i.sourceBuffers.length){var e=i.sourceBuffers[0];return e.appendAudioInitSegment_=!0,e.audioDisabled_=!e.audioCodec_,void i.activeSourceBuffers_.push(e)}for(var t=!1,n=!0,r=0;r<i.player_.audioTracks().length;r++){var s=i.player_.audioTracks()[r];if(s.enabled&&"main"!==s.kind){t=!0,n=!1;break}}i.sourceBuffers.forEach((function(e,r){if(e.appendAudioInitSegment_=!0,e.videoCodec_&&e.audioCodec_)e.audioDisabled_=t;else if(e.videoCodec_&&!e.audioCodec_)e.audioDisabled_=!0,n=!1;else if(!e.videoCodec_&&e.audioCodec_&&(e.audioDisabled_=r?n:!n,e.audioDisabled_))return;i.activeSourceBuffers_.push(e)}))},i.onPlayerMediachange_=function(){i.sourceBuffers.forEach((function(e){e.appendAudioInitSegment_=!0}))},i.onHlsReset_=function(){i.sourceBuffers.forEach((function(e){e.transmuxer_&&e.transmuxer_.postMessage({action:"resetCaptions"})}))},i.onHlsSegmentTimeMapping_=function(e){i.sourceBuffers.forEach((function(t){return t.timeMapping_=e.mapping}))},["sourceopen","sourceclose","sourceended"].forEach((function(e){this.nativeMediaSource_.addEventListener(e,this.trigger.bind(this))}),i),i.on("sourceopen",(function(e){var n=t.querySelector('[src="'+i.url_+'"]');n&&(i.player_=zr(n.parentNode),i.player_&&(i.player_.tech_.on("hls-reset",i.onHlsReset_),i.player_.tech_.on("hls-segment-time-mapping",i.onHlsSegmentTimeMapping_),i.player_.audioTracks&&i.player_.audioTracks()&&(i.player_.audioTracks().on("change",i.updateActiveSourceBuffers_),i.player_.audioTracks().on("addtrack",i.updateActiveSourceBuffers_),i.player_.audioTracks().on("removetrack",i.updateActiveSourceBuffers_)),i.player_.on("mediachange",i.onPlayerMediachange_)))})),i.on("sourceended",(function(e){for(var t=Fo(i.duration),n=0;n<i.sourceBuffers.length;n++){var r=i.sourceBuffers[n],s=r.metadataTrack_&&r.metadataTrack_.cues;s&&s.length&&(s[s.length-1].endTime=t)}})),i.on("sourceclose",(function(e){this.sourceBuffers.forEach((function(e){e.transmuxer_&&e.transmuxer_.terminate()})),this.sourceBuffers.length=0,this.player_&&(this.player_.audioTracks&&this.player_.audioTracks()&&(this.player_.audioTracks().off("change",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("addtrack",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("removetrack",this.updateActiveSourceBuffers_)),this.player_.el_&&this.player_.off("mediachange",this.onPlayerMediachange_),this.player_.tech_&&this.player_.tech_.el_&&(this.player_.tech_.off("hls-reset",this.onHlsReset_),this.player_.tech_.off("hls-segment-time-mapping",this.onHlsSegmentTimeMapping_)))})),i}return Wa(n,i),Va(n,[{key:"addSeekableRange_",value:function(e,t){var i=void 0;if(this.duration!==1/0)throw(i=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity")).name="InvalidStateError",i.code=11,i;(t>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=t)}},{key:"addSourceBuffer",value:function(e){var t=void 0,i=iu(e);if(/^(video|audio)\/mp2t$/i.test(i.type)){var n=[];i.parameters&&i.parameters.codecs&&(n=i.parameters.codecs.split(","),n=(n=Zo(n)).filter((function(e){return nu(e)||ru(e)}))),0===n.length&&(n=["avc1.4d400d","mp4a.40.2"]),t=new ou(this,n),0!==this.sourceBuffers.length&&(this.sourceBuffers[0].createRealSourceBuffers_(),t.createRealSourceBuffers_(),this.sourceBuffers[0].audioDisabled_=!0)}else t=this.nativeMediaSource_.addSourceBuffer(e);return this.sourceBuffers.push(t),t}}]),n}(zr.EventTarget),lu=0;zr.mediaSources={};var cu=function(e,t){var i=zr.mediaSources[e];if(!i)throw new Error("Media Source not found (Video.js)");i.trigger({type:"sourceopen",swfId:t})},hu=function(){return!!e.MediaSource&&!!e.MediaSource.isTypeSupported&&e.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},du=function(){if(this.MediaSource={open:cu,supportsNativeMediaSources:hu},hu())return new uu;throw new Error("Cannot use create a virtual MediaSource for this video")};du.open=cu,du.supportsNativeMediaSources=hu;var pu={createObjectURL:function(t){var i=void 0;return t instanceof uu?(i=e.URL.createObjectURL(t.nativeMediaSource_),t.url_=i,i):t instanceof uu?(i="blob:vjs-media-source/"+lu,lu++,zr.mediaSources[i]=t,i):(i=e.URL.createObjectURL(t),t.url_=i,i)}};zr.MediaSource=du,zr.URL=pu;var fu=zr.EventTarget,mu=zr.mergeOptions,gu=function(e,t){for(var i=void 0,n=mu(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),r=0;r<t.playlists.length;r++){var s=Qa(n,t.playlists[r]);s?n=s:i=!0}return $a(t,(function(e,t,r,s){if(e.playlists&&e.playlists.length){var a=e.playlists[0].uri,o=Qa(n,e.playlists[0]);o&&((n=o).mediaGroups[t][r][s].playlists[0]=n.playlists[a],i=!1)}})),i?null:n},vu=function(e){var t=e.byterange.offset+e.byterange.length-1;return e.uri+"-"+e.byterange.offset+"-"+t},yu=function(e,t){var i,n,r={};for(var s in e){var a=e[s].sidx;if(a){var o=vu(a);if(!t[o])break;i=t[o].sidxInfo,n=a,(Boolean(!i.map&&!n.map)||Boolean(i.map&&n.map&&i.map.byterange.offset===n.map.byterange.offset&&i.map.byterange.length===n.map.byterange.length))&&i.uri===n.uri&&i.byterange.offset===n.byterange.offset&&i.byterange.length===n.byterange.length&&(r[o]=t[o])}}return r},_u=function(e,t,i,n,r){var s={uri:Fa(n.handleManifestRedirects,e.resolvedUri),byterange:e.byterange,playlist:t};return i(zr.mergeOptions(s,{responseType:"arraybuffer",headers:So(s)}),r)},bu=function(t){function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments[3];Ha(this,i);var s=za(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),a=n.withCredentials,o=void 0!==a&&a,u=n.handleManifestRedirects,l=void 0!==u&&u;if(s.hls_=t,s.withCredentials=o,s.handleManifestRedirects=l,!e)throw new Error("A non-empty playlist URL or playlist is required");return s.on("minimumUpdatePeriod",(function(){s.refreshXml_()})),s.on("mediaupdatetimeout",(function(){s.refreshMedia_(s.media().uri)})),s.state="HAVE_NOTHING",s.loadedPlaylists_={},"string"==typeof e?(s.srcUrl=e,s.sidxMapping_={},za(s)):(s.setupChildLoader(r,e),s)}return Wa(i,t),Va(i,[{key:"setupChildLoader",value:function(e,t){this.masterPlaylistLoader_=e,this.childPlaylist_=t}},{key:"dispose",value:function(){this.stopRequest(),this.loadedPlaylists_={},e.clearTimeout(this.minimumUpdatePeriodTimeout_),e.clearTimeout(this.mediaRequest_),e.clearTimeout(this.mediaUpdateTimeout)}},{key:"hasPendingRequest",value:function(){return this.request||this.mediaRequest_}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"sidxRequestFinished_",value:function(e,t,i,n){var r=this;return function(s,a){if(r.request){if(r.request=null,s)return r.error={status:a.status,message:"DASH playlist request error at URL: "+e.uri,response:a.response,code:2},i&&(r.state=i),r.trigger("error"),n(t,null);var o=new Uint8Array(a.response),u=$s.parseSidx(o.subarray(8));return n(t,u)}}}},{key:"media",value:function(t){var i=this;if(!t)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 t){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}var r=!this.media_||t.uri!==this.media_.uri;if(r&&this.loadedPlaylists_[t.uri]&&this.loadedPlaylists_[t.uri].endList)return this.state="HAVE_METADATA",this.media_=t,void(r&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(r)if(this.media_&&this.trigger("mediachanging"),t.sidx){var s=void 0,a=void 0;this.masterPlaylistLoader_?(s=this.masterPlaylistLoader_.master,a=this.masterPlaylistLoader_.sidxMapping_):(s=this.master,a=this.sidxMapping_);var o=vu(t.sidx);a[o]={sidxInfo:t.sidx},this.request=_u(t.sidx,t,this.hls_.xhr,{handleManifestRedirects:this.handleManifestRedirects},this.sidxRequestFinished_(t,s,n,(function(e,r){if(!e||!r)throw new Error("failed to request sidx");a[o].sidx=r,i.haveMetadata({startingState:n,playlist:e.playlists[t.uri]})})))}else this.mediaRequest_=e.setTimeout(this.haveMetadata.bind(this,{startingState:n,playlist:t}),0)}},{key:"haveMetadata",value:function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.uri]=i,this.mediaRequest_=null,this.refreshMedia_(i.uri),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")}},{key:"pause",value:function(){this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.minimumUpdatePeriodTimeout_),"HAVE_NOTHING"===this.state&&(this.started=!1)}},{key:"load",value:function(t){var i=this;e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.minimumUpdatePeriodTimeout_);var n=this.media();if(t){var r=n?n.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=e.setTimeout((function(){return i.load()}),r)}else this.started?this.trigger("loadedplaylist"):this.start()}},{key:"parseMasterXml",value:function(){var e=Vs(this.masterXml_,{manifestUri:this.srcUrl,clientOffset:this.clientOffset_,sidxMapping:this.sidxMapping_});e.uri=this.srcUrl;for(var t=0;t<e.playlists.length;t++){var i="placeholder-uri-"+t;e.playlists[t].uri=i,e.playlists[i]=e.playlists[t]}return $a(e,(function(t,i,n,r){if(t.playlists&&t.playlists.length){var s="placeholder-uri-"+i+"-"+n+"-"+r;t.playlists[0].uri=s,e.playlists[s]=t.playlists[0]}})),Ja(e),Za(e),e}},{key:"start",value:function(){var t=this;this.started=!0,this.masterPlaylistLoader_?this.mediaRequest_=e.setTimeout(this.haveMaster_.bind(this),0):this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},(function(e,i){if(t.request){if(t.request=null,e)return t.error={status:i.status,message:"DASH playlist request error at URL: "+t.srcUrl,responseText:i.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");t.masterXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date?t.masterLoaded_=Date.parse(i.responseHeaders.date):t.masterLoaded_=Date.now(),t.srcUrl=Fa(t.handleManifestRedirects,t.srcUrl,i),t.syncClientServerClock_(t.onClientServerClockSync_.bind(t))}}))}},{key:"syncClientServerClock_",value:function(e){var t,i=this,n=(t=this.masterXml_,function(e){var t=Os(e,"UTCTiming")[0];if(!t)return null;var i=Ms(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error("UNSUPPORTED_UTC_TIMING_SCHEME")}return i}(Hs(t)));return null===n?(this.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===n.method?(this.clientOffset_=n.value-Date.now(),e()):void(this.request=this.hls_.xhr({uri:ja(this.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials},(function(t,r){if(i.request){if(t)return i.clientOffset_=i.masterLoaded_-Date.now(),e();var s;s="HEAD"===n.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):i.masterLoaded_:Date.parse(r.responseText),i.clientOffset_=s-Date.now(),e()}})))}},{key:"haveMaster_",value:function(){this.state="HAVE_MASTER",this.mediaRequest_=null,this.masterPlaylistLoader_?this.media_||this.media(this.childPlaylist_):(this.master=this.parseMasterXml(),this.trigger("loadedplaylist"))}},{key:"onClientServerClockSync_",value:function(){var t=this;this.haveMaster_(),this.hasPendingRequest()||this.media_||this.media(this.master.playlists[0]),this.master&&this.master.minimumUpdatePeriod&&(this.minimumUpdatePeriodTimeout_=e.setTimeout((function(){t.trigger("minimumUpdatePeriod")}),this.master.minimumUpdatePeriod))}},{key:"refreshXml_",value:function(){var t=this;this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(t.request){if(t.request=null,i)return t.error={status:n.status,message:"DASH playlist request error at URL: "+t.srcUrl,responseText:n.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");t.masterXml_=n.responseText,t.sidxMapping_=function(e,t,i,n){var r=Vs(e,{manifestUri:t,clientOffset:i}),s=yu(r.playlists,n);return $a(r,(function(e,t,i,r){if(e.playlists&&e.playlists.length){var a=e.playlists;s=mu(s,yu(a,n))}})),s}(t.masterXml_,t.srcUrl,t.clientOffset_,t.sidxMapping_);var r=t.parseMasterXml(),s=gu(t.master,r),a=t.media().sidx;if(s)if(a){var o=vu(a);if(!t.sidxMapping_[o]){var u=t.media();t.request=_u(u.sidx,u,t.hls_.xhr,{handleManifestRedirects:t.handleManifestRedirects},t.sidxRequestFinished_(u,r,t.state,(function(i,n){if(!i||!n)throw new Error("failed to request sidx on minimumUpdatePeriod");t.sidxMapping_[o].sidx=n,t.minimumUpdatePeriodTimeout_=e.setTimeout((function(){t.trigger("minimumUpdatePeriod")}),t.master.minimumUpdatePeriod),t.refreshMedia_(t.media().uri)})))}}else t.master=s;t.minimumUpdatePeriodTimeout_=e.setTimeout((function(){t.trigger("minimumUpdatePeriod")}),t.master.minimumUpdatePeriod)}}))}},{key:"refreshMedia_",value:function(t){var i=this;if(!t)throw new Error("refreshMedia_ must take a media uri");var n=void 0,r=void 0;this.masterPlaylistLoader_?(n=this.masterPlaylistLoader_.master,r=this.masterPlaylistLoader_.parseMasterXml()):(n=this.master,r=this.parseMasterXml());var s=gu(n,r);s?(this.masterPlaylistLoader_?this.masterPlaylistLoader_.master=s:this.master=s,this.media_=s.playlists[t]):(this.media_=r.playlists[t],this.trigger("playlistunchanged")),this.media().endList||(this.mediaUpdateTimeout=e.setTimeout((function(){i.trigger("mediaupdatetimeout")}),eo(this.media(),!!s))),this.trigger("loadedplaylist")}}]),i}(fu),Tu=function(e){return zr.log.debug?zr.log.debug.bind(zr,"VHS:",e+" >"):function(){}};function Su(){}var ku=function(){function e(t,i,n,r){Ha(this,e),this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=t,this.processedAppend_=!1,this.type_=n,this.mimeType_=i,this.logger_=Tu("SourceUpdater["+n+"]["+i+"]"),"closed"===t.readyState?t.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,i,r)):this.createSourceBuffer_(i,r)}return Va(e,[{key:"createSourceBuffer_",value:function(e,t){var i=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(e),this.logger_("created SourceBuffer"),t&&(t.trigger("sourcebufferadded"),this.mediaSource.sourceBuffers.length<2)?t.on("sourcebufferadded",(function(){i.start_()})):this.start_()}},{key:"start_",value:function(){var e=this;this.started_=!0,this.onUpdateendCallback_=function(){var t=e.pendingCallback_;e.pendingCallback_=null,e.sourceBuffer_.removing=!1,e.logger_("buffered ["+No(e.buffered())+"]"),t&&t(),e.runCallback_()},this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_),this.runCallback_()}},{key:"abort",value:function(e){var t=this;this.processedAppend_&&this.queueCallback_((function(){t.sourceBuffer_.abort()}),e)}},{key:"appendBuffer",value:function(e,t){var i=this;this.processedAppend_=!0,this.queueCallback_((function(){e.videoSegmentTimingInfoCallback&&i.sourceBuffer_.addEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback),i.sourceBuffer_.appendBuffer(e.bytes)}),(function(){e.videoSegmentTimingInfoCallback&&i.sourceBuffer_.removeEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback),t()}))}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:zr.createTimeRanges()}},{key:"remove",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Su;this.processedAppend_&&this.queueCallback_((function(){i.logger_("remove ["+e+" => "+t+"]"),i.sourceBuffer_.removing=!0,i.sourceBuffer_.remove(e,t)}),n)}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||!!this.pendingCallback_&&this.pendingCallback_!==Su}},{key:"timestampOffset",value:function(e){var t=this;return void 0!==e&&(this.queueCallback_((function(){t.sourceBuffer_.timestampOffset=e,t.runCallback_()})),this.timestampOffset_=e),this.timestampOffset_}},{key:"queueCallback_",value:function(e,t){this.callbacks_.push([e.bind(this),t]),this.runCallback_()}},{key:"runCallback_",value:function(){var e=void 0;!this.updating()&&this.callbacks_.length&&this.started_&&(e=this.callbacks_.shift(),this.pendingCallback_=e[1],e[0]())}},{key:"dispose",value:function(){var e=this,t=function t(){e.sourceBuffer_&&"open"===e.mediaSource.readyState&&e.sourceBuffer_.abort(),e.sourceBuffer_.removeEventListener("updateend",t)};this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_),this.sourceBuffer_.removing?this.sourceBuffer_.addEventListener("updateend",t):t()}}]),e}(),Cu={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,BUFFER_LOW_WATER_LINE_RATE:1},Eu=function(e){e.forEach((function(e){e.abort()}))},wu=function(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:-101,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:-102,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:2,xhr:t}:null},Pu=function(e,t,i,n,r,s,a){var o=[],u=function(e,t,i){var n=0,r=!1;return function(s,a){if(!r)return s?(r=!0,Eu(e),i(s,a)):(n+=1)===e.length?(a.endOfAllRequests=Date.now(),a.encryptedBytes?function(e,t,i){var n;e.addEventListener("message",(function n(r){if(r.data.source===t.requestId){e.removeEventListener("message",n);var s=r.data.decrypted;return t.bytes=new Uint8Array(s.bytes,s.byteOffset,s.byteLength),i(null,t)}})),n=t.key.bytes.slice?t.key.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.key.bytes)),e.postMessage(wo({source:t.requestId,encrypted:t.encryptedBytes,key:n,iv:t.key.iv}),[t.encryptedBytes.buffer,n.buffer])}(t,a,i):i(null,a)):void 0}}(o,i,a);if(r.key&&!r.key.bytes){var l=e(zr.mergeOptions(t,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),function(e,t){return function(i,n){var r=n.response,s=wu(i,n);if(s)return t(s,e);if(16!==r.byteLength)return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:2,xhr:n},e);var a=new DataView(r);return e.key.bytes=new Uint32Array([a.getUint32(0),a.getUint32(4),a.getUint32(8),a.getUint32(12)]),t(null,e)}}(r,u));o.push(l)}if(r.map&&!r.map.bytes){var c=e(zr.mergeOptions(t,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:So(r.map)}),function(e,t,i){return function(n,r){var s=r.response,a=wu(n,r);return a?i(a,e):0===s.byteLength?i({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:2,xhr:r},e):(e.map.bytes=new Uint8Array(r.response),t&&!t.isInitialized()&&t.init(),e.map.timescales=Zs.timescale(e.map.bytes),e.map.videoTrackIds=Zs.videoTrackIds(e.map.bytes),i(null,e))}}(r,n,u));o.push(c)}var h=e(zr.mergeOptions(t,{uri:r.resolvedUri,responseType:"arraybuffer",headers:So(r)}),function(e,t,i){return function(n,r){var s=r.response,a=wu(n,r),o=void 0;return a?i(a,e):0===s.byteLength?i({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:2,xhr:r},e):(e.stats=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}}(r),e.key?e.encryptedBytes=new Uint8Array(r.response):e.bytes=new Uint8Array(r.response),t&&e.map&&e.map.bytes&&(t.isInitialized()||t.init(),(o=t.parse(e.bytes,e.map.videoTrackIds,e.map.timescales))&&o.captions&&(e.captionStreams=o.captionStreams,e.fmp4Captions=o.captions)),i(null,e))}}(r,n,u));return h.addEventListener("progress",function(e,t){return function(i){var n,r,s;return e.stats=zr.mergeOptions(e.stats,(r=(n=i).target,(s={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-r.requestTime||0}).bytesReceived=n.loaded,s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3),s)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)}}(r,s)),o.push(h),function(){return Eu(o)}},Lu=function(t,i){var n;return t&&(n=e.getComputedStyle(t))?n[i]:""},Au=function(e,t){var i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))},Iu=function(t,i){var n=void 0,r=void 0;return t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),n=n||e.Number.MAX_VALUE,i.attributes.BANDWIDTH&&(r=i.attributes.BANDWIDTH),n-(r||e.Number.MAX_VALUE)},xu=function(e,t,i){if(!e||!t)return!1;var n=i===e.segments.length;return e.endList&&"open"===t.readyState&&n},Ou=function(e){return"number"==typeof e&&isFinite(e)},Du=function(t){function i(e){Ha(this,i);var t=za(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));if(!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");return t.bandwidth=e.bandwidth,t.throughput={rate:0,count:0},t.roundTrip=NaN,t.resetStats_(),t.mediaIndex=null,t.hasPlayed_=e.hasPlayed,t.currentTime_=e.currentTime,t.seekable_=e.seekable,t.seeking_=e.seeking,t.duration_=e.duration,t.mediaSource_=e.mediaSource,t.hls_=e.hls,t.loaderType_=e.loaderType,t.startingMedia_=void 0,t.segmentMetadataTrack_=e.segmentMetadataTrack,t.goalBufferLength_=e.goalBufferLength,t.sourceType_=e.sourceType,t.inbandTextTracks_=e.inbandTextTracks,t.state_="INIT",t.checkBufferTimeout_=null,t.error_=void 0,t.currentTimeline_=-1,t.pendingSegment_=null,t.mimeType_=null,t.sourceUpdater_=null,t.xhrOptions_=null,t.activeInitSegmentId_=null,t.initSegments_={},t.cacheEncryptionKeys_=e.cacheEncryptionKeys,t.keyCache_={},"main"===t.loaderType_?t.captionParser_=new da:t.captionParser_=null,t.decrypter_=e.decrypter,t.syncController_=e.syncController,t.syncPoint_={segmentIndex:0,time:0},t.syncController_.on("syncinfoupdate",(function(){return t.trigger("syncinfoupdate")})),t.mediaSource_.addEventListener("sourceopen",(function(){return t.ended_=!1})),t.fetchAtBuffer_=!1,t.logger_=Tu("SegmentLoader["+t.loaderType_+"]"),Object.defineProperty(t,"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e)}}),t}return Wa(i,t),Va(i,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED",this.pause(),this.abort_(),this.sourceUpdater_&&this.sourceUpdater_.dispose(),this.resetStats_(),this.captionParser_&&this.captionParser_.reset()}},{key:"abort",value:function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}},{key:"abort_",value:function(){this.pendingSegment_&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null}},{key:"error",value:function(e){return void 0!==e&&(this.error_=e),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0,this.pause(),this.trigger("ended")}},{key:"buffered_",value:function(){return this.sourceUpdater_?this.sourceUpdater_.buffered():zr.createTimeRanges()}},{key:"initSegment",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=Po(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,timescales:e.timescales,videoTrackIds:e.videoTrackIds}),n||e}},{key:"segmentKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=Lo(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&(this.sourceUpdater_||this.mimeType_&&"INIT"===this.state)&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_){if(this.syncController_.setDateTimeMapping(this.playlist_),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY")}}},{key:"init_",value:function(){return this.state="READY",this.sourceUpdater_=new ku(this.mediaSource_,this.mimeType_,this.loaderType_,this.sourceBufferEmitter_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.hasPlayed_()||(e.syncInfo={mediaSequence:e.mediaSequence,time:0});var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(i&&i.uri===e.uri){var s=e.mediaSequence-i.mediaSequence;this.logger_("live window shift ["+s+"]"),null!==this.mediaIndex&&(this.mediaIndex-=s),n&&(n.mediaIndex-=s,n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(i,e)}else null!==this.mediaIndex&&this.resyncLoader()}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(e,t){this.mimeType_||(this.mimeType_=e,this.sourceBufferEmitter_=t,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(e){this.ended_=!1,this.resetLoader(),this.remove(0,this.duration_(),e),this.captionParser_&&this.captionParser_.clearAllCaptions(),this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1,this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null,this.syncPoint_=null,this.abort()}},{key:"remove",value:function(e,t,i){if(this.sourceUpdater_&&this.sourceUpdater_.remove(e,t,i),jo(e,t,this.segmentMetadataTrack_),this.inbandTextTracks_)for(var n in this.inbandTextTracks_)jo(e,t,this.inbandTextTracks_[n])}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var e=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);e&&(this.isEndOfStream_(e.mediaIndex)?this.endOfStream():(e.mediaIndex!==this.playlist_.segments.length-1||"ended"!==this.mediaSource_.readyState||this.seeking_())&&(e.timeline!==this.currentTimeline_&&(this.syncController_.reset(),e.timestampOffset=e.startOfSegment,this.captionParser_&&this.captionParser_.clearAllCaptions()),this.loadSegment_(e)))}}},{key:"isEndOfStream_",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.playlist_;return xu(t,this.mediaSource_,e)&&!this.sourceUpdater_.updating()}},{key:"checkBuffer_",value:function(e,t,i,n,r,s){var a=0,o=void 0;e.length&&(a=e.end(e.length-1));var u=Math.max(0,a-r);if(!t.segments.length)return null;if(u>=this.goalBufferLength_())return null;if(!n&&u>=1)return null;if(null===s)return i=this.getSyncSegmentCandidate_(t),this.generateSegmentInfo_(t,i,null,!0);if(null!==i)return t.segments[i],o=a,this.generateSegmentInfo_(t,i+1,o,!1);if(this.fetchAtBuffer_){var l=yo.getMediaInfoForTime(t,a,s.segmentIndex,s.time);i=l.mediaIndex,o=l.startTime}else{var c=yo.getMediaInfoForTime(t,r,s.segmentIndex,s.time);i=c.mediaIndex,o=c.startTime}return this.generateSegmentInfo_(t,i,o,!1)}},{key:"getSyncSegmentCandidate_",value:function(e){var t=this;if(-1===this.currentTimeline_)return 0;var i=e.segments.map((function(e,t){return{timeline:e.timeline,segmentIndex:t}})).filter((function(e){return e.timeline===t.currentTimeline_}));return i.length?i[Math.min(i.length-1,1)].segmentIndex:Math.max(e.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(e,t,i,n){if(t<0||t>=e.segments.length)return null;var r=e.segments[t];return{requestId:"segment-loader-"+Math.random(),uri:r.resolvedUri,mediaIndex:t,isSyncRequest:n,startOfSegment:i,playlist:e,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:r.timeline,duration:r.duration,segment:r}}},{key:"abortRequestEarly_",value:function(e){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return!1;if(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return!1;var t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=yo.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),s=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return((e.length?e.end(e.length-1):0)-t)/i}(this.buffered_(),t,this.hls_.tech_.playbackRate())-1;if(r<=s)return!1;var a=function(e){var t=e.currentTime,i=e.bandwidth,n=e.duration,r=e.segmentDuration,s=e.timeUntilRebuffer,a=e.currentTimeline,o=e.syncController,u=e.master.playlists.filter((function(e){return!yo.isIncompatible(e)})),l=u.filter(yo.isEnabled);l.length||(l=u.filter((function(e){return!yo.isDisabled(e)})));var c=l.filter(yo.hasAttribute.bind(null,"BANDWIDTH")).map((function(e){var u=o.getSyncPoint(e,n,a,t)?1:2;return{playlist:e,rebufferingImpact:yo.estimateSegmentRequestTime(r,i,e)*u-s}})),h=c.filter((function(e){return e.rebufferingImpact<=0}));return Au(h,(function(e,t){return Iu(t.playlist,e.playlist)})),h.length?h[0]:(Au(c,(function(e,t){return e.rebufferingImpact-t.rebufferingImpact})),c[0]||null)}({master:this.hls_.playlists.master,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:s,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(a){var o=r-s-a.rebufferingImpact,u=.5;return s<=Oo&&(u=1),!(!a.playlist||a.playlist.uri===this.playlist_.uri||o<u)&&(this.bandwidth=a.playlist.attributes.BANDWIDTH*Cu.BANDWIDTH_VARIANCE+1,this.abort(),this.trigger("earlyabort"),!0)}}},{key:"handleProgress_",value:function(e,t){this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId&&!this.abortRequestEarly_(t.stats)&&this.trigger("progress")}},{key:"loadSegment_",value:function(e){this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),e.abortRequests=Pu(this.hls_.xhr,this.xhrOptions_,this.decrypter_,this.captionParser_,this.createSimplifiedSegmentObj_(e),this.handleProgress_.bind(this),this.segmentRequestFinished_.bind(this))}},{key:"trimBackBuffer_",value:function(e){var t=function(e,t,i){var n;return n=e.length&&e.start(0)>0&&e.start(0)<t?e.start(0):t-30,Math.min(n,t-i)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}},{key:"createSimplifiedSegmentObj_",value:function(e){var t=e.segment,i={resolvedUri:t.resolvedUri,byterange:t.byterange,requestId:e.requestId};if(t.key){var n=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);i.key=this.segmentKey(t.key),i.key.iv=n}return t.map&&(i.map=this.initSegment(t.map)),i}},{key:"segmentRequestFinished_",value:function(e,t){if(this.mediaRequests+=1,t.stats&&(this.mediaBytesTransferred+=t.stats.bytesReceived,this.mediaTransferDuration+=t.stats.roundTripTime),this.pendingSegment_){if(t.requestId===this.pendingSegment_.requestId){if(e)return this.pendingSegment_=null,this.state="READY",-102===e.code?void(this.mediaRequestsAborted+=1):(this.pause(),-101===e.code?(this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,void this.trigger("bandwidthupdate")):(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error")));this.bandwidth=t.stats.bandwidth,this.roundTrip=t.stats.roundTripTime,t.map&&(t.map=this.initSegment(t.map,!0)),t.key&&this.segmentKey(t.key,!0),this.processSegmentResponse_(t)}}else this.mediaRequestsAborted+=1}},{key:"processSegmentResponse_",value:function(e){var t=this.pendingSegment_;t.bytes=e.bytes,e.map&&(t.segment.map.bytes=e.map.bytes),t.endOfAllRequests=e.endOfAllRequests,e.fmp4Captions&&(function(e,t,i){for(var n in i)if(!e[n]){t.trigger({type:"usage",name:"hls-608"});var r=t.textTracks().getTrackById(n);e[n]=r||t.addRemoteTextTrack({kind:"captions",id:n,label:n},!1).track}}(this.inbandTextTracks_,this.hls_.tech_,e.captionStreams),function(e){var t=e.inbandTextTracks,i=e.captionArray,n=e.timestampOffset;if(i){var r=window.WebKitDataCue||window.VTTCue;i.forEach((function(e){var i=e.stream,s=e.startTime,a=e.endTime;t[i]&&(s+=n,a+=n,t[i].addCue(new r(s,a,e.text)))}))}}({inbandTextTracks:this.inbandTextTracks_,captionArray:e.fmp4Captions,timestampOffset:0}),this.captionParser_&&this.captionParser_.clearParsedCaptions()),this.handleSegment_()}},{key:"handleSegment_",value:function(){var e=this;if(this.pendingSegment_){var t=this.pendingSegment_,i=t.segment,n=this.syncController_.probeSegmentInfo(t);void 0===this.startingMedia_&&n&&(n.containsAudio||n.containsVideo)&&(this.startingMedia_={containsAudio:n.containsAudio,containsVideo:n.containsVideo});var r,s,a,o=(r=this.loaderType_,s=this.startingMedia_,a=n,"main"===r&&s&&a?a.containsAudio||a.containsVideo?s.containsVideo&&!a.containsVideo?"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.":!s.containsVideo&&a.containsVideo?"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);if(o)return this.error({message:o,blacklistDuration:1/0}),void this.trigger("error");if(t.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");if(null!==t.timestampOffset&&t.timestampOffset!==this.sourceUpdater_.timestampOffset()){if(n&&n.segmentTimestampInfo){var u=n.segmentTimestampInfo[0].ptsTime,l=n.segmentTimestampInfo[0].dtsTime;t.timestampOffset-=u-l}this.sourceUpdater_.timestampOffset(t.timestampOffset),this.trigger("timestampoffset")}var c=this.syncController_.mappingForTimeline(t.timeline);if(null!==c&&this.trigger({type:"segmenttimemapping",mapping:c}),this.state="APPENDING",i.map){var h=Po(i.map);if(!this.activeInitSegmentId_||this.activeInitSegmentId_!==h){var d=this.initSegment(i.map);this.sourceUpdater_.appendBuffer({bytes:d.bytes},(function(){e.activeInitSegmentId_=h}))}}t.byteLength=t.bytes.byteLength,"number"==typeof i.start&&"number"==typeof i.end?this.mediaSecondsLoaded+=i.end-i.start:this.mediaSecondsLoaded+=i.duration,this.logger_(function(e){var t=e.segment,i=t.start,n=t.end,r=e.playlist,s=r.mediaSequence,a=r.id,o=r.segments,u=void 0===o?[]:o,l=e.mediaIndex,c=e.timeline;return["appending ["+l+"] of ["+s+", "+(s+u.length)+"] from playlist ["+a+"]","["+i+" => "+n+"] in timeline ["+c+"]"].join(" ")}(t)),this.sourceUpdater_.appendBuffer({bytes:t.bytes,videoSegmentTimingInfoCallback:this.handleVideoSegmentTimingInfo_.bind(this,t.requestId)},this.handleUpdateEnd_.bind(this))}else this.state="READY"}},{key:"handleVideoSegmentTimingInfo_",value:function(e,t){if(this.pendingSegment_&&e===this.pendingSegment_.requestId){var i=this.pendingSegment_.segment;i.videoTimingInfo||(i.videoTimingInfo={}),i.videoTimingInfo.transmuxerPrependedSeconds=t.videoSegmentTimingInfo.prependedContentDuration||0,i.videoTimingInfo.transmuxedPresentationStart=t.videoSegmentTimingInfo.start.presentation,i.videoTimingInfo.transmuxedPresentationEnd=t.videoSegmentTimingInfo.end.presentation,i.videoTimingInfo.baseMediaDecodeTime=t.videoSegmentTimingInfo.baseMediaDecodeTime}}},{key:"handleUpdateEnd_",value:function(){if(!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_,t=e.segment,i=null!==this.mediaIndex;this.pendingSegment_=null,this.recordThroughput_(e),this.addSegmentMetadataCue_(e),this.state="READY",this.mediaIndex=e.mediaIndex,this.fetchAtBuffer_=!0,this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate"),t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration?this.resetEverything():(i&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.isEndOfStream_(e.mediaIndex+1,e.playlist)&&this.endOfStream(),this.paused()||this.monitorBuffer_())}},{key:"recordThroughput_",value:function(e){var t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(t){if(this.segmentMetadataTrack_){var i=t.segment,n=i.start,r=i.end;if(Ou(n)&&Ou(r)){jo(n,r,this.segmentMetadataTrack_);var s=e.WebKitDataCue||e.VTTCue,a={custom:i.custom,dateTimeObject:i.dateTimeObject,dateTimeString:i.dateTimeString,bandwidth:t.playlist.attributes.BANDWIDTH,resolution:t.playlist.attributes.RESOLUTION,codecs:t.playlist.attributes.CODECS,byteLength:t.byteLength,uri:t.uri,timeline:t.timeline,playlist:t.playlist.uri,start:n,end:r},o=new s(n,r,JSON.stringify(a));o.value=a,this.segmentMetadataTrack_.addCue(o)}}}}]),i}(zr.EventTarget),Ru=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},Uu=new Uint8Array("\n\n".split("").map((function(e){return e.charCodeAt(0)}))),Mu=function(t){function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ha(this,i);var n=za(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t));return n.mediaSource_=null,n.subtitlesTrack_=null,n}return Wa(i,t),Va(i,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return zr.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return zr.createTimeRanges([[t,i]])}},{key:"initSegment",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=Po(e),n=this.initSegments_[i];if(t&&!n&&e.bytes){var r=Uu.byteLength+e.bytes.byteLength,s=new Uint8Array(r);s.set(e.bytes),s.set(Uu,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:s}}return n||e}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"track",value:function(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}},{key:"remove",value:function(e,t){jo(e,t,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var e=this;this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var t=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(t=this.skipEmptySegments_(t)){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline))return this.syncController_.one("timestampoffset",(function(){e.state="READY",e.paused()||e.monitorBuffer_()})),void(this.state="WAITING_ON_TIMELINE");this.loadSegment_(t)}}},{key:"skipEmptySegments_",value:function(e){for(;e&&e.segment.empty;)e=this.generateSegmentInfo_(e.playlist,e.mediaIndex+1,e.startOfSegment+e.duration,e.isSyncRequest);return e}},{key:"handleSegment_",value:function(){var t=this;if(this.pendingSegment_&&this.subtitlesTrack_){this.state="APPENDING";var i=this.pendingSegment_,n=i.segment;if("function"!=typeof e.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var r=void 0,s=function(){t.subtitlesTrack_.tech_.off("vttjsloaded",r),t.error({message:"Error loading vtt.js"}),t.state="READY",t.pause(),t.trigger("error")};return r=function(){t.subtitlesTrack_.tech_.off("vttjserror",s),t.handleSegment_()},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",r),void this.subtitlesTrack_.tech_.one("vttjserror",s)}n.requested=!0;try{this.parseVTTCues_(i)}catch(e){return this.error({message:e.message}),this.state="READY",this.pause(),this.trigger("error")}if(this.updateTimeMapping_(i,this.syncController_.timelines[i.timeline],this.playlist_),i.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");i.byteLength=i.bytes.byteLength,this.mediaSecondsLoaded+=n.duration,i.cues.length&&this.remove(i.cues[0].endTime,i.cues[i.cues.length-1].endTime),i.cues.forEach((function(e){t.subtitlesTrack_.addCue(e)})),this.handleUpdateEnd_()}else this.state="READY"}},{key:"parseVTTCues_",value:function(t){var i=void 0,n=!1;"function"==typeof e.TextDecoder?i=new e.TextDecoder("utf8"):(i=e.WebVTT.StringDecoder(),n=!0);var r=new e.WebVTT.Parser(e,e.vttjs,i);if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},r.oncue=t.cues.push.bind(t.cues),r.ontimestampmap=function(e){return t.timestampmap=e},r.onparsingerror=function(e){zr.log.warn("Error encountered when parsing cues: "+e.message)},t.segment.map){var s=t.segment.map.bytes;n&&(s=Ru(s)),r.parse(s)}var a=t.bytes;n&&(a=Ru(a)),r.parse(a),r.flush()}},{key:"updateTimeMapping_",value:function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,s=r.MPEGTS/9e4-r.LOCAL+t.mapping;if(e.cues.forEach((function(e){e.startTime+=s,e.endTime+=s})),!i.syncInfo){var a=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(a,o-n.duration)}}}else n.empty=!0}}]),i}(Du),Nu=function(e,t){for(var i=e.cues,n=0;n<i.length;n++){var r=i[n];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null},Bu=function(e,t){var i;return(i=Ca.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,s=null,a=0,o=0;e.length-o>=3;){switch(Ca.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((a=Ca.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===s&&(t=e.subarray(o,o+a),s=Ca.aac.parseAacTimestamp(t)),o+=a;break;case"audio":if(e.length-o<7){i=!0;break}if((a=Ca.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+a),r=Ca.aac.parseSampleRate(t)),n++,o+=a;break;default:o++}if(i)return null}if(null===r||null===s)return null;var u=Ea/r;return{audio:[{type:"audio",dts:s,pts:s},{type:"audio",dts:s+1024*n*u,pts:s+1024*n*u}]}}(e):function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=wa;r<e.byteLength;)if(e[n]!==Pa||e[r]!==Pa)n++,r++;else{switch(i=e.subarray(n,r),Ca.ts.parseType(i,t.pid)){case"pat":t.pid||(t.pid=Ca.ts.parsePat(i));break;case"pmt":t.table||(t.table=Ca.ts.parsePmt(i))}if(t.pid&&t.table)return;n+=wa,r+=wa}}(e,t),t.table)if(t.table.hasOwnProperty(n))switch(t.table[n]){case 27:i.video=[],Aa(e,t,i),0===i.video.length&&delete i.video;break;case 15:i.audio=[],La(e,t,i),0===i.audio.length&&delete i.audio}return i}(e))&&(i.audio||i.video)?(function(e,t){if(e.audio&&e.audio.length){var i=t;void 0===i&&(i=e.audio[0].dts),e.audio.forEach((function(e){e.dts=ka(e.dts,i),e.pts=ka(e.pts,i),e.dtsTime=e.dts/Ea,e.ptsTime=e.pts/Ea}))}if(e.video&&e.video.length){var n=t;if(void 0===n&&(n=e.video[0].dts),e.video.forEach((function(e){e.dts=ka(e.dts,n),e.pts=ka(e.pts,n),e.dtsTime=e.dts/Ea,e.ptsTime=e.pts/Ea})),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=ka(r.dts,n),r.pts=ka(r.pts,n),r.dtsTime=r.dts/Ea,r.ptsTime=r.dts/Ea}}}(i,t),i):null},ju=[{name:"VOD",run:function(e,t,i,n,r){return i!==1/0?{time:0,segmentIndex:0}:null}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!e.datetimeToDisplayTime)return null;var s=t.segments||[],a=null,o=null;r=r||0;for(var u=0;u<s.length;u++){var l=s[u];if(l.dateTimeObject){var c=l.dateTimeObject.getTime()/1e3+e.datetimeToDisplayTime,h=Math.abs(r-c);if(null!==o&&(0===h||o<h))break;o=h,a={time:c,segmentIndex:u}}}return a}},{name:"Segment",run:function(e,t,i,n,r){var s=t.segments||[],a=null,o=null;r=r||0;for(var u=0;u<s.length;u++){var l=s[u];if(l.timeline===n&&void 0!==l.start){var c=Math.abs(r-l.start);if(null!==o&&o<c)break;(!a||null===o||o>=c)&&(o=c,a={time:l.start,segmentIndex:u})}}return a}},{name:"Discontinuity",run:function(e,t,i,n,r){var s=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var a=null,o=0;o<t.discontinuityStarts.length;o++){var u=t.discontinuityStarts[o],l=t.discontinuitySequence+o+1,c=e.discontinuities[l];if(c){var h=Math.abs(r-c.time);if(null!==a&&a<h)break;(!s||null===a||a>=h)&&(a=h,s={time:c.time,segmentIndex:u})}}return s}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence}:null}}],Fu=function(e){function t(){Ha(this,t);var e=za(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.inspectCache_=void 0,e.timelines=[],e.discontinuities=[],e.datetimeToDisplayTime=null,e.logger_=Tu("SyncController"),e}return Wa(t,e),Va(t,[{key:"getSyncPoint",value:function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+so(e,n.segmentIndex,0))}},{key:"runStrategies_",value:function(e,t,i,n){for(var r=[],s=0;s<ju.length;s++){var a=ju[s],o=a.run(this,e,t,i,n);o&&(o.strategy=a.name,r.push({strategy:a.name,syncPoint:o}))}return r}},{key:"selectSyncPoint_",value:function(e,t){for(var i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,s=1;s<e.length;s++){var a=Math.abs(e[s].syncPoint[t.key]-t.value);a<n&&(n=a,i=e[s].syncPoint,r=e[s].strategy)}return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+r+"]: [time:"+i.time+", segmentIndex:"+i.segmentIndex+"]"),i}},{key:"saveExpiredSegmentInfo",value:function(e,t){for(var i=t.mediaSequence-e.mediaSequence-1;i>=0;i--){var n=e.segments[i];if(n&&void 0!==n.start){t.syncInfo={mediaSequence:e.mediaSequence+i,time:n.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMapping",value:function(e){if(!this.datetimeToDisplayTime&&e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0].dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-t}}},{key:"reset",value:function(){this.inspectCache_=void 0}},{key:"probeSegmentInfo",value:function(e){var t,i=e.segment,n=e.playlist;return(t=i.map?this.probeMp4Segment_(e):this.probeTsSegment_(e))&&this.calculateSegmentTimeMapping_(e,t)&&(this.saveDiscontinuitySyncInfo_(e),n.syncInfo||(n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:i.start})),t}},{key:"probeMp4Segment_",value:function(e){var t=e.segment,i=Zs.timescale(t.map.bytes),n=Zs.compositionStartTime(i,e.bytes);return null!==e.timestampOffset&&(e.timestampOffset-=n),{start:n,end:n+t.duration}}},{key:"probeTsSegment_",value:function(e){var t=Bu(e.bytes,this.inspectCache_),i=void 0,n=void 0,r=void 0;return t?(t.video&&2===t.video.length?(this.inspectCache_=t.video[1].dts,i=t.video[0].dtsTime,n=t.video[1].dtsTime,r=t.video):t.audio&&2===t.audio.length&&(this.inspectCache_=t.audio[1].dts,i=t.audio[0].dtsTime,n=t.audio[1].dtsTime,r=t.audio),{segmentTimestampInfo:r,start:i,end:n,containsVideo:t.video&&2===t.video.length,containsAudio:t.audio&&2===t.audio.length}):null}},{key:"timestampOffsetForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].time}},{key:"mappingForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}},{key:"calculateSegmentTimeMapping_",value:function(e,t){var i=e.segment,n=this.timelines[e.timeline];if(null!==e.timestampOffset)n={time:e.startOfSegment,mapping:e.startOfSegment-t.start},this.timelines[e.timeline]=n,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+n.time+"] [mapping: "+n.mapping+"]"),i.start=e.startOfSegment,i.end=t.end+n.mapping;else{if(!n)return!1;i.start=t.start+n.mapping,i.end=t.end+n.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(e){var t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var n=0;n<t.discontinuityStarts.length;n++){var r=t.discontinuityStarts[n],s=t.discontinuitySequence+n+1,a=r-e.mediaIndex,o=Math.abs(a);if(!this.discontinuities[s]||this.discontinuities[s].accuracy>o){var u;u=a<0?i.start-so(t,e.mediaIndex,r):i.end+so(t,e.mediaIndex+1,r),this.discontinuities[s]={time:u,accuracy:o}}}}}]),t}(zr.EventTarget),Hu=new Go("./decrypter-worker.worker.js",(function(e,t){var i=this;!function(){var e=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},t=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),n=null,r=function(){function t(i){e(this,t),n||(n=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],n=t[4],r=i[4],s=void 0,a=void 0,o=void 0,u=[],l=[],c=void 0,h=void 0,d=void 0,p=void 0,f=void 0;for(s=0;s<256;s++)l[(u[s]=s<<1^283*(s>>7))^s]=s;for(a=o=0;!n[a];a^=c||1,o=l[o]||1)for(d=(d=o^o<<1^o<<2^o<<3^o<<4)>>8^255&d^99,n[a]=d,r[d]=a,f=16843009*u[h=u[c=u[a]]]^65537*h^257*c^16843008*a,p=257*u[d]^16843008*d,s=0;s<4;s++)t[s][a]=p=p<<24^p>>>8,i[s][d]=f=f<<24^f>>>8;for(s=0;s<5;s++)t[s]=t[s].slice(0),i[s]=i[s].slice(0);return e}()),this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];var r=void 0,s=void 0,a=void 0,o=void 0,u=void 0,l=this._tables[0][4],c=this._tables[1],h=i.length,d=1;if(4!==h&&6!==h&&8!==h)throw new Error("Invalid aes key size");for(o=i.slice(0),u=[],this._key=[o,u],r=h;r<4*h+28;r++)a=o[r-1],(r%h==0||8===h&&r%h==4)&&(a=l[a>>>24]<<24^l[a>>16&255]<<16^l[a>>8&255]<<8^l[255&a],r%h==0&&(a=a<<8^a>>>24^d<<24,d=d<<1^283*(d>>7))),o[r]=o[r-h]^a;for(s=0;r;s++,r--)a=o[3&s?r:r-4],u[s]=r<=4||s<4?a:c[0][l[a>>>24]]^c[1][l[a>>16&255]]^c[2][l[a>>8&255]]^c[3][l[255&a]]}return t.prototype.decrypt=function(e,t,i,n,r,s){var a=this._key[1],o=e^a[0],u=n^a[1],l=i^a[2],c=t^a[3],h=void 0,d=void 0,p=void 0,f=a.length/4-2,m=void 0,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],S=v[4];for(m=0;m<f;m++)h=y[o>>>24]^_[u>>16&255]^b[l>>8&255]^T[255&c]^a[g],d=y[u>>>24]^_[l>>16&255]^b[c>>8&255]^T[255&o]^a[g+1],p=y[l>>>24]^_[c>>16&255]^b[o>>8&255]^T[255&u]^a[g+2],c=y[c>>>24]^_[o>>16&255]^b[u>>8&255]^T[255&l]^a[g+3],g+=4,o=h,u=d,l=p;for(m=0;m<4;m++)r[(3&-m)+s]=S[o>>>24]<<24^S[u>>16&255]<<16^S[l>>8&255]<<8^S[255&c]^a[g++],h=o,o=u,u=l,l=c,c=h},t}(),s=function(){function t(){e(this,t),this.listeners={}}return t.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.prototype.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},t.prototype.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),s=t.length,a=0;a<s;++a)t[a].apply(this,r)},t.prototype.dispose=function(){this.listeners={}},t.prototype.pipe=function(e){this.on("data",(function(t){e.push(t)}))},t}(),a=function(t){function i(){e(this,i);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,t.call(this,s));return n.jobs=[],n.delay=1,n.timeout_=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(i,t),i.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},i}(s),o=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},u=function(){function i(t,n,r,s){e(this,i);var u=i.STEP,l=new Int32Array(t.buffer),c=new Uint8Array(t.byteLength),h=0;for(this.asyncStream_=new a,this.asyncStream_.push(this.decryptChunk_(l.subarray(h,h+u),n,r,c)),h=u;h<l.length;h+=u)r=new Uint32Array([o(l[h-4]),o(l[h-3]),o(l[h-2]),o(l[h-1])]),this.asyncStream_.push(this.decryptChunk_(l.subarray(h,h+u),n,r,c));this.asyncStream_.push((function(){var e;s(null,(e=c).subarray(0,e.byteLength-e[e.byteLength-1]))}))}return i.prototype.decryptChunk_=function(e,t,i,n){return function(){var s=function(e,t,i){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),s=new r(Array.prototype.slice.call(t)),a=new Uint8Array(e.byteLength),u=new Int32Array(a.buffer),l=void 0,c=void 0,h=void 0,d=void 0,p=void 0,f=void 0,m=void 0,g=void 0,v=void 0;for(l=i[0],c=i[1],h=i[2],d=i[3],v=0;v<n.length;v+=4)p=o(n[v]),f=o(n[v+1]),m=o(n[v+2]),g=o(n[v+3]),s.decrypt(p,f,m,g,u,v),u[v]=o(u[v]^l),u[v+1]=o(u[v+1]^c),u[v+2]=o(u[v+2]^h),u[v+3]=o(u[v+3]^d),l=p,c=f,h=m,d=g;return a}(e,t,i);n.set(s,e.byteOffset)}},t(i,null,[{key:"STEP",get:function(){return 32e3}}]),i}();new function(e){e.onmessage=function(t){var i=t.data,n=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),r=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),s=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new u(n,r,s,(function(t,n){var r,s;e.postMessage((r={source:i.source,decrypted:n},s={},Object.keys(r).forEach((function(e){var t=r[e];ArrayBuffer.isView(t)?s[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:s[e]=t})),s),[n.buffer])}))}}(i)}()})),Vu=function(e){var t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},qu=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Wu=function(e,t){t.activePlaylistLoader=e,e.load()},zu={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;qu(i,n);var s=n.activeTrack(),a=n.activeGroup(),o=(a.filter((function(e){return e.default}))[0]||a[0]).id,u=n.tracks[o];if(s!==u){for(var l in zr.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[l].enabled=n.tracks[l]===u;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];zr.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),qu(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},Gu={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,s=i.segmentLoaders[e];t.on("loadedmetadata",(function(){var e=t.media();s.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&s.load()})),t.on("loadedplaylist",(function(){s.playlist(t.media(),r),n.paused()||s.load()})),t.on("error",zu[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,s=i.segmentLoaders[e],a=i.mediaTypes[e];t.on("loadedmetadata",(function(){var e=t.media();s.playlist(e,r),s.track(a.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&s.load()})),t.on("loadedplaylist",(function(){s.playlist(t.media(),r),n.paused()||s.load()})),t.on("error",zu[e](e,i))}},Ku={AUDIO:function(e,t){var i=t.hls,n=t.sourceType,r=t.segmentLoaders[e],s=t.requestOptions,a=t.master.mediaGroups,o=t.mediaTypes[e],u=o.groups,l=o.tracks,c=t.masterPlaylistLoader;for(var h in a[e]&&0!==Object.keys(a[e]).length||(a[e]={main:{default:{default:!0}}}),a[e])for(var d in u[h]||(u[h]=[]),a[e][h]){var p,f=a[e][h][d];if(p=f.resolvedUri?new to(f.resolvedUri,i,s):f.playlists&&"dash"===n?new bu(f.playlists[0],i,s,c):null,f=zr.mergeOptions({id:d,playlistLoader:p},f),Gu[e](e,f.playlistLoader,t),u[h].push(f),void 0===l[d]){var m=new zr.AudioTrack({id:d,kind:Vu(f),enabled:!1,language:f.language,default:f.default,label:d});l[d]=m}}r.on("error",zu[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.hls,r=t.sourceType,s=t.segmentLoaders[e],a=t.requestOptions,o=t.master.mediaGroups,u=t.mediaTypes[e],l=u.groups,c=u.tracks,h=t.masterPlaylistLoader;for(var d in o[e])for(var p in l[d]||(l[d]=[]),o[e][d])if(!o[e][d][p].forced){var f=o[e][d][p],m=void 0;if("hls"===r?m=new to(f.resolvedUri,n,a):"dash"===r&&(m=new bu(f.playlists[0],n,a,h)),f=zr.mergeOptions({id:p,playlistLoader:m},f),Gu[e](e,f.playlistLoader,t),l[d].push(f),void 0===c[p]){var g=i.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;c[p]=g}}s.on("error",zu[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],s=r.groups,a=r.tracks;for(var o in n[e])for(var u in s[o]||(s[o]=[]),n[e][o]){var l=n[e][o][u];if(l.instreamId.match(/CC\d/)&&(s[o].push(zr.mergeOptions({id:u},l)),void 0===a[u])){var c=i.addRemoteTextTrack({id:l.instreamId,kind:"captions",default:l.default&&l.autoselect,language:l.language,label:u},!1).track;a[u]=c}}}},Xu={AUDIO:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if(i[n].enabled)return i[n];return null}},SUBTITLES:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if("showing"===i[n].mode)return i[n];return null}}},Yu=void 0,$u=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],Qu=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},Ju=function(t){function i(e){Ha(this,i);var t,n=za(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),r=e.url,s=e.handleManifestRedirects,a=e.withCredentials,o=e.tech,u=e.bandwidth,l=e.externHls,c=e.useCueTags,h=e.blacklistDuration,d=e.enableLowInitialPlaylist,p=e.sourceType,f=e.seekTo,m=e.cacheEncryptionKeys;if(!r)throw new Error("A non-empty playlist URL is required");Yu=l,n.withCredentials=a,n.tech_=o,n.hls_=o.hls,n.seekTo_=f,n.sourceType_=p,n.useCueTags_=c,n.blacklistDuration=h,n.enableLowInitialPlaylist=d,n.useCueTags_&&(n.cueTagsTrack_=n.tech_.addTextTrack("metadata","ad-cues"),n.cueTagsTrack_.inBandMetadataTrackDispatchType=""),n.requestOptions_={withCredentials:a,handleManifestRedirects:s,timeout:null},n.mediaTypes_=(t={},["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(e){t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Su,activeTrack:Su,onGroupChanged:Su,onTrackChanged:Su}})),t),n.mediaSource=new zr.MediaSource,n.mediaSource.addEventListener("sourceopen",n.handleSourceOpen_.bind(n)),n.seekable_=zr.createTimeRanges(),n.hasPlayed_=function(){return!1},n.syncController_=new Fu(e),n.segmentMetadataTrack_=o.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,n.decrypter_=new Hu,n.inbandTextTracks_={};var g={hls:n.hls_,mediaSource:n.mediaSource,currentTime:n.tech_.currentTime.bind(n.tech_),seekable:function(){return n.seekable()},seeking:function(){return n.tech_.seeking()},duration:function(){return n.mediaSource.duration},hasPlayed:function(){return n.hasPlayed_()},goalBufferLength:function(){return n.goalBufferLength()},bandwidth:u,syncController:n.syncController_,decrypter:n.decrypter_,sourceType:n.sourceType_,inbandTextTracks:n.inbandTextTracks_,cacheEncryptionKeys:m};return n.masterPlaylistLoader_="dash"===n.sourceType_?new bu(r,n.hls_,n.requestOptions_):new to(r,n.hls_,n.requestOptions_),n.setupMasterPlaylistLoaderListeners_(),n.mainSegmentLoader_=new Du(zr.mergeOptions(g,{segmentMetadataTrack:n.segmentMetadataTrack_,loaderType:"main"}),e),n.audioSegmentLoader_=new Du(zr.mergeOptions(g,{loaderType:"audio"}),e),n.subtitleSegmentLoader_=new Mu(zr.mergeOptions(g,{loaderType:"vtt"}),e),n.setupSegmentLoaderListeners_(),$u.forEach((function(e){n[e+"_"]=Qu.bind(n,e)})),n.logger_=Tu("MPC"),n.masterPlaylistLoader_.load(),n}return Wa(i,t),Va(i,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;vo(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){Ku[t](t,e)}));var t=e.mediaTypes,i=e.masterPlaylistLoader,n=e.tech,r=e.hls;["AUDIO","SUBTITLES"].forEach((function(i){t[i].activeGroup=function(e,t){return function(i){var n=t.masterPlaylistLoader,r=t.mediaTypes[e].groups,s=n.media();if(!s)return null;var a=null;return s.attributes[e]&&(a=r[s.attributes[e]]),a=a||r.main,void 0===i?a:null===i?null:a.filter((function(e){return e.id===i.id}))[0]||null}}(i,e),t[i].activeTrack=Xu[i](i,e),t[i].onGroupChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,s=t.mediaTypes[e],a=s.activeTrack(),o=s.activeGroup(a),u=s.activePlaylistLoader;qu(n,s),o&&(o.playlistLoader?(n.resyncLoader(),Wu(o.playlistLoader,s)):u&&r.resetEverything())}}(i,e),t[i].onTrackChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,s=t.mediaTypes[e],a=s.activeTrack(),o=s.activeGroup(a),u=s.activePlaylistLoader;qu(n,s),o&&(o.playlistLoader?u!==o.playlistLoader?(n.track&&n.track(a),n.resetEverything(),Wu(o.playlistLoader,s)):Wu(o.playlistLoader,s):r.resetEverything())}}(i,e)}));var s=t.AUDIO.activeGroup(),a=(s.filter((function(e){return e.default}))[0]||s[0]).id;t.AUDIO.tracks[a].enabled=!0,t.AUDIO.onTrackChanged(),i.on("mediachange",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanged()}))}));var o=function(){t.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"hls-audio-change"})};for(var u in n.audioTracks().addEventListener("change",o),n.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",(function(){n.audioTracks().removeEventListener("change",o),n.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),n.clearTracks("audio"),t.AUDIO.tracks)n.audioTracks().addTrack(t.AUDIO.tracks[u])}({sourceType:e.sourceType_,segmentLoaders:{AUDIO:e.audioSegmentLoader_,SUBTITLES:e.subtitleSegmentLoader_,main:e.mainSegmentLoader_},tech:e.tech_,requestOptions:e.requestOptions_,masterPlaylistLoader:e.masterPlaylistLoader_,hls:e.hls_,master:e.master(),mediaTypes:e.mediaTypes_,blacklistCurrentPlaylist:e.blacklistCurrentPlaylist.bind(e)}),e.triggerPresenceUsage_(e.master(),t);try{e.setupSourceBuffers_()}catch(t){return zr.log.warn("Failed to create SourceBuffers",t),e.mediaSource.endOfStream("decode")}e.setupFirstPlay(),!e.mediaTypes_.AUDIO.activePlaylistLoader||e.mediaTypes_.AUDIO.activePlaylistLoader.media()?e.trigger("selectedinitialmedia"):e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(function(){e.trigger("selectedinitialmedia")}))})),this.masterPlaylistLoader_.on("loadedplaylist",(function(){var t=e.masterPlaylistLoader_.media();if(!t){e.excludeUnsupportedVariants_();var i=void 0;return e.enableLowInitialPlaylist&&(i=e.selectInitialPlaylist()),i||(i=e.selectPlaylist()),e.initialMedia_=i,void e.masterPlaylistLoader_.media(e.initialMedia_)}if(e.useCueTags_&&e.updateAdCues_(t),e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.updateDuration(),e.tech_.paused()||(e.mainSegmentLoader_.load(),e.audioSegmentLoader_&&e.audioSegmentLoader_.load()),!t.endList){var n=function(){var t=e.seekable();0!==t.length&&e.mediaSource.addSeekableRange_(t.start(0),t.end(0))};e.duration()!==1/0?e.tech_.one("durationchange",(function t(){e.duration()===1/0?n():e.tech_.one("durationchange",t)})):n()}})),this.masterPlaylistLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)})),this.masterPlaylistLoader_.on("mediachanging",(function(){e.mainSegmentLoader_.abort(),e.mainSegmentLoader_.pause()})),this.masterPlaylistLoader_.on("mediachange",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;vo(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load(),e.tech_.trigger({type:"mediachange",bubbles:!0})})),this.masterPlaylistLoader_.on("playlistunchanged",(function(){var t=e.masterPlaylistLoader_.media();e.stuckAtPlaylistEnd_(t)&&(e.blacklistCurrentPlaylist({message:"Playlist no longer updating."}),e.tech_.trigger("playliststuck"))})),this.masterPlaylistLoader_.on("renditiondisabled",(function(){e.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})})),this.masterPlaylistLoader_.on("renditionenabled",(function(){e.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})}))}},{key:"triggerPresenceUsage_",value:function(e,t){var i=e.mediaGroups||{},n=!0,r=Object.keys(i.AUDIO);for(var s in i.AUDIO)for(var a in i.AUDIO[s])i.AUDIO[s][a].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"hls-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"}),Yu.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"hls-aes"}),Yu.Playlist.isFmp4(t)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"}),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"hls-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}},{key:"setupSegmentLoaderListeners_",value:function(){var e=this;this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist(),i=e.masterPlaylistLoader_.media(),n=e.tech_.buffered(),r=n.length?n.end(n.length-1)-e.tech_.currentTime():0,s=e.bufferLowWaterLine();(!i.endList||e.duration()<Cu.MAX_BUFFER_LOW_WATER_LINE||t.attributes.BANDWIDTH<i.attributes.BANDWIDTH||r>=s)&&e.masterPlaylistLoader_.media(t),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")})),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("ended",(function(){e.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(function(){e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)})),this.mainSegmentLoader_.on("reseteverything",(function(){e.tech_.trigger("hls-reset")})),this.mainSegmentLoader_.on("segmenttimemapping",(function(t){e.tech_.trigger({type:"hls-segment-time-mapping",mapping:t.mapping})})),this.audioSegmentLoader_.on("ended",(function(){e.onEndOfStream()}))}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}},{key:"smoothQualityChange_",value:function(){var e=this.selectPlaylist();e!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(e),this.mainSegmentLoader_.resetLoader())}},{key:"fastQualityChange_",value:function(){var e=this,t=this.selectPlaylist();t!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(t),this.mainSegmentLoader_.resetEverything((function(){zr.browser.IE_VERSION||zr.browser.IS_EDGE?e.tech_.setCurrentTime(e.tech_.currentTime()+.04):e.tech_.setCurrentTime(e.tech_.currentTime())})))}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.seekTo_(0),this.hasPlayed_()&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.seekTo_(e.end(e.length-1)):void 0}}},{key:"setupFirstPlay",value:function(){var e=this,t=this.masterPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_())return!1;if(!t.endList){var i=this.seekable();if(!i.length)return!1;if(zr.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",(function(){e.trigger("firstplay"),e.seekTo_(i.end(0)),e.hasPlayed_=function(){return!0}})),!1;this.trigger("firstplay"),this.seekTo_(i.end(0))}return this.hasPlayed_=function(){return!0},this.load(),!0}},{key:"handleSourceOpen_",value:function(){try{this.setupSourceBuffers_()}catch(e){return zr.log.warn("Failed to create Source Buffers",e),this.mediaSource.endOfStream("decode")}if(this.tech_.autoplay()){var e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,(function(e){}))}this.trigger("sourceopen")}},{key:"onEndOfStream",value:function(){var e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(e=!this.mainSegmentLoader_.startingMedia_||this.mainSegmentLoader_.startingMedia_.containsVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_),e){this.logger_("calling mediaSource.endOfStream()");try{this.mediaSource.endOfStream()}catch(e){zr.log.warn("Failed to call media source endOfStream",e)}}}},{key:"stuckAtPlaylistEnd_",value:function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.mediaSource.duration);if(null===t)return!1;var i=Yu.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-n<=Do;var s=r.end(r.length-1);return s-n<=Do&&i-s<=Do}},{key:"blacklistCurrentPlaylist",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],i=void 0,n=void 0;if(i=e.playlist||this.masterPlaylistLoader_.media(),t=t||e.blacklistDuration||this.blacklistDuration,!i){this.error=e;try{return this.mediaSource.endOfStream("network")}catch(e){return this.trigger("error")}}var r=1===this.masterPlaylistLoader_.master.playlists.filter(mo).length,s=this.masterPlaylistLoader_.master.playlists;return 1===s.length?(zr.log.warn("Problem encountered with the current HLS playlist. Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(r)):(r&&(zr.log.warn("Removing all playlists from the blacklist because the last rendition is about to be blacklisted."),s.forEach((function(e){e.excludeUntil!==1/0&&delete e.excludeUntil})),this.tech_.trigger("retryplaylist")),i.excludeUntil=Date.now()+1e3*t,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),n=this.selectPlaylist(),zr.log.warn("Problem encountered with the current HLS playlist."+(e.message?" "+e.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(n,r))}},{key:"pauseLoading",value:function(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}},{key:"setCurrentTime",value:function(e){var t=Uo(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}},{key:"duration",value:function(){return this.masterPlaylistLoader_?this.mediaSource?this.mediaSource.duration:Yu.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var e=void 0,t=void 0;if(this.masterPlaylistLoader_){var i=this.masterPlaylistLoader_.media();if(i){var n=this.syncController_.getExpiredTime(i,this.mediaSource.duration);if(null!==n&&0!==(e=Yu.Playlist.seekable(i,n)).length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(i=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(n=this.syncController_.getExpiredTime(i,this.mediaSource.duration)))return;if(0===(t=Yu.Playlist.seekable(i,n)).length)return}var r=void 0,s=void 0;this.seekable_&&this.seekable_.length&&(r=this.seekable_.end(0),s=this.seekable_.start(0)),t?t.start(0)>e.end(0)||e.start(0)>t.end(0)?this.seekable_=e:this.seekable_=zr.createTimeRanges([[t.start(0)>e.start(0)?t.start(0):e.start(0),t.end(0)<e.end(0)?t.end(0):e.end(0)]]):this.seekable_=e,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===r&&this.seekable_.start(0)===s||(this.logger_("seekable updated ["+No(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}}}},{key:"updateDuration",value:function(){var e=this,t=this.mediaSource.duration,i=Yu.Playlist.duration(this.masterPlaylistLoader_.media()),n=this.tech_.buffered(),r=function t(){e.logger_("Setting duration from "+e.mediaSource.duration+" => "+i);try{e.mediaSource.duration=i}catch(e){zr.log.warn("Failed to set media source duration",e)}e.tech_.trigger("durationchange"),e.mediaSource.removeEventListener("sourceopen",t)};n.length>0&&(i=Math.max(i,n.end(n.length-1))),t!==i&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",r):r())}},{key:"dispose",value:function(){var e=this;this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function(){var e,t=this.masterPlaylistLoader_.media();if(t&&"open"===this.mediaSource.readyState){if((e=function(e,t){var i=function(e){return e.segments&&e.segments.length&&e.segments[0].map?"mp4":"mp2t"}(t),n=function(e){var t=e.attributes||{};return t.CODECS?eu(t.CODECS):Jo}(t),r=t.attributes||{},s=!0,a=!1;if(!t)return[];if(e.mediaGroups.AUDIO&&r.AUDIO){var o=e.mediaGroups.AUDIO[r.AUDIO];if(o)for(var u in a=!0,s=!1,o)if(!o[u].uri&&!o[u].playlists){s=!0;break}}a&&!n.audioProfile&&(s||(n.audioProfile=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return eu(r.playlists[0].attributes.CODECS).audioProfile}return null}(e,r.AUDIO)),n.audioProfile||(zr.log.warn("Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)"),n.audioProfile=Jo.audioProfile));var l={};n.videoCodec&&(l.video=""+n.videoCodec+n.videoObjectTypeIndicator),n.audioProfile&&(l.audio="mp4a.40."+n.audioProfile);var c=tu("audio",i,[l.audio]),h=tu("video",i,[l.video]),d=tu("video",i,[l.video,l.audio]);return a?!s&&l.video?[h,c]:s||l.video?[d,c]:[c,c]:l.video?[d]:[c]}(this.masterPlaylistLoader_.master,t)).length<1)return this.error="No compatible SourceBuffer configuration for the variant stream:"+t.resolvedUri,this.mediaSource.endOfStream("decode");this.configureLoaderMimeTypes_(e),this.excludeIncompatibleVariants_(t)}}},{key:"configureLoaderMimeTypes_",value:function(e){var t=e.length>1&&-1===e[0].indexOf(",")&&e[0]!==e[1]?new zr.EventTarget:null;this.mainSegmentLoader_.mimeType(e[0],t),e[1]&&this.audioSegmentLoader_.mimeType(e[1],t)}},{key:"excludeUnsupportedVariants_",value:function(){this.master().playlists.forEach((function(t){var i;t.attributes.CODECS&&e.MediaSource&&e.MediaSource.isTypeSupported&&!e.MediaSource.isTypeSupported('video/mp4; codecs="'+(i=t.attributes.CODECS,i.replace(/avc1\.(\d+)\.(\d+)/i,(function(e){return Zo([e])[0]}))+'"'))&&(t.excludeUntil=1/0)}))}},{key:"excludeIncompatibleVariants_",value:function(e){var t=2,i=null,n=void 0;e.attributes.CODECS&&(n=eu(e.attributes.CODECS),i=n.videoCodec,t=n.codecCount),this.master().playlists.forEach((function(e){var n={codecCount:2,videoCodec:null};e.attributes.CODECS&&(n=eu(e.attributes.CODECS)),n.codecCount!==t&&(e.excludeUntil=1/0),n.videoCodec!==i&&(e.excludeUntil=1/0)}))}},{key:"updateAdCues_",value:function(t){var i=0,n=this.seekable();n.length&&(i=n.start(0)),function(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t.segments)for(var r=n,s=void 0,a=0;a<t.segments.length;a++){var o=t.segments[a];if(s||(s=Nu(i,r+o.duration/2)),s){if("cueIn"in o){s.endTime=r,s.adEndTime=r,r+=o.duration,s=null;continue}if(r<s.endTime){r+=o.duration;continue}s.endTime+=o.duration}else if("cueOut"in o&&((s=new e.VTTCue(r,r+o.duration,o.cueOut)).adStartTime=r,s.adEndTime=r+parseFloat(o.cueOut),i.addCue(s)),"cueOutCont"in o){var u=void 0,l=void 0,c=o.cueOutCont.split("/").map(parseFloat),h=Ga(c,2);u=h[0],l=h[1],(s=new e.VTTCue(r,r+o.duration,"")).adStartTime=r-u,s.adEndTime=s.adStartTime+l,i.addCue(s)}r+=o.duration}}(t,this.cueTagsTrack_,i)}},{key:"goalBufferLength",value:function(){var e=this.tech_.currentTime(),t=Cu.GOAL_BUFFER_LENGTH,i=Cu.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Cu.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)}},{key:"bufferLowWaterLine",value:function(){var e=this.tech_.currentTime(),t=Cu.BUFFER_LOW_WATER_LINE,i=Cu.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Cu.MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,n)}}]),i}(zr.EventTarget),Zu=function e(t,i,n){Ha(this,e);var r,s,a,o=t.masterPlaylistController_,u=o[(t.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(o);if(i.attributes.RESOLUTION){var l=i.attributes.RESOLUTION;this.width=l.width,this.height=l.height}this.bandwidth=i.attributes.BANDWIDTH,this.id=n,this.enabled=(r=t.playlists,s=i.uri,a=u,function(e){var t=r.master.playlists[s],i=fo(t),n=mo(t);return void 0===e?n:(e?delete t.disabled:t.disabled=!0,e===n||i||(a(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})},el=["seeking","seeked","pause","playing","error"],tl=function(){function t(i){var n=this;Ha(this,t),this.tech_=i.tech,this.seekable=i.seekable,this.seekTo=i.seekTo,this.allowSeeksWithinUnsafeLiveWindow=i.allowSeeksWithinUnsafeLiveWindow,this.media=i.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=Tu("PlaybackWatcher"),this.logger_("initialize");var r=function(){return n.monitorCurrentTime_()},s=function(){return n.techWaiting_()},a=function(){return n.cancelTimer_()},o=function(){return n.fixesBadSeeks_()};this.tech_.on("seekablechanged",o),this.tech_.on("waiting",s),this.tech_.on(el,a),this.tech_.on("canplay",r),this.dispose=function(){n.logger_("dispose"),n.tech_.off("seekablechanged",o),n.tech_.off("waiting",s),n.tech_.off(el,a),n.tech_.off("canplay",r),n.checkCurrentTimeTimeout_&&e.clearTimeout(n.checkCurrentTimeTimeout_),n.cancelTimer_()}}return Va(t,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&e.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=e.setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"checkCurrentTime_",value:function(){if(this.tech_.seeking()&&this.fixesBadSeeks_())return this.consecutiveUpdates=0,void(this.lastRecordedTime=this.tech_.currentTime());if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+Do>=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)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null}},{key:"fixesBadSeeks_",value:function(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime(),i=void 0;return this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(i=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)&&(i=e.start(0)+Do),void 0!==i&&(this.logger_("Trying to seek outside of seekable at time "+t+" with seekable range "+No(e)+". Seeking to "+i+"."),this.seekTo(i),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),i=Uo(t,e);return i.length&&e+3<=i.end(0)?(this.cancelTimer_(),this.seekTo(e),this.logger_("Stopped at "+e+" while inside a buffered region ["+i.start(0)+" -> "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.seekTo(i),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.buffered(),r=Mo(n,t);if(this.videoUnderflow_(r,n,t))return this.cancelTimer_(),this.seekTo(t),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;if(r.length>0){var s=r.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+r.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t),!0}return!1}},{key:"afterSeekableWindow_",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!e.length)return!1;var r=e.end(e.length-1)+Do,s=!i.endList;return s&&n&&(r=e.end(e.length-1)+3*i.targetDuration),t>r}},{key:"beforeSeekableWindow_",value:function(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-Do)}},{key:"videoUnderflow_",value:function(e,t,i){if(0===e.length){var n=this.gapFromVideoUnderflow_(t,i);if(n)return this.logger_("Encountered a gap in video from "+n.start+" to "+n.end+". Seeking to current time "+i),!0}return!1}},{key:"skipTheGap_",value:function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),n=Mo(t,i);this.cancelTimer_(),0!==n.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.seekTo(n.start(0)+Oo),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))}},{key:"gapFromVideoUnderflow_",value:function(e,t){for(var i=function(e){if(e.length<2)return zr.createTimeRanges();for(var t=[],i=1;i<e.length;i++){var n=e.end(i-1),r=e.start(i);t.push([n,r])}return zr.createTimeRanges(t)}(e),n=0;n<i.length;n++){var r=i.start(n),s=i.end(n);if(t-r<4&&t-r>2)return{start:r,end:s}}return null}}]),t}(),il={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}},nl=function e(t,i){var n=0,r=0,s=zr.mergeOptions(il,i);t.ready((function(){t.trigger({type:"usage",name:"hls-error-reload-initialized"})}));var a=function(){r&&t.currentTime(r)},o=function(e){null!=e&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",a),t.src(e),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},u=function(){if(Date.now()-n<1e3*s.errorInterval)t.trigger({type:"usage",name:"hls-error-reload-canceled"});else{if(s.getSource&&"function"==typeof s.getSource)return n=Date.now(),s.getSource.call(t,o);zr.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},l=function e(){t.off("loadedmetadata",a),t.off("error",u),t.off("dispose",e)};t.on("error",u),t.on("dispose",l),t.reloadSourceOnError=function(i){l(),e(t,i)}},rl=function(e){nl(this,e)};zr.use("*",(function(e){return{setSource:function(e,t){t(null,e)},setCurrentTime:function(t){return e.vhs&&e.currentSource().src===e.vhs.source_.src&&e.vhs.setCurrentTime(t),t},play:function(){e.vhs&&e.currentSource().src===e.vhs.source_.src&&e.vhs.setCurrentTime(e.tech_.currentTime())}}}));var sl={PlaylistLoader:to,Playlist:yo,Decrypter:Ba,AsyncStream:Ua,decrypt:Na,utils:Io,STANDARD_PLAYLIST_SELECTOR:function(){return function(t,i,n,r,s){var a=t.playlists.map((function(t){var i,n;return i=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width,n=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height,{bandwidth:t.attributes.BANDWIDTH||e.Number.MAX_VALUE,width:i,height:n,playlist:t}}));Au(a,(function(e,t){return e.bandwidth-t.bandwidth}));var o=(a=a.filter((function(e){return!yo.isIncompatible(e.playlist)}))).filter((function(e){return yo.isEnabled(e.playlist)}));o.length||(o=a.filter((function(e){return!yo.isDisabled(e.playlist)})));var u=o.filter((function(e){return e.bandwidth*Cu.BANDWIDTH_VARIANCE<i})),l=u[u.length-1],c=u.filter((function(e){return e.bandwidth===l.bandwidth}))[0];if(!1===s){var h=c||o[0]||a[0];return h?h.playlist:null}var d=u.filter((function(e){return e.width&&e.height}));Au(d,(function(e,t){return e.width-t.width}));var p=d.filter((function(e){return e.width===n&&e.height===r}));l=p[p.length-1];var f=p.filter((function(e){return e.bandwidth===l.bandwidth}))[0],m=void 0,g=void 0,v=void 0;f||(g=(m=d.filter((function(e){return e.width>n||e.height>r}))).filter((function(e){return e.width===m[0].width&&e.height===m[0].height})),l=g[g.length-1],v=g.filter((function(e){return e.bandwidth===l.bandwidth}))[0]);var y=v||f||c||o[0]||a[0];return y?y.playlist:null}(this.playlists.master,this.systemBandwidth,parseInt(Lu(this.tech_.el(),"width"),10),parseInt(Lu(this.tech_.el(),"height"),10),this.limitRenditionByPlayerDimensions)},INITIAL_PLAYLIST_SELECTOR:function(){var e=this.playlists.master.playlists.filter(yo.isEnabled);return Au(e,(function(e,t){return Iu(e,t)})),e.filter((function(e){return eu(e.attributes.CODECS).videoCodec}))[0]||null},comparePlaylistBandwidth:Iu,comparePlaylistResolution:function(t,i){var n=void 0,r=void 0;return t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),n=n||e.Number.MAX_VALUE,i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(r=i.attributes.RESOLUTION.width),n===(r=r||e.Number.MAX_VALUE)&&t.attributes.BANDWIDTH&&i.attributes.BANDWIDTH?t.attributes.BANDWIDTH-i.attributes.BANDWIDTH:n-r},xhr:To()};["GOAL_BUFFER_LENGTH","MAX_GOAL_BUFFER_LENGTH","GOAL_BUFFER_LENGTH_RATE","BUFFER_LOW_WATER_LINE","MAX_BUFFER_LOW_WATER_LINE","BUFFER_LOW_WATER_LINE_RATE","BANDWIDTH_VARIANCE"].forEach((function(e){Object.defineProperty(sl,e,{get:function(){return zr.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),Cu[e]},set:function(t){zr.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?zr.log.warn("value of Hls."+e+" must be greater than or equal to 0"):Cu[e]=t}})}));var al="videojs-vhs",ol=function(e){return/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e)?"hls":/^application\/dash\+xml/i.test(e)?"dash":null},ul=function(e,t){for(var i=t.media(),n=-1,r=0;r<e.length;r++)if(e[r].id===i.uri){n=r;break}e.selectedIndex_=n,e.trigger({selectedIndex:n,type:"change"})};sl.canPlaySource=function(){return zr.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var ll,cl=function(){if(!window.localStorage)return null;var e=window.localStorage.getItem(al);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}};sl.supportsNativeHls=(ll=t.createElement("video"),!!zr.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(e){return/maybe|probably/i.test(ll.canPlayType(e))}))),sl.supportsNativeDash=!!zr.getTech("Html5").isSupported()&&/maybe|probably/i.test(t.createElement("video").canPlayType("application/dash+xml")),sl.supportsTypeNatively=function(e){return"hls"===e?sl.supportsNativeHls:"dash"===e&&sl.supportsNativeDash},sl.isSupported=function(){return zr.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var hl=function(e){function i(e,n,r){Ha(this,i);var s=za(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,n,r.hls));if(n.options_&&n.options_.playerId){var a=zr(n.options_.playerId);a.hasOwnProperty("hls")||Object.defineProperty(a,"hls",{get:function(){return zr.log.warn("player.hls is deprecated. Use player.tech().hls instead."),n.trigger({type:"usage",name:"hls-player-access"}),s},configurable:!0}),a.vhs=s,a.dash=s,s.player_=a}if(s.tech_=n,s.source_=e,s.stats={},s.setOptions_(),s.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(s.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return s.on(t,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(function(e){var i=t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement;i&&i.contains(s.tech_.el())&&s.masterPlaylistController_.smoothQualityChange_()})),s.on(s.tech_,"seeking",(function(){0===this.tech_.currentTime()&&this.tech_.player_.loop()&&this.setCurrentTime(0)})),s.on(s.tech_,"error",(function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()})),s.on(s.tech_,"play",s.play),s}return Wa(i,e),Va(i,[{key:"setOptions_",value:function(){var e=this;if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.handleManifestRedirects=this.options_.handleManifestRedirects||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){var t=cl();t&&t.bandwidth&&(this.options_.bandwidth=t.bandwidth,this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})),t&&t.throughput&&(this.options_.throughput=t.throughput,this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=Cu.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Cu.INITIAL_BANDWIDTH,["withCredentials","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys"].forEach((function(t){void 0!==e.source_[t]&&(e.options_[t]=e.source_[t])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions}},{key:"src",value:function(e,t){var i=this;e&&(this.setOptions_(),this.options_.url=this.source_.src,this.options_.tech=this.tech_,this.options_.externHls=sl,this.options_.sourceType=ol(t),this.options_.seekTo=function(e){i.tech_.setCurrentTime(e),i.setCurrentTime(e)},this.masterPlaylistController_=new Ju(this.options_),this.playbackWatcher_=new tl(zr.mergeOptions(this.options_,{seekable:function(){return i.seekable()},media:function(){return i.masterPlaylistController_.media()}})),this.masterPlaylistController_.on("error",(function(){zr.players[i.tech_.options_.playerId].error(i.masterPlaylistController_.error)})),this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):sl.STANDARD_PLAYLIST_SELECTOR.bind(this),this.masterPlaylistController_.selectInitialPlaylist=sl.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(e){this.masterPlaylistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=e,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},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(){zr.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 i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return Bo(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return Bo(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(!window.localStorage)return!1;var t=cl();t=t?zr.mergeOptions(t,e):e;try{window.localStorage.setItem(al,JSON.stringify(t))}catch(e){return!1}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var e,t;t=(e=i).playlists,e.representations=function(){return t.master.playlists.filter((function(e){return!fo(e)})).map((function(t,i){return new Zu(e,t,t.uri)}))},function(e){var t=e.masterPlaylistController_.mainSegmentLoader_,i=e.masterPlaylistController_.audioSegmentLoader_,n=zr.players[e.tech_.options_.playerId];if(n.eme){var r=function(e,t,i){if(!e)return e;var n=void 0,r=void 0;if(i.mimeType_)n=t.mimeType_,r=i.mimeType_;else{var s=iu(t.mimeType_),a=s.parameters.codecs.split(","),o=void 0,u=void 0;a.forEach((function(e){e=e.trim(),nu(e)?o=e:ru(e)&&(u=e)})),n=s.type+'; codecs="'+u+'"',r=s.type.replace("video","audio")+'; codecs="'+o+'"'}var l={},c=t.playlist_;for(var h in e)l[h]={audioContentType:r,videoContentType:n},c.contentProtection&&c.contentProtection[h]&&c.contentProtection[h].pssh&&(l[h].pssh=c.contentProtection[h].pssh),"string"==typeof e[h]&&(l[h].url=e[h]);return zr.mergeOptions(e,l)}(e.source_.keySystems,t,i);r&&(n.currentSource().keySystems=r,11!==zr.browser.IE_VERSION&&n.eme.initializeMediaKeys&&n.eme.initializeMediaKeys())}}(i)})),this.on(this.masterPlaylistController_,"progress",(function(){this.tech_.trigger("progress")})),this.tech_.ready((function(){return i.setupQualityLevels_()})),this.tech_.el()&&this.tech_.src(zr.URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"setupQualityLevels_",value:function(){var e=this,t=zr.players[this.tech_.options_.playerId];t&&t.qualityLevels&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var t,i;t=e.qualityLevels_,(i=e).representations().forEach((function(e){t.addQualityLevel(e)})),ul(t,i.playlists)})),this.playlists.on("mediachange",(function(){ul(e.qualityLevels_,e.playlists)})))}},{key:"play",value:function(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function(e){this.masterPlaylistController_.setCurrentTime(e)}},{key:"duration",value:function(){return this.masterPlaylistController_.duration()}},{key:"seekable",value:function(){return this.masterPlaylistController_.seekable()}},{key:"dispose",value: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_.hls&&delete this.tech_.hls,qa(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"dispose",this).call(this)}},{key:"convertToProgramTime",value:function(e,t){return function(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===n)return r({message:"getProgramTime: playlist and time must be provided"});var s=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i=0,n=void 0,r=0;r<t.segments.length&&!(e<=(i=(n=t.segments[r]).videoTimingInfo?n.videoTimingInfo.transmuxedPresentationEnd:i+n.duration));r++);var s=t.segments[t.segments.length-1];if(s.videoTimingInfo&&s.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>i){if(e>i+.25*s.duration)return null;n=s}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:i-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}}(n,t);if(!s)return r({message:"valid programTime was not found"});if("estimate"===s.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:s.estimatedStart});var a={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,s.segment);return o&&(a.programDateTime=o.toISOString()),r(null,a)}({playlist:this.masterPlaylistController_.media(),time:e,callback:t})}},{key:"seekToProgramTime",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return xo({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}]),i}(zr.getComponent("Component")),dl={name:"videojs-http-streaming",VERSION:"1.11.2",canHandleSource:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=zr.mergeOptions(zr.options,t);return dl.canPlayType(e.type,i)},handleSource:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=zr.mergeOptions(zr.options,i);return t.hls=new hl(e,t,n),t.hls.xhr=To(),t.hls.src(e.src,e.type),t.hls},canPlayType:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=zr.mergeOptions(zr.options,t),n=i.hls.overrideNative,r=ol(e),s=r&&(!sl.supportsTypeNatively(r)||n);return s?"maybe":""}};return void 0!==zr.MediaSource&&void 0!==zr.URL||(zr.MediaSource=du,zr.URL=pu),du.supportsNativeMediaSources()&&zr.getTech("Html5").registerSourceHandler(dl,0),zr.HlsHandler=hl,zr.HlsSourceHandler=dl,zr.Hls=sl,zr.use||zr.registerComponent("Hls",sl),zr.options.hls=zr.options.hls||{},zr.registerPlugin?zr.registerPlugin("reloadSourceOnError",rl):zr.plugin("reloadSourceOnError",rl),zr})),function(){var e,t;(t=(e=window)&&e.videojs)&&(t.CDN_VERSION="7.7.5")}();