mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-11-25 17:55:16 +01:00
aa6520daac
* Added frontend development files/environment * More items-categories related removals * Improvements in pages templates (inc. static pages) * Improvements in video player * Added empty home page message + cta * Updates in media, playlist and management pages * Improvements in material icons font loading * Replaced media & playlists links in frontend dev-env * frontend package version update * chnaged frontend dev url port * static files update * Changed default position of theme switcher * enabled frontend docker container
2 lines
456 KiB
JavaScript
2 lines
456 KiB
JavaScript
/*! For license information please see video.min.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){function r(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];s("log",a,t)}var s,a="info";return s=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,0<l?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,r),r.createLogger=function(e){return t(i+": "+e)},r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:a},r.level=function(e){if("string"==typeof e){if(!r.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');a=e}return a},(r.history=function(){return n?[].concat(n):[]}).filter=function(e){return(n||[]).filter((function(t){return new RegExp(".*"+e+".*").test(t[0])}))},r.history.clear=function(){n&&(n.length=0)},r.history.disable=function(){null!==n&&(n.length=0,n=null)},r.history.enable=function(){null===n&&(n=[])},r.error=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return s("error",a,t)},r.warn=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return s("warn",a,t)},r.debug=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return s("debug",a,t)},r}("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(1<t?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)return"";var n=e.getComputedStyle(t);return n?n.getPropertyValue(i)||n[i]:""}function m(e){return"string"==typeof e&&Boolean(e.trim())}function g(e){if(0<=e.indexOf(" "))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):function(e){return new RegExp("(^|\\s)"+e+"($|\\s)")}(t).test(e.className)}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 L(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 P(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&&0<e.attributes.length)for(var i=e.attributes,n=i.length-1;0<=n;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:L,setAttributes:P,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&&0<r.length)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)}function J(e){var i=t.createElement("style");return i.className=e,i}function Z(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t}v()&&("complete"===t.readyState?Q():e.addEventListener("load",Q));var ee,te=3;function ie(){return te++}e.WeakMap||(ee=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 ee;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(t){}}return ne})()&&-1<ue.indexOf(i)&&(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);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){function n(){ce(e,t,n),i.apply(this,arguments)}n.guid=i.guid=i.guid||ie(),le(e,t,n)}function fe(e,t,i){t.guid||(t.guid=ie());var n=t.bind(e);return n.guid=i?i+"_"+t.guid:t.guid,n}function me(t,i){var n=e.performance.now();return function(){var r=e.performance.now();i<=r-n&&(t.apply(void 0,arguments),n=r)}}function ge(){}var ve,ye=Object.freeze({fixEvent:oe,on:le,off:ce,trigger:he,one:de,any:pe});function _e(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length}function be(e){if(!e.nodeName&&!Ee(e))throw new Error("Invalid target; must be a DOM node or evented object.")}function Te(e){if(!_e(e))throw new Error("Invalid event type; must be a non-empty string or array.")}function Se(e){if("function"!=typeof e)throw new Error("Invalid listener; must be a function.")}function ke(e,t){var i,n,r,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return r=s?(i=e.eventBusEl_,3<=t.length&&t.shift(),n=t[0],t[1]):(i=t[0],n=t[1],t[2]),be(i),Te(n),Se(r),{isTargetingSelf:s,target:i,type:n,listener:r=fe(e,r)}}function Ce(e,t,i,n){be(e),e.nodeName?ye[t](e,i,n):e[t](i,n)}ge.prototype.allowedEvents_={},ge.prototype.addEventListener=ge.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},le(this,e,t),this.addEventListener=i},ge.prototype.removeEventListener=ge.prototype.off=function(e,t){ce(this,e,t)},ge.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},de(this,e,t),this.addEventListener=i},ge.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},pe(this,e,t),this.addEventListener=i},ge.prototype.dispatchEvent=ge.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)},ge.prototype.queueTrigger=function(t){var i=this;ve=ve||new Map;var n=t.type||t,r=ve.get(this);r||(r=new Map,ve.set(this,r));var s=r.get(n);r.delete(n),e.clearTimeout(s);var a=e.setTimeout((function(){0===r.size&&(r=null,ve.delete(i)),i.trigger(t)}),0);r.set(n,a)};var Ee=function(e){return e instanceof ge||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"==typeof e[t]}))},we={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=ke(this,i),s=r.isTargetingSelf,a=r.target,o=r.type,u=r.listener;if(Ce(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,Ce(this,"on","dispose",l),Ce(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=ke(this,i),s=r.isTargetingSelf,a=r.target,o=r.type,u=r.listener;if(s)Ce(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,Ce(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=ke(this,i),s=r.isTargetingSelf,a=r.target,o=r.type,u=r.listener;if(s)Ce(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,Ce(a,"any",o,l)}},off:function(e,t,i){if(!e||_e(e))ce(this.eventBusEl_,e,t);else{var n=e,r=t;be(n),Te(r),Se(i),i=fe(this,i),this.off("dispose",i),n.nodeName?(ce(n,r,i),ce(n,"dispose",i)):Ee(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,we),t.eventedCallbacks&&t.eventedCallbacks.forEach((function(e){e()})),t.on("dispose",(function(){t.off(),e.setTimeout((function(){t.eventBusEl_=null}),0)})),t}var Pe={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&&Ee(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function Ae(e,t){return h(e,Pe),e.state=h({},e.state,t),"function"==typeof e.handleStateChanged&&Ee(e)&&e.on("statechanged",e.handleStateChanged),e}function Ie(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toLowerCase()}))}function xe(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))}function Oe(){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]=Oe(e[i],t)):e[i]=t}))})),e}var De=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_=Oe({},this.options_),i=this.options_=Oe(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}),Ae(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)!==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;0<=e;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_=Oe(this.options_,e)),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=xe(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&&xe(r.name()))&&(this.childNameIndex_[s]=r,this.childNameIndex_[Ie(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;0<=i;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_[xe(e.name())]=null,this.childNameIndex_[Ie(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 r="string"==typeof t?i[n=t]||e.options_[n]||{}:(n=t.name,t),{name:n,opts:r}})).filter((function(e){var i=t.getComponent(e.opts.componentClass||xe(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&&0<e.length&&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){L(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"+xe(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"+xe(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;function r(){t=!1}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(1<e.touches.length)t=!1;else if(n){var i=e.touches[0].pageX-n.pageX,r=e.touches[0].pageY-n.pageY;10<Math.sqrt(i*i+r*r)&&(t=!1)}})),this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",(function(r){!(n=null)===t&&e.performance.now()-i<200&&(r.preventDefault(),this.trigger("tap"))}))},i.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=fe(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=fe(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=fe(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=fe(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=xe(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&&0<u.length&&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_[Ie(e)]=i},t.getComponent=function(e){if(e&&t.components_)return t.components_[e]},t}();De.prototype.supportsRaf_="function"==typeof e.requestAnimationFrame&&"function"==typeof e.cancelAnimationFrame,De.registerComponent("Component",De);var Re,Ue,Me,Ne,Be=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},je=function(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t},Fe=e.navigator&&e.navigator.userAgent||"",He=/AppleWebKit\/([\d.]+)/i.exec(Fe),Ve=He?parseFloat(He.pop()):null,qe=/iPod/i.test(Fe),We=(Re=Fe.match(/OS (\d+)_/i))&&Re[1]?Re[1]:null,ze=/Android/i.test(Fe),Ge=function(){var e=Fe.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}(),Ke=ze&&Ge<5&&Ve<537,Xe=/Firefox/i.test(Fe),Ye=/Edge/i.test(Fe),$e=!Ye&&(/Chrome/i.test(Fe)||/CriOS/i.test(Fe)),Qe=(Ue=Fe.match(/(Chrome|CriOS)\/(\d+)/))&&Ue[2]?parseFloat(Ue[2]):null,Je=(!(Ne=(Me=/MSIE\s(\d+)\.\d/.exec(Fe))&&parseFloat(Me[1]))&&/Trident\/7.0/i.test(Fe)&&/rv:11.0/.test(Fe)&&(Ne=11),Ne),Ze=/Safari/i.test(Fe)&&!$e&&!ze&&!Ye,et=/Windows/i.test(Fe),tt=v()&&("ontouchstart"in e||e.navigator.maxTouchPoints||e.DocumentTouch&&e.document instanceof e.DocumentTouch),it=/iPad/i.test(Fe)||Ze&&tt&&!/iPhone/i.test(Fe),nt=/iPhone/i.test(Fe)&&!it,rt=nt||it||qe,st=(Ze||rt)&&!$e,at=Object.freeze({IS_IPOD:qe,IOS_VERSION:We,IS_ANDROID:ze,ANDROID_VERSION:Ge,IS_NATIVE_ANDROID:Ke,IS_FIREFOX:Xe,IS_EDGE:Ye,IS_CHROME:$e,CHROME_VERSION:Qe,IE_VERSION:Je,IS_SAFARI:Ze,IS_WINDOWS:et,TOUCH_ENABLED:tt,IS_IPAD:it,IS_IPHONE:nt,IS_IOS:rt,IS_ANY_SAFARI:st});function ot(e,t,i,n){return function(e,t,i){if("number"!=typeof t||t<0||i<t)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 ut(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:ot.bind(null,"start",0,e),end:ot.bind(null,"end",1,e)}}function lt(e,t){return Array.isArray(e)?ut(e):void 0===e||void 0===t?ut():ut([[e,t]])}function ct(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=lt(0,0));for(var s=0;s<e.length;s++)i=e.start(s),t<(n=e.end(s))&&(n=t),r+=n-i;return r/t}for(var ht,dt={prefixed:!0},pt=[["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"]],ft=pt[0],mt=0;mt<pt.length;mt++)if(pt[mt][1]in t){ht=pt[mt];break}if(ht){for(var gt=0;gt<ht.length;gt++)dt[ft[gt]]=ht[gt];dt.prefixed=ht[0]!==ft[0]}function vt(e){if(e instanceof vt)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=vt.defaultMessages[this.code]||"")}vt.prototype.code=0,vt.prototype.message="",vt.prototype.status=null,vt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],vt.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var yt=0;yt<vt.errorTypes.length;yt++)vt[vt.errorTypes[yt]]=yt,vt.prototype[vt.errorTypes[yt]]=yt;function _t(e){return null!=e&&"function"==typeof e.then}function bt(e){_t(e)&&e.then(null,(function(e){}))}function Tt(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}}))})}var St=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]})),kt=(St.code,St.codes,St.aliases,St.names,St.title,"vjs-modal-dialog"),Ct=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:kt+"-content"},{role:"document"}),n.descEl_=T("p",{className:kt+"-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}je(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 kt+" 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(),St.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(St.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}(De);Ct.prototype.options_={pauseOnOpen:!0,temporary:!0},De.registerComponent("ModalDialog",Ct);var Et=function(e){function t(t){var i;void 0===t&&(t=[]),(i=e.call(this)||this).tracks_=[],Object.defineProperty(Be(i),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<t.length;n++)i.addTrack(t[n]);return i}je(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}(ge);for(var wt in Et.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"},Et.prototype.allowedEvents_)Et.prototype["on"+wt]=null;function Lt(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)}function Pt(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)}function At(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}function It(e){if(!e.match(/^https?:\/\//)){var i=t.createElement("div");i.innerHTML='<a href="'+e+'">x</a>',e=i.firstChild.href}return e}function xt(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""}function Ot(t,i){void 0===i&&(i=e.location);var n=At(t);return(":"===n.protocol?i.protocol:n.protocol)+n.host!==i.protocol+i.host}var Dt=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;0<=n;n--)if(t[n].enabled){Lt(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}je(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&Lt(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,Lt(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}(Et),Rt=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;0<=n;n--)if(t[n].selected){Pt(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(Be(i),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),i}je(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.selected&&Pt(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,Pt(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}(Et),Ut=function(e){function t(){return e.apply(this,arguments)||this}je(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}(Et),Mt=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}(),Nt=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;function r(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})}if(this.cues_=e,this.length_=e.length,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}(),Bt={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},jt={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Ft={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Ht={disabled:"disabled",hidden:"hidden",showing:"showing"},Vt=function(e){function t(t){var i;function n(e){Object.defineProperty(Be(i),e,{get:function(){return r[e]},set:function(){}})}void 0===t&&(t={}),i=e.call(this)||this;var r={id:t.id||"vjs_track_"+ie(),kind:t.kind||"",label:t.label||"",language:t.language||""};for(var s in r)n(s);return i}return je(t,e),t}(ge),qt=Object.freeze({parseUrl:At,getAbsoluteURL:It,getFileExtension:xt,isCrossOrigin:Ot}),Wt=Object.prototype.toString,zt=Xt,Gt=Xt;function Kt(e,t,i){var n=e;return function(e){var t=Wt.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=o({},t,{uri:e}),n.callback=i,n}function Xt(e,t,i){return Yt(t=Kt(e,t,i))}function Yt(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(e){return clearTimeout(o),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,m)}function r(){if(!a){var t;clearTimeout(o),t=e.useXDR&&void 0===u.status?200:1223===u.status?204:u.status;var n=m,r=null;return 0!==t?(n={body:function(){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),f)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:t,method:c,headers:{},url:l,rawRequest:u},u.getAllResponseHeaders&&(n.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}(u.getAllResponseHeaders()))):r=new Error("Internal XMLHttpRequest Error"),i(r,n,n.body)}}var s,a,o,u=e.xhr||null,l=(u=u||(e.cors||e.useXDR?new Xt.XDomainRequest:new Xt.XMLHttpRequest)).url=e.uri||e.url,c=u.method=e.method||"GET",h=e.body||e.data,d=u.headers=e.headers||{},p=!!e.sync,f=!1,m={body:void 0,headers:{},statusCode:0,method:c,url:l,rawRequest:u};if("json"in e&&!1!==e.json&&(f=!0,d.accept||d.Accept||(d.Accept="application/json"),"GET"!==c&&"HEAD"!==c&&(d["content-type"]||d["Content-Type"]||(d["Content-Type"]="application/json"),h=JSON.stringify(!0===e.json?h:e.json))),u.onreadystatechange=function(){4===u.readyState&&setTimeout(r,0)},u.onload=r,u.onerror=n,u.onprogress=function(){},u.onabort=function(){a=!0},u.ontimeout=n,u.open(c,l,!p,e.username,e.password),p||(u.withCredentials=!!e.withCredentials),!p&&0<e.timeout&&(o=setTimeout((function(){if(!a){a=!0,u.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}}),e.timeout)),u.setRequestHeader)for(s in d)d.hasOwnProperty(s)&&u.setRequestHeader(s,d[s]);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(h||null),u}function $t(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),0<s.length&&(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()}function Qt(t,i){var n={uri:t},s=Ot(t);s&&(n.cors=s),zt(n,fe(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 $t(s,i);r.error("vttjs failed to load, stopping trying to process "+i.src)})):$t(s,i)})))}Xt.XMLHttpRequest=e.XMLHttpRequest||function(){},Xt.XDomainRequest="withCredentials"in new Xt.XMLHttpRequest?Xt.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){Xt["delete"===e?"del":e]=function(t,i,n){return(i=Kt(t,i,n)).method=e.toUpperCase(),Yt(i)}})),zt.default=Gt;var Jt=function(t){function i(e){var i;if(void 0===e&&(e={}),!e.tech)throw new Error("A tech was not provided.");var n=Oe(e,{kind:Ft[e.kind]||"subtitles",language:e.language||e.srclang||""}),r=Ht[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 Nt(i.cues_),o=new Nt(i.activeCues_),u=!1,l=fe(Be(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(Be(i),{default:{get:function(){return s},set:function(){}},mode:{get:function(){return r},set:function(e){var t=this;Ht[e]&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||Qt(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)&&Qt(i.src,Be(i))):i.loaded_=!0,i}je(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}(Vt);Jt.prototype.allowedEvents_={cuechange:"cuechange"};var Zt=function(e){function t(t){var i;void 0===t&&(t={});var n=Oe(t,{kind:jt[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(Be(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 je(t,e),t}(Vt),ei=function(e){function t(t){var i;void 0===t&&(t={});var n=Oe(t,{kind:Bt[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(Be(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 je(t,e),t}(Vt),ti=function(e){function t(t){var i,n;void 0===t&&(t={}),i=e.call(this)||this;var r=new Jt(t);return i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i.default=r.default,Object.defineProperties(Be(i),{readyState:{get:function(){return n}},track:{get:function(){return r}}}),n=0,r.addEventListener("loadeddata",(function(){n=2,i.trigger({type:"load",target:Be(i)})})),i}return je(t,e),t}(ge);ti.prototype.allowedEvents_={load:"load"},ti.NONE=0,ti.LOADING=1,ti.LOADED=2,ti.ERROR=3;var ii={audio:{ListClass:Dt,TrackClass:Zt,capitalName:"Audio"},video:{ListClass:Rt,TrackClass:ei,capitalName:"Video"},text:{ListClass:Ut,TrackClass:Jt,capitalName:"Text"}};Object.keys(ii).forEach((function(e){ii[e].getterName=e+"Tracks",ii[e].privateName=e+"Tracks_"}));var ni={remoteText:{ListClass:Ut,TrackClass:Jt,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Mt,TrackClass:ti,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},ri=o({},ii,ni);ni.names=Object.keys(ni),ii.names=Object.keys(ii),ri.names=[].concat(ni.names).concat(ii.names);var si=Object.create||function(e){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return ai.prototype=e,new ai};function ai(){}function oi(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function ui(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]):59<i[1]?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function li(){this.values=si(null)}function ci(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 hi(e,t,i){var n=e;function r(){var t=ui(e);if(null===t)throw new oi(oi.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 oi(oi.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 li;ci(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;0<=r;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)}((oi.prototype=si(Error.prototype)).constructor=oi).Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},li.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]*)?%$/)&&0<=(t=parseFloat(t))&&t<=100)&&(this.set(e,t),!0)}};var di=t.createElement("textarea"),pi={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},fi={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)"},mi={v:"title",lang:"lang"},gi={rt:"ruby"};function vi(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(t,i){var n=pi[t];if(!n)return null;var r=e.document.createElement(n),s=mi[t];return s&&i&&(r[s]=i.trim()),r}for(var r,s,a,o,u=e.document.createElement("div"),l=u,c=[];null!==(r=i());)if("<"!==r[0])l.appendChild(e.document.createTextNode((s=r,di.innerHTML=s,s=di.textContent,di.textContent="",s)));else{if("/"===r[1]){c.length&&c[c.length-1]===r.substr(2).replace(">","")&&(c.pop(),l=l.parentNode);continue}var h,d=ui(r.substr(1,r.length-2));if(d){h=e.document.createProcessingInstruction("timestamp",d),l.appendChild(h);continue}var p=r.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!p)continue;if(!(h=n(p[1],p[3])))continue;if(a=l,gi[(o=h).localName]&&gi[o.localName]!==a.localName)continue;if(p[2]){var f=p[2].split(".");f.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(fi.hasOwnProperty(i)){var n=t?"background-color":"color",r=fi[i];h.style[n]=r}})),h.className=f.join(" ")}c.push(p[1]),l.appendChild(h),l=h}return u}var yi=[[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 _i(e){for(var t=0;t<yi.length;t++){var i=yi[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function bi(){}function Ti(e,t,i){bi.call(this),this.cue=t,this.cueDiv=vi(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:function(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function n(e,t){for(var i=t.childNodes.length-1;0<=i;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?s[e.length=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(_i(i.charCodeAt(s)))return"rtl";return"ltr"}(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 Si(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 ki(e,t,i,n){var r=new Si(t),s=t.cue,a=function(e){if("number"==typeof e.line&&(e.snapToLines||0<=e.line&&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 Si(t)}var f=function(e,t){for(var r,s=new Si(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);u<a&&(r=new Si(e),a=u),e=new Si(s)}return r||s}(r,o);t.move(f.toCSSCompatValues(i))}function Ci(){}bi.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},bi.prototype.formatStyle=function(e,t){return 0===e?0:e+t},(Ti.prototype=si(bi.prototype)).constructor=Ti,Si.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}},Si.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},Si.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},Si.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},Si.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}},Si.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)},Si.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}},Si.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}},Ci.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Ci.convertCueToDOMTree=function(e,t){return e&&t?vi(e,t):null},Ci.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=Si.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 Ti(e,o,a),n.appendChild(i.div),ki(0,i,s,r),o.displayState=i.div,r.push(Si.getSimpleBoxPosition(i))}()}else for(var o=0;o<t.length;o++)n.appendChild(t[o].displayState)},(Ci.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=[]}).prototype={reportOrThrowError:function(e){if(!(e instanceof oi))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var n=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),n}function n(e){e.match(/X-TIMESTAMP-MAP/)?ci(e,(function(e,i){switch(e){case"X-TIMESTAMP-MAP":!function(e){var i=new li;ci(e,(function(e,t){switch(e){case"MPEGT":i.integer(e+"S",t);break;case"LOCA":i.set(e+"L",ui(t))}}),/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})}(i)}}),/=/):ci(e,(function(e,i){switch(e){case"Region":!function(e){var i=new li;if(ci(e,(function(e,t){switch(e){case"id":i.set(e,t);break;case"width":i.percent(e,t);break;case"lines":i.integer(e,t);break;case"regionanchor":case"viewportanchor":var n=t.split(",");if(2!==n.length)break;var r=new li;if(r.percent("x",n[0]),r.percent("y",n[1]),!r.has("x")||!r.has("y"))break;i.set(e+"X",r.get("x")),i.set(e+"Y",r.get("y"));break;case"scroll":i.alt(e,t,["up"])}}),/=/,/\s/),i.has("id")){var n=new(t.vttjs.VTTRegion||t.window.VTTRegion);n.width=i.get("width",100),n.lines=i.get("lines",3),n.regionAnchorX=i.get("regionanchorX",0),n.regionAnchorY=i.get("regionanchorY",100),n.viewportAnchorX=i.get("viewportanchorX",0),n.viewportAnchorY=i.get("viewportanchorY",100),n.scroll=i.get("scroll",""),t.onregion&&t.onregion(n),t.regionList.push({id:i.get("id"),region:n})}}(i)}}),/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var s=(r=i()).match(/^WEBVTT([ \t].*)?$/);if(!s||!s[0])throw new oi(oi.Errors.BadSignature);t.state="HEADER"}for(var a=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:r=i(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(e){t.cue.align="middle"}if(t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":try{hi(r,t.cue,t.regionList)}catch(e){t.reportOrThrowError(e),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(a=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(t.state="ID");continue}}}catch(e){t.reportOrThrowError(e),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.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 oi(oi.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var Ei=Ci,wi={"":1,lr:1,rl:1},Li={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Pi(e){return"string"==typeof e&&!!Li[e.toLowerCase()]&&e.toLowerCase()}function Ai(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&&!!wi[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=Pi(e);t&&(d=t,this.hasBeenReset=!0)}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||100<e)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=Pi(e);t&&(f=t,this.hasBeenReset=!0)}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||100<e)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=Pi(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Ai.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Ii=Ai,xi={"":!0,up:!0};function Oi(e){return"number"==typeof e&&0<=e&&e<=100}function Di(){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(!Oi(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(!Oi(e))throw new Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!Oi(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(e){if(!Oi(e))throw new Error("ViewportAnchorY must be between 0 and 100.");s=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!Oi(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&&!!xi[e.toLowerCase()]&&e.toLowerCase()}(e);!1===t||(a=t)}}})}var Ri=a((function(t){var i=t.exports={WebVTT:Ei,VTTCue:Ii,VTTRegion:Di};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()}));Ri.WebVTT,Ri.VTTCue,Ri.VTTRegion;var Ui=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})),ri.names.forEach((function(t){var i=ri[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 ri.text.ListClass,n.initTrackListeners(),e.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}je(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(fe(this,(function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()})),500)},s.onDurationChange=function(e){this.duration_=this.duration()},s.buffered=function(){return lt(0,0)},s.bufferedPercent=function(){return ct(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(ii.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 vt(e),this.trigger("error")),this.error_},s.played=function(){return this.hasStarted_?lt(0,0):lt()},s.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},s.initTrackListeners=function(){var e=this;ii.names.forEach((function(t){function i(){e.trigger(t+"trackchange")}var n=ii[t],r=e[n.getterName]();r.addEventListener("removetrack",i),r.addEventListener("addtrack",i),e.on("dispose",(function(){r.removeEventListener("removetrack",i),r.removeEventListener("addtrack",i)}))}))},s.addWebVttScript_=function(){var i=this;if(!e.WebVTT)if(t.body.contains(this.el())){if(!this.options_["vtt.js"]&&p(Ri)&&0<Object.keys(Ri).length)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(){function e(e){return n.addTrack(e.track)}function t(e){return n.removeTrack(e.track)}var i=this,n=this.textTracks(),r=this.remoteTextTracks();function s(){return i.trigger("texttrackchange")}function a(){s();for(var e=0;e<n.length;e++){var t=n[e];t.removeEventListener("cuechange",s),"showing"===t.mode&&t.addEventListener("cuechange",s)}}r.on("addtrack",e),r.on("removetrack",t),this.addWebVttScript_(),a(),n.addEventListener("change",a),n.addEventListener("addtrack",a),n.addEventListener("removetrack",a),this.on("dispose",(function(){r.off("addtrack",e),r.off("removetrack",t),n.removeEventListener("change",a),n.removeEventListener("addtrack",a),n.removeEventListener("removetrack",a);for(var i=0;i<n.length;i++)n[i].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 ri.text.TrackClass(r);return s.addTrack(a),a}(this,e,t,i)},s.createRemoteTextTrack=function(e){var t=Oe(e,{tech:this});return new ni.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=xe(e),n.techs_[e]=t,n.techs_[Ie(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=xe(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}(De);ri.names.forEach((function(e){var t=ri[e];Ui.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Ui.prototype.featuresVolumeControl=!0,Ui.prototype.featuresMuteControl=!0,Ui.prototype.featuresFullscreenResize=!1,Ui.prototype.featuresPlaybackRate=!1,Ui.prototype.featuresProgressEvents=!1,Ui.prototype.featuresSourceset=!1,Ui.prototype.featuresTimeupdateEvents=!1,Ui.prototype.featuresNativeTextTracks=!1,Ui.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)}},De.registerComponent("Tech",Ui),Ui.registerTech("Tech",Ui),Ui.defaultTechOrder_=[];var Mi={},Ni={},Bi={};function ji(e,t,i,n){void 0===n&&(n=null);var r="call"+xe(i),s=e.reduce(qi(r),n),a=s===Bi,o=a?null:t[i](s);return function(e,t,i,n){for(var r=e.length-1;0<=r;r--){var s=e[r];s[t]&&s[t](n,i)}}(e,i,o,a),o}var Fi={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1},Hi={setCurrentTime:1,setMuted:1,setVolume:1},Vi={play:1,pause:1};function qi(e){return function(t,i){return t===Bi?Bi:i[e]?i[e](t):t}}function Wi(e){void 0===e&&(e="");var t=xt(e);return zi[t.toLowerCase()]||""}var zi={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",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"};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=Oe({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=xe(o[a]),l=Ui.getTech(u);if(u||(l=De.getComponent(u)),l&&l.isSupported()){t.loadTech_(u);break}}return r}return je(t,e),t}(De);De.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}je(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){St.isEventKey(t,"Space")||St.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(De);De.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",fe(Be(n),n.update)),n}je(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()?bt(this.player_.play()):this.player_.pause())},t}(Xi);De.registerComponent("PosterImage",Yi);var $i="#222",Qi={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 Ji(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 Zi(e,t,i){try{e.style[t]=i}catch(e){return}}var en=function(t){function i(i,n,r){var s;s=t.call(this,i,n,r)||this;var a=fe(Be(s),s.updateDisplay);return i.on("loadstart",fe(Be(s),s.toggleDisplay)),i.on("texttrackchange",a),i.on("loadedmetadata",fe(Be(s),s.preselectTrack)),i.ready(fe(Be(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}je(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?i=o.kind===s.kind?o:i||o:s&&!s.enabled?t=e=i=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&&Zi(a.firstChild,"color",Ji(i.color||"#fff",i.textOpacity)),i.backgroundColor&&(a.firstChild.style.backgroundColor=i.backgroundColor),i.backgroundOpacity&&Zi(a.firstChild,"backgroundColor",Ji(i.backgroundColor||"#000",i.backgroundOpacity)),i.windowColor&&(i.windowOpacity?Zi(a,"backgroundColor",Ji(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 "+$i:"raised"===i.edgeStyle?a.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px "+$i:"depressed"===i.edgeStyle?a.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px "+$i:"uniform"===i.edgeStyle&&(a.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px "+$i)),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=Qi[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}(De);De.registerComponent("TextTrackDisplay",en);var tn=function(e){function t(){return e.apply(this,arguments)||this}return je(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}(De);De.registerComponent("LoadingSpinner",tn);var nn=function(e){function t(){return e.apply(this,arguments)||this}je(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=De.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."),De.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){St.isEventKey(t,"Space")||St.isEventKey(t,"Enter")?t.stopPropagation():e.prototype.handleKeyDown.call(this,t)},t}(Xi);De.registerComponent("Button",nn);var rn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).mouseused_=!1,n.on("mousedown",n.handleMouseDown),n}je(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&&0<this.player_.eme.sessions.length;return bt(t),void(!this.player_.tech(!0)||(Je||Ye)&&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()};_t(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}(nn);rn.prototype.controlText_="Play Video",De.registerComponent("BigPlayButton",rn);var sn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}je(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){St.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(nn);De.registerComponent("CloseButton",sn);var an=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}je(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}(nn);function on(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=0<r||0<a?r+":":"")+(n=((r||10<=s)&&n<10?"0"+n:n)+":")+(i<10?"0"+i:i)}an.prototype.controlText_="Play",De.registerComponent("PlayToggle",an);var un=on;function ln(e,t){return void 0===t&&(t=e),un(e,t)}var cn=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}je(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=ln(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}(De);cn.prototype.labelText_="Time",cn.prototype.controlText_="Time",De.registerComponent("TimeDisplay",cn);var hn=function(e){function t(){return e.apply(this,arguments)||this}je(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}(cn);hn.prototype.labelText_="Current Time",hn.prototype.controlText_="Current Time",De.registerComponent("CurrentTimeDisplay",hn);var dn=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}je(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}(cn);dn.prototype.labelText_="Duration",dn.prototype.controlText_="Duration",De.registerComponent("DurationDisplay",dn);var pn=function(e){function t(){return e.apply(this,arguments)||this}return je(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}(De);De.registerComponent("TimeDivider",pn);var fn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",n.updateContent),n}je(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}(cn);fn.prototype.labelText_="Remaining Time",fn.prototype.controlText_="Remaining Time",De.registerComponent("RemainingTimeDisplay",fn);var mn=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}je(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}(De);De.registerComponent("LiveDisplay",mn);var gn=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}je(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}(nn);function vn(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}gn.prototype.controlText_="Seek to live, currently playing live",De.registerComponent("SeekToLive",gn);var yn=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}je(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||$e||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(vn(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){St.isEventKey(t,"Left")||St.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):St.isEventKey(t,"Right")||St.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}(De);function _n(e,t){return vn(e/t*100,0,100).toFixed(2)+"%"}De.registerComponent("Slider",yn);var bn=function(e){function i(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",n.update),n}je(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=_n(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=_n(u,r),c.style.width=_n(l-u,r))}for(var h=s.length;h>i.length;h--)t.el_.removeChild(s[h-1]);s.length=i.length}))},i}(De);De.registerComponent("LoadProgressBar",bn);var Tn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=me(fe(Be(n),n.update),30),n}je(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?"":"-")+ln(u,o)}else s=ln(i,a);r.update(e,t,s),n&&n()}))},t}(De);De.registerComponent("TimeTooltip",Tn);var Sn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=me(fe(Be(n),n.update),30),n}je(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}(De);Sn.prototype.options_={children:[]},rt||ze||Sn.prototype.options_.children.push("timeTooltip"),De.registerComponent("PlayProgressBar",Sn);var kn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=me(fe(Be(n),n.update),30),n}je(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}(De);kn.prototype.options_={children:["timeTooltip"]},De.registerComponent("MouseTimeDisplay",kn);var Cn=function(e){function i(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}je(i,e);var n=i.prototype;return n.setEventHandlers_=function(){this.update_=fe(this,this.update),this.update=me(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.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,30))},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}",[ln(e,r),ln(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(s<=(t=r+i*n.liveWindow())&&(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?bt(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(St.isEventKey(t,"Space")||St.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(St.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(0);else if(St.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.duration());else if(/^[0-9]$/.test(St(t))){t.preventDefault(),t.stopPropagation();var i=10*(St.codes[St(t)]-St.codes[0])/100;this.player_.currentTime(this.player_.duration()*i)}else St.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()-60)):St.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i}(yn);Cn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},rt||ze||Cn.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),De.registerComponent("SeekBar",Cn);var En=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=me(fe(Be(n),n.handleMouseMove),30),n.throttledHandleMouseSeek=me(fe(Be(n),n.handleMouseSeek),30),n.enable(),n}je(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=vn(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}(De);En.prototype.options_={children:["seekBar"]},De.registerComponent("ProgressControl",En);var wn=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}je(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}(nn);wn.prototype.controlText_="Picture-in-Picture",De.registerComponent("PictureInPictureToggle",wn);var Ln=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}je(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}(nn);Ln.prototype.controlText_="Fullscreen",De.registerComponent("FullscreenToggle",Ln);var Pn=function(e){function t(){return e.apply(this,arguments)||this}return je(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}(De);De.registerComponent("VolumeLevel",Pn);var An=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}je(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}(yn);An.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},An.prototype.playerEvent="volumechange",De.registerComponent("VolumeBar",An);var In=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")}))}(Be(n),t),n.throttledHandleMouseMove=me(fe(Be(n),n.handleMouseMove),30),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}je(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}(De);In.prototype.options_={children:["volumeBar"]},De.registerComponent("VolumeControl",In);var xn=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")}))}(Be(n),t),n.on(t,["loadstart","volumechange"],n.update),n}je(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;rt&&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}(nn);xn.prototype.controlText_="Mute",De.registerComponent("MuteToggle",xn);var On=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}je(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){St.isEventKey(e,"Esc")&&this.muteToggle.focus()},n.handleMouseOver=function(e){this.addClass("vjs-hover"),le(t,"keyup",fe(this,this.handleKeyPress))},n.handleMouseOut=function(e){this.removeClass("vjs-hover"),ce(t,"keyup",fe(this,this.handleKeyPress))},n.handleKeyPress=function(e){St.isEventKey(e,"Esc")&&this.handleMouseOut()},i}(De);On.prototype.options_={children:["muteToggle","volumeControl"]},De.registerComponent("VolumePanel",On);var Dn=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_=fe(Be(n),n.handleBlur),n.boundHandleTapClick_=fe(Be(n),n.handleTapClick),n}je(i,e);var n=i.prototype;return n.addEventListenerForItem=function(e){e instanceof De&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},n.removeEventListenerForItem=function(e){e instanceof De&&(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){St.isEventKey(e,"Left")||St.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(St.isEventKey(e,"Right")||St.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(),0<t.length&&(e<0?e=0:e>=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())},i}(De);De.registerComponent("Menu",Dn);var Rn=function(e){function i(i,n){var r;void 0===n&&(n={}),(r=e.call(this,i,n)||this).menuButton_=new nn(i,n),r.menuButton_.controlText(r.controlText_),r.menuButton_.el_.setAttribute("aria-haspopup","true");var s=nn.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",fe(Be(r),r.handleMenuKeyUp))})),r.on("mouseleave",r.handleMouseLeave),r.on("keydown",r.handleSubmenuKeyDown),r}je(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 Dn(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=T("li",{className:"vjs-menu-title",innerHTML:xe(this.options_.title),tabIndex:-1});this.hideThreshold_+=1;var i=new De(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+" "+nn.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",fe(this,this.handleMenuKeyUp))},n.focus=function(){this.menuButton_.focus()},n.blur=function(){this.menuButton_.blur()},n.handleKeyDown=function(e){St.isEventKey(e,"Esc")||St.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),St.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(St.isEventKey(e,"Up")||St.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))},n.handleMenuKeyUp=function(e){(St.isEventKey(e,"Esc")||St.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},n.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},n.handleSubmenuKeyDown=function(e){(St.isEventKey(e,"Esc")||St.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),St.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"),rt&&_())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}(De);De.registerComponent("MenuButton",Rn);var Un=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 Be(n);var s=fe(Be(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 je(t,e),t}(Rn);De.registerComponent("TrackButton",Un);var Mn=["Tab","Esc","Up","Down","Right","Left"],Nn=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}je(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){Mn.some((function(e){return St.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);De.registerComponent("MenuItem",Nn);var Bn=function(i){function n(n,r){var s,a,o=r.track,u=n.textTracks();function l(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];s.handleTracksChange.apply(Be(s),t)}function c(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];s.handleSelectedLanguageChange.apply(Be(s),t)}return r.label=o.label||o.language||"Unknown",r.selected="showing"===o.mode,(s=i.call(this,n,r)||this).track=o,s.kinds=(r.kinds||[r.kind||s.track.kind]).filter(Boolean),n.on(["loadstart","texttrackchange"],l),u.addEventListener("change",l),u.addEventListener("selectedlanguagechange",c),s.on("dispose",(function(){n.off(["loadstart","texttrackchange"],l),u.removeEventListener("change",l),u.removeEventListener("selectedlanguagechange",c)})),void 0===u.onchange&&s.on(["tap","click"],(function(){if("object"!=typeof e.Event)try{a=new e.Event("change")}catch(e){}a||(a=t.createEvent("Event")).initEvent("change",!0,!0),u.dispatchEvent(a)})),s.handleTracksChange(),s}je(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}(Nn);De.registerComponent("TextTrackMenuItem",Bn);var jn=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}je(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(-1<this.options_.kinds.indexOf(s.kind)&&"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(-1<["captions","descriptions","subtitles"].indexOf(s.kind)&&"showing"===s.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(Bn);De.registerComponent("OffTextTrackMenuItem",jn);var Fn=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return je(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=Bn),this.label_&&(i=this.label_+" off"),e.push(new jn(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(-1<this.kinds_.indexOf(s.kind)){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}(Un);De.registerComponent("TextTrackButton",Fn);var Hn=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",fe(Be(n),n.update)),n}je(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}(Nn);De.registerComponent("ChaptersTrackMenuItem",Hn);var Vn=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}je(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;0<=t;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(xe(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 Hn(this.player_,{track:this.track_,cue:r});e.push(s)}return e},t}(Fn);Vn.prototype.kind_="chapters",Vn.prototype.controlText_="Chapters",De.registerComponent("ChaptersButton",Vn);var qn=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var s=t.textTracks(),a=fe(Be(r),r.handleTracksChange);return s.addEventListener("change",a),r.on("dispose",(function(){s.removeEventListener("change",a)})),r}je(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}(Fn);qn.prototype.kind_="descriptions",qn.prototype.controlText_="Descriptions",De.registerComponent("DescriptionsButton",qn);var Wn=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}je(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}(Fn);Wn.prototype.kind_="subtitles",Wn.prototype.controlText_="Subtitles",De.registerComponent("SubtitlesButton",Wn);var zn=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 je(t,e),t.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},t}(Bn);De.registerComponent("CaptionSettingsMenuItem",zn);var Gn=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}je(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 zn(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t)},t}(Fn);Gn.prototype.kind_="captions",Gn.prototype.controlText_="Captions",De.registerComponent("CaptionsButton",Gn);var Kn=function(e){function t(){return e.apply(this,arguments)||this}return je(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}(Bn);De.registerComponent("SubsCapsMenuItem",Kn);var Xn=function(e){function t(t,i){var n;return void 0===i&&(i={}),(n=e.call(this,t,i)||this).label_="subtitles",-1<["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)&&(n.label_="captions"),n.menuButton_.controlText(xe(n.label_)),n}je(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 zn(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t,Kn)},t}(Fn);Xn.prototype.kinds_=["captions","subtitles"],Xn.prototype.controlText_="Subtitles",De.registerComponent("SubsCapsButton",Xn);var Yn=function(e){function t(t,i){var n,r=i.track,s=t.audioTracks();function a(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(Be(n),t)}return 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"),s.addEventListener("change",a),n.on("dispose",(function(){s.removeEventListener("change",a)})),n}je(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}(Nn);De.registerComponent("AudioTrackMenuItem",Yn);var $n=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.audioTracks(),e.call(this,t,i)||this}je(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 Yn(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e},t}(Un);$n.prototype.controlText_="Audio Track",De.registerComponent("AudioTrackButton",$n);var Qn=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}je(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}(Nn);Qn.prototype.contentElType="button",De.registerComponent("PlaybackRateMenuItem",Qn);var Jn=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}je(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 Dn(this.player()),t=this.playbackRates();if(t)for(var i=t.length-1;0<=i;i--)e.addChild(new Qn(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()&&0<this.playbackRates().length},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}(Rn);Jn.prototype.controlText_="Playback Rate",De.registerComponent("PlaybackRateMenuButton",Jn);var Zn=function(e){function t(){return e.apply(this,arguments)||this}je(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}(De);De.registerComponent("Spacer",Zn);var er=function(e){function t(){return e.apply(this,arguments)||this}je(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}(Zn);De.registerComponent("CustomControlSpacer",er);var tr=function(e){function t(){return e.apply(this,arguments)||this}return je(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(De);tr.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in t&&tr.prototype.options_.children.splice(tr.prototype.options_.children.length-1,0,"pictureInPictureToggle"),De.registerComponent("ControlBar",tr);var ir=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",n.open),n}je(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}(Ct);ir.prototype.options_=o({},Ct.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),De.registerComponent("ErrorDisplay",ir);var nr="vjs-text-track-settings",rr=["#000","Black"],sr=["#00F","Blue"],ar=["#0FF","Cyan"],or=["#0F0","Green"],ur=["#F0F","Magenta"],lr=["#F00","Red"],cr=["#FFF","White"],hr=["#FF0","Yellow"],dr=["1","Opaque"],pr=["0.5","Semi-Transparent"],fr=["0","Transparent"],mr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[rr,cr,lr,or,sr,hr,ur,ar]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[dr,pr,fr]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[cr,rr,lr,or,sr,hr,ur,ar]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[dr,pr]},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:[fr,pr,dr]}};function gr(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}mr.windowColor.options=mr.backgroundColor.options;var vr=function(t){function i(e,i){var n;return i.temporary=!1,(n=t.call(this,e,i)||this).updateDisplay=fe(Be(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(mr,(function(e){n.on(n.$(e.selector),"change",n.updateDisplay)})),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}je(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=mr[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=this;return function(t,i,n){return void 0===n&&(n=0),l(t).reduce((function(i,n){return function(t,i,n){var r=function(e,t){return gr(e.options[e.options.selectedIndex].value,t)}(e.$(i.selector),i.parser);return void 0!==r&&(t[n]=r),t}(i,t[n],n)}),n)}(mr,0,{})},n.setValues=function(e){var t=this;c(mr,(function(i,n){!function(e,t,i){if(t)for(var n=0;n<e.options.length;n++)if(gr(e.options[n].value,i)===t){e.selectedIndex=n;break}}(t.$(i.selector),e[n],i.parser)}))},n.setDefaults=function(){var e=this;c(mr,(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(nr))}catch(t){r.warn(t)}t&&this.setValues(t)},n.saveSettings=function(){if(this.options_.persistTextTrackSettings){var t=this.getValues();try{Object.keys(t).length?e.localStorage.setItem(nr,JSON.stringify(t)):e.localStorage.removeItem(nr)}catch(t){r.warn(t)}}},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}(Ct);De.registerComponent("TextTrackSettings",vr);var yr=function(t){function i(i,n){var r,s=n.ResizeObserver||e.ResizeObserver;null===n.ResizeObserver&&(s=!1);var a=Oe({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;function a(){var e=this,i=arguments,n=function(){n=s=null,t.apply(e,i)};r.clearTimeout(s),s=r.setTimeout(n,100)}return void 0===r&&(r=e),a.cancel=function(){r.clearTimeout(s),s=null},a}((function(){r.resizeHandler()}),0,0,Be(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}je(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}(De);De.registerComponent("ResizeManager",yr);var _r=function(e){function i(i,n){var r,s=Oe({createEl:!1},n);return(r=e.call(this,i,s)||this).reset_(),r.on(r.player_,"durationchange",r.handleDurationchange),Je&&"hidden"in t&&"visibilityState"in t&&r.on(t,"visibilitychange",r.handleVisibilityChange),r}je(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&&t<=e-i},n.trackLive_=function(){this.pastSeekEnd_=this.pastSeekEnd_;var e=this.player_.seekable();if(e&&e.length){var t=this.seekableEnd();t!==this.lastSeekEnd_&&(this.lastSeekEnd_&&(this.seekableIncrementList_=this.seekableIncrementList_.slice(-11),this.seekableIncrementList_.push(Math.abs(t-this.lastSeekEnd_)),3<this.seekableIncrementList_.length&&(this.seekableIncrement_=function(e){var t=Math.floor(e.length/2),i=[].concat(e).sort((function(e,t){return e-t}));return e.length%2!=0?i[t]:(i[t-1]+i[t])/2}(this.seekableIncrementList_))),this.pastSeekEnd_=0,this.lastSeekEnd_=t,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_,30),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}(De);function br(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)}function Tr(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}function Sr(t){var i=t.el();if(!i.resetSourceWatch_){var n={},r=function(t){return Tr([t.el(),e.HTMLMediaElement.prototype,e.Element.prototype,Er],"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",Oe(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_)}}function kr(e,t,i,n){function r(i){return Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0})}void 0===n&&(n=!0);var s={configurable:!0,enumerable:!0,get:function(){var e=i();return r(e),e}};return n&&(s.set=r),Object.defineProperty(e,t,s)}De.registerComponent("LiveTracker",_r);var Cr,Er=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}}),wr=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?It(e.Element.prototype.getAttribute.call(this,"src")):""},set:function(t){return e.Element.prototype.setAttribute.call(this,"src",t),t}}),Lr=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")||!Ot(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_(),(tt||nt||Ke)&&!0===e.nativeControlsForTouch&&n.setControls(!0),n.proxyWebkitFullscreen_(),n.triggerReady(),n}je(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 Tr([t.el(),e.HTMLMediaElement.prototype,wr],"src")}(t),r=i.setAttribute,s=i.load;Object.defineProperty(i,"src",Oe(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(""),Sr(t)),e},i.currentSrc?t.triggerSourceset(i.currentSrc):br(t)||Sr(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(){function e(){t=[];for(var e=0;e<i.length;e++){var n=i[e];"metadata"===n.kind&&t.push({track:n,storedMode:n.mode})}}var t,i=this.textTracks();function n(){for(var e=0;e<t.length;e++){var r=t[e];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}i.removeEventListener("change",n)}e(),i.addEventListener("change",e),this.on("dispose",(function(){return i.removeEventListener("change",e)})),this.on("webkitbeginfullscreen",(function(){i.removeEventListener("change",e),i.removeEventListener("change",n),i.addEventListener("change",n)})),this.on("webkitendfullscreen",(function(){i.removeEventListener("change",e),i.addEventListener("change",e),i.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=ii[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;ii.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=Oe({},this.options_.tag&&A(this.options_.tag));tt&&!0===this.options_.nativeControlsForTouch||delete r.controls,P(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"),2<=e.readyState&&r.push("loadeddata"),3<=e.readyState&&r.push("canplay"),4<=e.readyState&&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&&ze&&$e&&0===this.el_.currentTime?(this.on("timeupdate",(function t(){0<e.el_.currentTime&&(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}(Ui);kr(Lr,"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}})),Lr.isSupported=function(){try{Lr.TEST_VID.volume=.5}catch(e){return!1}return!(!Lr.TEST_VID||!Lr.TEST_VID.canPlayType)},Lr.canPlayType=function(e){return Lr.TEST_VID.canPlayType(e)},Lr.canPlaySource=function(e,t){return Lr.canPlayType(e.type)},Lr.canControlVolume=function(){try{var e=Lr.TEST_VID.volume;return Lr.TEST_VID.volume=e/2+.1,e!==Lr.TEST_VID.volume}catch(e){return!1}},Lr.canMuteVolume=function(){try{var e=Lr.TEST_VID.muted;return Lr.TEST_VID.muted=!e,Lr.TEST_VID.muted?x(Lr.TEST_VID,"muted","muted"):O(Lr.TEST_VID,"muted"),e!==Lr.TEST_VID.muted}catch(e){return!1}},Lr.canControlPlaybackRate=function(){if(ze&&$e&&Qe<58)return!1;try{var e=Lr.TEST_VID.playbackRate;return Lr.TEST_VID.playbackRate=e/2+.1,e!==Lr.TEST_VID.playbackRate}catch(e){return!1}},Lr.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},Lr.supportsNativeTextTracks=function(){return st||rt&&$e},Lr.supportsNativeVideoTracks=function(){return!(!Lr.TEST_VID||!Lr.TEST_VID.videoTracks)},Lr.supportsNativeAudioTracks=function(){return!(!Lr.TEST_VID||!Lr.TEST_VID.audioTracks)},Lr.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];kr(Lr.prototype,t,(function(){return Lr[i]()}),!0)})),Lr.prototype.movingMediaElementInDOM=!rt,Lr.prototype.featuresFullscreenResize=!0,Lr.prototype.featuresProgressEvents=!0,Lr.prototype.featuresTimeupdateEvents=!0,Lr.patchCanPlayType=function(){4<=Ge&&!Xe&&!$e&&(Cr=Lr.TEST_VID&&Lr.TEST_VID.constructor.prototype.canPlayType,Lr.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":Cr.call(this,e)})},Lr.unpatchCanPlayType=function(){var e=Lr.TEST_VID.constructor.prototype.canPlayType;return Cr&&(Lr.TEST_VID.constructor.prototype.canPlayType=Cr),e},Lr.patchCanPlayType(),Lr.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){}}()}},Lr.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){Lr.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){Lr.prototype["set"+xe(e)]=function(t){(this.el_[e]=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){Lr.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach((function(e){Lr.prototype["set"+xe(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){Lr.prototype[e]=function(){return this.el_[e]()}})),Ui.withSourceHandlers(Lr),Lr.nativeSourceHandler={},Lr.nativeSourceHandler.canPlayType=function(e){try{return Lr.TEST_VID.canPlayType(e)}catch(e){return""}},Lr.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return Lr.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=xt(e.src);return Lr.nativeSourceHandler.canPlayType("video/"+i)}return""},Lr.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},Lr.nativeSourceHandler.dispose=function(){},Lr.registerSourceHandler(Lr.nativeSourceHandler),Ui.registerTech("Html5",Lr);var Pr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Ar={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Ir=["tiny","xsmall","small","medium","large","xlarge","huge"],xr={};Ir.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;xr[e]="vjs-layout-"+t}));var Or={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},Dr=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_=fe(Be(u),u.documentFullscreenChange_),u.boundFullWindowOnEscKey_=fe(Be(u),u.fullWindowOnEscKey),u.isFullscreen_=!1,u.log=s(u.id_),u.fsApi_=dt,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(Be(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=Oe(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"),tt&&u.addClass("vjs-touch-enabled"),rt||u.addClass("vjs-workinghover"),a.players[u.id_]=Be(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}je(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),function(e){Ni[e.id()]=null}(this),ri.names.forEach((function(t){var i=ri[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",(Je||$e&&et)&&(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_=J("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},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_;this.fluid_=!!e,Ee(this)&&this.off("playerreset",this.updateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),function(e,t){Ee(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))}((function(){this.on("playerreset",this.updateStyleEl_)}))):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_:0<this.videoWidth()?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),Z(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&&(0<=a&&(u.width=a),0<=o&&(u.height=o))}},o.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=xe(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(Ui.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};ri.names.forEach((function(e){var t=ri[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&&0<this.cache_.currentTime&&(s.startTime=this.cache_.currentTime);var a=Ui.getTech(e);if(!a)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new a(s),this.tech_.ready(fe(this,this.handleTechReady_),!0),function(e,t){e.forEach((function(e){var i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((function(e){return i.addCue(e)}))})),t.textTracks()}(this.textTracksJson_||[],this.tech_),Pr.forEach((function(e){i.on(i.tech_,e,i["handleTech"+xe(e)+"_"])})),Object.keys(Ar).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+Ar[e]+"_"].bind(i),event:t}):i["handleTech"+Ar[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=this;ri.names.forEach((function(t){var i=ri[t];e[i.privateName]=e[i.getterName]()})),this.textTracksJson_=function(e){var t=e.$$("track"),i=Array.prototype.map.call(t,(function(e){return e.track}));return Array.prototype.map.call(t,(function(e){var t=Tt(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(Tt))}(this.tech_),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();function i(){t.muted(e)}t.muted(!0),t.playTerminatedQueue_.push(i);var n=t.play();if(_t(n))return n.catch(i)};if("any"===e&&!0!==this.muted()?_t(i=this.play())&&(i=i.catch(n)):i="muted"===e&&!0!==this.muted()?n():this.play(),_t(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=Oe({},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(){0<this.tech_.playbackRate()&&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()?bt(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(e,t){var i=null;1<arguments.length&&(i=t),this.trigger("textdata",i)},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 Hi)return function(e,t,i,n){return t[i](e.reduce(qi(i),n))}(this.middleware_,this.tech_,e,t);if(e in Vi)return ji(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 Fi)return function(e,t,i){return e.reduceRight(qi(i),t[i]())}(this.middleware_,this.tech_,e);if(e in Vi)return ji(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=bt),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||!st&&!rt||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")||lt(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)===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=lt(0,0)),e},o.bufferedPercent=function(){return ct(this.buffered(),this.duration())},o.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return t<i&&(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(0<t&&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)return this.isFullscreen_;var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()},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){St.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=this.options_.userActions;t&&t.hotkeys&&!function(e){var t=e.tagName.toLowerCase();return!!e.isContentEditable||("input"===t?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type):-1!==["textarea"].indexOf(t))}(this.el_.ownerDocument.activeElement)&&("function"==typeof t.hotkeys?t.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 St.isEventKey(e,"f")}:n,s=i.muteKey,a=void 0===s?function(e){return St.isEventKey(e,"m")}:s,o=i.playPauseKey,u=void 0===o?function(e){return St.isEventKey(e,"k")||St.isEventKey(e,"Space")}:o;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();var l=De.getComponent("FullscreenToggle");!1!==t[this.fsApi_.fullscreenEnabled]&&l.prototype.handleClick.call(this,e)}else a.call(this,e)?(e.preventDefault(),e.stopPropagation(),De.getComponent("MuteToggle").prototype.handleClick.call(this,e)):u.call(this,e)&&(e.preventDefault(),e.stopPropagation(),De.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=Ui.getTech(s);if(a=a||De.getComponent(s)){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){function t(e,t,i){var n;return e.some((function(e){return t.some((function(t){if(n=i(e,t))return!0}))})),n}function i(e,t){var i=e[0];if(e[1].canPlaySource(t,s.options_[i.toLowerCase()]))return{source:t,tech:i}}var n,s=this,a=this.options_.techOrder.map((function(e){return[e,Ui.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)}));return(this.options_.sourceOrder?t(e,a,(n=i,function(e,t){return n(t,e)})):t(a,e,i))||!1},o.src=function(e){var t=this;if(void 0===e)return this.cache_.src||"";var i=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}(e);i.length?(this.changingSrc_=!0,this.cache_.sources=i,this.updateSourceCaches_(i[0]),function(e,t,i){e.setTimeout((function(){return function e(t,i,n,r,s,a){void 0===t&&(t={}),void 0===i&&(i=[]),void 0===s&&(s=[]),void 0===a&&(a=!1);var o=i,u=o[0],l=o.slice(1);if("string"==typeof u)e(t,Mi[u],n,r,s,a);else if(u){var c=function(e,t){var i=Ni[e.id()],n=null;if(null==i)return n=t(e),Ni[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}(r,u);if(!c.setSource)return s.push(c),e(t,l,n,r,s,a);c.setSource(h({},t),(function(i,o){if(i)return e(t,l,n,r,s,a);s.push(c),e(o,t.type===o.type?l:Mi[o.type],n,r,s,a)}))}else l.length?e(t,l,n,r,s,a):a?n(t,s):e(t,Mi["*"],n,r,s,!0)}(t,Mi[t.type],i,e)}),1)}(this,i[0],(function(e,n){if(t.middleware_=n,t.cache_.sources=i,t.updateSourceCaches_(e),t.src_(e))return 1<i.length?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());!function(e,t){e.forEach((function(e){return e.setTech&&e.setTech(t)}))}(n,t.tech_)}))):this.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0)},o.src_=function(e){var t=this,i=this.selectSource([e]);return!i||(function(e,t){return xe(e)===xe(t)}(i.tech,this.techName_)?this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0):(this.changingSrc_=!0,this.loadTech_(i.tech,i.source),this.tech_.ready((function(){t.changingSrc_=!1}))),!1)},o.load=function(){this.techCall_("load")},o.reset=function(){var t=this,i=this.options_.Promise||e.Promise;this.paused()||!i?this.doReset_():bt(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_(),Ee(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||"")!==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 vt(e),this.addClass("vjs-error"),r.error("(CODE:"+this.error_.code+" "+vt.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(){function e(e){r(),this.clearInterval(t)}var t,i,n,r=fe(this,this.reportUserActivity);this.on("mousedown",(function(){r(),this.clearInterval(t),t=this.setInterval(r,250)})),this.on("mousemove",(function(e){e.screenX===i&&e.screenY===n||(i=e.screenX,n=e.screenY,r())})),this.on("mouseup",e),this.on("mouseleave",e);var s,a=this.getChild("controlBar");!a||rt||ze||(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",r),this.on("keyup",r),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 Oe(a.prototype.options_.languages,this.languages_)},o.toJSON=function(){var e=Oe(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i<t.length;i++){var n=t[i];(n=Oe(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 Ct(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<Ir.length;i++){var n=Ir[i];if(t<=this.breakpoints_[n]){if(e===n)return;e&&this.removeClass(xr[e]),this.addClass(xr[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({},Or,e),this.updateCurrentBreakpoint_()),h(this.breakpoints_)},o.responsive=function(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?((this.responsive_=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 xr[this.breakpoint_]||""},o.loadMedia=function(e,t){var i=this;if(e&&"object"==typeof e){this.reset(),this.cache_.media=Oe(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)return Oe(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},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,void 0)}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}(De);ri.names.forEach((function(e){var t=ri[e];Dr.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),Dr.players={};var Rr=e.navigator;function Ur(e){return Wr.hasOwnProperty(e)}function Mr(e){return Ur(e)?Wr[e]:void 0}function Nr(e,t){e[qr]=e[qr]||{},e[qr][t]=!0}function Br(e,t,i){var n=(i?"before":"")+"pluginsetup";e.trigger(n,t),e.trigger(n+":"+t.name,t)}function jr(e,t){return t.prototype.name=e,function(){Br(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=Hr(t,[this].concat(n));return this[e]=function(){return s},Br(this,s.getEventHash()),s}}Dr.prototype.options_={techOrder:Ui.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Rr&&(Rr.languages&&Rr.languages[0]||Rr.userLanguage||Rr.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){Dr.prototype[e]=function(){return this.techGet_(e)}})),Pr.forEach((function(e){Dr.prototype["handleTech"+xe(e)+"_"]=function(){return this.trigger(e)}})),De.registerComponent("Player",Dr);var Fr=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})),Hr=a((function(e){function t(i,n,r){return function(){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}}()?e.exports=t=Reflect.construct:e.exports=t=function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&Fr(r,i.prototype),r},t.apply(null,arguments)}e.exports=t})),Vr="plugin",qr="activePlugins_",Wr={},zr=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,Ae(this,this.constructor.defaultState),Nr(t,this.name),this.dispose=fe(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[qr][e]=!1,this.player=this.state=null,t[e]=jr(e,Wr[e])},e.isBasic=function(t){var i="string"==typeof t?Mr(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(Ur(t))r.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(Dr.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 Wr[t]=i,t!==Vr&&(e.isBasic(i)?Dr.prototype[t]=function(e,t){function i(){Br(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return Nr(this,e),Br(this,{name:e,plugin:t,instance:i}),i}return Object.keys(t).forEach((function(e){i[e]=t[e]})),i}(t,i):Dr.prototype[t]=jr(t,i)),i},e.deregisterPlugin=function(e){if(e===Vr)throw new Error("Cannot de-register base plugin.");Ur(e)&&(delete Wr[e],delete Dr.prototype[e])},e.getPlugins=function(e){var t;return void 0===e&&(e=Object.keys(Wr)),e.forEach((function(e){var i=Mr(e);i&&((t=t||{})[e]=i)})),t},e.getPluginVersion=function(e){var t=Mr(e);return t&&t.VERSION||""},e}();zr.getPlugin=Mr,zr.BASE_PLUGIN_NAME=Vr,zr.registerPlugin(Vr,zr),Dr.prototype.usingPlugin=function(e){return!!this[qr]&&!0===this[qr][e]},Dr.prototype.hasPlugin=function(e){return!!Ur(e)};var Gr=function(e){return 0===e.indexOf("#")?e.slice(1):e};function Kr(e,t,i){var n=Kr.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("#"+Gr(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||{},Kr.hooks("beforesetup").forEach((function(e){var i=e(s,Oe(t));d(i)&&!Array.isArray(i)?t=Oe(t,i):r.error("please return an object in beforesetup hooks")}));var a=De.getComponent("Player");return n=new a(s,t,i),Kr.hooks("setup").forEach((function(e){return e(n)})),n}if(Kr.hooks_={},Kr.hooks=function(e,t){return Kr.hooks_[e]=Kr.hooks_[e]||[],t&&(Kr.hooks_[e]=Kr.hooks_[e].concat(t)),Kr.hooks_[e]},Kr.hook=function(e,t){Kr.hooks(e,t)},Kr.hookOnce=function(e,t){Kr.hooks(e,[].concat(t).map((function(t){return function i(){return Kr.removeHook(e,i),t.apply(void 0,arguments)}})))},Kr.removeHook=function(e,t){var i=Kr.hooks(e).indexOf(t);return!(i<=-1||(Kr.hooks_[e]=Kr.hooks_[e].slice(),Kr.hooks_[e].splice(i,1),0))},!0!==e.VIDEOJS_NO_DYNAMIC_STYLE&&v()){var Xr=z(".vjs-styles-defaults");if(!Xr){Xr=J("vjs-styles-defaults");var Yr=z("head");Yr&&Yr.insertBefore(Xr,Yr.firstChild),Z(Xr,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}$(1,Kr),Kr.VERSION=i,Kr.options=Dr.prototype.options_,Kr.getPlayers=function(){return Dr.players},Kr.getPlayer=function(e){var t,i=Dr.players;if("string"==typeof e){var n=Gr(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]}},Kr.getAllPlayers=function(){return Object.keys(Dr.players).map((function(e){return Dr.players[e]})).filter(Boolean)},Kr.players=Dr.players,Kr.getComponent=De.getComponent,Kr.registerComponent=function(e,t){Ui.isTech(t)&&r.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),De.registerComponent.call(De,e,t)},Kr.getTech=Ui.getTech,Kr.registerTech=Ui.registerTech,Kr.use=function(e,t){Mi[e]=Mi[e]||[],Mi[e].push(t)},Object.defineProperty(Kr,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(Kr.middleware,"TERMINATOR",{value:Bi,writeable:!1,enumerable:!0}),Kr.browser=at,Kr.TOUCH_ENABLED=tt,Kr.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&&Fr(e,t)}(i,e),e&&(i.super_=e),n)n.hasOwnProperty(r)&&(i.prototype[r]=n[r]);return i},Kr.mergeOptions=Oe,Kr.bind=fe,Kr.registerPlugin=zr.registerPlugin,Kr.deregisterPlugin=zr.deregisterPlugin,Kr.plugin=function(e,t){return r.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),zr.registerPlugin(e,t)},Kr.getPlugins=zr.getPlugins,Kr.getPlugin=zr.getPlugin,Kr.getPluginVersion=zr.getPluginVersion,Kr.addLanguage=function(e,t){var i;return e=(""+e).toLowerCase(),Kr.options.languages=Oe(Kr.options.languages,((i={})[e]=t,i)),Kr.options.languages[e]},Kr.log=r,Kr.createLogger=s,Kr.createTimeRange=Kr.createTimeRanges=lt,Kr.formatTime=ln,Kr.setFormatTime=function(e){un=e},Kr.resetFormatTime=function(){un=on},Kr.parseUrl=At,Kr.isCrossOrigin=Ot,Kr.EventTarget=ge,Kr.on=le,Kr.one=de,Kr.off=ce,Kr.trigger=he,Kr.xhr=zt,Kr.TextTrack=Jt,Kr.AudioTrack=Zt,Kr.VideoTrack=ei,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((function(e){Kr[e]=function(){return r.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead"),K[e].apply(null,arguments)}})),Kr.computedStyle=f,Kr.dom=K,Kr.url=qt,Kr.defineLazyProperty=kr;var $r=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 Qr(){return(Qr=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 Jr(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}function Zr(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}var es=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),-1<i},t.trigger=function(e,t){var i,n,r,s=this.listeners[e];if(s)if(2===arguments.length)for(n=s.length,i=0;i<n;++i)s[i].call(this,t);else for(r=Array.prototype.slice.call(arguments,1),n=s.length,i=0;i<n;++i)s[i].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}(),ts=function(e){function t(){var t;return(t=e.call(this)||this).buffer="",t}return Jr(t,e),t.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");-1<t;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(es),is=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}Jr(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}(es);function ns(e){return!!e&&"object"==typeof e}function rs(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return t.reduce((function(e,t){return Object.keys(t).forEach((function(i){Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):ns(e[i])&&ns(t[i])?e[i]=rs(e[i],t[i]):e[i]=t[i]})),e}),{})}function ss(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function as(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t}var os=function(t){function i(){var i;(i=t.call(this)||this).lineStream=new ts,i.parseStream=new is,i.lineStream.pipe(i.parseStream);var n,r,s=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i),a=[],o={},u={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},l=0;return i.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},i.parseStream.on("data",(function(t){var i,c;({tag:function(){({"allow-cache":function(){this.manifest.allowCache=t.allowed,"allowed"in t||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var e={};"length"in t&&((o.byterange=e).length=t.length,"offset"in t||(this.trigger("info",{message:"defaulting offset to zero"}),t.offset=0)),"offset"in t&&((o.byterange=e).offset=t.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"})),0<t.duration&&(o.duration=t.duration),0===t.duration&&(o.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=a},key:function(){if(t.attributes)if("NONE"!==t.attributes.METHOD)if(t.attributes.URI){if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===t.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(t.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===t.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==t.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):t.attributes.KEYID&&"0x"===t.attributes.KEYID.substring(0,2)?void(this.manifest.contentProtection={"com.widevine.alpha":{attributes:{schemeIdUri:t.attributes.KEYFORMAT,keyId:t.attributes.KEYID.substring(2)},pssh: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}(t.attributes.URI.split(",")[1])}}):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));t.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),r={method:t.attributes.METHOD||"AES-128",uri:t.attributes.URI},void 0!==t.attributes.IV&&(r.iv=t.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else r=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(t.number)?this.manifest.mediaSequence=t.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+t.number})},"discontinuity-sequence":function(){isFinite(t.number)?(this.manifest.discontinuitySequence=t.number,l=t.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+t.number})},"playlist-type":function(){/VOD|EVENT/.test(t.playlistType)?this.manifest.playlistType=t.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+t.playlist})},map:function(){n={},t.uri&&(n.uri=t.uri),t.byterange&&(n.byterange=t.byterange)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||u,t.attributes?(o.attributes||(o.attributes={}),Qr(o.attributes,t.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||u,t.attributes&&t.attributes.TYPE&&t.attributes["GROUP-ID"]&&t.attributes.NAME){var e=this.manifest.mediaGroups[t.attributes.TYPE];e[t.attributes["GROUP-ID"]]=e[t.attributes["GROUP-ID"]]||{},i=e[t.attributes["GROUP-ID"]],(c={default:/yes/i.test(t.attributes.DEFAULT)}).default?c.autoselect=!0:c.autoselect=/yes/i.test(t.attributes.AUTOSELECT),t.attributes.LANGUAGE&&(c.language=t.attributes.LANGUAGE),t.attributes.URI&&(c.uri=t.attributes.URI),t.attributes["INSTREAM-ID"]&&(c.instreamId=t.attributes["INSTREAM-ID"]),t.attributes.CHARACTERISTICS&&(c.characteristics=t.attributes.CHARACTERISTICS),t.attributes.FORCED&&(c.forced=/yes/i.test(t.attributes.FORCED)),i[t.attributes.NAME]=c}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){l+=1,o.discontinuity=!0,this.manifest.discontinuityStarts.push(a.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=t.dateTimeString,this.manifest.dateTimeObject=t.dateTimeObject),o.dateTimeString=t.dateTimeString,o.dateTimeObject=t.dateTimeObject},targetduration:function(){!isFinite(t.duration)||t.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+t.duration}):this.manifest.targetDuration=t.duration},totalduration:function(){!isFinite(t.duration)||t.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+t.duration}):this.manifest.totalDuration=t.duration},start:function(){t.attributes&&!isNaN(t.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:t.attributes["TIME-OFFSET"],precise:t.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){o.cueOut=t.data},"cue-out-cont":function(){o.cueOutCont=t.data},"cue-in":function(){o.cueIn=t.data}}[t.tagType]||function(){}).call(s)},uri:function(){o.uri=t.uri,a.push(o),!this.manifest.targetDuration||"duration"in o||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),o.duration=this.manifest.targetDuration),r&&(o.key=r),o.timeline=l,n&&(o.map=n),o={}},comment:function(){},custom:function(){t.segment?(o.custom=o.custom||{},o.custom[t.customType]=t.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[t.customType]=t.data)}})[t.type].call(s)})),i}Jr(i,t);var n=i.prototype;return n.push=function(e){this.lineStream.push(e)},n.end=function(){this.lineStream.push("\n")},n.addParser=function(e){this.parseStream.addParser(e)},n.addTagMapper=function(e){this.parseStream.addTagMapper(e)},i}(es);function us(t,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(t)||(t=ws.buildAbsoluteURL(e.location.href,t)),ws.buildAbsoluteURL(t,i))}function ls(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:us(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}function cs(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=Ls[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}function hs(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=ls({baseUrl:t,source:n.sourceURL,range:n.range}),h=ls({baseUrl:t,source:t,indexRange:u});if(h.map=c,l){var d=cs(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]}function ds(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=hs({baseUrl:i,timescale:u,timeline:s,periodIndex:s,duration:p.subsegmentDuration,sourceDuration:r,indexRange:h+"-"+(h+f-1)})[0];n&&(m.map=n),c.push(m),h+=f}return e.segments=c,e}function ps(e){return function(e){return Object.keys(e).map((function(t){return e[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}),{})).map((function(e){return e.discontinuityStarts=function(e,t){return e.reduce((function(e,t,i){return t.discontinuity&&e.push(i),e}),[])}(e.segments),e}))}function fs(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+"-"+(o=(a=n.sidx.byterange).offset+a.length-1,a.offset+"-"+o),s=t[r]&&t[r].sidx;n.sidx&&s&&ds(n,s,n.sidx.resolvedUri)}}var a,o;return e}function ms(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}function gs(e,t){for(var i,n,r,s,a,o,u,l,c,h,d,p,f=e.type,m=void 0===f?"static":f,g=e.minimumUpdatePeriod,v=void 0===g?0:g,y=e.media,_=void 0===y?"":y,b=e.sourceDuration,T=e.timescale,S=void 0===T?1:T,k=e.startNumber,C=void 0===k?1:k,E=e.periodIndex,w=[],L=-1,P=0;P<t.length;P++){var A=t[P],I=A.d,x=A.r||0,O=A.t||0;L<0&&(L=O),O&&L<O&&(L=O);var D=void 0;if(x<0){var R=P+1;D=R===t.length?"dynamic"===m&&0<v&&0<_.indexOf("$Number$")?(n=L,r=I,s=(i=e).NOW,a=i.clientOffset,o=i.availabilityStartTime,l=void 0===(u=i.timescale)?1:u,h=void 0===(c=i.start)?0:c,p=(s+a)/1e3+(void 0===(d=i.minimumUpdatePeriod)?0:d)-(o+h),Math.ceil((p*l-n)/r)):(b*S-L)/I:(t[R].t-L)/I}else D=x+1;for(var U=C+w.length+D,M=C+w.length;M<U;)w.push({number:M,duration:I/S,time:L,timeline:E}),L+=I,M++}return w}function vs(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||(r=n?parseInt(r,10):1)<=s.length?s:new Array(r-s.length+1).join("0")+s}}(t))}function ys(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,s=ls({baseUrl:e.baseUrl,source:vs(r.sourceURL,i),range:r.range});return function(e,t){return e.duration||t?e.duration?cs(e):gs(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=vs(e.media||"",i);return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:us(e.baseUrl||"",n),map:s,number:t.number}}))}function _s(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=ls({baseUrl:i,source:r.sourceURL,range:r.range}),a=ls({baseUrl:i,source:t.media,range:t.mediaRange});return a.map=s,a}(e,t)}));return i&&(s=cs(e)),t&&(s=gs(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}))}function bs(e){var t,i,n=e.attributes,r=e.segmentInfo;r.template?(i=ys,t=rs(n,r.template)):r.base?(i=hs,t=rs(n,r.base)):r.list&&(i=_s,t=rs(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}function Ts(e,t){return as(e.childNodes).filter((function(e){return e.tagName===t}))}function Ss(e){return e.textContent.trim()}function ks(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)}function Cs(e){return e&&e.attributes?as(e.attributes).reduce((function(e,t){var i=As[t.name]||As.DEFAULT;return e[t.name]=i(t.value),e}),{}):{}}var Es,ws=(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}(Es={exports:{}}),Es.exports),Ls={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)}}},Ps=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,As={mediaPresentationDuration:function(e){return ks(e)},availabilityStartTime:function(e){return function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)&&(e+="Z"),Date.parse(e)}(e)/1e3},minimumUpdatePeriod:function(e){return ks(e)},timeShiftBufferDepth:function(e){return ks(e)},start:function(e){return ks(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)?ks(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}};function Is(e,t){return t.length?ss(e.map((function(e){return t.map((function(t){return us(e,Ss(t))}))}))):e}function xs(e){var t=Ts(e,"SegmentTemplate")[0],i=Ts(e,"SegmentList")[0],n=i&&Ts(i,"SegmentURL").map((function(e){return rs({tag:"SegmentURL"},Cs(e))})),r=Ts(e,"SegmentBase")[0],s=i||t,a=s&&Ts(s,"SegmentTimeline")[0],o=i||r||t,u=o&&Ts(o,"Initialization")[0],l=t&&Cs(t);l&&u?l.initialization=u&&Cs(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var c={template:l,timeline:a&&Ts(a,"S").map((function(e){return Cs(e)})),list:i&&rs(Cs(i),{segmentUrls:n,initialization:Cs(u)}),base:r&&rs(Cs(r),{initialization:Cs(u)})};return Object.keys(c).forEach((function(e){c[e]||delete c[e]})),c}function Os(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&&0<n.getElementsByTagName("parsererror").length)throw new Error("DASH_INVALID_XML");return n}function Ds(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=ps(e.filter((function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType}))).map(ms),u=ps(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:fs(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:fs([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}(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=i.attributes.lang||"text";return e[n]||(e[n]={language:n,default:!1,autoselect:!1,playlists:fs([function(e){var t,i=e.attributes,n=e.segments;return void 0===n&&(n=[{uri:i.baseUrl,timeline:i.periodIndex,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration),{attributes:(t={NAME:i.id,BANDWIDTH:i.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:i.baseUrl||"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1}}(i)],t),uri:""}),e}),{})}(l,t)),c}(function(e){return e.map(bs)}(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=Ts(t,"Period");if(!c.length)throw new Error("INVALID_NUMBER_OF_PERIOD");var h=Cs(t),d=Is([s],Ts(t,"BaseURL"));return h.sourceDuration=h.mediaPresentationDuration||0,h.NOW=o,h.clientOffset=l,ss(c.map(function(t,i){return function(n,r){var s=Is(i,Ts(n,"BaseURL")),a=Cs(n),o=parseInt(a.id,10),u=e.isNaN(o)?r:o,l=rs(t,{periodIndex:u}),c=Ts(n,"AdaptationSet"),h=xs(n);return ss(c.map(function(t,i,n){return function(r){var s=Cs(r),a=Is(i,Ts(r,"BaseURL")),o={role:Cs(Ts(r,"Role")[0])},u=rs(t,s,o),l=function(t){return t.reduce((function(t,i){var n=Cs(i),r=Ws[n.schemeIdUri];if(r){t[r]={attributes:n};var s=Ts(i,"cenc:pssh")[0];if(s){var a=Ss(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}),{})}(Ts(r,"ContentProtection"));Object.keys(l).length&&(u=rs(u,{contentProtection:l}));var c=xs(r),h=Ts(r,"Representation"),d=rs(n,c);return ss(h.map(function(e,t,i){return function(n){var r=Ts(n,"BaseURL"),s=Is(t,r),a=rs(e,Cs(n)),o=xs(n);return s.map((function(e){return{segmentInfo:rs(i,o),attributes:rs(a,{baseUrl:e})}}))}}(u,a,d)))}}(l,s,h)))}}(h,d)))}(Os(t),i)),i.sidxMapping)}function Rs(e){return new Date(1e3*e-20828448e5)}function Us(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]}}function Ms(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),(t+=String.fromCharCode(e[2]))+String.fromCharCode(e[3])}var Ns,Bs,js,Fs,Hs,Vs,qs,Ws={"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"},zs=function(e){return e>>>0},Gs=zs,Ks={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:Ns(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:Ms(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},n=8;n<e.byteLength;)i.compatibleBrands.push(Ms(e.subarray(n,n+4))),n+=4;return i},dinf:function(e){return{boxes:Ns(e)}},dref:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),dataReferences:Ns(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:Ms(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: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}(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=Rs(i.getUint32(n)),n+=8,r.modificationTime=Rs(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=8):(r.creationTime=Rs(i.getUint32(n)),n+=4,r.modificationTime=Rs(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:Ns(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:Ns(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 28<e.byteLength&&(i.streamDescriptor=Ns(e.subarray(28))[0]),i},moof:function(e){return{boxes:Ns(e)}},moov:function(e){return{boxes:Ns(e)}},mvex:function(e){return{boxes:Ns(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=Rs(t.getUint32(i)),i+=8,n.modificationTime=Rs(t.getUint32(i)),i+=4,n.timescale=t.getUint32(i),i+=8):(n.creationTime=Rs(t.getUint32(i)),i+=4,n.modificationTime=Rs(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:Ns(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:Ns(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 Ks.ftyp(e)},tfdt:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:Gs(e[4]<<24|e[5]<<16|e[6]<<8|e[7])};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=Gs(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=Rs(t.getUint32(i)),i+=8,n.modificationTime=Rs(t.getUint32(i)),i+=4,n.trackId=t.getUint32(i),i+=4,i+=8):(n.creationTime=Rs(t.getUint32(i)),i+=4,n.modificationTime=Rs(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:Ns(e)}},trak:function(e){return{boxes:Ns(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:Us(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=Us(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)])}}},Xs={inspect:Ns=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=Ms(e.subarray(a+4,a+8)),r=1<i?a+i:e.byteLength,(s=(Ks[n]||function(e){return{data:e}})(e.subarray(a+8,r))).size=i,s.type=n,o.push(s),a=r;return o},textify:Bs=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"+Bs(e.boxes,t+1):"")})).join("\n")},parseType:Ms,findBox:function e(t,i){var n,r,s,a,o,u=[];if(!i.length)return null;for(n=0;n<t.byteLength;)r=Gs(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]),s=Ms(t.subarray(n+4,n+8)),a=1<r?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:Ks.traf,parseTfdt:Ks.tfdt,parseHdlr:Ks.hdlr,parseTfhd:Ks.tfhd,parseTrun:Ks.trun,parseSidx:Ks.sidx},Ys=zs,$s=function(e){return("00"+e.toString(16)).slice(-2)};function Qs(){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),-1<n)},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={}}}}js=function(e){return Xs.findBox(e,["moov","trak"]).reduce((function(e,t){var i,n,r,s,a;return(i=Xs.findBox(t,["tkhd"])[0])?(n=i[0],s=Ys(i[r=0===n?12:20]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3]),(a=Xs.findBox(t,["mdia","mdhd"])[0])?(r=0===(n=a[0])?12:20,e[s]=Ys(a[r]<<24|a[r+1]<<16|a[r+2]<<8|a[r+3]),e):null):null}),{})},Fs=function(e,t){var i,n,r;return i=Xs.findBox(t,["moof","traf"]),n=[].concat.apply([],i.map((function(t){return Xs.findBox(t,["tfhd"]).map((function(i){var n,r;return n=Ys(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),r=e[n]||9e4,(Xs.findBox(t,["tfdt"]).map((function(e){var t,i;return t=e[0],i=Ys(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(i*=Math.pow(2,32),i+=Ys(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},Hs=function(e,t){var i,n=Xs.findBox(t,["moof","traf"]),r=0,s=0;if(n&&n.length)for(var a=Xs.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)},Vs=function(e){var t=Xs.findBox(e,["moov","trak"]),i=[];return t.forEach((function(e){var t=Xs.findBox(e,["mdia","hdlr"]),n=Xs.findBox(e,["tkhd"]);t.forEach((function(e,t){var r,s,a=Xs.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},qs=function(e){var t=Xs.findBox(e,["moov","trak"]),i=[];return t.forEach((function(e){var t,n,r={},s=Xs.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=Xs.findBox(e,["mdia","hdlr"])[0];if(a){var o=Xs.parseType(a.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var u=Xs.findBox(e,["mdia","minf","stbl","stsd"])[0];if(u){var l=u.subarray(8);r.codec=Xs.parseType(l.subarray(4,8));var c,h=Xs.findBox(l,[r.codec])[0];h&&(/^[a-z]vc[1-9]$/i.test(r.codec)?(c=h.subarray(78),"avcC"===Xs.parseType(c.subarray(4,8))&&11<c.length?(r.codec+=".",r.codec+=$s(c[9]),r.codec+=$s(c[10]),r.codec+=$s(c[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)&&(c=h.subarray(28),"esds"===Xs.parseType(c.subarray(4,8))&&20<c.length&&0!==c[19]?(r.codec+="."+$s(c[19]),r.codec+="."+$s(c[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"))}var d=Xs.findBox(e,["mdia","mdhd"])[0];if(d&&s){var p=0===n?12:20;r.timescale=Ys(d[p]<<24|d[1+p]<<16|d[2+p]<<8|d[3+p])}i.push(r)})),i};var Js={findBox:Xs.findBox,parseType:Xs.parseType,timescale:js,startTime:Fs,compositionStartTime:Hs,videoTrackIds:Vs,tracks:qs};function Zs(){Zs.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new sa(0,0),new sa(0,1),new sa(1,0),new sa(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)}Qs.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},Qs.prototype.push=function(e){this.trigger("data",e)},Qs.prototype.flush=function(e){this.trigger("done",e)},Qs.prototype.partialFlush=function(e){this.trigger("partialdone",e)},Qs.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},Qs.prototype.reset=function(e){this.trigger("reset",e)};var ea=Qs;function ta(e){return null===e?"":(e=na[e]||e,String.fromCharCode(e))}function ia(){for(var e=[],t=15;t--;)e.push("");return e}(Zs.prototype=new ea).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,r=n=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[2+r]&&(s.ccData=t[3+r]<<8|t[4+r],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}},Zs.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},Zs.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)},Zs.prototype.flush=function(){return this.flushStream("flush")},Zs.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Zs.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},Zs.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)},Zs.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Zs.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Zs.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=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],sa=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_=ia();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=ia();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=ia()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))s=ta((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=ta((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=ra.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=ta(n),s+=ta(r),this[this.mode_](e.pts,s),this.column_+=s.length)}else this.lastControlCode_=null}};function aa(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}function oa(e,t){var i=Js.findBox(e,["moof","traf"]),n=Js.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=Js.findBox(s,["tfhd"]),o=Xs.parseTfhd(a[0]),u=o.trackId,l=Js.findBox(s,["tfdt"]),c=0<l.length?Xs.parseTfdt(l[0]).baseMediaDecodeTime:0,h=Js.findBox(s,["trun"]);t===u&&0<h.length&&(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=aa(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=Xs.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}sa.prototype=new ea,sa.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e){try{return e.trim()}catch(e){return""}})).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},sa.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=ia(),this.nonDisplayed_=ia(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},sa.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_},sa.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},sa.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},sa.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},sa.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},sa.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&64<=t&&t<=127},sa.prototype.isColorPAC=function(e){return 64<=e&&e<=79||96<=e&&e<=127},sa.prototype.isNormalChar=function(e){return 32<=e&&e<=127},sa.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=ia(),this.displayed_=ia()),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},sa.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)},sa.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)}},sa.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},sa.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},sa.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_]=""},sa.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=Zs,ca=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(;0<t.length;){var u=t.shift();this.parse(u,s,a)}return null!==(o=function(e,t,i){return null===t?null:{seiNals:oa(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=[],n=i=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()};function ha(e){var t=31&e[1];return(t<<=8)|e[2]}function da(e){return!!(64&e[1])}function pa(e){var t=0;return 1<(48&e[3])>>>4&&(t+=e[4]+1),t}function fa(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}}function ma(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}new ea;var ga={parseType:function(e,t){var i=ha(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=da(e),i=4+pa(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=da(e),n=4+pa(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:da,parsePesType:function(e,t){switch(t[ha(e)]){case 27:return"video";case 15:return"audio";case 21:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!da(e))return null;var t=4+pa(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+pa(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}for(r+3!==n-2&&"slice_layer_without_partitioning_rbsp_idr"===fa(31&i[r+3])&&(s=!0);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"===fa(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&&3<i.byteLength&&"slice_layer_without_partitioning_rbsp_idr"===fa(31&i[r+3])&&(s=!0),s}},va=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ya={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?20+i:10+i},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 va[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=ma(e.subarray(10,14)));do{if((i=ma(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)))break;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])}}t+=10,t+=i}while(t<e.byteLength);return null}},_a=function(e,t){var i=1;for(t<e&&(i=-1);4294967296<Math.abs(t-e);)e+=8589934592*i;return e},ba={};function Ta(e,t,i){for(var n,r,s,a,o=0,u=Ca,l=!1;u<=e.byteLength;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o++,u++;else{switch(n=e.subarray(o,u),ba.ts.parseType(n,t.pid)){case"pes":r=ba.ts.parsePesType(n,t.table),s=ba.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&s&&(a=ba.ts.parsePesTime(n))&&(a.type="audio",i.audio.push(a),l=!0)}if(l)break;o+=Ca,u+=Ca}for(o=(u=e.byteLength)-Ca,l=!1;0<=o;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o--,u--;else{switch(n=e.subarray(o,u),ba.ts.parseType(n,t.pid)){case"pes":r=ba.ts.parsePesType(n,t.table),s=ba.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&s&&(a=ba.ts.parsePesTime(n))&&(a.type="audio",i.audio.push(a),l=!0)}if(l)break;o-=Ca,u-=Ca}}function Sa(e,t,i){for(var n,r,s,a,o,u,l,c=0,h=Ca,d=!1,p={data:[],size:0};h<e.byteLength;)if(71!==e[c]||71!==e[h])c++,h++;else{switch(n=e.subarray(c,h),ba.ts.parseType(n,t.pid)){case"pes":if(r=ba.ts.parsePesType(n,t.table),s=ba.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(s&&!d&&(a=ba.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(ba.ts.videoPacketContainsKeyFrame(o)){var f=ba.ts.parsePesTime(o);f&&(i.firstKeyFrame=f,i.firstKeyFrame.type="video")}p.size=0}p.data.push(n),p.size+=n.byteLength}}if(d&&i.firstKeyFrame)break;c+=Ca,h+=Ca}for(c=(h=e.byteLength)-Ca,d=!1;0<=c;)if(71!==e[c]||71!==e[h])c--,h--;else{switch(n=e.subarray(c,h),ba.ts.parseType(n,t.pid)){case"pes":r=ba.ts.parsePesType(n,t.table),s=ba.ts.parsePayloadUnitStartIndicator(n),"video"===r&&s&&(a=ba.ts.parsePesTime(n))&&(a.type="video",i.video.push(a),d=!0)}if(d)break;c-=Ca,h-=Ca}}ba.ts=ga,ba.aac=ya;var ka=9e4,Ca=188;function Ea(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wa(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)}}var La=null,Pa=(Aa.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},Aa);function Aa(e){Ea(this,Aa),La=La||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,f=16843009*u[h=u[c=u[r[n[a]=d]=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=[[La[0][0].slice(),La[0][1].slice(),La[0][2].slice(),La[0][3].slice(),La[0][4].slice()],[La[1][0].slice(),La[1][1].slice(),La[1][2].slice(),La[1][3].slice(),La[1][4].slice()]];var t=void 0,i=void 0,n=void 0,r=void 0,s=void 0,a=this._tables[0][4],o=this._tables[1],u=e.length,l=1;if(4!==u&&6!==u&&8!==u)throw new Error("Invalid aes key size");for(r=e.slice(0),s=[],this._key=[r,s],t=u;t<4*u+28;t++)n=r[t-1],(t%u==0||8===u&&t%u==4)&&(n=a[n>>>24]<<24^a[n>>16&255]<<16^a[n>>8&255]<<8^a[255&n],t%u==0&&(n=n<<8^n>>>24^l<<24,l=l<<1^283*(l>>7))),r[t]=r[t-u]^n;for(i=0;t;i++,t--)n=r[3&i?t:t-4],s[i]=t<=4||i<4?n:o[0][a[n>>>24]]^o[1][a[n>>16&255]]^o[2][a[n>>8&255]]^o[3][a[255&n]]}var Ia=(xa.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},xa.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),-1<i},xa.prototype.trigger=function(e,t){var i=this.listeners[e];if(i)if(2===arguments.length)for(var n=i.length,r=0;r<n;++r)i[r].call(this,t);else for(var s=Array.prototype.slice.call(arguments,1),a=i.length,o=0;o<a;++o)i[o].apply(this,s)},xa.prototype.dispose=function(){this.listeners={}},xa.prototype.pipe=function(e){this.on("data",(function(t){e.push(t)}))},xa);function xa(){Ea(this,xa),this.listeners={}}var Oa,Da=(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)}(Ra,Oa=Ia),Ra.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},Ra.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},Ra);function Ra(){Ea(this,Ra);var e=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,Oa.call(this,Ia));return e.jobs=[],e.delay=1,e.timeout_=null,e}function Ua(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}function Ma(e,t,i){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),r=new Pa(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=Ua(n[m]),d=Ua(n[m+1]),p=Ua(n[m+2]),f=Ua(n[m+3]),r.decrypt(h,d,p,f,a,m),a[m]=Ua(a[m]^o),a[m+1]=Ua(a[m+1]^u),a[m+2]=Ua(a[m+2]^l),a[m+3]=Ua(a[m+3]^c),o=h,u=d,l=p,c=f;return s}var Na=(Ba.prototype.decryptChunk_=function(e,t,i,n){return function(){var r=Ma(e,t,i);n.set(r,e.byteOffset)}},function(e,t,i){i&&wa(e,i)}(Ba,0,[{key:"STEP",get:function(){return 32e3}}]),Ba);function Ba(e,t,i,n){Ea(this,Ba);var r=Ba.STEP,s=new Int32Array(e.buffer),a=new Uint8Array(e.byteLength),o=0;for(this.asyncStream_=new Da,this.asyncStream_.push(this.decryptChunk_(s.subarray(o,o+r),t,i,a)),o=r;o<s.length;o+=r)i=new Uint32Array([Ua(s[o-4]),Ua(s[o-3]),Ua(s[o-2]),Ua(s[o-1])]),this.asyncStream_.push(this.decryptChunk_(s.subarray(o,o+r),t,i,a));this.asyncStream_.push((function(){n(null,function(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}(a))}))}function ja(t,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(t)||(t=$r.buildAbsoluteURL(e.location.href,t)),$r.buildAbsoluteURL(t,i))}function Fa(e,t,i){return e&&i.responseURL&&t!==i.responseURL?i.responseURL:t}function Ha(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Va=function(e,t,i){return t&&qa(e.prototype,t),i&&qa(e,i),e};function qa(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)}}function Wa(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)}function za(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}function Ga(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)}}))}function Ka(e,t){var i=Ja(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=Ja(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]=Ja(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}function Xa(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];(e.playlists[i.uri]=i).resolvedUri=ja(e.uri,i.uri),i.id=t,i.attributes||(i.attributes={},Za.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))}}function Ya(e){Ga(e,(function(t){t.uri&&(t.resolvedUri=ja(e.uri,t.uri))}))}function $a(e,t){var i=e.segments[e.segments.length-1];return t&&i&&i.duration?1e3*i.duration:500*(e.targetDuration||10)}var Qa=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")},Ja=Kr.mergeOptions,Za=Kr.log,eo=(Wa(to,Kr.EventTarget),Va(to,[{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:500<=e.status?4:2},this.trigger("error")}},{key:"haveMetadata",value:function(t,i){var n=this;this.request=null,this.state="HAVE_METADATA";var r=new os;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=Ka(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")}),$a(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 os;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,Xa(t.master),Ya(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"))}}))}}]),to);function to(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};Ha(this,to);var n=za(this,(to.__proto__||Object.getPrototypeOf(to)).call(this)),r=i.withCredentials,s=void 0!==r&&r,a=i.handleManifestRedirects,o=void 0!==a&&a;n.srcUrl=e,n.hls_=t,n.withCredentials=s,n.handleManifestRedirects=o;var u=t.options_;if(n.customTagParsers=u&&u.customTagParsers||[],n.customTagMappers=u&&u.customTagMappers||[],!n.srcUrl)throw new Error("A non-empty playlist URL is required");return n.state="HAVE_NOTHING",n.on("mediaupdatetimeout",(function(){"HAVE_METADATA"===n.state&&(n.state="HAVE_CURRENT_METADATA",n.request=n.hls_.xhr({uri:ja(n.master.uri,n.media().uri),withCredentials:n.withCredentials},(function(e,t){if(n.request)return e?n.playlistRequestError(n.request,n.media().uri,"HAVE_METADATA"):void n.haveMetadata(n.request,n.media().uri)})))})),n}function io(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}function no(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 io(t,i,n)}function ro(e,t,i){var n=0;if(i<t){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}function so(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--&&!(n<=(i+=e.segments[t].duration)););return Math.max(0,t)}function ao(e,t,i){if(!e||!e.segments)return null;if(e.endList)return no(e);if(null===t)return null;t=t||0;var n=i?so(e):e.segments.length;return io(e,e.mediaSequence+n,t)}function oo(e){return e-Math.floor(e)==0}function uo(e,t){if(oo(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(oo(s)||n===i)return(s+e)/r}}function lo(e){return e.excludeUntil&&e.excludeUntil>Date.now()}function co(e){return e.excludeUntil&&e.excludeUntil===1/0}function ho(e){var t=lo(e);return!e.disabled&&!t}function po(e,t){return t.attributes&&t.attributes[e]}function fo(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!!ho(e)&&(e.attributes.BANDWIDTH||0)<i})).length}function mo(){return function e(t,i){t=Mo({timeout:45e3},t);var n=e.beforeRequest||Kr.Hls.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);r&&(t=r)}var s=Uo(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}}function go(e){var t={};return e.byterange&&(t.Range=function(e){var t;return t=e.offset+e.length-1,"bytes="+e.offset+"-"+t}(e.byterange)),t}function vo(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")}function yo(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function _o(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}function bo(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function To(e){return e.resolvedUri}function So(e){for(var t=Array.prototype.slice.call(e),i="",n=0;n<t.length/16;n++)i+=t.slice(16*n,16*n+16).map(vo).join("")+" "+t.slice(16*n,16*n+16).map(yo).join("")+"\n";return i}function ko(e){var t=e.programTime,i=e.playlist,n=e.retryCount,r=void 0===n?2:n,s=e.seekTo,a=e.pauseAfterSeek,o=void 0===a||a,u=e.tech,l=e.callback;if(!l)throw new Error("seekToProgramTime: callback must be provided");if(void 0===t||!i||!s)return l({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!i.endList&&!u.hasStarted_)return l({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}(i))return l({message:"programDateTime tags must be provided in the manifest "+i.resolvedUri});var c=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=t.segments[t.segments.length-1],a=s.dateTimeObject,o=s.videoTimingInfo?function(e){return e.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds}(s.videoTimingInfo):s.duration+.25*s.duration;return new Date(a.getTime()+1e3*o)<i?null:(a<i&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Ro.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(t,i);if(!c)return l({message:t+" was not found in the stream"});var h=c.segment,d=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}(h.dateTimeObject,t);if("estimate"===c.type)return 0===r?l({message:t+" is not buffered yet. Try again"}):(s(c.estimatedStart+d),void u.one("seeked",(function(){ko({programTime:t,playlist:i,retryCount:r-1,seekTo:s,pauseAfterSeek:o,tech:u,callback:l})})));var p=h.start+d;u.one("seeked",(function(){return l(null,u.currentTime())})),o&&u.pause(),s(p)}function Co(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 Kr.createTimeRanges(i)}function Eo(e,t){return Co(e,(function(e,i){return e-.1<=t&&t<=i+.1}))}function wo(e,t){return Co(e,(function(e){return t<=e-1/30}))}function Lo(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(", ")}function Po(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}function Ao(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)}function Io(e){return isNaN(e)||Math.abs(e)===1/0?Number.MAX_VALUE:e}var xo=Kr.createTimeRange,Oo=uo.bind(null,1),Do=uo.bind(null,-1),Ro={duration:no,seekable:function(e,t){var i=t||0,n=ao(e,t,!0);return null===n?xo():xo(i,n)},safeLiveIndex:so,getMediaInfoForTime:function(e,t,i,n){var r=void 0,s=void 0,a=e.segments.length,o=t-n;if(o<0){if(0<i)for(r=i-1;0<=r;r--)if(s=e.segments[r],0<(o+=Do(s.duration)))return{mediaIndex:r,startTime:n-ro(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-=Oo(s.duration))<0)return{mediaIndex:r,startTime:n+ro(e,i,r)};return{mediaIndex:a-1,startTime:t}},isEnabled:ho,isDisabled:function(e){return e.disabled},isBlacklisted:lo,isIncompatible:co,playlistEnd:ao,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:po,estimateSegmentRequestTime:function(e,t,i,n){var r=3<arguments.length&&void 0!==n?n:0;return po("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*r)/t:NaN},isLowestEnabledRendition:fo},Uo=Kr.xhr,Mo=Kr.mergeOptions,No=Object.freeze({createTransferableMessage:_o,initSegmentId:bo,segmentKeyId:To,hexDump:So,tagDump:function(e){return So(e.bytes)},textRanges:function(e){var t,i,n="",r=void 0;for(r=0;r<e.length;r++)n+=(i=r,(t=e).start(i)+"-"+t.end(i)+" ");return n}}),Bo="undefined"!=typeof window?window:{},jo="undefined"==typeof Symbol?"__target":Symbol(),Fo=Bo.BlobBuilder||Bo.WebKitBlobBuilder||Bo.MozBlobBuilder||Bo.MSBlobBuilder,Ho=Bo.URL||Bo.webkitURL||Ho&&Ho.msURL,Vo=Bo.Worker;function qo(e,t){return function(i){var n=this;if(!t)return new Vo(e);if(Vo&&!i){var r=Ko(t.toString().replace(/^function.+?{/,"").slice(0,-1));return this[jo]=new Vo(r),function(e,t){if(e&&t){var i=e.terminate;e.objURL=t,e.terminate=function(){e.objURL&&Ho.revokeObjectURL(e.objURL),i.call(e)}}}(this[jo],r),this[jo]}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(Vo){var Wo,zo=Ko("self.onmessage = function () {}"),Go=new Uint8Array(1);try{(Wo=new Vo(zo)).postMessage(Go,[Go.buffer])}catch(e){Vo=null}finally{Ho.revokeObjectURL(zo),Wo&&Wo.terminate()}}function Ko(e){try{return Ho.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(i){var t=new Fo;return t.append(e),Ho.createObjectURL(t.getBlob(type))}}function Xo(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)}))}))}function Yo(e){var t,i=0<arguments.length&&void 0!==e?e:"",n={codecCount:0};return n.codecCount=i.split(",").length,n.codecCount=n.codecCount||2,(t=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(i))&&(n.videoCodec=t[2],n.videoObjectTypeIndicator=t[3]),n.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(i),n.audioProfile=n.audioProfile&&n.audioProfile[2],n}function $o(e,t,i){return e+"/"+t+'; codecs="'+i.filter((function(e){return!!e})).join(", ")+'"'}function Qo(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(1<i.length){var n=i[0].replace(/"/g,"").trim(),r=i[1].replace(/"/g,"").trim();t.parameters[n]=r}})),t}function Jo(e){return/mp4a\.\d+.\d+/i.test(e)}function Zo(e){return/avc1\.[\da-f]+/i.test(e)}var eu=new qo("./transmuxer-worker.worker.js",(function(e,t){var i=this;!function(){function e(){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),-1<n)},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,L,P,A,I,x,O,D,R,U,M,N,B,j,F,H,V=e,q=Math.pow(2,32)-1;function W(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}function z(e){for(var t=[];e--;)t.push(0);return t}function G(){G.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new fe(0,0),new fe(0,1),new fe(1,0),new fe(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)}!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]),L=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]),P=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:L,audio:P},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/(1+q)),o=Math.floor(e.baseMediaDecodeTime%(1+q)),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 K,X,Y,$,Q,J=function(e){return t(k.mdat,e)},Z=u,ee=function(e){var t,i=s(),n=l(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t},te=[33,16,5,32,164,27],ie=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ne={96e3:[te,[227,64],z(154),[56]],88200:[te,[231],z(170),[56]],64e3:[te,[248,192],z(240),[56]],48e3:[te,[255,192],z(268),[55,148,128],z(54),[112]],44100:[te,[255,192],z(268),[55,163,128],z(84),[112]],32e3:[te,[255,192],z(268),[55,234],z(226),[112]],24e3:[te,[255,192],z(268),[55,255,128],z(268),[111,112],z(126),[224]],16e3:[te,[255,192],z(268),[55,255,128],z(268),[111,255],z(269),[223,108],z(195),[1,192]],12e3:[ie,z(268),[3,127,248],z(268),[6,255,240],z(268),[13,255,224],z(268),[27,253,128],z(259),[56]],11025:[ie,z(268),[3,127,248],z(268),[6,255,240],z(268),[13,255,224],z(268),[27,255,192],z(268),[55,175,128],z(108),[112]],8e3:[ie,z(268),[3,121,16],z(47),[7]]},re=(K=ne,Object.keys(K).reduce((function(e,t){return e[t]=new Uint8Array(K[t].reduce((function(e,t){return e.concat(t)}),[])),e}),{})),se=(X=function(e){return 9e4*e},Y=function(e,t){return e*t},$=function(e){return e/9e4},Q=function(e,t){return e/t},function(e,t){return X(Q(e,t))}),ae=function(e,t,i){return $(i?e:e-t)},oe=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},ue=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},le=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))};function ce(e){return null===e?"":(e=de[e]||e,String.fromCharCode(e))}function he(){for(var e=[],t=15;t--;)e.push("");return e}(G.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,r=n=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[2+r]&&(s.ccData=t[3+r]<<8|t[4+r],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}},G.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},G.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)},G.prototype.flush=function(){return this.flushStream("flush")},G.prototype.partialFlush=function(){return this.flushStream("partialFlush")},G.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},G.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)},G.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},G.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},G.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var de={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},pe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],fe=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_=he();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=he();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=he()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))s=ce((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=ce((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=pe.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=ce(n),s+=ce(r),this[this.mode_](e.pts,s),this.column_+=s.length)}else this.lastControlCode_=null}};function me(e,t){var i=1;for(t<e&&(i=-1);4294967296<Math.abs(t-e);)e+=8589934592*i;return e}function ge(e){var t,i;ge.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=me(e.dts,i),e.pts=me(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){t=i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}}fe.prototype=new V,fe.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e){try{return e.trim()}catch(e){return""}})).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},fe.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=he(),this.nonDisplayed_=he(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},fe.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_},fe.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},fe.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},fe.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},fe.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},fe.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&64<=t&&t<=127},fe.prototype.isColorPAC=function(e){return 64<=e&&e<=79||96<=e&&e<=127},fe.prototype.isNormalChar=function(e){return 32<=e&&e<=127},fe.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=he(),this.displayed_=he()),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},fe.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)},fe.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)}},fe.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},fe.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},fe.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_]=""},fe.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var ve={CaptionStream:G,Cea608Stream:fe},ye={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21};function _e(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r}function be(e,t,i){return decodeURIComponent(_e(e,t,i))}function Te(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}ge.prototype=new V;var Se,ke=ge,Ce={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=be(e.data,1,t),e.value=be(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=be(e.data,1,t),e.url=be(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(_e(i,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Se=function(e){var t,i={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},n=0,r=[],s=0;if(Se.prototype.init.call(this),this.dispatchType=ye.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;else if(r.push(e),s+=e.data.byteLength,1===r.length&&(n=Te(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+=Te(t.data.subarray(10,14)),n-=Te(t.data.subarray(16,20)));do{if((o=Te(t.data.subarray(a+4,a+8)))<1)return;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,Ce[u.id]&&(Ce[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 Ee,we,Le,Pe=Se,Ae=ke;(Ee=function(){var e=new Uint8Array(188),t=0;Ee.prototype.init.call(this),this.push=function(i){var n,r=0,s=188;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+=188,s+=188);r<n.byteLength&&(e.set(n.subarray(r),0),t=n.byteLength-r)},this.flush=function(){188===t&&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,(we=function(){var e,t,i,n;we.prototype.init.call(this),(n=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===ye.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=a:s===ye.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=a:s===ye.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],1<(48&t[3])>>>4&&(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=ye.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=ye.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,we.STREAM_TYPES={h264:27,adts:15},(Le=function(){function e(e,t,n){var r,s,a=new Uint8Array(e.size),o={type:t},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;!function(e,t){var i;t.packetLength=6+(e[4]<<8|e[5]),t.dataAlignmentIndicator=0!=(4&e[6]),192&(i=e[7])&&(t.pts=(14&e[9])<<27|(255&e[10])<<20|(254&e[11])<<12|(255&e[12])<<5|(254&e[13])>>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8])}(a,o),r="video"===t||o.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&i.trigger("data",o)}}var t,i=this,n={data:[],size:0},r={data:[],size:0},s={data:[],size:0};Le.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var t,i;switch(a.streamType){case ye.H264_STREAM_TYPE:case ye.H264_STREAM_TYPE:t=n,i="video";break;case ye.ADTS_STREAM_TYPE:t=r,i="audio";break;case ye.METADATA_STREAM_TYPE:t=s,i="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&e(t,i,!0),t.data.push(a),t.size+=a.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=a.programMapTable).video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i.trigger("data",e)}})[a.type]()},this.reset=function(){n.size=0,n.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){e(n,"video"),e(r,"audio"),e(s,"timed-metadata")},this.flush=function(){this.flushStreams_(),this.trigger("done")}}).prototype=new V;var Ie={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:Ee,TransportParseStream:we,ElementaryStream:Le,TimestampRolloverStream:Ae,CaptionStream:ve.CaptionStream,Cea608Stream:ve.Cea608Stream,MetadataStream:Pe};for(var xe in ye)ye.hasOwnProperty(xe)&&(Ie[xe]=ye[xe]);var Oe,De=Ie,Re=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(Oe=function(e){var t,i=0;Oe.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])))/Re[(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:Re[(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 Ue,Me,Ne,Be=Oe,je=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;e<n||(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 0<(n-=r)?i<<=r:0<t&&this.loadWord(),0<(r=e-r)?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()};(Me=function(){var e,t,i=0;Me.prototype.init.call(this),this.push=function(n){for(var r,s=(t=t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),r):n.data).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}for(i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));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&&3<t.byteLength&&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,Ne={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Ue=function(){var e,t,i,n,r,s,a,o=new Me;Ue.prototype.init.call(this),(e=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 je(e)).readUnsignedByte(),r=t.readUnsignedByte(),n=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),Ne[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 Fe,He={H264Stream:Ue,NalByteStream:Me},Ve=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?20+i:10+i},qe=function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i};function We(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}function ze(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}}(Fe=function(){var e=new Uint8Array,t=0;Fe.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;3<=e.length-u;)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=qe(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=Ve(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=0<n?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 Ge,Ke,Xe,Ye,$e=Fe,Qe=He.H264Stream,Je=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Ze=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"];(Ke=function(e,t){var i=[],n=0,r=0,s=0,a=1/0;t=t||{},Ke.prototype.init.call(this),this.push=function(t){le(e,t),e&&Je.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=ue(e,t.keepOriginalTimestamps),function(e,t,i,n){var r,s,a,o,u,l=0,c=0,h=0;if(t.length&&(r=se(e.baseMediaDecodeTime,e.samplerate),s=Math.ceil(9e4/(e.samplerate/1024)),i&&n&&(l=r-Math.max(i,n),h=(c=Math.floor(l/s))*s),!(c<1||45e3<h))){for(a=(a=re[e.samplerate])||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(function(e,t){return Y($(e),t)}(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),oe(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.reset=function(){oe(e),i=[],this.trigger("reset")}}).prototype=new V,(Ge=function(e,t){var i,n,r=0,s=[],a=[];t=t||{},Ge.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){le(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],Ze.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,p=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(i=function(e){var t,i,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,t=n.byteLength=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),(o=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}(i))[0][0].keyFrame||((n=this.getGopForFusion_(s[0],e))?(p=n.duration,o.unshift(n),o.byteLength+=n.byteLength,o.nalCount+=n.nalCount,o.pts=n.pts,o.dts=n.dts,o.duration+=n.duration):o=function(e){var t;return!e[0][0].keyFrame&&1<e.length&&(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}(o)),a.length){var f;if(!(f=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),s=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");oe(e),o=f}le(e,o),e.samples=function(e,t){var i,n,r,s,a=0,o=[];for(i=0;i<e.length;i++)for(s=e[i],n=0;n<s.length;n++)a+=(r=W(s[n],a)).size,o.push(r);return o}(o),l=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}(o)),e.baseMediaDecodeTime=ue(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),h=o[0],d=o[o.length-1],this.trigger("segmentTimingInfo",ze(e.baseMediaDecodeTime,h.dts,h.pts,d.dts+d.duration,d.pts+d.duration,p)),this.trigger("timingInfo",{start:o[0].dts,end:o[o.length-1].dts+o[o.length-1].duration}),this.gopCache_.unshift({gop:o.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),u=Z(r,[e]),c=new Uint8Array(u.byteLength+l.byteLength),r++,c.set(u),c.set(l,u.byteLength),this.trigger("data",{track:e,boxes:c}),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(){oe(e),n=i=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&&We(e.pps[0],s.pps[0])&&e.sps&&We(e.sps[0],s.sps[0])&&(r.dts<e.timelineStartInfo.dts||-1e4<=(i=t.dts-r.dts-r.duration)&&i<=45e3&&(!n||i<o)&&(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;0<=t&&0<=i;){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,(Ye=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,Ye.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,Ye.prototype.flush=function(e){var t,i,n,r,s=0,a={captions:[],captionStreams:{},metadata:[],info:{}},o=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?(o=this.videoTrack.timelineStartInfo.pts,Ze.forEach((function(e){a.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,Je.forEach((function(e){a.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?a.type=this.pendingTracks[0].type:a.type="combined",this.emittedTracks+=this.pendingTracks.length,n=ee(this.pendingTracks),a.initSegment=new Uint8Array(n.byteLength),a.initSegment.set(n),a.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)a.data.set(this.pendingBoxes[r],s),s+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=ae(t.startPts,o,this.keepOriginalTimestamps),t.endTime=ae(t.endPts,o,this.keepOriginalTimestamps),a.captionStreams[t.stream]=!0,a.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=ae(i.pts,o,this.keepOriginalTimestamps),a.metadata.push(i);for(a.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",a),r=0;r<a.captions.length;r++)t=a.captions[r],this.trigger("caption",t);for(r=0;r<a.metadata.length;r++)i=a.metadata[r],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ye.prototype.setRemux=function(e){this.remuxTracks=e},(Xe=function(e){var t,i,n=this,r=!0;Xe.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};(this.transmuxPipeline_=r).type="aac",r.metadataStream=new De.MetadataStream,r.aacStream=new $e,r.audioTimestampRolloverStream=new De.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new De.TimestampRolloverStream("timed-metadata"),r.adtsStream=new Be,r.coalesceStream=new Ye(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 Ke(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).type="ts",r.metadataStream=new De.MetadataStream,r.packetStream=new De.TransportPacketStream,r.parseStream=new De.TransportParseStream,r.elementaryStream=new De.ElementaryStream,r.timestampRolloverStream=new De.TimestampRolloverStream,r.adtsStream=new Be,r.h264Stream=new Qe,r.captionStream=new De.CaptionStream,r.coalesceStream=new Ye(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 Ge(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 Ke(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,oe(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,oe(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=function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)}(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 et={Transmuxer:Xe,VideoSegmentStream:Ge,AudioSegmentStream:Ke,AUDIO_PROPERTIES:Je,VIDEO_PROPERTIES:Ze,generateVideoSegmentTimingInfo:ze};var tt=(function(e,t,i){t&&function(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)}}(e.prototype,t)}(it,[{key:"init",value:function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new et.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())}}]),it);function it(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,it),this.options=t||{},this.self=e,this.init()}new function(e){e.onmessage=function(t){"init"===t.data.action&&t.data.options?this.messageHandlers=new tt(e,t.data.options):(this.messageHandlers||(this.messageHandlers=new tt(e)),t.data&&t.data.action&&"init"!==t.data.action&&this.messageHandlers[t.data.action]&&this.messageHandlers[t.data.action](t.data))}}(i)}()})),tu={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},iu=(Wa(nu,Kr.EventTarget),Va(nu,[{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/9e4,presentation:e.start.pts/9e4},end:{decode:e.end.dts/9e4,presentation:e.end.pts/9e4},baseMediaDecodeTime:e.baseMediaDecodeTime/9e4};e.prependedContentDuration&&(t.prependedContentDuration=e.prependedContentDuration/9e4),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);function r(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 n.updating=!1,n.realBuffer_=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: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)}(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)),Ao(e,t,this.metadataTrack_),this.inbandTextTracks_)for(var i in this.inbandTextTracks_)Ao(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=Io(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 Kr.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return Kr.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return Kr.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}}]),nu);function nu(e,t){Ha(this,nu);var i=za(this,(nu.__proto__||Object.getPrototypeOf(nu)).call(this,Kr.EventTarget));i.timestampOffset_=0,i.pendingBuffers_=[],i.bufferUpdating_=!1,i.mediaSource_=e,i.codecs_=t,i.audioCodec_=null,i.videoCodec_=null,i.audioDisabled_=!1,i.appendAudioInitSegment_=!0,i.gopBuffer_=[],i.timeMapping_=0,i.safeAppend_=11<=Kr.browser.IE_VERSION;var n={remux:!1,alignGopsAtEnd:i.safeAppend_};return i.codecs_.forEach((function(e){Jo(e)?i.audioCodec_=e:Zo(e)&&(i.videoCodec_=e)})),i.transmuxer_=new eu,i.transmuxer_.postMessage({action:"init",options:n}),i.transmuxer_.onmessage=function(e){return"data"===e.data.action?i.data_(e):"done"===e.data.action?i.done_(e):"gopInfo"===e.data.action?i.appendGopInfo_(e):"videoSegmentTimingInfo"===e.data.action?i.videoSegmentTimingInfo_(e.data.videoSegmentTimingInfo):void 0},Object.defineProperty(i,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(e){"number"==typeof e&&0<=e&&(this.timestampOffset_=e,this.appendAudioInitSegment_=!0,this.gopBuffer_.length=0,this.timeMapping_=0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e}))}}),Object.defineProperty(i,"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(i,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(i,"buffered",{get:function(){return function(e,t,i){var n=null,r=null,s=0,a=[],o=[];if(!e&&!t)return Kr.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 Kr.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]),r=n=null);return Kr.createTimeRanges(o)}(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}}),i}var ru=(Wa(su,Kr.EventTarget),Va(su,[{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=Qo(e);if(/^(video|audio)\/mp2t$/i.test(i.type)){var n=[];i.parameters&&i.parameters.codecs&&(n=(n=Xo(n=i.parameters.codecs.split(","))).filter((function(e){return Jo(e)||Zo(e)}))),0===n.length&&(n=["avc1.4d400d","mp4a.40.2"]),t=new iu(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}}]),su);function su(){Ha(this,su);var i=za(this,(su.__proto__||Object.getPrototypeOf(su)).call(this)),n=void 0;for(n in i.nativeMediaSource_=new e.MediaSource,i.nativeMediaSource_)n in su.prototype||"function"!=typeof i.nativeMediaSource_[n]||(i[n]=i.nativeMediaSource_[n].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)===1/0||(this.nativeMediaSource_.duration=e)}}),Object.defineProperty(i,"seekable",{get:function(){return this.duration_===1/0?Kr.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){n=!(t=!0);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_=Kr(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=Io(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}var au=0;function ou(e,t){var i=Kr.mediaSources[e];if(!i)throw new Error("Media Source not found (Video.js)");i.trigger({type:"sourceopen",swfId:t})}function uu(){return!!e.MediaSource&&!!e.MediaSource.isTypeSupported&&e.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')}function lu(){if(this.MediaSource={open:ou,supportsNativeMediaSources:uu},uu())return new ru;throw new Error("Cannot use create a virtual MediaSource for this video")}Kr.mediaSources={},lu.open=ou,lu.supportsNativeMediaSources=uu;var cu={createObjectURL:function(t){var i=void 0;return t instanceof ru?(i=e.URL.createObjectURL(t.nativeMediaSource_),t.url_=i):t instanceof ru?(i="blob:vjs-media-source/"+au,au++,Kr.mediaSources[i]=t,i):(i=e.URL.createObjectURL(t),t.url_=i)}};function hu(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=Ka(n,t.playlists[r]);s?n=s:i=!0}return Ga(t,(function(e,t,r,s){if(e.playlists&&e.playlists.length){var a=e.playlists[0].uri,o=Ka(n,e.playlists[0]);o&&((n=o).mediaGroups[t][r][s].playlists[0]=n.playlists[a],i=!1)}})),i?null:n}function du(e){var t=e.byterange.offset+e.byterange.length-1;return e.uri+"-"+e.byterange.offset+"-"+t}function pu(e,t){var i,n,r={};for(var s in e){var a=e[s].sidx;if(a){var o=du(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}function fu(e,t,i,n,r){var s={uri:Fa(n.handleManifestRedirects,e.resolvedUri),byterange:e.byterange,playlist:t};return i(Kr.mergeOptions(s,{responseType:"arraybuffer",headers:go(s)}),r)}Kr.MediaSource=lu,Kr.URL=cu;var mu=Kr.mergeOptions,gu=(Wa(vu,Kr.EventTarget),Va(vu,[{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=Xs.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;a=this.masterPlaylistLoader_?(s=this.masterPlaylistLoader_.master,this.masterPlaylistLoader_.sidxMapping_):(s=this.master,this.sidxMapping_);var o=du(t.sidx);a[o]={sidxInfo:t.sidx},this.request=fu(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=Ds(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 Ga(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]}})),Xa(e),Ya(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=this,i=function(e){var t=Ts(e,"UTCTiming")[0];if(!t)return null;var i=Cs(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}(Os(this.masterXml_));return null===i?(this.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.clientOffset_=i.value-Date.now(),e()):void(this.request=this.hls_.xhr({uri:ja(this.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n)return t.clientOffset_=t.masterLoaded_-Date.now(),e();var s;s="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText),t.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=Ds(e,{manifestUri:t,clientOffset:i}),s=pu(r.playlists,n);return Ga(r,(function(e,t,i,r){if(e.playlists&&e.playlists.length){var a=e.playlists;s=mu(s,pu(a,n))}})),s}(t.masterXml_,t.srcUrl,t.clientOffset_,t.sidxMapping_);var r=t.parseMasterXml(),s=hu(t.master,r),a=t.media().sidx;if(s)if(a){var o=du(a);if(!t.sidxMapping_[o]){var u=t.media();t.request=fu(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,r=void 0;n=this.masterPlaylistLoader_?(r=this.masterPlaylistLoader_.master,this.masterPlaylistLoader_.parseMasterXml()):(r=this.master,this.parseMasterXml());var s=hu(r,n);s?(this.masterPlaylistLoader_?this.masterPlaylistLoader_.master=s:this.master=s,this.media_=s.playlists[t]):(this.media_=n.playlists[t],this.trigger("playlistunchanged")),this.media().endList||(this.mediaUpdateTimeout=e.setTimeout((function(){i.trigger("mediaupdatetimeout")}),$a(this.media(),!!s))),this.trigger("loadedplaylist")}}]),vu);function vu(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=arguments[3];Ha(this,vu);var r=za(this,(vu.__proto__||Object.getPrototypeOf(vu)).call(this)),s=i.withCredentials,a=void 0!==s&&s,o=i.handleManifestRedirects,u=void 0!==o&&o;if(r.hls_=t,r.withCredentials=a,r.handleManifestRedirects=u,!e)throw new Error("A non-empty playlist URL or playlist is required");return r.on("minimumUpdatePeriod",(function(){r.refreshXml_()})),r.on("mediaupdatetimeout",(function(){r.refreshMedia_(r.media().uri)})),r.state="HAVE_NOTHING",r.loadedPlaylists_={},"string"==typeof e?(r.srcUrl=e,r.sidxMapping_={},za(r)):(r.setupChildLoader(n,e),r)}function yu(e){return Kr.log.debug?Kr.log.debug.bind(Kr,"VHS:",e+" >"):function(){}}function _u(){}var bu=(Va(Tu,[{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 ["+Lo(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:Kr.createTimeRanges()}},{key:"remove",value:function(e,t,i){var n=this,r=2<arguments.length&&void 0!==i?i:_u;this.processedAppend_&&this.queueCallback_((function(){n.logger_("remove ["+e+" => "+t+"]"),n.sourceBuffer_.removing=!0,n.sourceBuffer_.remove(e,t)}),r)}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||!!this.pendingCallback_&&this.pendingCallback_!==_u}},{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(){function e(){t.sourceBuffer_&&"open"===t.mediaSource.readyState&&t.sourceBuffer_.abort(),t.sourceBuffer_.removeEventListener("updateend",e)}var t=this;this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_),this.sourceBuffer_.removing?this.sourceBuffer_.addEventListener("updateend",e):e()}}]),Tu);function Tu(e,t,i,n){Ha(this,Tu),this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=e,this.processedAppend_=!1,this.type_=i,this.mimeType_=t,this.logger_=yu("SourceUpdater["+i+"]["+t+"]"),"closed"===e.readyState?e.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,t,n)):this.createSourceBuffer_(t,n)}function Su(e){e.forEach((function(e){e.abort()}))}function ku(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Iu,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:xu,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Au,xhr:t}:null}function Cu(t,i){var n;return t&&(n=e.getComputedStyle(t))?n[i]:""}function Eu(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}))}function wu(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)}function Lu(e){return"number"==typeof e&&isFinite(e)}var Pu={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},Au=2,Iu=-101,xu=-102,Ou=(Wa(Du,Kr.EventTarget),Va(Du,[{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():Kr.createTimeRanges()}},{key:"initSegment",value:function(e,t){var i=1<arguments.length&&void 0!==t&&t;if(!e)return null;var n=bo(e),r=this.initSegments_[n];return i&&!r&&e.bytes&&(this.initSegments_[n]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,timescales:e.timescales,videoTrackIds:e.videoTrackIds}),r||e}},{key:"segmentKey",value:function(e,t){var i=1<arguments.length&&void 0!==t&&t;if(!e)return null;var n=To(e),r=this.keyCache_[n];this.cacheEncryptionKeys_&&i&&!r&&e.bytes&&(this.keyCache_[n]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});var s={resolvedUri:(r||e).resolvedUri};return r&&(s.bytes=r.bytes),s}},{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 bu(this.mediaSource_,this.mimeType_,this.loaderType_,this.sourceBufferEmitter_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(e,t){var i=1<arguments.length&&void 0!==t?t:{};if(e){var n=this.playlist_,r=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=i,this.hasPlayed_()||(e.syncInfo={mediaSequence:e.mediaSequence,time:0});var s=null;if(n&&(n.id?s=n.id:n.uri&&(s=n.uri)),this.logger_("playlist update ["+s+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(n&&n.uri===e.uri){var a=e.mediaSequence-n.mediaSequence;this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex&&(this.mediaIndex-=a),r&&(r.mediaIndex-=a,0<=r.mediaIndex&&(r.segment=e.segments[r.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(n,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),Ao(e,t,this.segmentMetadataTrack_),this.inbandTextTracks_)for(var n in this.inbandTextTracks_)Ao(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,t){return function(e,t,i){if(!e||!t)return!1;var n=i===e.segments.length;return e.endList&&"open"===t.readyState&&n}(1<arguments.length&&void 0!==t?t:this.playlist_,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&&1<=u)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=Ro.getMediaInfoForTime(t,a,s.segmentIndex,s.time);i=l.mediaIndex,o=l.startTime}else{var c=Ro.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=Ro.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),s=function(e,t,i){var n=2<arguments.length&&void 0!==i?i:1;return((e.length?e.end(e.length-1):0)-t)/n}(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!Ro.isIncompatible(e)})),l=u.filter(Ro.isEnabled);l.length||(l=u.filter((function(e){return!Ro.isDisabled(e)})));var c=l.filter(Ro.hasAttribute.bind(null,"BANDWIDTH")).map((function(e){var u=o.getSyncPoint(e,n,a,t)?1:2;return{playlist:e,rebufferingImpact:Ro.estimateSegmentRequestTime(r,i,e)*u-s}})),h=c.filter((function(e){return e.rebufferingImpact<=0}));return Eu(h,(function(e,t){return wu(t.playlist,e.playlist)})),h.length?h[0]:(Eu(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<=1/30&&(u=1),!(!a.playlist||a.playlist.uri===this.playlist_.uri||o<u||(this.bandwidth=a.playlist.attributes.BANDWIDTH*Pu.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=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,Su(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(_o({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(Kr.mergeOptions(t,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),function(e,t){return function(i,n){var r=n.response,s=ku(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:Au,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(Kr.mergeOptions(t,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:go(r.map)}),function(e,t,i){return function(n,r){var s=r.response,a=ku(n,r);return a?i(a,e):0===s.byteLength?i({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:Au,xhr:r},e):(e.map.bytes=new Uint8Array(r.response),t&&!t.isInitialized()&&t.init(),e.map.timescales=Js.timescale(e.map.bytes),e.map.videoTrackIds=Js.videoTrackIds(e.map.bytes),i(null,e))}}(r,n,u));o.push(c)}var h=e(Kr.mergeOptions(t,{uri:r.resolvedUri,responseType:"arraybuffer",headers:go(r)}),function(e,t,i){return function(n,r){var s=r.response,a=ku(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:Au,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){return e.stats=Kr.mergeOptions(e.stats,function(e){var t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i}(i)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)}}(r,s)),o.push(h),function(){return Su(o)}}(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&&0<e.start(0)&&e.start(0)<t?e.start(0):t-30,Math.min(n,t-i)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0<t&&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",e.code===xu?void(this.mediaRequestsAborted+=1):(this.pause(),e.code===Iu?(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=function(e,t,i){return"main"===e&&t&&i?i.containsAudio||i.containsVideo?t.containsVideo&&!i.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.":!t.containsVideo&&i.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}(this.loaderType_,this.startingMedia_,n);if(r)return this.error({message:r,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 s=n.segmentTimestampInfo[0].ptsTime,a=n.segmentTimestampInfo[0].dtsTime;t.timestampOffset-=s-a}this.sourceUpdater_.timestampOffset(t.timestampOffset),this.trigger("timestampoffset")}var o=this.syncController_.mappingForTimeline(t.timeline);if(null!==o&&this.trigger({type:"segmenttimemapping",mapping:o}),this.state="APPENDING",i.map){var u=bo(i.map);if(!this.activeInitSegmentId_||this.activeInitSegmentId_!==u){var l=this.initSegment(i.map);this.sourceUpdater_.appendBuffer({bytes:l.bytes},(function(){e.activeInitSegmentId_=u}))}}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(Lu(n)&&Lu(r)){Ao(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)}}}}]),Du);function Du(e){Ha(this,Du);var t=za(this,(Du.__proto__||Object.getPrototypeOf(Du)).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 ca: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_=yu("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}function Ru(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))}var Uu=new Uint8Array("\n\n".split("").map((function(e){return e.charCodeAt(0)}))),Mu=(Wa(Nu,Ou),Va(Nu,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return Kr.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return Kr.createTimeRanges([[t,i]])}},{key:"initSegment",value:function(e,t){var i=1<arguments.length&&void 0!==t&&t;if(!e)return null;var n=bo(e),r=this.initSegments_[n];if(i&&!r&&e.bytes){var s=Uu.byteLength+e.bytes.byteLength,a=new Uint8Array(s);a.set(e.bytes),a.set(Uu,e.bytes.byteLength),this.initSegments_[n]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return r||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){Ao(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(i){return this.error({message:i.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){Kr.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}}]),Nu);function Nu(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};Ha(this,Nu);var i=za(this,(Nu.__proto__||Object.getPrototypeOf(Nu)).call(this,e,t));return i.mediaSource_=null,i.subtitlesTrack_=null,i}function Bu(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}var ju=[{name:"VOD",run:function(e,t,i,n,r){return i===1/0?null:{time:0,segmentIndex:0}}},{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||c<=o)&&(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||h<=a)&&(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=(Wa(Hu,Kr.EventTarget),Va(Hu,[{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 0<n.segmentIndex&&(n.time*=-1),Math.abs(n.time+ro(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;0<=i;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=Js.timescale(t.map.bytes),n=Js.compositionStartTime(i,e.bytes);return null!==e.timestampOffset&&(e.timestampOffset-=n),{start:n,end:n+t.duration}}},{key:"probeTsSegment_",value:function(e){var t=function(e,t){var i;return(i=ba.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,s=null,a=0,o=0;3<=e.length-o;){switch(ba.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((a=ba.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===s&&(t=e.subarray(o,o+a),s=ba.aac.parseAacTimestamp(t)),o+=a;break;case"audio":if(e.length-o<7){i=!0;break}if((a=ba.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+a),r=ba.aac.parseSampleRate(t)),n++,o+=a;break;default:o++}if(i)return null}if(null===r||null===s)return null;var u=ka/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=Ca;r<e.byteLength;)if(71!==e[n]||71!==e[r])n++,r++;else{switch(i=e.subarray(n,r),ba.ts.parseType(i,t.pid)){case"pat":t.pid||(t.pid=ba.ts.parsePat(i));break;case"pmt":t.table||(t.table=ba.ts.parsePmt(i))}if(t.pid&&t.table)return;n+=Ca,r+=Ca}}(e,t),t.table)if(t.table.hasOwnProperty(n))switch(t.table[n]){case 27:i.video=[],Sa(e,t,i),0===i.video.length&&delete i.video;break;case 15:i.audio=[],Ta(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=_a(e.dts,i),e.pts=_a(e.pts,i),e.dtsTime=e.dts/ka,e.ptsTime=e.pts/ka}))}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=_a(e.dts,n),e.pts=_a(e.pts,n),e.dtsTime=e.dts/ka,e.ptsTime=e.pts/ka})),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=_a(r.dts,n),r.pts=_a(r.pts,n),r.dtsTime=r.dts/ka,r.ptsTime=r.dts/ka}}}(i,t),i):null}(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,s=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,o=s-e.mediaIndex,u=Math.abs(o);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>u)r=o<0?i.start-ro(t,e.mediaIndex,s):i.end+ro(t,e.mediaIndex+1,s),this.discontinuities[a]={time:r,accuracy:u}}}}]),Hu);function Hu(){Ha(this,Hu);var e=za(this,(Hu.__proto__||Object.getPrototypeOf(Hu)).call(this));return e.inspectCache_=void 0,e.timelines=[],e.discontinuities=[],e.datetimeToDisplayTime=null,e.logger_=yu("SyncController"),e}function Vu(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)}function qu(e,t){(t.activePlaylistLoader=e).load()}var Wu=new qo("./decrypter-worker.worker.js",(function(e,t){var i,n,r,s,a,o,u;function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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)}}function h(e){l(this,h),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,f=16843009*u[h=u[c=u[r[n[a]=d]=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 t=void 0,i=void 0,r=void 0,s=void 0,a=void 0,o=this._tables[0][4],u=this._tables[1],c=e.length,d=1;if(4!==c&&6!==c&&8!==c)throw new Error("Invalid aes key size");for(s=e.slice(0),a=[],this._key=[s,a],t=c;t<4*c+28;t++)r=s[t-1],(t%c==0||8===c&&t%c==4)&&(r=o[r>>>24]<<24^o[r>>16&255]<<16^o[r>>8&255]<<8^o[255&r],t%c==0&&(r=r<<8^r>>>24^d<<24,d=d<<1^283*(d>>7))),s[t]=s[t-c]^r;for(i=0;t;i++,t--)r=s[3&i?t:t-4],a[i]=t<=4||i<4?r:u[0][o[r>>>24]]^u[1][o[r>>16&255]]^u[2][o[r>>8&255]]^u[3][o[255&r]]}function d(){l(this,d),this.listeners={}}function p(){l(this,p);var e=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,a.call(this,s));return e.jobs=[],e.delay=1,e.timeout_=null,e}function f(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}function m(e,t,i,n){l(this,m);var r=m.STEP,s=new Int32Array(e.buffer),a=new Uint8Array(e.byteLength),u=0;for(this.asyncStream_=new o,this.asyncStream_.push(this.decryptChunk_(s.subarray(u,u+r),t,i,a)),u=r;u<s.length;u+=r)i=new Uint32Array([f(s[u-4]),f(s[u-3]),f(s[u-2]),f(s[u-1])]),this.asyncStream_.push(this.decryptChunk_(s.subarray(u,u+r),t,i,a));this.asyncStream_.push((function(){n(null,function(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}(a))}))}i=function(e,t,i){return t&&c(e.prototype,t),i&&c(e,i),e},n=null,h.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},r=h,d.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},d.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),-1<i},d.prototype.trigger=function(e,t){var i=this.listeners[e];if(i)if(2===arguments.length)for(var n=i.length,r=0;r<n;++r)i[r].call(this,t);else for(var s=Array.prototype.slice.call(arguments,1),a=i.length,o=0;o<a;++o)i[o].apply(this,s)},d.prototype.dispose=function(){this.listeners={}},d.prototype.pipe=function(e){this.on("data",(function(t){e.push(t)}))},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)}(p,a=s=d),p.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},p.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},o=p,m.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),o=new Int32Array(a.buffer),u=void 0,l=void 0,c=void 0,h=void 0,d=void 0,p=void 0,m=void 0,g=void 0,v=void 0;for(u=i[0],l=i[1],c=i[2],h=i[3],v=0;v<n.length;v+=4)d=f(n[v]),p=f(n[v+1]),m=f(n[v+2]),g=f(n[v+3]),s.decrypt(d,p,m,g,o,v),o[v]=f(o[v]^u),o[v+1]=f(o[v+1]^l),o[v+2]=f(o[v+2]^c),o[v+3]=f(o[v+3]^h),u=d,l=p,c=m,h=g;return a}(e,t,i);n.set(s,e.byteOffset)}},i(m,null,[{key:"STEP",get:function(){return 32e3}}]),u=m,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){e.postMessage(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}({source:i.source,decrypted:n}),[n.buffer])}))}}(this)})),zu={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;Vu(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 Kr.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];Kr.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Vu(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,n,r=t.hls,s=t.sourceType,a=t.segmentLoaders[e],o=t.requestOptions,u=t.master.mediaGroups,l=t.mediaTypes[e],c=l.groups,h=l.tracks,d=t.masterPlaylistLoader;for(var p in u[e]&&0!==Object.keys(u[e]).length||(u[e]={main:{default:{default:!0}}}),u[e])for(var f in c[p]||(c[p]=[]),u[e][p]){var m,g=u[e][p][f];if(m=g.resolvedUri?new eo(g.resolvedUri,r,o):g.playlists&&"dash"===s?new gu(g.playlists[0],r,o,d):null,g=Kr.mergeOptions({id:f,playlistLoader:m},g),Gu[e](e,g.playlistLoader,t),c[p].push(g),void 0===h[f]){var v=new Kr.AudioTrack({id:f,kind:(i=g,n=void 0,n=i.default?"main":"alternative",i.characteristics&&0<=i.characteristics.indexOf("public.accessibility.describes-video")&&(n="main-desc"),n),enabled:!1,language:g.language,default:g.default,label:f});h[f]=v}}a.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 eo(f.resolvedUri,n,a):"dash"===r&&(m=new gu(f.playlists[0],n,a,h)),f=Kr.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(Kr.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=(Wa(Ju,Kr.EventTarget),Va(Ju,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;fo(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;Vu(n,s),o&&(o.playlistLoader?(n.resyncLoader(),qu(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;Vu(n,s),o&&(o.playlistLoader?(u!==o.playlistLoader&&(n.track&&n.track(a),n.resetEverything()),qu(o.playlistLoader,s)):r.resetEverything())}}(i,e)}));var s=t.AUDIO.activeGroup(),a=(s.filter((function(e){return e.default}))[0]||s[0]).id;function o(){t.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"hls-audio-change"})}for(var u in t.AUDIO.tracks[a].enabled=!0,t.AUDIO.onTrackChanged(),i.on("mediachange",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanged()}))})),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 Kr.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;fo(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&&1<Object.keys(i.AUDIO[r[0]]).length&&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()<Pu.MAX_BUFFER_LOW_WATER_LINE||t.attributes.BANDWIDTH<i.attributes.BANDWIDTH||s<=r)&&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(){Kr.browser.IE_VERSION||Kr.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(Kr.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 Kr.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){Kr.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<=.1;var s=r.end(r.length-1);return s-n<=.1&&i-s<=.1}},{key:"blacklistCurrentPlaylist",value:function(e,t){var i,n=0<arguments.length&&void 0!==e?e:{},r=t,s=void 0;if(s=n.playlist||this.masterPlaylistLoader_.media(),r=r||n.blacklistDuration||this.blacklistDuration,!s){this.error=n;try{return this.mediaSource.endOfStream("network")}catch(e){return this.trigger("error")}}var a=1===this.masterPlaylistLoader_.master.playlists.filter(ho).length,o=this.masterPlaylistLoader_.master.playlists;return 1===o.length?(Kr.log.warn("Problem encountered with the current HLS playlist. Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(a)):(a&&(Kr.log.warn("Removing all playlists from the blacklist because the last rendition is about to be blacklisted."),o.forEach((function(e){e.excludeUntil!==1/0&&delete e.excludeUntil})),this.tech_.trigger("retryplaylist")),s.excludeUntil=Date.now()+1e3*r,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),i=this.selectPlaylist(),Kr.log.warn("Problem encountered with the current HLS playlist."+(n.message?" "+n.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(i,a))}},{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=Eo(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_=Kr.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 ["+Lo(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}}}},{key:"updateDuration",value:function(){function e(){t.logger_("Setting duration from "+t.mediaSource.duration+" => "+n);try{t.mediaSource.duration=n}catch(e){Kr.log.warn("Failed to set media source duration",e)}t.tech_.trigger("durationchange"),t.mediaSource.removeEventListener("sourceopen",e)}var t=this,i=this.mediaSource.duration,n=Yu.Playlist.duration(this.masterPlaylistLoader_.media()),r=this.tech_.buffered();0<r.length&&(n=Math.max(n,r.end(r.length-1))),i!==n&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",e):e())}},{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?Yo(t.CODECS):tu}(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 s=!(a=!0),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 Yo(r.playlists[0].attributes.CODECS).audioProfile}return null}(e,r.AUDIO)),n.audioProfile||(Kr.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=tu.audioProfile));var l={};n.videoCodec&&(l.video=""+n.videoCodec+n.videoObjectTypeIndicator),n.audioProfile&&(l.audio="mp4a.40."+n.audioProfile);var c=$o("audio",i,[l.audio]),h=$o("video",i,[l.video]),d=$o("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=1<e.length&&-1===e[0].indexOf(",")&&e[0]!==e[1]?new Kr.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){t.attributes.CODECS&&e.MediaSource&&e.MediaSource.isTypeSupported&&!e.MediaSource.isTypeSupported('video/mp4; codecs="'+function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e){return Xo([e])[0]}))}(t.attributes.CODECS)+'"')&&(t.excludeUntil=1/0)}))}},{key:"excludeIncompatibleVariants_",value:function(e){var t=2,i=null,n=void 0;e.attributes.CODECS&&(n=Yo(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=Yo(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,n){var r=2<arguments.length&&void 0!==n?n:0;if(t.segments)for(var s=r,a=void 0,o=0;o<t.segments.length;o++){var u=t.segments[o];if(a=a||Bu(i,s+u.duration/2)){if("cueIn"in u){a.endTime=s,a.adEndTime=s,s+=u.duration,a=null;continue}if(s<a.endTime){s+=u.duration;continue}a.endTime+=u.duration}else if("cueOut"in u&&((a=new e.VTTCue(s,s+u.duration,u.cueOut)).adStartTime=s,a.adEndTime=s+parseFloat(u.cueOut),i.addCue(a)),"cueOutCont"in u){var l,c,h=u.cueOutCont.split("/").map(parseFloat),d=Qa(h,2);l=d[0],c=d[1],(a=new e.VTTCue(s,s+u.duration,"")).adStartTime=s-l,a.adEndTime=a.adStartTime+c,i.addCue(a)}s+=u.duration}}(t,this.cueTagsTrack_,i)}},{key:"goalBufferLength",value:function(){var e=this.tech_.currentTime(),t=Pu.GOAL_BUFFER_LENGTH,i=Pu.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Pu.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)}},{key:"bufferLowWaterLine",value:function(){var e=this.tech_.currentTime(),t=Pu.BUFFER_LOW_WATER_LINE,i=Pu.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Pu.MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,n)}}]),Ju);function Ju(e){Ha(this,Ju);var t=za(this,(Ju.__proto__||Object.getPrototypeOf(Ju)).call(this)),i=e.url,n=e.handleManifestRedirects,r=e.withCredentials,s=e.tech,a=e.bandwidth,o=e.externHls,u=e.useCueTags,l=e.blacklistDuration,c=e.enableLowInitialPlaylist,h=e.sourceType,d=e.seekTo,p=e.cacheEncryptionKeys;if(!i)throw new Error("A non-empty playlist URL is required");Yu=o,t.withCredentials=r,t.tech_=s,t.hls_=s.hls,t.seekTo_=d,t.sourceType_=h,t.useCueTags_=u,t.blacklistDuration=l,t.enableLowInitialPlaylist=c,t.useCueTags_&&(t.cueTagsTrack_=t.tech_.addTextTrack("metadata","ad-cues"),t.cueTagsTrack_.inBandMetadataTrackDispatchType=""),t.requestOptions_={withCredentials:r,handleManifestRedirects:n,timeout:null},t.mediaTypes_=function(){var e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:_u,activeTrack:_u,onGroupChanged:_u,onTrackChanged:_u}})),e}(),t.mediaSource=new Kr.MediaSource,t.mediaSource.addEventListener("sourceopen",t.handleSourceOpen_.bind(t)),t.seekable_=Kr.createTimeRanges(),t.hasPlayed_=function(){return!1},t.syncController_=new Fu(e),t.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,t.decrypter_=new Wu,t.inbandTextTracks_={};var f={hls:t.hls_,mediaSource:t.mediaSource,currentTime:t.tech_.currentTime.bind(t.tech_),seekable:function(){return t.seekable()},seeking:function(){return t.tech_.seeking()},duration:function(){return t.mediaSource.duration},hasPlayed:function(){return t.hasPlayed_()},goalBufferLength:function(){return t.goalBufferLength()},bandwidth:a,syncController:t.syncController_,decrypter:t.decrypter_,sourceType:t.sourceType_,inbandTextTracks:t.inbandTextTracks_,cacheEncryptionKeys:p};return t.masterPlaylistLoader_="dash"===t.sourceType_?new gu(i,t.hls_,t.requestOptions_):new eo(i,t.hls_,t.requestOptions_),t.setupMasterPlaylistLoaderListeners_(),t.mainSegmentLoader_=new Ou(Kr.mergeOptions(f,{segmentMetadataTrack:t.segmentMetadataTrack_,loaderType:"main"}),e),t.audioSegmentLoader_=new Ou(Kr.mergeOptions(f,{loaderType:"audio"}),e),t.subtitleSegmentLoader_=new Mu(Kr.mergeOptions(f,{loaderType:"vtt"}),e),t.setupSegmentLoaderListeners_(),$u.forEach((function(e){t[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(t,e)})),t.logger_=yu("MPC"),t.masterPlaylistLoader_.load(),t}function Zu(e,t,i){Ha(this,Zu);var n=e.masterPlaylistController_,r=n[(e.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(n);if(t.attributes.RESOLUTION){var s=t.attributes.RESOLUTION;this.width=s.width,this.height=s.height}this.bandwidth=t.attributes.BANDWIDTH,this.id=i,this.enabled=function(e,t,i){return function(n){var r=e.master.playlists[t],s=co(r),a=ho(r);return void 0===n?a:(n?delete r.disabled:r.disabled=!0,n===a||s||(i(),n?e.trigger("renditionenabled"):e.trigger("renditiondisabled")),n)}}(e.playlists,t.uri,r)}var el=["seeking","seeked","pause","playing","error"],tl=(Va(il,[{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+.1>=t.end(t.length-1)))return this.techWaiting_();5<=this.consecutiveUpdates&&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)+.1),void 0!==i&&(this.logger_("Trying to seek outside of seekable at time "+t+" with seekable range "+Lo(e)+". Seeking to "+i+"."),this.seekTo(i),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=Eo(this.tech_.buffered(),e);return t.length&&e+3<=t.end(0)?(this.cancelTimer_(),this.seekTo(e),this.logger_("Stopped at "+e+" while inside a buffered region ["+t.start(0)+" -> "+t.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=wo(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(0<r.length){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,n){var r=3<arguments.length&&void 0!==n&&n;if(!e.length)return!1;var s=e.end(e.length-1)+.1;return!i.endList&&r&&(s=e.end(e.length-1)+3*i.targetDuration),s<t}},{key:"beforeSeekableWindow_",value:function(e,t){return!!(e.length&&0<e.start(0)&&t<e.start(0)-.1)}},{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=wo(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)+1/30),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 Kr.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 Kr.createTimeRanges(t)}(e),n=0;n<i.length;n++){var r=i.start(n),s=i.end(n);if(t-r<4&&2<t-r)return{start:r,end:s}}return null}}]),il);function il(t){var i=this;function n(){return i.monitorCurrentTime_()}function r(){return i.techWaiting_()}function s(){return i.cancelTimer_()}function a(){return i.fixesBadSeeks_()}Ha(this,il),this.tech_=t.tech,this.seekable=t.seekable,this.seekTo=t.seekTo,this.allowSeeksWithinUnsafeLiveWindow=t.allowSeeksWithinUnsafeLiveWindow,this.media=t.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=yu("PlaybackWatcher"),this.logger_("initialize"),this.tech_.on("seekablechanged",a),this.tech_.on("waiting",r),this.tech_.on(el,s),this.tech_.on("canplay",n),this.dispose=function(){i.logger_("dispose"),i.tech_.off("seekablechanged",a),i.tech_.off("waiting",r),i.tech_.off(el,s),i.tech_.off("canplay",n),i.checkCurrentTimeTimeout_&&e.clearTimeout(i.checkCurrentTimeTimeout_),i.cancelTimer_()}}function nl(e){!function e(t,i){var n=0,r=0,s=Kr.mergeOptions(rl,i);function a(){r&&t.currentTime(r)}function o(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())}function u(){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);Kr.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}}function l(){t.off("loadedmetadata",a),t.off("error",u),t.off("dispose",l)}t.ready((function(){t.trigger({type:"usage",name:"hls-error-reload-initialized"})})),t.on("error",u),t.on("dispose",l),t.reloadSourceOnError=function(i){l(),e(t,i)}}(this,e)}var rl={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}};Kr.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:eo,Playlist:Ro,Decrypter:Na,AsyncStream:Da,decrypt:Ma,utils:No,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}}));Eu(a,(function(e,t){return e.bandwidth-t.bandwidth}));var o=(a=a.filter((function(e){return!Ro.isIncompatible(e.playlist)}))).filter((function(e){return Ro.isEnabled(e.playlist)}));o.length||(o=a.filter((function(e){return!Ro.isDisabled(e.playlist)})));var u=o.filter((function(e){return e.bandwidth*Pu.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}));Eu(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(Cu(this.tech_.el(),"width"),10),parseInt(Cu(this.tech_.el(),"height"),10),this.limitRenditionByPlayerDimensions)},INITIAL_PLAYLIST_SELECTOR:function(){var e=this.playlists.master.playlists.filter(Ro.isEnabled);return Eu(e,(function(e,t){return wu(e,t)})),e.filter((function(e){return Yo(e.attributes.CODECS).videoCodec}))[0]||null},comparePlaylistBandwidth:wu,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:mo()};function al(e){return/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e)?"hls":/^application\/dash\+xml/i.test(e)?"dash":null}function ol(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"})}["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 Kr.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),Pu[e]},set:function(t){Kr.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?Kr.log.warn("value of Hls."+e+" must be greater than or equal to 0"):Pu[e]=t}})}));var ul="videojs-vhs";function ll(){if(!window.localStorage)return null;var e=window.localStorage.getItem(ul);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}}sl.canPlaySource=function(){return Kr.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")},sl.supportsNativeHls=function(){var e=t.createElement("video");return!!Kr.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),sl.supportsNativeDash=!!Kr.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 Kr.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var cl=(Wa(hl,Kr.getComponent("Component")),Va(hl,[{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=ll();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=Pu.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Pu.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=al(t),this.options_.seekTo=function(e){i.tech_.setCurrentTime(e),i.setCurrentTime(e)},this.masterPlaylistController_=new Qu(this.options_),this.playbackWatcher_=new tl(Kr.mergeOptions(this.options_,{seekable:function(){return i.seekable()},media:function(){return i.masterPlaylistController_.media()}})),this.masterPlaylistController_.on("error",(function(){Kr.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=0<this.throughput?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){Kr.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 Po(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 Po(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){var t=ll();t=t?Kr.mergeOptions(t,e):e;try{window.localStorage.setItem(ul,JSON.stringify(t))}catch(e){return}}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){!function(e){var t=e.playlists;e.representations=function(){return t.master.playlists.filter((function(e){return!co(e)})).map((function(t,i){return new Zu(e,t,t.uri)}))}}(i),function(e){var t=e.masterPlaylistController_.mainSegmentLoader_,i=e.masterPlaylistController_.audioSegmentLoader_,n=Kr.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=Qo(t.mimeType_),a=s.parameters.codecs.split(","),o=void 0,u=void 0;a.forEach((function(e){Jo(e=e.trim())?o=e:Zo(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 Kr.mergeOptions(e,l)}(e.source_.keySystems,t,i);r&&(n.currentSource().keySystems=r,11!==Kr.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(Kr.URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"setupQualityLevels_",value:function(){var e=this,t=Kr.players[this.tech_.options_.playerId];t&&t.qualityLevels&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){!function(e,t){t.representations().forEach((function(t){e.addQualityLevel(t)})),ol(e,t.playlists)}(e.qualityLevels_,e)})),this.playlists.on("mediachange",(function(){ol(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,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}(hl.prototype.__proto__||Object.getPrototypeOf(hl.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(i<e){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,i,n){var r=!(2<arguments.length&&void 0!==i)||i,s=3<arguments.length&&void 0!==n?n:2;return ko({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:s,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}]),hl);function hl(e,i,n){Ha(this,hl);var r=za(this,(hl.__proto__||Object.getPrototypeOf(hl)).call(this,i,n.hls));if(i.options_&&i.options_.playerId){var s=Kr(i.options_.playerId);s.hasOwnProperty("hls")||Object.defineProperty(s,"hls",{get:function(){return Kr.log.warn("player.hls is deprecated. Use player.tech().hls instead."),i.trigger({type:"usage",name:"hls-player-access"}),r},configurable:!0}),s.vhs=r,(s.dash=r).player_=s}if(r.tech_=i,r.source_=e,r.stats={},r.setOptions_(),r.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks)i.overrideNativeAudioTracks(!0),i.overrideNativeVideoTracks(!0);else if(r.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return r.on(t,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(function(e){var i=t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement;i&&i.contains(r.tech_.el())&&r.masterPlaylistController_.smoothQualityChange_()})),r.on(r.tech_,"seeking",(function(){0===this.tech_.currentTime()&&this.tech_.player_.loop()&&this.setCurrentTime(0)})),r.on(r.tech_,"error",(function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()})),r.on(r.tech_,"play",r.play),r}var dl={name:"videojs-http-streaming",VERSION:"1.11.2",canHandleSource:function(e,t){var i=Kr.mergeOptions(Kr.options,1<arguments.length&&void 0!==t?t:{});return dl.canPlayType(e.type,i)},handleSource:function(e,t,i){var n=Kr.mergeOptions(Kr.options,2<arguments.length&&void 0!==i?i:{});return t.hls=new cl(e,t,n),t.hls.xhr=mo(),t.hls.src(e.src,e.type),t.hls},canPlayType:function(e,t){var i=Kr.mergeOptions(Kr.options,1<arguments.length&&void 0!==t?t:{}).hls.overrideNative,n=al(e);return!n||sl.supportsTypeNatively(n)&&!i?"":"maybe"}};return void 0!==Kr.MediaSource&&void 0!==Kr.URL||(Kr.MediaSource=lu,Kr.URL=cu),lu.supportsNativeMediaSources()&&Kr.getTech("Html5").registerSourceHandler(dl,0),Kr.HlsHandler=cl,Kr.HlsSourceHandler=dl,Kr.Hls=sl,Kr.use||Kr.registerComponent("Hls",sl),Kr.options.hls=Kr.options.hls||{},Kr.registerPlugin?Kr.registerPlugin("reloadSourceOnError",nl):Kr.plugin("reloadSourceOnError",nl),Kr})),function(){var e,t;(t=(e=window)&&e.videojs)&&(t.CDN_VERSION="7.7.5")}(); |