Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/media/player/videojs/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/media/player/videojs/amd/build/video-lazy.min.js

function _typeof2(e){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof2=function(e){return typeof e}}else{_typeof2=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof2(e)}(function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof2(exports))&&"undefined"!=typeof module?module.exports=t(require("global/window"),require("global/document")):"function"==typeof define&&define.amd?define ("media_videojs/video-lazy",["./window","./document"],t):(e=e||self,e.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 ua=[],ca=function(t,a){return function(n,r,i){var s=a.levels[r],o=new RegExp("^("+s+")$");if("log"!==n){i.unshift(n.toUpperCase()+":")}i.unshift(t+":");if(ua){ua.push([].concat(i));var l=ua.length-1e3;ua.splice(0,0<l?l:0)}if(!e.console){return}var d=e.console[n];if(!d&&"debug"===n){d=e.console.info||e.console.log}if(!d||!s||!o.test(n)){return}d[Array.isArray(i)?"apply":"call"](e.console,i)}};function a(e){var t="info",n,r=function(){for(var e=arguments.length,a=Array(e),r=0;r<e;r++){a[r]=arguments[r]}n("log",t,a)};n=ca(e,r);r.createLogger=function(t){return a(e+": "+t)};r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t};r.level=function(e){if("string"==typeof e){if(!r.levels.hasOwnProperty(e)){throw new Error("\""+e+"\" in not a valid log level")}t=e}return t};r.history=function(){return ua?[].concat(ua):[]};r.history.filter=function(e){return(ua||[]).filter(function(t){return new RegExp(".*"+e+".*").test(t[0])})};r.history.clear=function(){if(ua){ua.length=0}};r.history.disable=function(){if(null!==ua){ua.length=0;ua=null}};r.history.enable=function(){if(null===ua){ua=[]}};r.error=function(){for(var e=arguments.length,a=Array(e),r=0;r<e;r++){a[r]=arguments[r]}return n("error",t,a)};r.warn=function(){for(var e=arguments.length,a=Array(e),r=0;r<e;r++){a[r]=arguments[r]}return n("warn",t,a)};r.debug=function(){for(var e=arguments.length,a=Array(e),r=0;r<e;r++){a[r]=arguments[r]}return n("debug",t,a)};return r}var ma=a("VIDEOJS"),ga=ma.createLogger;function n(e,t){return t={exports:{}},e(t,t.exports),t.exports}var ya=n(function(e){function t(){e.exports=t=Object.assign||function(e){for(var t=1,a;t<arguments.length;t++){a=arguments[t];for(var n in a){if(Object.prototype.hasOwnProperty.call(a,n)){e[n]=a[n]}}}return e};return t.apply(this,arguments)}e.exports=t}),ha=Object.prototype.toString,_a=function(e){return l(e)?Object.keys(e):[]};function r(e,t){_a(e).forEach(function(a){return t(e[a],a)})}function s(e,t,a){if(void 0===a){a=0}return _a(e).reduce(function(a,n){return t(a,e[n],n)},a)}function o(e){for(var t=arguments.length,a=Array(1<t?t-1:0),n=1;n<t;n++){a[n-1]=arguments[n]}if(Object.assign){return ya.apply(void 0,[e].concat(a))}a.forEach(function(t){if(!t){return}r(t,function(t,a){e[a]=t})});return e}function l(e){return!!e&&"object"===_typeof2(e)}function d(e){return l(e)&&"[object Object]"===ha.call(e)&&e.constructor===Object}function p(t,a){if(!t||!a){return""}if("function"==typeof e.getComputedStyle){var n=e.getComputedStyle(t);return n?n.getPropertyValue(a)||n[a]:""}return""}function u(e){return"string"==typeof e&&!!e.trim()}function c(e){if(0<=e.indexOf(" ")){throw new Error("class has illegal whitespace characters")}}function m(e){return new RegExp("(^|\\s)"+e+"($|\\s)")}function g(){return t===e.document}function y(e){return l(e)&&1===e.nodeType}function h(){try{return e.parent!==e.self}catch(e){return!0}}function _(e){return function(a,n){if(!u(a)){return t[e](null)}if(u(n)){n=t.querySelector(n)}var r=y(n)?n:t;return r[e]&&r[e](a)}}function f(e,a,n,r){if(void 0===e){e="div"}if(void 0===a){a={}}if(void 0===n){n={}}var i=t.createElement(e);Object.getOwnPropertyNames(a).forEach(function(e){var t=a[e];if(-1!==e.indexOf("aria-")||"role"===e||"type"===e){ma.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\n"+("createEl(type, properties, attributes). Attempting to set "+e+" to "+t+"."));i.setAttribute(e,t)}else if("textContent"===e){T(i,t)}else if(i[e]!==t){i[e]=t}});Object.getOwnPropertyNames(n).forEach(function(e){i.setAttribute(e,n[e])});if(r){B(i,r)}return i}function T(e,t){if("undefined"==typeof e.textContent){e.innerText=t}else{e.textContent=t}return e}function b(e,t){if(t.firstChild){t.insertBefore(e,t.firstChild)}else{t.appendChild(e)}}function v(e,t){c(t);if(e.classList){return e.classList.contains(t)}return m(t).test(e.className)}function S(e,t){if(e.classList){e.classList.add(t)}else if(!v(e,t)){e.className=(e.className+" "+t).trim()}return e}function k(e,t){if(e.classList){e.classList.remove(t)}else{c(t);e.className=e.className.split(/\s+/).filter(function(e){return e!==t}).join(" ")}return e}function C(e,t,a){var n=v(e,t);if("function"==typeof a){a=a(e,t)}if("boolean"!=typeof a){a=!n}if(a===n){return}if(a){S(e,t)}else{k(e,t)}return e}function E(e,t){Object.getOwnPropertyNames(t).forEach(function(a){var n=t[a];if(null===n||"undefined"==typeof n||!1===n){e.removeAttribute(a)}else{e.setAttribute(a,!0===n?"":n)}})}function I(e){var t={};if(e&&e.attributes&&0<e.attributes.length){for(var a=e.attributes,n=a.length-1;0<=n;n--){var r=a[n].name,s=a[n].value;if("boolean"==typeof e[r]||-1!==",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+r+",")){s=null!==s?!0:!1}t[r]=s}}return t}function x(e,t){return e.getAttribute(t)}function L(e,t,a){e.setAttribute(t,a)}function P(e,t){e.removeAttribute(t)}function D(){t.body.focus();t.onselectstart=function(){return!1}}function w(){t.onselectstart=function(){return!0}}function A(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),a={};["bottom","height","left","right","top","width"].forEach(function(e){if(t[e]!==void 0){a[e]=t[e]}});if(!a.height){a.height=parseFloat(p(e,"height"))}if(!a.width){a.width=parseFloat(p(e,"width"))}return a}}function O(a){var n;if(a.getBoundingClientRect&&a.parentNode){n=a.getBoundingClientRect()}if(!n){return{left:0,top:0}}var r=t.documentElement,i=t.body,s=r.clientLeft||i.clientLeft||0,o=e.pageXOffset||i.scrollLeft,l=n.left+o-s,d=r.clientTop||i.clientTop||0,p=e.pageYOffset||i.scrollTop,u=n.top+p-d;return{left:Math.round(l),top:Math.round(u)}}function R(e,t){var a={},n=O(e),r=e.offsetWidth,i=e.offsetHeight,s=n.top,o=n.left,l=t.pageY,d=t.pageX;if(t.changedTouches){d=t.changedTouches[0].pageX;l=t.changedTouches[0].pageY}a.y=Math.max(0,Math.min(1,(s-l+i)/i));a.x=Math.max(0,Math.min(1,(d-o)/r));return a}function N(e){return l(e)&&3===e.nodeType}function U(e){while(e.firstChild){e.removeChild(e.firstChild)}return e}function M(e){if("function"==typeof e){e=e()}return(Array.isArray(e)?e:[e]).map(function(e){if("function"==typeof e){e=e()}if(y(e)||N(e)){return e}if("string"==typeof e&&/\S/.test(e)){return t.createTextNode(e)}}).filter(function(e){return e})}function B(e,t){M(t).forEach(function(t){return e.appendChild(t)});return e}function j(e,t){return B(U(e),t)}function F(e){if(e.button===void 0&&e.buttons===void 0){return!0}if(0===e.button&&e.buttons===void 0){return!0}if("mouseup"===e.type&&0===e.button&&0===e.buttons){return!0}if(0!==e.button||1!==e.buttons){return!1}return!0}var fa=_("querySelector"),$=_("querySelectorAll"),Ta=Object.freeze({isReal:g,isEl:y,isInFrame:h,createEl:f,textContent:T,prependTo:b,hasClass:v,addClass:S,removeClass:k,toggleClass:C,setAttributes:E,getAttributes:I,getAttribute:x,setAttribute:L,removeAttribute:P,blockTextSelection:D,unblockTextSelection:w,getBoundingClientRect:A,findPosition:O,getPointerPosition:R,isTextNode:N,emptyEl:U,normalizeContent:M,appendContent:B,insertContent:j,isSingleLeftClick:F,$:fa,$$:$}),ba=!1,va,Sa=function(){if(!g()||!1===va.options.autoSetup){return}var a=Array.prototype.slice.call(t.getElementsByTagName("video")),n=Array.prototype.slice.call(t.getElementsByTagName("audio")),r=Array.prototype.slice.call(t.getElementsByTagName("video-js")),s=a.concat(n,r);if(s&&0<s.length){for(var o=0,l=s.length,e;o<l;o++){e=s[o];if(e&&e.getAttribute){if(e.player===void 0){var d=e.getAttribute("data-setup");if(null!==d){va(e)}}}else{H(1);break}}}else if(!ba){H(1)}};function H(t,a){if(a){va=a}e.setTimeout(Sa,t)}function q(){ba=!0;e.removeEventListener("load",q)}if(g()){if("complete"===t.readyState){q()}else{e.addEventListener("load",q)}}var ka=function(e){var a=t.createElement("style");a.className=e;return a},Ca=function(e,t){if(e.styleSheet){e.styleSheet.cssText=t}else{e.textContent=t}},Ea=3;function V(){return Ea++}var Ia;if(!e.WeakMap){Ia=function(){function t(){this.vdata="vdata"+Math.floor(e.performance&&e.performance.now()||Date.now());this.data={}}var a=t.prototype;a.set=function(e,t){var a=e[this.vdata]||V();if(!e[this.vdata]){e[this.vdata]=a}this.data[a]=t;return this};a.get=function(e){var t=e[this.vdata];if(t){return this.data[t]}ma("We have no data for this element",e)};a.has=function(e){var t=e[this.vdata];return t in this.data};a["delete"]=function(e){var t=e[this.vdata];if(t){delete this.data[t];delete e[this.vdata]}};return t}()}var xa=e.WeakMap?new WeakMap:new Ia;function W(e,t){if(!xa.has(e)){return}var a=xa.get(e);if(0===a.handlers[t].length){delete a.handlers[t];if(e.removeEventListener){e.removeEventListener(t,a.dispatcher,!1)}else if(e.detachEvent){e.detachEvent("on"+t,a.dispatcher)}}if(0>=Object.getOwnPropertyNames(a.handlers).length){delete a.handlers;delete a.dispatcher;delete a.disabled}if(0===Object.getOwnPropertyNames(a).length){xa["delete"](e)}}function z(e,t,a,n){a.forEach(function(a){e(t,a,n)})}function G(a){if(a.fixed_){return a}function n(){return!0}function r(){return!1}if(!a||!a.isPropagationStopped){var i=a||e.event;a={};for(var s in i){if("layerX"!=s&&"layerY"!==s&&"keyLocation"!==s&&"webkitMovementX"!==s&&"webkitMovementY"!==s){if(!("returnValue"===s&&i.preventDefault)){a[s]=i[s]}}}if(!a.target){a.target=a.srcElement||t}if(!a.relatedTarget){a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement}a.preventDefault=function(){if(i.preventDefault){i.preventDefault()}a.returnValue=!1;i.returnValue=!1;a.defaultPrevented=!0};a.defaultPrevented=!1;a.stopPropagation=function(){if(i.stopPropagation){i.stopPropagation()}a.cancelBubble=!0;i.cancelBubble=!0;a.isPropagationStopped=n};a.isPropagationStopped=r;a.stopImmediatePropagation=function(){if(i.stopImmediatePropagation){i.stopImmediatePropagation()}a.isImmediatePropagationStopped=n;a.stopPropagation()};a.isImmediatePropagationStopped=r;if(null!==a.clientX&&a.clientX!==void 0){var o=t.documentElement,l=t.body;a.pageX=a.clientX+(o&&o.scrollLeft||l&&l.scrollLeft||0)-(o&&o.clientLeft||l&&l.clientLeft||0);a.pageY=a.clientY+(o&&o.scrollTop||l&&l.scrollTop||0)-(o&&o.clientTop||l&&l.clientTop||0)}a.which=a.charCode||a.keyCode;if(null!==a.button&&a.button!==void 0){a.button=1&a.button?0:4&a.button?1:2&a.button?2:0}}a.fixed_=!0;return a}var La,Pa=function(){if("boolean"!=typeof La){La=!1;try{var t=Object.defineProperty({},"passive",{get:function(){La=!0}});e.addEventListener("test",null,t);e.removeEventListener("test",null,t)}catch(t){}}return La},Da=["touchstart","touchmove"];function K(e,t,a){if(Array.isArray(t)){return z(K,e,t,a)}if(!xa.has(e)){xa.set(e,{})}var r=xa.get(e);if(!r.handlers){r.handlers={}}if(!r.handlers[t]){r.handlers[t]=[]}if(!a.guid){a.guid=V()}r.handlers[t].push(a);if(!r.dispatcher){r.disabled=!1;r.dispatcher=function(t,a){if(r.disabled){return}t=G(t);var i=r.handlers[t.type];if(i){for(var s=i.slice(0),o=0,l=s.length;o<l;o++){if(t.isImmediatePropagationStopped()){break}else{try{s[o].call(e,t,a)}catch(t){ma.error(t)}}}}}}if(1===r.handlers[t].length){if(e.addEventListener){var i=!1;if(Pa()&&-1<Da.indexOf(t)){i={passive:!0}}e.addEventListener(t,r.dispatcher,i)}else if(e.attachEvent){e.attachEvent("on"+t,r.dispatcher)}}}function Y(e,a,r){if(!xa.has(e)){return}var i=xa.get(e);if(!i.handlers){return}if(Array.isArray(a)){return z(Y,e,a,r)}var s=function(e,a){i.handlers[a]=[];W(e,a)};if(a===void 0){for(var o in i.handlers){if(Object.prototype.hasOwnProperty.call(i.handlers||{},o)){s(e,o)}}return}var t=i.handlers[a];if(!t){return}if(!r){s(e,a);return}if(r.guid){for(var l=0;l<t.length;l++){if(t[l].guid===r.guid){t.splice(l--,1)}}}W(e,a)}function X(e,t,a){var n=xa.has(e)?xa.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t){t={type:t,target:e}}else if(!t.target){t.target=e}t=G(t);if(n.dispatcher){n.dispatcher.call(e,t,a)}if(r&&!t.isPropagationStopped()&&!0===t.bubbles){X.call(null,r,t,a)}else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){if(!xa.has(t.target)){xa.set(t.target,{})}var i=xa.get(t.target);if(t.target[t.type]){i.disabled=!0;if("function"==typeof t.target[t.type]){t.target[t.type]()}i.disabled=!1}}return!t.defaultPrevented}function Q(e,t,a){if(Array.isArray(t)){return z(Q,e,t,a)}var n=function n(){Y(e,t,n);a.apply(this,arguments)};n.guid=a.guid=a.guid||V();K(e,t,n)}function J(e,t,a){var n=function n(){Y(e,t,n);a.apply(this,arguments)};n.guid=a.guid=a.guid||V();K(e,t,n)}var wa=Object.freeze({fixEvent:G,on:K,off:Y,trigger:X,one:Q,any:J}),Aa=30,Oa=function(e,t,a){if(!t.guid){t.guid=V()}var n=t.bind(e);n.guid=a?a+"_"+t.guid:t.guid;return n},Ra=function(t,a){var n=e.performance.now(),r=function(){var r=e.performance.now();if(r-n>=a){t.apply(void 0,arguments);n=r}};return r},Na=function(t,a,n,r){if(void 0===r){r=e}var i,s=function(){r.clearTimeout(i);i=null},o=function(){var e=this,s=arguments,o=function(){i=null;o=null;if(!n){t.apply(e,s)}};if(!i&&n){t.apply(e,s)}r.clearTimeout(i);i=r.setTimeout(o,a)};o.cancel=s;return o},Ua=function(){};Ua.prototype.allowedEvents_={};Ua.prototype.on=function(e,t){var a=this.addEventListener;this.addEventListener=function(){};K(this,e,t);this.addEventListener=a};Ua.prototype.addEventListener=Ua.prototype.on;Ua.prototype.off=function(e,t){Y(this,e,t)};Ua.prototype.removeEventListener=Ua.prototype.off;Ua.prototype.one=function(e,t){var a=this.addEventListener;this.addEventListener=function(){};Q(this,e,t);this.addEventListener=a};Ua.prototype.any=function(e,t){var a=this.addEventListener;this.addEventListener=function(){};J(this,e,t);this.addEventListener=a};Ua.prototype.trigger=function(e){var t=e.type||e;if("string"==typeof e){e={type:t}}e=G(e);if(this.allowedEvents_[t]&&this["on"+t]){this["on"+t](e)}X(this,e)};Ua.prototype.dispatchEvent=Ua.prototype.trigger;var Ma;Ua.prototype.queueTrigger=function(t){var a=this;if(!Ma){Ma=new Map}var n=t.type||t,r=Ma.get(this);if(!r){r=new Map;Ma.set(this,r)}var i=r.get(n);r["delete"](n);e.clearTimeout(i);var s=e.setTimeout(function(){if(0===r.size){r=null;Ma["delete"](a)}a.trigger(t)},0);r.set(n,s)};var Ba=function(e){return e instanceof Ua||!!e.eventBusEl_&&["on","one","off","trigger"].every(function(t){return"function"==typeof e[t]})},ja=function(e,t){if(Ba(e)){t()}else{if(!e.eventedCallbacks){e.eventedCallbacks=[]}e.eventedCallbacks.push(t)}},Fa=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},Ha=function(e){if(!e.nodeName&&!Ba(e)){throw new Error("Invalid target; must be a DOM node or evented object.")}},qa=function(e){if(!Fa(e)){throw new Error("Invalid event type; must be a non-empty string or array.")}},Va=function(e){if("function"!=typeof e){throw new Error("Invalid listener; must be a function.")}},Wa=function(e,t){var a=3>t.length||t[0]===e||t[0]===e.eventBusEl_,n,r,i;if(a){n=e.eventBusEl_;if(3<=t.length){t.shift()}r=t[0];i=t[1]}else{n=t[0];r=t[1];i=t[2]}Ha(n);qa(r);Va(i);i=Oa(e,i);return{isTargetingSelf:a,target:n,type:r,listener:i}},za=function(e,t,a,n){Ha(e);if(e.nodeName){wa[t](e,a,n)}else{e[t](a,n)}},Ga={on:function(){for(var e=this,t=arguments.length,a=Array(t),n=0;n<t;n++){a[n]=arguments[n]}var r=Wa(this,a),i=r.isTargetingSelf,s=r.target,o=r.type,l=r.listener;za(s,"on",o,l);if(!i){var d=function(){return e.off(s,o,l)};d.guid=l.guid;var p=function(){return e.off("dispose",d)};p.guid=l.guid;za(this,"on","dispose",d);za(s,"on","dispose",p)}},one:function(){for(var e=this,t=arguments.length,a=Array(t),n=0;n<t;n++){a[n]=arguments[n]}var r=Wa(this,a),i=r.isTargetingSelf,s=r.target,o=r.type,l=r.listener;if(i){za(s,"one",o,l)}else{var d=function t(){e.off(s,o,t);for(var a=arguments.length,n=Array(a),r=0;r<a;r++){n[r]=arguments[r]}l.apply(null,n)};d.guid=l.guid;za(s,"one",o,d)}},any:function(){for(var e=this,t=arguments.length,a=Array(t),n=0;n<t;n++){a[n]=arguments[n]}var r=Wa(this,a),i=r.isTargetingSelf,s=r.target,o=r.type,l=r.listener;if(i){za(s,"any",o,l)}else{var d=function t(){e.off(s,o,t);for(var a=arguments.length,n=Array(a),r=0;r<a;r++){n[r]=arguments[r]}l.apply(null,n)};d.guid=l.guid;za(s,"any",o,d)}},off:function(e,t,a){if(!e||Fa(e)){Y(this.eventBusEl_,e,t)}else{var n=e,r=t;Ha(n);qa(r);Va(a);a=Oa(this,a);this.off("dispose",a);if(n.nodeName){Y(n,r,a);Y(n,"dispose",a)}else if(Ba(n)){n.off(r,a);n.off("dispose",a)}}},trigger:function(e,t){return X(this.eventBusEl_,e,t)}};function Z(t,a){if(void 0===a){a={}}var n=a,r=n.eventBusKey;if(r){if(!t[r].nodeName){throw new Error("The eventBusKey \""+r+"\" does not refer to an element.")}t.eventBusEl_=t[r]}else{t.eventBusEl_=f("span",{className:"vjs-event-bus"})}o(t,Ga);if(t.eventedCallbacks){t.eventedCallbacks.forEach(function(e){e()})}t.on("dispose",function(){t.off();e.setTimeout(function(){t.eventBusEl_=null},0)});return t}var Ka={state:{},setState:function(e){var t=this;if("function"==typeof e){e=e()}var a;r(e,function(e,n){if(t.state[n]!==e){a=a||{};a[n]={from:t.state[n],to:e}}t.state[n]=e});if(a&&Ba(this)){this.trigger({changes:a,type:"statechanged"})}return a}};function ee(e,t){o(e,Ka);e.state=o({},e.state,t);if("function"==typeof e.handleStateChanged&&Ba(e)){e.on("statechanged",e.handleStateChanged)}return e}var Ya=function(e){if("string"!=typeof e){return e}return e.replace(/./,function(e){return e.toLowerCase()})},Xa=function(e){if("string"!=typeof e){return e}return e.replace(/./,function(e){return e.toUpperCase()})},$a=function(e,t){return Xa(e)===Xa(t)};function te(){for(var e={},t=arguments.length,a=Array(t),n=0;n<t;n++){a[n]=arguments[n]}a.forEach(function(t){if(!t){return}r(t,function(t,a){if(!d(t)){e[a]=t;return}if(!d(e[a])){e[a]={}}e[a]=te(e[a],t)})});return e}var Qa=function(){function t(t,a,n){if(!t&&this.play){this.player_=t=this}else{this.player_=t}this.isDisposed_=!1;this.parentComponent_=null;this.options_=te({},this.options_);a=this.options_=te(this.options_,a);this.id_=a.id||a.el&&a.el.id;if(!this.id_){var r=t&&t.id&&t.id()||"no_player";this.id_=r+"_component_"+V()}this.name_=a.name||null;if(a.el){this.el_=a.el}else if(!1!==a.createEl){this.el_=this.createEl()}if(!1!==a.evented){Z(this,{eventBusKey:this.el_?"el_":null})}ee(this,this.constructor.defaultState);this.children_=[];this.childIndex_={};this.childNameIndex_={};var i;if(!e.Set){i=function(){function e(){this.set_={}}var t=e.prototype;t.has=function(e){return e in this.set_};t["delete"]=function(e){var t=this.has(e);delete this.set_[e];return t};t.add=function(e){this.set_[e]=1;return this};t.forEach=function(e,t){for(var a in this.set_){e.call(t,a,a,this)}};return e}()}this.setTimeoutIds_=e.Set?new Set:new i;this.setIntervalIds_=e.Set?new Set:new i;this.rafIds_=e.Set?new Set:new i;this.clearingTimersOnDispose_=!1;if(!1!==a.initChildren){this.initChildren()}this.ready(n);if(!1!==a.reportTouchActivity){this.enableTouchActivity()}}var a=t.prototype;a.dispose=function(){if(this.isDisposed_){return}this.trigger({type:"dispose",bubbles:!1});this.isDisposed_=!0;if(this.children_){for(var e=this.children_.length-1;0<=e;e--){if(this.children_[e].dispose){this.children_[e].dispose()}}}this.children_=null;this.childIndex_=null;this.childNameIndex_=null;this.parentComponent_=null;if(this.el_){if(this.el_.parentNode){this.el_.parentNode.removeChild(this.el_)}if(xa.has(this.el_)){xa["delete"](this.el_)}this.el_=null}this.player_=null};a.isDisposed=function(){return!!this.isDisposed_};a.player=function(){return this.player_};a.options=function(e){if(!e){return this.options_}this.options_=te(this.options_,e);return this.options_};a.el=function(){return this.el_};a.createEl=function(e,t,a){return f(e,t,a)};a.localize=function(e,t,a){if(void 0===a){a=e}var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),i=r&&r[n],s=n&&n.split("-")[0],o=r&&r[s],l=a;if(i&&i[e]){l=i[e]}else if(o&&o[e]){l=o[e]}if(t){l=l.replace(/\{(\d+)\}/g,function(e,a){var n=t[a-1],r=n;if("undefined"==typeof n){r=e}return r})}return l};a.contentEl=function(){return this.contentEl_||this.el_};a.id=function(){return this.id_};a.name=function(){return this.name_};a.children=function(){return this.children_};a.getChildById=function(e){return this.childIndex_[e]};a.getChild=function(e){if(!e){return}return this.childNameIndex_[e]};a.addChild=function(e,a,n){if(void 0===a){a={}}if(void 0===n){n=this.children_.length}var r,i;if("string"==typeof e){i=Xa(e);var s=a.componentClass||i;a.name=i;var o=t.getComponent(s);if(!o){throw new Error("Component "+s+" does not exist")}if("function"!=typeof o){return null}r=new o(this.player_||this,a)}else{r=e}if(r.parentComponent_){r.parentComponent_.removeChild(r)}this.children_.splice(n,0,r);r.parentComponent_=this;if("function"==typeof r.id){this.childIndex_[r.id()]=r}i=i||r.name&&Xa(r.name());if(i){this.childNameIndex_[i]=r;this.childNameIndex_[Ya(i)]=r}if("function"==typeof r.el&&r.el()){var l=null;if(this.children_[n+1]&&this.children_[n+1].el_){l=this.children_[n+1].el_}this.contentEl().insertBefore(r.el(),l)}return r};a.removeChild=function(e){if("string"==typeof e){e=this.getChild(e)}if(!e||!this.children_){return}for(var t=!1,a=this.children_.length-1;0<=a;a--){if(this.children_[a]===e){t=!0;this.children_.splice(a,1);break}}if(!t){return}e.parentComponent_=null;this.childIndex_[e.id()]=null;this.childNameIndex_[Xa(e.name())]=null;this.childNameIndex_[Ya(e.name())]=null;var n=e.el();if(n&&n.parentNode===this.contentEl()){this.contentEl().removeChild(e.el())}};a.initChildren=function(){var e=this,a=this.options_.children;if(a){var n=this.options_,r=function(t){var a=t.name,r=t.opts;if(n[a]!==void 0){r=n[a]}if(!1===r){return}if(!0===r){r={}}r.playerOptions=e.options_.playerOptions;var i=e.addChild(a,r);if(i){e[a]=i}},i,s=t.getComponent("Tech");if(Array.isArray(a)){i=a}else{i=Object.keys(a)}i.concat(Object.keys(this.options_).filter(function(e){return!i.some(function(t){if("string"==typeof t){return e===t}return e===t.name})})).map(function(t){var n,r;if("string"==typeof t){n=t;r=a[n]||e.options_[n]||{}}else{n=t.name;r=t}return{name:n,opts:r}}).filter(function(e){var a=t.getComponent(e.opts.componentClass||Xa(e.name));return a&&!s.isTech(a)}).forEach(r)}};a.buildCSSClass=function(){return""};a.ready=function(e,t){if(void 0===t){t=!1}if(!e){return}if(!this.isReady_){this.readyQueue_=this.readyQueue_||[];this.readyQueue_.push(e);return}if(t){e.call(this)}else{this.setTimeout(e,1)}};a.triggerReady=function(){this.isReady_=!0;this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[];if(e&&0<e.length){e.forEach(function(e){e.call(this)},this)}this.trigger("ready")},1)};a.$=function(e,t){return fa(e,t||this.contentEl())};a.$$=function(e,t){return $(e,t||this.contentEl())};a.hasClass=function(e){return v(this.el_,e)};a.addClass=function(e){S(this.el_,e)};a.removeClass=function(e){k(this.el_,e)};a.toggleClass=function(e,t){C(this.el_,e,t)};a.show=function(){this.removeClass("vjs-hidden")};a.hide=function(){this.addClass("vjs-hidden")};a.lockShowing=function(){this.addClass("vjs-lock-showing")};a.unlockShowing=function(){this.removeClass("vjs-lock-showing")};a.getAttribute=function(e){return x(this.el_,e)};a.setAttribute=function(e,t){L(this.el_,e,t)};a.removeAttribute=function(e){P(this.el_,e)};a.width=function(e,t){return this.dimension("width",e,t)};a.height=function(e,t){return this.dimension("height",e,t)};a.dimensions=function(e,t){this.width(e,!0);this.height(t)};a.dimension=function(e,t,a){if(t!==void 0){if(null===t||t!==t){t=0}if(-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")){this.el_.style[e]=t}else if("auto"===t){this.el_.style[e]=""}else{this.el_.style[e]=t+"px"}if(!a){this.trigger("componentresize")}return}if(!this.el_){return 0}var n=this.el_.style[e],r=n.indexOf("px");if(-1!==r){return parseInt(n.slice(0,r),10)}return parseInt(this.el_["offset"+Xa(e)],10)};a.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e){throw new Error("currentDimension only accepts width or height value")}t=p(this.el_,e);t=parseFloat(t);if(0===t||isNaN(t)){var a="offset"+Xa(e);t=this.el_[a]}return t};a.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}};a.currentWidth=function(){return this.currentDimension("width")};a.currentHeight=function(){return this.currentDimension("height")};a.focus=function(){this.el_.focus()};a.blur=function(){this.el_.blur()};a.handleKeyDown=function(e){if(this.player_){e.stopPropagation();this.player_.handleKeyDown(e)}};a.handleKeyPress=function(e){this.handleKeyDown(e)};a.emitTapEvents=function(){var t=0,a=null,n;this.on("touchstart",function(r){if(1===r.touches.length){a={pageX:r.touches[0].pageX,pageY:r.touches[0].pageY};t=e.performance.now();n=!0}});this.on("touchmove",function(e){if(1<e.touches.length){n=!1}else if(a){var t=e.touches[0].pageX-a.pageX,r=e.touches[0].pageY-a.pageY,i=Math.sqrt(t*t+r*r);if(i>10){n=!1}}});var r=function(){n=!1};this.on("touchleave",r);this.on("touchcancel",r);this.on("touchend",function(r){a=null;if(!0===n){var i=e.performance.now()-t;if(i<200){r.preventDefault();this.trigger("tap")}}})};a.enableTouchActivity=function(){if(!this.player()||!this.player().reportUserActivity){return}var e=Oa(this.player(),this.player().reportUserActivity),t;this.on("touchstart",function(){e();this.clearInterval(t);t=this.setInterval(e,250)});var a=function(){e();this.clearInterval(t)};this.on("touchmove",e);this.on("touchend",a);this.on("touchcancel",a)};a.setTimeout=function(t,a){var n=this,r;t=Oa(this,t);this.clearTimersOnDispose_();r=e.setTimeout(function(){if(n.setTimeoutIds_.has(r)){n.setTimeoutIds_["delete"](r)}t()},a);this.setTimeoutIds_.add(r);return r};a.clearTimeout=function(t){if(this.setTimeoutIds_.has(t)){this.setTimeoutIds_["delete"](t);e.clearTimeout(t)}return t};a.setInterval=function(t,a){t=Oa(this,t);this.clearTimersOnDispose_();var n=e.setInterval(t,a);this.setIntervalIds_.add(n);return n};a.clearInterval=function(t){if(this.setIntervalIds_.has(t)){this.setIntervalIds_["delete"](t);e.clearInterval(t)}return t};a.requestAnimationFrame=function(t){var a=this;if(!this.supportsRaf_){return this.setTimeout(t,1e3/60)}this.clearTimersOnDispose_();var n;t=Oa(this,t);n=e.requestAnimationFrame(function(){if(a.rafIds_.has(n)){a.rafIds_["delete"](n)}t()});this.rafIds_.add(n);return n};a.cancelAnimationFrame=function(t){if(!this.supportsRaf_){return this.clearTimeout(t)}if(this.rafIds_.has(t)){this.rafIds_["delete"](t);e.cancelAnimationFrame(t)}return t};a.clearTimersOnDispose_=function(){var e=this;if(this.clearingTimersOnDispose_){return}this.clearingTimersOnDispose_=!0;this.one("dispose",function(){[["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(t){var a=t[0],n=t[1];e[a].forEach(e[n],e)});e.clearingTimersOnDispose_=!1})};t.registerComponent=function(e,a){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(a),i=t===a||t.prototype.isPrototypeOf(a.prototype);if(r||!i){var s;if(r){s="techs must be registered using Tech.registerTech()"}else{s="must be a Component subclass"}throw new Error("Illegal component, \""+e+"\"; "+s+".")}e=Xa(e);if(!t.components_){t.components_={}}var o=t.getComponent("Player");if("Player"===e&&o&&o.players){var l=o.players,d=Object.keys(l);if(l&&0<d.length&&d.map(function(e){return l[e]}).every(Boolean)){throw new Error("Can not register Player component after player has been created.")}}t.components_[e]=a;t.components_[Ya(e)]=a;return a};t.getComponent=function(e){if(!e||!t.components_){return}return t.components_[e]};return t}();Qa.prototype.supportsRaf_="function"==typeof e.requestAnimationFrame&&"function"==typeof e.cancelAnimationFrame;Qa.registerComponent("Component",Qa);var Ja=function(e){if(void 0===e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e},Za=n(function(e){function t(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){e.exports=t=function(e){return typeof e}}else{e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return t(a)}e.exports=t}),en=n(function(e){function t(a){e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)};return t(a)}e.exports=t});var tn=function(e,t){e.prototype=Object.create(t.prototype);e.prototype.constructor=e;e.__proto__=t},an=e.navigator&&e.navigator.userAgent||"",nn=/AppleWebKit\/([\d.]+)/i.exec(an),rn=nn?parseFloat(nn.pop()):null,sn=/iPod/i.test(an),on=function(){var e=an.match(/OS (\d+)_/i);if(e&&e[1]){return e[1]}return null}(),ln=/Android/i.test(an),dn=function(){var e=an.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e){return null}var t=e[1]&&parseFloat(e[1]),a=e[2]&&parseFloat(e[2]);if(t&&a){return parseFloat(e[1]+"."+e[2])}else if(t){return t}return null}(),pn=ln&&5>dn&&537>rn,un=/Firefox/i.test(an),cn=/Edg/i.test(an),mn=!cn&&(/Chrome/i.test(an)||/CriOS/i.test(an)),gn=function(){var e=an.match(/(Chrome|CriOS)\/(\d+)/);if(e&&e[2]){return parseFloat(e[2])}return null}(),yn=function(){var e=/MSIE\s(\d+)\.\d/.exec(an),t=e&&parseFloat(e[1]);return"7.7.6"}(),hn=/Safari/i.test(an)&&!mn&&!ln&&!cn,_n=/Windows/i.test(an),fn=g()&&("ontouchstart"in e||e.navigator.maxTouchPoints||e.DocumentTouch&&e.document instanceof e.DocumentTouch),Tn=/iPad/i.test(an)||hn&&fn&&!/iPhone/i.test(an),bn=/iPhone/i.test(an)&&!Tn,vn=bn||Tn||sn,Sn=(hn||vn)&&!mn,kn=Object.freeze({IS_IPOD:sn,IOS_VERSION:on,IS_ANDROID:ln,ANDROID_VERSION:dn,IS_NATIVE_ANDROID:pn,IS_FIREFOX:un,IS_EDGE:cn,IS_CHROME:mn,CHROME_VERSION:gn,IE_VERSION:yn,IS_SAFARI:hn,IS_WINDOWS:_n,TOUCH_ENABLED:fn,IS_IPAD:Tn,IS_IPHONE:bn,IS_IOS:vn,IS_ANY_SAFARI:Sn});function ae(e,t,a){if("number"!=typeof t||0>t||t>a){throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+a+").")}}function ne(e,t,a,n){ae(e,n,a.length-1);return a[n][t]}function re(e){if(e===void 0||0===e.length){return{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}}return{length:e.length,start:ne.bind(null,"start",0,e),end:ne.bind(null,"end",1,e)}}function ie(e,t){if(Array.isArray(e)){return re(e)}else if(e===void 0||t===void 0){return re()}return re([[e,t]])}function se(e,t){var a=0,n,r;if(!t){return 0}if(!e||!e.length){e=ie(0,0)}for(var s=0;s<e.length;s++){n=e.start(s);r=e.end(s);if(r>t){r=t}a+=r-n}return a/t}for(var Cn={prefixed:!0},En=[["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"]],In=En[0],xn,Ln=0;Ln<En.length;Ln++){if(En[Ln][1]in t){xn=En[Ln];break}}if(xn){for(var Pn=0;Pn<xn.length;Pn++){Cn[In[Pn]]=xn[Pn]}Cn.prefixed=xn[0]!==In[0]}function oe(e){if(e instanceof oe){return e}if("number"==typeof e){this.code=e}else if("string"==typeof e){this.message=e}else if(l(e)){if("number"==typeof e.code){this.code=e.code}o(this,e)}if(!this.message){this.message=oe.defaultMessages[this.code]||""}}oe.prototype.code=0;oe.prototype.message="";oe.prototype.status=null;oe.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];oe.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 Dn=0;Dn<oe.errorTypes.length;Dn++){oe[oe.errorTypes[Dn]]=Dn;oe.prototype[oe.errorTypes[Dn]]=Dn}var wn=function(e,t){var a,n=null;try{a=JSON.parse(e,t)}catch(e){n=e}return[n,a]};function le(e){return e!==void 0&&null!==e&&"function"==typeof e.then}function de(e){if(le(e)){e.then(null,function(){})}}var An=function(e){var t=["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(t,a){if(e[a]){t[a]=e[a]}return 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}})});return t},On={textTracksToJson:function(e){var t=e.$$("track"),a=Array.prototype.map.call(t,function(e){return e.track}),n=Array.prototype.map.call(t,function(e){var t=An(e.track);if(e.src){t.src=e.src}return t});return n.concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===a.indexOf(e)}).map(An))},jsonToTextTracks:function(e,t){e.forEach(function(e){var a=t.addRemoteTextTrack(e).track;if(!e.src&&e.cues){e.cues.forEach(function(e){return a.addCue(e)})}});return t.textTracks()},trackToJson_:An},Rn=n(function(e,t){function a(e){if(e&&"object"===_typeof2(e)){var t=e.which||e.keyCode||e.charCode;if(t)e=t}if("number"==typeof e)return o[e];var a=e+"",i=n[a.toLowerCase()];if(i)return i;var i=r[a.toLowerCase()];if(i)return i;if(1===a.length)return a.charCodeAt(0)}a.isEventKey=function(e,t){if(e&&"object"===_typeof2(e)){var a=e.which||e.keyCode||e.charCode;if(null===a||a===void 0){return!1}if("string"==typeof t){var i=n[t.toLowerCase()];if(i){return i===a}var i=r[t.toLowerCase()];if(i){return i===a}}else if("number"==typeof t){return t===a}return!1}};t=e.exports=a;var n=t.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;123>s;s++){n[String.fromCharCode(s)]=s-32}for(var s=48;58>s;s++){n[s-48]=s}for(s=1;13>s;s++){n["f"+s]=s+111}for(s=0;10>s;s++){n["numpad "+s]=s+96}var o=t.names=t.title={};for(s in n){o[n[s]]=s}for(var l in r){n[l]=r[l]}}),Nn=Rn.code,Un=Rn.codes,Mn=Rn.aliases,Bn=Rn.names,jn=Rn.title,Fn="vjs-modal-dialog",Hn=function(a){tn(n,a);function n(e,t){var n=a.call(this,e,t)||this;n.opened_=n.hasBeenOpened_=n.hasBeenFilled_=!1;n.closeable(!n.options_.uncloseable);n.content(n.options_.content);n.contentEl_=f("div",{className:Fn+"-content"},{role:"document"});n.descEl_=f("p",{className:Fn+"-description vjs-control-text",id:n.el().getAttribute("aria-describedby")});T(n.descEl_,n.description());n.el_.appendChild(n.descEl_);n.el_.appendChild(n.contentEl_);return n}var r=n.prototype;r.createEl=function(){return a.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;a.prototype.dispose.call(this)};r.buildCSSClass=function(){return Fn+" vjs-hidden "+a.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.");if(this.closeable()){e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")}return e};r.open=function(){if(!this.opened_){var e=this.player();this.trigger("beforemodalopen");this.opened_=!0;if(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_){this.fill()}this.wasPlaying_=!e.paused();if(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){if("boolean"==typeof e){this[e?"open":"close"]()}return this.opened_};r.close=function(){if(!this.opened_){return}var e=this.player();this.trigger("beforemodalclose");this.opened_=!1;if(this.wasPlaying_&&this.options_.pauseOnOpen){e.play()}this.off("keydown",this.handleKeyDown);if(this.hadControls_){e.controls(!0)}this.hide();this.el().setAttribute("aria-hidden","true");this.trigger("modalclose");this.conditionalBlur_();if(this.options_.temporary){this.dispose()}};r.closeable=function e(t){if("boolean"==typeof t){var e=this.closeable_=!!t,a=this.getChild("closeButton");if(e&&!a){var n=this.contentEl_;this.contentEl_=this.el_;a=this.addChild("closeButton",{controlText:"Close Modal Dialog"});this.contentEl_=n;this.on(a,"close",this.close)}if(!e&&a){this.off(a,"close",this.close);this.removeChild(a);a.dispose()}}return this.closeable_};r.fill=function(){this.fillWith(this.content())};r.fillWith=function(e){var t=this.contentEl(),a=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill");this.hasBeenFilled_=!0;a.removeChild(t);this.empty();j(t,e);this.trigger("modalfill");if(n){a.insertBefore(t,n)}else{a.appendChild(t)}var r=this.getChild("closeButton");if(r){a.appendChild(r.el_)}};r.empty=function(){this.trigger("beforemodalempty");U(this.contentEl());this.trigger("modalempty")};r.content=function(e){if("undefined"!=typeof e){this.content_=e}return this.content_};r.conditionalFocus_=function(){var e=t.activeElement,a=this.player_.el_;this.previouslyActiveEl_=null;if(a.contains(e)||a===e){this.previouslyActiveEl_=e;this.focus()}};r.conditionalBlur_=function(){if(this.previouslyActiveEl_){this.previouslyActiveEl_.focus();this.previouslyActiveEl_=null}};r.handleKeyDown=function(e){e.stopPropagation();if(Rn.isEventKey(e,"Escape")&&this.closeable()){e.preventDefault();this.close();return}if(!Rn.isEventKey(e,"Tab")){return}for(var a=this.focusableEls_(),n=this.el_.querySelector(":focus"),r,s=0;s<a.length;s++){if(n===a[s]){r=s;break}}if(t.activeElement===this.el_){r=0}if(e.shiftKey&&0===r){a[a.length-1].focus();e.preventDefault()}else if(!e.shiftKey&&r===a.length-1){a[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")})};return n}(Qa);Hn.prototype.options_={pauseOnOpen:!0,temporary:!0};Qa.registerComponent("ModalDialog",Hn);var qn=function(e){tn(t,e);function t(t){var a;if(void 0===t){t=[]}a=e.call(this)||this;a.tracks_=[];Object.defineProperty(Ja(a),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<t.length;n++){a.addTrack(t[n])}return a}var a=t.prototype;a.addTrack=function(e){var t=this.tracks_.length;if(!(""+t in this)){Object.defineProperty(this,t,{get:function(){return this.tracks_[t]}})}if(-1===this.tracks_.indexOf(e)){this.tracks_.push(e);this.trigger({track:e,type:"addtrack",target:this})}};a.removeTrack=function(e){for(var t,a=0,n=this.length;a<n;a++){if(this[a]===e){t=this[a];if(t.off){t.off()}this.tracks_.splice(a,1);break}}if(!t){return}this.trigger({track:t,type:"removetrack",target:this})};a.getTrackById=function(e){for(var t=null,a=0,n=this.length,r;a<n;a++){r=this[a];if(r.id===e){t=r;break}}return t};return t}(Ua);qn.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"};for(var Vn in qn.prototype.allowedEvents_){qn.prototype["on"+Vn]=null}var Wn=function(e,t){for(var a=0;a<e.length;a++){if(!Object.keys(e[a]).length||t.id===e[a].id){continue}e[a].enabled=!1}},zn=function(e){tn(t,e);function t(t){var a;if(void 0===t){t=[]}for(var n=t.length-1;0<=n;n--){if(t[n].enabled){Wn(t,t[n]);break}}a=e.call(this,t)||this;a.changing_=!1;return a}var a=t.prototype;a.addTrack=function(t){var a=this;if(t.enabled){Wn(this,t)}e.prototype.addTrack.call(this,t);if(!t.addEventListener){return}t.enabledChange_=function(){if(a.changing_){return}a.changing_=!0;Wn(a,t);a.changing_=!1;a.trigger("change")};t.addEventListener("enabledchange",t.enabledChange_)};a.removeTrack=function(t){e.prototype.removeTrack.call(this,t);if(t.removeEventListener&&t.enabledChange_){t.removeEventListener("enabledchange",t.enabledChange_);t.enabledChange_=null}};return t}(qn),Gn=function(e,t){for(var a=0;a<e.length;a++){if(!Object.keys(e[a]).length||t.id===e[a].id){continue}e[a].selected=!1}},Kn=function(e){tn(t,e);function t(t){var a;if(void 0===t){t=[]}for(var n=t.length-1;0<=n;n--){if(t[n].selected){Gn(t,t[n]);break}}a=e.call(this,t)||this;a.changing_=!1;Object.defineProperty(Ja(a),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++){if(this[e].selected){return e}}return-1},set:function(){}});return a}var a=t.prototype;a.addTrack=function(t){var a=this;if(t.selected){Gn(this,t)}e.prototype.addTrack.call(this,t);if(!t.addEventListener){return}t.selectedChange_=function(){if(a.changing_){return}a.changing_=!0;Gn(a,t);a.changing_=!1;a.trigger("change")};t.addEventListener("selectedchange",t.selectedChange_)};a.removeTrack=function(t){e.prototype.removeTrack.call(this,t);if(t.removeEventListener&&t.selectedChange_){t.removeEventListener("selectedchange",t.selectedChange_);t.selectedChange_=null}};return t}(qn),Yn=function(e){tn(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.addTrack=function(t){var a=this;e.prototype.addTrack.call(this,t);if(!this.queueChange_){this.queueChange_=function(){return a.queueTrigger("change")}}if(!this.triggerSelectedlanguagechange){this.triggerSelectedlanguagechange_=function(){return a.trigger("selectedlanguagechange")}}t.addEventListener("modechange",this.queueChange_);if(-1===["metadata","chapters"].indexOf(t.kind)){t.addEventListener("modechange",this.triggerSelectedlanguagechange_)}};a.removeTrack=function(t){e.prototype.removeTrack.call(this,t);if(t.removeEventListener){if(this.queueChange_){t.removeEventListener("modechange",this.queueChange_)}if(this.selectedlanguagechange_){t.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}};return t}(qn),Xn=function(){function e(e){if(void 0===e){e=[]}this.trackElements_=[];Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,a=e.length;t<a;t++){this.addTrackElement_(e[t])}}var t=e.prototype;t.addTrackElement_=function(e){var t=this.trackElements_.length;if(!(""+t in this)){Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}})}if(-1===this.trackElements_.indexOf(e)){this.trackElements_.push(e)}};t.getTrackElementByTrack_=function(e){for(var t,a=0,n=this.trackElements_.length;a<n;a++){if(e===this.trackElements_[a].track){t=this.trackElements_[a];break}}return t};t.removeTrackElement_=function(e){for(var t=0,a=this.trackElements_.length;t<a;t++){if(e===this.trackElements_[t]){if(this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off){this.trackElements_[t].track.off()}if("function"==typeof this.trackElements_[t].off){this.trackElements_[t].off()}this.trackElements_.splice(t,1);break}}};return e}(),$n=function(){function e(t){e.prototype.setCues_.call(this,t);Object.defineProperty(this,"length",{get:function(){return this.length_}})}var t=e.prototype;t.setCues_=function(e){var t=this.length||0,a=0,n=e.length;this.cues_=e;this.length_=e.length;var r=function(e){if(!(""+e in this)){Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})}};if(t<n){a=t;for(;a<n;a++){r.call(this,a)}}};t.getCueById=function(e){for(var t=null,a=0,n=this.length,r;a<n;a++){r=this[a];if(r.id===e){t=r;break}}return t};return e}(),Qn={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Jn={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Zn={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},er={disabled:"disabled",hidden:"hidden",showing:"showing"},tr=function(e){tn(t,e);function t(t){var a;if(void 0===t){t={}}a=e.call(this)||this;var n={id:t.id||"vjs_track_"+V(),kind:t.kind||"",label:t.label||"",language:t.language||""},r=function(e){Object.defineProperty(Ja(a),e,{get:function(){return n[e]},set:function(){}})};for(var i in n){r(i)}return a}return t}(Ua),ar=function(n){var r=["protocol","hostname","port","pathname","search","hash","host"],s=t.createElement("a");s.href=n;var o=""===s.host&&"file:"!==s.protocol,l;if(o){l=t.createElement("div");l.innerHTML="<a href=\""+n+"\"></a>";s=l.firstChild;l.setAttribute("style","display:none; position:absolute;");t.body.appendChild(l)}for(var d={},p=0;p<r.length;p++){d[r[p]]=s[r[p]]}if("http:"===d.protocol){d.host=d.host.replace(/:80$/,"")}if("https:"===d.protocol){d.host=d.host.replace(/:443$/,"")}if(!d.protocol){d.protocol=e.location.protocol}if(o){t.body.removeChild(l)}return d},nr=function(e){if(!e.match(/^https?:\/\//)){var a=t.createElement("div");a.innerHTML="<a href=\""+e+"\">x</a>";e=a.firstChild.href}return e},rr=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t){return t.pop().toLowerCase()}}return""},ir=function(t,a){if(void 0===a){a=e.location}var n=ar(t),r=":"===n.protocol?a.protocol:n.protocol,i=r+n.host!==a.protocol+a.host;return i},sr=Object.freeze({parseUrl:ar,getAbsoluteURL:nr,getFileExtension:rr,isCrossOrigin:ir}),or=function(e){var t=lr.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)},lr=Object.prototype.toString;var dr=function(e){var t={};if(!e){return t}e.trim().split("\n").forEach(function(e){var a=e.indexOf(":"),n=e.slice(0,a).trim().toLowerCase(),r=e.slice(a+1).trim();if("undefined"==typeof t[n]){t[n]=r}else if(Array.isArray(t[n])){t[n].push(r)}else{t[n]=[t[n],r]}});return t},pr=me;me.XMLHttpRequest=e.XMLHttpRequest||function(){};me.XDomainRequest="withCredentials"in new me.XMLHttpRequest?me.XMLHttpRequest:e.XDomainRequest;pe(["get","put","post","patch","head","delete"],function(e){me["delete"===e?"del":e]=function(t,a,n){a=ce(t,a,n);a.method=e.toUpperCase();return ge(a)}});function pe(e,t){for(var a=0;a<e.length;a++){t(e[a])}}function ue(e){for(var t in e){if(e.hasOwnProperty(t))return!1}return!0}function ce(e,t,a){var n=e;if(or(t)){a=t;if("string"==typeof e){n={uri:e}}}else{n=ya({},t,{uri:e})}n.callback=a;return n}function me(e,t,a){t=ce(e,t,a);return ge(t)}function ge(e){if("undefined"==typeof e.callback){throw new Error("callback argument missing")}var i=!1,s=function(t,a,n){if(!i){i=!0;e.callback(t,a,n)}};function t(){if(4===o.readyState){setTimeout(r,0)}}function a(){var e;if(o.response){e=o.response}else{e=o.responseText||ye(o)}if(y){try{e=JSON.parse(e)}catch(t){}}return e}function n(e){clearTimeout(h);if(!(e instanceof Error)){e=new Error(""+(e||"Unknown XMLHttpRequest Error"))}e.statusCode=0;return s(e,_)}function r(){if(d)return;var t;clearTimeout(h);if(e.useXDR&&o.status===void 0){t=200}else{t=1223===o.status?204:o.status}var n=_,r=null;if(0!==t){n={body:a(),statusCode:t,method:u,headers:{},url:p,rawRequest:o};if(o.getAllResponseHeaders){n.headers=dr(o.getAllResponseHeaders())}}else{r=new Error("Internal XMLHttpRequest Error")}return s(r,n,n.body)}var o=e.xhr||null;if(!o){if(e.cors||e.useXDR){o=new me.XDomainRequest}else{o=new me.XMLHttpRequest}}var l,d,p=o.url=e.uri||e.url,u=o.method=e.method||"GET",c=e.body||e.data,m=o.headers=e.headers||{},g=!!e.sync,y=!1,h,_={body:void 0,headers:{},statusCode:0,method:u,url:p,rawRequest:o};if("json"in e&&!1!==e.json){y=!0;m.accept||m.Accept||(m.Accept="application/json");if("GET"!==u&&"HEAD"!==u){m["content-type"]||m["Content-Type"]||(m["Content-Type"]="application/json");c=JSON.stringify(!0===e.json?c:e.json)}}o.onreadystatechange=t;o.onload=r;o.onerror=n;o.onprogress=function(){};o.onabort=function(){d=!0};o.ontimeout=n;o.open(u,p,!g,e.username,e.password);if(!g){o.withCredentials=!!e.withCredentials}if(!g&&0<e.timeout){h=setTimeout(function(){if(d)return;d=!0;o.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT";n(t)},e.timeout)}if(o.setRequestHeader){for(l in m){if(m.hasOwnProperty(l)){o.setRequestHeader(l,m[l])}}}else if(e.headers&&!ue(e.headers)){throw new Error("Headers cannot be set on an XDomainRequest object")}if("responseType"in e){o.responseType=e.responseType}if("beforeSend"in e&&"function"==typeof e.beforeSend){e.beforeSend(o)}o.send(c||null);return o}function ye(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(t){}return null}pr["default"]=me;var ur=function(t,a){var n=new e.WebVTT.Parser(e,e.vttjs,e.WebVTT.StringDecoder()),r=[];n.oncue=function(e){a.addCue(e)};n.onparsingerror=function(e){r.push(e)};n.onflush=function(){a.trigger({type:"loadeddata",target:a})};n.parse(t);if(0<r.length){if(e.console&&e.console.groupCollapsed){e.console.groupCollapsed("Text Track parsing errors for "+a.src)}r.forEach(function(e){return ma.error(e)});if(e.console&&e.console.groupEnd){e.console.groupEnd()}}n.flush()},cr=function(t,a){var n={uri:t},r=ir(t);if(r){n.cors=r}pr(n,Oa(this,function(t,n,r){if(t){return ma.error(t,n)}a.loaded_=!0;if("function"!=typeof e.WebVTT){if(a.tech_){a.tech_.any(["vttjsloaded","vttjserror"],function(e){if("vttjserror"===e.type){ma.error("vttjs failed to load, stopping trying to process "+a.src);return}return ur(r,a)})}}else{ur(r,a)}}))},mr=function(t){tn(a,t);function a(e){var a;if(void 0===e){e={}}if(!e.tech){throw new Error("A tech was not provided.")}var n=te(e,{kind:Zn[e.kind]||"subtitles",language:e.language||e.srclang||""}),r=er[n.mode]||"disabled",i=n["default"];if("metadata"===n.kind||"chapters"===n.kind){r="hidden"}a=t.call(this,n)||this;a.tech_=n.tech;a.cues_=[];a.activeCues_=[];a.preload_=!1!==a.tech_.preloadTextTracks;var s=new $n(a.cues_),o=new $n(a.activeCues_),d=!1,p=Oa(Ja(a),function(){this.activeCues=this.activeCues;if(d){this.trigger("cuechange");d=!1}});if("disabled"!==r){a.tech_.ready(function(){a.tech_.on("timeupdate",p)},!0)}Object.defineProperties(Ja(a),{default:{get:function(){return i},set:function(){}},mode:{get:function(){return r},set:function(e){var t=this;if(!er[e]){return}r=e;if(!this.preload_&&"disabled"!==r&&0===this.cues.length){cr(this.src,this)}if("disabled"!==r){this.tech_.ready(function(){t.tech_.on("timeupdate",p)},!0)}else{this.tech_.off("timeupdate",p)}this.trigger("modechange")}},cues:{get:function(){if(!this.loaded_){return null}return s},set:function(){}},activeCues:{get:function(){if(!this.loaded_){return null}if(0===this.cues.length){return o}for(var e=this.tech_.currentTime(),t=[],a=0,n=this.cues.length,r;a<n;a++){r=this.cues[a];if(r.startTime<=e&&r.endTime>=e){t.push(r)}else if(r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e){t.push(r)}}d=!1;if(t.length!==this.activeCues_.length){d=!0}else{for(var s=0;s<t.length;s++){if(-1===this.activeCues_.indexOf(t[s])){d=!0}}}this.activeCues_=t;o.setCues_(this.activeCues_);return o},set:function(){}}});if(n.src){a.src=n.src;if(!a.preload_){a.loaded_=!0}if(a.preload_||i||"subtitles"!==n.kind&&"captions"!==n.kind){cr(a.src,Ja(a))}}else{a.loaded_=!0}return a}var n=a.prototype;n.addCue=function(t){var a=t;if(e.vttjs&&!(t instanceof e.vttjs.VTTCue)){a=new e.vttjs.VTTCue(t.startTime,t.endTime,t.text);for(var n in t){if(!(n in a)){a[n]=t[n]}}a.id=t.id;a.originalCue_=t}for(var r=this.tech_.textTracks(),s=0;s<r.length;s++){if(r[s]!==this){r[s].removeCue(a)}}this.cues_.push(a);this.cues.setCues_(this.cues_)};n.removeCue=function(e){var t=this.cues_.length;while(t--){var a=this.cues_[t];if(a===e||a.originalCue_&&a.originalCue_===e){this.cues_.splice(t,1);this.cues.setCues_(this.cues_);break}}};return a}(tr);mr.prototype.allowedEvents_={cuechange:"cuechange"};var gr=function(e){tn(t,e);function t(t){var a;if(void 0===t){t={}}var n=te(t,{kind:Jn[t.kind]||""});a=e.call(this,n)||this;var r=!1;Object.defineProperty(Ja(a),"enabled",{get:function(){return r},set:function(e){if("boolean"!=typeof e||e===r){return}r=e;this.trigger("enabledchange")}});if(n.enabled){a.enabled=n.enabled}a.loaded_=!0;return a}return t}(tr),yr=function(e){tn(t,e);function t(t){var a;if(void 0===t){t={}}var n=te(t,{kind:Qn[t.kind]||""});a=e.call(this,n)||this;var r=!1;Object.defineProperty(Ja(a),"selected",{get:function(){return r},set:function(e){if("boolean"!=typeof e||e===r){return}r=e;this.trigger("selectedchange")}});if(n.selected){a.selected=n.selected}return a}return t}(tr),hr=0,_r=2,fr=function(e){tn(t,e);function t(t){var a;if(void 0===t){t={}}a=e.call(this)||this;var n,r=new mr(t);a.kind=r.kind;a.src=r.src;a.srclang=r.language;a.label=r.label;a["default"]=r["default"];Object.defineProperties(Ja(a),{readyState:{get:function(){return n}},track:{get:function(){return r}}});n=hr;r.addEventListener("loadeddata",function(){n=_r;a.trigger({type:"load",target:Ja(a)})});return a}return t}(Ua);fr.prototype.allowedEvents_={load:"load"};fr.NONE=hr;fr.LOADING=1;fr.LOADED=_r;fr.ERROR=3;var Tr={audio:{ListClass:zn,TrackClass:gr,capitalName:"Audio"},video:{ListClass:Kn,TrackClass:yr,capitalName:"Video"},text:{ListClass:Yn,TrackClass:mr,capitalName:"Text"}};Object.keys(Tr).forEach(function(e){Tr[e].getterName=e+"Tracks";Tr[e].privateName=e+"Tracks_"});var br={remoteText:{ListClass:Yn,TrackClass:mr,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Xn,TrackClass:fr,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},vr=ya({},Tr,br);br.names=Object.keys(br);Tr.names=Object.keys(Tr);vr.names=[].concat(br.names).concat(Tr.names);var Sr=Object.create||function(){function e(){}return function(t){if(1!==arguments.length){throw new Error("Object.create shim only accepts one parameter.")}e.prototype=t;return new e}}();function he(e,t){this.name="ParsingError";this.code=e.code;this.message=t||e.message}he.prototype=Sr(Error.prototype);he.prototype.constructor=he;he.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function _e(e){function t(e,t,a,n){return 3600*(0|e)+60*(0|t)+(0|a)+(0|n)/1e3}var a=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);if(!a){return null}if(a[3]){return t(a[1],a[2],a[3].replace(":",""),a[4])}else if(59<a[1]){return t(a[1],a[2],0,a[4])}else{return t(0,a[1],a[2],a[4])}}function fe(){this.values=Sr(null)}fe.prototype={set:function(e,t){if(!this.get(e)&&""!==t){this.values[e]=t}},get:function(e,t,a){if(a){return this.has(e)?this.values[e]:t[a]}return this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,r){for(var a=0;a<r.length;++a){if(t===r[a]){this.set(e,t);break}}},integer:function(e,t){if(/^-?\d+$/.test(t)){this.set(e,parseInt(t,10))}},percent:function(e,t){var a;if(a=t.match(/^([\d]{1,3})(\.[\d]*)?%$/)){t=parseFloat(t);if(0<=t&&100>=t){this.set(e,t);return!0}}return!1}};function Te(e,t,a,n){var r=n?e.split(n):[e];for(var s in r){if("string"!=typeof r[s]){continue}var i=r[s].split(a);if(2!==i.length){continue}var o=i[0],l=i[1];t(o,l)}}function be(e,t,a){var s=e;function n(){var t=_e(e);if(null===t){throw new he(he.Errors.BadTimeStamp,"Malformed timestamp: "+s)}e=e.replace(/^[^\sa-zA-Z-]+/,"");return t}function r(e,t){var n=new fe;Te(e,function(e,t){switch(e){case"region":for(var r=a.length-1;0<=r;r--){if(a[r].id===t){n.set(e,a[r].region);break}}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var s=t.split(","),o=s[0];n.integer(e,o);n.percent(e,o)?n.set("snapToLines",!1):null;n.alt(e,o,["auto"]);if(2===s.length){n.alt("lineAlign",s[1],["start","center","end"])}break;case"position":s=t.split(",");n.percent(e,s[0]);if(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"]);break;}},/:/,/\s/);t.region=n.get("region",null);t.vertical=n.get("vertical","");try{t.line=n.get("line","auto")}catch(t){}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(a){t.align=n.get("align","middle")}try{t.position=n.get("position","auto")}catch(a){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)}function i(){e=e.replace(/^\s+/,"")}i();t.startTime=n();i();if("-->"!==e.substr(0,3)){throw new he(he.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+s)}e=e.substr(3);i();t.endTime=n();i();r(e,t)}var kr=t.createElement("textarea"),Cr={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Er={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)"},Ir={v:"title",lang:"lang"},xr={rt:"ruby"};function ve(e,a){function n(){if(!a){return null}function e(e){a=a.substr(e.length);return e}var t=a.match(/^([^<]*)(<[^>]*>?)?/);return e(t[1]?t[1]:t[2])}function r(e){kr.innerHTML=e;e=kr.textContent;kr.textContent="";return e}function i(e,t){return!xr[t.localName]||xr[t.localName]===e.localName}function s(t,a){var n=Cr[t];if(!n){return null}var r=e.document.createElement(n),i=Ir[t];if(i&&a){r[i]=a.trim()}return r}var o=e.document.createElement("div"),l=o,d,p=[];while(null!==(d=n())){if("<"===d[0]){if("/"===d[1]){if(p.length&&p[p.length-1]===d.substr(2).replace(">","")){p.pop();l=l.parentNode}continue}var u=_e(d.substr(1,d.length-2)),c;if(u){c=e.document.createProcessingInstruction("timestamp",u);l.appendChild(c);continue}var g=d.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!g){continue}c=s(g[1],g[3]);if(!c){continue}if(!i(l,c)){continue}if(g[2]){var m=g[2].split(".");m.forEach(function(e){var t=/^bg_/.test(e),a=t?e.slice(3):e;if(Er.hasOwnProperty(a)){var n=t?"background-color":"color",r=Er[a];c.style[n]=r}});c.className=m.join(" ")}p.push(g[1]);l.appendChild(c);l=c;continue}l.appendChild(e.document.createTextNode(r(d)))}return o}var Lr=[[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 Se(e){for(var t=0,a;t<Lr.length;t++){a=Lr[t];if(e>=a[0]&&e<=a[1]){return!0}}return!1}function ke(e){var n=[],r="",s;if(!e||!e.childNodes){return"ltr"}function t(e,t){for(var a=t.childNodes.length-1;0<=a;a--){e.push(t.childNodes[a])}}function a(e){if(!e||!e.length){return null}var n=e.pop(),r=n.textContent||n.innerText;if(r){var i=r.match(/^.*(\n|\r)/);if(i){e.length=0;return i[0]}return r}if("ruby"===n.tagName){return a(e)}if(n.childNodes){t(e,n);return a(e)}}t(n,e);while(r=a(n)){for(var o=0;o<r.length;o++){s=r.charCodeAt(o);if(Se(s)){return"rtl"}}}return"ltr"}function Ce(e){if("number"==typeof e.line&&(e.snapToLines||0<=e.line&&100>=e.line)){return e.line}if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement){return-1}for(var t=e.track,a=t.textTrackList,n=0,r=0;r<a.length&&a[r]!==t;r++){if("showing"===a[r].mode){n++}}return-1*++n}function Ee(){}Ee.prototype.applyStyles=function(e,t){t=t||this.div;for(var a in e){if(e.hasOwnProperty(a)){t.style[a]=e[a]}}};Ee.prototype.formatStyle=function(e,t){return 0===e?0:e+t};function Ie(e,t,a){Ee.call(this);this.cue=t;this.cueDiv=ve(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:ke(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:a.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;break;}if(""===t.vertical){this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")})}else{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")})}}Ie.prototype=Sr(Ee.prototype);Ie.prototype.constructor=Ie;function xe(e){var t,a,n,r;if(e.div){a=e.div.offsetHeight;n=e.div.offsetWidth;r=e.div.offsetTop;var i=(i=e.div.childNodes)&&(i=i[0])&&i.getClientRects&&i.getClientRects();e=e.div.getBoundingClientRect();t=i?Math.max(i[0]&&i[0].height||0,e.height/i.length):0}this.left=e.left;this.right=e.right;this.top=e.top||r;this.height=e.height||a;this.bottom=e.bottom||r+(e.height||a);this.width=e.width||n;this.lineHeight=t!==void 0?t:e.lineHeight}xe.prototype.move=function(e,t){t=t!==void 0?t:this.lineHeight;switch(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;break;}};xe.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top};xe.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++){if(this.overlaps(e[t])){return!0}}return!1};xe.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right};xe.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;}};xe.prototype.intersectPercentage=function(e){var t=Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left)),a=Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top));return t*a/(this.height*this.width)};xe.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}};xe.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,a=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e;var r={left:e.left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||a};return r};function Le(e,t,a,n){function r(e,t){for(var r,s=new xe(e),o=1,l=0;l<t.length;l++){while(e.overlapsOppositeAxis(a,t[l])||e.within(a)&&e.overlapsAny(n)){e.move(t[l])}if(e.within(a)){return e}var d=e.intersectPercentage(a);if(o>d){r=new xe(e);o=d}e=new xe(s)}return r||s}var i=new xe(t),s=t.cue,o=Ce(s),l=[];if(s.snapToLines){var d;switch(s.vertical){case"":l=["+y","-y"];d="height";break;case"rl":l=["+x","-x"];d="width";break;case"lr":l=["-x","+x"];d="width";break;}var p=i.lineHeight,u=p*Math.round(o),c=a[d]+p,m=l[0];if(Math.abs(u)>c){u=0>u?-1:1;u*=Math.ceil(c/p)*p}if(0>o){u+=""===s.vertical?a.height:a.width;l=l.reverse()}i.move(m,u)}else{var g=100*(i.lineHeight/a.height);switch(s.lineAlign){case"center":o-=g/2;break;case"end":o-=g;break;}switch(s.vertical){case"":t.applyStyles({top:t.formatStyle(o,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(o,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(o,"%")});break;}l=["+y","-x","+x","-y"];i=new xe(t)}var y=r(i,l);t.move(y.toCSSCompatValues(a))}function Pe(){}Pe.StringDecoder=function(){return{decode:function(e){if(!e){return""}if("string"!=typeof e){throw new Error("Error - expected string data.")}return decodeURIComponent(encodeURIComponent(e))}}};Pe.convertCueToDOMTree=function(e,t){if(!e||!t){return null}return ve(e,t)};Pe.processCues=function(e,t,a){if(!e||!t||!a){return null}while(a.firstChild){a.removeChild(a.firstChild)}var r=e.document.createElement("div");r.style.position="absolute";r.style.left="0";r.style.right="0";r.style.top="0";r.style.bottom="0";r.style.margin="1.5%";a.appendChild(r);function n(e){for(var t=0;t<e.length;t++){if(e[t].hasBeenReset||!e[t].displayState){return!0}}return!1}if(!n(t)){for(var s=0;s<t.length;s++){r.appendChild(t[s].displayState)}return}var o=[],l=xe.getSimpleBoxPosition(r),d=Math.round(100*(l.height*.05))/100,p={font:d+"px "+"sans-serif"};(function(){for(var a,n,s=0;s<t.length;s++){n=t[s];a=new Ie(e,n,p);r.appendChild(a.div);Le(e,a,l,o);n.displayState=a.div;o.push(xe.getSimpleBoxPosition(a))}})()};Pe.Parser=function(e,t,a){if(!a){a=t;t={}}if(!t){t={}}this.window=e;this.vttjs=t;this.state="INITIAL";this.buffer="";this.decoder=a||new TextDecoder("utf8");this.regionList=[]};Pe.Parser.prototype={reportOrThrowError:function(t){if(t instanceof he){this.onparsingerror&&this.onparsingerror(t)}else{throw t}},parse:function(e){var i=this;if(e){i.buffer+=i.decoder.decode(e,{stream:!0})}function t(){var e=i.buffer,t=0;while(t<e.length&&"\r"!==e[t]&&"\n"!==e[t]){++t}var a=e.substr(0,t);if("\r"===e[t]){++t}if("\n"===e[t]){++t}i.buffer=e.substr(t);return a}function a(e){var t=new fe;Te(e,function(e,a){switch(e){case"id":t.set(e,a);break;case"width":t.percent(e,a);break;case"lines":t.integer(e,a);break;case"regionanchor":case"viewportanchor":var n=a.split(",");if(2!==n.length){break}var r=new fe;r.percent("x",n[0]);r.percent("y",n[1]);if(!r.has("x")||!r.has("y")){break}t.set(e+"X",r.get("x"));t.set(e+"Y",r.get("y"));break;case"scroll":t.alt(e,a,["up"]);break;}},/=/,/\s/);if(t.has("id")){var a=new(i.vttjs.VTTRegion||i.window.VTTRegion);a.width=t.get("width",100);a.lines=t.get("lines",3);a.regionAnchorX=t.get("regionanchorX",0);a.regionAnchorY=t.get("regionanchorY",100);a.viewportAnchorX=t.get("viewportanchorX",0);a.viewportAnchorY=t.get("viewportanchorY",100);a.scroll=t.get("scroll","");i.onregion&&i.onregion(a);i.regionList.push({id:t.get("id"),region:a})}}function n(e){var t=new fe;Te(e,function(e,a){switch(e){case"MPEGT":t.integer(e+"S",a);break;case"LOCA":t.set(e+"L",_e(a));break;}},/[^\d]:/,/,/);i.ontimestampmap&&i.ontimestampmap({MPEGTS:t.get("MPEGTS"),LOCAL:t.get("LOCAL")})}function r(e){if(e.match(/X-TIMESTAMP-MAP/)){Te(e,function(e,t){switch(e){case"X-TIMESTAMP-MAP":n(t);break;}},/=/)}else{Te(e,function(e,t){switch(e){case"Region":a(t);break;}},/:/)}}try{var s;if("INITIAL"===i.state){if(!/\r\n|\n/.test(i.buffer)){return this}s=t();var o=s.match(/^WEBVTT([ \t].*)?$/);if(!o||!o[0]){throw new he(he.Errors.BadSignature)}i.state="HEADER"}var l=!1;while(i.buffer){if(!/\r\n|\n/.test(i.buffer)){return this}if(!l){s=t()}else{l=!1}switch(i.state){case"HEADER":if(/:/.test(s)){r(s)}else if(!s){i.state="ID"}continue;case"NOTE":if(!s){i.state="ID"}continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){i.state="NOTE";break}if(!s){continue}i.cue=new(i.vttjs.VTTCue||i.window.VTTCue)(0,0,"");try{i.cue.align="center"}catch(t){i.cue.align="middle"}i.state="CUE";if(-1===s.indexOf("-->")){i.cue.id=s;continue}case"CUE":try{be(s,i.cue,i.regionList)}catch(t){i.reportOrThrowError(t);i.cue=null;i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":var d=-1!==s.indexOf("-->");if(!s||d&&(l=!0)){i.oncue&&i.oncue(i.cue);i.cue=null;i.state="ID";continue}if(i.cue.text){i.cue.text+="\n"}i.cue.text+=s.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":if(!s){i.state="ID"}continue;}}}catch(t){i.reportOrThrowError(t);if("CUETEXT"===i.state&&i.cue&&i.oncue){i.oncue(i.cue)}i.cue=null;i.state="INITIAL"===i.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var t=this;try{t.buffer+=t.decoder.decode();if(t.cue||"HEADER"===t.state){t.buffer+="\n\n";t.parse()}if("INITIAL"===t.state){throw new he(he.Errors.BadSignature)}}catch(a){t.reportOrThrowError(a)}t.onflush&&t.onflush();return this}};var Pr={"":1,lr:1,rl:1},Dr={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function De(e){if("string"!=typeof e){return!1}var t=Pr[e.toLowerCase()];return t?e.toLowerCase():!1}function we(e){if("string"!=typeof e){return!1}var t=Dr[e.toLowerCase()];return t?e.toLowerCase():!1}function Ae(e,t,a){this.hasBeenReset=!1;var n="",r=!1,i=e,s=t,o=a,l=null,d="",p=!0,u="auto",c="start",m="auto",g="auto",y=100,h="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 i},set:function(e){if("number"!=typeof e){throw new TypeError("Start time must be set to a number.")}i=e;this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e){throw new TypeError("End time must be set to a number.")}s=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 l},set:function(e){l=e;this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return d},set:function(e){var t=De(e);if(!1===t){throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.")}d=t;this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return p},set:function(e){p=!!e;this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e&&e!=="auto"){throw new SyntaxError("Line: an invalid number or illegal string was specified.")}u=e;this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return c},set:function(e){var t=we(e);if(!t){console.warn("lineAlign: an invalid or illegal string was specified.")}else{c=t;this.hasBeenReset=!0}}},position:{enumerable:!0,get:function(){return m},set:function(e){if(0>e||100<e){throw new Error("Position must be between 0 and 100.")}m=e;this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return g},set:function(e){var t=we(e);if(!t){console.warn("positionAlign: an invalid or illegal string was specified.")}else{g=t;this.hasBeenReset=!0}}},size:{enumerable:!0,get:function(){return y},set:function(e){if(0>e||100<e){throw new Error("Size must be between 0 and 100.")}y=e;this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return h},set:function(e){var t=we(e);if(!t){throw new SyntaxError("align: an invalid or illegal alignment string was specified.")}h=t;this.hasBeenReset=!0}}});this.displayState=void 0}Ae.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var wr={"":!0,up:!0};function Oe(e){if("string"!=typeof e){return!1}var t=wr[e.toLowerCase()];return t?e.toLowerCase():!1}function Re(e){return"number"==typeof e&&0<=e&&100>=e}var Ar=function(){var e=100,t=3,a=0,n=100,r=0,i=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!Re(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(!Re(e)){throw new Error("RegionAnchorX must be between 0 and 100.")}n=e}},regionAnchorX:{enumerable:!0,get:function(){return a},set:function(e){if(!Re(e)){throw new Error("RegionAnchorY must be between 0 and 100.")}a=e}},viewportAnchorY:{enumerable:!0,get:function(){return i},set:function(e){if(!Re(e)){throw new Error("ViewportAnchorY must be between 0 and 100.")}i=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!Re(e)){throw new Error("ViewportAnchorX must be between 0 and 100.")}r=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=Oe(e);if(!1===t){console.warn("Scroll: an invalid or illegal string was specified.")}else{s=t}}}})},Or=n(function(t){var a=t.exports={WebVTT:Pe,VTTCue:Ae,VTTRegion:Ar};e.vttjs=a;e.WebVTT=a.WebVTT;var n=a.VTTCue,r=a.VTTRegion,i=e.VTTCue,s=e.VTTRegion;a.shim=function(){e.VTTCue=n;e.VTTRegion=r};a.restore=function(){e.VTTCue=i;e.VTTRegion=s};if(!e.VTTCue){a.shim()}}),Rr=Or.WebVTT,Nr=Or.VTTCue,Ur=Or.VTTRegion;function Ne(e,t,a,n,r){if(void 0===r){r={}}var i=e.textTracks();r.kind=t;if(a){r.label=a}if(n){r.language=n}r.tech=e;var s=new vr.text.TrackClass(r);i.addTrack(s);return s}var Mr=function(a){tn(n,a);function n(e,t){var n;if(void 0===e){e={}}if(void 0===t){t=function(){}}e.reportTouchActivity=!1;n=a.call(this,null,e,t)||this;n.hasStarted_=!1;n.on("playing",function(){this.hasStarted_=!0});n.on("loadstart",function(){this.hasStarted_=!1});vr.names.forEach(function(t){var a=vr[t];if(e&&e[a.getterName]){n[a.privateName]=e[a.getterName]}});if(!n.featuresProgressEvents){n.manualProgressOn()}if(!n.featuresTimeupdateEvents){n.manualTimeUpdatesOn()}["Text","Audio","Video"].forEach(function(t){if(!1===e["native"+t+"Tracks"]){n["featuresNative"+t+"Tracks"]=!1}});if(!1===e.nativeCaptions||!1===e.nativeTextTracks){n.featuresNativeTextTracks=!1}else if(!0===e.nativeCaptions||!0===e.nativeTextTracks){n.featuresNativeTextTracks=!0}if(!n.featuresNativeTextTracks){n.emulateTextTracks()}n.preloadTextTracks=!1!==e.preloadTextTracks;n.autoRemoteTextTracks_=new vr.text.ListClass;n.initTrackListeners();if(!e.nativeControlsForTouch){n.emitTapEvents()}if(n.constructor){n.name_=n.constructor.name||"Unknown Tech"}return n}var r=n.prototype;r.triggerSourceset=function(e){var t=this;if(!this.isReady_){this.one("ready",function(){return t.setTimeout(function(){return t.triggerSourceset(e)},1)})}this.trigger({src:e,type:"sourceset"})};r.manualProgressOn=function(){this.on("durationchange",this.onDurationChange);this.manualProgress=!0;this.one("ready",this.trackProgress)};r.manualProgressOff=function(){this.manualProgress=!1;this.stopTrackingProgress();this.off("durationchange",this.onDurationChange)};r.trackProgress=function(){this.stopTrackingProgress();this.progressInterval=this.setInterval(Oa(this,function(){var e=this.bufferedPercent();if(this.bufferedPercent_!==e){this.trigger("progress")}this.bufferedPercent_=e;if(1===e){this.stopTrackingProgress()}}),500)};r.onDurationChange=function(){this.duration_=this.duration()};r.buffered=function(){return ie(0,0)};r.bufferedPercent=function(){return se(this.buffered(),this.duration_)};r.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)};r.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0;this.on("play",this.trackCurrentTime);this.on("pause",this.stopTrackingCurrentTime)};r.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1;this.stopTrackingCurrentTime();this.off("play",this.trackCurrentTime);this.off("pause",this.stopTrackingCurrentTime)};r.trackCurrentTime=function(){if(this.currentTimeInterval){this.stopTrackingCurrentTime()}this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)};r.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval);this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})};r.dispose=function(){this.clearTracks(Tr.names);if(this.manualProgress){this.manualProgressOff()}if(this.manualTimeUpdates){this.manualTimeUpdatesOff()}a.prototype.dispose.call(this)};r.clearTracks=function(e){var t=this;e=[].concat(e);e.forEach(function(e){var a=t[e+"Tracks"]()||[],n=a.length;while(n--){var r=a[n];if("text"===e){t.removeRemoteTextTrack(r)}a.removeTrack(r)}})};r.cleanupAutoTextTracks=function(){var e=this.autoRemoteTextTracks_||[],t=e.length;while(t--){var a=e[t];this.removeRemoteTextTrack(a)}};r.reset=function(){};r.error=function(e){if(e!==void 0){this.error_=new oe(e);this.trigger("error")}return this.error_};r.played=function(){if(this.hasStarted_){return ie(0,0)}return ie()};r.setCurrentTime=function(){if(this.manualTimeUpdates){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}};r.initTrackListeners=function(){var e=this;Tr.names.forEach(function(t){var a=Tr[t],n=function(){e.trigger(t+"trackchange")},r=e[a.getterName]();r.addEventListener("removetrack",n);r.addEventListener("addtrack",n);e.on("dispose",function(){r.removeEventListener("removetrack",n);r.removeEventListener("addtrack",n)})})};r.addWebVttScript_=function(){var a=this;if(e.WebVTT){return}if(t.body.contains(this.el())){if(!this.options_["vtt.js"]&&d(Or)&&0<Object.keys(Or).length){this.trigger("vttjsloaded");return}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(){a.trigger("vttjsloaded")};n.onerror=function(){a.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_)}};r.emulateTextTracks=function(){var e=this,t=this.textTracks(),a=this.remoteTextTracks(),n=function(a){return t.addTrack(a.track)},r=function(a){return t.removeTrack(a.track)};a.on("addtrack",n);a.on("removetrack",r);this.addWebVttScript_();var s=function(){return e.trigger("texttrackchange")},o=function(){s();for(var e=0,a;e<t.length;e++){a=t[e];a.removeEventListener("cuechange",s);if("showing"===a.mode){a.addEventListener("cuechange",s)}}};o();t.addEventListener("change",o);t.addEventListener("addtrack",o);t.addEventListener("removetrack",o);this.on("dispose",function(){a.off("addtrack",n);a.off("removetrack",r);t.removeEventListener("change",o);t.removeEventListener("addtrack",o);t.removeEventListener("removetrack",o);for(var e=0,l;e<t.length;e++){l=t[e];l.removeEventListener("cuechange",s)}})};r.addTextTrack=function(e,t,a){if(!e){throw new Error("TextTrack kind is required but was not provided")}return Ne(this,e,t,a)};r.createRemoteTextTrack=function(e){var t=te(e,{tech:this});return new br.remoteTextEl.TrackClass(t)};r.addRemoteTextTrack=function(e,t){var a=this;if(void 0===e){e={}}var n=this.createRemoteTextTrack(e);if(!0!==t&&!1!==t){ma.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);if(!0!==t){this.ready(function(){return a.autoRemoteTextTracks_.addTrack(n.track)})}return n};r.removeRemoteTextTrack=function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t);this.remoteTextTracks().removeTrack(e);this.autoRemoteTextTracks_.removeTrack(e)};r.getVideoPlaybackQuality=function(){return{}};r.requestPictureInPicture=function(){var t=this.options_.Promise||e.Promise;if(t){return t.reject()}};r.setPoster=function(){};r.playsinline=function(){};r.setPlaysinline=function(){};r.overrideNativeAudioTracks=function(){};r.overrideNativeVideoTracks=function(){};r.canPlayType=function(){return""};n.canPlayType=function(){return""};n.canPlaySource=function(e){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_={}}if(!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")}e=Xa(e);n.techs_[e]=t;n.techs_[Ya(e)]=t;if("Tech"!==e){n.defaultTechOrder_.push(e)}return t};n.getTech=function(t){if(!t){return}if(n.techs_&&n.techs_[t]){return n.techs_[t]}t=Xa(t);if(e&&e.videojs&&e.videojs[t]){ma.warn("The "+t+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)");return e.videojs[t]}};return n}(Qa);vr.names.forEach(function(e){var t=vr[e];Mr.prototype[t.getterName]=function(){this[t.privateName]=this[t.privateName]||new t.ListClass;return this[t.privateName]}});Mr.prototype.featuresVolumeControl=!0;Mr.prototype.featuresMuteControl=!0;Mr.prototype.featuresFullscreenResize=!1;Mr.prototype.featuresPlaybackRate=!1;Mr.prototype.featuresProgressEvents=!1;Mr.prototype.featuresSourceset=!1;Mr.prototype.featuresTimeupdateEvents=!1;Mr.prototype.featuresNativeTextTracks=!1;Mr.withSourceHandlers=function(e){e.registerSourceHandler=function(t,a){var n=e.sourceHandlers;if(!n){n=e.sourceHandlers=[]}if(a===void 0){a=n.length}n.splice(a,0,t)};e.canPlayType=function(t){for(var a=e.sourceHandlers||[],n,r=0;r<a.length;r++){n=a[r].canPlayType(t);if(n){return n}}return""};e.selectSourceHandler=function(t,a){for(var n=e.sourceHandlers||[],r,s=0;s<n.length;s++){r=n[s].canHandleSource(t,a);if(r){return n[s]}}return null};e.canPlaySource=function(t,a){var n=e.selectSourceHandler(t,a);if(n){return n.canHandleSource(t,a)}return""};["seekable","seeking","duration"].forEach(function(e){var t=this[e];if("function"!=typeof t){return}this[e]=function(){if(this.sourceHandler_&&this.sourceHandler_[e]){return this.sourceHandler_[e].apply(this.sourceHandler_,arguments)}return t.apply(this,arguments)}},e.prototype);e.prototype.setSource=function(t){var a=e.selectSourceHandler(t,this.options_);if(!a){if(e.nativeSourceHandler){a=e.nativeSourceHandler}else{ma.error("No source handler found for the current source.")}}this.disposeSourceHandler();this.off("dispose",this.disposeSourceHandler);if(a!==e.nativeSourceHandler){this.currentSource_=t}this.sourceHandler_=a.handleSource(t,this,this.options_);this.one("dispose",this.disposeSourceHandler)};e.prototype.disposeSourceHandler=function(){if(this.currentSource_){this.clearTracks(["audio","video"]);this.currentSource_=null}this.cleanupAutoTextTracks();if(this.sourceHandler_){if(this.sourceHandler_.dispose){this.sourceHandler_.dispose()}this.sourceHandler_=null}}};Qa.registerComponent("Tech",Mr);Mr.registerTech("Tech",Mr);Mr.defaultTechOrder_=[];var Br={},jr={},Fr={};function Ue(e,t,a){e.setTimeout(function(){return ze(t,Br[t.type],a,e)},1)}function Me(e,t){e.forEach(function(e){return e.setTech&&e.setTech(t)})}function Be(e,t,a){return e.reduceRight(He(a),t[a]())}function je(e,t,a,n){return t[a](e.reduce(He(a),n))}function Fe(e,t,a,n){if(void 0===n){n=null}var r="call"+Xa(a),i=e.reduce(He(r),n),s=i===Fr,o=s?null:t[a](i);qe(e,a,o,s);return o}var Hr={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1},qr={setCurrentTime:1,setMuted:1,setVolume:1},Vr={play:1,pause:1};function He(e){return function(t,a){if(t===Fr){return Fr}if(a[e]){return a[e](t)}return t}}function qe(e,t,a,n){for(var r=e.length-1,s;0<=r;r--){s=e[r];if(s[t]){s[t](n,a)}}}function Ve(e){jr[e.id()]=null}function We(e,t){var a=jr[e.id()],n=null;if(a===void 0||null===a){n=t(e);jr[e.id()]=[[t,n]];return n}for(var r=0;r<a.length;r++){var s=a[r],o=s[0],l=s[1];if(o!==t){continue}n=l}if(null===n){n=t(e);a.push([t,n])}return n}function ze(e,t,a,n,r,i){if(void 0===e){e={}}if(void 0===t){t=[]}if(void 0===r){r=[]}if(void 0===i){i=!1}var s=t,l=s[0],d=s.slice(1);if("string"==typeof l){ze(e,Br[l],a,n,r,i)}else if(l){var p=We(n,l);if(!p.setSource){r.push(p);return ze(e,d,a,n,r,i)}p.setSource(o({},e),function(t,s){if(t){return ze(e,d,a,n,r,i)}r.push(p);ze(s,e.type===s.type?d:Br[s.type],a,n,r,i)})}else if(d.length){ze(e,d,a,n,r,i)}else if(i){a(e,r)}else{ze(e,Br["*"],a,n,r,!0)}}var Wr={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"},zr=function(e){if(void 0===e){e=""}var t=rr(e),a=Wr[t.toLowerCase()];return a||""},Gr=function(e,t){if(!t){return""}if(e.cache_.source.src===t&&e.cache_.source.type){return e.cache_.source.type}var a=e.cache_.sources.filter(function(e){return e.src===t});if(a.length){return a[0].type}for(var n=e.$$("source"),r=0,o;r<n.length;r++){o=n[r];if(o.type&&o.src&&o.src===t){return o.type}}return zr(t)},Kr=function e(t){if(Array.isArray(t)){var a=[];t.forEach(function(t){t=e(t);if(Array.isArray(t)){a=a.concat(t)}else if(l(t)){a.push(t)}});t=a}else if("string"==typeof t&&t.trim()){t=[Ge({src:t})]}else if(l(t)&&"string"==typeof t.src&&t.src&&t.src.trim()){t=[Ge(t)]}else{t=[]}return t};function Ge(e){if(!e.type){var t=zr(e.src);if(t){e.type=t}}return e}var Yr=function(e){tn(t,e);function t(t,a,n){var r,s=te({createEl:!1},a);r=e.call(this,t,s,n)||this;if(!a.playerOptions.sources||0===a.playerOptions.sources.length){for(var o=0,l=a.playerOptions.techOrder;o<l.length;o++){var d=Xa(l[o]),p=Mr.getTech(d);if(!d){p=Qa.getComponent(d)}if(p&&p.isSupported()){t.loadTech_(d);break}}}else{t.src(a.playerOptions.sources)}return r}return t}(Qa);Qa.registerComponent("MediaLoader",Yr);var Xr=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.emitTapEvents();n.enable();return n}var a=t.prototype;a.createEl=function(t,a,n){if(void 0===t){t="div"}if(void 0===a){a={}}if(void 0===n){n={}}a=o({innerHTML:"<span aria-hidden=\"true\" class=\"vjs-icon-placeholder\"></span>",className:this.buildCSSClass(),tabIndex:0},a);if("button"===t){ma.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead.")}n=o({role:"button"},n);this.tabIndex_=a.tabIndex;var r=e.prototype.createEl.call(this,t,a,n);this.createControlTextEl(r);return r};a.dispose=function(){this.controlTextEl_=null;e.prototype.dispose.call(this)};a.createControlTextEl=function(e){this.controlTextEl_=f("span",{className:"vjs-control-text"},{"aria-live":"polite"});if(e){e.appendChild(this.controlTextEl_)}this.controlText(this.controlText_,e);return this.controlTextEl_};a.controlText=function(e,t){if(void 0===t){t=this.el()}if(e===void 0){return this.controlText_||"Need Text"}var a=this.localize(e);this.controlText_=e;T(this.controlTextEl_,a);if(!this.nonIconControl){t.setAttribute("title",a)}};a.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)};a.enable=function(){if(!this.enabled_){this.enabled_=!0;this.removeClass("vjs-disabled");this.el_.setAttribute("aria-disabled","false");if("undefined"!=typeof this.tabIndex_){this.el_.setAttribute("tabIndex",this.tabIndex_)}this.on(["tap","click"],this.handleClick);this.on("keydown",this.handleKeyDown)}};a.disable=function(){this.enabled_=!1;this.addClass("vjs-disabled");this.el_.setAttribute("aria-disabled","true");if("undefined"!=typeof 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)};a.handleClick=function(){if(this.options_.clickHandler){this.options_.clickHandler.call(this,arguments)}};a.handleKeyDown=function(t){if(Rn.isEventKey(t,"Space")||Rn.isEventKey(t,"Enter")){t.preventDefault();t.stopPropagation();this.trigger("click")}else{e.prototype.handleKeyDown.call(this,t)}};return t}(Qa);Qa.registerComponent("ClickableComponent",Xr);var $r=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.update();t.on("posterchange",Oa(Ja(n),n.update));return n}var a=t.prototype;a.dispose=function(){this.player().off("posterchange",this.update);e.prototype.dispose.call(this)};a.createEl=function(){var e=f("div",{className:"vjs-poster",tabIndex:-1});return e};a.update=function(){var e=this.player().poster();this.setSrc(e);if(e){this.show()}else{this.hide()}};a.setSrc=function(e){var t="";if(e){t="url(\""+e+"\")"}this.el_.style.backgroundImage=t};a.handleClick=function(){if(!this.player_.controls()){return}var e=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&0<this.player_.eme.sessions.length;if(this.player_.tech(!0)&&!((yn||cn)&&e)){this.player_.tech(!0).focus()}if(this.player_.paused()){de(this.player_.play())}else{this.player_.pause()}};return t}(Xr);Qa.registerComponent("PosterImage",$r);var Qr="#ccc",Jr={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 Ke(e,t){var a;if(4===e.length){a=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]}else if(7===e.length){a=e.slice(1)}else{throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.")}return"rgba("+parseInt(a.slice(0,2),16)+","+parseInt(a.slice(2,4),16)+","+parseInt(a.slice(4,6),16)+","+t+")"}function Ye(e,t,a){try{e.style[t]=a}catch(t){}}var Zr=function(t){tn(a,t);function a(a,n,r){var i=t.call(this,a,n,r)||this;var s=Oa(Ja(i),i.updateDisplay);a.on("loadstart",Oa(Ja(i),i.toggleDisplay));a.on("texttrackchange",s);a.on("loadedmetadata",Oa(Ja(i),i.preselectTrack));a.ready(Oa(Ja(i),function(){if(a.tech_&&a.tech_.featuresNativeTextTracks){this.hide();return}a.on("fullscreenchange",s);a.on("playerresize",s);e.addEventListener("orientationchange",s);a.on("dispose",function(){return e.removeEventListener("orientationchange",s)});for(var t=this.options_.playerOptions.tracks||[],n=0;n<t.length;n++){this.player_.addRemoteTextTrack(t[n],!0)}this.preselectTrack()}));return i}var n=a.prototype;n.preselectTrack=function(){for(var e={captions:1,subtitles:1},t=this.player_.textTracks(),a=this.player_.cache_.selectedLanguage,n,r,s,o=0,l;o<t.length;o++){l=t[o];if(a&&a.enabled&&a.language&&a.language===l.language&&l.kind in e){if(l.kind===a.kind){s=l}else if(!s){s=l}}else if(a&&!a.enabled){s=null;n=null;r=null}else if(l["default"]){if("descriptions"===l.kind&&!n){n=l}else if(l.kind in e&&!r){r=l}}}if(s){s.mode="showing"}else if(r){r.mode="showing"}else if(n){n.mode="showing"}};n.toggleDisplay=function(){if(this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks){this.hide()}else{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(){if("function"==typeof e.WebVTT){e.WebVTT.processCues(e,[],this.el_)}};n.updateDisplay=function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;this.clearDisplay();if(t){for(var a=[],n=0,r;n<e.length;++n){r=e[n];if("showing"!==r.mode){continue}a.push(r)}this.updateForTrack(a);return}var s=null,o=null,l=e.length;while(l--){var d=e[l];if("showing"===d.mode){if("descriptions"===d.kind){s=d}else{o=d}}}if(o){if("off"!==this.getAttribute("aria-live")){this.setAttribute("aria-live","off")}this.updateForTrack(o)}else if(s){if("assertive"!==this.getAttribute("aria-live")){this.setAttribute("aria-live","assertive")}this.updateForTrack(s)}};n.updateDisplayState=function(t){var a=this.player_.textTrackSettings.getValues(),n=t.activeCues,r=n.length;while(r--){var s=n[r];if(!s){continue}var o=s.displayState;if(a.color){o.firstChild.style.color=a.color}if(a.textOpacity){Ye(o.firstChild,"color",Ke(a.color||"#fff",a.textOpacity))}if(a.backgroundColor){o.firstChild.style.backgroundColor=a.backgroundColor}if(a.backgroundOpacity){Ye(o.firstChild,"backgroundColor",Ke(a.backgroundColor||"#000",a.backgroundOpacity))}if(a.windowColor){if(a.windowOpacity){Ye(o,"backgroundColor",Ke(a.windowColor,a.windowOpacity))}else{o.style.backgroundColor=a.windowColor}}if(a.edgeStyle){if("dropshadow"===a.edgeStyle){o.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222"}else if("raised"===a.edgeStyle){o.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222"}else if("depressed"===a.edgeStyle){o.firstChild.style.textShadow="1px 1px "+Qr+", 0 1px "+Qr+", -1px -1px "+"#222"+", 0 -1px "+"#222"}else if("uniform"===a.edgeStyle){o.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222"}}if(a.fontPercent&&1!==a.fontPercent){var l=e.parseFloat(o.style.fontSize);o.style.fontSize=l*a.fontPercent+"px";o.style.height="auto";o.style.top="auto";o.style.bottom="2px"}if(a.fontFamily&&"default"!==a.fontFamily){if("small-caps"===a.fontFamily){o.firstChild.style.fontVariant="small-caps"}else{o.firstChild.style.fontFamily=Jr[a.fontFamily]}}}};n.updateForTrack=function(t){if(!Array.isArray(t)){t=[t]}if("function"!=typeof e.WebVTT||t.every(function(e){return!e.activeCues})){return}for(var a=[],n=0,r;n<t.length;++n){r=t[n];for(var s=0;s<r.activeCues.length;++s){a.push(r.activeCues[s])}}e.WebVTT.processCues(e,a,this.el_);for(var o=0,l;o<t.length;++o){l=t[o];for(var d=0,p;d<l.activeCues.length;++d){p=l.activeCues[d].displayState;S(p,"vjs-text-track-cue");S(p,"vjs-text-track-cue-"+(l.language?l.language:o))}if(this.player_.textTrackSettings){this.updateDisplayState(l)}}};return a}(Qa);Qa.registerComponent("TextTrackDisplay",Zr);var ei=function(e){tn(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.createEl=function(){var t=this.player_.isAudio(),a=this.localize(t?"Audio Player":"Video Player"),n=f("span",{className:"vjs-control-text",innerHTML:this.localize("{1} is loading.",[a])}),r=e.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});r.appendChild(n);return r};return t}(Qa);Qa.registerComponent("LoadingSpinner",ei);var ti=function(e){tn(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.createEl=function(e,t,a){if(void 0===t){t={}}if(void 0===a){a={}}e="button";t=o({innerHTML:"<span aria-hidden=\"true\" class=\"vjs-icon-placeholder\"></span>",className:this.buildCSSClass()},t);a=o({type:"button"},a);var n=Qa.prototype.createEl.call(this,e,t,a);this.createControlTextEl(n);return n};a.addChild=function(e,t){if(void 0===t){t={}}var a=this.constructor.name;ma.warn("Adding an actionable (user controllable) child to a Button ("+a+") is not supported; use a ClickableComponent instead.");return Qa.prototype.addChild.call(this,e,t)};a.enable=function(){e.prototype.enable.call(this);this.el_.removeAttribute("disabled")};a.disable=function(){e.prototype.disable.call(this);this.el_.setAttribute("disabled","disabled")};a.handleKeyDown=function(t){if(Rn.isEventKey(t,"Space")||Rn.isEventKey(t,"Enter")){t.stopPropagation();return}e.prototype.handleKeyDown.call(this,t)};return t}(Xr);Qa.registerComponent("Button",ti);var ai=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.mouseused_=!1;n.on("mousedown",n.handleMouseDown);return n}var a=t.prototype;a.buildCSSClass=function(){return"vjs-big-play-button"};a.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY){var a=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&0<this.player_.eme.sessions.length;de(t);if(this.player_.tech(!0)&&!((yn||cn)&&a)){this.player_.tech(!0).focus()}return}var n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(!r){this.player_.tech(!0).focus();return}var i=function(){return r.focus()};if(le(t)){t.then(i,function(){})}else{this.setTimeout(i,1)}};a.handleKeyDown=function(t){this.mouseused_=!1;e.prototype.handleKeyDown.call(this,t)};a.handleMouseDown=function(){this.mouseused_=!0};return t}(ti);ai.prototype.controlText_="Play Video";Qa.registerComponent("BigPlayButton",ai);var ni=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.controlText(a&&a.controlText||n.localize("Close"));return n}var a=t.prototype;a.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)};a.handleClick=function(){this.trigger({type:"close",bubbles:!1})};a.handleKeyDown=function(t){if(Rn.isEventKey(t,"Esc")){t.preventDefault();t.stopPropagation();this.trigger("click")}else{e.prototype.handleKeyDown.call(this,t)}};return t}(ti);Qa.registerComponent("CloseButton",ni);var ri=function(e){tn(t,e);function t(t,a){var n;if(void 0===a){a={}}n=e.call(this,t,a)||this;a.replay=a.replay===void 0||a.replay;n.on(t,"play",n.handlePlay);n.on(t,"pause",n.handlePause);if(a.replay){n.on(t,"ended",n.handleEnded)}return n}var a=t.prototype;a.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)};a.handleClick=function(){if(this.player_.paused()){this.player_.play()}else{this.player_.pause()}};a.handleSeeked=function(e){this.removeClass("vjs-ended");if(this.player_.paused()){this.handlePause(e)}else{this.handlePlay(e)}};a.handlePlay=function(){this.removeClass("vjs-ended");this.removeClass("vjs-paused");this.addClass("vjs-playing");this.controlText("Pause")};a.handlePause=function(){this.removeClass("vjs-playing");this.addClass("vjs-paused");this.controlText("Play")};a.handleEnded=function(){this.removeClass("vjs-playing");this.addClass("vjs-ended");this.controlText("Replay");this.one(this.player_,"seeked",this.handleSeeked)};return t}(ti);ri.prototype.controlText_="Play";Qa.registerComponent("PlayToggle",ri);var ii=function(e,t){e=0>e?0:e;var a=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),i=Math.floor(t/60%60),o=Math.floor(t/3600);if(isNaN(e)||e===1/0){r=n=a="-"}r=0<r||0<o?r+":":"";n=((r||10<=i)&&10>n?"0"+n:n)+":";a=10>a?"0"+a:a;return r+n+a},si=ii;function Xe(e,t){if(void 0===t){t=e}return si(e,t)}var oi=function(e){tn(a,e);function a(t,a){var n=e.call(this,t,a)||this;n.on(t,["timeupdate","ended"],n.updateContent);n.updateTextNode_();return n}var n=a.prototype;n.createEl=function(){var t=this.buildCSSClass(),a=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_)+"\xA0</span>"});this.contentEl_=f("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"});a.appendChild(this.contentEl_);return a};n.dispose=function(){this.contentEl_=null;this.textNode_=null;e.prototype.dispose.call(this)};n.updateTextNode_=function(e){var a=this;if(void 0===e){e=0}e=Xe(e);if(this.formattedTime_===e){return}this.formattedTime_=e;this.requestAnimationFrame(function(){if(!a.contentEl_){return}var e=a.textNode_;a.textNode_=t.createTextNode(a.formattedTime_);if(!a.textNode_){return}if(e){a.contentEl_.replaceChild(a.textNode_,e)}else{a.contentEl_.appendChild(a.textNode_)}})};n.updateContent=function(){};return a}(Qa);oi.prototype.labelText_="Time";oi.prototype.controlText_="Time";Qa.registerComponent("TimeDisplay",oi);var li=function(e){tn(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.buildCSSClass=function(){return"vjs-current-time"};a.updateContent=function(){var e;if(this.player_.ended()){e=this.player_.duration()}else{e=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}this.updateTextNode_(e)};return t}(oi);li.prototype.labelText_="Current Time";li.prototype.controlText_="Current Time";Qa.registerComponent("CurrentTimeDisplay",li);var di=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.on(t,"durationchange",n.updateContent);n.on(t,"loadstart",n.updateContent);n.on(t,"loadedmetadata",n.updateContent);return n}var a=t.prototype;a.buildCSSClass=function(){return"vjs-duration"};a.updateContent=function(){var e=this.player_.duration();this.updateTextNode_(e)};return t}(oi);di.prototype.labelText_="Duration";di.prototype.controlText_="Duration";Qa.registerComponent("DurationDisplay",di);var pi=function(e){tn(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"<div><span>/</span></div>"},{"aria-hidden":!0})};return t}(Qa);Qa.registerComponent("TimeDivider",pi);var ui=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.on(t,"durationchange",n.updateContent);return n}var a=t.prototype;a.buildCSSClass=function(){return"vjs-remaining-time"};a.createEl=function(){var t=e.prototype.createEl.call(this);t.insertBefore(f("span",{},{"aria-hidden":!0},"-"),this.contentEl_);return t};a.updateContent=function(){if("number"!=typeof this.player_.duration()){return}var e;if(this.player_.ended()){e=0}else if(this.player_.remainingTimeDisplay){e=this.player_.remainingTimeDisplay()}else{e=this.player_.remainingTime()}this.updateTextNode_(e)};return t}(oi);ui.prototype.labelText_="Remaining Time";ui.prototype.controlText_="Remaining Time";Qa.registerComponent("RemainingTimeDisplay",ui);var ci=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.updateShowing();n.on(n.player(),"durationchange",n.updateShowing);return n}var a=t.prototype;a.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});this.contentEl_=f("div",{className:"vjs-live-display",innerHTML:"<span class=\"vjs-control-text\">"+this.localize("Stream Type")+"\xA0</span>"+this.localize("LIVE")},{"aria-live":"off"});t.appendChild(this.contentEl_);return t};a.dispose=function(){this.contentEl_=null;e.prototype.dispose.call(this)};a.updateShowing=function(){if(this.player().duration()===1/0){this.show()}else{this.hide()}};return t}(Qa);Qa.registerComponent("LiveDisplay",ci);var mi=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.updateLiveEdgeStatus();if(n.player_.liveTracker){n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatus)}return n}var a=t.prototype;a.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});this.textEl_=f("span",{className:"vjs-seek-to-live-text",innerHTML:this.localize("LIVE")},{"aria-hidden":"true"});t.appendChild(this.textEl_);return t};a.updateLiveEdgeStatus=function(){if(!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")}else{this.setAttribute("aria-disabled",!1);this.removeClass("vjs-at-live-edge");this.controlText("Seek to live, currently behind live")}};a.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()};a.dispose=function(){if(this.player_.liveTracker){this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatus)}this.textEl_=null;e.prototype.dispose.call(this)};return t}(ti);mi.prototype.controlText_="Seek to live, currently playing live";Qa.registerComponent("SeekToLive",mi);var gi=function(e,t,a){e=+e;return Math.min(a,Math.max(t,isNaN(e)?t:e))},yi=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.bar=n.getChild(n.options_.barName);n.vertical(!!n.options_.vertical);n.enable();return n}var a=t.prototype;a.enabled=function(){return this.enabled_};a.enable=function(){if(this.enabled()){return}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);if(this.playerEvent){this.on(this.player_,this.playerEvent,this.update)}this.removeClass("disabled");this.setAttribute("tabindex",0);this.enabled_=!0};a.disable=function(){if(!this.enabled()){return}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");if(this.playerEvent){this.off(this.player_,this.playerEvent,this.update)}this.enabled_=!1};a.createEl=function(t,a,n){if(void 0===a){a={}}if(void 0===n){n={}}a.className=a.className+" vjs-slider";a=o({tabIndex:0},a);n=o({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n);return e.prototype.createEl.call(this,t,a,n)};a.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;if("mousedown"===e.type){e.preventDefault()}if("touchstart"===e.type&&!mn){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)};a.handleMouseMove=function(){};a.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;w();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()};a.update=function(){var e=this;if(!this.el_||!this.bar){return}var t=this.getProgress();if(t===this.progress_){return t}this.progress_=t;this.requestAnimationFrame(function(){var a=e.vertical()?"height":"width";e.bar.el().style[a]=(100*t).toFixed(2)+"%"});return t};a.getProgress=function(){return+gi(this.getPercent(),0,1).toFixed(4)};a.calculateDistance=function(e){var t=R(this.el_,e);if(this.vertical()){return t.y}return t.x};a.handleKeyDown=function(t){if(Rn.isEventKey(t,"Left")||Rn.isEventKey(t,"Down")){t.preventDefault();t.stopPropagation();this.stepBack()}else if(Rn.isEventKey(t,"Right")||Rn.isEventKey(t,"Up")){t.preventDefault();t.stopPropagation();this.stepForward()}else{e.prototype.handleKeyDown.call(this,t)}};a.handleClick=function(e){e.stopPropagation();e.preventDefault()};a.vertical=function(e){if(e===void 0){return this.vertical_||!1}this.vertical_=!!e;if(this.vertical_){this.addClass("vjs-slider-vertical")}else{this.addClass("vjs-slider-horizontal")}};return t}(Qa);Qa.registerComponent("Slider",yi);var hi=function(e,t){return gi(100*(e/t),0,100).toFixed(2)+"%"},fi=function(e){tn(a,e);function a(t,a){var n=e.call(this,t,a)||this;n.partEls_=[];n.on(t,"progress",n.update);return n}var n=a.prototype;n.createEl=function(){var a=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),n=f("span",{className:"vjs-control-text"}),r=f("span",{textContent:this.localize("Loaded")}),i=t.createTextNode(": ");this.percentageEl_=f("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"});a.appendChild(n);n.appendChild(r);n.appendChild(i);n.appendChild(this.percentageEl_);return a};n.dispose=function(){this.partEls_=null;this.percentageEl_=null;e.prototype.dispose.call(this)};n.update=function(){var e=this;this.requestAnimationFrame(function(){var t=e.player_.liveTracker,a=e.player_.buffered(),n=t&&t.isLive()?t.seekableEnd():e.player_.duration(),r=e.player_.bufferedEnd(),s=e.partEls_,o=hi(r,n);if(e.percent_!==o){e.el_.style.width=o;T(e.percentageEl_,o);e.percent_=o}for(var l=0;l<a.length;l++){var d=a.start(l),p=a.end(l),u=s[l];if(!u){u=e.el_.appendChild(f());s[l]=u}if(u.dataset.start===d&&u.dataset.end===p){continue}u.dataset.start=d;u.dataset.end=p;u.style.left=hi(d,r);u.style.width=hi(p-d,r)}for(var c=s.length;c>a.length;c--){e.el_.removeChild(s[c-1])}s.length=a.length})};return a}(Qa);Qa.registerComponent("LoadProgressBar",fi);var Ti=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.update=Ra(Oa(Ja(n),n.update),Aa);return n}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})};a.update=function(e,t,a){var n=A(this.el_),r=A(this.player_.el()),i=e.width*t;if(!r||!n){return}var s=e.left-r.left+i,o=e.width-i+(r.right-e.right),l=n.width/2;if(s<l){l+=l-s}else if(o<l){l=o}if(0>l){l=0}else if(l>n.width){l=n.width}this.el_.style.right="-"+l+"px";this.write(a)};a.write=function(e){T(this.el_,e)};a.updateTime=function(e,t,a,n){var r=this;if(this.rafId_){this.cancelAnimationFrame(this.rafId_)}this.rafId_=this.requestAnimationFrame(function(){var i,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),l=o-t*o;i=(1>l?"":"-")+Xe(l,o)}else{i=Xe(a,s)}r.update(e,t,i);if(n){n()}})};return t}(Qa);Qa.registerComponent("TimeTooltip",Ti);var bi=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.update=Ra(Oa(Ja(n),n.update),Aa);return n}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})};a.update=function(e,t){var a=this.getChild("timeTooltip");if(!a){return}var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();a.updateTime(e,t,n)};return t}(Qa);bi.prototype.options_={children:[]};if(!vn&&!ln){bi.prototype.options_.children.push("timeTooltip")}Qa.registerComponent("PlayProgressBar",bi);var vi=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.update=Ra(Oa(Ja(n),n.update),Aa);return n}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})};a.update=function(e,t){var a=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,function(){a.el_.style.left=e.width*t+"px"})};return t}(Qa);vi.prototype.options_={children:["timeTooltip"]};Qa.registerComponent("MouseTimeDisplay",vi);var Si=12,ki=function(e){tn(a,e);function a(t,a){var n=e.call(this,t,a)||this;n.setEventHandlers_();return n}var n=a.prototype;n.setEventHandlers_=function(){this.update_=Oa(this,this.update);this.update=Ra(this.update_,Aa);this.on(this.player_,["ended","durationchange","timeupdate"],this.update);if(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_);if("hidden"in t&&"visibilityState"in t){this.on(t,"visibilitychange",this.toggleVisibility_)}};n.toggleVisibility_=function(a){if(t.hidden){this.disableInterval_(a)}else{this.enableInterval_();this.update()}};n.enableInterval_=function(){if(this.updateInterval){return}this.updateInterval=this.setInterval(this.update,Aa)};n.disableInterval_=function(t){if(this.player_.liveTracker&&this.player_.liveTracker.isLive()&&"ended"!==t.type){return}if(!this.updateInterval){return}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(){var t=this,a=e.prototype.update.call(this);this.requestAnimationFrame(function(){var e=t.player_.ended()?t.player_.duration():t.getCurrentTime_(),n=t.player_.liveTracker,r=t.player_.duration();if(n&&n.isLive()){r=t.player_.liveTracker.liveCurrentTime()}if(t.percent_!==a){t.el_.setAttribute("aria-valuenow",(100*a).toFixed(2));t.percent_=a}if(t.currentTime_!==e||t.duration_!==r){t.el_.setAttribute("aria-valuetext",t.localize("progress bar timing: currentTime={1} duration={2}",[Xe(e,r),Xe(r,r)],"{1} of {2}"));t.currentTime_=e;t.duration_=r}if(t.bar){t.bar.update(A(t.el()),t.getProgress())}});return a};n.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()};n.getPercent=function(){var e=this.getCurrentTime_(),t,a=this.player_.liveTracker;if(a&&a.isLive()){t=(e-a.seekableStart())/a.liveWindow();if(a.atLiveEdge()){t=1}}else{t=e/this.player_.duration()}return t};n.handleMouseDown=function(t){if(!F(t)){return}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(!F(e)){return}var t,a=this.calculateDistance(e),n=this.player_.liveTracker;if(!n||!n.isLive()){t=a*this.player_.duration();if(t===this.player_.duration()){t=t-.1}}else{var r=n.seekableStart(),i=n.liveCurrentTime();t=r+a*n.liveWindow();if(t>=i){t=i}if(t<=r){t=r+.1}if(t===1/0){return}}this.player_.currentTime(t)};n.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");if(!t){return}t.show()};n.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");if(!t){return}t.hide()};n.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t);if(t){t.stopPropagation()}this.player_.scrubbing(!1);this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0});if(this.videoWasPlaying){de(this.player_.play())}else{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(){if(this.player_.paused()){this.player_.play()}else{this.player_.pause()}};n.handleKeyDown=function(t){if(Rn.isEventKey(t,"Space")||Rn.isEventKey(t,"Enter")){t.preventDefault();t.stopPropagation();this.handleAction(t)}else if(Rn.isEventKey(t,"Home")){t.preventDefault();t.stopPropagation();this.player_.currentTime(0)}else if(Rn.isEventKey(t,"End")){t.preventDefault();t.stopPropagation();this.player_.currentTime(this.player_.duration())}else if(/^[0-9]$/.test(Rn(t))){t.preventDefault();t.stopPropagation();var a=10*(Rn.codes[Rn(t)]-Rn.codes[0])/100;this.player_.currentTime(this.player_.duration()*a)}else if(Rn.isEventKey(t,"PgDn")){t.preventDefault();t.stopPropagation();this.player_.currentTime(this.player_.currentTime()-5*Si)}else if(Rn.isEventKey(t,"PgUp")){t.preventDefault();t.stopPropagation();this.player_.currentTime(this.player_.currentTime()+5*Si)}else{e.prototype.handleKeyDown.call(this,t)}};return a}(yi);ki.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};if(!vn&&!ln){ki.prototype.options_.children.splice(1,0,"mouseTimeDisplay")}Qa.registerComponent("SeekBar",ki);var Ci=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.handleMouseMove=Ra(Oa(Ja(n),n.handleMouseMove),Aa);n.throttledHandleMouseSeek=Ra(Oa(Ja(n),n.handleMouseSeek),Aa);n.enable();return n}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})};a.handleMouseMove=function(e){var t=this.getChild("seekBar");if(!t){return}var a=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(!a&&!n){return}var r=t.el(),i=A(r),s=R(r,e).x;s=gi(0,1,s);if(n){n.update(i,s)}if(a){a.update(i,t.getProgress())}};a.handleMouseSeek=function(e){var t=this.getChild("seekBar");if(t){t.handleMouseMove(e)}};a.enabled=function(){return this.enabled_};a.disable=function(){this.children().forEach(function(e){return e.disable&&e.disable()});if(!this.enabled()){return}this.off(["mousedown","touchstart"],this.handleMouseDown);this.off(this.el_,"mousemove",this.handleMouseMove);this.handleMouseUp();this.addClass("disabled");this.enabled_=!1};a.enable=function(){this.children().forEach(function(e){return e.enable&&e.enable()});if(this.enabled()){return}this.on(["mousedown","touchstart"],this.handleMouseDown);this.on(this.el_,"mousemove",this.handleMouseMove);this.removeClass("disabled");this.enabled_=!0};a.handleMouseDown=function(e){var t=this.el_.ownerDocument,a=this.getChild("seekBar");if(a){a.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)};a.handleMouseUp=function(e){var t=this.el_.ownerDocument,a=this.getChild("seekBar");if(a){a.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)};return t}(Qa);Ci.prototype.options_={children:["seekBar"]};Qa.registerComponent("ProgressControl",Ci);var Ei=function(e){tn(a,e);function a(a,n){var r=e.call(this,a,n)||this;r.on(a,["enterpictureinpicture","leavepictureinpicture"],r.handlePictureInPictureChange);if(!t.pictureInPictureEnabled){r.disable()}return r}var n=a.prototype;n.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)};n.handlePictureInPictureChange=function(){if(this.player_.isInPictureInPicture()){this.controlText("Exit Picture-in-Picture")}else{this.controlText("Picture-in-Picture")}};n.handleClick=function(){if(!this.player_.isInPictureInPicture()){this.player_.requestPictureInPicture()}else{this.player_.exitPictureInPicture()}};return a}(ti);Ei.prototype.controlText_="Picture-in-Picture";Qa.registerComponent("PictureInPictureToggle",Ei);var Ii=function(e){tn(a,e);function a(a,n){var r=e.call(this,a,n)||this;r.on(a,"fullscreenchange",r.handleFullscreenChange);if(!1===t[a.fsApi_.fullscreenEnabled]){r.disable()}return r}var n=a.prototype;n.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)};n.handleFullscreenChange=function(){if(this.player_.isFullscreen()){this.controlText("Non-Fullscreen")}else{this.controlText("Fullscreen")}};n.handleClick=function(){if(!this.player_.isFullscreen()){this.player_.requestFullscreen()}else{this.player_.exitFullscreen()}};return a}(ti);Ii.prototype.controlText_="Fullscreen";Qa.registerComponent("FullscreenToggle",Ii);var xi=function(e,t){if(t.tech_&&!t.tech_.featuresVolumeControl){e.addClass("vjs-hidden")}e.on(t,"loadstart",function(){if(!t.tech_.featuresVolumeControl){e.addClass("vjs-hidden")}else{e.removeClass("vjs-hidden")}})},Li=function(e){tn(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:"<span class=\"vjs-control-text\"></span>"})};return t}(Qa);Qa.registerComponent("VolumeLevel",Li);var Pi=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.on("slideractive",n.updateLastVolume_);n.on(t,"volumechange",n.updateARIAAttributes);t.ready(function(){return n.updateARIAAttributes()});return n}var a=t.prototype;a.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"})};a.handleMouseDown=function(t){if(!F(t)){return}e.prototype.handleMouseDown.call(this,t)};a.handleMouseMove=function(e){if(!F(e)){return}this.checkMuted();this.player_.volume(this.calculateDistance(e))};a.checkMuted=function(){if(this.player_.muted()){this.player_.muted(!1)}};a.getPercent=function(){if(this.player_.muted()){return 0}return this.player_.volume()};a.stepForward=function(){this.checkMuted();this.player_.volume(this.player_.volume()+.1)};a.stepBack=function(){this.checkMuted();this.player_.volume(this.player_.volume()-.1)};a.updateARIAAttributes=function(){var e=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",e);this.el_.setAttribute("aria-valuetext",e+"%")};a.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())};a.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",function(){if(0===e.player_.volume()){e.player_.lastVolume_(t)}})};return t}(yi);Pi.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};Pi.prototype.playerEvent="volumechange";Qa.registerComponent("VolumeBar",Pi);var Di=function(e){tn(t,e);function t(t,a){var n;if(void 0===a){a={}}a.vertical=a.vertical||!1;if("undefined"==typeof a.volumeBar||d(a.volumeBar)){a.volumeBar=a.volumeBar||{};a.volumeBar.vertical=a.vertical}n=e.call(this,t,a)||this;xi(Ja(n),t);n.throttledHandleMouseMove=Ra(Oa(Ja(n),n.handleMouseMove),Aa);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")});return n}var a=t.prototype;a.createEl=function(){var t="vjs-volume-horizontal";if(this.options_.vertical){t="vjs-volume-vertical"}return e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})};a.handleMouseDown=function(){var e=this.el_.ownerDocument;this.on(e,"mousemove",this.throttledHandleMouseMove);this.on(e,"touchmove",this.throttledHandleMouseMove);this.on(e,"mouseup",this.handleMouseUp);this.on(e,"touchend",this.handleMouseUp)};a.handleMouseUp=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseMove);this.off(e,"touchmove",this.throttledHandleMouseMove);this.off(e,"mouseup",this.handleMouseUp);this.off(e,"touchend",this.handleMouseUp)};a.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)};return t}(Qa);Di.prototype.options_={children:["volumeBar"]};Qa.registerComponent("VolumeControl",Di);var wi=function(e,t){if(t.tech_&&!t.tech_.featuresMuteControl){e.addClass("vjs-hidden")}e.on(t,"loadstart",function(){if(!t.tech_.featuresMuteControl){e.addClass("vjs-hidden")}else{e.removeClass("vjs-hidden")}})},Ai=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;wi(Ja(n),t);n.on(t,["loadstart","volumechange"],n.update);return n}var a=t.prototype;a.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)};a.handleClick=function(){var e=this.player_.volume(),t=this.player_.lastVolume_();if(0===e){var a=.1>t?.1:t;this.player_.volume(a);this.player_.muted(!1)}else{this.player_.muted(this.player_.muted()?!1:!0)}};a.update=function(){this.updateIcon_();this.updateControlText_()};a.updateIcon_=function(){var e=this.player_.volume(),t=3;if(vn&&this.player_.tech_&&this.player_.tech_.el_){this.player_.muted(this.player_.tech_.el_.muted)}if(0===e||this.player_.muted()){t=0}else if(.33>e){t=1}else if(.67>e){t=2}for(var a=0;4>a;a++){k(this.el_,"vjs-vol-"+a)}S(this.el_,"vjs-vol-"+t)};a.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume(),t=e?"Unmute":"Mute";if(this.controlText()!==t){this.controlText(t)}};return t}(ti);Ai.prototype.controlText_="Mute";Qa.registerComponent("MuteToggle",Ai);var Oi=function(e){tn(a,e);function a(t,a){var n;if(void 0===a){a={}}if("undefined"!=typeof a.inline){a.inline=a.inline}else{a.inline=!0}if("undefined"==typeof a.volumeControl||d(a.volumeControl)){a.volumeControl=a.volumeControl||{};a.volumeControl.vertical=!a.inline}n=e.call(this,t,a)||this;n.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_);return n}var n=a.prototype;n.sliderActive_=function(){this.addClass("vjs-slider-active")};n.sliderInactive_=function(){this.removeClass("vjs-slider-active")};n.volumePanelState_=function(){if(this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")){this.addClass("vjs-hidden")}if(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";if(!this.options_.inline){t="vjs-volume-panel-vertical"}return 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){if(Rn.isEventKey(e,"Esc")){this.muteToggle.focus()}};n.handleMouseOver=function(){this.addClass("vjs-hover");K(t,"keyup",Oa(this,this.handleKeyPress))};n.handleMouseOut=function(){this.removeClass("vjs-hover");Y(t,"keyup",Oa(this,this.handleKeyPress))};n.handleKeyPress=function(e){if(Rn.isEventKey(e,"Esc")){this.handleMouseOut()}};return a}(Qa);Oi.prototype.options_={children:["muteToggle","volumeControl"]};Qa.registerComponent("VolumePanel",Oi);var Ri=function(e){tn(a,e);function a(t,a){var n=e.call(this,t,a)||this;if(a){n.menuButton_=a.menuButton}n.focusedChild_=-1;n.on("keydown",n.handleKeyDown);n.boundHandleBlur_=Oa(Ja(n),n.handleBlur);n.boundHandleTapClick_=Oa(Ja(n),n.handleTapClick);return n}var n=a.prototype;n.addEventListenerForItem=function(e){if(!(e instanceof Qa)){return}this.on(e,"blur",this.boundHandleBlur_);this.on(e,["tap","click"],this.boundHandleTapClick_)};n.removeEventListenerForItem=function(e){if(!(e instanceof Qa)){return}this.off(e,"blur",this.boundHandleBlur_);this.off(e,["tap","click"],this.boundHandleTapClick_)};n.removeChild=function(t){if("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);if(t){this.addEventListenerForItem(t)}};n.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=f(t,{className:"vjs-menu-content"});this.contentEl_.setAttribute("role","menu");var a=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});a.appendChild(this.contentEl_);K(a,"click",function(e){e.preventDefault();e.stopImmediatePropagation()});return a};n.dispose=function(){this.contentEl_=null;this.boundHandleBlur_=null;this.boundHandleTapClick_=null;e.prototype.dispose.call(this)};n.handleBlur=function(e){var a=e.relatedTarget||t.activeElement;if(!this.children().some(function(e){return e.el()===a})){var n=this.menuButton_;if(n&&n.buttonPressed_&&a!==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 a=t.filter(function(t){return t.el()===e.target})[0];if(!a){return}if("CaptionSettingsMenuItem"!==a.name()){this.menuButton_.focus()}}};n.handleKeyDown=function(e){if(Rn.isEventKey(e,"Left")||Rn.isEventKey(e,"Down")){e.preventDefault();e.stopPropagation();this.stepForward()}else if(Rn.isEventKey(e,"Right")||Rn.isEventKey(e,"Up")){e.preventDefault();e.stopPropagation();this.stepBack()}};n.stepForward=function(){var e=0;if(this.focusedChild_!==void 0){e=this.focusedChild_+1}this.focus(e)};n.stepBack=function(){var e=0;if(this.focusedChild_!==void 0){e=this.focusedChild_-1}this.focus(e)};n.focus=function(e){if(void 0===e){e=0}var t=this.children().slice(),a=t.length&&t[0].className&&/vjs-menu-title/.test(t[0].className);if(a){t.shift()}if(0<t.length){if(0>e){e=0}else if(e>=t.length){e=t.length-1}this.focusedChild_=e;t[e].el_.focus()}};return a}(Qa);Qa.registerComponent("Menu",Ri);var Ni=function(e){tn(a,e);function a(a,n){var r;if(void 0===n){n={}}r=e.call(this,a,n)||this;r.menuButton_=new ti(a,n);r.menuButton_.controlText(r.controlText_);r.menuButton_.el_.setAttribute("aria-haspopup","true");var i=ti.prototype.buildCSSClass();r.menuButton_.el_.className=r.buildCSSClass()+" "+i;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();K(t,"keyup",Oa(Ja(r),r.handleMenuKeyUp))});r.on("mouseleave",r.handleMouseLeave);r.on("keydown",r.handleSubmenuKeyDown);return r}var n=a.prototype;n.update=function(){var e=this.createMenu();if(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");if(this.items&&this.items.length<=this.hideThreshold_){this.hide()}else{this.show()}};n.createMenu=function(){var e=new Ri(this.player_,{menuButton:this});this.hideThreshold_=0;if(this.options_.title){var t=f("li",{className:"vjs-menu-title",innerHTML:Xa(this.options_.title),tabIndex:-1});this.hideThreshold_+=1;var a=new Qa(this.player_,{el:t});e.addItem(a)}this.items=this.createItems();if(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";if(!0===this.options_.inline){t+="-inline"}else{t+="-popup"}var a=ti.prototype.buildCSSClass();return"vjs-menu-button "+t+" "+a+" "+e.prototype.buildCSSClass.call(this)};n.buildCSSClass=function(){var t="vjs-menu-button";if(!0===this.options_.inline){t+="-inline"}else{t+="-popup"}return"vjs-menu-button "+t+" "+e.prototype.buildCSSClass.call(this)};n.controlText=function(e,t){if(void 0===t){t=this.menuButton_.el()}return this.menuButton_.controlText(e,t)};n.dispose=function(){this.handleMouseLeave();e.prototype.dispose.call(this)};n.handleClick=function(){if(this.buttonPressed_){this.unpressButton()}else{this.pressButton()}};n.handleMouseLeave=function(){this.removeClass("vjs-hover");Y(t,"keyup",Oa(this,this.handleMenuKeyUp))};n.focus=function(){this.menuButton_.focus()};n.blur=function(){this.menuButton_.blur()};n.handleKeyDown=function(e){if(Rn.isEventKey(e,"Esc")||Rn.isEventKey(e,"Tab")){if(this.buttonPressed_){this.unpressButton()}if(!Rn.isEventKey(e,"Tab")){e.preventDefault();this.menuButton_.focus()}}else if(Rn.isEventKey(e,"Up")||Rn.isEventKey(e,"Down")){if(!this.buttonPressed_){e.preventDefault();this.pressButton()}}};n.handleMenuKeyUp=function(e){if(Rn.isEventKey(e,"Esc")||Rn.isEventKey(e,"Tab")){this.removeClass("vjs-hover")}};n.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)};n.handleSubmenuKeyDown=function(e){if(Rn.isEventKey(e,"Esc")||Rn.isEventKey(e,"Tab")){if(this.buttonPressed_){this.unpressButton()}if(!Rn.isEventKey(e,"Tab")){e.preventDefault();this.menuButton_.focus()}}};n.pressButton=function(){if(this.enabled_){this.buttonPressed_=!0;this.menu.show();this.menu.lockShowing();this.menuButton_.el_.setAttribute("aria-expanded","true");if(vn&&h()){return}this.menu.focus()}};n.unpressButton=function(){if(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()};return a}(Qa);Qa.registerComponent("MenuButton",Ni);var Ui=function(e){tn(t,e);function t(t,a){var n,r=a.tracks;n=e.call(this,t,a)||this;if(1>=n.items.length){n.hide()}if(!r){return Ja(n)}var i=Oa(Ja(n),n.update);r.addEventListener("removetrack",i);r.addEventListener("addtrack",i);n.player_.on("ready",i);n.player_.on("dispose",function(){r.removeEventListener("removetrack",i);r.removeEventListener("addtrack",i)});return n}return t}(Ni);Qa.registerComponent("TrackButton",Ui);var Mi=["Tab","Esc","Up","Down","Right","Left"],Bi=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.selectable=a.selectable;n.isSelected_=a.selected||!1;n.multiSelectable=a.multiSelectable;n.selected(n.isSelected_);if(n.selectable){if(n.multiSelectable){n.el_.setAttribute("role","menuitemcheckbox")}else{n.el_.setAttribute("role","menuitemradio")}}else{n.el_.setAttribute("role","menuitem")}return n}var a=t.prototype;a.createEl=function(t,a,n){this.nonIconControl=!0;return e.prototype.createEl.call(this,"li",o({className:"vjs-menu-item",innerHTML:"<span class=\"vjs-menu-item-text\">"+this.localize(this.options_.label)+"</span>",tabIndex:-1},a),n)};a.handleKeyDown=function(t){if(!Mi.some(function(e){return Rn.isEventKey(t,e)})){e.prototype.handleKeyDown.call(this,t)}};a.handleClick=function(){this.selected(!0)};a.selected=function(e){if(this.selectable){if(e){this.addClass("vjs-selected");this.el_.setAttribute("aria-checked","true");this.controlText(", selected");this.isSelected_=!0}else{this.removeClass("vjs-selected");this.el_.setAttribute("aria-checked","false");this.controlText("");this.isSelected_=!1}}};return t}(Xr);Qa.registerComponent("MenuItem",Bi);var ji=function(a){tn(n,a);function n(n,r){var i,s=r.track,o=n.textTracks();r.label=s.label||s.language||"Unknown";r.selected="showing"===s.mode;i=a.call(this,n,r)||this;i.track=s;i.kinds=(r.kinds||[r.kind||i.track.kind]).filter(Boolean);var l=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++){t[a]=arguments[a]}i.handleTracksChange.apply(Ja(i),t)},d=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++){t[a]=arguments[a]}i.handleSelectedLanguageChange.apply(Ja(i),t)};n.on(["loadstart","texttrackchange"],l);o.addEventListener("change",l);o.addEventListener("selectedlanguagechange",d);i.on("dispose",function(){n.off(["loadstart","texttrackchange"],l);o.removeEventListener("change",l);o.removeEventListener("selectedlanguagechange",d)});if(o.onchange===void 0){var p;i.on(["tap","click"],function(){if("object"!==_typeof2(e.Event)){try{p=new e.Event("change")}catch(e){}}if(!p){p=t.createEvent("Event");p.initEvent("change",!0,!0)}o.dispatchEvent(p)})}i.handleTracksChange();return i}var r=n.prototype;r.handleClick=function(e){var t=this.track,n=this.player_.textTracks();a.prototype.handleClick.call(this,e);if(!n){return}for(var r=0,s;r<n.length;r++){s=n[r];if(-1===this.kinds.indexOf(s.kind)){continue}if(s===t){if("showing"!==s.mode){s.mode="showing"}}else if("disabled"!==s.mode){s.mode="disabled"}}};r.handleTracksChange=function(){var e="showing"===this.track.mode;if(e!==this.isSelected_){this.selected(e)}};r.handleSelectedLanguageChange=function(){if("showing"===this.track.mode){var e=this.player_.cache_.selectedLanguage;if(e&&e.enabled&&e.language===this.track.language&&e.kind!==this.track.kind){return}this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}};r.dispose=function(){this.track=null;a.prototype.dispose.call(this)};return n}(Bi);Qa.registerComponent("TextTrackMenuItem",ji);var Fi=function(e){tn(t,e);function t(t,a){a.track={player:t,kind:a.kind,kinds:a.kinds,default:!1,mode:"disabled"};if(!a.kinds){a.kinds=[a.kind]}if(a.label){a.track.label=a.label}else{a.track.label=a.kinds.join(" and ")+" off"}a.selectable=!0;a.multiSelectable=!1;return e.call(this,t,a)||this}var a=t.prototype;a.handleTracksChange=function(){for(var e=this.player().textTracks(),t=!0,a=0,n=e.length,r;a<n;a++){r=e[a];if(-1<this.options_.kinds.indexOf(r.kind)&&"showing"===r.mode){t=!1;break}}if(t!==this.isSelected_){this.selected(t)}};a.handleSelectedLanguageChange=function(){for(var e=this.player().textTracks(),t=!0,a=0,n=e.length,r;a<n;a++){r=e[a];if(-1<["captions","descriptions","subtitles"].indexOf(r.kind)&&"showing"===r.mode){t=!1;break}}if(t){this.player_.cache_.selectedLanguage={enabled:!1}}};return t}(ji);Qa.registerComponent("OffTextTrackMenuItem",Fi);var Hi=function(e){tn(t,e);function t(t,a){if(void 0===a){a={}}a.tracks=t.textTracks();return e.call(this,t,a)||this}var a=t.prototype;a.createItems=function(e,t){if(void 0===e){e=[]}if(void 0===t){t=ji}var a;if(this.label_){a=this.label_+" off"}e.push(new Fi(this.player_,{kinds:this.kinds_,kind:this.kind_,label:a}));this.hideThreshold_+=1;var n=this.player_.textTracks();if(!Array.isArray(this.kinds_)){this.kinds_=[this.kind_]}for(var r=0,s;r<n.length;r++){s=n[r];if(-1<this.kinds_.indexOf(s.kind)){var o=new t(this.player_,{track:s,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass("vjs-"+s.kind+"-menu-item");e.push(o)}}return e};return t}(Ui);Qa.registerComponent("TextTrackButton",Hi);var qi=function(e){tn(t,e);function t(t,a){var n,r=a.track,i=a.cue,s=t.currentTime();a.selectable=!0;a.multiSelectable=!1;a.label=i.text;a.selected=i.startTime<=s&&s<i.endTime;n=e.call(this,t,a)||this;n.track=r;n.cue=i;r.addEventListener("cuechange",Oa(Ja(n),n.update));return n}var a=t.prototype;a.handleClick=function(){e.prototype.handleClick.call(this);this.player_.currentTime(this.cue.startTime);this.update(this.cue.startTime)};a.update=function(){var e=this.cue,t=this.player_.currentTime();this.selected(e.startTime<=t&&t<e.endTime)};return t}(Bi);Qa.registerComponent("ChaptersTrackMenuItem",qi);var Vi=function(e){tn(t,e);function t(t,a,n){return e.call(this,t,a,n)||this}var a=t.prototype;a.buildCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildCSSClass.call(this)};a.buildWrapperCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildWrapperCSSClass.call(this)};a.update=function(t){if(!this.track_||t&&("addtrack"===t.type||"removetrack"===t.type)){this.setTrack(this.findChaptersTrack())}e.prototype.update.call(this)};a.setTrack=function(e){if(this.track_===e){return}if(!this.updateHandler_){this.updateHandler_=this.update.bind(this)}if(this.track_){var t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(t){t.removeEventListener("load",this.updateHandler_)}this.track_=null}this.track_=e;if(this.track_){this.track_.mode="hidden";var a=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(a){a.addEventListener("load",this.updateHandler_)}}};a.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1,a;0<=t;t--){a=e[t];if(a.kind===this.kind_){return a}}};a.getMenuCaption=function(){if(this.track_&&this.track_.label){return this.track_.label}return this.localize(Xa(this.kind_))};a.createMenu=function(){this.options_.title=this.getMenuCaption();return e.prototype.createMenu.call(this)};a.createItems=function(){var e=[];if(!this.track_){return e}var t=this.track_.cues;if(!t){return e}for(var a=0,n=t.length;a<n;a++){var r=t[a],s=new qi(this.player_,{track:this.track_,cue:r});e.push(s)}return e};return t}(Hi);Vi.prototype.kind_="chapters";Vi.prototype.controlText_="Chapters";Qa.registerComponent("ChaptersButton",Vi);var Wi=function(e){tn(t,e);function t(t,a,n){var r=e.call(this,t,a,n)||this;var i=t.textTracks(),s=Oa(Ja(r),r.handleTracksChange);i.addEventListener("change",s);r.on("dispose",function(){i.removeEventListener("change",s)});return r}var a=t.prototype;a.handleTracksChange=function(){for(var e=this.player().textTracks(),t=!1,a=0,n=e.length,r;a<n;a++){r=e[a];if(r.kind!==this.kind_&&"showing"===r.mode){t=!0;break}}if(t){this.disable()}else{this.enable()}};a.buildCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildCSSClass.call(this)};a.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildWrapperCSSClass.call(this)};return t}(Hi);Wi.prototype.kind_="descriptions";Wi.prototype.controlText_="Descriptions";Qa.registerComponent("DescriptionsButton",Wi);var zi=function(e){tn(t,e);function t(t,a,n){return e.call(this,t,a,n)||this}var a=t.prototype;a.buildCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildCSSClass.call(this)};a.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildWrapperCSSClass.call(this)};return t}(Hi);zi.prototype.kind_="subtitles";zi.prototype.controlText_="Subtitles";Qa.registerComponent("SubtitlesButton",zi);var Gi=function(e){tn(t,e);function t(t,a){var n;a.track={player:t,kind:a.kind,label:a.kind+" settings",selectable:!1,default:!1,mode:"disabled"};a.selectable=!1;a.name="CaptionSettingsMenuItem";n=e.call(this,t,a)||this;n.addClass("vjs-texttrack-settings");n.controlText(", opens "+a.kind+" settings dialog");return n}var a=t.prototype;a.handleClick=function(){this.player().getChild("textTrackSettings").open()};return t}(ji);Qa.registerComponent("CaptionSettingsMenuItem",Gi);var Ki=function(e){tn(t,e);function t(t,a,n){return e.call(this,t,a,n)||this}var a=t.prototype;a.buildCSSClass=function(){return"vjs-captions-button "+e.prototype.buildCSSClass.call(this)};a.buildWrapperCSSClass=function(){return"vjs-captions-button "+e.prototype.buildWrapperCSSClass.call(this)};a.createItems=function(){var t=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")){t.push(new Gi(this.player_,{kind:this.kind_}));this.hideThreshold_+=1}return e.prototype.createItems.call(this,t)};return t}(Hi);Ki.prototype.kind_="captions";Ki.prototype.controlText_="Captions";Qa.registerComponent("CaptionsButton",Ki);var Yi=function(e){tn(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.createEl=function(t,a,n){var r="<span class=\"vjs-menu-item-text\">"+this.localize(this.options_.label);if("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>";var i=e.prototype.createEl.call(this,t,o({innerHTML:r},a),n);return i};return t}(ji);Qa.registerComponent("SubsCapsMenuItem",Yi);var Xi=function(e){tn(t,e);function t(t,a){var n;if(void 0===a){a={}}n=e.call(this,t,a)||this;n.label_="subtitles";if(-1<["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)){n.label_="captions"}n.menuButton_.controlText(Xa(n.label_));return n}var a=t.prototype;a.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)};a.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)};a.createItems=function(){var t=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")){t.push(new Gi(this.player_,{kind:this.label_}));this.hideThreshold_+=1}t=e.prototype.createItems.call(this,t,Yi);return t};return t}(Hi);Xi.prototype.kinds_=["captions","subtitles"];Xi.prototype.controlText_="Subtitles";Qa.registerComponent("SubsCapsButton",Xi);var $i=function(e){tn(t,e);function t(t,a){var n,r=a.track,i=t.audioTracks();a.label=r.label||r.language||"Unknown";a.selected=r.enabled;n=e.call(this,t,a)||this;n.track=r;n.addClass("vjs-"+r.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++){t[a]=arguments[a]}n.handleTracksChange.apply(Ja(n),t)};i.addEventListener("change",s);n.on("dispose",function(){i.removeEventListener("change",s)});return n}var a=t.prototype;a.createEl=function(t,a,n){var r="<span class=\"vjs-menu-item-text\">"+this.localize(this.options_.label);if("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>";var i=e.prototype.createEl.call(this,t,o({innerHTML:r},a),n);return i};a.handleClick=function(t){var a=this.player_.audioTracks();e.prototype.handleClick.call(this,t);for(var n=0,r;n<a.length;n++){r=a[n];r.enabled=r===this.track}};a.handleTracksChange=function(){this.selected(this.track.enabled)};return t}(Bi);Qa.registerComponent("AudioTrackMenuItem",$i);var Qi=function(e){tn(t,e);function t(t,a){if(void 0===a){a={}}a.tracks=t.audioTracks();return e.call(this,t,a)||this}var a=t.prototype;a.buildCSSClass=function(){return"vjs-audio-button "+e.prototype.buildCSSClass.call(this)};a.buildWrapperCSSClass=function(){return"vjs-audio-button "+e.prototype.buildWrapperCSSClass.call(this)};a.createItems=function(e){if(void 0===e){e=[]}this.hideThreshold_=1;for(var t=this.player_.audioTracks(),a=0,n;a<t.length;a++){n=t[a];e.push(new $i(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e};return t}(Ui);Qi.prototype.controlText_="Audio Track";Qa.registerComponent("AudioTrackButton",Qi);var Ji=function(e){tn(t,e);function t(t,a){var n,r=a.rate,i=parseFloat(r,10);a.label=r;a.selected=1===i;a.selectable=!0;a.multiSelectable=!1;n=e.call(this,t,a)||this;n.label=r;n.rate=i;n.on(t,"ratechange",n.update);return n}var a=t.prototype;a.handleClick=function(){e.prototype.handleClick.call(this);this.player().playbackRate(this.rate)};a.update=function(){this.selected(this.player().playbackRate()===this.rate)};return t}(Bi);Ji.prototype.contentElType="button";Qa.registerComponent("PlaybackRateMenuItem",Ji);var Zi=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.updateVisibility();n.updateLabel();n.on(t,"loadstart",n.updateVisibility);n.on(t,"ratechange",n.updateLabel);return n}var a=t.prototype;a.createEl=function(){var t=e.prototype.createEl.call(this);this.labelEl_=f("div",{className:"vjs-playback-rate-value",innerHTML:"1x"});t.appendChild(this.labelEl_);return t};a.dispose=function(){this.labelEl_=null;e.prototype.dispose.call(this)};a.buildCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildCSSClass.call(this)};a.buildWrapperCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildWrapperCSSClass.call(this)};a.createMenu=function(){var e=new Ri(this.player()),t=this.playbackRates();if(t){for(var a=t.length-1;0<=a;a--){e.addChild(new Ji(this.player(),{rate:t[a]+"x"}))}}return e};a.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())};a.handleClick=function(){for(var e=this.player().playbackRate(),t=this.playbackRates(),a=t[0],n=0;n<t.length;n++){if(t[n]>e){a=t[n];break}}this.player().playbackRate(a)};a.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates};a.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0<this.playbackRates().length};a.updateVisibility=function(){if(this.playbackRateSupported()){this.removeClass("vjs-hidden")}else{this.addClass("vjs-hidden")}};a.updateLabel=function(){if(this.playbackRateSupported()){this.labelEl_.innerHTML=this.player().playbackRate()+"x"}};return t}(Ni);Zi.prototype.controlText_="Playback Rate";Qa.registerComponent("PlaybackRateMenuButton",Zi);var es=function(e){tn(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)};a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})};return t}(Qa);Qa.registerComponent("Spacer",es);var ts=function(e){tn(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)};a.createEl=function(){var t=e.prototype.createEl.call(this,{className:this.buildCSSClass()});t.innerHTML="\xA0";return t};return t}(es);Qa.registerComponent("CustomControlSpacer",ts);var as=function(e){tn(t,e);function t(){return e.apply(this,arguments)||this}var a=t.prototype;a.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})};return t}(Qa);as.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]};if("exitPictureInPicture"in t){as.prototype.options_.children.splice(as.prototype.options_.children.length-1,0,"pictureInPictureToggle")}Qa.registerComponent("ControlBar",as);var ns=function(e){tn(t,e);function t(t,a){var n=e.call(this,t,a)||this;n.on(t,"error",n.open);return n}var a=t.prototype;a.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)};a.content=function(){var e=this.player().error();return e?this.localize(e.message):""};return t}(Hn);ns.prototype.options_=ya({},Hn.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});Qa.registerComponent("ErrorDisplay",ns);var rs=["#000","Black"],is=["#00F","Blue"],ss=["#0FF","Cyan"],os=["#0F0","Green"],ls=["#F0F","Magenta"],ds=["#F00","Red"],ps=["#FFF","White"],us=["#FF0","Yellow"],cs=["1","Opaque"],ms=["0.5","Semi-Transparent"],gs=["0","Transparent"],ys={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[rs,ps,ds,os,is,us,ls,ss]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[cs,ms,gs]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[ps,rs,ds,os,is,us,ls,ss]},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:+e}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[cs,ms]},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:[gs,ms,cs]}};ys.windowColor.options=ys.backgroundColor.options;function $e(e,t){if(t){e=t(e)}if(e&&"none"!==e){return e}}function Qe(e,t){var a=e.options[e.options.selectedIndex].value;return $e(a,t)}function Je(e,t,a){if(!t){return}for(var n=0;n<e.options.length;n++){if($e(e.options[n].value,a)===t){e.selectedIndex=n;break}}}var hs=function(t){tn(a,t);function a(e,a){var n;a.temporary=!1;n=t.call(this,e,a)||this;n.updateDisplay=Oa(Ja(n),n.updateDisplay);n.fill();n.hasBeenOpened_=n.hasBeenFilled_=!0;n.endDialog=f("p",{className:"vjs-control-text",textContent:n.localize("End of dialog window.")});n.el().appendChild(n.endDialog);n.setDefaults();if(a.persistTextTrackSettings===void 0){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()});r(ys,function(e){n.on(n.$(e.selector),"change",n.updateDisplay)});if(n.options_.persistTextTrackSettings){n.restoreSettings()}return n}var n=a.prototype;n.dispose=function(){this.endDialog=null;t.prototype.dispose.call(this)};n.createElSelect_=function(e,t,a){var n=this;if(void 0===t){t=""}if(void 0===a){a="label"}var r=ys[e],i=r.id.replace("%s",this.id_),s=[t,i].join(" ").trim();return["<"+a+" id=\""+i+"\" class=\""+("label"===a?"vjs-label":"")+"\">",this.localize(r.label),"</"+a+">","<select aria-labelledby=\""+s+"\">"].concat(r.options.map(function(e){var t=i+"-"+e[1].replace(/\W+/g,"");return["<option id=\""+t+"\" value=\""+e[0]+"\" ","aria-labelledby=\""+s+" "+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 f("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})};n.createElFont_=function(){return f("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 f("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 s(ys,function(t,a,n){var r=Qe(e.$(a.selector),a.parser);if(r!==void 0){t[n]=r}return t},{})};n.setValues=function(e){var t=this;r(ys,function(a,n){Je(t.$(a.selector),e[n],a.parser)})};n.setDefaults=function(){var e=this;r(ys,function(t){var a=t.hasOwnProperty("default")?t["default"]:0;e.$(t.selector).selectedIndex=a})};n.restoreSettings=function(){var t;try{t=JSON.parse(e.localStorage.getItem("vjs-text-track-settings"))}catch(e){ma.warn(e)}if(t){this.setValues(t)}};n.saveSettings=function(){if(!this.options_.persistTextTrackSettings){return}var t=this.getValues();try{if(Object.keys(t).length){e.localStorage.setItem("vjs-text-track-settings",JSON.stringify(t))}else{e.localStorage.removeItem("vjs-text-track-settings")}}catch(e){ma.warn(e)}};n.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");if(e){e.updateDisplay()}};n.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,a=e&&e.captionsButton;if(t){t.focus()}else if(a){a.focus()}};return a}(Hn);Qa.registerComponent("TextTrackSettings",hs);var _s=function(t){tn(a,t);function a(a,n){var r,i=n.ResizeObserver||e.ResizeObserver;if(null===n.ResizeObserver){i=!1}var s=te({createEl:!i,reportTouchActivity:!1},n);r=t.call(this,a,s)||this;r.ResizeObserver=n.ResizeObserver||e.ResizeObserver;r.loadListener_=null;r.resizeObserver_=null;r.debouncedHandler_=Na(function(){r.resizeHandler()},100,!1,Ja(r));if(i){r.resizeObserver_=new r.ResizeObserver(r.debouncedHandler_);r.resizeObserver_.observe(a.el())}else{r.loadListener_=function(){if(!r.el_||!r.el_.contentWindow){return}var e=r.debouncedHandler_,t=r.unloadListener_=function(){Y(this,"resize",e);Y(this,"unload",t);t=null};K(r.el_.contentWindow,"unload",t);K(r.el_.contentWindow,"resize",e)};r.one("load",r.loadListener_)}return r}var n=a.prototype;n.createEl=function(){return t.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1},{"aria-hidden":"true"})};n.resizeHandler=function(){if(!this.player_||!this.player_.trigger){return}this.player_.trigger("playerresize")};n.dispose=function(){if(this.debouncedHandler_){this.debouncedHandler_.cancel()}if(this.resizeObserver_){if(this.player_.el()){this.resizeObserver_.unobserve(this.player_.el())}this.resizeObserver_.disconnect()}if(this.loadListener_){this.off("load",this.loadListener_)}if(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)};return a}(Qa);Qa.registerComponent("ResizeManager",_s);var fs=function(e){var t=Math.floor(e.length/2),a=[].concat(e).sort(function(e,t){return e-t});return 0!=e.length%2?a[t]:(a[t-1]+a[t])/2},Ts={trackingThreshold:30},bs=function(e){tn(a,e);function a(a,n){var r,i=te(Ts,n,{createEl:!1});r=e.call(this,a,i)||this;r.reset_();r.on(r.player_,"durationchange",r.handleDurationchange);if(yn&&"hidden"in t&&"visibilityState"in t){r.on(t,"visibilitychange",r.handleVisibilityChange)}return r}var n=a.prototype;n.handleVisibilityChange=function(){if(this.player_.duration()!==1/0){return}if(t.hidden){this.stopTracking()}else{this.startTracking()}};n.isBehind_=function(){if(!this.timeupdateSeen_){return!1}var e=this.liveCurrentTime(),t=this.player_.currentTime(),a=2*this.seekableIncrement_+.07;return e!==1/0&&e-a>=t};n.trackLive_=function(){this.pastSeekEnd_=this.pastSeekEnd_;var e=this.player_.seekable();if(!e||!e.length){return}var t=this.seekableEnd();if(t!==this.lastSeekEnd_){if(this.lastSeekEnd_){this.seekableIncrementList_=this.seekableIncrementList_.slice(-11);this.seekableIncrementList_.push(Math.abs(t-this.lastSeekEnd_));if(3<this.seekableIncrementList_.length){this.seekableIncrement_=fs(this.seekableIncrementList_)}}this.pastSeekEnd_=0;this.lastSeekEnd_=t;this.trigger("seekableendchange")}if(this.pastSeekEnd()>1.5*this.seekableIncrement_){this.pastSeekEnd_=0}else{this.pastSeekEnd_=this.pastSeekEnd()+.03}if(this.isBehind_()!==this.behindLiveEdge()){this.behindLiveEdge_=this.isBehind_();this.trigger("liveedgechange")}};n.handleDurationchange=function(){if(this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold){if(this.player_.options_.liveui){this.player_.addClass("vjs-liveui")}this.startTracking()}else{this.player_.removeClass("vjs-liveui");this.stopTracking()}};n.startTracking=function(){var e=this;if(this.isTracking()){return}if(!this.timeupdateSeen_){this.timeupdateSeen_=this.player_.hasStarted()}this.trackingInterval_=this.setInterval(this.trackLive_,Aa);this.trackLive_();this.on(this.player_,"play",this.trackLive_);this.on(this.player_,"pause",this.trackLive_);if(!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);if(this.handleTimeupdate){this.off(this.player_,"timeupdate",this.handleTimeupdate);this.handleTimeupdate=null}};n.stopTracking=function(){if(!this.isTracking()){return}this.reset_()};n.seekableEnd=function(){var e=this.player_.seekable(),t=[],a=e?e.length:0;while(a--){t.push(e.end(a))}return t.length?t.sort()[t.length-1]:1/0};n.seekableStart=function(){var e=this.player_.seekable(),t=[],a=e?e.length:0;while(a--){t.push(e.start(a))}return t.length?t.sort()[0]:0};n.liveWindow=function(){var e=this.liveCurrentTime();if(e===1/0){return 1/0}return 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(){if(this.atLiveEdge()){return}this.player_.currentTime(this.liveCurrentTime());if(this.player_.paused()){this.player_.play()}};n.dispose=function(){this.stopTracking();e.prototype.dispose.call(this)};return a}(Qa);Qa.registerComponent("LiveTracker",bs);var vs=function(e){var t=e.el();if(t.hasAttribute("src")){e.triggerSourceset(t.src);return!0}var a=e.$$("source"),n=[],r="";if(!a.length){return!1}for(var s=0,o;s<a.length;s++){o=a[s].src;if(o&&-1===n.indexOf(o)){n.push(o)}}if(!n.length){return!1}if(1===n.length){r=n[0]}e.triggerSourceset(r);return!0},Ss=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(a){var n=t.createElement(this.nodeName.toLowerCase());n.innerHTML=a;var r=t.createDocumentFragment();while(n.childNodes.length){r.appendChild(n.childNodes[0])}this.innerText="";e.Element.prototype.appendChild.call(this,r);return this.innerHTML}}),ks=function(e,t){for(var a={},n=0;n<e.length;n++){a=Object.getOwnPropertyDescriptor(e[n],t);if(a&&a.set&&a.get){break}}a.enumerable=!0;a.configurable=!0;return a},Cs=function(t){return ks([t.el(),e.HTMLMediaElement.prototype,e.Element.prototype,Ss],"innerHTML")},Es=function(e){var t=e.el();if(t.resetSourceWatch_){return}var a={},n=Cs(e),r=function(a){return function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++){r[i]=arguments[i]}var s=a.apply(t,r);vs(e);return s}};["append","appendChild","insertAdjacentHTML"].forEach(function(e){if(!t[e]){return}a[e]=t[e];t[e]=r(a[e])});Object.defineProperty(t,"innerHTML",te(n,{set:r(n.set)}));t.resetSourceWatch_=function(){t.resetSourceWatch_=null;Object.keys(a).forEach(function(e){t[e]=a[e]});Object.defineProperty(t,"innerHTML",n)};e.one("sourceset",t.resetSourceWatch_)},Is=Object.defineProperty({},"src",{get:function(){if(this.hasAttribute("src")){return nr(e.Element.prototype.getAttribute.call(this,"src"))}return""},set:function(t){e.Element.prototype.setAttribute.call(this,"src",t);return t}}),xs=function(t){return ks([t.el(),e.HTMLMediaElement.prototype,Is],"src")},Ls=function(e){if(!e.featuresSourceset){return}var t=e.el();if(t.resetSourceset_){return}var a=xs(e),r=t.setAttribute,i=t.load;Object.defineProperty(t,"src",te(a,{set:function(n){var r=a.set.call(t,n);e.triggerSourceset(t.src);return r}}));t.setAttribute=function(a,n){var i=r.call(t,a,n);if(/src/i.test(a)){e.triggerSourceset(t.src)}return i};t.load=function(){var a=i.call(t);if(!vs(e)){e.triggerSourceset("");Es(e)}return a};if(t.currentSrc){e.triggerSourceset(t.currentSrc)}else if(!vs(e)){Es(e)}t.resetSourceset_=function(){t.resetSourceset_=null;t.load=i;t.setAttribute=r;Object.defineProperty(t,"src",a);if(t.resetSourceWatch_){t.resetSourceWatch_()}}},Ps=function(e,t,a,n){if(void 0===n){n=!0}var r=function(a){return Object.defineProperty(e,t,{value:a,enumerable:!0,writable:!0})},i={configurable:!0,enumerable:!0,get:function(){var e=a();r(e);return e}};if(n){i.set=r}return Object.defineProperty(e,t,i)},Ds=function(a){tn(n,a);function n(e,t){var n=a.call(this,e,t)||this;var r=e.source,s=!1;if(r&&(n.el_.currentSrc!==r.src||e.tag&&3===e.tag.initNetworkState_)){n.setSource(r)}else{n.handleLateInit_(n.el_)}if(e.enableSourceset){n.setupSourcesetHandling_()}if(n.el_.hasChildNodes()){var o=n.el_.childNodes,l=o.length,d=[];while(l--){var p=o[l],u=p.nodeName.toLowerCase();if("track"===u){if(!n.featuresNativeTextTracks){d.push(p)}else{n.remoteTextTrackEls().addTrackElement_(p);n.remoteTextTracks().addTrack(p.track);n.textTracks().addTrack(p.track);if(!s&&!n.el_.hasAttribute("crossorigin")&&ir(p.src)){s=!0}}}}for(var c=0;c<d.length;c++){n.el_.removeChild(d[c])}}n.proxyNativeTracks_();if(n.featuresNativeTextTracks&&s){ma.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_();if((fn||bn||pn)&&!0===e.nativeControlsForTouch){n.setControls(!0)}n.proxyWebkitFullscreen_();n.triggerReady();return n}var r=n.prototype;r.dispose=function(){if(this.el_&&this.el_.resetSourceset_){this.el_.resetSourceset_()}n.disposeMediaElement(this.el_);this.options_=null;a.prototype.dispose.call(this)};r.setupSourcesetHandling_=function(){Ls(this)};r.restoreMetadataTracksInIOSNativePlayer_=function(){var e=this.textTracks(),t,a=function(){t=[];for(var a=0,n;a<e.length;a++){n=e[a];if("metadata"===n.kind){t.push({track:n,storedMode:n.mode})}}};a();e.addEventListener("change",a);this.on("dispose",function(){return e.removeEventListener("change",a)});var n=function a(){for(var n=0,r;n<t.length;n++){r=t[n];if("disabled"===r.track.mode&&r.track.mode!==r.storedMode){r.track.mode=r.storedMode}}e.removeEventListener("change",a)};this.on("webkitbeginfullscreen",function(){e.removeEventListener("change",a);e.removeEventListener("change",n);e.addEventListener("change",n)});this.on("webkitendfullscreen",function(){e.removeEventListener("change",a);e.addEventListener("change",a);e.removeEventListener("change",n)})};r.overrideNative_=function(e,t){var a=this;if(t!==this["featuresNative"+e+"Tracks"]){return}var n=e.toLowerCase();if(this[n+"TracksListeners_"]){Object.keys(this[n+"TracksListeners_"]).forEach(function(e){var t=a.el()[n+"Tracks"];t.removeEventListener(e,a[n+"TracksListeners_"][e])})}this["featuresNative"+e+"Tracks"]=!t;this[n+"TracksListeners_"]=null;this.proxyNativeTracksForType_(n)};r.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)};r.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)};r.proxyNativeTracksForType_=function(e){var t=this,a=Tr[e],n=this.el()[a.getterName],r=this[a.getterName]();if(!this["featuresNative"+a.capitalName+"Tracks"]||!n||!n.addEventListener){return}var i={change:function(){var a={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(a);if("text"===e){t[br.remoteText.getterName]().trigger(a)}},addtrack:function(t){r.addTrack(t.track)},removetrack:function(t){r.removeTrack(t.track)}},s=function(){for(var e=[],t=0,a;t<r.length;t++){a=!1;for(var s=0;s<n.length;s++){if(n[s]===r[t]){a=!0;break}}if(!a){e.push(r[t])}}while(e.length){r.removeTrack(e.shift())}};this[a.getterName+"Listeners_"]=i;Object.keys(i).forEach(function(e){var a=i[e];n.addEventListener(e,a);t.on("dispose",function(){return n.removeEventListener(e,a)})});this.on("loadstart",s);this.on("dispose",function(){return t.off("loadstart",s)})};r.proxyNativeTracks_=function(){var e=this;Tr.names.forEach(function(t){e.proxyNativeTracksForType_(t)})};r.createEl=function(){var e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){var a=e.cloneNode(!0);if(e.parentNode){e.parentNode.insertBefore(a,e)}n.disposeMediaElement(e);e=a}else{e=t.createElement("video");var r=this.options_.tag&&I(this.options_.tag),s=te({},r);if(!fn||!0!==this.options_.nativeControlsForTouch){delete s.controls}E(e,o(s,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}if("undefined"!=typeof this.options_.preload){L(e,"preload",this.options_.preload)}for(var l=["loop","muted","playsinline","autoplay"],d=0;d<l.length;d++){var p=l[d],u=this.options_[p];if("undefined"!=typeof u){if(u){L(e,p,p)}else{P(e,p)}e[p]=u}}return e};r.handleLateInit_=function(e){if(0===e.networkState||3===e.networkState){return}if(0===e.readyState){var t=!1,a=function(){t=!0};this.on("loadstart",a);var n=function(){if(!t){this.trigger("loadstart")}};this.on("loadedmetadata",n);this.ready(function(){this.off("loadstart",a);this.off("loadedmetadata",n);if(!t){this.trigger("loadstart")}});return}var r=["loadstart","loadedmetadata"];if(2<=e.readyState){r.push("loadeddata")}if(3<=e.readyState){r.push("canplay")}if(4<=e.readyState){r.push("canplaythrough")}this.ready(function(){r.forEach(function(e){this.trigger(e)},this)})};r.setCurrentTime=function(e){try{this.el_.currentTime=e}catch(t){ma(t,"Video is not ready. (Video.js)")}};r.duration=function(){var e=this;if(this.el_.duration===1/0&&ln&&mn&&0===this.el_.currentTime){var t=function t(){if(0<e.el_.currentTime){if(e.el_.duration===1/0){e.trigger("durationchange")}e.off("timeupdate",t)}};this.on("timeupdate",t);return NaN}return this.el_.duration||NaN};r.width=function(){return this.el_.offsetWidth};r.height=function(){return this.el_.offsetHeight};r.proxyWebkitFullscreen_=function(){var e=this;if(!("webkitDisplayingFullscreen"in this.el_)){return}var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},a=function(){if("webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode){this.one("webkitendfullscreen",t);this.trigger("fullscreenchange",{isFullscreen:!0})}};this.on("webkitbeginfullscreen",a);this.on("dispose",function(){e.off("webkitbeginfullscreen",a);e.off("webkitendfullscreen",t)})};r.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};r.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA){this.el_.play();this.setTimeout(function(){e.pause();e.webkitEnterFullScreen()},0)}else{e.webkitEnterFullScreen()}};r.exitFullScreen=function(){this.el_.webkitExitFullScreen()};r.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()};r.src=function(e){if(e===void 0){return this.el_.src}this.setSrc(e)};r.reset=function(){n.resetMediaElement(this.el_)};r.currentSrc=function(){if(this.currentSource_){return this.currentSource_.src}return this.el_.currentSrc};r.setControls=function(e){this.el_.controls=!!e};r.addTextTrack=function(e,t,n){if(!this.featuresNativeTextTracks){return a.prototype.addTextTrack.call(this,e,t,n)}return this.el_.addTextTrack(e,t,n)};r.createRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks){return a.prototype.createRemoteTextTrack.call(this,e)}var n=t.createElement("track");if(e.kind){n.kind=e.kind}if(e.label){n.label=e.label}if(e.language||e.srclang){n.srclang=e.language||e.srclang}if(e["default"]){n["default"]=e["default"]}if(e.id){n.id=e.id}if(e.src){n.src=e.src}return n};r.addRemoteTextTrack=function(e,t){var n=a.prototype.addRemoteTextTrack.call(this,e,t);if(this.featuresNativeTextTracks){this.el().appendChild(n)}return n};r.removeRemoteTextTrack=function(e){a.prototype.removeRemoteTextTrack.call(this,e);if(this.featuresNativeTextTracks){var t=this.$$("track"),n=t.length;while(n--){if(e===t[n]||e===t[n].track){this.el().removeChild(t[n])}}}};r.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality){return this.el().getVideoPlaybackQuality()}var t={};if("undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount){t.droppedVideoFrames=this.el().webkitDroppedFrameCount;t.totalVideoFrames=this.el().webkitDecodedFrameCount}if(e.performance&&"function"==typeof e.performance.now){t.creationTime=e.performance.now()}else if(e.performance&&e.performance.timing&&"number"==typeof e.performance.timing.navigationStart){t.creationTime=e.Date.now()-e.performance.timing.navigationStart}return t};return n}(Mr);Ps(Ds,"TEST_VID",function(){if(!g()){return}var e=t.createElement("video"),a=t.createElement("track");a.kind="captions";a.srclang="en";a.label="English";e.appendChild(a);return e});Ds.isSupported=function(){try{Ds.TEST_VID.volume=.5}catch(t){return!1}return!!(Ds.TEST_VID&&Ds.TEST_VID.canPlayType)};Ds.canPlayType=function(e){return Ds.TEST_VID.canPlayType(e)};Ds.canPlaySource=function(e){return Ds.canPlayType(e.type)};Ds.canControlVolume=function(){try{var e=Ds.TEST_VID.volume;Ds.TEST_VID.volume=e/2+.1;return e!==Ds.TEST_VID.volume}catch(t){return!1}};Ds.canMuteVolume=function(){try{var e=Ds.TEST_VID.muted;Ds.TEST_VID.muted=!e;if(Ds.TEST_VID.muted){L(Ds.TEST_VID,"muted","muted")}else{P(Ds.TEST_VID,"muted","muted")}return e!==Ds.TEST_VID.muted}catch(t){return!1}};Ds.canControlPlaybackRate=function(){if(ln&&mn&&58>gn){return!1}try{var e=Ds.TEST_VID.playbackRate;Ds.TEST_VID.playbackRate=e/2+.1;return e!==Ds.TEST_VID.playbackRate}catch(t){return!1}};Ds.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(t){return!1}return!0};Ds.supportsNativeTextTracks=function(){return Sn||vn&&mn};Ds.supportsNativeVideoTracks=function(){return!!(Ds.TEST_VID&&Ds.TEST_VID.videoTracks)};Ds.supportsNativeAudioTracks=function(){return!!(Ds.TEST_VID&&Ds.TEST_VID.audioTracks)};Ds.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],a=e[1];Ps(Ds.prototype,t,function(){return Ds[a]()},!0)});Ds.prototype.movingMediaElementInDOM=!vn;Ds.prototype.featuresFullscreenResize=!0;Ds.prototype.featuresProgressEvents=!0;Ds.prototype.featuresTimeupdateEvents=!0;var ws;Ds.patchCanPlayType=function(){if(4<=dn&&!un&&!mn){ws=Ds.TEST_VID&&Ds.TEST_VID.constructor.prototype.canPlayType;Ds.TEST_VID.constructor.prototype.canPlayType=function(e){if(e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)){return"maybe"}return ws.call(this,e)}}};Ds.unpatchCanPlayType=function(){var e=Ds.TEST_VID.constructor.prototype.canPlayType;if(ws){Ds.TEST_VID.constructor.prototype.canPlayType=ws}return e};Ds.patchCanPlayType();Ds.disposeMediaElement=function(e){if(!e){return}if(e.parentNode){e.parentNode.removeChild(e)}while(e.hasChildNodes()){e.removeChild(e.firstChild)}e.removeAttribute("src");if("function"==typeof e.load){(function(){try{e.load()}catch(t){}})()}};Ds.resetMediaElement=function(e){if(!e){return}var t=e.querySelectorAll("source"),a=t.length;while(a--){e.removeChild(t[a])}e.removeAttribute("src");if("function"==typeof e.load){(function(){try{e.load()}catch(t){}})()}};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){Ds.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){Ds.prototype["set"+Xa(e)]=function(t){this.el_[e]=t;if(t){this.el_.setAttribute(e,e)}else{this.el_.removeAttribute(e)}}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(e){Ds.prototype[e]=function(){return this.el_[e]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach(function(e){Ds.prototype["set"+Xa(e)]=function(t){this.el_[e]=t}});["pause","load","play"].forEach(function(e){Ds.prototype[e]=function(){return this.el_[e]()}});Mr.withSourceHandlers(Ds);Ds.nativeSourceHandler={};Ds.nativeSourceHandler.canPlayType=function(e){try{return Ds.TEST_VID.canPlayType(e)}catch(t){return""}};Ds.nativeSourceHandler.canHandleSource=function(e){if(e.type){return Ds.nativeSourceHandler.canPlayType(e.type)}else if(e.src){var t=rr(e.src);return Ds.nativeSourceHandler.canPlayType("video/"+t)}return""};Ds.nativeSourceHandler.handleSource=function(e,t){t.setSrc(e.src)};Ds.nativeSourceHandler.dispose=function(){};Ds.registerSourceHandler(Ds.nativeSourceHandler);Mr.registerTech("Html5",Ds);var As=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Os={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Rs=["tiny","xsmall","small","medium","large","xlarge","huge"],Ns={};Rs.forEach(function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Ns[e]="vjs-layout-"+t});var Us={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},Ms=function(a){tn(n,a);function n(e,r,i){var s;e.id=e.id||r.id||"vjs_video_"+V();r=o(n.getTagSettings(e),r);r.initChildren=!1;r.createEl=!1;r.evented=!1;r.reportTouchActivity=!1;if(!r.language){if("function"==typeof e.closest){var l=e.closest("[lang]");if(l&&l.getAttribute){r.language=l.getAttribute("lang")}}else{var d=e;while(d&&1===d.nodeType){if(I(d).hasOwnProperty("lang")){r.language=d.getAttribute("lang");break}d=d.parentNode}}}s=a.call(this,null,r,i)||this;s.boundDocumentFullscreenChange_=Oa(Ja(s),s.documentFullscreenChange_);s.boundFullWindowOnEscKey_=Oa(Ja(s),s.fullWindowOnEscKey);s.isFullscreen_=!1;s.log=ga(s.id_);s.fsApi_=Cn;s.isPosterFromTech_=!1;s.queuedCallbacks_=[];s.isReady_=!1;s.hasStarted_=!1;s.userActive_=!1;if(!s.options_||!s.options_.techOrder||!s.options_.techOrder.length){throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?")}s.tag=e;s.tagAttributes=e&&I(e);s.language(s.options_.language);if(r.languages){var p={};Object.getOwnPropertyNames(r.languages).forEach(function(e){p[e.toLowerCase()]=r.languages[e]});s.languages_=p}else{s.languages_=n.prototype.options_.languages}s.resetCache_();s.poster_=r.poster||"";s.controls_=!!r.controls;e.controls=!1;e.removeAttribute("controls");s.changingSrc_=!1;s.playCallbacks_=[];s.playTerminatedQueue_=[];if(e.hasAttribute("autoplay")){s.autoplay(!0)}else{s.autoplay(s.options_.autoplay)}if(r.plugins){Object.keys(r.plugins).forEach(function(e){if("function"!=typeof s[e]){throw new Error("plugin \""+e+"\" does not exist")}})}s.scrubbing_=!1;s.el_=s.createEl();Z(Ja(s),{eventBusKey:"el_"});if(s.fsApi_.requestFullscreen){K(t,s.fsApi_.fullscreenchange,s.boundDocumentFullscreenChange_);s.on(s.fsApi_.fullscreenchange,s.boundDocumentFullscreenChange_)}if(s.fluid_){s.on("playerreset",s.updateStyleEl_)}var u=te(s.options_);if(r.plugins){Object.keys(r.plugins).forEach(function(e){s[e](r.plugins[e])})}s.options_.playerOptions=u;s.middleware_=[];s.initChildren();s.isAudio("audio"===e.nodeName.toLowerCase());if(s.controls()){s.addClass("vjs-controls-enabled")}else{s.addClass("vjs-controls-disabled")}s.el_.setAttribute("role","region");if(s.isAudio()){s.el_.setAttribute("aria-label",s.localize("Audio Player"))}else{s.el_.setAttribute("aria-label",s.localize("Video Player"))}if(s.isAudio()){s.addClass("vjs-audio")}if(s.flexNotSupported_()){s.addClass("vjs-no-flex")}if(fn){s.addClass("vjs-touch-enabled")}if(!vn){s.addClass("vjs-workinghover")}n.players[s.id_]=Ja(s);var c="7.7.6".split(".")[0];s.addClass("vjs-v"+c);s.userActive(!0);s.reportUserActivity();s.one("play",s.listenForUserActivity_);s.on("stageclick",s.handleStageClick_);s.on("keydown",s.handleKeyDown);s.breakpoints(s.options_.breakpoints);s.responsive(s.options_.responsive);return s}var r=n.prototype;r.dispose=function(){var e=this;this.trigger("dispose");this.off("dispose");Y(t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_);Y(t,"keydown",this.boundFullWindowOnEscKey_);if(this.styleEl_&&this.styleEl_.parentNode){this.styleEl_.parentNode.removeChild(this.styleEl_);this.styleEl_=null}n.players[this.id_]=null;if(this.tag&&this.tag.player){this.tag.player=null}if(this.el_&&this.el_.player){this.el_.player=null}if(this.tech_){this.tech_.dispose();this.isPosterFromTech_=!1;this.poster_=""}if(this.playerElIngest_){this.playerElIngest_=null}if(this.tag){this.tag=null}Ve(this);vr.names.forEach(function(t){var a=vr[t],n=e[a.getterName]();if(n&&n.off){n.off()}});a.prototype.dispose.call(this)};r.createEl=function(){var n=this.tag,r,s=this.playerElIngest_=n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player"),o="video-js"===this.tag.tagName.toLowerCase();if(s){r=this.el_=n.parentNode}else if(!o){r=this.el_=a.prototype.createEl.call(this,"div")}var l=I(n);if(o){r=this.el_=n;n=this.tag=t.createElement("video");while(r.children.length){n.appendChild(r.firstChild)}if(!v(r,"video-js")){S(r,"video-js")}r.appendChild(n);s=this.playerElIngest_=r;Object.keys(r).forEach(function(e){try{n[e]=r[e]}catch(t){}})}n.setAttribute("tabindex","-1");l.tabindex="-1";if(yn||mn&&_n){n.setAttribute("role","application");l.role="application"}n.removeAttribute("width");n.removeAttribute("height");if("width"in l){delete l.width}if("height"in l){delete l.height}Object.getOwnPropertyNames(l).forEach(function(e){if(!(o&&"class"===e)){r.setAttribute(e,l[e])}if(o){n.setAttribute(e,l[e])}});n.playerId=n.id;n.id+="_html5_api";n.className="vjs-tech";n.player=r.player=this;this.addClass("vjs-paused");if(!0!==e.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=ka("vjs-styles-dimensions");var d=fa(".vjs-styles-defaults"),p=fa("head");p.insertBefore(this.styleEl_,d?d.nextSibling:p.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 u=n.getElementsByTagName("a"),c=0,m;c<u.length;c++){m=u.item(c);S(m,"vjs-hidden");m.setAttribute("hidden","hidden")}n.initNetworkState_=n.networkState;if(n.parentNode&&!s){n.parentNode.insertBefore(r,n)}b(n,r);this.children_.unshift(n);this.el_.setAttribute("lang",this.language_);this.el_=r;return r};r.width=function(e){return this.dimension("width",e)};r.height=function(e){return this.dimension("height",e)};r.dimension=function(e,t){var a=e+"_";if(t===void 0){return this[a]||0}if(""===t||"auto"===t){this[a]=void 0;this.updateStyleEl_();return}var n=parseFloat(t);if(isNaN(n)){ma.error("Improper value \""+t+"\" supplied for for "+e);return}this[a]=n;this.updateStyleEl_()};r.fluid=function(e){if(e===void 0){return!!this.fluid_}this.fluid_=!!e;if(Ba(this)){this.off("playerreset",this.updateStyleEl_)}if(e){this.addClass("vjs-fluid");this.fill(!1);ja(function(){this.on("playerreset",this.updateStyleEl_)})}else{this.removeClass("vjs-fluid")}this.updateStyleEl_()};r.fill=function(e){if(e===void 0){return!!this.fill_}this.fill_=!!e;if(e){this.addClass("vjs-fill");this.fluid(!1)}else{this.removeClass("vjs-fill")}};r.aspectRatio=function(e){if(e===void 0){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_()};r.updateStyleEl_=function(){if(!0===e.VIDEOJS_NO_DYNAMIC_STYLE){var t="number"==typeof this.width_?this.width_:this.options_.width,a="number"==typeof this.height_?this.height_:this.options_.height,n=this.tech_&&this.tech_.el();if(n){if(0<=t){n.width=t}if(0<=a){n.height=a}}return}var r,i,s,o;if(this.aspectRatio_!==void 0&&"auto"!==this.aspectRatio_){s=this.aspectRatio_}else if(0<this.videoWidth()){s=this.videoWidth()+":"+this.videoHeight()}else{s="16:9"}var l=s.split(":"),d=l[1]/l[0];if(this.width_!==void 0){r=this.width_}else if(this.height_!==void 0){r=this.height_/d}else{r=this.videoWidth()||300}if(this.height_!==void 0){i=this.height_}else{i=r*d}if(/^[^a-zA-Z]/.test(this.id())){o="dimensions-"+this.id()}else{o=this.id()+"-dimensions"}this.addClass(o);Ca(this.styleEl_,"\n      ."+o+" {\n        width: "+r+"px;\n        height: "+i+"px;\n      }\n\n      ."+o+".vjs-fluid {\n        padding-top: "+100*d+"%;\n      }\n    ")};r.loadTech_=function(e,t){var a=this;if(this.tech_){this.unloadTech_()}var n=Xa(e),r=e.charAt(0).toLowerCase()+e.slice(1);if("Html5"!==n&&this.tag){Mr.getTech("Html5").disposeMediaElement(this.tag);this.tag.player=null;this.tag=null}this.techName_=n;this.isReady_=!1;var i="string"==typeof this.autoplay()?!1:this.autoplay(),s={source:t,autoplay:i,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};vr.names.forEach(function(e){var t=vr[e];s[t.getterName]=a[t.privateName]});o(s,this.options_[n]);o(s,this.options_[r]);o(s,this.options_[e.toLowerCase()]);if(this.tag){s.tag=this.tag}if(t&&t.src===this.cache_.src&&0<this.cache_.currentTime){s.startTime=this.cache_.currentTime}var l=Mr.getTech(e);if(!l){throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'")}this.tech_=new l(s);this.tech_.ready(Oa(this,this.handleTechReady_),!0);On.jsonToTextTracks(this.textTracksJson_||[],this.tech_);As.forEach(function(e){a.on(a.tech_,e,a["handleTech"+Xa(e)+"_"])});Object.keys(Os).forEach(function(e){a.on(a.tech_,e,function(t){if(0===a.tech_.playbackRate()&&a.tech_.seeking()){a.queuedCallbacks_.push({callback:a["handleTech"+Os[e]+"_"].bind(a),event:t});return}a["handleTech"+Os[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"));if(this.controls()&&!this.usingNativeControls()){this.addTechControlsListeners_()}if(this.tech_.el().parentNode!==this.el()&&("Html5"!==n||!this.tag)){b(this.tech_.el(),this.el())}if(this.tag){this.tag.player=null;this.tag=null}};r.unloadTech_=function(){var e=this;vr.names.forEach(function(t){var a=vr[t];e[a.privateName]=e[a.getterName]()});this.textTracksJson_=On.textTracksToJson(this.tech_);this.isReady_=!1;this.tech_.dispose();this.tech_=!1;if(this.isPosterFromTech_){this.poster_="";this.trigger("posterchange")}this.isPosterFromTech_=!1};r.tech=function(e){if(e===void 0){ma.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")}return this.tech_};r.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_)};r.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_)};r.handleTechReady_=function(){this.triggerReady();if(this.cache_.volume){this.techCall_("setVolume",this.cache_.volume)}this.handleTechPosterChange_();this.handleTechDurationChange_()};r.handleTechLoadStart_=function(){this.removeClass("vjs-ended");this.removeClass("vjs-seeking");this.error(null);this.handleTechDurationChange_();if(!this.paused()){this.trigger("loadstart");this.trigger("firstplay")}else{this.hasStarted(!1);this.trigger("loadstart")}this.manualAutoplay_(this.autoplay())};r.manualAutoplay_=function(e){var t=this;if(!this.tech_||"string"!=typeof e){return}var a=function(){var e=t.muted();t.muted(!0);var a=function(){t.muted(e)};t.playTerminatedQueue_.push(a);var n=t.play();if(!le(n)){return}return n["catch"](a)},n;if("any"===e&&!0!==this.muted()){n=this.play();if(le(n)){n=n["catch"](a)}}else if("muted"===e&&!0!==this.muted()){n=a()}else{n=this.play()}if(!le(n)){return}return n.then(function(){t.trigger({type:"autoplay-success",autoplay:e})})["catch"](function(){t.trigger({type:"autoplay-failure",autoplay:e})})};r.updateSourceCaches_=function(e){if(void 0===e){e=""}var t=e,a="";if("string"!=typeof t){t=e.src;a=e.type}this.cache_.source=this.cache_.source||{};this.cache_.sources=this.cache_.sources||[];if(t&&!a){a=Gr(this,t)}this.cache_.source=te({},e,{src:t,type:a});for(var n=this.cache_.sources.filter(function(e){return e.src&&e.src===t}),r=[],s=this.$$("source"),o=[],l=0,d;l<s.length;l++){d=I(s[l]);r.push(d);if(d.src&&d.src===t){o.push(d.src)}}if(o.length&&!n.length){this.cache_.sources=r}else if(!n.length){this.cache_.sources=[this.cache_.source]}this.cache_.src=t};r.handleTechSourceset_=function(e){var t=this;if(!this.changingSrc_){var a=function(e){return t.updateSourceCaches_(e)},n=this.currentSource().src,r=e.src;if(n&&!/^blob:/.test(n)&&/^blob:/.test(r)){if(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n){a=function(){}}}a(r);if(!e.src){this.tech_.any(["sourceset","loadstart"],function(a){if("sourceset"===a.type){return}var e=t.techGet("currentSrc");t.lastSource_.tech=e;t.updateSourceCaches_(e)})}}this.lastSource_={player:this.currentSource().src,tech:e.src};this.trigger({src:e.src,type:"sourceset"})};r.hasStarted=function(e){if(e===void 0){return this.hasStarted_}if(e===this.hasStarted_){return}this.hasStarted_=e;if(this.hasStarted_){this.addClass("vjs-has-started");this.trigger("firstplay")}else{this.removeClass("vjs-has-started")}};r.handleTechPlay_=function(){this.removeClass("vjs-ended");this.removeClass("vjs-paused");this.addClass("vjs-playing");this.hasStarted(!0);this.trigger("play")};r.handleTechRateChange_=function(){if(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")};r.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting");this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",function a(){if(t!==e.currentTime()){e.removeClass("vjs-waiting");e.off("timeupdate",a)}})};r.handleTechCanPlay_=function(){this.removeClass("vjs-waiting");this.trigger("canplay")};r.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting");this.trigger("canplaythrough")};r.handleTechPlaying_=function(){this.removeClass("vjs-waiting");this.trigger("playing")};r.handleTechSeeking_=function(){this.addClass("vjs-seeking");this.trigger("seeking")};r.handleTechSeeked_=function(){this.removeClass("vjs-seeking");this.removeClass("vjs-ended");this.trigger("seeked")};r.handleTechFirstPlay_=function(){if(this.options_.starttime){ma.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")};r.handleTechPause_=function(){this.removeClass("vjs-playing");this.addClass("vjs-paused");this.trigger("pause")};r.handleTechEnded_=function(){this.addClass("vjs-ended");if(this.options_.loop){this.currentTime(0);this.play()}else if(!this.paused()){this.pause()}this.trigger("ended")};r.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))};r.handleTechClick_=function(e){if(!F(e)){return}if(!this.controls_){return}if(this.paused()){de(this.play())}else{this.pause()}};r.handleTechDoubleClick_=function(e){if(!this.controls_){return}var t=Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(t){return t.contains(e.target)});if(!t){if(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||!1!==this.options_.userActions.doubleClick){if(this.options_!==void 0&&this.options_.userActions!==void 0&&"function"==typeof this.options_.userActions.doubleClick){this.options_.userActions.doubleClick.call(this,e)}else if(this.isFullscreen()){this.exitFullscreen()}else{this.requestFullscreen()}}}};r.handleTechTap_=function(){this.userActive(!this.userActive())};r.handleTechTouchStart_=function(){this.userWasActive=this.userActive()};r.handleTechTouchMove_=function(){if(this.userWasActive){this.reportUserActivity()}};r.handleTechTouchEnd_=function(e){e.preventDefault()};r.handleStageClick_=function(){this.reportUserActivity()};r.toggleFullscreenClass_=function(){if(this.isFullscreen()){this.addClass("vjs-fullscreen")}else{this.removeClass("vjs-fullscreen")}};r.documentFullscreenChange_=function(a){var e=a.target.player;if(e&&e!==this){return}var n=this.el(),r=t[this.fsApi_.fullscreenElement]===n;if(!r&&n.matches){r=n.matches(":"+this.fsApi_.fullscreen)}else if(!r&&n.msMatchesSelector){r=n.msMatchesSelector(":"+this.fsApi_.fullscreen)}this.isFullscreen(r)};r.handleTechFullscreenChange_=function(e,t){if(t){this.isFullscreen(t.isFullscreen)}};r.togglePictureInPictureClass_=function(){if(this.isInPictureInPicture()){this.addClass("vjs-picture-in-picture")}else{this.removeClass("vjs-picture-in-picture")}};r.handleTechEnterPictureInPicture_=function(){this.isInPictureInPicture(!0)};r.handleTechLeavePictureInPicture_=function(){this.isInPictureInPicture(!1)};r.handleTechError_=function(){var e=this.tech_.error();this.error(e)};r.handleTechTextData_=function(){var e=null;if(1<arguments.length){e=arguments[1]}this.trigger("textdata",e)};r.getCache=function(){return this.cache_};r.resetCache_=function(){this.cache_={currentTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],volume:1}};r.techCall_=function(e,t){this.ready(function(){if(e in qr){return je(this.middleware_,this.tech_,e,t)}else if(e in Vr){return Fe(this.middleware_,this.tech_,e,t)}try{if(this.tech_){this.tech_[e](t)}}catch(t){ma(t);throw t}},!0)};r.techGet_=function(t){if(!this.tech_||!this.tech_.isReady_){return}if(t in Hr){return Be(this.middleware_,this.tech_,t)}else if(t in Vr){return Fe(this.middleware_,this.tech_,t)}try{return this.tech_[t]()}catch(a){if(this.tech_[t]===void 0){ma("Video.js: "+t+" method not defined for "+this.techName_+" playback technology.",a);throw a}if("TypeError"===a.name){ma("Video.js: "+t+" unavailable on "+this.techName_+" playback technology element.",a);this.tech_.isReady_=!1;throw a}ma(a);throw a}};r.play=function(){var t=this,a=this.options_.Promise||e.Promise;if(a){return new a(function(e){t.play_(e)})}return this.play_()};r.play_=function(e){var t=this;if(void 0===e){e=de}this.playCallbacks_.push(e);var a=!!(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_){this.off(["ready","loadstart"],this.waitToPlay_);this.waitToPlay_=null}if(!this.isReady_||!a){this.waitToPlay_=function(){t.play_()};this.one(["ready","loadstart"],this.waitToPlay_);if(!a&&(Sn||vn)){this.load()}return}var n=this.techGet_("play");if(null===n){this.runPlayTerminatedQueue_()}else{this.runPlayCallbacks_(n)}};r.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[];e.forEach(function(e){e()})};r.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[];this.playTerminatedQueue_=[];t.forEach(function(t){t(e)})};r.pause=function(){this.techCall_("pause")};r.paused=function(){return!1===this.techGet_("paused")?!1:!0};r.played=function(){return this.techGet_("played")||ie(0,0)};r.scrubbing=function(e){if("undefined"==typeof e){return this.scrubbing_}this.scrubbing_=!!e;if(e){this.addClass("vjs-scrubbing")}else{this.removeClass("vjs-scrubbing")}};r.currentTime=function(e){if("undefined"!=typeof e){if(0>e){e=0}this.techCall_("setCurrentTime",e);return}this.cache_.currentTime=this.techGet_("currentTime")||0;return this.cache_.currentTime};r.duration=function(e){if(e===void 0){return this.cache_.duration!==void 0?this.cache_.duration:NaN}e=parseFloat(e);if(0>e){e=1/0}if(e!==this.cache_.duration){this.cache_.duration=e;if(e===1/0){this.addClass("vjs-live")}else{this.removeClass("vjs-live")}if(!isNaN(e)){this.trigger("durationchange")}}};r.remainingTime=function(){return this.duration()-this.currentTime()};r.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())};r.buffered=function e(){var e=this.techGet_("buffered");if(!e||!e.length){e=ie(0,0)}return e};r.bufferedPercent=function(){return se(this.buffered(),this.duration())};r.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),a=e.end(e.length-1);if(a>t){a=t}return a};r.volume=function(e){var t;if(e!==void 0){t=Math.max(0,Math.min(1,parseFloat(e)));this.cache_.volume=t;this.techCall_("setVolume",t);if(0<t){this.lastVolume_(t)}return}t=parseFloat(this.techGet_("volume"));return isNaN(t)?1:t};r.muted=function(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1};r.defaultMuted=function(e){if(e!==void 0){return this.techCall_("setDefaultMuted",e)}return this.techGet_("defaultMuted")||!1};r.lastVolume_=function(e){if(e!==void 0&&0!==e){this.cache_.lastVolume=e;return}return this.cache_.lastVolume};r.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1};r.isFullscreen=function(e){if(e!==void 0){var t=this.isFullscreen_;this.isFullscreen_=!!e;if(this.isFullscreen_!==t&&this.fsApi_.prefixed){this.trigger("fullscreenchange")}this.toggleFullscreenClass_();return}return this.isFullscreen_};r.requestFullscreen=function(e){var t=this,a;if(!this.fsApi_.prefixed){a=this.options_.fullscreen&&this.options_.fullscreen.options||{};if(e!==void 0){a=e}}if(this.fsApi_.requestFullscreen){var n=this.el_[this.fsApi_.requestFullscreen](a);if(n){n.then(function(){return t.isFullscreen(!0)},function(){return t.isFullscreen(!1)})}return n}else if(this.tech_.supportsFullScreen()){this.techCall_("enterFullScreen")}else{this.enterFullWindow()}};r.exitFullscreen=function(){var e=this;if(this.fsApi_.requestFullscreen){var a=t[this.fsApi_.exitFullscreen]();if(a){a.then(function(){return e.isFullscreen(!1)})}return a}else if(this.tech_.supportsFullScreen()){this.techCall_("exitFullScreen")}else{this.exitFullWindow()}};r.enterFullWindow=function(){this.isFullscreen(!0);this.isFullWindow=!0;this.docOrigOverflow=t.documentElement.style.overflow;K(t,"keydown",this.boundFullWindowOnEscKey_);t.documentElement.style.overflow="hidden";S(t.body,"vjs-full-window");this.trigger("enterFullWindow")};r.fullWindowOnEscKey=function(e){if(Rn.isEventKey(e,"Esc")){if(!0===this.isFullscreen()){this.exitFullscreen()}else{this.exitFullWindow()}}};r.exitFullWindow=function(){this.isFullscreen(!1);this.isFullWindow=!1;Y(t,"keydown",this.boundFullWindowOnEscKey_);t.documentElement.style.overflow=this.docOrigOverflow;k(t.body,"vjs-full-window");this.trigger("exitFullWindow")};r.isInPictureInPicture=function(e){if(e!==void 0){this.isInPictureInPicture_=!!e;this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_};r.requestPictureInPicture=function(){if("pictureInPictureEnabled"in t){return this.techGet_("requestPictureInPicture")}};r.exitPictureInPicture=function(){if("pictureInPictureEnabled"in t){return t.exitPictureInPicture()}};r.handleKeyDown=function(e){var t=this.options_.userActions;if(!t||!t.hotkeys){return}if(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable){return!0}if("input"===t){return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type)}return-1!==["textarea"].indexOf(t)}(this.el_.ownerDocument.activeElement)){return}if("function"==typeof t.hotkeys){t.hotkeys.call(this,e)}else{this.handleHotkeys(e)}};r.handleHotkeys=function(e){var a=this.options_.userActions?this.options_.userActions.hotkeys:{},n=a.fullscreenKey,r=void 0===n?function(e){return Rn.isEventKey(e,"f")}:n,i=a.muteKey,s=void 0===i?function(e){return Rn.isEventKey(e,"m")}:i,o=a.playPauseKey,l=void 0===o?function(e){return Rn.isEventKey(e,"k")||Rn.isEventKey(e,"Space")}:o;if(r.call(this,e)){e.preventDefault();e.stopPropagation();var d=Qa.getComponent("FullscreenToggle");if(!1!==t[this.fsApi_.fullscreenEnabled]){d.prototype.handleClick.call(this,e)}}else if(s.call(this,e)){e.preventDefault();e.stopPropagation();var p=Qa.getComponent("MuteToggle");p.prototype.handleClick.call(this,e)}else if(l.call(this,e)){e.preventDefault();e.stopPropagation();var u=Qa.getComponent("PlayToggle");u.prototype.handleClick.call(this,e)}};r.canPlayType=function(e){for(var t,a=0,n=this.options_.techOrder;a<n.length;a++){var r=n[a],s=Mr.getTech(r);if(!s){s=Qa.getComponent(r)}if(!s){ma.error("The \""+r+"\" tech is undefined. Skipped browser support check for that tech.");continue}if(s.isSupported()){t=s.canPlayType(e);if(t){return t}}}return""};r.selectSource=function(e){var t=this,a=this.options_.techOrder.map(function(e){return[e,Mr.getTech(e)]}).filter(function(e){var t=e[0],a=e[1];if(a){return a.isSupported()}ma.error("The \""+t+"\" tech is undefined. Skipped browser support check for that tech.");return!1}),n=function(e,t,a){var n;e.some(function(e){return t.some(function(t){n=a(e,t);if(n){return!0}})});return n},r,i=function(e){return function(t,a){return e(a,t)}},s=function(e,a){var n=e[0],r=e[1];if(r.canPlaySource(a,t.options_[n.toLowerCase()])){return{source:a,tech:n}}};if(this.options_.sourceOrder){r=n(e,a,i(s))}else{r=n(a,e,s)}return r||!1};r.src=function(e){var t=this;if("undefined"==typeof e){return this.cache_.src||""}var a=Kr(e);if(!a.length){this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0);return}this.changingSrc_=!0;this.cache_.sources=a;this.updateSourceCaches_(a[0]);Ue(this,a[0],function(e,n){t.middleware_=n;t.cache_.sources=a;t.updateSourceCaches_(e);var r=t.src_(e);if(r){if(1<a.length){return t.src(a.slice(1))}t.changingSrc_=!1;t.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0);t.triggerReady();return}Me(n,t.tech_)})};r.src_=function(e){var t=this,a=this.selectSource([e]);if(!a){return!0}if(!$a(a.tech,this.techName_)){this.changingSrc_=!0;this.loadTech_(a.tech,a.source);this.tech_.ready(function(){t.changingSrc_=!1});return!1}this.ready(function(){if(this.tech_.constructor.prototype.hasOwnProperty("setSource")){this.techCall_("setSource",e)}else{this.techCall_("src",e.src)}this.changingSrc_=!1},!0);return!1};r.load=function(){this.techCall_("load")};r.reset=function(){var t=this,a=this.options_.Promise||e.Promise;if(this.paused()||!a){this.doReset_()}else{var n=this.play();de(n.then(function(){return t.doReset_()}))}};r.doReset_=function(){if(this.tech_){this.tech_.clearTracks("text")}this.resetCache_();this.poster("");this.loadTech_(this.options_.techOrder[0],null);this.techCall_("reset");this.resetControlBarUI_();if(Ba(this)){this.trigger("playerreset")}};r.resetControlBarUI_=function(){this.resetProgressBar_();this.resetPlaybackRate_();this.resetVolumeBar_()};r.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar,t=e.durationDisplay,a=e.remainingTimeDisplay;if(t){t.updateContent()}if(a){a.updateContent()}};r.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate());this.handleTechRateChange_()};r.resetVolumeBar_=function(){this.volume(1);this.trigger("volumechange")};r.currentSources=function(){var e=this.currentSource(),t=[];if(0!==Object.keys(e).length){t.push(e)}return this.cache_.sources||t};r.currentSource=function(){return this.cache_.source||{}};r.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""};r.currentType=function(){return this.currentSource()&&this.currentSource().type||""};r.preload=function(e){if(e!==void 0){this.techCall_("setPreload",e);this.options_.preload=e;return}return this.techGet_("preload")};r.autoplay=function(e){if(e===void 0){return this.options_.autoplay||!1}var t;if("string"==typeof e&&/(any|play|muted)/.test(e)){this.options_.autoplay=e;this.manualAutoplay_(e);t=!1}else if(!e){this.options_.autoplay=!1}else{this.options_.autoplay=!0}t="undefined"==typeof t?this.options_.autoplay:t;if(this.tech_){this.techCall_("setAutoplay",t)}};r.playsinline=function(e){if(e!==void 0){this.techCall_("setPlaysinline",e);this.options_.playsinline=e;return this}return this.techGet_("playsinline")};r.loop=function(e){if(e!==void 0){this.techCall_("setLoop",e);this.options_.loop=e;return}return this.techGet_("loop")};r.poster=function(e){if(e===void 0){return this.poster_}if(!e){e=""}if(e===this.poster_){return}this.poster_=e;this.techCall_("setPoster",e);this.isPosterFromTech_=!1;this.trigger("posterchange")};r.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";if(e!==this.poster_){this.poster_=e;this.isPosterFromTech_=!0;this.trigger("posterchange")}}};r.controls=function(e){if(e===void 0){return!!this.controls_}e=!!e;if(this.controls_===e){return}this.controls_=e;if(this.usingNativeControls()){this.techCall_("setControls",e)}if(this.controls_){this.removeClass("vjs-controls-disabled");this.addClass("vjs-controls-enabled");this.trigger("controlsenabled");if(!this.usingNativeControls()){this.addTechControlsListeners_()}}else{this.removeClass("vjs-controls-enabled");this.addClass("vjs-controls-disabled");this.trigger("controlsdisabled");if(!this.usingNativeControls()){this.removeTechControlsListeners_()}}};r.usingNativeControls=function(e){if(e===void 0){return!!this.usingNativeControls_}e=!!e;if(this.usingNativeControls_===e){return}this.usingNativeControls_=e;if(this.usingNativeControls_){this.addClass("vjs-using-native-controls");this.trigger("usingnativecontrols")}else{this.removeClass("vjs-using-native-controls");this.trigger("usingcustomcontrols")}};r.error=function(e){if(e===void 0){return this.error_||null}if(this.options_.suppressNotSupportedError&&e&&4===e.code){var t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1;this.any(["click","touchstart"],t);this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(null===e){this.error_=e;this.removeClass("vjs-error");if(this.errorDisplay){this.errorDisplay.close()}return}this.error_=new oe(e);this.addClass("vjs-error");ma.error("(CODE:"+this.error_.code+" "+oe.errorTypes[this.error_.code]+")",this.error_.message,this.error_);this.trigger("error")};r.reportUserActivity=function(){this.userActivity_=!0};r.userActive=function(e){if(e===void 0){return this.userActive_}e=!!e;if(e===this.userActive_){return}this.userActive_=e;if(this.userActive_){this.userActivity_=!0;this.removeClass("vjs-user-inactive");this.addClass("vjs-user-active");this.trigger("useractive");return}if(this.tech_){this.tech_.one("mousemove",function(t){t.stopPropagation();t.preventDefault()})}this.userActivity_=!1;this.removeClass("vjs-user-active");this.addClass("vjs-user-inactive");this.trigger("userinactive")};r.listenForUserActivity_=function(){var e,t,a,n=Oa(this,this.reportUserActivity),r=function(r){if(r.screenX!==t||r.screenY!==a){t=r.screenX;a=r.screenY;n()}},i=function(){n();this.clearInterval(e);e=this.setInterval(n,250)},s=function(){n();this.clearInterval(e)};this.on("mousedown",i);this.on("mousemove",r);this.on("mouseup",s);this.on("mouseleave",s);var o=this.getChild("controlBar");if(o&&!vn&&!ln){o.on("mouseenter",function(){this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout;this.player().options_.inactivityTimeout=0});o.on("mouseleave",function(){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})}this.on("keydown",n);this.on("keyup",n);var l;this.setInterval(function(){if(!this.userActivity_){return}this.userActivity_=!1;this.userActive(!0);this.clearTimeout(l);var e=this.options_.inactivityTimeout;if(0>=e){return}l=this.setTimeout(function(){if(!this.userActivity_){this.userActive(!1)}},e)},250)};r.playbackRate=function(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}if(this.tech_&&this.tech_.featuresPlaybackRate){return this.cache_.lastPlaybackRate||this.techGet_("playbackRate")}return 1};r.defaultPlaybackRate=function(e){if(e!==void 0){return this.techCall_("setDefaultPlaybackRate",e)}if(this.tech_&&this.tech_.featuresPlaybackRate){return this.techGet_("defaultPlaybackRate")}return 1};r.isAudio=function(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_};r.addTextTrack=function(e,t,a){if(this.tech_){return this.tech_.addTextTrack(e,t,a)}};r.addRemoteTextTrack=function(e,t){if(this.tech_){return this.tech_.addRemoteTextTrack(e,t)}};r.removeRemoteTextTrack=function(e){if(void 0===e){e={}}var t=e,a=t.track;if(!a){a=e}if(this.tech_){return this.tech_.removeRemoteTextTrack(a)}};r.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")};r.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0};r.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0};r.language=function(e){if(e===void 0){return this.language_}this.language_=(e+"").toLowerCase()};r.languages=function(){return te(n.prototype.options_.languages,this.languages_)};r.toJSON=function(){var e=te(this.options_),t=e.tracks;e.tracks=[];for(var a=0,n;a<t.length;a++){n=t[a];n=te(n);n.player=void 0;e.tracks[a]=n}return e};r.createModal=function(e,t){var a=this;t=t||{};t.content=e||"";var n=new Hn(this,t);this.addChild(n);n.on("dispose",function(){a.removeChild(n)});n.open();return n};r.updateCurrentBreakpoint_=function(){if(!this.responsive()){return}for(var e=this.currentBreakpoint(),t=this.currentWidth(),a=0;a<Rs.length;a++){var n=Rs[a],r=this.breakpoints_[n];if(t<=r){if(e===n){return}if(e){this.removeClass(Ns[e])}this.addClass(Ns[n]);this.breakpoint_=n;break}}};r.removeCurrentBreakpoint_=function(){var e=this.currentBreakpointClass();this.breakpoint_="";if(e){this.removeClass(e)}};r.breakpoints=function(e){if(e===void 0){return o(this.breakpoints_)}this.breakpoint_="";this.breakpoints_=o({},Us,e);this.updateCurrentBreakpoint_();return o(this.breakpoints_)};r.responsive=function(e){if(e===void 0){return this.responsive_}e=!!e;var t=this.responsive_;if(e===t){return}this.responsive_=e;if(e){this.on("playerresize",this.updateCurrentBreakpoint_);this.updateCurrentBreakpoint_()}else{this.off("playerresize",this.updateCurrentBreakpoint_);this.removeCurrentBreakpoint_()}return e};r.currentBreakpoint=function(){return this.breakpoint_};r.currentBreakpointClass=function(){return Ns[this.breakpoint_]||""};r.loadMedia=function(e,t){var a=this;if(!e||"object"!==_typeof2(e)){return}this.reset();this.cache_.media=te(e);var n=this.cache_.media,r=n.artwork,i=n.poster,s=n.src,o=n.textTracks;if(!r&&i){this.cache_.media.artwork=[{src:i,type:zr(i)}]}if(s){this.src(s)}if(i){this.poster(i)}if(Array.isArray(o)){o.forEach(function(e){return a.addRemoteTextTrack(e,!1)})}this.ready(t)};r.getMedia=function(){if(!this.cache_.media){var e=this.poster(),t=this.currentSources(),a=Array.prototype.map.call(this.remoteTextTracks(),function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}}),n={src:t,textTracks:a};if(e){n.poster=e;n.artwork=[{src:n.poster,type:zr(n.poster)}]}return n}return te(this.cache_.media)};n.getTagSettings=function(e){var t={sources:[],tracks:[]},a=I(e),n=a["data-setup"];if(v(e,"vjs-fill")){a.fill=!0}if(v(e,"vjs-fluid")){a.fluid=!0}if(null!==n){var r=wn(n||"{}"),s=r[0],l=r[1];if(s){ma.error(s)}o(a,l)}o(t,a);if(e.hasChildNodes()){for(var d=e.childNodes,p=0,u=d.length;p<u;p++){var c=d[p],m=c.nodeName.toLowerCase();if("source"===m){t.sources.push(I(c))}else if("track"===m){t.tracks.push(I(c))}}}return t};r.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)};return n}(Qa);vr.names.forEach(function(e){var t=vr[e];Ms.prototype[t.getterName]=function(){if(this.tech_){return this.tech_[t.getterName]()}this[t.privateName]=this[t.privateName]||new t.ListClass;return this[t.privateName]}});Ms.players={};var Bs=e.navigator;Ms.prototype.options_={techOrder:Mr.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Bs&&(Bs.languages&&Bs.languages[0]||Bs.userLanguage||Bs.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){Ms.prototype[e]=function(){return this.techGet_(e)}});As.forEach(function(e){Ms.prototype["handleTech"+Xa(e)+"_"]=function(){return this.trigger(e)}});Qa.registerComponent("Player",Ms);var js=n(function(e){function t(a,n){e.exports=t=Object.setPrototypeOf||function(e,t){e.__proto__=t;return e};return t(a,n)}e.exports=t});var Fs=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return!0}catch(t){return!1}},Hs=n(function(e){function t(){if(Fs()){e.exports=t=Reflect.construct}else{e.exports=t=function(e,t,n){var r=[null];r.push.apply(r,t);var a=Function.bind.apply(e,r),i=new a;if(n)js(i,n.prototype);return i}}return t.apply(null,arguments)}e.exports=t}),qs="plugin",Vs="activePlugins_",Ws={},zs=function(e){return Ws.hasOwnProperty(e)},Gs=function(e){return zs(e)?Ws[e]:void 0},Ks=function(e,t){e[Vs]=e[Vs]||{};e[Vs][t]=!0},Ys=function(e,t,a){var n=(a?"before":"")+"pluginsetup";e.trigger(n,t);e.trigger(n+":"+t.name,t)},Xs=function(e,t){var a=function(){Ys(this,{name:e,plugin:t,instance:null},!0);var a=t.apply(this,arguments);Ks(this,e);Ys(this,{name:e,plugin:t,instance:a});return a};Object.keys(t).forEach(function(e){a[e]=t[e]});return a},$s=function(e,t){t.prototype.name=e;return function(){Ys(this,{name:e,plugin:t,instance:null},!0);for(var a=arguments.length,n=Array(a),r=0;r<a;r++){n[r]=arguments[r]}var i=Hs(t,[this].concat(n));this[e]=function(){return i};Ys(this,i.getEventHash());return i}},Qs=function(){function e(t){if(this.constructor===e){throw new Error("Plugin must be sub-classed; not directly instantiated.")}this.player=t;Z(this);delete this.trigger;ee(this,this.constructor.defaultState);Ks(t,this.name);this.dispose=Oa(this,this.dispose);t.on("dispose",this.dispose)}var t=e.prototype;t.version=function(){return this.constructor.VERSION};t.getEventHash=function(e){if(void 0===e){e={}}e.name=this.name;e.plugin=this.constructor;e.instance=this;return e};t.trigger=function(e,t){if(void 0===t){t={}}return X(this.eventBusEl_,e,this.getEventHash(t))};t.handleStateChanged=function(){};t.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose");this.off();t.off("dispose",this.dispose);t[Vs][e]=!1;this.player=this.state=null;t[e]=$s(e,Ws[e])};e.isBasic=function(t){var a="string"==typeof t?Gs(t):t;return"function"==typeof a&&!e.prototype.isPrototypeOf(a.prototype)};e.registerPlugin=function(t,a){if("string"!=typeof t){throw new Error("Illegal plugin name, \""+t+"\", must be a string, was "+_typeof2(t)+".")}if(zs(t)){ma.warn("A plugin named \""+t+"\" already exists. You may want to avoid re-registering plugins!")}else if(Ms.prototype.hasOwnProperty(t)){throw new Error("Illegal plugin name, \""+t+"\", cannot share a name with an existing player method!")}if("function"!=typeof a){throw new Error("Illegal plugin for \""+t+"\", must be a function, was "+_typeof2(a)+".")}Ws[t]=a;if(t!==qs){if(e.isBasic(a)){Ms.prototype[t]=Xs(t,a)}else{Ms.prototype[t]=$s(t,a)}}return a};e.deregisterPlugin=function(e){if(e===qs){throw new Error("Cannot de-register base plugin.")}if(zs(e)){delete Ws[e];delete Ms.prototype[e]}};e.getPlugins=function(e){if(void 0===e){e=Object.keys(Ws)}var t;e.forEach(function(e){var a=Gs(e);if(a){t=t||{};t[e]=a}});return t};e.getPluginVersion=function(e){var t=Gs(e);return t&&t.VERSION||""};return e}();Qs.getPlugin=Gs;Qs.BASE_PLUGIN_NAME=qs;Qs.registerPlugin(qs,Qs);Ms.prototype.usingPlugin=function(e){return!!this[Vs]&&!0===this[Vs][e]};Ms.prototype.hasPlugin=function(e){return!!zs(e)};var Js=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}});if(t)js(e,t)},Zs=function(e,t){if(void 0===t){t={}}var a=function(){e.apply(this,arguments)},n={};if("object"===_typeof2(t)){if(t.constructor!==Object.prototype.constructor){a=t.constructor}n=t}else if("function"==typeof t){a=t}Js(a,e);if(e){a.super_=e}for(var r in n){if(n.hasOwnProperty(r)){a.prototype[r]=n[r]}}return a},eo=function(e){return 0===e.indexOf("#")?e.slice(1):e};function Ze(e,t,a){var n=Ze.getPlayer(e);if(n){if(t){ma.warn("Player \""+e+"\" is already initialised. Options will not be applied.")}if(a){n.ready(a)}return n}var r="string"==typeof e?fa("#"+eo(e)):e;if(!y(r)){throw new TypeError("The element or ID supplied is not valid. (videojs)")}if(!r.ownerDocument.defaultView||!r.ownerDocument.body.contains(r)){ma.warn("The element supplied is not included in the DOM")}t=t||{};Ze.hooks("beforesetup").forEach(function(e){var a=e(r,te(t));if(!l(a)||Array.isArray(a)){ma.error("please return an object in beforesetup hooks");return}t=te(t,a)});var i=Qa.getComponent("Player");n=new i(r,t,a);Ze.hooks("setup").forEach(function(e){return e(n)});return n}Ze.hooks_={};Ze.hooks=function(e,t){Ze.hooks_[e]=Ze.hooks_[e]||[];if(t){Ze.hooks_[e]=Ze.hooks_[e].concat(t)}return Ze.hooks_[e]};Ze.hook=function(e,t){Ze.hooks(e,t)};Ze.hookOnce=function(e,t){Ze.hooks(e,[].concat(t).map(function(t){return function a(){Ze.removeHook(e,a);return t.apply(void 0,arguments)}}))};Ze.removeHook=function(e,t){var a=Ze.hooks(e).indexOf(t);if(-1>=a){return!1}Ze.hooks_[e]=Ze.hooks_[e].slice();Ze.hooks_[e].splice(a,1);return!0};if(!0!==e.VIDEOJS_NO_DYNAMIC_STYLE&&g()){var to=fa(".vjs-styles-defaults");if(!to){to=ka("vjs-styles-defaults");var ao=fa("head");if(ao){ao.insertBefore(to,ao.firstChild)}Ca(to,"\n      .video-js {\n        width: 300px;\n        height: 150px;\n      }\n\n      .vjs-fluid {\n        padding-top: 56.25%\n      }\n    ")}}H(1,Ze);Ze.VERSION="7.7.6";Ze.options=Ms.prototype.options_;Ze.getPlayers=function(){return Ms.players};Ze.getPlayer=function(e){var t=Ms.players,a;if("string"==typeof e){var n=eo(e),r=t[n];if(r){return r}a=fa("#"+n)}else{a=e}if(y(a)){var i=a,s=i.player,o=i.playerId;if(s||t[o]){return s||t[o]}}};Ze.getAllPlayers=function(){return Object.keys(Ms.players).map(function(e){return Ms.players[e]}).filter(Boolean)};Ze.players=Ms.players;Ze.getComponent=Qa.getComponent;Ze.registerComponent=function(e,t){if(Mr.isTech(t)){ma.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)")}Qa.registerComponent.call(Qa,e,t)};Ze.getTech=Mr.getTech;Ze.registerTech=Mr.registerTech;Ze.use=function(e,t){Br[e]=Br[e]||[];Br[e].push(t)};Object.defineProperty(Ze,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(Ze.middleware,"TERMINATOR",{value:Fr,writeable:!1,enumerable:!0});Ze.browser=kn;Ze.TOUCH_ENABLED=fn;Ze.extend=Zs;Ze.mergeOptions=te;Ze.bind=Oa;Ze.registerPlugin=Qs.registerPlugin;Ze.deregisterPlugin=Qs.deregisterPlugin;Ze.plugin=function(e,t){ma.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead");return Qs.registerPlugin(e,t)};Ze.getPlugins=Qs.getPlugins;Ze.getPlugin=Qs.getPlugin;Ze.getPluginVersion=Qs.getPluginVersion;Ze.addLanguage=function(e,t){var a;e=(""+e).toLowerCase();Ze.options.languages=te(Ze.options.languages,(a={},a[e]=t,a));return Ze.options.languages[e]};Ze.log=ma;Ze.createLogger=ga;Ze.createTimeRange=Ze.createTimeRanges=ie;Ze.formatTime=Xe;Ze.setFormatTime=function(e){si=e};Ze.resetFormatTime=function(){si=ii};Ze.parseUrl=ar;Ze.isCrossOrigin=ir;Ze.EventTarget=Ua;Ze.on=K;Ze.one=Q;Ze.off=Y;Ze.trigger=X;Ze.xhr=pr;Ze.TextTrack=mr;Ze.AudioTrack=gr;Ze.VideoTrack=yr;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(e){Ze[e]=function(){ma.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead");return Ta[e].apply(null,arguments)}});Ze.computedStyle=p;Ze.dom=Ta;Ze.url=sr;Ze.defineLazyProperty=Ps;var no=n(function(e){(function(){var t={buildAbsoluteURL:function(e,a,n){n=n||{};e=e.trim();a=a.trim();if(!a){if(!n.alwaysNormalize){return e}var r=t.parseURL(e);if(!r){throw new Error("Error trying to parse base URL.")}r.path=t.normalizePath(r.path);return t.buildURLFromParts(r)}var i=t.parseURL(a);if(!i){throw new Error("Error trying to parse relative URL.")}if(i.scheme){if(!n.alwaysNormalize){return a}i.path=t.normalizePath(i.path);return t.buildURLFromParts(i)}var s=t.parseURL(e);if(!s){throw new Error("Error trying to parse base URL.")}if(!s.netLoc&&s.path&&"/"!==s.path[0]){var o=/^([^\/?#]*)(.*)$/.exec(s.path);s.netLoc=o[1];s.path=o[2]}if(s.netLoc&&!s.path){s.path="/"}var l={scheme:s.scheme,netLoc:i.netLoc,path:null,params:i.params,query:i.query,fragment:i.fragment};if(!i.netLoc){l.netLoc=s.netLoc;if("/"!==i.path[0]){if(!i.path){l.path=s.path;if(!i.params){l.params=s.params;if(!i.query){l.query=s.query}}}else{var d=s.path,p=d.substring(0,d.lastIndexOf("/")+1)+i.path;l.path=t.normalizePath(p)}}}if(null===l.path){l.path=n.alwaysNormalize?t.normalizePath(i.path):i.path}return t.buildURLFromParts(l)},parseURL:function(e){var t=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/.exec(e);if(!t){return null}return{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}},normalizePath:function(e){e=e.split("").reverse().join("").replace(/(?:\/|^)\.(?=\/)/g,"");while(e.length!==(e=e.replace(/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,"")).length){}return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=t})()});function et(){et=Object.assign||function(e){for(var t=1,a;t<arguments.length;t++){a=arguments[t];for(var n in a){if(Object.prototype.hasOwnProperty.call(a,n)){e[n]=a[n]}}}return e};return et.apply(this,arguments)}function tt(e,t){e.prototype=Object.create(t.prototype);e.prototype.constructor=e;e.__proto__=t}function at(e){if(void 0===e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}var ro=function(){function e(){this.listeners={}}var t=e.prototype;t.on=function(e,t){if(!this.listeners[e]){this.listeners[e]=[]}this.listeners[e].push(t)};t.off=function(e,t){if(!this.listeners[e]){return!1}var a=this.listeners[e].indexOf(t);this.listeners[e].splice(a,1);return-1<a};t.trigger=function(e){var t=this.listeners[e],a,n,r;if(!t){return}if(2===arguments.length){n=t.length;for(a=0;a<n;++a){t[a].call(this,arguments[1])}}else{r=Array.prototype.slice.call(arguments,1);n=t.length;for(a=0;a<n;++a){t[a].apply(this,r)}}};t.dispose=function(){this.listeners={}};t.pipe=function(e){this.on("data",function(t){e.push(t)})};return e}(),io=function(e){tt(t,e);function t(){var t=e.call(this)||this;t.buffer="";return t}var a=t.prototype;a.push=function(e){var t;this.buffer+=e;t=this.buffer.indexOf("\n");for(;-1<t;t=this.buffer.indexOf("\n")){this.trigger("data",this.buffer.substring(0,t));this.buffer=this.buffer.substring(t+1)}};return t}(ro),so=function(){return new RegExp("(?:^|,)("+("(?:[^=]*)=(?:"+"\"[^\"]*\"|[^,]*"+")")+")")},oo=function(e){var t=e.split(so()),a={},n=t.length,r;while(n--){if(""===t[n]){continue}r=/([^=]*)=(.*)/.exec(t[n]).slice(1);r[0]=r[0].replace(/^\s+|\s+$/g,"");r[1]=r[1].replace(/^\s+|\s+$/g,"");r[1]=r[1].replace(/^['"](.*)['"]$/g,"$1");a[r[0]]=r[1]}return a},lo=function(e){tt(t,e);function t(){var t=e.call(this)||this;t.customParsers=[];t.tagMappers=[];return t}var a=t.prototype;a.push=function(e){var t=this,a,n;e=e.trim();if(0===e.length){return}if("#"!==e[0]){this.trigger("data",{type:"uri",uri:e});return}var r=this.tagMappers.reduce(function(t,a){var n=a(e);if(n===e){return t}return t.concat([n])},[e]);r.forEach(function(e){for(var r=0;r<t.customParsers.length;r++){if(t.customParsers[r].call(t,e)){return}}if(0!==e.indexOf("#EXT")){t.trigger("data",{type:"comment",text:e.slice(1)});return}e=e.replace("\r","");a=/^#EXTM3U/.exec(e);if(a){t.trigger("data",{type:"tag",tagType:"m3u"});return}a=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e);if(a){n={type:"tag",tagType:"inf"};if(a[1]){n.duration=parseFloat(a[1])}if(a[2]){n.title=a[2]}t.trigger("data",n);return}a=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e);if(a){n={type:"tag",tagType:"targetduration"};if(a[1]){n.duration=parseInt(a[1],10)}t.trigger("data",n);return}a=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e);if(a){n={type:"tag",tagType:"totalduration"};if(a[1]){n.duration=parseInt(a[1],10)}t.trigger("data",n);return}a=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e);if(a){n={type:"tag",tagType:"version"};if(a[1]){n.version=parseInt(a[1],10)}t.trigger("data",n);return}a=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e);if(a){n={type:"tag",tagType:"media-sequence"};if(a[1]){n.number=parseInt(a[1],10)}t.trigger("data",n);return}a=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e);if(a){n={type:"tag",tagType:"discontinuity-sequence"};if(a[1]){n.number=parseInt(a[1],10)}t.trigger("data",n);return}a=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e);if(a){n={type:"tag",tagType:"playlist-type"};if(a[1]){n.playlistType=a[1]}t.trigger("data",n);return}a=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e);if(a){n={type:"tag",tagType:"byterange"};if(a[1]){n.length=parseInt(a[1],10)}if(a[2]){n.offset=parseInt(a[2],10)}t.trigger("data",n);return}a=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e);if(a){n={type:"tag",tagType:"allow-cache"};if(a[1]){n.allowed=!/NO/.test(a[1])}t.trigger("data",n);return}a=/^#EXT-X-MAP:?(.*)$/.exec(e);if(a){n={type:"tag",tagType:"map"};if(a[1]){var s=oo(a[1]);if(s.URI){n.uri=s.URI}if(s.BYTERANGE){var o=s.BYTERANGE.split("@"),l=o[0],d=o[1];n.byterange={};if(l){n.byterange.length=parseInt(l,10)}if(d){n.byterange.offset=parseInt(d,10)}}}t.trigger("data",n);return}a=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e);if(a){n={type:"tag",tagType:"stream-inf"};if(a[1]){n.attributes=oo(a[1]);if(n.attributes.RESOLUTION){var p=n.attributes.RESOLUTION.split("x"),u={};if(p[0]){u.width=parseInt(p[0],10)}if(p[1]){u.height=parseInt(p[1],10)}n.attributes.RESOLUTION=u}if(n.attributes.BANDWIDTH){n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)}if(n.attributes["PROGRAM-ID"]){n.attributes["PROGRAM-ID"]=parseInt(n.attributes["PROGRAM-ID"],10)}}t.trigger("data",n);return}a=/^#EXT-X-MEDIA:?(.*)$/.exec(e);if(a){n={type:"tag",tagType:"media"};if(a[1]){n.attributes=oo(a[1])}t.trigger("data",n);return}a=/^#EXT-X-ENDLIST/.exec(e);if(a){t.trigger("data",{type:"tag",tagType:"endlist"});return}a=/^#EXT-X-DISCONTINUITY/.exec(e);if(a){t.trigger("data",{type:"tag",tagType:"discontinuity"});return}a=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e);if(a){n={type:"tag",tagType:"program-date-time"};if(a[1]){n.dateTimeString=a[1];n.dateTimeObject=new Date(a[1])}t.trigger("data",n);return}a=/^#EXT-X-KEY:?(.*)$/.exec(e);if(a){n={type:"tag",tagType:"key"};if(a[1]){n.attributes=oo(a[1]);if(n.attributes.IV){if("0x"===n.attributes.IV.substring(0,2).toLowerCase()){n.attributes.IV=n.attributes.IV.substring(2)}n.attributes.IV=n.attributes.IV.match(/.{8}/g);n.attributes.IV[0]=parseInt(n.attributes.IV[0],16);n.attributes.IV[1]=parseInt(n.attributes.IV[1],16);n.attributes.IV[2]=parseInt(n.attributes.IV[2],16);n.attributes.IV[3]=parseInt(n.attributes.IV[3],16);n.attributes.IV=new Uint32Array(n.attributes.IV)}}t.trigger("data",n);return}a=/^#EXT-X-START:?(.*)$/.exec(e);if(a){n={type:"tag",tagType:"start"};if(a[1]){n.attributes=oo(a[1]);n.attributes["TIME-OFFSET"]=parseFloat(n.attributes["TIME-OFFSET"]);n.attributes.PRECISE=/YES/.test(n.attributes.PRECISE)}t.trigger("data",n);return}a=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e);if(a){n={type:"tag",tagType:"cue-out-cont"};if(a[1]){n.data=a[1]}else{n.data=""}t.trigger("data",n);return}a=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e);if(a){n={type:"tag",tagType:"cue-out"};if(a[1]){n.data=a[1]}else{n.data=""}t.trigger("data",n);return}a=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e);if(a){n={type:"tag",tagType:"cue-in"};if(a[1]){n.data=a[1]}else{n.data=""}t.trigger("data",n);return}t.trigger("data",{type:"tag",data:e.slice(4)})})};a.addParser=function(e){var t=this,a=e.expression,n=e.customType,r=e.dataParser,i=e.segment;if("function"!=typeof r){r=function(e){return e}}this.customParsers.push(function(e){var s=a.exec(e);if(s){t.trigger("data",{type:"custom",data:r(e),customType:n,segment:i});return!0}})};a.addTagMapper=function(e){var t=e.expression,a=e.map;this.tagMappers.push(function(e){if(t.test(e)){return a(e)}return e})};return t}(ro);function nt(t){for(var a=e.atob(t||""),n=new Uint8Array(a.length),r=0;r<a.length;r++){n[r]=a.charCodeAt(r)}return n}var po=function(e){tt(t,e);function t(){var t=e.call(this)||this;t.lineStream=new io;t.parseStream=new lo;t.lineStream.pipe(t.parseStream);var a=at(t),n=[],r={},i,s,o=function(){},l={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},d=0;t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]};t.parseStream.on("data",function(e){var t,p;({tag:function(){(({"allow-cache":function(){this.manifest.allowCache=e.allowed;if(!("allowed"in e)){this.trigger("info",{message:"defaulting allowCache to YES"});this.manifest.allowCache=!0}},byterange:function t(){var t={};if("length"in e){r.byterange=t;t.length=e.length;if(!("offset"in e)){this.trigger("info",{message:"defaulting offset to zero"});e.offset=0}}if("offset"in e){r.byterange=t;t.offset=e.offset}},endlist:function(){this.manifest.endList=!0},inf:function(){if(!("mediaSequence"in this.manifest)){this.manifest.mediaSequence=0;this.trigger("info",{message:"defaulting media sequence to zero"})}if(!("discontinuitySequence"in this.manifest)){this.manifest.discontinuitySequence=0;this.trigger("info",{message:"defaulting discontinuity sequence to zero"})}if(0<e.duration){r.duration=e.duration}if(0===e.duration){r.duration=.01;this.trigger("info",{message:"updating zero segment duration to a small value"})}this.manifest.segments=n},key:function(){if(!e.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if("NONE"===e.attributes.METHOD){s=null;return}if(!e.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(e.attributes.KEYFORMAT==="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"){if(-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if("SAMPLE-AES-CENC"===e.attributes.METHOD){this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"})}if("data:text/plain;base64,"!==e.attributes.URI.substring(0,23)){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2))){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection={"com.widevine.alpha":{attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:nt(e.attributes.URI.split(",")[1])}};return}if(!e.attributes.METHOD){this.trigger("warn",{message:"defaulting key method to AES-128"})}s={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI};if("undefined"!=typeof e.attributes.IV){s.iv=e.attributes.IV}},"media-sequence":function(){if(!isFinite(e.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number});return}this.manifest.mediaSequence=e.number},"discontinuity-sequence":function(){if(!isFinite(e.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number});return}this.manifest.discontinuitySequence=e.number;d=e.number},"playlist-type":function(){if(!/VOD|EVENT/.test(e.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist});return}this.manifest.playlistType=e.playlistType},map:function(){i={};if(e.uri){i.uri=e.uri}if(e.byterange){i.byterange=e.byterange}},"stream-inf":function(){this.manifest.playlists=n;this.manifest.mediaGroups=this.manifest.mediaGroups||l;if(!e.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}if(!r.attributes){r.attributes={}}et(r.attributes,e.attributes)},media:function(){this.manifest.mediaGroups=this.manifest.mediaGroups||l;if(!(e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}var a=this.manifest.mediaGroups[e.attributes.TYPE];a[e.attributes["GROUP-ID"]]=a[e.attributes["GROUP-ID"]]||{};t=a[e.attributes["GROUP-ID"]];p={default:/yes/i.test(e.attributes.DEFAULT)};if(p["default"]){p.autoselect=!0}else{p.autoselect=/yes/i.test(e.attributes.AUTOSELECT)}if(e.attributes.LANGUAGE){p.language=e.attributes.LANGUAGE}if(e.attributes.URI){p.uri=e.attributes.URI}if(e.attributes["INSTREAM-ID"]){p.instreamId=e.attributes["INSTREAM-ID"]}if(e.attributes.CHARACTERISTICS){p.characteristics=e.attributes.CHARACTERISTICS}if(e.attributes.FORCED){p.forced=/yes/i.test(e.attributes.FORCED)}t[e.attributes.NAME]=p},discontinuity:function(){d+=1;r.discontinuity=!0;this.manifest.discontinuityStarts.push(n.length)},"program-date-time":function(){if("undefined"==typeof this.manifest.dateTimeString){this.manifest.dateTimeString=e.dateTimeString;this.manifest.dateTimeObject=e.dateTimeObject}r.dateTimeString=e.dateTimeString;r.dateTimeObject=e.dateTimeObject},targetduration:function(){if(!isFinite(e.duration)||0>e.duration){this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration});return}this.manifest.targetDuration=e.duration},totalduration:function(){if(!isFinite(e.duration)||0>e.duration){this.trigger("warn",{message:"ignoring invalid total duration: "+e.duration});return}this.manifest.totalDuration=e.duration},start:function(){if(!e.attributes||isNaN(e.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}},"cue-out":function(){r.cueOut=e.data},"cue-out-cont":function(){r.cueOutCont=e.data},"cue-in":function(){r.cueIn=e.data}})[e.tagType]||o).call(a)},uri:function(){r.uri=e.uri;n.push(r);if(this.manifest.targetDuration&&!("duration"in r)){this.trigger("warn",{message:"defaulting segment duration to the target duration"});r.duration=this.manifest.targetDuration}if(s){r.key=s}r.timeline=d;if(i){r.map=i}r={}},comment:function(){},custom:function(){if(e.segment){r.custom=r.custom||{};r.custom[e.customType]=e.data}else{this.manifest.custom=this.manifest.custom||{};this.manifest.custom[e.customType]=e.data}}})[e.type].call(a)});return t}var a=t.prototype;a.push=function(e){this.lineStream.push(e)};a.end=function(){this.lineStream.push("\n")};a.addParser=function(e){this.parseStream.addParser(e)};a.addTagMapper=function(e){this.parseStream.addTagMapper(e)};return t}(ro);function rt(e){return e&&"object"===_typeof2(e)&&"default"in e?e["default"]:e}var uo=rt(no),co=rt(e),mo=function(e,t){if(/^[a-z]+:/i.test(t)){return t}if(!/\/\//i.test(e)){e=uo.buildAbsoluteURL(co.location&&co.location.href||"",e)}return uo.buildAbsoluteURL(e,t)};function it(e){return e&&"object"===_typeof2(e)&&"default"in e?e["default"]:e}var go=it(e),yo=function(e){return go.atob?go.atob(e):Buffer.from(e,"base64").toString("binary")};function st(e){for(var t=yo(e),a=new Uint8Array(t.length),n=0;n<t.length;n++){a[n]=t.charCodeAt(n)}return a}var ho=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,_o=new RegExp("[\\-\\.0-9"+ho.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),fo=new RegExp("^"+ho.source+_o.source+"*(?::"+ho.source+_o.source+"*)?$"),To=0,bo=1,vo=2,So=3,ko=4,Co=5,Eo=6,Io=7;function ot(){}ot.prototype={parse:function(e,t,a){var n=this.domBuilder;n.startDocument();gt(t,t={});lt(e,t,a,n,this.errorHandler);n.endDocument()}};function lt(e,t,n,r,s){function o(e){if(65535<e){e-=65536;var t=55296+(e>>10),a=56320+(1023&e);return String.fromCharCode(t,a)}else{return String.fromCharCode(e)}}function l(e){var t=e.slice(1,-1);if(t in n){return n[t]}else if("#"===t.charAt(0)){return o(parseInt(t.substr(1).replace("x","0x")))}else{s.error("entity not found:"+e);return e}}function d(t){if(t>f){var a=e.substring(f,t).replace(/&#?\w+;/g,l);y&&p(f);r.characters(a,0,t-f);f=t}}function p(t,a){while(t>=c&&(a=g.exec(e))){u=a.index;c=u+a[0].length;y.lineNumber++}y.columnNumber=t-u+1}var u=0,c=0,g=/.*(?:\r\n?|\n)|.*$/g,y=r.locator,h=[{currentNSMap:t}],_={},f=0;while(!0){try{var T=e.indexOf("<",f);if(0>T){if(!e.substr(f).match(/^\s*$/)){var b=r.doc,v=b.createTextNode(e.substr(f));b.appendChild(v);r.currentElement=v}return}if(T>f){d(T)}switch(e.charAt(T+1)){case"/":var S=e.indexOf(">",T+3),k=e.substring(T+2,S),C=h.pop();if(0>S){k=e.substring(T+2).replace(/[\s<].*/,"");s.error("end tag name: "+k+" is not complete:"+C.tagName);S=T+1+k.length}else if(k.match(/\s</)){k=k.replace(/[\s<].*/,"");s.error("end tag name: "+k+" maybe not complete");S=T+1+k.length}var E=C.localNSMap,I=C.tagName==k,x=I||C.tagName&&C.tagName.toLowerCase()==k.toLowerCase();if(x){r.endElement(C.uri,C.localName,k);if(E){for(var L in E){r.endPrefixMapping(L)}}if(!I){s.fatalError("end tag name: "+k+" is not match the current start tagName:"+C.tagName)}}else{h.push(C)}S++;break;case"?":y&&p(T);S=ht(e,T,r);break;case"!":y&&p(T);S=yt(e,T,r,s);break;default:y&&p(T);var P=new _t,m=h[h.length-1].currentNSMap,S=pt(e,T,P,m,l,s),D=P.length;if(!P.closed&&mt(e,S,P.tagName,_)){P.closed=!0;if(!n.nbsp){s.warning("unclosed xml attribute")}}if(y&&D){for(var w=dt(y,{}),A=0,O;A<D;A++){O=P[A];p(O.offset);O.locator=dt(y,{})}r.locator=w;if(ut(P,r,m)){h.push(P)}r.locator=y}else{if(ut(P,r,m)){h.push(P)}}if("http://www.w3.org/1999/xhtml"===P.uri&&!P.closed){S=ct(e,S,P.tagName,l,r)}else{S++}}}catch(t){s.error("element parse error: "+t);S=-1}if(S>f){f=S}else{d(Math.max(T,f)+1)}}}function dt(e,a){a.lineNumber=e.lineNumber;a.columnNumber=e.columnNumber;return a}function pt(e,t,a,n,r,i){var o,l,d=++t,u=To;while(!0){var m=e.charAt(d);switch(m){case"=":if(u===bo){o=e.slice(t,d);u=So}else if(u===vo){u=So}else{throw new Error("attribute equal must after attrName")}break;case"'":case"\"":if(u===So||u===bo){if(u===bo){i.warning("attribute value must after \"=\"");o=e.slice(t,d)}t=d+1;d=e.indexOf(m,t);if(0<d){l=e.slice(t,d).replace(/&#?\w+;/g,r);a.add(o,l,t-1);u=Co}else{throw new Error("attribute value no end '"+m+"' match")}}else if(u==ko){l=e.slice(t,d).replace(/&#?\w+;/g,r);a.add(o,l,t);i.warning("attribute \""+o+"\" missed start quot("+m+")!!");t=d+1;u=Co}else{throw new Error("attribute value must after \"=\"")}break;case"/":switch(u){case To:a.setTagName(e.slice(t,d));case Co:case Eo:case Io:u=Io;a.closed=!0;case ko:case bo:case vo:break;default:throw new Error("attribute invalid close char('/')");}break;case"":i.error("unexpected end of input");if(u==To){a.setTagName(e.slice(t,d))}return d;case">":switch(u){case To:a.setTagName(e.slice(t,d));case Co:case Eo:case Io:break;case ko:case bo:l=e.slice(t,d);if("/"===l.slice(-1)){a.closed=!0;l=l.slice(0,-1)}case vo:if(u===vo){l=o}if(u==ko){i.warning("attribute \""+l+"\" missed quot(\")!!");a.add(o,l.replace(/&#?\w+;/g,r),t)}else{if("http://www.w3.org/1999/xhtml"!==n[""]||!l.match(/^(?:disabled|checked|selected)$/i)){i.warning("attribute \""+l+"\" missed value!! \""+l+"\" instead!!")}a.add(l,l,t)}break;case So:throw new Error("attribute value missed!!");}return d;case"\x80":m=" ";default:if(" ">=m){switch(u){case To:a.setTagName(e.slice(t,d));u=Eo;break;case bo:o=e.slice(t,d);u=vo;break;case ko:var l=e.slice(t,d).replace(/&#?\w+;/g,r);i.warning("attribute \""+l+"\" missed quot(\")!!");a.add(o,l,t);case Co:u=Eo;break;}}else{switch(u){case vo:a.tagName;if("http://www.w3.org/1999/xhtml"!==n[""]||!o.match(/^(?:disabled|checked|selected)$/i)){i.warning("attribute \""+o+"\" missed value!! \""+o+"\" instead2!!")}a.add(o,o,t);t=d;u=bo;break;case Co:i.warning("attribute space is required\""+o+"\"!!");case Eo:u=bo;t=d;break;case So:u=ko;t=d;break;case Io:throw new Error("elements closed character '/' and '>' must be connected to");}}}d++}}function ut(e,t,n){var r=e.tagName,s=null,o=e.length;while(o--){var l=e[o],d=l.qName,p=l.value,u=d.indexOf(":");if(0<u){var c=l.prefix=d.slice(0,u),m=d.slice(u+1),g="xmlns"===c&&m}else{m=d;c=null;g="xmlns"===d&&""}l.localName=m;if(!1!==g){if(null==s){s={};gt(n,n={})}n[g]=s[g]=p;l.uri="http://www.w3.org/2000/xmlns/";t.startPrefixMapping(g,p)}}var o=e.length;while(o--){l=e[o];var c=l.prefix;if(c){if("xml"===c){l.uri="http://www.w3.org/XML/1998/namespace"}if("xmlns"!==c){l.uri=n[c||""]}}}var u=r.indexOf(":");if(0<u){c=e.prefix=r.slice(0,u);m=e.localName=r.slice(u+1)}else{c=null;m=e.localName=r}var y=e.uri=n[c||""];t.startElement(y,m,r,e);if(e.closed){t.endElement(y,m,r);if(s){for(c in s){t.endPrefixMapping(c)}}}else{e.currentNSMap=n;e.localNSMap=s;return!0}}function ct(e,t,a,n,r){if(/^(?:script|textarea)$/i.test(a)){var i=e.indexOf("</"+a+">",t),s=e.substring(t+1,i);if(/[&<]/.test(s)){if(/^script$/i.test(a)){r.characters(s,0,s.length);return i}s=s.replace(/&#?\w+;/g,n);r.characters(s,0,s.length);return i}}return t+1}function mt(e,t,a,n){var r=n[a];if(null==r){r=e.lastIndexOf("</"+a+">");if(r<t){r=e.lastIndexOf("</"+a)}n[a]=r}return r<t}function gt(e,t){for(var a in e){t[a]=e[a]}}function yt(e,t,a,n){var r=e.charAt(t+2);switch(r){case"-":if("-"===e.charAt(t+3)){var i=e.indexOf("-->",t+4);if(i>t){a.comment(e,t+4,i-t-4);return i+3}else{n.error("Unclosed comment");return-1}}else{return-1}default:if("CDATA["==e.substr(t+3,6)){var i=e.indexOf("]]>",t+9);a.startCDATA();a.characters(e,t+9,i-t-9);a.endCDATA();return i+3}var s=Tt(e,t),o=s.length;if(1<o&&/!doctype/i.test(s[0][0])){var l=s[1][0],d=3<o&&/^public$/i.test(s[2][0])&&s[3][0],p=4<o&&s[4][0],u=s[o-1];a.startDTD(l,d&&d.replace(/^(['"])(.*?)\1$/,"$2"),p&&p.replace(/^(['"])(.*?)\1$/,"$2"));a.endDTD();return u.index+u[0].length}}return-1}function ht(e,t,a){var n=e.indexOf("?>",t);if(n){var r=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(r){r[0].length;a.processingInstruction(r[1],r[2]);return n+2}else{return-1}}return-1}function _t(){}_t.prototype={setTagName:function(e){if(!fo.test(e)){throw new Error("invalid tagName:"+e)}this.tagName=e},add:function(e,t,a){if(!fo.test(e)){throw new Error("invalid attribute:"+e)}this[this.length++]={qName:e,value:t,offset:a}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function ft(e,t){e.__proto__=t;return e}if(!(ft({},ft.prototype)instanceof ft)){ft=function(e,t){function a(){}a.prototype=t;a=new a;for(t in e){a[t]=e[t]}return a}}function Tt(e,t){var a,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t;r.exec(e);while(a=r.exec(e)){n.push(a);if(a[1])return n}}var xo={XMLReader:ot};function bt(e,t){for(var a in e){t[a]=e[a]}}function vt(e,a){var n=e.prototype;if(Object.create){var r=Object.create(a.prototype);n.__proto__=r}if(!(n instanceof a)){var i=function(){};i.prototype=a.prototype;i=new i;bt(n,i);e.prototype=n=i}if(n.constructor!=e){if("function"!=typeof e){console.error("unknow Class:"+e)}n.constructor=e}}var Lo={},Po=Lo.ELEMENT_NODE=1,Do=Lo.ATTRIBUTE_NODE=2,wo=Lo.TEXT_NODE=3,Ao=Lo.CDATA_SECTION_NODE=4,Oo=Lo.ENTITY_REFERENCE_NODE=5,Ro=Lo.ENTITY_NODE=6,No=Lo.PROCESSING_INSTRUCTION_NODE=7,Uo=Lo.COMMENT_NODE=8,Mo=Lo.DOCUMENT_NODE=9,Bo=Lo.DOCUMENT_TYPE_NODE=10,jo=Lo.DOCUMENT_FRAGMENT_NODE=11,Fo=Lo.NOTATION_NODE=12,Ho={},qo={},Vo=Ho.INDEX_SIZE_ERR=(qo[1]="Index size error",1),Wo=Ho.DOMSTRING_SIZE_ERR=(qo[2]="DOMString size error",2),zo=Ho.HIERARCHY_REQUEST_ERR=(qo[3]="Hierarchy request error",3),Go=Ho.WRONG_DOCUMENT_ERR=(qo[4]="Wrong document",4),Ko=Ho.INVALID_CHARACTER_ERR=(qo[5]="Invalid character",5),Yo=Ho.NO_DATA_ALLOWED_ERR=(qo[6]="No data allowed",6),Xo=Ho.NO_MODIFICATION_ALLOWED_ERR=(qo[7]="No modification allowed",7),$o=Ho.NOT_FOUND_ERR=(qo[8]="Not found",8),Qo=Ho.NOT_SUPPORTED_ERR=(qo[9]="Not supported",9),Jo=Ho.INUSE_ATTRIBUTE_ERR=(qo[10]="Attribute in use",10),Zo=Ho.INVALID_STATE_ERR=(qo[11]="Invalid state",11),el=Ho.SYNTAX_ERR=(qo[12]="Syntax error",12),tl=Ho.INVALID_MODIFICATION_ERR=(qo[13]="Invalid modification",13),al=Ho.NAMESPACE_ERR=(qo[14]="Invalid namespace",14),nl=Ho.INVALID_ACCESS_ERR=(qo[15]="Invalid access",15);function St(e,t){if(t instanceof Error){var a=t}else{a=this;Error.call(this,qo[e]);this.message=qo[e];if(Error.captureStackTrace)Error.captureStackTrace(this,St)}a.code=e;if(t)this.message=this.message+": "+t;return a}St.prototype=Error.prototype;bt(Ho,St);function kt(){}kt.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var a=[],n=0;n<this.length;n++){aa(this[n],a,e,t)}return a.join("")}};function Ct(e,t){this._node=e;this._refresh=t;Et(this)}function Et(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var a=e._refresh(e._node);ia(e,"length",a.length);bt(a,e);e._inc=t}}Ct.prototype.item=function(e){Et(this);return this[e]};vt(Ct,kt);function It(){}function xt(e,t){var a=e.length;while(a--){if(e[a]===t){return a}}}function Lt(e,t,a,n){if(n){t[xt(t,n)]=a}else{t[t.length++]=a}if(e){a.ownerElement=e;var r=e.ownerDocument;if(r){n&&Ut(r,e,n);Nt(r,e,a)}}}function Pt(e,t,a){var n=xt(t,a);if(0<=n){var r=t.length-1;while(n<r){t[n]=t[++n]}t.length=r;if(e){var s=e.ownerDocument;if(s){Ut(s,e,a);a.ownerElement=null}}}else{throw St($o,new Error(e.tagName+"@"+a))}}It.prototype={length:0,item:kt.prototype.item,getNamedItem:function(e){var t=this.length;while(t--){var a=this[t];if(a.nodeName==e){return a}}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement){throw new St(Jo)}var a=this.getNamedItem(e.nodeName);Lt(this._ownerElement,this,e,a);return a},setNamedItemNS:function(e){var t=e.ownerElement,a;if(t&&t!=this._ownerElement){throw new St(Jo)}a=this.getNamedItemNS(e.namespaceURI,e.localName);Lt(this._ownerElement,this,e,a);return a},removeNamedItem:function(e){var t=this.getNamedItem(e);Pt(this._ownerElement,this,t);return t},removeNamedItemNS:function(e,t){var a=this.getNamedItemNS(e,t);Pt(this._ownerElement,this,a);return a},getNamedItemNS:function(e,t){var a=this.length;while(a--){var n=this[a];if(n.localName==t&&n.namespaceURI==e){return n}}return null}};function Dt(e){this._features={};if(e){for(var t in e){this._features=e[t]}}}Dt.prototype={hasFeature:function(e,t){var a=this._features[e.toLowerCase()];if(a&&(!t||t in a)){return!0}else{return!1}},createDocument:function(e,t,a){var n=new Rt;n.implementation=this;n.childNodes=new kt;n.doctype=a;if(a){n.appendChild(a)}if(t){var r=n.createElementNS(e,t);n.appendChild(r)}return n},createDocumentType:function(e,t,a){var n=new Kt;n.name=e;n.nodeName=e;n.publicId=t;n.systemId=a;return n}};function wt(){}wt.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return jt(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t);if(t){this.removeChild(t)}},removeChild:function(e){return Bt(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ra(this.ownerDocument||this,this,e)},normalize:function(){var e=this.firstChild;while(e){var t=e.nextSibling;if(t&&t.nodeType==wo&&e.nodeType==wo){this.removeChild(t);e.appendData(t.data)}else{e.normalize();e=t}}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return 0<this.attributes.length},lookupPrefix:function(e){var t=this;while(t){var a=t._nsMap;if(a){for(var r in a){if(a[r]==e){return r}}}t=t.nodeType==Do?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){var t=this;while(t){var a=t._nsMap;if(a){if(e in a){return a[e]}}t=t.nodeType==Do?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return null==t}};function At(e){return"<"==e&&"&lt;"||">"==e&&"&gt;"||"&"==e&&"&amp;"||"\""==e&&"&quot;"||"&#"+e.charCodeAt()+";"}bt(Lo,wt);bt(Lo,wt.prototype);function Ot(e,t){if(t(e)){return!0}if(e=e.firstChild){do{if(Ot(e,t)){return!0}}while(e=e.nextSibling)}}function Rt(){}function Nt(e,t,a){e&&e._inc++;var n=a.namespaceURI;if("http://www.w3.org/2000/xmlns/"==n){t._nsMap[a.prefix?a.localName:""]=a.value}}function Ut(e,t,a){e&&e._inc++;var n=a.namespaceURI;if("http://www.w3.org/2000/xmlns/"==n){delete t._nsMap[a.prefix?a.localName:""]}}function Mt(e,t,a){if(e&&e._inc){e._inc++;var n=t.childNodes;if(a){n[n.length++]=a}else{var r=t.firstChild,s=0;while(r){n[s++]=r;r=r.nextSibling}n.length=s}}}function Bt(e,t){var a=t.previousSibling,n=t.nextSibling;if(a){a.nextSibling=n}else{e.firstChild=n}if(n){n.previousSibling=a}else{e.lastChild=a}Mt(e.ownerDocument,e);return t}function jt(e,t,a){var n=t.parentNode;if(n){n.removeChild(t)}if(t.nodeType===jo){var r=t.firstChild;if(null==r){return t}var i=t.lastChild}else{r=i=t}var s=a?a.previousSibling:e.lastChild;r.previousSibling=s;i.nextSibling=a;if(s){s.nextSibling=r}else{e.firstChild=r}if(null==a){e.lastChild=i}else{a.previousSibling=i}do{r.parentNode=e}while(r!==i&&(r=r.nextSibling));Mt(e.ownerDocument||e,e);if(t.nodeType==jo){t.firstChild=t.lastChild=null}return t}function Ft(e,t){var a=t.parentNode;if(a){var n=e.lastChild;a.removeChild(t);var n=e.lastChild}var n=e.lastChild;t.parentNode=e;t.previousSibling=n;t.nextSibling=null;if(n){n.nextSibling=t}else{e.firstChild=t}e.lastChild=t;Mt(e.ownerDocument,e,t);return t}Rt.prototype={nodeName:"#document",nodeType:Mo,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==jo){var a=e.firstChild;while(a){var n=a.nextSibling;this.insertBefore(a,t);a=n}return e}if(null==this.documentElement&&e.nodeType==Po){this.documentElement=e}return jt(this,e,t),e.ownerDocument=this,e},removeChild:function(e){if(this.documentElement==e){this.documentElement=null}return Bt(this,e)},importNode:function(e,t){return na(this,e,t)},getElementById:function(e){var t=null;Ot(this.documentElement,function(a){if(a.nodeType==Po){if(a.getAttribute("id")==e){t=a;return!0}}});return t},createElement:function(e){var t=new Ht;t.ownerDocument=this;t.nodeName=e;t.tagName=e;t.childNodes=new kt;var a=t.attributes=new It;a._ownerElement=t;return t},createDocumentFragment:function(){var e=new Qt;e.ownerDocument=this;e.childNodes=new kt;return e},createTextNode:function(e){var t=new Wt;t.ownerDocument=this;t.appendData(e);return t},createComment:function(e){var t=new zt;t.ownerDocument=this;t.appendData(e);return t},createCDATASection:function(e){var t=new Gt;t.ownerDocument=this;t.appendData(e);return t},createProcessingInstruction:function(e,t){var a=new Jt;a.ownerDocument=this;a.tagName=a.target=e;a.nodeValue=a.data=t;return a},createAttribute:function(e){var t=new qt;t.ownerDocument=this;t.name=e;t.nodeName=e;t.localName=e;t.specified=!0;return t},createEntityReference:function(e){var t=new $t;t.ownerDocument=this;t.nodeName=e;return t},createElementNS:function(e,t){var a=new Ht,n=t.split(":"),r=a.attributes=new It;a.childNodes=new kt;a.ownerDocument=this;a.nodeName=t;a.tagName=t;a.namespaceURI=e;if(2==n.length){a.prefix=n[0];a.localName=n[1]}else{a.localName=t}r._ownerElement=a;return a},createAttributeNS:function(e,t){var a=new qt,n=t.split(":");a.ownerDocument=this;a.nodeName=t;a.name=t;a.namespaceURI=e;a.specified=!0;if(2==n.length){a.prefix=n[0];a.localName=n[1]}else{a.localName=t}return a}};vt(Rt,wt);function Ht(){this._nsMap={}}Ht.prototype={nodeType:Po,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var a=this.ownerDocument.createAttribute(e);a.value=a.nodeValue=""+t;this.setAttributeNode(a)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){if(e.nodeType===jo){return this.insertBefore(e,null)}else{return Ft(this,e)}},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var a=this.getAttributeNodeNS(e,t);a&&this.removeAttributeNode(a)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var a=this.getAttributeNodeNS(e,t);return a&&a.value||""},setAttributeNS:function(e,t,a){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+a;this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new Ct(this,function(t){var a=[];Ot(t,function(n){if(n!==t&&n.nodeType==Po&&("*"===e||n.tagName==e)){a.push(n)}});return a})},getElementsByTagNameNS:function(e,t){return new Ct(this,function(a){var n=[];Ot(a,function(r){if(r!==a&&r.nodeType===Po&&("*"===e||r.namespaceURI===e)&&("*"===t||r.localName==t)){n.push(r)}});return n})}};Rt.prototype.getElementsByTagName=Ht.prototype.getElementsByTagName;Rt.prototype.getElementsByTagNameNS=Ht.prototype.getElementsByTagNameNS;vt(Ht,wt);function qt(){}qt.prototype.nodeType=Do;vt(qt,wt);function Vt(){}Vt.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e;this.nodeValue=this.data=e;this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(){throw new Error(qo[zo])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,a){var n=this.data.substring(0,e),r=this.data.substring(e+t);a=n+a+r;this.nodeValue=this.data=a;this.length=a.length}};vt(Vt,wt);function Wt(){}Wt.prototype={nodeName:"#text",nodeType:wo,splitText:function(e){var t=this.data,a=t.substring(e);t=t.substring(0,e);this.data=this.nodeValue=t;this.length=t.length;var n=this.ownerDocument.createTextNode(a);if(this.parentNode){this.parentNode.insertBefore(n,this.nextSibling)}return n}};vt(Wt,Vt);function zt(){}zt.prototype={nodeName:"#comment",nodeType:Uo};vt(zt,Vt);function Gt(){}Gt.prototype={nodeName:"#cdata-section",nodeType:Ao};vt(Gt,Vt);function Kt(){}Kt.prototype.nodeType=Bo;vt(Kt,wt);function Yt(){}Yt.prototype.nodeType=Fo;vt(Yt,wt);function Xt(){}Xt.prototype.nodeType=Ro;vt(Xt,wt);function $t(){}$t.prototype.nodeType=Oo;vt($t,wt);function Qt(){}Qt.prototype.nodeName="#document-fragment";Qt.prototype.nodeType=jo;vt(Qt,wt);function Jt(){}Jt.prototype.nodeType=No;vt(Jt,wt);function Zt(){}Zt.prototype.serializeToString=function(e,t,a){return ea.call(e,t,a)};wt.prototype.toString=ea;function ea(e,t){var a=[],n=9==this.nodeType?this.documentElement:this,r=n.prefix,i=n.namespaceURI;if(i&&null==r){var r=n.lookupPrefix(i);if(null==r){var s=[{namespace:i,prefix:null}]}}aa(this,a,e,t,s);return a.join("")}function ta(e,t,a){var n=e.prefix||"",r=e.namespaceURI;if(!n&&!r){return!1}if("xml"===n&&"http://www.w3.org/XML/1998/namespace"===r||"http://www.w3.org/2000/xmlns/"==r){return!1}var s=a.length;while(s--){var o=a[s];if(o.prefix==n){return o.namespace!=r}}return!0}function aa(e,t,a,n,r){if(n){e=n(e);if(e){if("string"==typeof e){t.push(e);return}}else{return}}switch(e.nodeType){case Po:if(!r)r=[];var s=r.length,o=e.attributes,l=o.length,d=e.firstChild,p=e.tagName;a="http://www.w3.org/1999/xhtml"===e.namespaceURI||a;t.push("<",p);for(var u=0,c;u<l;u++){c=o.item(u);if("xmlns"==c.prefix){r.push({prefix:c.localName,namespace:c.value})}else if("xmlns"==c.nodeName){r.push({prefix:"",namespace:c.value})}}for(var u=0,c;u<l;u++){c=o.item(u);if(ta(c,a,r)){var m=c.prefix||"",g=c.namespaceURI,y=m?" xmlns:"+m:" xmlns";t.push(y,"=\"",g,"\"");r.push({prefix:m,namespace:g})}aa(c,t,a,n,r)}if(ta(e,a,r)){var m=e.prefix||"",g=e.namespaceURI,y=m?" xmlns:"+m:" xmlns";t.push(y,"=\"",g,"\"");r.push({prefix:m,namespace:g})}if(d||a&&!/^(?:meta|link|img|br|hr|input)$/i.test(p)){t.push(">");if(a&&/^script$/i.test(p)){while(d){if(d.data){t.push(d.data)}else{aa(d,t,a,n,r)}d=d.nextSibling}}else{while(d){aa(d,t,a,n,r);d=d.nextSibling}}t.push("</",p,">")}else{t.push("/>")}return;case Mo:case jo:var d=e.firstChild;while(d){aa(d,t,a,n,r);d=d.nextSibling}return;case Do:return t.push(" ",e.name,"=\"",e.value.replace(/[<&"]/g,At),"\"");case wo:return t.push(e.data.replace(/[<&]/g,At));case Ao:return t.push("<![CDATA[",e.data,"]]>");case Uo:return t.push("<!--",e.data,"-->");case Bo:var h=e.publicId,_=e.systemId;t.push("<!DOCTYPE ",e.name);if(h){t.push(" PUBLIC \"",h);if(_&&"."!=_){t.push("\" \"",_)}t.push("\">")}else if(_&&"."!=_){t.push(" SYSTEM \"",_,"\">")}else{var f=e.internalSubset;if(f){t.push(" [",f,"]")}t.push(">")}return;case No:return t.push("<?",e.target," ",e.data,"?>");case Oo:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName);}}function na(e,t,a){var n;switch(t.nodeType){case Po:n=t.cloneNode(!1);n.ownerDocument=e;case jo:break;case Do:a=!0;break;}if(!n){n=t.cloneNode(!1)}n.ownerDocument=e;n.parentNode=null;if(a){var r=t.firstChild;while(r){n.appendChild(na(e,r,a));r=r.nextSibling}}return n}function ra(e,t,a){var r=new t.constructor;for(var s in t){var n=t[s];if("object"!=_typeof2(n)){if(n!=r[s]){r[s]=n}}}if(t.childNodes){r.childNodes=new kt}r.ownerDocument=e;switch(r.nodeType){case Po:var o=t.attributes,l=r.attributes=new It,d=o.length;l._ownerElement=r;for(var p=0;p<d;p++){r.setAttributeNode(ra(e,o.item(p),!0))}break;case Do:a=!0;}if(a){var u=t.firstChild;while(u){r.appendChild(ra(e,u,a));u=u.nextSibling}}return r}function ia(e,t,a){e[t]=a}try{if(Object.defineProperty){var rl=function e(t){switch(t.nodeType){case Po:case jo:var a=[];t=t.firstChild;while(t){if(7!==t.nodeType&&8!==t.nodeType){a.push(e(t))}t=t.nextSibling}return a.join("");default:return t.nodeValue;}};Object.defineProperty(Ct.prototype,"length",{get:function(){Et(this);return this.$$length}});Object.defineProperty(wt.prototype,"textContent",{get:function(){return rl(this)},set:function(e){switch(this.nodeType){case Po:case jo:while(this.firstChild){this.removeChild(this.firstChild)}if(e||e+""){this.appendChild(this.ownerDocument.createTextNode(e))}break;default:this.data=e;this.value=e;this.nodeValue=e;}}});ia=function(e,t,a){e["$$"+t]=a}}}catch(t){}var il={DOMImplementation:Dt,XMLSerializer:Zt},sl=n(function(e,t){function a(e){this.options=e||{locator:{}}}a.prototype.parseFromString=function(e,t){var a=this.options,i=new p,s=a.domBuilder||new r,o=a.errorHandler,l=a.locator,d=a.xmlns||{},u={lt:"<",gt:">",amp:"&",quot:"\"",apos:"'"};if(l){s.setDocumentLocator(l)}i.errorHandler=n(o,s,l);i.domBuilder=a.domBuilder||s;if(/\/x?html?$/.test(t)){u.nbsp="\xA0";u.copy="\xA9";d[""]="http://www.w3.org/1999/xhtml"}d.xml=d.xml||"http://www.w3.org/XML/1998/namespace";if(e){i.parse(e,d,u)}else{i.errorHandler.error("invalid doc source")}return s.doc};function n(e,t,a){if(!e){if(t instanceof r){return t}e=t}var i={},s=e instanceof Function;a=a||{};function n(t){var n=e[t];if(!n&&s){n=2==e.length?function(a){e(t,a)}:e}i[t]=n&&function(e){n("[xmldom "+t+"]\t"+e+o(a))}||function(){}}n("warning");n("error");n("fatalError");return i}function r(){this.cdata=!1}function s(e,t){t.lineNumber=e.lineNumber;t.columnNumber=e.columnNumber}r.prototype={startDocument:function(){this.doc=new u().createDocument(null,null,null);if(this.locator){this.doc.documentURI=this.locator.systemId}},startElement:function(e,t,a,n){var r=this.doc,o=r.createElementNS(e,a||t),l=n.length;d(this,o);this.currentElement=o;this.locator&&s(this.locator,o);for(var p=0;p<l;p++){var e=n.getURI(p),u=n.getValue(p),a=n.getQName(p),c=r.createAttributeNS(e,a);this.locator&&s(n.getLocator(p),c);c.value=c.nodeValue=u;o.setAttributeNode(c)}},endElement:function(){var e=this.currentElement,t=e.tagName;this.currentElement=e.parentNode},startPrefixMapping:function(){},endPrefixMapping:function(){},processingInstruction:function(e,t){var a=this.doc.createProcessingInstruction(e,t);this.locator&&s(this.locator,a);d(this,a)},ignorableWhitespace:function(){},characters:function(e){e=l.apply(this,arguments);if(e){if(this.cdata){var t=this.doc.createCDATASection(e)}else{var t=this.doc.createTextNode(e)}if(this.currentElement){this.currentElement.appendChild(t)}else if(/^\s*$/.test(e)){this.doc.appendChild(t)}this.locator&&s(this.locator,t)}},skippedEntity:function(){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){if(this.locator=e){e.lineNumber=0}},comment:function(e){e=l.apply(this,arguments);var t=this.doc.createComment(e);this.locator&&s(this.locator,t);d(this,t)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,a){var n=this.doc.implementation;if(n&&n.createDocumentType){var r=n.createDocumentType(e,t,a);this.locator&&s(this.locator,r);d(this,r)}},warning:function(e){console.warn("[xmldom warning]\t"+e,o(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,o(this.locator))},fatalError:function(e){console.error("[xmldom fatalError]\t"+e,o(this.locator));throw e}};function o(e){if(e){return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}}function l(e,t,a){if("string"==typeof e){return e.substr(t,a)}else{if(e.length>=t+a||t){return new java.lang.String(e,t,a)+""}return e}}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){r.prototype[e]=function(){return null}});function d(e,t){if(!e.currentElement){e.doc.appendChild(t)}else{e.currentElement.appendChild(t)}}var p=xo.XMLReader,u=t.DOMImplementation=il.DOMImplementation;t.XMLSerializer=il.XMLSerializer;t.DOMParser=a}),ol=sl.DOMImplementation,ll=sl.XMLSerializer,dl=sl.DOMParser,pl=function(e){return!!e&&"object"===_typeof2(e)},ul=function e(){for(var t=arguments.length,a=Array(t),n=0;n<t;n++){a[n]=arguments[n]}return a.reduce(function(t,a){Object.keys(a).forEach(function(n){if(Array.isArray(t[n])&&Array.isArray(a[n])){t[n]=t[n].concat(a[n])}else if(pl(t[n])&&pl(a[n])){t[n]=e(t[n],a[n])}else{t[n]=a[n]}});return t},{})},cl=function(e){return Object.keys(e).map(function(t){return e[t]})},ml=function(e,t){for(var a=[],n=e;n<t;n++){a.push(n)}return a},gl=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},yl=function(e){if(!e.length){return[]}for(var t=[],a=0;a<e.length;a++){t.push(e[a])}return t},hl=function(e,t){return e.reduce(function(n,a,e){if(a[t]){n.push(e)}return n},[])},_l={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"},fl=function(e){var t=e.baseUrl,a=void 0===t?"":t,n=e.source,r=void 0===n?"":n,i=e.range,s=void 0===i?"":i,o=e.indexRange,l=void 0===o?"":o,d={uri:r,resolvedUri:mo(a||"",r)};if(s||l){var p=s?s:l,u=p.split("-"),c=parseInt(u[0],10),m=parseInt(u[1],10);d.byterange={length:m-c+1,offset:c}}return d},Tl=function(e){var t=e.offset+e.length-1;return e.offset+"-"+t},bl={static:function(e){var t=e.duration,a=e.timescale,n=void 0===a?1:a,r=e.sourceDuration;return{start:0,end:Math.ceil(r/(t/n))}},dynamic:function(e){var t=e.NOW,a=e.clientOffset,n=e.availabilityStartTime,r=e.timescale,i=void 0===r?1:r,s=e.duration,o=e.start,l=void 0===o?0:o,d=e.minimumUpdatePeriod,p=void 0===d?0:d,u=e.timeShiftBufferDepth,c=void 0===u?1/0:u,m=(t+a)/1e3,g=n+l,y=Math.ceil((m+p-g)*i/s),h=Math.floor((m-g-c)*i/s),_=Math.floor((m-g)*i/s);return{start:Math.max(0,h),end:Math.min(y,_)}}},vl=function(e){return function(t,a){var n=e.duration,r=e.timescale,i=void 0===r?1:r,s=e.periodIndex,o=e.startNumber,l=void 0===o?1:o;return{number:l+t,duration:n/i,timeline:s,time:a*n}}},Sl=function(e){var t=e.type,a=void 0===t?"static":t,n=e.duration,r=e.timescale,i=void 0===r?1:r,s=e.sourceDuration,o=bl[a](e),l=o.start,d=o.end,p=ml(l,d).map(vl(e));if("static"===a){var u=p.length-1;p[u].duration=s-n/i*u}return p},kl=function(e){var t=e.baseUrl,a=e.initialization,n=void 0===a?{}:a,r=e.sourceDuration,i=e.timescale,s=void 0===i?1:i,o=e.indexRange,l=void 0===o?"":o,d=e.duration;if(!t){throw new Error(_l.NO_BASE_URL)}var p=fl({baseUrl:t,source:n.sourceURL,range:n.range}),u=fl({baseUrl:t,source:t,indexRange:l});u.map=p;if(d){var c=Sl(e);if(c.length){u.duration=c[0].duration;u.timeline=c[0].timeline}}else if(r){u.duration=r/s;u.timeline=0}u.number=0;return[u]},Cl=function(e,t,a){for(var n=e.sidx.map?e.sidx.map:null,r=e.sidx.duration,s=e.timeline||0,o=e.sidx.byterange,l=o.offset+o.length,d=t.timescale,p=t.references.filter(function(e){return 1!==e.referenceType}),u=[],c=l+t.firstOffset,m=0;m<p.length;m++){var g=t.references[m],y=g.referencedSize,h=g.subsegmentDuration,_=c+y-1,f=c+"-"+_,T=kl({baseUrl:a,timescale:d,timeline:s,periodIndex:s,duration:h,sourceDuration:r,indexRange:f})[0];if(n){T.map=n}u.push(T);c+=y}e.segments=u;return e},El=function(e){var t=cl(e.reduce(function(e,t){var a=t.attributes.id+(t.attributes.lang||"");if(e[a]){var n;if(t.segments[0]){t.segments[0].discontinuity=!0}(n=e[a].segments).push.apply(n,t.segments);if(t.attributes.contentProtection){e[a].attributes.contentProtection=t.attributes.contentProtection}}else{e[a]=t}return e},{}));return t.map(function(e){e.discontinuityStarts=hl(e.segments,"discontinuity");return e})},Il=function(e,t){if(void 0===t){t={}}if(!Object.keys(t).length){return e}for(var a in e){var n=e[a];if(!n.sidx){continue}var r=n.sidx.uri+"-"+Tl(n.sidx.byterange),i=t[r]&&t[r].sidx;if(n.sidx&&i){Cl(n,i,n.sidx.resolvedUri)}}return e},xl=function(e){var t,a=e.attributes,n=e.segments,r=e.sidx,i={attributes:(t={NAME:a.id,BANDWIDTH:a.bandwidth,CODECS:a.codecs},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(a.type||"static"),timeline:a.periodIndex,resolvedUri:"",targetDuration:a.duration,segments:n,mediaSequence:n.length?n[0].number:1};if(a.contentProtection){i.contentProtection=a.contentProtection}if(r){i.sidx=r}return i},Ll=function(e){var t,a=e.attributes,n=e.segments;if("undefined"==typeof n){n=[{uri:a.baseUrl,timeline:a.periodIndex,resolvedUri:a.baseUrl||"",duration:a.sourceDuration,number:0}];a.duration=a.sourceDuration}return{attributes:(t={NAME:a.id,BANDWIDTH:a.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(a.type||"static"),timeline:a.periodIndex,resolvedUri:a.baseUrl||"",targetDuration:a.duration,segments:n,mediaSequence:n.length?n[0].number:1}},Pl=function(e,t){if(void 0===t){t={}}var n,r=e.reduce(function(e,a){var r=a.attributes.role&&a.attributes.role.value||"",i=a.attributes.lang||"",s="main";if(i){var o=r?" ("+r+")":"";s=""+a.attributes.lang+o}if(e[s]&&e[s].playlists[0].attributes.BANDWIDTH>a.attributes.bandwidth){return e}e[s]={language:i,autoselect:!0,default:"main"===r,playlists:Il([xl(a)],t),uri:""};if("undefined"==typeof n&&"main"===r){n=a;n["default"]=!0}return e},{});if(!n){var i=Object.keys(r)[0];r[i]["default"]=!0}return r},Dl=function(e,t){if(void 0===t){t={}}return e.reduce(function(e,a){var n=a.attributes.lang||"text";if(e[n]){return e}e[n]={language:n,default:!1,autoselect:!1,playlists:Il([Ll(a)],t),uri:""};return e},{})},wl=function(e){var t,a=e.attributes,n=e.segments,r=e.sidx,i={attributes:(t={NAME:a.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:a.width,height:a.height},CODECS:a.codecs,BANDWIDTH:a.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(a.type||"static"),timeline:a.periodIndex,resolvedUri:"",targetDuration:a.duration,segments:n,mediaSequence:n.length?n[0].number:1};if(a.contentProtection){i.contentProtection=a.contentProtection}if(r){i.sidx=r}return i},Al=function(e,t){var a;if(void 0===t){t={}}if(!e.length){return{}}var n=e[0].attributes,r=n.sourceDuration,i=n.type,s=void 0===i?"static":i,o=n.suggestedPresentationDelay,l=n.minimumUpdatePeriod,d=void 0===l?0:l,p=El(e.filter(function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType})).map(wl),u=El(e.filter(function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio"===t.contentType})),c=e.filter(function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType}),m={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(a={AUDIO:{},VIDEO:{}},a["CLOSED-CAPTIONS"]={},a.SUBTITLES={},a),uri:"",duration:r,playlists:Il(p,t),minimumUpdatePeriod:1e3*d};if("dynamic"===s){m.suggestedPresentationDelay=o}if(u.length){m.mediaGroups.AUDIO.audio=Pl(u,t)}if(c.length){m.mediaGroups.SUBTITLES.subs=Dl(c,t)}return m},Ol=function(e,t,a){var n=e.NOW,r=e.clientOffset,i=e.availabilityStartTime,s=e.timescale,o=void 0===s?1:s,l=e.start,d=void 0===l?0:l,p=e.minimumUpdatePeriod,u=void 0===p?0:p;return Math.ceil((((n+r)/1e3+u-(i+d))*o-t)/a)},Rl=function(e,t){for(var a=e.type,n=void 0===a?"static":a,r=e.minimumUpdatePeriod,i=void 0===r?0:r,s=e.media,o=void 0===s?"":s,l=e.sourceDuration,d=e.timescale,p=void 0===d?1:d,u=e.startNumber,c=void 0===u?1:u,m=e.periodIndex,g=[],y=-1,h=0;h<t.length;h++){var _=t[h],f=_.d,T=_.r||0,b=_.t||0;if(0>y){y=b}if(b&&b>y){y=b}var v=void 0;if(0>T){var S=h+1;if(S===t.length){if("dynamic"===n&&0<i&&0<o.indexOf("$Number$")){v=Ol(e,y,f)}else{v=(l*p-y)/f}}else{v=(t[S].t-y)/f}}else{v=T+1}var k=c+g.length+v,C=c+g.length;while(C<k){g.push({number:C,duration:f/p,time:y,timeline:m});y+=f;C++}}return g},Nl=function(e){return function(t,a,n,r){if("$$"===t){return"$"}if("undefined"==typeof e[a]){return t}var i=""+e[a];if("RepresentationID"===a){return i}if(!n){r=1}else{r=parseInt(r,10)}if(i.length>=r){return i}return""+Array(r-i.length+1).join("0")+i}},Ul=function(e,t){return e.replace(/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,Nl(t))},Ml=function(e,t){if(!e.duration&&!t){return[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}if(e.duration){return Sl(e)}return Rl(e,t)},Bl=function(e,t){var a={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,i=fl({baseUrl:e.baseUrl,source:Ul(r.sourceURL,a),range:r.range}),s=Ml(e,t);return s.map(function(t){a.Number=t.number;a.Time=t.time;var n=Ul(e.media||"",a);return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:mo(e.baseUrl||"",n),map:i,number:t.number}})},jl=function(e,t){var a=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,i=fl({baseUrl:a,source:r.sourceURL,range:r.range}),s=fl({baseUrl:a,source:t.media,range:t.mediaRange});s.map=i;return s},Fl=function(e,t){var a=e.duration,n=e.segmentUrls,r=void 0===n?[]:n;if(!a&&!t||a&&t){throw new Error(_l.SEGMENT_TIME_UNSPECIFIED)}var i=r.map(function(t){return jl(e,t)}),s;if(a){s=Sl(e)}if(t){s=Rl(e,t)}var o=s.map(function(e,t){if(i[t]){var a=i[t];a.timeline=e.timeline;a.duration=e.duration;a.number=e.number;return a}}).filter(function(e){return e});return o},Hl=function(e){var t=e.attributes,a=e.segmentInfo,n,r;if(a.template){r=Bl;n=ul(t,a.template)}else if(a.base){r=kl;n=ul(t,a.base)}else if(a.list){r=Fl;n=ul(t,a.list)}var i={attributes:t};if(!r){return i}var s=r(n,a.timeline);if(n.duration){var o=n,l=o.duration,d=o.timescale,p=void 0===d?1:d;n.duration=l/p}else if(s.length){n.duration=s.reduce(function(e,t){return Math.max(e,Math.ceil(t.duration))},0)}else{n.duration=0}i.attributes=n;i.segments=s;if(a.base&&n.indexRange){i.sidx=s[0];i.segments=[]}return i},ql=function(e){return e.map(Hl)},Vl=function(e,t){return yl(e.childNodes).filter(function(e){var a=e.tagName;return a===t})},Wl=function(e){return e.textContent.trim()},zl=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t){return 0}var a=t.slice(1),n=a[0],r=a[1],i=a[2],s=a[3],o=a[4],l=a[5];return parseFloat(n||0)*31536000+parseFloat(r||0)*2592000+parseFloat(i||0)*86400+parseFloat(s||0)*3600+parseFloat(o||0)*60+parseFloat(l||0)},Gl=function(e){if(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)){e+="Z"}return Date.parse(e)},Kl={mediaPresentationDuration:function(e){return zl(e)},availabilityStartTime:function(e){return Gl(e)/1e3},minimumUpdatePeriod:function(e){return zl(e)},suggestedPresentationDelay:function(e){return zl(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return zl(e)},start:function(e){return zl(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);if(isNaN(t)){return zl(e)}return 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}},Yl=function(e){if(!(e&&e.attributes)){return{}}return yl(e.attributes).reduce(function(t,a){var e=Kl[a.name]||Kl.DEFAULT;t[a.name]=e(a.value);return t},{})},Xl={"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"},$l=function(e,t){if(!t.length){return e}return gl(e.map(function(e){return t.map(function(t){return mo(e,Wl(t))})}))},Ql=function(e){var t=Vl(e,"SegmentTemplate")[0],a=Vl(e,"SegmentList")[0],n=a&&Vl(a,"SegmentURL").map(function(e){return ul({tag:"SegmentURL"},Yl(e))}),r=Vl(e,"SegmentBase")[0],i=a||t,s=i&&Vl(i,"SegmentTimeline")[0],o=a||r||t,l=o&&Vl(o,"Initialization")[0],d=t&&Yl(t);if(d&&l){d.initialization=l&&Yl(l)}else if(d&&d.initialization){d.initialization={sourceURL:d.initialization}}var p={template:d,timeline:s&&Vl(s,"S").map(function(e){return Yl(e)}),list:a&&ul(Yl(a),{segmentUrls:n,initialization:Yl(l)}),base:r&&ul(Yl(r),{initialization:Yl(l)})};Object.keys(p).forEach(function(e){if(!p[e]){delete p[e]}});return p},Jl=function(e,t,a){return function(n){var r=Vl(n,"BaseURL"),i=$l(t,r),s=ul(e,Yl(n)),o=Ql(n);return i.map(function(e){return{segmentInfo:ul(a,o),attributes:ul(s,{baseUrl:e})}})}},Zl=function(e){return e.reduce(function(e,t){var a=Yl(t),n=Xl[a.schemeIdUri];if(n){e[n]={attributes:a};var r=Vl(t,"cenc:pssh")[0];if(r){var i=Wl(r),s=i&&st(i);e[n].pssh=s}}return e},{})},ed=function(e,t,a){return function(n){var r=Yl(n),i=$l(t,Vl(n,"BaseURL")),s=Vl(n,"Role")[0],o={role:Yl(s)},l=ul(e,r,o),d=Zl(Vl(n,"ContentProtection"));if(Object.keys(d).length){l=ul(l,{contentProtection:d})}var p=Ql(n),u=Vl(n,"Representation"),c=ul(a,p);return gl(u.map(Jl(l,i,c)))}},td=function(t,a){return function(n,r){var i=$l(a,Vl(n,"BaseURL")),s=Yl(n),o=parseInt(s.id,10),l=e.isNaN(o)?r:o,d=ul(t,{periodIndex:l}),p=Vl(n,"AdaptationSet"),u=Ql(n);return gl(p.map(ed(d,i,u)))}},ad=function(e,t){if(void 0===t){t={}}var a=t,n=a.manifestUri,r=void 0===n?"":n,i=a.NOW,s=void 0===i?Date.now():i,o=a.clientOffset,l=void 0===o?0:o,d=Vl(e,"Period");if(!d.length){throw new Error(_l.INVALID_NUMBER_OF_PERIOD)}var p=Yl(e),u=$l([r],Vl(e,"BaseURL"));p.sourceDuration=p.mediaPresentationDuration||0;p.NOW=s;p.clientOffset=l;return gl(d.map(td(p,u)))},nd=function(e){if(""===e){throw new Error(_l.DASH_EMPTY_MANIFEST)}var t=new dl,a=t.parseFromString(e,"application/xml"),n=a&&"MPD"===a.documentElement.tagName?a.documentElement:null;if(!n||n&&0<n.getElementsByTagName("parsererror").length){throw new Error(_l.DASH_INVALID_XML)}return n},rd=function(e){var t=Vl(e,"UTCTiming")[0];if(!t){return null}var a=Yl(t);switch(a.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":a.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":a.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":a.method="DIRECT";a.value=Date.parse(a.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(_l.UNSUPPORTED_UTC_TIMING_SCHEME);}return a},id=function(e,t){if(void 0===t){t={}}return Al(ql(ad(nd(e),t)),t.sidxMapping)},sd=function(e){return rd(nd(e))},od={toUnsigned:function(e){return e>>>0},toHexString:function(e){return("00"+e.toString(16)).slice(-2)}},ld,dd,pd=od.toUnsigned,ud=function(e){return new Date(1e3*e-20828448e5)},cd=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},md=function(e){var t="";t+=String.fromCharCode(e[0]);t+=String.fromCharCode(e[1]);t+=String.fromCharCode(e[2]);t+=String.fromCharCode(e[3]);return t},gd=function e(t,a){var n=[],r,s,o,l,d;if(!a.length){return null}for(r=0;r<t.byteLength;){s=pd(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3]);o=md(t.subarray(r+4,r+8));l=1<s?r+s:t.byteLength;if(o===a[0]){if(1===a.length){n.push(t.subarray(r+8,l))}else{d=e(t.subarray(r+8,l),a.slice(1));if(d.length){n=n.concat(d)}}}r=l}return n},yd=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=[],n,r;for(n=0;n+4<e.length;n+=r){r=t.getUint32(n);n+=4;if(0>=r){a.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(31&e[n]){case 1:a.push("slice_layer_without_partitioning_rbsp");break;case 5:a.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:a.push("sei_rbsp");break;case 7:a.push("seq_parameter_set_rbsp");break;case 8:a.push("pic_parameter_set_rbsp");break;case 9:a.push("access_unit_delimiter_rbsp");break;default:a.push(31&"UNKNOWN NAL - "+e[n]);break;}}return a},hd={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:ld(e.subarray(78,e.byteLength))}},avcC:function(e){var t=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:[]},n=31&e[5],r,s,o,l;o=6;for(l=0;l<n;l++){s=t.getUint16(o);o+=2;a.sps.push(new Uint8Array(e.subarray(o,o+s)));o+=s}r=e[o];o++;for(l=0;l<r;l++){s=t.getUint16(o);o+=2;a.pps.push(new Uint8Array(e.subarray(o,o+s)));o+=s}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:63&e[12]>>>2,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:31&e[26]>>>3,samplingFrequencyIndex:(7&e[26])<<1|1&e[27]>>>7,channelConfiguration:15&e[27]>>>3}}}},ftyp:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={majorBrand:md(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},n=8;while(n<e.byteLength){a.compatibleBrands.push(md(e.subarray(n,n+4)));n+=4}return a},dinf:function(e){return{boxes:ld(e)}},dref:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),dataReferences:ld(e.subarray(8))}},hdlr:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),handlerType:md(e.subarray(8,12)),name:""},n=8;for(n=24;n<e.byteLength;n++){if(0===e[n]){n++;break}a.name+=String.fromCharCode(e[n])}a.name=decodeURIComponent(escape(a.name));return a},mdat:function(e){return{byteLength:e.byteLength,nals:yd(e)}},mdhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=4,n,r={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};if(1===r.version){a+=4;r.creationTime=ud(t.getUint32(a));a+=8;r.modificationTime=ud(t.getUint32(a));a+=4;r.timescale=t.getUint32(a);a+=8;r.duration=t.getUint32(a)}else{r.creationTime=ud(t.getUint32(a));a+=4;r.modificationTime=ud(t.getUint32(a));a+=4;r.timescale=t.getUint32(a);a+=4;r.duration=t.getUint32(a)}a+=4;n=t.getUint16(a);r.language+=String.fromCharCode((n>>10)+96);r.language+=String.fromCharCode(((992&n)>>5)+96);r.language+=String.fromCharCode((31&n)+96);return r},mdia:function(e){return{boxes:ld(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:ld(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};if(28<e.byteLength){a.streamDescriptor=ld(e.subarray(28))[0]}return a},moof:function(e){return{boxes:ld(e)}},moov:function(e){return{boxes:ld(e)}},mvex:function(e){return{boxes:ld(e)}},mvhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=4,n={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};if(1===n.version){a+=4;n.creationTime=ud(t.getUint32(a));a+=8;n.modificationTime=ud(t.getUint32(a));a+=4;n.timescale=t.getUint32(a);a+=8;n.duration=t.getUint32(a)}else{n.creationTime=ud(t.getUint32(a));a+=4;n.modificationTime=ud(t.getUint32(a));a+=4;n.timescale=t.getUint32(a);a+=4;n.duration=t.getUint32(a)}a+=4;n.rate=t.getUint16(a)+t.getUint16(a+2)/16;a+=4;n.volume=t.getUint8(a)+t.getUint8(a+1)/8;a+=2;a+=2;a+=8;n.matrix=new Uint32Array(e.subarray(a,a+36));a+=36;a+=24;n.nextTrackId=t.getUint32(a);return 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={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},a;for(a=4;a<e.byteLength;a++){t.samples.push({dependsOn:(48&e[a])>>4,isDependedOn:(12&e[a])>>2,hasRedundancy:3&e[a]})}return t},sidx:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8),earliestPresentationTime:t.getUint32(12),firstOffset:t.getUint32(16)},n=t.getUint16(22),r;for(r=24;n;r+=12,n--){a.references.push({referenceType:(128&e[r])>>>7,referencedSize:2147483647&t.getUint32(r),subsegmentDuration:t.getUint32(r+4),startsWithSap:!!(128&e[r+8]),sapType:(112&e[r+8])>>>4,sapDeltaTime:268435455&t.getUint32(r+8)})}return a},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:ld(e)}},stco:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},n=t.getUint32(4),r;for(r=8;n;r+=4,n--){a.chunkOffsets.push(t.getUint32(r))}return a},stsc:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=t.getUint32(4),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]},r;for(r=8;a;r+=12,a--){n.sampleToChunks.push({firstChunk:t.getUint32(r),samplesPerChunk:t.getUint32(r+4),sampleDescriptionIndex:t.getUint32(r+8)})}return n},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:ld(e.subarray(8))}},stsz:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:t.getUint32(4),entries:[]},n;for(n=12;n<e.byteLength;n+=4){a.entries.push(t.getUint32(n))}return a},stts:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},n=t.getUint32(4),r;for(r=8;n;r+=8,n--){a.timeToSamples.push({sampleCount:t.getUint32(r),sampleDelta:t.getUint32(r+4)})}return a},styp:function(e){return hd.ftyp(e)},tfdt:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:pd(e[4]<<24|e[5]<<16|e[6]<<8|e[7])};if(1===t.version){t.baseMediaDecodeTime*=Math.pow(2,32);t.baseMediaDecodeTime+=pd(e[8]<<24|e[9]<<16|e[10]<<8|e[11])}return t},tfhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4)},n=1&a.flags[2],r=2&a.flags[2],s=8&a.flags[2],o=16&a.flags[2],l=32&a.flags[2],d=65536&a.flags[0],p=131072&a.flags[0],u;u=8;if(n){u+=4;a.baseDataOffset=t.getUint32(12);u+=4}if(r){a.sampleDescriptionIndex=t.getUint32(u);u+=4}if(s){a.defaultSampleDuration=t.getUint32(u);u+=4}if(o){a.defaultSampleSize=t.getUint32(u);u+=4}if(l){a.defaultSampleFlags=t.getUint32(u)}if(d){a.durationIsEmpty=!0}if(!n&&p){a.baseDataOffsetIsMoof=!0}return a},tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=4,n={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};if(1===n.version){a+=4;n.creationTime=ud(t.getUint32(a));a+=8;n.modificationTime=ud(t.getUint32(a));a+=4;n.trackId=t.getUint32(a);a+=4;a+=8;n.duration=t.getUint32(a)}else{n.creationTime=ud(t.getUint32(a));a+=4;n.modificationTime=ud(t.getUint32(a));a+=4;n.trackId=t.getUint32(a);a+=4;a+=4;n.duration=t.getUint32(a)}a+=4;a+=8;n.layer=t.getUint16(a);a+=2;n.alternateGroup=t.getUint16(a);a+=2;n.volume=t.getUint8(a)+t.getUint8(a+1)/8;a+=2;a+=2;n.matrix=new Uint32Array(e.subarray(a,a+36));a+=36;n.width=t.getUint16(a)+t.getUint16(a+2)/16;a+=4;n.height=t.getUint16(a)+t.getUint16(a+2)/16;return n},traf:function(e){return{boxes:ld(e)}},trak:function(e){return{boxes:ld(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={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},a=new DataView(e.buffer,e.byteOffset,e.byteLength),n=1&t.flags[2],r=4&t.flags[2],i=1&t.flags[1],s=2&t.flags[1],o=4&t.flags[1],l=8&t.flags[1],d=a.getUint32(4),p=8,u;if(n){t.dataOffset=a.getInt32(p);p+=4}if(r&&d){u={flags:cd(e.subarray(p,p+4))};p+=4;if(i){u.duration=a.getUint32(p);p+=4}if(s){u.size=a.getUint32(p);p+=4}if(l){u.compositionTimeOffset=a.getUint32(p);p+=4}t.samples.push(u);d--}while(d--){u={};if(i){u.duration=a.getUint32(p);p+=4}if(s){u.size=a.getUint32(p);p+=4}if(o){u.flags=cd(e.subarray(p,p+4));p+=4}if(l){u.compositionTimeOffset=a.getUint32(p);p+=4}t.samples.push(u)}return t},"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)])}}};ld=function(e){for(var t=0,a=[],n,r,s,o,l,d=new ArrayBuffer(e.length),p=new Uint8Array(d),u=0;u<e.length;++u){p[u]=e[u]}n=new DataView(d);while(t<e.byteLength){r=n.getUint32(t);s=md(e.subarray(t+4,t+8));o=1<r?t+r:e.byteLength;l=(hd[s]||function(e){return{data:e}})(e.subarray(t+8,o));l.size=r;l.type=s;a.push(l);t=o}return a};dd=function(e,t){var a;t=t||0;a=Array(2*t+1).join(" ");return e.map(function(e){return a+e.type+"\n"+Object.keys(e).filter(function(e){return"type"!==e&&"boxes"!==e}).map(function(t){var n=a+"  "+t+": ",r=e[t];if(r instanceof Uint8Array||r instanceof Uint32Array){var i=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);if(!i){return n+"<>"}if(1===i.length){return n+"<"+i.join("").slice(1)+">"}return n+"<\n"+i.map(function(e){return a+"  "+e}).join("\n")+"\n"+a+"  >"}return n+JSON.stringify(r,null,2).split("\n").map(function(e,t){if(0===t){return e}return a+"  "+e}).join("\n")}).join("\n")+(e.boxes?"\n"+dd(e.boxes,t+1):"")}).join("\n")};var _d={inspect:ld,textify:dd,parseType:md,findBox:gd,parseTraf:hd.traf,parseTfdt:hd.tfdt,parseHdlr:hd.hdlr,parseTfhd:hd.tfhd,parseTrun:hd.trun,parseSidx:hd.sidx},fd=od.toUnsigned,Td=od.toHexString,bd,vd,Sd,kd,Cd;bd=function(e){var t=_d.findBox(e,["moov","trak"]);return t.reduce(function(e,t){var a,n,r,i,s;a=_d.findBox(t,["tkhd"])[0];if(!a){return null}n=a[0];r=0===n?12:20;i=fd(a[r]<<24|a[r+1]<<16|a[r+2]<<8|a[r+3]);s=_d.findBox(t,["mdia","mdhd"])[0];if(!s){return null}n=s[0];r=0===n?12:20;e[i]=fd(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3]);return e},{})};vd=function(e,t){var a,n,r;a=_d.findBox(t,["moof","traf"]);n=[].concat.apply([],a.map(function(t){return _d.findBox(t,["tfhd"]).map(function(a){var n,r,i;n=fd(a[4]<<24|a[5]<<16|a[6]<<8|a[7]);r=e[n]||9e4;i=_d.findBox(t,["tfdt"]).map(function(e){var t,a;t=e[0];a=fd(e[4]<<24|e[5]<<16|e[6]<<8|e[7]);if(1===t){a*=Math.pow(2,32);a+=fd(e[8]<<24|e[9]<<16|e[10]<<8|e[11])}return a})[0];i=i||1/0;return i/r})}));r=Math.min.apply(null,n);return isFinite(r)?r:0};Sd=function(e,t){var a=_d.findBox(t,["moof","traf"]),n=0,r=0,s;if(a&&a.length){for(var o=_d.parseTraf(a[0]),l=0;l<o.boxes.length;l++){if("tfhd"===o.boxes[l].type){s=o.boxes[l].trackId}else if("tfdt"===o.boxes[l].type){n=o.boxes[l].baseMediaDecodeTime}else if("trun"===o.boxes[l].type&&o.boxes[l].samples.length){r=o.boxes[l].samples[0].compositionTimeOffset||0}}}var d=e[s]||9e4;return(n+r)/d};kd=function(e){var t=_d.findBox(e,["moov","trak"]),a=[];t.forEach(function(e){var t=_d.findBox(e,["mdia","hdlr"]),n=_d.findBox(e,["tkhd"]);t.forEach(function(e,t){var r=_d.parseType(e.subarray(8,12)),i=n[t],s,o;if("vide"===r){s=new DataView(i.buffer,i.byteOffset,i.byteLength);s.getUint8(0);o=s.getUint32(20);a.push(o)}})});return a};Cd=function(e){var t=_d.findBox(e,["moov","trak"]),a=[];t.forEach(function(e){var t={},n=_d.findBox(e,["tkhd"])[0],r;if(n){r=new DataView(n.buffer,n.byteOffset,n.byteLength);r.getUint8(0);t.id=r.getUint32(20)}var i=_d.findBox(e,["mdia","hdlr"])[0];if(i){var s=_d.parseType(i.subarray(8,12));if("vide"===s){t.type="video"}else if("soun"===s){t.type="audio"}else{t.type=s}}var o=_d.findBox(e,["mdia","minf","stbl","stsd"])[0];if(o){var l=o.subarray(8);t.codec=_d.parseType(l.subarray(4,8));var d=_d.findBox(l,[t.codec])[0],p,u;if(d){if(/^[a-z]vc[1-9]$/i.test(t.codec)){p=d.subarray(78);u=_d.parseType(p.subarray(4,8));if("avcC"===u&&11<p.length){t.codec+=".";t.codec+=Td(p[9]);t.codec+=Td(p[10]);t.codec+=Td(p[11])}else{t.codec="avc1.4d400d"}}else if(/^mp4[a,v]$/i.test(t.codec)){p=d.subarray(28);u=_d.parseType(p.subarray(4,8));if("esds"===u&&20<p.length&&0!==p[19]){t.codec+="."+Td(p[19]);t.codec+="."+Td(63&p[20]>>>2).replace(/^0/,"")}else{t.codec="mp4a.40.2"}}}}var c=_d.findBox(e,["mdia","mdhd"])[0];if(c&&n){20;t.timescale=fd(c[20]<<24|c[21]<<16|c[22]<<8|c[23])}a.push(t)});return a};var Ed={findBox:_d.findBox,parseType:_d.parseType,timescale:bd,startTime:vd,compositionStartTime:Sd,videoTrackIds:kd,tracks:Cd},Id=4,xd=function(e){var t=0,a={payloadType:-1,payloadSize:0},n=0,r=0;while(t<e.byteLength){if(e[t]===128){break}while(255===e[t]){n+=255;t++}n+=e[t++];while(255===e[t]){r+=255;t++}r+=e[t++];if(!a.payload&&n===Id){a.payloadType=n;a.payloadSize=r;a.payload=e.subarray(t,t+r);break}t+=r;n=0;r=0}return a},Ld=function(e,t){var a=[],n,r,s,o;if(!(64&t[0])){return a}r=31&t[0];for(n=0;n<r;n++){s=3*n;o={type:3&t[s+2],pts:e};if(4&t[s+2]){o.ccData=t[s+3]<<8|t[s+4];a.push(o)}}return a},Pd=function(e){var t=e.byteLength,a=[],n=1,r,s;while(n<t-2){if(0===e[n]&&0===e[n+1]&&3===e[n+2]){a.push(n+2);n+=2}else{n++}}if(0===a.length){return e}r=t-a.length;s=new Uint8Array(r);var o=0;for(n=0;n<r;o++,n++){if(o===a[0]){o++;a.shift()}s[n]=e[o]}return s},Dd={parseSei:xd,parseUserData:function(e){if(181!==e.payload[0]){return null}if(49!=(e.payload[1]<<8|e.payload[2])){return null}if("GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])){return null}if(3!==e.payload[7]){return null}return e.payload.subarray(8,e.payload.length-1)},parseCaptionPackets:Ld,discardEmulationPreventionBytes:Pd,USER_DATA_REGISTERED_ITU_T_T35:Id},wd=function(){this.init=function(){var e={};this.on=function(t,a){if(!e[t]){e[t]=[]}e[t]=e[t].concat(a)};this.off=function(t,a){var n;if(!e[t]){return!1}n=e[t].indexOf(a);e[t]=e[t].slice();e[t].splice(n,1);return-1<n};this.trigger=function(t){var a,n,r,s;a=e[t];if(!a){return}if(2===arguments.length){r=a.length;for(n=0;n<r;++n){a[n].call(this,arguments[1])}}else{s=[];n=arguments.length;for(n=1;n<arguments.length;++n){s.push(arguments[n])}r=a.length;for(n=0;n<r;++n){a[n].apply(this,s)}}};this.dispose=function(){e={}}}};wd.prototype.pipe=function(e){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)});return e};wd.prototype.push=function(e){this.trigger("data",e)};wd.prototype.flush=function(e){this.trigger("done",e)};wd.prototype.partialFlush=function(e){this.trigger("partialdone",e)};wd.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)};wd.prototype.reset=function(e){this.trigger("reset",e)};var Ad=wd,Od=function e(){e.prototype.init.call(this);this.captionPackets_=[];this.ccStreams_=[new jd(0,0),new jd(0,1),new jd(1,0),new jd(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)};Od.prototype=new Ad;Od.prototype.push=function(e){var t,a,n;if("sei_rbsp"!==e.nalUnitType){return}t=Dd.parseSei(e.escapedRBSP);if(t.payloadType!==Dd.USER_DATA_REGISTERED_ITU_T_T35){return}a=Dd.parseUserData(t);if(!a){return}if(e.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--;if(!this.numSameDts_){this.ignoreNextEqualDts_=!1}return}n=Dd.parseCaptionPackets(e.pts,a);this.captionPackets_=this.captionPackets_.concat(n);if(this.latestDts_!==e.dts){this.numSameDts_=0}this.numSameDts_++;this.latestDts_=e.dts};Od.prototype.flushCCStreams=function(e){this.ccStreams_.forEach(function(t){return"flush"===e?t.flush():t.partialFlush()},this)};Od.prototype.flushStream=function(e){if(!this.captionPackets_.length){this.flushCCStreams(e);return}this.captionPackets_.forEach(function(e,t){e.presortIndex=t});this.captionPackets_.sort(function(e,t){if(e.pts===t.pts){return e.presortIndex-t.presortIndex}return e.pts-t.pts});this.captionPackets_.forEach(function(e){if(2>e.type){this.dispatchCea608Packet(e)}},this);this.captionPackets_.length=0;this.flushCCStreams(e)};Od.prototype.flush=function(){return this.flushStream("flush")};Od.prototype.partialFlush=function(){return this.flushStream("partialFlush")};Od.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=!1;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(e){e.reset()})};Od.prototype.dispatchCea608Packet=function(e){if(this.setsTextOrXDSActive(e)){this.activeCea608Channel_[e.type]=null}else if(this.setsChannel1Active(e)){this.activeCea608Channel_[e.type]=0}else if(this.setsChannel2Active(e)){this.activeCea608Channel_[e.type]=1}if(null===this.activeCea608Channel_[e.type]){return}this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)};Od.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)};Od.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)};Od.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var Rd={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},Nd=function(e){if(null===e){return""}e=Rd[e]||e;return String.fromCharCode(e)},Ud=14,Md=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Bd=function(){var e=[],t=Ud+1;while(t--){e.push("")}return e},jd=function e(t,a){e.prototype.init.call(this);this.field_=t||0;this.dataChannel_=a||0;this.name_="CC"+((this.field_<<1|this.dataChannel_)+1);this.setConstants();this.reset();this.push=function(e){var t,a,n,r,i;t=32639&e.ccData;if(t===this.lastControlCode_){this.lastControlCode_=null;return}if(4096==(61440&t)){this.lastControlCode_=t}else if(t!==this.PADDING_){this.lastControlCode_=null}n=t>>>8;r=255&t;if(t===this.PADDING_){}else 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);a=this.displayed_;this.displayed_=this.nonDisplayed_;this.nonDisplayed_=a;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_){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}}else if(t===this.ERASE_DISPLAYED_MEMORY_){this.flushDisplayed(e.pts);this.displayed_=Bd()}else if(t===this.ERASE_NON_DISPLAYED_MEMORY_){this.nonDisplayed_=Bd()}else if(t===this.RESUME_DIRECT_CAPTIONING_){if("paintOn"!==this.mode_){this.flushDisplayed(e.pts);this.displayed_=Bd()}this.mode_="paintOn";this.startPts_=e.pts}else if(this.isSpecialCharacter(n,r)){n=(3&n)<<8;i=Nd(n|r);this[this.mode_](e.pts,i);this.column_++}else if(this.isExtCharacter(n,r)){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}n=(3&n)<<8;i=Nd(n|r);this[this.mode_](e.pts,i);this.column_++}else if(this.isMidRowCode(n,r)){this.clearFormatting(e.pts);this[this.mode_](e.pts," ");this.column_++;if(14==(14&r)){this.addFormatting(e.pts,["i"])}if(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 s=Md.indexOf(7968&t);if("rollUp"===this.mode_){if(0>s-this.rollUpRows_+1){s=this.rollUpRows_-1}this.setRollUp(e.pts,s)}if(s!==this.row_){this.clearFormatting(e.pts);this.row_=s}if(1&r&&-1===this.formatting_.indexOf("u")){this.addFormatting(e.pts,["u"])}if(16==(16&t)){this.column_=4*((14&t)>>1)}if(this.isColorPAC(r)){if(14==(14&r)){this.addFormatting(e.pts,["i"])}}}else if(this.isNormalChar(n)){if(0===r){r=null}i=Nd(n);i+=Nd(r);this[this.mode_](e.pts,i);this.column_+=i.length}}};jd.prototype=new Ad;jd.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e){try{return e.trim()}catch(t){console.error("Skipping malformed caption.");return""}}).join("\n").replace(/^\n+|\n+$/g,"");if(t.length){this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})}};jd.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=Bd();this.nonDisplayed_=Bd();this.lastControlCode_=null;this.column_=0;this.row_=Ud;this.rollUpRows_=2;this.formatting_=[]};jd.prototype.setConstants=function(){if(0===this.dataChannel_){this.BASE_=16;this.EXT_=17;this.CONTROL_=(20|this.field_)<<8;this.OFFSET_=23}else if(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_};jd.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&63>=t};jd.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&63>=t};jd.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&47>=t};jd.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&35>=t};jd.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&64<=t&&127>=t};jd.prototype.isColorPAC=function(e){return 64<=e&&79>=e||96<=e&&127>=e};jd.prototype.isNormalChar=function(e){return 32<=e&&127>=e};jd.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_){this.row_=Ud;this.mode_="rollUp";this.flushDisplayed(e);this.nonDisplayed_=Bd();this.displayed_=Bd()}if(t!==void 0&&t!==this.row_){for(var a=0;a<this.rollUpRows_;a++){this.displayed_[t-a]=this.displayed_[this.row_-a];this.displayed_[this.row_-a]=""}}if(t===void 0){t=this.row_}this.topRow_=t-this.rollUpRows_+1};jd.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var a=t.reduce(function(e,t){return e+"<"+t+">"},"");this[this.mode_](e,a)};jd.prototype.clearFormatting=function(e){if(!this.formatting_.length){return}var t=this.formatting_.reverse().reduce(function(e,t){return e+"</"+t+">"},"");this.formatting_=[];this[this.mode_](e,t)};jd.prototype.popOn=function(e,t){var a=this.nonDisplayed_[this.row_];a+=t;this.nonDisplayed_[this.row_]=a};jd.prototype.rollUp=function(e,t){var a=this.displayed_[this.row_];a+=t;this.displayed_[this.row_]=a};jd.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++){this.displayed_[e]=""}for(e=this.row_+1;e<Ud+1;e++){this.displayed_[e]=""}for(e=this.topRow_;e<this.row_;e++){this.displayed_[e]=this.displayed_[e+1]}this.displayed_[this.row_]=""};jd.prototype.paintOn=function(e,t){var a=this.displayed_[this.row_];a+=t;this.displayed_[this.row_]=a};var Fd=Dd.discardEmulationPreventionBytes,Hd={CaptionStream:Od,Cea608Stream:jd}.CaptionStream,qd=function(e,t){for(var a=e,n=0,r;n<t.length;n++){r=t[n];if(a<r.size){return r}a-=r.size}return null},Vd=function(e,t,a){var n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[],s,o,l,d;for(o=0;o+4<e.length;o+=l){l=n.getUint32(o);o+=4;if(0>=l){continue}switch(31&e[o]){case 6:var p=e.subarray(o+1,o+1+l),u=qd(o,t);s={nalUnitType:"sei_rbsp",size:l,data:p,escapedRBSP:Fd(p),trackId:a};if(u){s.pts=u.pts;s.dts=u.dts;d=u}else{s.pts=d.pts;s.dts=d.dts}r.push(s);break;default:break;}}return r},Wd=function(e,t,a){var n=t,r=a.defaultSampleDuration||0,i=a.defaultSampleSize||0,s=a.trackId,o=[];e.forEach(function(e){var t=_d.parseTrun(e),a=t.samples;a.forEach(function(e){if(e.duration===void 0){e.duration=r}if(e.size===void 0){e.size=i}e.trackId=s;e.dts=n;if(e.compositionTimeOffset===void 0){e.compositionTimeOffset=0}e.pts=n+e.compositionTimeOffset;n+=e.duration});o=o.concat(a)});return o},zd=function(e,t){var a=Ed.findBox(e,["moof","traf"]),n=Ed.findBox(e,["mdat"]),r={},i=[];n.forEach(function(e,t){var n=a[t];i.push({mdat:e,traf:n})});i.forEach(function(e){var a=e.mdat,n=e.traf,i=Ed.findBox(n,["tfhd"]),s=_d.parseTfhd(i[0]),o=s.trackId,l=Ed.findBox(n,["tfdt"]),d=0<l.length?_d.parseTfdt(l[0]).baseMediaDecodeTime:0,p=Ed.findBox(n,["trun"]),u,c;if(t===o&&0<p.length){u=Wd(p,d,s);c=Vd(a,u,o);if(!r[o]){r[o]=[]}r[o]=r[o].concat(c)}});return r},Gd=function(e,t,a){var n;if(null===t){return null}n=zd(e,t);return{seiNals:n[t],timescale:a}},Kd=function(){var e=!1,t,a,n,r,i,s;this.isInitialized=function(){return e};this.init=function(a){t=new Hd;e=!0;s=a?a.isPartial:!1;t.on("data",function(e){e.startTime=e.startPts/r;e.endTime=e.endPts/r;i.captions.push(e);i.captionStreams[e.stream]=!0})};this.isNewInit=function(e,t){if(e&&0===e.length||t&&"object"===_typeof2(t)&&0===Object.keys(t).length){return!1}return n!==e[0]||r!==t[n]};this.parse=function(e,t,s){var o;if(!this.isInitialized()){return null}else if(!t||!s){return null}else if(this.isNewInit(t,s)){n=t[0];r=s[n]}else if(null===n||!r){a.push(e);return null}while(0<a.length){var l=a.shift();this.parse(l,t,s)}o=Gd(e,n,r);if(null===o||!o.seiNals){return null}this.pushNals(o.seiNals);this.flushStream();return i};this.pushNals=function(e){if(!this.isInitialized()||!e||0===e.length){return null}e.forEach(function(e){t.push(e)})};this.flushStream=function(){if(!this.isInitialized()){return null}if(!s){t.flush()}else{t.partialFlush()}};this.clearParsedCaptions=function(){i.captions=[];i.captionStreams={}};this.resetCaptionStream=function(){if(!this.isInitialized()){return null}t.reset()};this.clearAllCaptions=function(){this.clearParsedCaptions();this.resetCaptionStream()};this.reset=function(){a=[];n=null;r=null;if(!i){i={captions:[],captionStreams:{}}}else{this.clearParsedCaptions()}this.resetCaptionStream()};this.reset()},Yd={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Xd="shared",$d=function(e,t){var a=1;if(e>t){a=-1}while(Math.abs(t-e)>4294967296){e+=a*8589934592}return e},Qd=function e(t){var a,n;e.prototype.init.call(this);this.type_=t||Xd;this.push=function(e){if(this.type_!==Xd&&e.type!==this.type_){return}if(n===void 0){n=e.dts}e.dts=$d(e.dts,n);e.pts=$d(e.pts,n);a=e.dts;this.trigger("data",e)};this.flush=function(){n=a;this.trigger("done")};this.endTimeline=function(){this.flush();this.trigger("endedtimeline")};this.discontinuity=function(){n=void 0;a=void 0};this.reset=function(){this.discontinuity();this.trigger("reset")}};Qd.prototype=new Ad;var Jd=function(e){var t=31&e[1];t<<=8;t|=e[2];return t},Zd=function(e){return!!(64&e[1])},ep=function(e){var t=0;if(1<(48&e[3])>>>4){t+=e[4]+1}return t},tp=function(e){var t={},a=Zd(e),n=4+ep(e);if(a){n+=e[n]+1}if(!(1&e[n+5])){return}var r,s,o;r=(15&e[n+1])<<8|e[n+2];s=3+r-4;o=(15&e[n+10])<<8|e[n+11];var l=12+o;while(l<s){var d=n+l;t[(31&e[d+1])<<8|e[d+2]]=e[d];l+=((15&e[d+3])<<8|e[d+4])+5}return t},ap=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null;}},np=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],rp=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},ip=function(e,t,a){var n,r="";for(n=t;n<a;n++){r+="%"+("00"+e[n].toString(16)).slice(-2)}return r},sp=function(e,t,a){return unescape(ip(e,t,a))},op=function(e){var t=0;while(t+5<e.length){if(255!==e[t]||240!=(246&e[t+1])){t++;continue}return np[(60&e[t+2])>>>2]}return null},lp=function(e){var t,a,n,r;t=10;if(64&e[5]){t+=4;t+=rp(e.subarray(10,14))}do{a=rp(e.subarray(t+4,t+8));if(1>a){return null}r=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);if("PRIV"===r){n=e.subarray(t+10,t+a+10);for(var s=0;s<n.byteLength;s++){if(0===n[s]){var o=sp(n,0,s);if("com.apple.streaming.transportStreamTimestamp"===o){var l=n.subarray(s+1),d=(1&l[3])<<30|l[4]<<22|l[5]<<14|l[6]<<6|l[7]>>>2;d*=4;d+=3&l[7];return d}break}}}t+=10;t+=a}while(t<e.byteLength);return null},dp=9e4,pp,up,cp,mp,gp,yp,hp;pp=function(e){return e*dp};up=function(e,t){return e*t};cp=function(e){return e/dp};mp=function(e,t){return e/t};gp=function(e,t){return pp(mp(e,t))};yp=function(e,t){return up(cp(e),t)};hp=function(e,t,a){return cp(a?e:e-t)};var _p={ONE_SECOND_IN_TS:dp,secondsToVideoTs:pp,secondsToAudioTs:up,videoTsToSeconds:cp,audioTsToSeconds:mp,audioTsToVideoTs:gp,videoTsToAudioTs:yp,metadataTsToSeconds:hp},fp={TimestampRolloverStream:Qd,handleRollover:$d}.handleRollover,Tp={};Tp.ts={parseType:function(e,t){var a=Jd(e);if(0===a){return"pat"}else if(a===t){return"pmt"}else if(t){return"pes"}return null},parsePat:function(e){var t=Zd(e),a=4+ep(e);if(t){a+=e[a]+1}return(31&e[a+10])<<8|e[a+11]},parsePmt:tp,parsePayloadUnitStartIndicator:Zd,parsePesType:function(e,t){var a=Jd(e),n=t[a];switch(n){case Yd.H264_STREAM_TYPE:return"video";case Yd.ADTS_STREAM_TYPE:return"audio";case Yd.METADATA_STREAM_TYPE:return"timed-metadata";default:return null;}},parsePesTime:function(e){var t=Zd(e);if(!t){return null}var a=4+ep(e);if(a>=e.byteLength){return null}var n=null,r;r=e[a+7];if(192&r){n={};n.pts=(14&e[a+9])<<27|(255&e[a+10])<<20|(254&e[a+11])<<12|(255&e[a+12])<<5|(254&e[a+13])>>>3;n.pts*=4;n.pts+=(6&e[a+13])>>>1;n.dts=n.pts;if(64&r){n.dts=(14&e[a+14])<<27|(255&e[a+15])<<20|(254&e[a+16])<<12|(255&e[a+17])<<5|(254&e[a+18])>>>3;n.dts*=4;n.dts+=(6&e[a+18])>>>1}}return n},videoPacketContainsKeyFrame:function(e){var t=4+ep(e),a=e.subarray(t),n=0,r=0,i=!1,s;for(;r<a.byteLength-3;r++){if(1===a[r+2]){n=r+5;break}}while(n<a.byteLength){switch(a[n]){case 0:if(0!==a[n-1]){n+=2;break}else if(0!==a[n-2]){n++;break}if(r+3!==n-2){s=ap(31&a[r+3]);if("slice_layer_without_partitioning_rbsp_idr"===s){i=!0}}do{n++}while(1!==a[n]&&n<a.length);r=n-2;n+=3;break;case 1:if(0!==a[n-1]||0!==a[n-2]){n+=3;break}s=ap(31&a[r+3]);if("slice_layer_without_partitioning_rbsp_idr"===s){i=!0}r=n-2;n+=3;break;default:n+=3;break;}}a=a.subarray(r);n-=r;r=0;if(a&&3<a.byteLength){s=ap(31&a[r+3]);if("slice_layer_without_partitioning_rbsp_idr"===s){i=!0}}return i}};Tp.aac={isLikelyAacData:function(e){if(e[0]===73&&e[1]===68&&e[2]===51){return!0}return!1},parseId3TagSize:function(e,t){var a=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],n=e[t+5];if((16&n)>>4){return a+20}return a+10},parseAdtsSize:function(e,t){var a=(224&e[t+5])>>5,n=e[t+4]<<3,r=e[t+3]&6144;return r|n|a},parseType:function(e,t){if(e[t]===73&&e[t+1]===68&&e[t+2]===51){return"timed-metadata"}else if(e[t]&!0&&240==(240&e[t+1])){return"audio"}return null},parseSampleRate:op,parseAacTimestamp:lp};var bp=_p.ONE_SECOND_IN_TS,vp=188,Sp=71,kp=function(e,t){var a=0,n=vp,r,i;while(n<e.byteLength){if(e[a]===Sp&&e[n]===Sp){r=e.subarray(a,n);i=Tp.ts.parseType(r,t.pid);switch(i){case"pat":if(!t.pid){t.pid=Tp.ts.parsePat(r)}break;case"pmt":if(!t.table){t.table=Tp.ts.parsePmt(r)}break;default:break;}if(t.pid&&t.table){return}a+=vp;n+=vp;continue}a++;n++}},Cp=function(e,t,a){var n=0,r=vp,i,s,o,l,d,p=!1;while(r<=e.byteLength){if(e[n]===Sp&&(e[r]===Sp||r===e.byteLength)){i=e.subarray(n,r);s=Tp.ts.parseType(i,t.pid);switch(s){case"pes":o=Tp.ts.parsePesType(i,t.table);l=Tp.ts.parsePayloadUnitStartIndicator(i);if("audio"===o&&l){d=Tp.ts.parsePesTime(i);if(d){d.type="audio";a.audio.push(d);p=!0}}break;default:break;}if(p){break}n+=vp;r+=vp;continue}n++;r++}r=e.byteLength;n=r-vp;p=!1;while(0<=n){if(e[n]===Sp&&(e[r]===Sp||r===e.byteLength)){i=e.subarray(n,r);s=Tp.ts.parseType(i,t.pid);switch(s){case"pes":o=Tp.ts.parsePesType(i,t.table);l=Tp.ts.parsePayloadUnitStartIndicator(i);if("audio"===o&&l){d=Tp.ts.parsePesTime(i);if(d){d.type="audio";a.audio.push(d);p=!0}}break;default:break;}if(p){break}n-=vp;r-=vp;continue}n--;r--}},Ep=function(e,t,a){var n=0,r=vp,s,o,l,d,p,u,c,m,g=!1,y={data:[],size:0};while(r<e.byteLength){if(e[n]===Sp&&e[r]===Sp){s=e.subarray(n,r);o=Tp.ts.parseType(s,t.pid);switch(o){case"pes":l=Tp.ts.parsePesType(s,t.table);d=Tp.ts.parsePayloadUnitStartIndicator(s);if("video"===l){if(d&&!g){p=Tp.ts.parsePesTime(s);if(p){p.type="video";a.video.push(p);g=!0}}if(!a.firstKeyFrame){if(d){if(0!==y.size){u=new Uint8Array(y.size);c=0;while(y.data.length){m=y.data.shift();u.set(m,c);c+=m.byteLength}if(Tp.ts.videoPacketContainsKeyFrame(u)){var h=Tp.ts.parsePesTime(u);if(h){a.firstKeyFrame=h;a.firstKeyFrame.type="video"}else{console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}}y.size=0}}y.data.push(s);y.size+=s.byteLength}}break;default:break;}if(g&&a.firstKeyFrame){break}n+=vp;r+=vp;continue}n++;r++}r=e.byteLength;n=r-vp;g=!1;while(0<=n){if(e[n]===Sp&&e[r]===Sp){s=e.subarray(n,r);o=Tp.ts.parseType(s,t.pid);switch(o){case"pes":l=Tp.ts.parsePesType(s,t.table);d=Tp.ts.parsePayloadUnitStartIndicator(s);if("video"===l&&d){p=Tp.ts.parsePesTime(s);if(p){p.type="video";a.video.push(p);g=!0}}break;default:break;}if(g){break}n-=vp;r-=vp;continue}n--;r--}},Ip=function(e,t){if(e.audio&&e.audio.length){var a=t;if("undefined"==typeof a){a=e.audio[0].dts}e.audio.forEach(function(e){e.dts=fp(e.dts,a);e.pts=fp(e.pts,a);e.dtsTime=e.dts/bp;e.ptsTime=e.pts/bp})}if(e.video&&e.video.length){var n=t;if("undefined"==typeof n){n=e.video[0].dts}e.video.forEach(function(e){e.dts=fp(e.dts,n);e.pts=fp(e.pts,n);e.dtsTime=e.dts/bp;e.ptsTime=e.pts/bp});if(e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=fp(r.dts,n);r.pts=fp(r.pts,n);r.dtsTime=r.dts/bp;r.ptsTime=r.dts/bp}}},xp=function(e){var t=!1,a=0,n=null,r=null,i=0,s=0,o;while(3<=e.length-s){var l=Tp.aac.parseType(e,s);switch(l){case"timed-metadata":if(10>e.length-s){t=!0;break}i=Tp.aac.parseId3TagSize(e,s);if(i>e.length){t=!0;break}if(null===r){o=e.subarray(s,s+i);r=Tp.aac.parseAacTimestamp(o)}s+=i;break;case"audio":if(7>e.length-s){t=!0;break}i=Tp.aac.parseAdtsSize(e,s);if(i>e.length){t=!0;break}if(null===n){o=e.subarray(s,s+i);n=Tp.aac.parseSampleRate(o)}a++;s+=i;break;default:s++;break;}if(t){return null}}if(null===n||null===r){return null}var d=bp/n,p={audio:[{type:"audio",dts:r,pts:r},{type:"audio",dts:r+1024*a*d,pts:r+1024*a*d}]};return p},Lp=function(e){var t={pid:null,table:null},a={};kp(e,t);for(var n in t.table){if(t.table.hasOwnProperty(n)){var r=t.table[n];switch(r){case Yd.H264_STREAM_TYPE:a.video=[];Ep(e,t,a);if(0===a.video.length){delete a.video}break;case Yd.ADTS_STREAM_TYPE:a.audio=[];Cp(e,t,a);if(0===a.audio.length){delete a.audio}break;default:break;}}}return a};function sa(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}var Pp=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}},Dp=function(){function e(e,t){for(var a=0,n;a<t.length;a++){n=t[a];n.enumerable=n.enumerable||!1;n.configurable=!0;if("value"in n)n.writable=!0;Object.defineProperty(e,n.key,n)}}return function(t,a,n){if(a)e(t.prototype,a);if(n)e(t,n);return t}}(),wp=function(e,t){if("function"!=typeof t&&null!==t){throw new TypeError("Super expression must either be null or a function, not "+_typeof2(t))}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t},Ap=function(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&("object"===_typeof2(t)||"function"==typeof t)?t:e},Op=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],a=e[1],n=t[4],r=a[4],o=void 0,l=void 0,p=void 0,u=[],d=[],c=void 0,m=void 0,g=void 0,y=void 0,h=void 0,_=void 0;for(o=0;256>o;o++){d[(u[o]=o<<1^283*(o>>7))^o]=o}for(l=p=0;!n[l];l^=c||1,p=d[p]||1){y=p^p<<1^p<<2^p<<3^p<<4;y=99^(y>>8^255&y);n[l]=y;r[y]=l;g=u[m=u[c=u[l]]];_=16843009*g^65537*m^257*c^16843008*l;h=257*u[y]^16843008*y;for(o=0;4>o;o++){t[o][l]=h=h<<24^h>>>8;a[o][y]=_=_<<24^_>>>8}}for(o=0;5>o;o++){t[o]=t[o].slice(0);a[o]=a[o].slice(0)}return e},Rp=null,Np=function(){function e(t){Pp(this,e);if(!Rp){Rp=Op()}this._tables=[[Rp[0][0].slice(),Rp[0][1].slice(),Rp[0][2].slice(),Rp[0][3].slice(),Rp[0][4].slice()],[Rp[1][0].slice(),Rp[1][1].slice(),Rp[1][2].slice(),Rp[1][3].slice(),Rp[1][4].slice()]];var a=void 0,n=void 0,r=void 0,s=void 0,o=void 0,l=this._tables[0][4],d=this._tables[1],p=t.length,u=1;if(4!==p&&6!==p&&8!==p){throw new Error("Invalid aes key size")}s=t.slice(0);o=[];this._key=[s,o];for(a=p;a<4*p+28;a++){r=s[a-1];if(0==a%p||8===p&&4==a%p){r=l[r>>>24]<<24^l[255&r>>16]<<16^l[255&r>>8]<<8^l[255&r];if(0==a%p){r=r<<8^r>>>24^u<<24;u=u<<1^283*(u>>7)}}s[a]=s[a-p]^r}for(n=0;a;n++,a--){r=s[3&n?a:a-4];if(4>=a||4>n){o[n]=r}else{o[n]=d[0][l[r>>>24]]^d[1][l[255&r>>16]]^d[2][l[255&r>>8]]^d[3][l[255&r]]}}}e.prototype.decrypt=function(e,t,n,r,s,o){var l=this._key[1],p=e^l[0],u=r^l[1],m=n^l[2],g=t^l[3],y=void 0,h=void 0,_=void 0,f=l.length/4-2,T=void 0,v=4,S=this._tables[1],k=S[0],C=S[1],E=S[2],I=S[3],x=S[4];for(T=0;T<f;T++){y=k[p>>>24]^C[255&u>>16]^E[255&m>>8]^I[255&g]^l[v];h=k[u>>>24]^C[255&m>>16]^E[255&g>>8]^I[255&p]^l[v+1];_=k[m>>>24]^C[255&g>>16]^E[255&p>>8]^I[255&u]^l[v+2];g=k[g>>>24]^C[255&p>>16]^E[255&u>>8]^I[255&m]^l[v+3];v+=4;p=y;u=h;m=_}for(T=0;4>T;T++){s[(3&-T)+o]=x[p>>>24]<<24^x[255&u>>16]<<16^x[255&m>>8]<<8^x[255&g]^l[v++];y=p;p=u;u=m;m=g;g=y}};return e}(),Up=function(){function e(){Pp(this,e);this.listeners={}}e.prototype.on=function(e,t){if(!this.listeners[e]){this.listeners[e]=[]}this.listeners[e].push(t)};e.prototype.off=function(e,t){if(!this.listeners[e]){return!1}var a=this.listeners[e].indexOf(t);this.listeners[e].splice(a,1);return-1<a};e.prototype.trigger=function(e){var t=this.listeners[e];if(!t){return}if(2===arguments.length){for(var a=t.length,n=0;n<a;++n){t[n].call(this,arguments[1])}}else{for(var r=Array.prototype.slice.call(arguments,1),s=t.length,o=0;o<s;++o){t[o].apply(this,r)}}};e.prototype.dispose=function(){this.listeners={}};e.prototype.pipe=function(e){this.on("data",function(t){e.push(t)})};return e}(),Mp=function(e){wp(t,e);function t(){Pp(this,t);var a=Ap(this,e.call(this,Up));a.jobs=[];a.delay=1;a.timeout_=null;return a}t.prototype.processJob_=function(){this.jobs.shift()();if(this.jobs.length){this.timeout_=setTimeout(this.processJob_.bind(this),this.delay)}else{this.timeout_=null}};t.prototype.push=function(e){this.jobs.push(e);if(!this.timeout_){this.timeout_=setTimeout(this.processJob_.bind(this),this.delay)}};return t}(Up),Bp=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},jp=function(e,t,a){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),r=new Np(Array.prototype.slice.call(t)),i=new Uint8Array(e.byteLength),s=new Int32Array(i.buffer),o=void 0,l=void 0,d=void 0,p=void 0,u=void 0,c=void 0,m=void 0,g=void 0,y=void 0;o=a[0];l=a[1];d=a[2];p=a[3];for(y=0;y<n.length;y+=4){u=Bp(n[y]);c=Bp(n[y+1]);m=Bp(n[y+2]);g=Bp(n[y+3]);r.decrypt(u,c,m,g,s,y);s[y]=Bp(s[y]^o);s[y+1]=Bp(s[y+1]^l);s[y+2]=Bp(s[y+2]^d);s[y+3]=Bp(s[y+3]^p);o=u;l=c;d=m;p=g}return i},Fp=function(){function e(t,a,n,r){Pp(this,e);var s=e.STEP,o=new Int32Array(t.buffer),l=new Uint8Array(t.byteLength),d=0;this.asyncStream_=new Mp;this.asyncStream_.push(this.decryptChunk_(o.subarray(d,d+s),a,n,l));for(d=s;d<o.length;d+=s){n=new Uint32Array([Bp(o[d-4]),Bp(o[d-3]),Bp(o[d-2]),Bp(o[d-1])]);this.asyncStream_.push(this.decryptChunk_(o.subarray(d,d+s),a,n,l))}this.asyncStream_.push(function(){r(null,sa(l))})}e.prototype.decryptChunk_=function(e,t,a,n){return function(){var r=jp(e,t,a);n.set(r,e.byteOffset)}};Dp(e,null,[{key:"STEP",get:function(){return 32e3}}]);return e}(),Hp=function(t,a){if(/^[a-z]+:/i.test(a)){return a}if(!/\/\//i.test(t)){t=no.buildAbsoluteURL(e.location.href,t)}return no.buildAbsoluteURL(t,a)},qp=function(e,t,a){if(e&&a.responseURL&&t!==a.responseURL){return a.responseURL}return t},Vp=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}},Wp=function(){function e(e,t){for(var a=0,n;a<t.length;a++){n=t[a];n.enumerable=n.enumerable||!1;n.configurable=!0;if("value"in n)n.writable=!0;Object.defineProperty(e,n.key,n)}}return function(t,a,n){if(a)e(t.prototype,a);if(n)e(t,n);return t}}(),zp=function e(t,a,n){if(null===t)t=Function.prototype;var r=Object.getOwnPropertyDescriptor(t,a);if(r===void 0){var i=Object.getPrototypeOf(t);if(null===i){}else{return e(i,a,n)}}else if("value"in r){return r.value}else{var s=r.get;if(s===void 0){return}return s.call(n)}},Gp=function(e,t){if("function"!=typeof t&&null!==t){throw new TypeError("Super expression must either be null or a function, not "+_typeof2(t))}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t},Kp=function(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&("object"===_typeof2(t)||"function"==typeof t)?t:e},Yp=function(){function e(e,t){var a=[],n=!0,r=!1,i=void 0;try{for(var s=e[Symbol.iterator](),o;!(n=(o=s.next()).done);n=!0){a.push(o.value);if(t&&a.length===t)break}}catch(e){r=!0;i=e}finally{try{if(!n&&s["return"])s["return"]()}finally{if(r)throw i}}return a}return function(t,a){if(Array.isArray(t)){return t}else if(Symbol.iterator in Object(t)){return e(t,a)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}(),Xp=Ze.mergeOptions,$p=Ze.EventTarget,Qp=Ze.log,Jp=function(e,t){["AUDIO","SUBTITLES"].forEach(function(a){for(var n in e.mediaGroups[a]){for(var r in e.mediaGroups[a][n]){var i=e.mediaGroups[a][n][r];t(i,a,n,r)}}})},Zp=function(e,t,a){var n=t.slice();a=a||0;for(var r=Math.min(e.length,t.length+a),s=a;s<r;s++){n[s-a]=Xp(e[s],n[s-a])}return n},eu=function(e,t){if(!e.resolvedUri){e.resolvedUri=Hp(t,e.uri)}if(e.key&&!e.key.resolvedUri){e.key.resolvedUri=Hp(t,e.key.uri)}if(e.map&&!e.map.resolvedUri){e.map.resolvedUri=Hp(t,e.map.uri)}},tu=function(e,t){var a=Xp(e,{}),n=a.playlists[t.id];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=Xp(n,t);if(n.segments){r.segments=Zp(n.segments,t.segments,t.mediaSequence-n.mediaSequence)}r.segments.forEach(function(e){eu(e,r.resolvedUri)});for(var s=0;s<a.playlists.length;s++){if(a.playlists[s].id===t.id){a.playlists[s]=r}}a.playlists[t.id]=r;a.playlists[t.uri]=r;return a},au=function(e,t){return e+"-"+t},nu=function(e){var t=e.playlists.length;while(t--){var a=e.playlists[t];a.resolvedUri=Hp(e.uri,a.uri);a.id=au(t,a.uri);e.playlists[a.id]=a;e.playlists[a.uri]=a;if(!a.attributes){a.attributes={};Qp.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}},ru=function(e){Jp(e,function(t){if(t.uri){t.resolvedUri=Hp(e.uri,t.uri)}})},iu=function(e,t){var a=e.segments[e.segments.length-1],n=void 0;if(t&&a&&a.duration){n=1e3*a.duration}else{n=500*(e.targetDuration||10)}return n},su=function(t){Gp(a,t);function a(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};Vp(this,a);var r=Kp(this,(a.__proto__||Object.getPrototypeOf(a)).call(this)),i=n.withCredentials,s=i===void 0?!1:i,o=n.handleManifestRedirects,l=o===void 0?!1:o;r.srcUrl=e;r.hls_=t;r.withCredentials=s;r.handleManifestRedirects=l;var d=t.options_;r.customTagParsers=d&&d.customTagParsers||[];r.customTagMappers=d&&d.customTagMappers||[];if(!r.srcUrl){throw new Error("A non-empty playlist URL is required")}r.state="HAVE_NOTHING";r.on("mediaupdatetimeout",function(){if("HAVE_METADATA"!==r.state){return}r.state="HAVE_CURRENT_METADATA";r.request=r.hls_.xhr({uri:Hp(r.master.uri,r.media().uri),withCredentials:r.withCredentials},function(e){if(!r.request){return}if(e){return r.playlistRequestError(r.request,r.media(),"HAVE_METADATA")}r.haveMetadata(r.request,r.media().uri,r.media().id)})});return r}Wp(a,[{key:"playlistRequestError",value:function(e,t,a){var n=t.uri,r=t.id;this.request=null;if(a){this.state=a}this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:500<=e.status?4:2};this.trigger("error")}},{key:"haveMetadata",value:function(t,a,n){var r=this;this.request=null;this.state="HAVE_METADATA";var i=new po;this.customTagParsers.forEach(function(e){return i.addParser(e)});this.customTagMappers.forEach(function(e){return i.addTagMapper(e)});i.push(t.responseText);i.end();i.manifest.uri=a;i.manifest.id=n;i.manifest.attributes=i.manifest.attributes||{};var s=tu(this.master,i.manifest);this.targetDuration=i.manifest.targetDuration;if(s){this.master=s;this.media_=this.master.playlists[n]}else{this.trigger("playlistunchanged")}if(!this.media().endList){e.clearTimeout(this.mediaUpdateTimeout);this.mediaUpdateTimeout=e.setTimeout(function(){r.trigger("mediaupdatetimeout")},iu(this.media(),!!s))}this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.trigger("dispose");this.stopRequest();e.clearTimeout(this.mediaUpdateTimeout);e.clearTimeout(this.finalRenditionTimeout);this.off()}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null;e.onreadystatechange=null;e.abort()}}},{key:"media",value:function(t,a){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]}e.clearTimeout(this.finalRenditionTimeout);if(a){var r=1e3*(t.targetDuration/2)||5000;this.finalRenditionTimeout=e.setTimeout(this.media.bind(this,t,!1),r);return}var i=this.state,s=!this.media_||t.id!==this.media_.id;if(this.master.playlists[t.id].endList){if(this.request){this.request.onreadystatechange=null;this.request.abort();this.request=null}this.state="HAVE_METADATA";this.media_=t;if(s){this.trigger("mediachanging");this.trigger("mediachange")}return}if(!s){return}this.state="SWITCHING_MEDIA";if(this.request){if(t.resolvedUri===this.request.url){return}this.request.onreadystatechange=null;this.request.abort();this.request=null}if(this.media_){this.trigger("mediachanging")}this.request=this.hls_.xhr({uri:t.resolvedUri,withCredentials:this.withCredentials},function(e,a){if(!n.request){return}t.resolvedUri=qp(n.handleManifestRedirects,t.resolvedUri,a);if(e){return n.playlistRequestError(n.request,t,i)}n.haveMetadata(a,t.uri,t.id);if("HAVE_MASTER"===i){n.trigger("loadedmetadata")}else{n.trigger("mediachange")}})}},{key:"pause",value:function(){this.stopRequest();e.clearTimeout(this.mediaUpdateTimeout);if("HAVE_NOTHING"===this.state){this.started=!1}if("SWITCHING_MEDIA"===this.state){if(this.media_){this.state="HAVE_METADATA"}else{this.state="HAVE_MASTER"}}else if("HAVE_CURRENT_METADATA"===this.state){this.state="HAVE_METADATA"}}},{key:"load",value:function(t){var a=this;e.clearTimeout(this.mediaUpdateTimeout);var n=this.media();if(t){var r=n?1e3*(n.targetDuration/2):5000;this.mediaUpdateTimeout=e.setTimeout(function(){return a.load()},r);return}if(!this.started){this.start();return}if(n&&!n.endList){this.trigger("mediaupdatetimeout")}else{this.trigger("loadedplaylist")}}},{key:"start",value:function(){var t=this;this.started=!0;this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(a,n){if(!t.request){return}t.request=null;if(a){t.error={status:n.status,message:"HLS playlist request error at URL: "+t.srcUrl+".",responseText:n.responseText,code:2};if("HAVE_NOTHING"===t.state){t.started=!1}return t.trigger("error")}var r=new po;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=qp(t.handleManifestRedirects,t.srcUrl,n);r.manifest.uri=t.srcUrl;if(r.manifest.playlists){t.master=r.manifest;nu(t.master);ru(t.master);t.trigger("loadedplaylist");if(!t.request){t.media(r.manifest.playlists[0])}return}var i=au(0,t.srcUrl);t.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:e.location.href,playlists:[{uri:t.srcUrl,id:i,resolvedUri:t.srcUrl,attributes:{}}]};t.master.playlists[i]=t.master.playlists[0];t.master.playlists[t.srcUrl]=t.master.playlists[0];t.haveMetadata(n,t.srcUrl,i);return t.trigger("loadedmetadata")})}}]);return a}($p),ou=Ze.createTimeRange,lu=function(e,t){var a=0,n=t-e.mediaSequence,r=e.segments[n];if(r){if("undefined"!=typeof r.start){return{result:r.start,precise:!0}}if("undefined"!=typeof r.end){return{result:r.end-r.duration,precise:!0}}}while(n--){r=e.segments[n];if("undefined"!=typeof r.end){return{result:a+r.end,precise:!0}}a+=r.duration;if("undefined"!=typeof r.start){return{result:a+r.start,precise:!0}}}return{result:a,precise:!1}},du=function(e,t){var a=0,n=void 0,r=t-e.mediaSequence;for(;r<e.segments.length;r++){n=e.segments[r];if("undefined"!=typeof n.start){return{result:n.start-a,precise:!0}}a+=n.duration;if("undefined"!=typeof n.end){return{result:n.end-a,precise:!0}}}return{result:-1,precise:!1}},pu=function(e,t,a){var n=void 0,r=void 0;if("undefined"==typeof t){t=e.mediaSequence+e.segments.length}if(t<e.mediaSequence){return 0}n=lu(e,t);if(n.precise){return n.result}r=du(e,t);if(r.precise){return r.result}return n.result+a},uu=function(t,a,n){if(!t){return 0}if("number"!=typeof n){n=0}if("undefined"==typeof a){if(t.totalDuration){return t.totalDuration}if(!t.endList){return e.Infinity}}return pu(t,a,n)},cu=function(e,t,a){var n=0;if(t>a){var r=[a,t];t=r[0];a=r[1]}if(0>t){for(var s=t;s<Math.min(0,a);s++){n+=e.targetDuration}t=0}for(var o=t;o<a;o++){n+=e.segments[o].duration}return n},mu=function(e,t){if(!e.segments.length){return 0}var a=e.segments.length,n=e.segments[a-1].duration||e.targetDuration,r="number"==typeof t?t:n+2*e.targetDuration;if(0===r){return a}var s=0;while(a--){s+=e.segments[a].duration;if(s>=r){break}}return Math.max(0,a)},gu=function(e,t,a,n){if(!e||!e.segments){return null}if(e.endList){return uu(e)}if(null===t){return null}t=t||0;var r=a?mu(e,n):e.segments.length;return pu(e,e.mediaSequence+r,t)},yu=function(e){return 0==e-Math.floor(e)},hu=function(e,t){if(yu(t)){return t+.1*e}for(var a=t.toString().split(".")[1].length,n=1;n<=a;n++){var r=Math.pow(10,n),s=t*r;if(yu(s)||n===a){return(s+e)/r}}},_u=hu.bind(null,1),fu=hu.bind(null,-1),Tu=function(e,t,a,n){var r=void 0,s=void 0,o=e.segments.length,l=t-n;if(0>l){if(0<a){for(r=a-1;0<=r;r--){s=e.segments[r];l+=fu(s.duration);if(0<l){return{mediaIndex:r,startTime:n-cu(e,a,r)}}}}return{mediaIndex:0,startTime:t}}if(0>a){for(r=a;0>r;r++){l-=e.targetDuration;if(0>l){return{mediaIndex:0,startTime:t}}}a=0}for(r=a;r<o;r++){s=e.segments[r];l-=_u(s.duration);if(0>l){return{mediaIndex:r,startTime:n+cu(e,a,r)}}}return{mediaIndex:o-1,startTime:t}},bu=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},vu=function(e){return e.excludeUntil&&e.excludeUntil===1/0},Su=function(e){var t=bu(e);return!e.disabled&&!t},ku=function(e){for(var t=0;t<e.segments.length;t++){if(e.segments[t].key){return!0}}return!1},Cu=function(e){for(var t=0;t<e.segments.length;t++){if(e.segments[t].map){return!0}}return!1},Eu=function(e,t){return t.attributes&&t.attributes[e]},Iu=function(e,t){if(1===e.playlists.length){return!0}var a=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(function(e){if(!Su(e)){return!1}return(e.attributes.BANDWIDTH||0)<a}).length},xu={duration:uu,seekable:function(e,t,a){var n=gu(e,t,!0,a);if(null===n){return ou()}return ou(t||0,n)},safeLiveIndex:mu,getMediaInfoForTime:Tu,isEnabled:Su,isDisabled:function(e){return e.disabled},isBlacklisted:bu,isIncompatible:vu,playlistEnd:gu,isAes:ku,isFmp4:Cu,hasAttribute:Eu,estimateSegmentRequestTime:function(e,t,a){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:0;if(!Eu("BANDWIDTH",a)){return NaN}var r=e*a.attributes.BANDWIDTH;return(r-8*n)/t},isLowestEnabledRendition:Iu},Lu=Ze.xhr,Pu=Ze.mergeOptions,Du=function(){return function e(t,a){t=Pu({timeout:45e3},t);var n=e.beforeRequest||Ze.Hls.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);if(r){t=r}}var i=Lu(t,function(e,t){var n=i.response;if(!e&&n){i.responseTime=Date.now();i.roundTripTime=i.responseTime-i.requestTime;i.bytesReceived=n.byteLength||n.length;if(!i.bandwidth){i.bandwidth=Math.floor(1e3*(8*(i.bytesReceived/i.roundTripTime)))}}if(t.headers){i.responseHeaders=t.headers}if(e&&"ETIMEDOUT"===e.code){i.timedout=!0}if(!e&&!i.aborted&&200!==t.statusCode&&206!==t.statusCode&&0!==t.statusCode){e=new Error("XHR Failed with a response of: "+(i&&(n||i.responseText)))}a(e,i)}),s=i.abort;i.abort=function(){i.aborted=!0;return s.apply(i,arguments)};i.uri=t.uri;i.requestTime=Date.now();return i}},wu=function(e){var t=void 0,a=void 0;a=e.offset+e.length-1;t=e.offset;return"bytes="+t+"-"+a},Au=function(e){var t={};if(e.byterange){t.Range=wu(e.byterange)}return t},Ou=function(e,t){return e.start(t)+"-"+e.end(t)},Ru=function(t,e){var a=t.toString(16);return"00".substring(0,2-a.length)+a+(e%2?" ":"")},Nu=function(t){if(32<=t&&126>t){return String.fromCharCode(t)}return"."},Uu=function(e){var t={};Object.keys(e).forEach(function(a){var n=e[a];if(ArrayBuffer.isView(n)){t[a]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}}else{t[a]=n}});return t},Mu=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Bu=function(e){return e.resolvedUri},ju=function(e){for(var t=Array.prototype.slice.call(e),a=16,n="",r=void 0,i=void 0,s=0;s<t.length/a;s++){r=t.slice(s*a,s*a+a).map(Ru).join("");i=t.slice(s*a,s*a+a).map(Nu).join("");n+=r+" "+i+"\n"}return n},Fu=function(e){var t="",a=void 0;for(a=0;a<e.length;a++){t+=Ou(e,a)+" "}return t},Hu=Object.freeze({createTransferableMessage:Uu,initSegmentId:Mu,segmentKeyId:Bu,hexDump:ju,tagDump:function(e){var t=e.bytes;return ju(t)},textRanges:Fu}),qu=.25,Vu=function(e,t){if(!t.dateTimeObject){return null}var a=t.videoTimingInfo.transmuxerPrependedSeconds,n=t.videoTimingInfo.transmuxedPresentationStart;return new Date(t.dateTimeObject.getTime()+1e3*(e-(n+a)))},Wu=function(e){return e.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds},zu=function(e,t){var a;try{a=new Date(e)}catch(t){return null}if(!t||!t.segments||0===t.segments.length){return null}var n=t.segments[0];if(a<n.dateTimeObject){return null}for(var r=0;r<t.segments.length-1;r++){n=t.segments[r];var s=t.segments[r+1].dateTimeObject;if(a<s){break}}var o=t.segments[t.segments.length-1],l=o.dateTimeObject,d=o.videoTimingInfo?Wu(o.videoTimingInfo):o.duration+o.duration*qu,p=new Date(l.getTime()+1e3*d);if(a>p){return null}if(a>l){n=o}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:xu.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"}},Gu=function(e,t){if(!t||!t.segments||0===t.segments.length){return null}for(var a=0,n=void 0,r=0;r<t.segments.length;r++){n=t.segments[r];a=n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationEnd:a+n.duration;if(e<=a){break}}var s=t.segments[t.segments.length-1];if(s.videoTimingInfo&&s.videoTimingInfo.transmuxedPresentationEnd<e){return null}if(e>a){if(e>a+s.duration*qu){return null}n=s}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:a-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}},Ku=function(e,t){var a=void 0,n=void 0;try{a=new Date(e);n=new Date(t)}catch(t){}var r=a.getTime(),i=n.getTime();return(i-r)/1e3},Yu=function(e){if(!e.segments||0===e.segments.length){return!1}for(var t=0,a;t<e.segments.length;t++){a=e.segments[t];if(!a.dateTimeObject){return!1}}return!0},Xu=function(e){var t=e.playlist,a=e.time,n=a===void 0?void 0:a,r=e.callback;if(!r){throw new Error("getProgramTime: callback must be provided")}if(!t||n===void 0){return r({message:"getProgramTime: playlist and time must be provided"})}var i=Gu(n,t);if(!i){return r({message:"valid programTime was not found"})}if("estimate"===i.type){return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart})}var s={mediaSeconds:n},o=Vu(n,i.segment);if(o){s.programDateTime=o.toISOString()}return r(null,s)},$u=function e(t){var a=t.programTime,n=t.playlist,r=t.retryCount,i=r===void 0?2:r,s=t.seekTo,o=t.pauseAfterSeek,l=o===void 0?!0:o,d=t.tech,p=t.callback;if(!p){throw new Error("seekToProgramTime: callback must be provided")}if("undefined"==typeof a||!n||!s){return p({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"})}if(!n.endList&&!d.hasStarted_){return p({message:"player must be playing a live stream to start buffering"})}if(!Yu(n)){return p({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri})}var u=zu(a,n);if(!u){return p({message:a+" was not found in the stream"})}var c=u.segment,m=Ku(c.dateTimeObject,a);if("estimate"===u.type){if(0===i){return p({message:a+" is not buffered yet. Try again"})}s(u.estimatedStart+m);d.one("seeked",function(){e({programTime:a,playlist:n,retryCount:i-1,seekTo:s,pauseAfterSeek:l,tech:d,callback:p})});return}var g=c.start+m;d.one("seeked",function(){return p(null,d.currentTime())});if(l){d.pause()}s(g)},Qu=1/30,Ju=3*Qu,Zu=function(e,t){var a=[],n=void 0;if(e&&e.length){for(n=0;n<e.length;n++){if(t(e.start(n),e.end(n))){a.push([e.start(n),e.end(n)])}}}return Ze.createTimeRanges(a)},ec=function(e,t){return Zu(e,function(e,a){return e-Ju<=t&&a+Ju>=t})},tc=function(e,t){return Zu(e,function(e){return e-Qu>=t})},ac=function(e){if(2>e.length){return Ze.createTimeRanges()}for(var t=[],a=1;a<e.length;a++){var n=e.end(a-1),r=e.start(a);t.push([n,r])}return Ze.createTimeRanges(t)},nc=function(e){var t=[];if(!e||!e.length){return""}for(var a=0;a<e.length;a++){t.push(e.start(a)+" => "+e.end(a))}return t.join(", ")},rc=function(e,t){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:1,n=e.length?e.end(e.length-1):0;return(n-t)/a},ic=function(e){for(var t=[],a=0;a<e.length;a++){t.push({start:e.start(a),end:e.end(a)})}return t},sc=function(e,t,a){var n=t.player_;if(a.captions&&a.captions.length){if(!e.inbandTextTracks_){e.inbandTextTracks_={}}for(var r in a.captionStreams){if(!e.inbandTextTracks_[r]){n.tech_.trigger({type:"usage",name:"hls-608"});var i=n.textTracks().getTrackById(r);if(i){e.inbandTextTracks_[r]=i}else{e.inbandTextTracks_[r]=n.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track}}}}if(a.metadata&&a.metadata.length&&!e.metadataTrack_){e.metadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track;e.metadataTrack_.inBandMetadataTrackDispatchType=a.metadata.dispatchType}},oc=function(e,t,a){var n=void 0,r=void 0;if(!a){return}if(!a.cues){return}n=a.cues.length;while(n--){r=a.cues[n];if(r.startTime<=t&&r.endTime>=e){a.removeCue(r)}}},lc=function(e){Object.defineProperties(e.frame,{id:{get:function(){Ze.log.warn("cue.frame.id is deprecated. Use cue.value.key instead.");return e.value.key}},value:{get:function(){Ze.log.warn("cue.frame.value is deprecated. Use cue.value.data instead.");return e.value.data}},privateData:{get:function(){Ze.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead.");return e.value.data}}})},dc=function(e){var t;if(isNaN(e)||Math.abs(e)===1/0){t=Number.MAX_VALUE}else{t=e}return t},pc=function(t,a,n){var r=e.WebKitDataCue||e.VTTCue;if(a){a.forEach(function(e){var t=e.stream;this.inbandTextTracks_[t].addCue(new r(e.startTime+this.timestampOffset,e.endTime+this.timestampOffset,e.text))},t)}if(n){var s=dc(t.mediaSource_.duration);n.forEach(function(t){var a=t.cueTime+this.timestampOffset;if("number"!=typeof a||e.isNaN(a)||0>a||!(a<1/0)){return}t.frames.forEach(function(e){var t=new r(a,a,e.value||e.url||e.data||"");t.frame=e;t.value=e;lc(t);this.metadataTrack_.addCue(t)},this)},t);if(t.metadataTrack_&&t.metadataTrack_.cues&&t.metadataTrack_.cues.length){for(var o=t.metadataTrack_.cues,l=[],d=0;d<o.length;d++){if(o[d]){l.push(o[d])}}var p=l.reduce(function(e,t){var a=e[t.startTime]||[];a.push(t);e[t.startTime]=a;return e},{}),u=Object.keys(p).sort(function(e,t){return+e-+t});u.forEach(function(e,t){var a=p[e],n=+u[t+1]||s;a.forEach(function(e){e.endTime=n})})}}},uc="undefined"!=typeof window?window:{},cc="undefined"==typeof Symbol?"__target":Symbol(),mc=uc.BlobBuilder||uc.WebKitBlobBuilder||uc.MozBlobBuilder||uc.MSBlobBuilder,gc=uc.URL||uc.webkitURL||gc&&gc.msURL,yc=uc.Worker;function oa(e,t){return function(a){var n=this;if(!t){return new yc(e)}else if(yc&&!a){var r=t.toString().replace(/^function.+?{/,"").slice(0,-1),i=la(r);this[cc]=new yc(i);da(this[cc],i);return this[cc]}else{var s={postMessage:function(e){if(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(yc){var hc,_c=la("self.onmessage = function () {}"),fc=new Uint8Array(1);try{hc=new yc(_c);hc.postMessage(fc,[fc.buffer])}catch(t){yc=null}finally{gc.revokeObjectURL(_c);if(hc){hc.terminate()}}}function la(t){try{return gc.createObjectURL(new Blob([t],{type:"application/javascript"}))}catch(n){var a=new mc;a.append(t);return gc.createObjectURL(a.getBlob(type))}}function da(e,t){if(!e||!t)return;var a=e.terminate;e.objURL=t;e.terminate=function(){if(e.objURL)gc.revokeObjectURL(e.objURL);a.call(e)}}var Tc=new oa("./transmuxer-worker.worker.js",function(){var e=this,t=function(){var t=function(){this.init=function(){var e={};this.on=function(t,a){if(!e[t]){e[t]=[]}e[t]=e[t].concat(a)};this.off=function(t,a){var n;if(!e[t]){return!1}n=e[t].indexOf(a);e[t]=e[t].slice();e[t].splice(n,1);return-1<n};this.trigger=function(t){var a,n,r,s;a=e[t];if(!a){return}if(2===arguments.length){r=a.length;for(n=0;n<r;++n){a[n].call(this,arguments[1])}}else{s=[];n=arguments.length;for(n=1;n<arguments.length;++n){s.push(arguments[n])}r=a.length;for(n=0;n<r;++n){a[n].apply(this,s)}}};this.dispose=function(){e={}}}};t.prototype.pipe=function(e){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)});return e};t.prototype.push=function(e){this.trigger("data",e)};t.prototype.flush=function(e){this.trigger("done",e)};t.prototype.partialFlush=function(e){this.trigger("partialdone",e)};t.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)};t.prototype.reset=function(e){this.trigger("reset",e)};var a=t,n=Math.pow(2,32)-1,r,i,s,o,l,d,p,u,c,m,g,y,h,_,f,T,b,v,S,k,C,E,I,x,L,P,D,w,A,O,R,N,U,M,B,j;(function(){I={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:[]};if("undefined"==typeof Uint8Array){return}for(var e in I){if(I.hasOwnProperty(e)){I[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]}}x=new Uint8Array([105,115,111,109]);P=new Uint8Array([97,118,99,49]);L=new Uint8Array([0,0,0,1]);D=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]);w=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:D,audio:w};N=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);R=new Uint8Array([0,0,0,0,0,0,0,0]);U=new Uint8Array([0,0,0,0,0,0,0,0]);M=U;B=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]);j=U;O=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])})();r=function(e){var t=[],a=0,n,r,s;for(n=1;n<arguments.length;n++){t.push(arguments[n])}n=t.length;while(n--){a+=t[n].byteLength}r=new Uint8Array(a+8);s=new DataView(r.buffer,r.byteOffset,r.byteLength);s.setUint32(0,r.byteLength);r.set(e,4);for(n=0,a=8;n<t.length;n++){r.set(t[n],a);a+=t[n].byteLength}return r};i=function(){return r(I.dinf,r(I.dref,N))};s=function(e){return r(I.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]))};o=function(){return r(I.ftyp,x,L,x,P)};T=function(e){return r(I.hdlr,A[e])};l=function(e){return r(I.mdat,e)};f=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,255&e.duration>>>24,255&e.duration>>>16,255&e.duration>>>8,255&e.duration,85,196,0,0]);if(e.samplerate){t[12]=255&e.samplerate>>>24;t[13]=255&e.samplerate>>>16;t[14]=255&e.samplerate>>>8;t[15]=255&e.samplerate}return r(I.mdhd,t)};_=function(e){return r(I.mdia,f(e),T(e.type),p(e))};d=function(e){return r(I.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))};p=function(e){return r(I.minf,"video"===e.type?r(I.vmhd,O):r(I.smhd,R),i(),v(e))};u=function(e,t){var a=[],n=t.length;while(n--){a[n]=k(t[n])}return r.apply(null,[I.moof,d(e)].concat(a))};c=function(e){var t=e.length,a=[];while(t--){a[t]=y(e[t])}return r.apply(null,[I.moov,g(4294967295)].concat(a).concat(m(e)))};m=function(e){var t=e.length,a=[];while(t--){a[t]=C(e[t])}return r.apply(null,[I.mvex].concat(a))};g=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return r(I.mvhd,t)};b=function(e){var t=e.samples||[],a=new Uint8Array(4+t.length),n,s;for(s=0;s<t.length;s++){n=t[s].flags;a[s+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy}return r(I.sdtp,a)};v=function(e){return r(I.stbl,S(e),r(I.stts,j),r(I.stsc,M),r(I.stsz,B),r(I.stco,U))};(function(){var e,t;S=function(a){return r(I.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===a.type?e(a):t(a))};e=function(e){var t=e.sps||[],a=e.pps||[],n=[],s=[],o,l;for(o=0;o<t.length;o++){n.push((65280&t[o].byteLength)>>>8);n.push(255&t[o].byteLength);n=n.concat(Array.prototype.slice.call(t[o]))}for(o=0;o<a.length;o++){s.push((65280&a[o].byteLength)>>>8);s.push(255&a[o].byteLength);s=s.concat(Array.prototype.slice.call(a[o]))}l=[I.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]),r(I.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([t.length],n,[a.length],s))),r(I.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))];if(e.sarRatio){var d=e.sarRatio[0],p=e.sarRatio[1];l.push(r(I.pasp,new Uint8Array([(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d,(4278190080&p)>>24,(16711680&p)>>16,(65280&p)>>8,255&p])))}return r.apply(null,l)};t=function(e){return r(I.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]),s(e))}})();h=function(e){var t=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 r(I.tkhd,t)};k=function(e){var t,a,i,s,o,l,d;t=r(I.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]));l=Math.floor(e.baseMediaDecodeTime/(n+1));d=Math.floor(e.baseMediaDecodeTime%(n+1));a=r(I.tfdt,new Uint8Array([1,0,0,0,255&l>>>24,255&l>>>16,255&l>>>8,255&l,255&d>>>24,255&d>>>16,255&d>>>8,255&d]));o=92;if("audio"===e.type){i=E(e,o);return r(I.traf,t,a,i)}s=b(e);i=E(e,s.length+o);return r(I.traf,t,a,i,s)};y=function(e){e.duration=e.duration||4294967295;return r(I.trak,h(e),_(e))};C=function(e){var t=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]);if("video"!==e.type){t[t.length-1]=0}return r(I.trex,t)};(function(){var e,t,a;a=function(e,t){var a=0,n=0,r=0,i=0;if(e.length){if(e[0].duration!==void 0){a=1}if(e[0].size!==void 0){n=2}if(e[0].flags!==void 0){r=4}if(e[0].compositionTimeOffset!==void 0){i=8}}return[0,0,a|n|r|i,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]};t=function(e,t){var n,s,o,l;s=e.samples||[];t+=20+16*s.length;n=a(s,t);for(l=0;l<s.length;l++){o=s[l];n=n.concat([(4278190080&o.duration)>>>24,(16711680&o.duration)>>>16,(65280&o.duration)>>>8,255&o.duration,(4278190080&o.size)>>>24,(16711680&o.size)>>>16,(65280&o.size)>>>8,255&o.size,o.flags.isLeading<<2|o.flags.dependsOn,o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,o.flags.degradationPriority&61440,15&o.flags.degradationPriority,(4278190080&o.compositionTimeOffset)>>>24,(16711680&o.compositionTimeOffset)>>>16,(65280&o.compositionTimeOffset)>>>8,255&o.compositionTimeOffset])}return r(I.trun,new Uint8Array(n))};e=function(e,t){var n,s,o,l;s=e.samples||[];t+=20+8*s.length;n=a(s,t);for(l=0;l<s.length;l++){o=s[l];n=n.concat([(4278190080&o.duration)>>>24,(16711680&o.duration)>>>16,(65280&o.duration)>>>8,255&o.duration,(4278190080&o.size)>>>24,(16711680&o.size)>>>16,(65280&o.size)>>>8,255&o.size])}return r(I.trun,new Uint8Array(n))};E=function(a,n){if("audio"===a.type){return e(a,n)}return t(a,n)}})();var F={ftyp:o,mdat:l,moof:u,moov:c,initSegment:function(e){var t=o(),a=c(e),n;n=new Uint8Array(t.byteLength+a.byteLength);n.set(t);n.set(a,t.byteLength);return n}},H=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},q=function(e,t){var a=H();a.dataOffset=t;a.compositionTimeOffset=e.pts-e.dts;a.duration=e.duration;a.size=4*e.length;a.size+=e.byteLength;if(e.keyFrame){a.flags.dependsOn=2;a.flags.isNonSyncSample=0}return a},V={groupNalsIntoFrames:function(e){var t,a,n=[],r=[];r.byteLength=0;r.nalCount=0;r.duration=0;n.byteLength=0;for(t=0;t<e.length;t++){a=e[t];if("access_unit_delimiter_rbsp"===a.nalUnitType){if(n.length){n.duration=a.dts-n.dts;r.byteLength+=n.byteLength;r.nalCount+=n.length;r.duration+=n.duration;r.push(n)}n=[a];n.byteLength=a.data.byteLength;n.pts=a.pts;n.dts=a.dts}else{if("slice_layer_without_partitioning_rbsp_idr"===a.nalUnitType){n.keyFrame=!0}n.duration=a.dts-n.dts;n.byteLength+=a.data.byteLength;n.push(a)}}if(r.length&&(!n.duration||0>=n.duration)){n.duration=r[r.length-1].duration}r.byteLength+=n.byteLength;r.nalCount+=n.length;r.duration+=n.duration;r.push(n);return r},groupFramesIntoGops:function(e){var t,a,n=[],r=[];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;for(t=0;t<e.length;t++){a=e[t];if(a.keyFrame){if(n.length){r.push(n);r.byteLength+=n.byteLength;r.nalCount+=n.nalCount;r.duration+=n.duration}n=[a];n.nalCount=a.length;n.byteLength=a.byteLength;n.pts=a.pts;n.dts=a.dts;n.duration=a.duration}else{n.duration+=a.duration;n.nalCount+=a.length;n.byteLength+=a.byteLength;n.push(a)}}if(r.length&&0>=n.duration){n.duration=r[r.length-1].duration}r.byteLength+=n.byteLength;r.nalCount+=n.nalCount;r.duration+=n.duration;r.push(n);return r},extendFirstKeyFrame:function(e){var t;if(!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}return e},generateSampleTable:function(e,t){var a,n,r,s,o,l=t||0,d=[];for(a=0;a<e.length;a++){s=e[a];for(n=0;n<s.length;n++){o=s[n];r=q(o,l);l+=r.size;d.push(r)}}return d},concatenateNalData:function(e){var t,a,n,r,s,o,l=0,d=e.byteLength,p=e.nalCount,u=new Uint8Array(d+4*p),c=new DataView(u.buffer);for(t=0;t<e.length;t++){r=e[t];for(a=0;a<r.length;a++){s=r[a];for(n=0;n<s.length;n++){o=s[n];c.setUint32(l,o.data.byteLength);l+=4;u.set(o.data,l);l+=o.data.byteLength}}}return u},generateSampleTableForFrame:function(e,t){var a,n=[];a=q(e,t||0);n.push(a);return n},concatenateNalDataForFrame:function(e){var t,a,n=0,r=e.byteLength,s=e.length,o=new Uint8Array(r+4*s),l=new DataView(o.buffer);for(t=0;t<e.length;t++){a=e[t];l.setUint32(n,a.data.byteLength);n+=4;o.set(a.data,n);n+=a.data.byteLength}return o}},W=[33,16,5,32,164,27],z=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],G=function(e){var t=[];while(e--){t.push(0)}return t},K={96e3:[W,[227,64],G(154),[56]],88200:[W,[231],G(170),[56]],64e3:[W,[248,192],G(240),[56]],48e3:[W,[255,192],G(268),[55,148,128],G(54),[112]],44100:[W,[255,192],G(268),[55,163,128],G(84),[112]],32e3:[W,[255,192],G(268),[55,234],G(226),[112]],24e3:[W,[255,192],G(268),[55,255,128],G(268),[111,112],G(126),[224]],16e3:[W,[255,192],G(268),[55,255,128],G(268),[111,255],G(269),[223,108],G(195),[1,192]],12e3:[z,G(268),[3,127,248],G(268),[6,255,240],G(268),[13,255,224],G(268),[27,253,128],G(259),[56]],11025:[z,G(268),[3,127,248],G(268),[6,255,240],G(268),[13,255,224],G(268),[27,255,192],G(268),[55,175,128],G(108),[112]],8e3:[z,G(268),[3,121,16],G(47),[7]]},Y=function(e){return Object.keys(e).reduce(function(t,a){t[a]=new Uint8Array(e[a].reduce(function(e,t){return e.concat(t)},[]));return t},{})}(K),X=9e4,$,Q,J,Z,ee,te,ae;$=function(e){return e*X};Q=function(e,t){return e*t};J=function(e){return e/X};Z=function(e,t){return e/t};ee=function(e,t){return $(Z(e,t))};te=function(e,t){return Q(J(e),t)};ae=function(e,t,a){return J(a?e:e-t)};var ne={ONE_SECOND_IN_TS:X,secondsToVideoTs:$,secondsToAudioTs:Q,videoTsToSeconds:J,audioTsToSeconds:Z,audioTsToVideoTs:ee,videoTsToAudioTs:te,metadataTsToSeconds:ae},re=function(e){var t,a,n=0;for(t=0;t<e.length;t++){a=e[t];n+=a.data.byteLength}return n},ie={prefixWithSilence:function(e,t,a,n){var r,s=0,o=0,l=0,d=0,p,u,c;if(!t.length){return}r=ne.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate);s=Math.ceil(ne.ONE_SECOND_IN_TS/(e.samplerate/1024));if(a&&n){o=r-Math.max(a,n);l=Math.floor(o/s);d=l*s}if(1>l||d>ne.ONE_SECOND_IN_TS/2){return}p=Y[e.samplerate];if(!p){p=t[0].data}for(u=0;u<l;u++){c=t[0];t.splice(0,0,{data:p,dts:c.dts-s,pts:c.pts-s})}e.baseMediaDecodeTime-=Math.floor(ne.videoTsToAudioTs(d,e.samplerate))},trimAdtsFramesByEarliestDts:function(e,t,a){if(t.minSegmentDts>=a){return e}t.minSegmentDts=1/0;return e.filter(function(e){if(e.dts>=a){t.minSegmentDts=Math.min(t.minSegmentDts,e.dts);t.minSegmentPts=t.minSegmentDts;return!0}return!1})},generateSampleTable:function(e){var t,a,n=[];for(t=0;t<e.length;t++){a=e[t];n.push({size:a.data.byteLength,duration:1024})}return n},concatenateFrameData:function(e){var t,a,n=0,r=new Uint8Array(re(e));for(t=0;t<e.length;t++){a=e[t];r.set(a.data,n);n+=a.data.byteLength}return r}},se=ne.ONE_SECOND_IN_TS,oe={clearDtsInfo:function(e){delete e.minSegmentDts;delete e.maxSegmentDts;delete e.minSegmentPts;delete e.maxSegmentPts},calculateTrackBaseMediaDecodeTime:function(e,t){var a,n,r=e.minSegmentDts;if(!t){r-=e.timelineStartInfo.dts}a=e.timelineStartInfo.baseMediaDecodeTime;a+=r;a=Math.max(0,a);if("audio"===e.type){n=e.samplerate/se;a*=n;a=Math.floor(a)}return a},collectDtsInfo:function(e,t){if("number"==typeof t.pts){if(e.timelineStartInfo.pts===void 0){e.timelineStartInfo.pts=t.pts}if(e.minSegmentPts===void 0){e.minSegmentPts=t.pts}else{e.minSegmentPts=Math.min(e.minSegmentPts,t.pts)}if(e.maxSegmentPts===void 0){e.maxSegmentPts=t.pts}else{e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)}}if("number"==typeof t.dts){if(e.timelineStartInfo.dts===void 0){e.timelineStartInfo.dts=t.dts}if(e.minSegmentDts===void 0){e.minSegmentDts=t.dts}else{e.minSegmentDts=Math.min(e.minSegmentDts,t.dts)}if(e.maxSegmentDts===void 0){e.maxSegmentDts=t.dts}else{e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts)}}}},le=4,de={parseSei:function(e){var t=0,a={payloadType:-1,payloadSize:0},n=0,r=0;while(t<e.byteLength){if(e[t]===128){break}while(255===e[t]){n+=255;t++}n+=e[t++];while(255===e[t]){r+=255;t++}r+=e[t++];if(!a.payload&&n===le){a.payloadType=n;a.payloadSize=r;a.payload=e.subarray(t,t+r);break}t+=r;n=0;r=0}return a},parseUserData:function(e){if(181!==e.payload[0]){return null}if(49!=(e.payload[1]<<8|e.payload[2])){return null}if("GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])){return null}if(3!==e.payload[7]){return null}return e.payload.subarray(8,e.payload.length-1)},parseCaptionPackets:function(e,t){var a=[],n,r,s,o;if(!(64&t[0])){return a}r=31&t[0];for(n=0;n<r;n++){s=3*n;o={type:3&t[s+2],pts:e};if(4&t[s+2]){o.ccData=t[s+3]<<8|t[s+4];a.push(o)}}return a},discardEmulationPreventionBytes:function(e){var t=e.byteLength,a=[],n=1,r,s;while(n<t-2){if(0===e[n]&&0===e[n+1]&&3===e[n+2]){a.push(n+2);n+=2}else{n++}}if(0===a.length){return e}r=t-a.length;s=new Uint8Array(r);var o=0;for(n=0;n<r;o++,n++){if(o===a[0]){o++;a.shift()}s[n]=e[o]}return s},USER_DATA_REGISTERED_ITU_T_T35:le},pe=function e(){e.prototype.init.call(this);this.captionPackets_=[];this.ccStreams_=[new he(0,0),new he(0,1),new he(1,0),new he(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)};pe.prototype=new a;pe.prototype.push=function(e){var t,a,n;if("sei_rbsp"!==e.nalUnitType){return}t=de.parseSei(e.escapedRBSP);if(t.payloadType!==de.USER_DATA_REGISTERED_ITU_T_T35){return}a=de.parseUserData(t);if(!a){return}if(e.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--;if(!this.numSameDts_){this.ignoreNextEqualDts_=!1}return}n=de.parseCaptionPackets(e.pts,a);this.captionPackets_=this.captionPackets_.concat(n);if(this.latestDts_!==e.dts){this.numSameDts_=0}this.numSameDts_++;this.latestDts_=e.dts};pe.prototype.flushCCStreams=function(e){this.ccStreams_.forEach(function(t){return"flush"===e?t.flush():t.partialFlush()},this)};pe.prototype.flushStream=function(e){if(!this.captionPackets_.length){this.flushCCStreams(e);return}this.captionPackets_.forEach(function(e,t){e.presortIndex=t});this.captionPackets_.sort(function(e,t){if(e.pts===t.pts){return e.presortIndex-t.presortIndex}return e.pts-t.pts});this.captionPackets_.forEach(function(e){if(2>e.type){this.dispatchCea608Packet(e)}},this);this.captionPackets_.length=0;this.flushCCStreams(e)};pe.prototype.flush=function(){return this.flushStream("flush")};pe.prototype.partialFlush=function(){return this.flushStream("partialFlush")};pe.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=!1;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(e){e.reset()})};pe.prototype.dispatchCea608Packet=function(e){if(this.setsTextOrXDSActive(e)){this.activeCea608Channel_[e.type]=null}else if(this.setsChannel1Active(e)){this.activeCea608Channel_[e.type]=0}else if(this.setsChannel2Active(e)){this.activeCea608Channel_[e.type]=1}if(null===this.activeCea608Channel_[e.type]){return}this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)};pe.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)};pe.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)};pe.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var ue={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},ce=function(e){if(null===e){return""}e=ue[e]||e;return String.fromCharCode(e)},me=14,ge=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],ye=function(){var e=[],t=me+1;while(t--){e.push("")}return e},he=function e(t,a){e.prototype.init.call(this);this.field_=t||0;this.dataChannel_=a||0;this.name_="CC"+((this.field_<<1|this.dataChannel_)+1);this.setConstants();this.reset();this.push=function(e){var t,a,n,r,i;t=32639&e.ccData;if(t===this.lastControlCode_){this.lastControlCode_=null;return}if(4096==(61440&t)){this.lastControlCode_=t}else if(t!==this.PADDING_){this.lastControlCode_=null}n=t>>>8;r=255&t;if(t===this.PADDING_){}else 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);a=this.displayed_;this.displayed_=this.nonDisplayed_;this.nonDisplayed_=a;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_){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}}else if(t===this.ERASE_DISPLAYED_MEMORY_){this.flushDisplayed(e.pts);this.displayed_=ye()}else if(t===this.ERASE_NON_DISPLAYED_MEMORY_){this.nonDisplayed_=ye()}else if(t===this.RESUME_DIRECT_CAPTIONING_){if("paintOn"!==this.mode_){this.flushDisplayed(e.pts);this.displayed_=ye()}this.mode_="paintOn";this.startPts_=e.pts}else if(this.isSpecialCharacter(n,r)){n=(3&n)<<8;i=ce(n|r);this[this.mode_](e.pts,i);this.column_++}else if(this.isExtCharacter(n,r)){if("popOn"===this.mode_){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1)}else{this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1)}n=(3&n)<<8;i=ce(n|r);this[this.mode_](e.pts,i);this.column_++}else if(this.isMidRowCode(n,r)){this.clearFormatting(e.pts);this[this.mode_](e.pts," ");this.column_++;if(14==(14&r)){this.addFormatting(e.pts,["i"])}if(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 s=ge.indexOf(7968&t);if("rollUp"===this.mode_){if(0>s-this.rollUpRows_+1){s=this.rollUpRows_-1}this.setRollUp(e.pts,s)}if(s!==this.row_){this.clearFormatting(e.pts);this.row_=s}if(1&r&&-1===this.formatting_.indexOf("u")){this.addFormatting(e.pts,["u"])}if(16==(16&t)){this.column_=4*((14&t)>>1)}if(this.isColorPAC(r)){if(14==(14&r)){this.addFormatting(e.pts,["i"])}}}else if(this.isNormalChar(n)){if(0===r){r=null}i=ce(n);i+=ce(r);this[this.mode_](e.pts,i);this.column_+=i.length}}};he.prototype=new a;he.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e){try{return e.trim()}catch(t){console.error("Skipping malformed caption.");return""}}).join("\n").replace(/^\n+|\n+$/g,"");if(t.length){this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})}};he.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=ye();this.nonDisplayed_=ye();this.lastControlCode_=null;this.column_=0;this.row_=me;this.rollUpRows_=2;this.formatting_=[]};he.prototype.setConstants=function(){if(0===this.dataChannel_){this.BASE_=16;this.EXT_=17;this.CONTROL_=(20|this.field_)<<8;this.OFFSET_=23}else if(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_};he.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&63>=t};he.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&63>=t};he.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&47>=t};he.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&35>=t};he.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&64<=t&&127>=t};he.prototype.isColorPAC=function(e){return 64<=e&&79>=e||96<=e&&127>=e};he.prototype.isNormalChar=function(e){return 32<=e&&127>=e};he.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_){this.row_=me;this.mode_="rollUp";this.flushDisplayed(e);this.nonDisplayed_=ye();this.displayed_=ye()}if(t!==void 0&&t!==this.row_){for(var a=0;a<this.rollUpRows_;a++){this.displayed_[t-a]=this.displayed_[this.row_-a];this.displayed_[this.row_-a]=""}}if(t===void 0){t=this.row_}this.topRow_=t-this.rollUpRows_+1};he.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var a=t.reduce(function(e,t){return e+"<"+t+">"},"");this[this.mode_](e,a)};he.prototype.clearFormatting=function(e){if(!this.formatting_.length){return}var t=this.formatting_.reverse().reduce(function(e,t){return e+"</"+t+">"},"");this.formatting_=[];this[this.mode_](e,t)};he.prototype.popOn=function(e,t){var a=this.nonDisplayed_[this.row_];a+=t;this.nonDisplayed_[this.row_]=a};he.prototype.rollUp=function(e,t){var a=this.displayed_[this.row_];a+=t;this.displayed_[this.row_]=a};he.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++){this.displayed_[e]=""}for(e=this.row_+1;e<me+1;e++){this.displayed_[e]=""}for(e=this.topRow_;e<this.row_;e++){this.displayed_[e]=this.displayed_[e+1]}this.displayed_[this.row_]=""};he.prototype.paintOn=function(e,t){var a=this.displayed_[this.row_];a+=t;this.displayed_[this.row_]=a};var _e={CaptionStream:pe,Cea608Stream:he},fe={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Te="shared",be=function(e,t){var a=1;if(e>t){a=-1}while(Math.abs(t-e)>4294967296){e+=a*8589934592}return e},ve=function e(t){var a,n;e.prototype.init.call(this);this.type_=t||Te;this.push=function(e){if(this.type_!==Te&&e.type!==this.type_){return}if(n===void 0){n=e.dts}e.dts=be(e.dts,n);e.pts=be(e.pts,n);a=e.dts;this.trigger("data",e)};this.flush=function(){n=a;this.trigger("done")};this.endTimeline=function(){this.flush();this.trigger("endedtimeline")};this.discontinuity=function(){n=void 0;a=void 0};this.reset=function(){this.discontinuity();this.trigger("reset")}};ve.prototype=new a;var Se=function(e,t,a){var n,r="";for(n=t;n<a;n++){r+="%"+("00"+e[n].toString(16)).slice(-2)}return r},ke=function(e,t,a){return decodeURIComponent(Se(e,t,a))},Ce=function(e,t,a){return unescape(Se(e,t,a))},Ee=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},Ie={TXXX:function(e){var t;if(3!==e.data[0]){return}for(t=1;t<e.data.length;t++){if(0===e.data[t]){e.description=ke(e.data,1,t);e.value=ke(e.data,t+1,e.data.length).replace(/\0*$/,"");break}}e.data=e.value},WXXX:function(e){var t;if(3!==e.data[0]){return}for(t=1;t<e.data.length;t++){if(0===e.data[t]){e.description=ke(e.data,1,t);e.url=ke(e.data,t+1,e.data.length);break}}},PRIV:function(e){var t;for(t=0;t<e.data.length;t++){if(0===e.data[t]){e.owner=Ce(e.data,0,t);break}}e.privateData=e.data.subarray(t+1);e.data=e.privateData}},xe;xe=function(e){var t={debug:!!(e&&e.debug),descriptor:e&&e.descriptor},a=0,n=[],r=0,s;xe.prototype.init.call(this);this.dispatchType=fe.METADATA_STREAM_TYPE.toString(16);if(t.descriptor){for(s=0;s<t.descriptor.length;s++){this.dispatchType+=("00"+t.descriptor[s].toString(16)).slice(-2)}}this.push=function(e){var s,o,l,p,u,c;if("timed-metadata"!==e.type){return}if(e.dataAlignmentIndicator){r=0;n.length=0}if(0===n.length&&(10>e.data.length||e.data[0]!==73||e.data[1]!==68||e.data[2]!==51)){if(t.debug){console.log("Skipping unrecognized metadata packet")}return}n.push(e);r+=e.data.byteLength;if(1===n.length){a=Ee(e.data.subarray(6,10));a+=10}if(r<a){return}s={data:new Uint8Array(a),frames:[],pts:n[0].pts,dts:n[0].dts};for(u=0;u<a;){s.data.set(n[0].data.subarray(0,a-u),u);u+=n[0].data.byteLength;r-=n[0].data.byteLength;n.shift()}o=10;if(64&s.data[5]){o+=4;o+=Ee(s.data.subarray(10,14));a-=Ee(s.data.subarray(16,20))}do{l=Ee(s.data.subarray(o+4,o+8));if(1>l){return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.")}c=String.fromCharCode(s.data[o],s.data[o+1],s.data[o+2],s.data[o+3]);p={id:c,data:s.data.subarray(o+10,o+l+10)};p.key=p.id;if(Ie[p.id]){Ie[p.id](p);if("com.apple.streaming.transportStreamTimestamp"===p.owner){var m=p.data,d=(1&m[3])<<30|m[4]<<22|m[5]<<14|m[6]<<6|m[7]>>>2;d*=4;d+=3&m[7];p.timeStamp=d;if(s.pts===void 0&&s.dts===void 0){s.pts=p.timeStamp;s.dts=p.timeStamp}this.trigger("timestamp",p)}}s.frames.push(p);o+=10;o+=l}while(o<a);this.trigger("data",s)}};xe.prototype=new a;var Le=xe,Pe={TimestampRolloverStream:ve,handleRollover:be}.TimestampRolloverStream,De,we,Ae,Oe=188,Re=71;De=function(){var e=new Uint8Array(Oe),t=0;De.prototype.init.call(this);this.push=function(a){var n=0,r=Oe,i;if(t){i=new Uint8Array(a.byteLength+t);i.set(e.subarray(0,t));i.set(a,t);t=0}else{i=a}while(r<i.byteLength){if(i[n]===Re&&i[r]===Re){this.trigger("data",i.subarray(n,r));n+=Oe;r+=Oe;continue}n++;r++}if(n<i.byteLength){e.set(i.subarray(n),0);t=i.byteLength-n}};this.flush=function(){if(t===Oe&&e[0]===Re){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")}};De.prototype=new a;we=function(){var e,t,a,n;we.prototype.init.call(this);n=this;this.packetsWaitingForPmt=[];this.programMapTable=void 0;e=function(e,n){var r=0;if(n.payloadUnitStartIndicator){r+=e[r]+1}if("pat"===n.type){t(e.subarray(r),n)}else{a(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};a=function(e,t){var a,r,i,s;if(!(1&e[5])){return}n.programMapTable={video:null,audio:null,"timed-metadata":{}};a=(15&e[1])<<8|e[2];r=3+a-4;i=(15&e[10])<<8|e[11];s=12+i;while(s<r){var o=e[s],l=(31&e[s+1])<<8|e[s+2];if(o===fe.H264_STREAM_TYPE&&null===n.programMapTable.video){n.programMapTable.video=l}else if(o===fe.ADTS_STREAM_TYPE&&null===n.programMapTable.audio){n.programMapTable.audio=l}else if(o===fe.METADATA_STREAM_TYPE){n.programMapTable["timed-metadata"][l]=o}s+=((15&e[s+3])<<8|e[s+4])+5}t.programMapTable=n.programMapTable};this.push=function(t){var a={},n=4;a.payloadUnitStartIndicator=!!(64&t[1]);a.pid=31&t[1];a.pid<<=8;a.pid|=t[2];if(1<(48&t[3])>>>4){n+=t[n]+1}if(0===a.pid){a.type="pat";e(t.subarray(n),a);this.trigger("data",a)}else if(a.pid===this.pmtPid){a.type="pmt";e(t.subarray(n),a);this.trigger("data",a);while(this.packetsWaitingForPmt.length){this.processPes_.apply(this,this.packetsWaitingForPmt.shift())}}else if(this.programMapTable===void 0){this.packetsWaitingForPmt.push([t,n,a])}else{this.processPes_(t,n,a)}};this.processPes_=function(e,t,a){if(a.pid===this.programMapTable.video){a.streamType=fe.H264_STREAM_TYPE}else if(a.pid===this.programMapTable.audio){a.streamType=fe.ADTS_STREAM_TYPE}else{a.streamType=this.programMapTable["timed-metadata"][a.pid]}a.type="pes";a.data=e.subarray(t);this.trigger("data",a)}};we.prototype=new a;we.STREAM_TYPES={h264:27,adts:15};Ae=function(){var e=this,t={data:[],size:0},a={data:[],size:0},n={data:[],size:0},r,s=function(e,t){var a;t.packetLength=6+(e[4]<<8|e[5]);t.dataAlignmentIndicator=0!=(4&e[6]);a=e[7];if(192&a){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;if(64&a){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])},o=function(t,a,n){var r=new Uint8Array(t.size),o={type:a},l=0,d=0,p=!1,u;if(!t.data.length||9>t.size){return}o.trackId=t.data[0].pid;for(l=0;l<t.data.length;l++){u=t.data[l];r.set(u.data,d);d+=u.data.byteLength}s(r,o);p="video"===a||o.packetLength<=t.size;if(n||p){t.size=0;t.data.length=0}if(p){e.trigger("data",o)}};Ae.prototype.init.call(this);this.push=function(i){({pat:function(){},pes:function(){var e,r;switch(i.streamType){case fe.H264_STREAM_TYPE:case fe.H264_STREAM_TYPE:e=t;r="video";break;case fe.ADTS_STREAM_TYPE:e=a;r="audio";break;case fe.METADATA_STREAM_TYPE:e=n;r="timed-metadata";break;default:return;}if(i.payloadUnitStartIndicator){o(e,r,!0)}e.data.push(i);e.size+=i.data.byteLength},pmt:function(){var t={type:"metadata",tracks:[]};r=i.programMapTable;if(null!==r.video){t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+r.video,codec:"avc",type:"video"})}if(null!==r.audio){t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+r.audio,codec:"adts",type:"audio"})}e.trigger("data",t)}})[i.type]()};this.reset=function(){t.size=0;t.data.length=0;a.size=0;a.data.length=0;this.trigger("reset")};this.flushStreams_=function(){o(t,"video");o(a,"audio");o(n,"timed-metadata")};this.flush=function(){this.flushStreams_();this.trigger("done")}};Ae.prototype=new a;var Ne={PAT_PID:0,MP2T_PACKET_LENGTH:Oe,TransportPacketStream:De,TransportParseStream:we,ElementaryStream:Ae,TimestampRolloverStream:Pe,CaptionStream:_e.CaptionStream,Cea608Stream:_e.Cea608Stream,MetadataStream:Le};for(var Ue in fe){if(fe.hasOwnProperty(Ue)){Ne[Ue]=fe[Ue]}}var Me=Ne,Be=ne.ONE_SECOND_IN_TS,je,Fe=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];je=function(e){var t,a=0;je.prototype.init.call(this);this.push=function(n){var r=0,s,o,l,d,p,u;if(!e){a=0}if("audio"!==n.type){return}if(t){d=t;t=new Uint8Array(d.byteLength+n.data.byteLength);t.set(d);t.set(n.data,d.byteLength)}else{t=n.data}while(r+5<t.length){if(255!==t[r]||240!=(246&t[r+1])){r++;continue}o=2*(1&~t[r+1]);s=(3&t[r+3])<<11|t[r+4]<<3|(224&t[r+5])>>5;p=1024*((3&t[r+6])+1);u=p*Be/Fe[(60&t[r+2])>>>2];l=r+s;if(t.byteLength<l){return}this.trigger("data",{pts:n.pts+a*u,dts:n.dts+a*u,sampleCount:p,audioobjecttype:(3&t[r+2]>>>6)+1,channelcount:(1&t[r+2])<<2|(192&t[r+3])>>>6,samplerate:Fe[(60&t[r+2])>>>2],samplingfrequencyindex:(60&t[r+2])>>>2,samplesize:16,data:t.subarray(r+7+o,l)});a++;if(t.byteLength===l){t=void 0;return}t=t.subarray(l)}};this.flush=function(){a=0;this.trigger("done")};this.reset=function(){t=void 0;this.trigger("reset")};this.endTimeline=function(){t=void 0;this.trigger("endedtimeline")}};je.prototype=new a;var He=je,qe;qe=function(e){var t=e.byteLength,a=0,n=0;this.length=function(){return 8*t};this.bitsAvailable=function(){return 8*t+n};this.loadWord=function(){var r=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(0===s){throw new Error("no bytes available")}i.set(e.subarray(r,r+s));a=new DataView(i.buffer).getUint32(0);n=8*s;t-=s};this.skipBits=function(e){var r;if(n>e){a<<=e;n-=e}else{e-=n;r=Math.floor(e/8);e-=8*r;t-=r;this.loadWord();a<<=e;n-=e}};this.readBits=function(e){var r=Math.min(n,e),i=a>>>32-r;n-=r;if(0<n){a<<=r}else if(0<t){this.loadWord()}r=e-r;if(0<r){return i<<r|this.readBits(r)}return i};this.skipLeadingZeros=function(){var e;for(e=0;e<n;++e){if(0!=(a&2147483648>>>e)){a<<=e;n-=e;return e}}this.loadWord();return 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();if(1&e){return 1+e>>>1}return-1*(e>>>1)};this.readBoolean=function(){return 1===this.readBits(1)};this.readUnsignedByte=function(){return this.readBits(8)};this.loadWord()};var Ve=qe,We,ze,Ge;ze=function(){var e=0,t,a;ze.prototype.init.call(this);this.push=function(n){var r;if(!a){a=n.data}else{r=new Uint8Array(a.byteLength+n.data.byteLength);r.set(a);r.set(n.data,a.byteLength);a=r}var i=a.byteLength;for(;e<i-3;e++){if(1===a[e+2]){t=e+5;break}}while(t<i){switch(a[t]){case 0:if(0!==a[t-1]){t+=2;break}else if(0!==a[t-2]){t++;break}if(e+3!==t-2){this.trigger("data",a.subarray(e+3,t-2))}do{t++}while(1!==a[t]&&t<i);e=t-2;t+=3;break;case 1:if(0!==a[t-1]||0!==a[t-2]){t+=3;break}this.trigger("data",a.subarray(e+3,t-2));e=t-2;t+=3;break;default:t+=3;break;}}a=a.subarray(e);t-=e;e=0};this.reset=function(){a=null;e=0;this.trigger("reset")};this.flush=function(){if(a&&3<a.byteLength){this.trigger("data",a.subarray(e+3))}a=null;e=0;this.trigger("done")};this.endTimeline=function(){this.flush();this.trigger("endedtimeline")}};ze.prototype=new a;Ge={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0};We=function(){var e=new ze,t,a,n,r,i,s,o;We.prototype.init.call(this);t=this;this.push=function(t){if("video"!==t.type){return}a=t.trackId;n=t.pts;r=t.dts;e.push(t)};e.on("data",function(e){var o={trackId:a,pts:n,dts:r,data:e};switch(31&e[0]){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp";o.escapedRBSP=i(e.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp";o.escapedRBSP=i(e.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";break;default:break;}t.trigger("data",o)});e.on("done",function(){t.trigger("done")});e.on("partialdone",function(){t.trigger("partialdone")});e.on("reset",function(){t.trigger("reset")});e.on("endedtimeline",function(){t.trigger("endedtimeline")});this.flush=function(){e.flush()};this.partialFlush=function(){e.partialFlush()};this.reset=function(){e.reset()};this.endTimeline=function(){e.endTimeline()};o=function(e,t){var a=8,n=8,r,i;for(r=0;r<e;r++){if(0!==n){i=t.readExpGolomb();n=(a+i+256)%256}a=0===n?a:n}};i=function(e){var t=e.byteLength,a=[],n=1,r,s;while(n<t-2){if(0===e[n]&&0===e[n+1]&&3===e[n+2]){a.push(n+2);n+=2}else{n++}}if(0===a.length){return e}r=t-a.length;s=new Uint8Array(r);var o=0;for(n=0;n<r;o++,n++){if(o===a[0]){o++;a.shift()}s[n]=e[o]}return s};s=function(e){var t=0,a=0,n=0,r=0,s=1,l,d,p,u,c,m,g,y,h,_,f,T,b,v;l=new Ve(e);d=l.readUnsignedByte();u=l.readUnsignedByte();p=l.readUnsignedByte();l.skipUnsignedExpGolomb();if(Ge[d]){c=l.readUnsignedExpGolomb();if(3===c){l.skipBits(1)}l.skipUnsignedExpGolomb();l.skipUnsignedExpGolomb();l.skipBits(1);if(l.readBoolean()){f=3!==c?8:12;for(v=0;v<f;v++){if(l.readBoolean()){if(6>v){o(16,l)}else{o(64,l)}}}}}l.skipUnsignedExpGolomb();m=l.readUnsignedExpGolomb();if(0===m){l.readUnsignedExpGolomb()}else if(1===m){l.skipBits(1);l.skipExpGolomb();l.skipExpGolomb();g=l.readUnsignedExpGolomb();for(v=0;v<g;v++){l.skipExpGolomb()}}l.skipUnsignedExpGolomb();l.skipBits(1);y=l.readUnsignedExpGolomb();h=l.readUnsignedExpGolomb();_=l.readBits(1);if(0===_){l.skipBits(1)}l.skipBits(1);if(l.readBoolean()){t=l.readUnsignedExpGolomb();a=l.readUnsignedExpGolomb();n=l.readUnsignedExpGolomb();r=l.readUnsignedExpGolomb()}if(l.readBoolean()){if(l.readBoolean()){b=l.readUnsignedByte();switch(b){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[l.readUnsignedByte()<<8|l.readUnsignedByte(),l.readUnsignedByte()<<8|l.readUnsignedByte()];break}}if(T){s=T[0]/T[1]}}}return{profileIdc:d,levelIdc:p,profileCompatibility:u,width:Math.ceil((16*(y+1)-2*t-2*a)*s),height:16*((2-_)*(h+1))-2*n-2*r,sarRatio:T}}};We.prototype=new a;var Ke={H264Stream:We,NalByteStream:ze},Ye=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Xe=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},$e=function(e,t,a){var n,r="";for(n=t;n<a;n++){r+="%"+("00"+e[n].toString(16)).slice(-2)}return r},Qe=function(e,t,a){return unescape($e(e,t,a))},Je={isLikelyAacData:function(e){if(e[0]===73&&e[1]===68&&e[2]===51){return!0}return!1},parseId3TagSize:function(e,t){var a=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],n=e[t+5];if((16&n)>>4){return a+20}return a+10},parseAdtsSize:function(e,t){var a=(224&e[t+5])>>5,n=e[t+4]<<3,r=e[t+3]&6144;return r|n|a},parseType:function(e,t){if(e[t]===73&&e[t+1]===68&&e[t+2]===51){return"timed-metadata"}else if(e[t]&!0&&240==(240&e[t+1])){return"audio"}return null},parseSampleRate:function(e){var t=0;while(t+5<e.length){if(255!==e[t]||240!=(246&e[t+1])){t++;continue}return Ye[(60&e[t+2])>>>2]}return null},parseAacTimestamp:function(e){var t,a,n,r;t=10;if(64&e[5]){t+=4;t+=Xe(e.subarray(10,14))}do{a=Xe(e.subarray(t+4,t+8));if(1>a){return null}r=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);if("PRIV"===r){n=e.subarray(t+10,t+a+10);for(var s=0;s<n.byteLength;s++){if(0===n[s]){var o=Qe(n,0,s);if("com.apple.streaming.transportStreamTimestamp"===o){var l=n.subarray(s+1),d=(1&l[3])<<30|l[4]<<22|l[5]<<14|l[6]<<6|l[7]>>>2;d*=4;d+=3&l[7];return d}break}}}t+=10;t+=a}while(t<e.byteLength);return null}},Ze;Ze=function(){var e=new Uint8Array,t=0;Ze.prototype.init.call(this);this.setTimestamp=function(e){t=e};this.push=function(a){var n=0,r=0,i,s,o,l;if(e.length){l=e.length;e=new Uint8Array(a.byteLength+l);e.set(e.subarray(0,l));e.set(a,l)}else{e=a}while(3<=e.length-r){if(e[r]===73&&e[r+1]===68&&e[r+2]===51){if(10>e.length-r){break}n=Je.parseId3TagSize(e,r);if(r+n>e.length){break}s={type:"timed-metadata",data:e.subarray(r,r+n)};this.trigger("data",s);r+=n;continue}else if(255==(255&e[r])&&240==(240&e[r+1])){if(7>e.length-r){break}n=Je.parseAdtsSize(e,r);if(r+n>e.length){break}o={type:"audio",data:e.subarray(r,r+n),pts:t,dts:t};this.trigger("data",o);r+=n;continue}r++}i=e.length-r;if(0<i){e=e.subarray(r)}else{e=new Uint8Array}};this.reset=function(){e=new Uint8Array;this.trigger("reset")};this.endTimeline=function(){e=new Uint8Array;this.trigger("endedtimeline")}};Ze.prototype=new a;var et=Ze,tt=Ke.H264Stream,at=Je.isLikelyAacData,nt=ne.ONE_SECOND_IN_TS,rt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],it=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],st,ot,lt,dt,pt=function(e,t){var a;if(e.length!==t.length){return!1}for(a=0;a<e.length;a++){if(e[a]!==t[a]){return!1}}return!0},ut=function(e,t,a,n,r,i){return{start:{dts:e,pts:e+(a-t)},end:{dts:e+(n-t),pts:e+(r-a)},prependedContentDuration:i,baseMediaDecodeTime:e}};ot=function(e,t){var a=[],n=0,r=0,i=0,s=1/0;t=t||{};ot.prototype.init.call(this);this.push=function(t){oe.collectDtsInfo(e,t);if(e){rt.forEach(function(a){e[a]=t[a]})}a.push(t)};this.setEarliestDts=function(t){r=t-e.timelineStartInfo.baseMediaDecodeTime};this.setVideoBaseMediaDecodeTime=function(e){s=e};this.setAudioAppendStart=function(e){i=e};this.flush=function(){var o,l,d,p,u;if(0===a.length){this.trigger("done","AudioSegmentStream");return}o=ie.trimAdtsFramesByEarliestDts(a,e,r);e.baseMediaDecodeTime=oe.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps);ie.prefixWithSilence(e,o,i,s);e.samples=ie.generateSampleTable(o);d=F.mdat(ie.concatenateFrameData(o));a=[];l=F.moof(n,[e]);p=new Uint8Array(l.byteLength+d.byteLength);n++;p.set(l);p.set(d,l.byteLength);oe.clearDtsInfo(e);u=Math.ceil(1024*nt/e.samplerate);if(o.length){this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+o.length*u})}this.trigger("data",{track:e,boxes:p});this.trigger("done","AudioSegmentStream")};this.reset=function(){oe.clearDtsInfo(e);a=[];this.trigger("reset")}};ot.prototype=new a;st=function(e,t){var a=0,n=[],r=[],i,s;t=t||{};st.prototype.init.call(this);delete e.minPTS;this.gopCache_=[];this.push=function(t){oe.collectDtsInfo(e,t);if("seq_parameter_set_rbsp"===t.nalUnitType&&!i){i=t.config;e.sps=[t.data];it.forEach(function(t){e[t]=i[t]},this)}if("pic_parameter_set_rbsp"===t.nalUnitType&&!s){s=t.data;e.pps=[t.data]}n.push(t)};this.flush=function(){var i,s,o,l,d,p,u=0,c,m;while(n.length){if("access_unit_delimiter_rbsp"===n[0].nalUnitType){break}n.shift()}if(0===n.length){this.resetStream_();this.trigger("done","VideoSegmentStream");return}i=V.groupNalsIntoFrames(n);o=V.groupFramesIntoGops(i);if(!o[0][0].keyFrame){s=this.getGopForFusion_(n[0],e);if(s){u=s.duration;o.unshift(s);o.byteLength+=s.byteLength;o.nalCount+=s.nalCount;o.pts=s.pts;o.dts=s.dts;o.duration+=s.duration}else{o=V.extendFirstKeyFrame(o)}}if(r.length){var g;if(t.alignGopsAtEnd){g=this.alignGopsAtEnd_(o)}else{g=this.alignGopsAtStart_(o)}if(!g){this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps});this.gopCache_.length=Math.min(6,this.gopCache_.length);n=[];this.resetStream_();this.trigger("done","VideoSegmentStream");return}oe.clearDtsInfo(e);o=g}oe.collectDtsInfo(e,o);e.samples=V.generateSampleTable(o);d=F.mdat(V.concatenateNalData(o));e.baseMediaDecodeTime=oe.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps);this.trigger("processedGopsInfo",o.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}));c=o[0];m=o[o.length-1];this.trigger("segmentTimingInfo",ut(e.baseMediaDecodeTime,c.dts,c.pts,m.dts+m.duration,m.pts+m.duration,u));this.trigger("timingInfo",{start:o[0].pts,end:o[o.length-1].pts+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);n=[];this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime);this.trigger("timelineStartInfo",e.timelineStartInfo);l=F.moof(a,[e]);p=new Uint8Array(l.byteLength+d.byteLength);a++;p.set(l);p.set(d,l.byteLength);this.trigger("data",{track:e,boxes:p});this.resetStream_();this.trigger("done","VideoSegmentStream")};this.reset=function(){this.resetStream_();n=[];this.gopCache_.length=0;r.length=0;this.trigger("reset")};this.resetStream_=function(){oe.clearDtsInfo(e);i=void 0;s=void 0};this.getGopForFusion_=function(t){var a=1/0,n,r,s,o,l;for(l=0;l<this.gopCache_.length;l++){o=this.gopCache_[l];s=o.gop;if(!(e.pps&&pt(e.pps[0],o.pps[0]))||!(e.sps&&pt(e.sps[0],o.sps[0]))){continue}if(s.dts<e.timelineStartInfo.dts){continue}n=t.dts-s.dts-s.duration;if(n>=-10000&&n<=45000){if(!r||a>n){r=o;a=n}}}if(r){return r.gop}return null};this.alignGopsAtStart_=function(e){var t,a,n,i,s,o,l,d;s=e.byteLength;o=e.nalCount;l=e.duration;t=a=0;while(t<r.length&&a<e.length){n=r[t];i=e[a];if(n.pts===i.pts){break}if(i.pts>n.pts){t++;continue}a++;s-=i.byteLength;o-=i.nalCount;l-=i.duration}if(0===a){return e}if(a===e.length){return null}d=e.slice(a);d.byteLength=s;d.duration=l;d.nalCount=o;d.pts=d[0].pts;d.dts=d[0].dts;return d};this.alignGopsAtEnd_=function(e){var t,a,n,i,s,o;t=r.length-1;a=e.length-1;s=null;o=!1;while(0<=t&&0<=a){n=r[t];i=e[a];if(n.pts===i.pts){o=!0;break}if(n.pts>i.pts){t--;continue}if(t===r.length-1){s=a}a--}if(!o&&null===s){return null}var l;if(o){l=a}else{l=s}if(0===l){return e}var d=e.slice(l),p=d.reduce(function(e,t){e.byteLength+=t.byteLength;e.duration+=t.duration;e.nalCount+=t.nalCount;return e},{byteLength:0,duration:0,nalCount:0});d.byteLength=p.byteLength;d.duration=p.duration;d.nalCount=p.nalCount;d.pts=d[0].pts;d.dts=d[0].dts;return d};this.alignGopsWith=function(e){r=e}};st.prototype=new a;dt=function(e,t){this.numberOfTracks=0;this.metadataStream=t;e=e||{};if("undefined"!=typeof e.remux){this.remuxTracks=!!e.remux}else{this.remuxTracks=!0}if("boolean"==typeof e.keepOriginalTimestamps){this.keepOriginalTimestamps=e.keepOriginalTimestamps}else{this.keepOriginalTimestamps=!1}this.pendingTracks=[];this.videoTrack=null;this.pendingBoxes=[];this.pendingCaptions=[];this.pendingMetadata=[];this.pendingBytes=0;this.emittedTracks=0;dt.prototype.init.call(this);this.push=function(e){if(e.text){return this.pendingCaptions.push(e)}if(e.frames){return this.pendingMetadata.push(e)}this.pendingTracks.push(e.track);this.pendingBytes+=e.boxes.byteLength;if("video"===e.track.type){this.videoTrack=e.track;this.pendingBoxes.push(e.boxes)}if("audio"===e.track.type){this.audioTrack=e.track;this.pendingBoxes.unshift(e.boxes)}}};dt.prototype=new a;dt.prototype.flush=function(e){var t=0,a={captions:[],captionStreams:{},metadata:[],info:{}},n,r,s,o=0,l;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e){return}else if(this.remuxTracks){return}else if(0===this.pendingTracks.length){this.emittedTracks++;if(this.emittedTracks>=this.numberOfTracks){this.trigger("done");this.emittedTracks=0}return}}if(this.videoTrack){o=this.videoTrack.timelineStartInfo.pts;it.forEach(function(e){a.info[e]=this.videoTrack[e]},this)}else if(this.audioTrack){o=this.audioTrack.timelineStartInfo.pts;rt.forEach(function(e){a.info[e]=this.audioTrack[e]},this)}if(this.videoTrack||this.audioTrack){if(1===this.pendingTracks.length){a.type=this.pendingTracks[0].type}else{a.type="combined"}this.emittedTracks+=this.pendingTracks.length;s=F.initSegment(this.pendingTracks);a.initSegment=new Uint8Array(s.byteLength);a.initSegment.set(s);a.data=new Uint8Array(this.pendingBytes);for(l=0;l<this.pendingBoxes.length;l++){a.data.set(this.pendingBoxes[l],t);t+=this.pendingBoxes[l].byteLength}for(l=0;l<this.pendingCaptions.length;l++){n=this.pendingCaptions[l];n.startTime=ne.metadataTsToSeconds(n.startPts,o,this.keepOriginalTimestamps);n.endTime=ne.metadataTsToSeconds(n.endPts,o,this.keepOriginalTimestamps);a.captionStreams[n.stream]=!0;a.captions.push(n)}for(l=0;l<this.pendingMetadata.length;l++){r=this.pendingMetadata[l];r.cueTime=ne.metadataTsToSeconds(r.pts,o,this.keepOriginalTimestamps);a.metadata.push(r)}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);for(l=0;l<a.captions.length;l++){n=a.captions[l];this.trigger("caption",n)}for(l=0;l<a.metadata.length;l++){r=a.metadata[l];this.trigger("id3Frame",r)}}if(this.emittedTracks>=this.numberOfTracks){this.trigger("done");this.emittedTracks=0}};dt.prototype.setRemux=function(e){this.remuxTracks=e};lt=function(e){var t=this,a=!0,n,r;lt.prototype.init.call(this);e=e||{};this.baseMediaDecodeTime=e.baseMediaDecodeTime||0;this.transmuxPipeline_={};this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a;a.type="aac";a.metadataStream=new Me.MetadataStream;a.aacStream=new et;a.audioTimestampRolloverStream=new Me.TimestampRolloverStream("audio");a.timedMetadataTimestampRolloverStream=new Me.TimestampRolloverStream("timed-metadata");a.adtsStream=new He;a.coalesceStream=new dt(e,a.metadataStream);a.headOfPipeline=a.aacStream;a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream);a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream);a.metadataStream.on("timestamp",function(e){a.aacStream.setTimestamp(e.timeStamp)});a.aacStream.on("data",function(i){if("timed-metadata"===i.type&&!a.audioSegmentStream){r=r||{timelineStartInfo:{baseMediaDecodeTime:t.baseMediaDecodeTime},codec:"adts",type:"audio"};a.coalesceStream.numberOfTracks++;a.audioSegmentStream=new ot(r,e);a.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo"));a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)}t.trigger("trackinfo",{hasAudio:!!r,hasVideo:!!n})});a.coalesceStream.on("data",this.trigger.bind(this,"data"));a.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a;a.type="ts";a.metadataStream=new Me.MetadataStream;a.packetStream=new Me.TransportPacketStream;a.parseStream=new Me.TransportParseStream;a.elementaryStream=new Me.ElementaryStream;a.timestampRolloverStream=new Me.TimestampRolloverStream;a.adtsStream=new He;a.h264Stream=new tt;a.captionStream=new Me.CaptionStream;a.coalesceStream=new dt(e,a.metadataStream);a.headOfPipeline=a.packetStream;a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream).pipe(a.timestampRolloverStream);a.timestampRolloverStream.pipe(a.h264Stream);a.timestampRolloverStream.pipe(a.adtsStream);a.timestampRolloverStream.pipe(a.metadataStream).pipe(a.coalesceStream);a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream);a.elementaryStream.on("data",function(s){var o;if("metadata"===s.type){o=s.tracks.length;while(o--){if(!n&&"video"===s.tracks[o].type){n=s.tracks[o];n.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime}else if(!r&&"audio"===s.tracks[o].type){r=s.tracks[o];r.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime}}if(n&&!a.videoSegmentStream){a.coalesceStream.numberOfTracks++;a.videoSegmentStream=new st(n,e);a.videoSegmentStream.on("timelineStartInfo",function(e){if(r){r.timelineStartInfo=e;a.audioSegmentStream.setEarliestDts(e.dts)}});a.videoSegmentStream.on("processedGopsInfo",t.trigger.bind(t,"gopInfo"));a.videoSegmentStream.on("segmentTimingInfo",t.trigger.bind(t,"videoSegmentTimingInfo"));a.videoSegmentStream.on("baseMediaDecodeTime",function(e){if(r){a.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}});a.videoSegmentStream.on("timingInfo",t.trigger.bind(t,"videoTimingInfo"));a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)}if(r&&!a.audioSegmentStream){a.coalesceStream.numberOfTracks++;a.audioSegmentStream=new ot(r,e);a.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo"));a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)}t.trigger("trackinfo",{hasAudio:!!r,hasVideo:!!n})}});a.coalesceStream.on("data",this.trigger.bind(this,"data"));a.coalesceStream.on("id3Frame",function(e){e.dispatchType=a.metadataStream.dispatchType;t.trigger("id3Frame",e)});a.coalesceStream.on("caption",this.trigger.bind(this,"caption"));a.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setBaseMediaDecodeTime=function(t){var a=this.transmuxPipeline_;if(!e.keepOriginalTimestamps){this.baseMediaDecodeTime=t}if(r){r.timelineStartInfo.dts=void 0;r.timelineStartInfo.pts=void 0;oe.clearDtsInfo(r);if(!e.keepOriginalTimestamps){r.timelineStartInfo.baseMediaDecodeTime=t}if(a.audioTimestampRolloverStream){a.audioTimestampRolloverStream.discontinuity()}}if(n){if(a.videoSegmentStream){a.videoSegmentStream.gopCache_=[]}n.timelineStartInfo.dts=void 0;n.timelineStartInfo.pts=void 0;oe.clearDtsInfo(n);a.captionStream.reset();if(!e.keepOriginalTimestamps){n.timelineStartInfo.baseMediaDecodeTime=t}}if(a.timestampRolloverStream){a.timestampRolloverStream.discontinuity()}};this.setAudioAppendStart=function(e){if(r){this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)}};this.setRemux=function(t){var a=this.transmuxPipeline_;e.remux=t;if(a&&a.coalesceStream){a.coalesceStream.setRemux(t)}};this.alignGopsWith=function(e){if(n&&this.transmuxPipeline_.videoSegmentStream){this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)}};this.push=function(e){if(a){var t=at(e);if(t&&"aac"!==this.transmuxPipeline_.type){this.setupAacPipeline()}else if(!t&&"ts"!==this.transmuxPipeline_.type){this.setupTsPipeline()}a=!1}this.transmuxPipeline_.headOfPipeline.push(e)};this.flush=function(){a=!0;this.transmuxPipeline_.headOfPipeline.flush()};this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()};this.reset=function(){if(this.transmuxPipeline_.headOfPipeline){this.transmuxPipeline_.headOfPipeline.reset()}};this.resetCaptions=function(){if(this.transmuxPipeline_.captionStream){this.transmuxPipeline_.captionStream.reset()}}};lt.prototype=new a;var ct={Transmuxer:lt,VideoSegmentStream:st,AudioSegmentStream:ot,AUDIO_PROPERTIES:rt,VIDEO_PROPERTIES:it,generateVideoSegmentTimingInfo:ut},mt=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}},gt=function(){function e(e,t){for(var a=0,n;a<t.length;a++){n=t[a];n.enumerable=n.enumerable||!1;n.configurable=!0;if("value"in n)n.writable=!0;Object.defineProperty(e,n.key,n)}}return function(t,a,n){if(a)e(t.prototype,a);if(n)e(t,n);return t}}(),yt=function(e,t){t.on("data",function(t){var a=t.initSegment;t.initSegment={data:a.buffer,byteOffset:a.byteOffset,byteLength:a.byteLength};var n=t.data;t.data=n.buffer;e.postMessage({action:"data",segment:t,byteOffset:n.byteOffset,byteLength:n.byteLength},[t.data])});if(t.captionStream){t.captionStream.on("data",function(t){e.postMessage({action:"caption",data:t})})}t.on("done",function(){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})})},ht=function(){function e(t,a){mt(this,e);this.options=a||{};this.self=t;this.init()}gt(e,[{key:"init",value:function(){if(this.transmuxer){this.transmuxer.dispose()}this.transmuxer=new ct.Transmuxer(this.options);yt(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(){this.transmuxer.flush()}},{key:"resetCaptions",value:function(){this.transmuxer.resetCaptions()}},{key:"alignGopsWith",value:function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}]);return e}(),_t=new function(e){e.onmessage=function(t){if("init"===t.data.action&&t.data.options){this.messageHandlers=new ht(e,t.data.options);return}if(!this.messageHandlers){this.messageHandlers=new ht(e)}if(t.data&&t.data.action&&"init"!==t.data.action){if(this.messageHandlers[t.data.action]){this.messageHandlers[t.data.action](t.data)}}}}(e);return _t}()}),bc={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},vc=function(e){return e.map(function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,a){var n=("00"+(+t).toString(16)).slice(-2),r=("00"+(+a).toString(16)).slice(-2);return"avc1."+n+"00"+r})})},Sc=function(){var e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"",t={codecCount:0},a=void 0;t.codecCount=e.split(",").length;t.codecCount=t.codecCount||2;a=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(e);if(a){t.videoCodec=a[2];t.videoObjectTypeIndicator=a[3]}t.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(e);t.audioProfile=t.audioProfile&&t.audioProfile[2];return t},kc=function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,function(e){return vc([e])[0]})},Cc=function(e,t,a){return e+"/"+t+"; codecs=\""+a.filter(function(e){return!!e}).join(", ")+"\""},Ec=function(e){if(e.segments&&e.segments.length&&e.segments[0].map){return"mp4"}return"mp2t"},Ic=function(e){var t=e.attributes||{};if(t.CODECS){return Sc(t.CODECS)}return bc},xc=function(e,t){if(!e.mediaGroups.AUDIO||!t){return null}var a=e.mediaGroups.AUDIO[t];if(!a){return null}for(var n in a){var r=a[n];if(r["default"]&&r.playlists){return Sc(r.playlists[0].attributes.CODECS).audioProfile}}return null},Lc=function(e,t){var a=Ec(t),n=Ic(t),r=t.attributes||{},i=!0,s=!1;if(!t){return[]}if(e.mediaGroups.AUDIO&&r.AUDIO){var o=e.mediaGroups.AUDIO[r.AUDIO];if(o){s=!0;i=!1;for(var l in o){if(!o[l].uri&&!o[l].playlists){i=!0;break}}}}if(s&&!n.audioProfile){if(!i){n.audioProfile=xc(e,r.AUDIO)}if(!n.audioProfile){Ze.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=bc.audioProfile}}var d={};if(n.videoCodec){d.video=""+n.videoCodec+n.videoObjectTypeIndicator}if(n.audioProfile){d.audio="mp4a.40."+n.audioProfile}var p=Cc("audio",a,[d.audio]),u=Cc("video",a,[d.video]),c=Cc("video",a,[d.video,d.audio]);if(s){if(!i&&d.video){return[u,p]}if(!i&&!d.video){return[p,p]}return[c,p]}if(!d.video){return[p]}return[c]},Pc=function(e){var t={type:"",parameters:{}},a=e.trim().split(";");t.type=a.shift().trim();a.forEach(function(e){var a=e.trim().split("=");if(1<a.length){var n=a[0].replace(/"/g,"").trim(),r=a[1].replace(/"/g,"").trim();t.parameters[n]=r}});return t},Dc=function(e){return /mp4a\.\d+.\d+/i.test(e)},wc=function(e){return /avc1\.[\da-f]+/i.test(e)},Ac=function(e,t,a){if("undefined"==typeof t||null===t||!e.length){return[]}var n=Math.ceil(9e4*(t-a+3)),r=void 0;for(r=0;r<e.length;r++){if(e[r].pts>n){break}}return e.slice(r)},Oc=function(e,t,a){if(!t.length){return e}if(a){return t.slice()}var n=t[0].pts,r=0;for(r;r<e.length;r++){if(e[r].pts>=n){break}}return e.slice(0,r).concat(t)},Rc=function(e,t,a,n){var r=Math.ceil(9e4*(t-n)),s=Math.ceil(9e4*(a-n)),o=e.slice(),l=e.length;while(l--){if(e[l].pts<=s){break}}if(-1===l){return o}var d=l+1;while(d--){if(e[d].pts<=r){break}}d=Math.max(d,0);o.splice(d,l-d+1);return o},Nc=function(e,t,a){var n=null,r=null,i=0,s=[],o=[];if(!e&&!t){return Ze.createTimeRange()}if(!e){return t.buffered}if(!t){return e.buffered}if(a){return e.buffered}if(0===e.buffered.length&&0===t.buffered.length){return Ze.createTimeRange()}var l=e.buffered,d=t.buffered,p=l.length;while(p--){s.push({time:l.start(p),type:"start"});s.push({time:l.end(p),type:"end"})}p=d.length;while(p--){s.push({time:d.start(p),type:"start"});s.push({time:d.end(p),type:"end"})}s.sort(function(e,t){return e.time-t.time});for(p=0;p<s.length;p++){if("start"===s[p].type){i++;if(2===i){n=s[p].time}}else if("end"===s[p].type){i--;if(1===i){r=s[p].time}}if(null!==n&&null!==r){o.push([n,r]);n=null;r=null}}return Ze.createTimeRanges(o)},Uc=9e4,Mc=function(e,t){var a=e.addSourceBuffer(t),n=Object.create(null);n.updating=!1;n.realBuffer_=a;var r=function(e){if("function"==typeof a[e]){n[e]=function(){return a[e].apply(a,arguments)}}else if("undefined"==typeof n[e]){Object.defineProperty(n,e,{get:function(){return a[e]},set:function(t){return a[e]=t}})}};for(var i in a){r(i)}return n},Bc=function(e){Gp(t,e);function t(e,a){Vp(this,t);var n=Kp(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,Ze.EventTarget));n.timestampOffset_=0;n.pendingBuffers_=[];n.bufferUpdating_=!1;n.mediaSource_=e;n.codecs_=a;n.audioCodec_=null;n.videoCodec_=null;n.audioDisabled_=!1;n.appendAudioInitSegment_=!0;n.gopBuffer_=[];n.timeMapping_=0;n.safeAppend_=11<=Ze.browser.IE_VERSION;var r={remux:!1,alignGopsAtEnd:n.safeAppend_};n.codecs_.forEach(function(e){if(Dc(e)){n.audioCodec_=e}else if(wc(e)){n.videoCodec_=e}});n.transmuxer_=new Tc;n.transmuxer_.postMessage({action:"init",options:r});n.transmuxer_.onmessage=function(e){if("data"===e.data.action){return n.data_(e)}if("done"===e.data.action){return n.done_(e)}if("gopInfo"===e.data.action){return n.appendGopInfo_(e)}if("videoSegmentTimingInfo"===e.data.action){return n.videoSegmentTimingInfo_(e.data.videoSegmentTimingInfo)}};Object.defineProperty(n,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(e){if("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(n,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(e){if(this.videoBuffer_){this.videoBuffer_.appendWindowStart=e}if(this.audioBuffer_){this.audioBuffer_.appendWindowStart=e}}});Object.defineProperty(n,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}});Object.defineProperty(n,"buffered",{get:function(){return Nc(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}});return n}Wp(t,[{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);sc(this,this.mediaSource_,t);this.pendingBuffers_.push(t)}},{key:"done_",value:function(){if("closed"===this.mediaSource_.readyState){this.pendingBuffers_.length=0;return}this.processPendingSegments_()}},{key:"videoSegmentTimingInfo_",value:function(e){var t={start:{decode:e.start.dts/Uc,presentation:e.start.pts/Uc},end:{decode:e.end.dts/Uc,presentation:e.end.pts/Uc},baseMediaDecodeTime:e.baseMediaDecodeTime/Uc};if(e.prependedContentDuration){t.prependedContentDuration=e.prependedContentDuration/Uc}this.trigger({type:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}},{key:"createRealSourceBuffers_",value:function(){var e=this,t=["audio","video"];t.forEach(function(a){if(!e[a+"Codec_"]){return}if(e[a+"Buffer_"]){return}var n=null;if(e.mediaSource_[a+"Buffer_"]){n=e.mediaSource_[a+"Buffer_"];n.updating=!1}else{var r=a+"/mp4;codecs=\""+e[a+"Codec_"]+"\"";n=Mc(e.mediaSource_.nativeMediaSource_,r);e.mediaSource_[a+"Buffer_"]=n}e[a+"Buffer_"]=n;["update","updatestart","updateend"].forEach(function(r){n.addEventListener(r,function(){if("audio"===a&&e.audioDisabled_){return}if("updateend"===r){e[a+"Buffer_"].updating=!1}var n=t.every(function(n){if("audio"===n&&e.audioDisabled_){return!0}if(a!==n&&e[n+"Buffer_"]&&e[n+"Buffer_"].updating){return!1}return!0});if(n){return e.trigger(r)}})})})}},{key:"appendBuffer",value:function(e){this.bufferUpdating_=!0;if(this.audioBuffer_&&this.audioBuffer_.buffered.length){var t=this.audioBuffer_.buffered;this.transmuxer_.postMessage({action:"setAudioAppendStart",appendStart:t.end(t.length-1)})}if(this.videoBuffer_){this.transmuxer_.postMessage({action:"alignGopsWith",gopsToAlignWith:Ac(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_=Oc(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_=Rc(this.gopBuffer_,e,t,this.timeMapping_)}if(!this.audioDisabled_&&this.audioBuffer_){this.audioBuffer_.updating=!0;this.audioBuffer_.remove(e,t)}oc(e,t,this.metadataTrack_);if(this.inbandTextTracks_){for(var a in this.inbandTextTracks_){oc(e,t,this.inbandTextTracks_[a])}}}},{key:"processPendingSegments_",value:function(){var e={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]};if(!this.pendingBuffers_.length){this.trigger("updateend");this.bufferUpdating_=!1;return}e=this.pendingBuffers_.reduce(function(e,t){var a=t.type,n=t.data,r=t.initSegment;e[a].segments.push(n);e[a].bytes+=n.byteLength;e[a].initSegment=r;if(t.captions){e.captions=e.captions.concat(t.captions)}if(t.info){e[a].info=t.info}if(t.metadata){e.metadata=e.metadata.concat(t.metadata)}return e},e);if(!this.videoBuffer_&&!this.audioBuffer_){if(0===e.video.bytes){this.videoCodec_=null}if(0===e.audio.bytes){this.audioCodec_=null}this.createRealSourceBuffers_()}if(e.audio.info){this.mediaSource_.trigger({type:"audioinfo",info:e.audio.info})}if(e.video.info){this.mediaSource_.trigger({type:"videoinfo",info:e.video.info})}if(this.appendAudioInitSegment_){if(!this.audioDisabled_&&this.audioBuffer_){e.audio.segments.unshift(e.audio.initSegment);e.audio.bytes+=e.audio.initSegment.byteLength}this.appendAudioInitSegment_=!1}var t=!1;if(this.videoBuffer_&&e.video.bytes){e.video.segments.unshift(e.video.initSegment);e.video.bytes+=e.video.initSegment.byteLength;this.concatAndAppendSegments_(e.video,this.videoBuffer_)}else if(this.videoBuffer_&&(this.audioDisabled_||!this.audioBuffer_)){t=!0}pc(this,e.captions,e.metadata);if(!this.audioDisabled_&&this.audioBuffer_){this.concatAndAppendSegments_(e.audio,this.audioBuffer_)}this.pendingBuffers_.length=0;if(t){this.trigger("updateend")}this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(e,t){var a=0,n=void 0;if(e.bytes){n=new Uint8Array(e.bytes);e.segments.forEach(function(e){n.set(e,a);a+=e.byteLength});try{t.updating=!0;t.appendBuffer(n)}catch(e){if(this.mediaSource_.player_){this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:e.message,originalError:e})}}}}},{key:"abort",value:function(){if(this.videoBuffer_){this.videoBuffer_.abort()}if(!this.audioDisabled_&&this.audioBuffer_){this.audioBuffer_.abort()}if(this.transmuxer_){this.transmuxer_.postMessage({action:"reset"})}this.pendingBuffers_.length=0;this.bufferUpdating_=!1}},{key:"dispose",value:function(){this.trigger("dispose");this.off()}}]);return t}(Ze.EventTarget),jc=function(a){Gp(n,a);function n(){Vp(this,n);var a=Kp(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),r=void 0;a.nativeMediaSource_=new e.MediaSource;for(r in a.nativeMediaSource_){if(!(r in n.prototype)&&"function"==typeof a.nativeMediaSource_[r]){a[r]=a.nativeMediaSource_[r].bind(a.nativeMediaSource_)}}a.duration_=NaN;Object.defineProperty(a,"duration",{get:function(){if(this.duration_===1/0){return this.duration_}return this.nativeMediaSource_.duration},set:function(e){this.duration_=e;if(e!==1/0){this.nativeMediaSource_.duration=e}}});Object.defineProperty(a,"seekable",{get:function(){if(this.duration_===1/0){return Ze.createTimeRanges([[0,this.nativeMediaSource_.duration]])}return this.nativeMediaSource_.seekable}});Object.defineProperty(a,"readyState",{get:function(){return this.nativeMediaSource_.readyState}});Object.defineProperty(a,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}});a.sourceBuffers=[];a.activeSourceBuffers_=[];a.updateActiveSourceBuffers_=function(){a.activeSourceBuffers_.length=0;if(1===a.sourceBuffers.length){var e=a.sourceBuffers[0];e.appendAudioInitSegment_=!0;e.audioDisabled_=!e.audioCodec_;a.activeSourceBuffers_.push(e);return}for(var t=!1,n=!0,r=0,s;r<a.player_.audioTracks().length;r++){s=a.player_.audioTracks()[r];if(s.enabled&&"main"!==s.kind){t=!0;n=!1;break}}a.sourceBuffers.forEach(function(e,r){e.appendAudioInitSegment_=!0;if(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;if(e.audioDisabled_){return}}a.activeSourceBuffers_.push(e)})};a.onPlayerMediachange_=function(){a.sourceBuffers.forEach(function(e){e.appendAudioInitSegment_=!0})};a.onHlsReset_=function(){a.sourceBuffers.forEach(function(e){if(e.transmuxer_){e.transmuxer_.postMessage({action:"resetCaptions"})}})};a.onHlsSegmentTimeMapping_=function(e){a.sourceBuffers.forEach(function(t){return t.timeMapping_=e.mapping})};["sourceopen","sourceclose","sourceended"].forEach(function(e){this.nativeMediaSource_.addEventListener(e,this.trigger.bind(this))},a);a.on("sourceopen",function(){var e=t.querySelector("[src=\""+a.url_+"\"]");if(!e){return}a.player_=Ze(e.parentNode);if(!a.player_){return}a.player_.tech_.on("hls-reset",a.onHlsReset_);a.player_.tech_.on("hls-segment-time-mapping",a.onHlsSegmentTimeMapping_);if(a.player_.audioTracks&&a.player_.audioTracks()){a.player_.audioTracks().on("change",a.updateActiveSourceBuffers_);a.player_.audioTracks().on("addtrack",a.updateActiveSourceBuffers_);a.player_.audioTracks().on("removetrack",a.updateActiveSourceBuffers_)}a.player_.on("mediachange",a.onPlayerMediachange_)});a.on("sourceended",function(){for(var e=dc(a.duration),t=0;t<a.sourceBuffers.length;t++){var n=a.sourceBuffers[t],r=n.metadataTrack_&&n.metadataTrack_.cues;if(r&&r.length){r[r.length-1].endTime=e}}});a.on("sourceclose",function(){this.sourceBuffers.forEach(function(e){if(e.transmuxer_){e.transmuxer_.terminate()}});this.sourceBuffers.length=0;if(!this.player_){return}if(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_)}if(this.player_.el_){this.player_.off("mediachange",this.onPlayerMediachange_)}if(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_)}});return a}Wp(n,[{key:"addSeekableRange_",value:function(e,t){var a;if(this.duration!==1/0){a=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity");a.name="InvalidStateError";a.code=11;throw a}if(t>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration)){this.nativeMediaSource_.duration=t}}},{key:"addSourceBuffer",value:function(e){var t=void 0,a=Pc(e);if(/^(video|audio)\/mp2t$/i.test(a.type)){var n=[];if(a.parameters&&a.parameters.codecs){n=a.parameters.codecs.split(",");n=vc(n);n=n.filter(function(e){return Dc(e)||wc(e)})}if(0===n.length){n=["avc1.4d400d","mp4a.40.2"]}t=new Bc(this,n);if(0!==this.sourceBuffers.length){this.sourceBuffers[0].createRealSourceBuffers_();t.createRealSourceBuffers_();this.sourceBuffers[0].audioDisabled_=!0}}else{t=this.nativeMediaSource_.addSourceBuffer(e)}this.sourceBuffers.push(t);return t}},{key:"dispose",value:function(){this.trigger("dispose");this.off();this.sourceBuffers.forEach(function(e){if(e.dispose){e.dispose()}});this.sourceBuffers.length=0}}]);return n}(Ze.EventTarget),Fc=0;Ze.mediaSources={};var Hc=function(e,t){var a=Ze.mediaSources[e];if(a){a.trigger({type:"sourceopen",swfId:t})}else{throw new Error("Media Source not found (Video.js)")}},qc=function(){return!!e.MediaSource&&!!e.MediaSource.isTypeSupported&&e.MediaSource.isTypeSupported("video/mp4;codecs=\"avc1.4d400d,mp4a.40.2\"")},Vc=function(){this.MediaSource={open:Hc,supportsNativeMediaSources:qc};if(qc()){return new jc}throw new Error("Cannot use create a virtual MediaSource for this video")};Vc.open=Hc;Vc.supportsNativeMediaSources=qc;var Wc={createObjectURL:function(t){var a=void 0;if(t instanceof jc){a=e.URL.createObjectURL(t.nativeMediaSource_);t.url_=a;return a}if(!(t instanceof jc)){a=e.URL.createObjectURL(t);t.url_=a;return a}a="blob:vjs-media-source/"+Fc;Fc++;Ze.mediaSources[a]=t;return a}};Ze.MediaSource=Vc;Ze.URL=Wc;var zc=Ze.EventTarget,Gc=Ze.mergeOptions,Kc=function(e,t){for(var a=void 0,n=Gc(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),r=0,s;r<t.playlists.length;r++){s=tu(n,t.playlists[r]);if(s){n=s}else{a=!0}}Jp(t,function(e,t,r,i){if(e.playlists&&e.playlists.length){var s=e.playlists[0].id,o=tu(n,e.playlists[0]);if(o){n=o;n.mediaGroups[t][r][i].playlists[0]=n.playlists[s];a=!1}}});if(a){return null}return n},Yc=function(e){var t=e.byterange.offset+e.byterange.length-1;return e.uri+"-"+e.byterange.offset+"-"+t},Xc=function(e,t){var a=!!(!e.map&&!t.map),n=a||!!(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length);return n&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length},$c=function(e,t){var a={};for(var n in e){var r=e[n],i=r.sidx;if(i){var s=Yc(i);if(!t[s]){break}var o=t[s].sidxInfo;if(Xc(o,i)){a[s]=t[s]}}}return a},Qc=function(e,t,a,n){var r=id(e,{manifestUri:t,clientOffset:a}),i=$c(r.playlists,n),s=i;Jp(r,function(e){if(e.playlists&&e.playlists.length){var t=e.playlists;s=Gc(s,$c(t,n))}});return s},Jc=function(e,t,a,n,r){var i={uri:qp(n.handleManifestRedirects,e.resolvedUri),byterange:e.byterange,playlist:t},s=Ze.mergeOptions(i,{responseType:"arraybuffer",headers:Au(i)});return a(s,r)},Zc=function(t){Gp(a,t);function a(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},r=arguments[3];Vp(this,a);var i=Kp(this,(a.__proto__||Object.getPrototypeOf(a)).call(this)),s=n.withCredentials,o=s===void 0?!1:s,l=n.handleManifestRedirects,d=l===void 0?!1:l;i.hls_=t;i.withCredentials=o;i.handleManifestRedirects=d;if(!e){throw new Error("A non-empty playlist URL or playlist is required")}i.on("minimumUpdatePeriod",function(){i.refreshXml_()});i.on("mediaupdatetimeout",function(){i.refreshMedia_(i.media().id)});i.state="HAVE_NOTHING";i.loadedPlaylists_={};if("string"==typeof e){i.srcUrl=e;i.sidxMapping_={};return Kp(i)}i.setupChildLoader(r,e);return i}Wp(a,[{key:"setupChildLoader",value:function(e,t){this.masterPlaylistLoader_=e;this.childPlaylist_=t}},{key:"dispose",value:function(){this.trigger("dispose");this.stopRequest();this.loadedPlaylists_={};e.clearTimeout(this.minimumUpdatePeriodTimeout_);e.clearTimeout(this.mediaRequest_);e.clearTimeout(this.mediaUpdateTimeout);this.off()}},{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,a,n){var r=this;return function(i,s){if(!r.request){return}r.request=null;if(i){r.error={status:s.status,message:"DASH playlist request error at URL: "+e.uri,response:s.response,code:2};if(a){r.state=a}r.trigger("error");return n(t,null)}var o=new Uint8Array(s.response),l=_d.parseSidx(o.subarray(8));return n(t,l)}}},{key:"media",value:function(t){var a=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.id!==this.media_.id;if(r&&this.loadedPlaylists_[t.id]&&this.loadedPlaylists_[t.id].endList){this.state="HAVE_METADATA";this.media_=t;if(r){this.trigger("mediachanging");this.trigger("mediachange")}return}if(!r){return}if(this.media_){this.trigger("mediachanging")}if(!t.sidx){this.mediaRequest_=e.setTimeout(this.haveMetadata.bind(this,{startingState:n,playlist:t}),0);return}var i=void 0,s=void 0;if(this.masterPlaylistLoader_){i=this.masterPlaylistLoader_.master;s=this.masterPlaylistLoader_.sidxMapping_}else{i=this.master;s=this.sidxMapping_}var o=Yc(t.sidx);s[o]={sidxInfo:t.sidx};this.request=Jc(t.sidx,t,this.hls_.xhr,{handleManifestRedirects:this.handleManifestRedirects},this.sidxRequestFinished_(t,i,n,function(e,r){if(!e||!r){throw new Error("failed to request sidx")}s[o].sidx=r;a.haveMetadata({startingState:n,playlist:e.playlists[t.id]})}))}},{key:"haveMetadata",value:function(e){var t=e.startingState,a=e.playlist;this.state="HAVE_METADATA";this.loadedPlaylists_[a.id]=a;this.mediaRequest_=null;this.refreshMedia_(a.id);if("HAVE_MASTER"===t){this.trigger("loadedmetadata")}else{this.trigger("mediachange")}}},{key:"pause",value:function(){this.stopRequest();e.clearTimeout(this.mediaUpdateTimeout);e.clearTimeout(this.minimumUpdatePeriodTimeout_);if("HAVE_NOTHING"===this.state){this.started=!1}}},{key:"load",value:function(t){var a=this;e.clearTimeout(this.mediaUpdateTimeout);e.clearTimeout(this.minimumUpdatePeriodTimeout_);var n=this.media();if(t){var r=n?1e3*(n.targetDuration/2):5000;this.mediaUpdateTimeout=e.setTimeout(function(){return a.load()},r);return}if(!this.started){this.start();return}if(n&&!n.endList){this.trigger("mediaupdatetimeout")}else{this.trigger("loadedplaylist")}}},{key:"parseMasterXml",value:function(){var e=id(this.masterXml_,{manifestUri:this.srcUrl,clientOffset:this.clientOffset_,sidxMapping:this.sidxMapping_});e.uri=this.srcUrl;for(var t=0,a;t<e.playlists.length;t++){a="placeholder-uri-"+t;e.playlists[t].uri=a}Jp(e,function(t,a,n,r){if(t.playlists&&t.playlists.length){var i="placeholder-uri-"+a+"-"+n+"-"+r,s=au(0,i);t.playlists[0].uri=i;t.playlists[0].id=s;e.playlists[s]=t.playlists[0];e.playlists[i]=t.playlists[0]}});nu(e);ru(e);return e}},{key:"start",value:function(){var t=this;this.started=!0;if(this.masterPlaylistLoader_){this.mediaRequest_=e.setTimeout(this.haveMaster_.bind(this),0);return}this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(e,a){if(!t.request){return}t.request=null;if(e){t.error={status:a.status,message:"DASH playlist request error at URL: "+t.srcUrl,responseText:a.responseText,code:2};if("HAVE_NOTHING"===t.state){t.started=!1}return t.trigger("error")}t.masterXml_=a.responseText;if(a.responseHeaders&&a.responseHeaders.date){t.masterLoaded_=Date.parse(a.responseHeaders.date)}else{t.masterLoaded_=Date.now()}t.srcUrl=qp(t.handleManifestRedirects,t.srcUrl,a);t.syncClientServerClock_(t.onClientServerClockSync_.bind(t))})}},{key:"syncClientServerClock_",value:function(e){var t=this,a=sd(this.masterXml_);if(null===a){this.clientOffset_=this.masterLoaded_-Date.now();return e()}if("DIRECT"===a.method){this.clientOffset_=a.value-Date.now();return e()}this.request=this.hls_.xhr({uri:Hp(this.srcUrl,a.value),method:a.method,withCredentials:this.withCredentials},function(n,r){if(!t.request){return}if(n){t.clientOffset_=t.masterLoaded_-Date.now();return e()}var i;if("HEAD"===a.method){if(!r.responseHeaders||!r.responseHeaders.date){i=t.masterLoaded_}else{i=Date.parse(r.responseHeaders.date)}}else{i=Date.parse(r.responseText)}t.clientOffset_=i-Date.now();e()})}},{key:"haveMaster_",value:function(){this.state="HAVE_MASTER";this.mediaRequest_=null;if(!this.masterPlaylistLoader_){this.master=this.parseMasterXml();this.trigger("loadedplaylist")}else if(!this.media_){this.media(this.childPlaylist_)}}},{key:"onClientServerClockSync_",value:function(){var t=this;this.haveMaster_();if(!this.hasPendingRequest()&&!this.media_){this.media(this.master.playlists[0])}if(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(a,n){if(!t.request){return}t.request=null;if(a){t.error={status:n.status,message:"DASH playlist request error at URL: "+t.srcUrl,responseText:n.responseText,code:2};if("HAVE_NOTHING"===t.state){t.started=!1}return t.trigger("error")}t.masterXml_=n.responseText;t.sidxMapping_=Qc(t.masterXml_,t.srcUrl,t.clientOffset_,t.sidxMapping_);var r=t.parseMasterXml(),i=Kc(t.master,r),s=t.media().sidx;if(i){if(s){var o=Yc(s);if(!t.sidxMapping_[o]){var l=t.media();t.request=Jc(l.sidx,l,t.hls_.xhr,{handleManifestRedirects:t.handleManifestRedirects},t.sidxRequestFinished_(l,r,t.state,function(a,n){if(!a||!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().id)}))}}else{t.master=i}}t.minimumUpdatePeriodTimeout_=e.setTimeout(function(){t.trigger("minimumUpdatePeriod")},t.master.minimumUpdatePeriod)})}},{key:"refreshMedia_",value:function(t){var a=this;if(!t){throw new Error("refreshMedia_ must take a media id")}var n=void 0,r=void 0;if(this.masterPlaylistLoader_){n=this.masterPlaylistLoader_.master;r=this.masterPlaylistLoader_.parseMasterXml()}else{n=this.master;r=this.parseMasterXml()}var i=Kc(n,r);if(i){if(this.masterPlaylistLoader_){this.masterPlaylistLoader_.master=i}else{this.master=i}this.media_=i.playlists[t]}else{this.media_=r.playlists[t];this.trigger("playlistunchanged")}if(!this.media().endList){this.mediaUpdateTimeout=e.setTimeout(function(){a.trigger("mediaupdatetimeout")},iu(this.media(),!!i))}this.trigger("loadedplaylist")}}]);return a}(zc),em=function(e){if(Ze.log.debug){return Ze.log.debug.bind(Ze,"VHS:",e+" >")}return function(){}};function pa(){}var tm=function(){function e(t,a,n,r){Vp(this,e);this.callbacks_=[];this.pendingCallback_=null;this.timestampOffset_=0;this.mediaSource=t;this.processedAppend_=!1;this.type_=n;this.mimeType_=a;this.logger_=em("SourceUpdater["+n+"]["+a+"]");if("closed"===t.readyState){t.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,a,r))}else{this.createSourceBuffer_(a,r)}}Wp(e,[{key:"createSourceBuffer_",value:function(e,t){var a=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(e);this.logger_("created SourceBuffer");if(t){t.trigger("sourcebufferadded");if(2>this.mediaSource.sourceBuffers.length){t.on("sourcebufferadded",function(){a.start_()});return}}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 ["+nc(e.buffered())+"]");if(t){t()}e.runCallback_()};this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_);this.runCallback_()}},{key:"abort",value:function(e){var t=this;if(this.processedAppend_){this.queueCallback_(function(){t.sourceBuffer_.abort()},e)}}},{key:"appendBuffer",value:function(e,t){var a=this;this.processedAppend_=!0;this.queueCallback_(function(){if(e.videoSegmentTimingInfoCallback){a.sourceBuffer_.addEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback)}a.sourceBuffer_.appendBuffer(e.bytes)},function(){if(e.videoSegmentTimingInfoCallback){a.sourceBuffer_.removeEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback)}t()})}},{key:"buffered",value:function(){if(!this.sourceBuffer_){return Ze.createTimeRanges()}return this.sourceBuffer_.buffered}},{key:"remove",value:function(e,t){var a=this,n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:pa;if(this.processedAppend_){this.queueCallback_(function(){a.logger_("remove ["+e+" => "+t+"]");a.sourceBuffer_.removing=!0;a.sourceBuffer_.remove(e,t)},n)}}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||!!this.pendingCallback_&&this.pendingCallback_!==pa}},{key:"timestampOffset",value:function(e){var t=this;if("undefined"!=typeof e){this.queueCallback_(function(){t.sourceBuffer_.timestampOffset=e;t.runCallback_()});this.timestampOffset_=e}return this.timestampOffset_}},{key:"queueCallback_",value:function(e,t){this.callbacks_.push([e.bind(this),t]);this.runCallback_()}},{key:"runCallback_",value:function(){var e;if(!this.updating()&&this.callbacks_.length&&this.started_){e=this.callbacks_.shift();this.pendingCallback_=e[1];e[0]()}}},{key:"dispose",value:function(){var e=this,t=function t(){if(e.sourceBuffer_&&"open"===e.mediaSource.readyState){e.sourceBuffer_.abort()}e.sourceBuffer_.removeEventListener("updateend",t)};this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_);if(this.sourceBuffer_.removing){this.sourceBuffer_.addEventListener("updateend",t)}else{t()}}}]);return e}(),am={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},nm={FAILURE:2,TIMEOUT:-101,ABORTED:-102},rm=function(e){e.forEach(function(e){e.abort()})},im=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}},sm=function(e){var t=e.target,a=Date.now()-t.requestTime,n={bandwidth:1/0,bytesReceived:0,roundTripTime:a||0};n.bytesReceived=e.loaded;n.bandwidth=Math.floor(1e3*(8*(n.bytesReceived/n.roundTripTime)));return n},om=function(e,t){if(t.timedout){return{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:nm.TIMEOUT,xhr:t}}if(t.aborted){return{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:nm.ABORTED,xhr:t}}if(e){return{status:t.status,message:"HLS request errored at URL: "+t.uri,code:nm.FAILURE,xhr:t}}return null},lm=function(e,t){return function(a,n){var r=n.response,i=om(a,n);if(i){return t(i,e)}if(16!==r.byteLength){return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:nm.FAILURE,xhr:n},e)}var s=new DataView(r);e.key.bytes=new Uint32Array([s.getUint32(0),s.getUint32(4),s.getUint32(8),s.getUint32(12)]);return t(null,e)}},dm=function(e,t,a){return function(n,r){var i=r.response,s=om(n,r);if(s){return a(s,e)}if(0===i.byteLength){return a({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:nm.FAILURE,xhr:r},e)}e.map.bytes=new Uint8Array(r.response);if(t&&!t.isInitialized()){t.init()}e.map.timescales=Ed.timescale(e.map.bytes);e.map.videoTrackIds=Ed.videoTrackIds(e.map.bytes);return a(null,e)}},pm=function(e,t,a){return function(n,r){var i=r.response,s=om(n,r),o=void 0;if(s){return a(s,e)}if(0===i.byteLength){return a({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:nm.FAILURE,xhr:r},e)}e.stats=im(r);if(e.key){e.encryptedBytes=new Uint8Array(r.response)}else{e.bytes=new Uint8Array(r.response)}if(t&&e.map&&e.map.bytes){if(!t.isInitialized()){t.init()}o=t.parse(e.bytes,e.map.videoTrackIds,e.map.timescales);if(o&&o.captions){e.captionStreams=o.captionStreams;e.fmp4Captions=o.captions}}return a(null,e)}},um=function(e,t,a){e.addEventListener("message",function n(r){if(r.data.source===t.requestId){e.removeEventListener("message",n);var i=r.data.decrypted;t.bytes=new Uint8Array(i.bytes,i.byteOffset,i.byteLength);return a(null,t)}});var n;if(t.key.bytes.slice){n=t.key.bytes.slice()}else{n=new Uint32Array(Array.prototype.slice.call(t.key.bytes))}e.postMessage(Uu({source:t.requestId,encrypted:t.encryptedBytes,key:n,iv:t.key.iv}),[t.encryptedBytes.buffer,n.buffer])},cm=function(e,t,a){var n=0,r=!1;return function(i,s){if(r){return}if(i){r=!0;rm(e);return a(i,s)}n+=1;if(n===e.length){s.endOfAllRequests=Date.now();if(s.encryptedBytes){return um(t,s,a)}return a(null,s)}}},mm=function(e,t){return function(a){e.stats=Ze.mergeOptions(e.stats,sm(a));if(!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived){e.stats.firstBytesReceivedAt=Date.now()}return t(a,e)}},gm=function(e,t,a,n,r,i,s){var o=[],l=cm(o,a,s);if(r.key&&!r.key.bytes){var d=Ze.mergeOptions(t,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),p=lm(r,l),u=e(d,p);o.push(u)}if(r.map&&!r.map.bytes){var c=Ze.mergeOptions(t,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Au(r.map)}),m=dm(r,n,l),g=e(c,m);o.push(g)}var y=Ze.mergeOptions(t,{uri:r.resolvedUri,responseType:"arraybuffer",headers:Au(r)}),h=pm(r,n,l),_=e(y,h);_.addEventListener("progress",mm(r,i));o.push(_);return function(){return rm(o)}},ym=function(t,a){var n;if(!t){return""}n=e.getComputedStyle(t);if(!n){return""}return n[a]},hm=function(e,t){var a=e.slice();e.sort(function(e,n){var r=t(e,n);if(0===r){return a.indexOf(e)-a.indexOf(n)}return r})},_m=function(t,a){var n=void 0,r=void 0;if(t.attributes.BANDWIDTH){n=t.attributes.BANDWIDTH}n=n||e.Number.MAX_VALUE;if(a.attributes.BANDWIDTH){r=a.attributes.BANDWIDTH}r=r||e.Number.MAX_VALUE;return n-r},fm=function(t,a){var n=void 0,r=void 0;if(t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width){n=t.attributes.RESOLUTION.width}n=n||e.Number.MAX_VALUE;if(a.attributes.RESOLUTION&&a.attributes.RESOLUTION.width){r=a.attributes.RESOLUTION.width}r=r||e.Number.MAX_VALUE;if(n===r&&t.attributes.BANDWIDTH&&a.attributes.BANDWIDTH){return t.attributes.BANDWIDTH-a.attributes.BANDWIDTH}return n-r},Tm=function(t,a,n,r,i){var s=t.playlists.map(function(t){var a=void 0,n=void 0,r=void 0;a=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width;n=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height;r=t.attributes.BANDWIDTH;r=r||e.Number.MAX_VALUE;return{bandwidth:r,width:a,height:n,playlist:t}});hm(s,function(e,t){return e.bandwidth-t.bandwidth});s=s.filter(function(e){return!xu.isIncompatible(e.playlist)});var o=s.filter(function(e){return xu.isEnabled(e.playlist)});if(!o.length){o=s.filter(function(e){return!xu.isDisabled(e.playlist)})}var l=o.filter(function(e){return e.bandwidth*am.BANDWIDTH_VARIANCE<a}),d=l[l.length-1],p=l.filter(function(e){return e.bandwidth===d.bandwidth})[0];if(!1===i){var u=p||o[0]||s[0];return u?u.playlist:null}var c=l.filter(function(e){return e.width&&e.height});hm(c,function(e,t){return e.width-t.width});var m=c.filter(function(e){return e.width===n&&e.height===r});d=m[m.length-1];var g=m.filter(function(e){return e.bandwidth===d.bandwidth})[0],y=void 0,h=void 0,_=void 0;if(!g){y=c.filter(function(e){return e.width>n||e.height>r});h=y.filter(function(e){return e.width===y[0].width&&e.height===y[0].height});d=h[h.length-1];_=h.filter(function(e){return e.bandwidth===d.bandwidth})[0]}var f=_||g||p||o[0]||s[0];return f?f.playlist:null},bm=function(e){var t=e.master,a=e.currentTime,n=e.bandwidth,r=e.duration,i=e.segmentDuration,s=e.timeUntilRebuffer,o=e.currentTimeline,l=e.syncController,d=t.playlists.filter(function(e){return!xu.isIncompatible(e)}),p=d.filter(xu.isEnabled);if(!p.length){p=d.filter(function(e){return!xu.isDisabled(e)})}var u=p.filter(xu.hasAttribute.bind(null,"BANDWIDTH")),c=u.map(function(e){var t=l.getSyncPoint(e,r,o,a),d=t?1:2,p=xu.estimateSegmentRequestTime(i,n,e);return{playlist:e,rebufferingImpact:p*d-s}}),m=c.filter(function(e){return 0>=e.rebufferingImpact});hm(m,function(e,t){return _m(t.playlist,e.playlist)});if(m.length){return m[0]}hm(c,function(e,t){return e.rebufferingImpact-t.rebufferingImpact});return c[0]||null},vm=function(e,t,a){for(var n in a){if(!e[n]){t.trigger({type:"usage",name:"hls-608"});var r=t.textTracks().getTrackById(n);if(r){e[n]=r}else{e[n]=t.addRemoteTextTrack({kind:"captions",id:n,label:n},!1).track}}}},Sm=function(e){var t=e.inbandTextTracks,a=e.captionArray,n=e.timestampOffset;if(!a){return}var r=window.WebKitDataCue||window.VTTCue;a.forEach(function(e){var a=e.stream,i=e.startTime,s=e.endTime;if(!t[a]){return}i+=n;s+=n;t[a].addCue(new r(i,s,e.text))})},km=function(e,t,a){if(!e||!t){return!1}var n=e.segments,r=a===n.length;return e.endList&&"open"===t.readyState&&r},Cm=function(e){return"number"==typeof e&&isFinite(e)},Em=function(e,t,a){if("main"!==e||!t||!a){return null}if(!a.containsAudio&&!a.containsVideo){return"Neither audio nor video found in segment."}if(t.containsVideo&&!a.containsVideo){return"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."}if(!t.containsVideo&&a.containsVideo){return"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."}return null},Im=function(e,t,a){var n=t-30;if(e.length){n=Math.max(n,e.start(0))}return Math.min(t-a,n)},xm=function(e){var t=e.segment,a=t.start,n=t.end,r=e.playlist,i=r.mediaSequence,s=r.id,o=r.segments,l=o===void 0?[]:o,d=e.mediaIndex,p=e.timeline;return["appending ["+d+"] of ["+i+", "+(i+l.length)+"] from playlist ["+s+"]","["+a+" => "+n+"] in timeline ["+p+"]"].join(" ")},Lm=function(t){Gp(a,t);function a(e){Vp(this,a);var t=Kp(this,(a.__proto__||Object.getPrototypeOf(a)).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")}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_={};if("main"===t.loaderType_){t.captionParser_=new Kd}else{t.captionParser_=null}t.decrypter_=e.decrypter;t.syncController_=e.syncController;t.syncPoint_={segmentIndex:0,time:0};t.triggerSyncInfoUpdate_=function(){return t.trigger("syncinfoupdate")};t.syncController_.on("syncinfoupdate",t.triggerSyncInfoUpdate_);t.mediaSource_.addEventListener("sourceopen",function(){return t.ended_=!1});t.fetchAtBuffer_=!1;t.logger_=em("SegmentLoader["+t.loaderType_+"]");Object.defineProperty(t,"state",{get:function(){return this.state_},set:function(e){if(e!==this.state_){this.logger_(this.state_+" -> "+e);this.state_=e}}});return t}Wp(a,[{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.trigger("dispose");this.state="DISPOSED";this.pause();this.abort_();if(this.sourceUpdater_){this.sourceUpdater_.dispose()}this.resetStats_();if(this.captionParser_){this.captionParser_.reset()}if(this.checkBufferTimeout_){e.clearTimeout(this.checkBufferTimeout_)}if(this.syncController_&&this.triggerSyncInfoUpdate_){this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_)}this.off()}},{key:"abort",value:function(){if("WAITING"!==this.state){if(this.pendingSegment_){this.pendingSegment_=null}return}this.abort_();this.state="READY";if(!this.paused()){this.monitorBuffer_()}}},{key:"abort_",value:function(){if(this.pendingSegment_){this.pendingSegment_.abortRequests()}this.pendingSegment_=null}},{key:"error",value:function(e){if("undefined"!=typeof e){this.error_=e}this.pendingSegment_=null;return this.error_}},{key:"endOfStream",value:function(){this.ended_=!0;this.pause();this.trigger("ended")}},{key:"buffered_",value:function(){if(!this.sourceUpdater_){return Ze.createTimeRanges()}return this.sourceUpdater_.buffered()}},{key:"initSegment",value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:!1;if(!e){return null}var a=Mu(e),n=this.initSegments_[a];if(t&&!n&&e.bytes){this.initSegments_[a]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,timescales:e.timescales,videoTrackIds:e.videoTrackIds}}return n||e}},{key:"segmentKey",value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:!1;if(!e){return null}var a=Bu(e),n=this.keyCache_[a];if(this.cacheEncryptionKeys_&&t&&!n&&e.bytes){this.keyCache_[a]=n={resolvedUri:e.resolvedUri,bytes:e.bytes}}var r={resolvedUri:(n||e).resolvedUri};if(n){r.bytes=n.bytes}return r}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&(this.sourceUpdater_||this.mimeType_&&"INIT"===this.state)&&!this.paused()}},{key:"load",value:function(){this.monitorBuffer_();if(!this.playlist_){return}this.syncController_.setDateTimeMapping(this.playlist_);if("INIT"===this.state&&this.couldBeginLoading_()){return this.init_()}if(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state){return}this.state="READY"}},{key:"init_",value:function(){this.state="READY";this.sourceUpdater_=new tm(this.mediaSource_,this.mimeType_,this.loaderType_,this.sourceBufferEmitter_);this.resetEverything();return this.monitorBuffer_()}},{key:"playlist",value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};if(!e){return}var a=this.playlist_,n=this.pendingSegment_;this.playlist_=e;this.xhrOptions_=t;if("INIT"===this.state){e.syncInfo={mediaSequence:e.mediaSequence,time:0}}var r=null;if(a){if(a.id){r=a.id}else if(a.uri){r=a.uri}}this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]");this.trigger("syncinfoupdate");if("INIT"===this.state&&this.couldBeginLoading_()){return this.init_()}if(!a||a.uri!==e.uri){if(null!==this.mediaIndex){this.resyncLoader()}return}var i=e.mediaSequence-a.mediaSequence;this.logger_("live window shift ["+i+"]");if(null!==this.mediaIndex){this.mediaIndex-=i}if(n){n.mediaIndex-=i;if(0<=n.mediaIndex){n.segment=e.segments[n.mediaIndex]}}this.syncController_.saveExpiredSegmentInfo(a,e)}},{key:"pause",value:function(){if(this.checkBufferTimeout_){e.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=null}}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(e,t){if(this.mimeType_){return}this.mimeType_=e;this.sourceBufferEmitter_=t;if("INIT"===this.state&&this.couldBeginLoading_()){this.init_()}}},{key:"resetEverything",value:function(e){this.ended_=!1;this.resetLoader();this.remove(0,1/0,e);if(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,a){if(t===1/0){t=this.duration_()}if(this.sourceUpdater_){this.sourceUpdater_.remove(e,t,a)}oc(e,t,this.segmentMetadataTrack_);if(this.inbandTextTracks_){for(var n in this.inbandTextTracks_){oc(e,t,this.inbandTextTracks_[n])}}}},{key:"monitorBuffer_",value:function(){if(this.checkBufferTimeout_){e.clearTimeout(this.checkBufferTimeout_)}this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){if("READY"===this.state){this.fillBuffer_()}if(this.checkBufferTimeout_){e.clearTimeout(this.checkBufferTimeout_)}this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(this.sourceUpdater_.updating()){return}if(!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_);if(!e){return}if(this.isEndOfStream_(e.mediaIndex)){this.endOfStream();return}if(e.mediaIndex===this.playlist_.segments.length-1&&"ended"===this.mediaSource_.readyState&&!this.seeking_()){return}if(e.timeline!==this.currentTimeline_){this.syncController_.reset();e.timestampOffset=e.startOfSegment;if(this.captionParser_){this.captionParser_.clearAllCaptions()}}this.loadSegment_(e)}},{key:"isEndOfStream_",value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:this.playlist_;return km(t,this.mediaSource_,e)&&!this.sourceUpdater_.updating()}},{key:"checkBuffer_",value:function(e,t,a,n,r,i){var s=0,o=void 0;if(e.length){s=e.end(e.length-1)}var l=Math.max(0,s-r);if(!t.segments.length){return null}if(l>=this.goalBufferLength_()){return null}if(!n&&1<=l){return null}if(null===i){a=this.getSyncSegmentCandidate_(t);return this.generateSegmentInfo_(t,a,null,!0)}if(null!==a){t.segments[a];o=s;return this.generateSegmentInfo_(t,a+1,o,!1)}if(this.fetchAtBuffer_){var d=xu.getMediaInfoForTime(t,s,i.segmentIndex,i.time);a=d.mediaIndex;o=d.startTime}else{var p=xu.getMediaInfoForTime(t,r,i.segmentIndex,i.time);a=p.mediaIndex;o=p.startTime}return this.generateSegmentInfo_(t,a,o,!1)}},{key:"getSyncSegmentCandidate_",value:function(e){var t=this;if(-1===this.currentTimeline_){return 0}var a=e.segments.map(function(e,t){return{timeline:e.timeline,segmentIndex:t}}).filter(function(e){return e.timeline===t.currentTimeline_});if(a.length){return a[Math.min(a.length-1,1)].segmentIndex}return Math.max(e.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(e,t,a,n){if(0>t||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:a,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(1e3>Date.now()-(e.firstBytesReceivedAt||Date.now())){return!1}var t=this.currentTime_(),a=e.bandwidth,n=this.pendingSegment_.duration,r=xu.estimateSegmentRequestTime(n,a,this.playlist_,e.bytesReceived),i=rc(this.buffered_(),t,this.hls_.tech_.playbackRate())-1;if(r<=i){return!1}var s=bm({master:this.hls_.playlists.master,currentTime:t,bandwidth:a,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:i,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!s){return}var o=r-i-s.rebufferingImpact,l=.5;if(i<=Qu){l=1}if(!s.playlist||s.playlist.uri===this.playlist_.uri||o<l){return!1}this.bandwidth=s.playlist.attributes.BANDWIDTH*am.BANDWIDTH_VARIANCE+1;this.abort();this.trigger("earlyabort");return!0}},{key:"handleProgress_",value:function(e,t){if(!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId||this.abortRequestEarly_(t.stats)){return}this.trigger("progress")}},{key:"loadSegment_",value:function(e){this.state="WAITING";this.pendingSegment_=e;this.trimBackBuffer_(e);e.abortRequests=gm(this.hls_.xhr,this.xhrOptions_,this.decrypter_,this.captionParser_,this.createSimplifiedSegmentObj_(e),this.handleProgress_.bind(this),this.segmentRequestFinished_.bind(this))}},{key:"trimBackBuffer_",value:function(){var e=Im(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);if(0<e){this.remove(0,e)}}},{key:"createSimplifiedSegmentObj_",value:function(e){var t=e.segment,a={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]);a.key=this.segmentKey(t.key);a.key.iv=n}if(t.map){a.map=this.initSegment(t.map)}return a}},{key:"segmentRequestFinished_",value:function(e,t){this.mediaRequests+=1;if(t.stats){this.mediaBytesTransferred+=t.stats.bytesReceived;this.mediaTransferDuration+=t.stats.roundTripTime}if(!this.pendingSegment_){this.mediaRequestsAborted+=1;return}if(t.requestId!==this.pendingSegment_.requestId){return}if(e){this.pendingSegment_=null;this.state="READY";if(e.code===nm.ABORTED){this.mediaRequestsAborted+=1;return}this.pause();if(e.code===nm.TIMEOUT){this.mediaRequestsTimedout+=1;this.bandwidth=1;this.roundTrip=NaN;this.trigger("bandwidthupdate");return}this.mediaRequestsErrored+=1;this.error(e);this.trigger("error");return}this.bandwidth=t.stats.bandwidth;this.roundTrip=t.stats.roundTripTime;if(t.map){t.map=this.initSegment(t.map,!0)}if(t.key){this.segmentKey(t.key,!0)}this.processSegmentResponse_(t)}},{key:"processSegmentResponse_",value:function(e){var t=this.pendingSegment_;t.bytes=e.bytes;if(e.map){t.segment.map.bytes=e.map.bytes}t.endOfAllRequests=e.endOfAllRequests;if(e.fmp4Captions){vm(this.inbandTextTracks_,this.hls_.tech_,e.captionStreams);Sm({inbandTextTracks:this.inbandTextTracks_,captionArray:e.fmp4Captions,timestampOffset:0});if(this.captionParser_){this.captionParser_.clearParsedCaptions()}}this.handleSegment_()}},{key:"handleSegment_",value:function(){var e=this;if(!this.pendingSegment_){this.state="READY";return}var t=this.pendingSegment_,a=t.segment,n=this.syncController_.probeSegmentInfo(t);if("undefined"==typeof this.startingMedia_&&n&&(n.containsAudio||n.containsVideo)){this.startingMedia_={containsAudio:n.containsAudio,containsVideo:n.containsVideo}}var r=Em(this.loaderType_,this.startingMedia_,n);if(r){this.error({message:r,blacklistDuration:1/0});this.trigger("error");return}if(t.isSyncRequest){this.trigger("syncinfoupdate");this.pendingSegment_=null;this.state="READY";return}if(null!==t.timestampOffset&&t.timestampOffset!==this.sourceUpdater_.timestampOffset()){if(n&&n.segmentTimestampInfo){var i=n.segmentTimestampInfo[0].ptsTime,s=n.segmentTimestampInfo[0].dtsTime;t.timestampOffset-=i-s}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";if(a.map){var l=Mu(a.map);if(!this.activeInitSegmentId_||this.activeInitSegmentId_!==l){var d=this.initSegment(a.map);this.sourceUpdater_.appendBuffer({bytes:d.bytes},function(){e.activeInitSegmentId_=l})}}t.byteLength=t.bytes.byteLength;if("number"==typeof a.start&&"number"==typeof a.end){this.mediaSecondsLoaded+=a.end-a.start}else{this.mediaSecondsLoaded+=a.duration}this.logger_(xm(t));this.sourceUpdater_.appendBuffer({bytes:t.bytes,videoSegmentTimingInfoCallback:this.handleVideoSegmentTimingInfo_.bind(this,t.requestId)},this.handleUpdateEnd_.bind(this))}},{key:"handleVideoSegmentTimingInfo_",value:function(e,t){if(!this.pendingSegment_||e!==this.pendingSegment_.requestId){return}var a=this.pendingSegment_.segment;if(!a.videoTimingInfo){a.videoTimingInfo={}}a.videoTimingInfo.transmuxerPrependedSeconds=t.videoSegmentTimingInfo.prependedContentDuration||0;a.videoTimingInfo.transmuxedPresentationStart=t.videoSegmentTimingInfo.start.presentation;a.videoTimingInfo.transmuxedPresentationEnd=t.videoSegmentTimingInfo.end.presentation;a.videoTimingInfo.baseMediaDecodeTime=t.videoSegmentTimingInfo.baseMediaDecodeTime}},{key:"handleUpdateEnd_",value:function(){if(!this.pendingSegment_){this.state="READY";if(!this.paused()){this.monitorBuffer_()}return}var e=this.pendingSegment_,t=e.segment,a=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");if(t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration){this.resetEverything();return}if(a){this.trigger("bandwidthupdate")}this.trigger("progress");if(this.isEndOfStream_(e.mediaIndex+1,e.playlist)){this.endOfStream()}if(!this.paused()){this.monitorBuffer_()}}},{key:"recordThroughput_",value:function(e){var t=this.throughput.rate,a=Date.now()-e.endOfAllRequests+1,n=Math.floor(1e3*(8*(e.byteLength/a)));this.throughput.rate+=(n-t)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(t){if(!this.segmentMetadataTrack_){return}var a=t.segment,n=a.start,r=a.end;if(!Cm(n)||!Cm(r)){return}oc(n,r,this.segmentMetadataTrack_);var i=e.WebKitDataCue||e.VTTCue,s={custom:a.custom,dateTimeObject:a.dateTimeObject,dateTimeString:a.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.id,start:n,end:r},o=JSON.stringify(s),l=new i(n,r,o);l.value=s;this.segmentMetadataTrack_.addCue(l)}}]);return a}(Ze.EventTarget),Pm=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},Dm=new Uint8Array(["\n","\n"].map(function(e){return e.charCodeAt(0)})),wm=function(t){Gp(a,t);function a(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};Vp(this,a);var n=Kp(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e,t));n.mediaSource_=null;n.subtitlesTrack_=null;n.featuresNativeTextTracks_=e.featuresNativeTextTracks;return n}Wp(a,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length){return Ze.createTimeRanges()}var e=this.subtitlesTrack_.cues,t=e[0].startTime,a=e[e.length-1].startTime;return Ze.createTimeRanges([[t,a]])}},{key:"initSegment",value:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:!1;if(!e){return null}var a=Mu(e),n=this.initSegments_[a];if(t&&!n&&e.bytes){var r=Dm.byteLength+e.bytes.byteLength,i=new Uint8Array(r);i.set(e.bytes);i.set(Dm,e.bytes.byteLength);this.initSegments_[a]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:i}}return n||e}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){this.state="READY";this.resetEverything();return this.monitorBuffer_()}},{key:"track",value:function(e){if("undefined"==typeof e){return this.subtitlesTrack_}this.subtitlesTrack_=e;if("INIT"===this.state&&this.couldBeginLoading_()){this.init_()}return this.subtitlesTrack_}},{key:"remove",value:function(e,t){oc(e,t,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var e=this;if(!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_);t=this.skipEmptySegments_(t);if(!t){return}if(null===this.syncController_.timestampOffsetForTimeline(t.timeline)){var a=function(){e.state="READY";if(!e.paused()){e.monitorBuffer_()}};this.syncController_.one("timestampoffset",a);this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(t)}},{key:"skipEmptySegments_",value:function(e){while(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="READY";return}this.state="APPENDING";var a=this.pendingSegment_,n=a.segment;if("function"!=typeof e.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var r=void 0,i=function(){t.subtitlesTrack_.tech_.off("vttjsloaded",r);t.error({message:"Error loading vtt.js"});t.state="READY";t.pause();t.trigger("error")};r=function(){t.subtitlesTrack_.tech_.off("vttjserror",i);t.handleSegment_()};this.state="WAITING_ON_VTTJS";this.subtitlesTrack_.tech_.one("vttjsloaded",r);this.subtitlesTrack_.tech_.one("vttjserror",i);return}n.requested=!0;try{this.parseVTTCues_(a)}catch(t){this.error({message:t.message});this.state="READY";this.pause();return this.trigger("error")}this.updateTimeMapping_(a,this.syncController_.timelines[a.timeline],this.playlist_);if(a.isSyncRequest){this.trigger("syncinfoupdate");this.pendingSegment_=null;this.state="READY";return}a.byteLength=a.bytes.byteLength;this.mediaSecondsLoaded+=n.duration;if(a.cues.length){this.remove(a.cues[0].endTime,a.cues[a.cues.length-1].endTime)}a.cues.forEach(function(a){t.subtitlesTrack_.addCue(t.featuresNativeTextTracks_?new e.VTTCue(a.startTime,a.endTime,a.text):a)});this.handleUpdateEnd_()}},{key:"parseVTTCues_",value:function(t){var a=void 0,n=!1;if("function"==typeof e.TextDecoder){a=new e.TextDecoder("utf8")}else{a=e.WebVTT.StringDecoder();n=!0}var r=new e.WebVTT.Parser(e,e.vttjs,a);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){Ze.log.warn("Error encountered when parsing cues: "+e.message)};if(t.segment.map){var i=t.segment.map.bytes;if(n){i=Pm(i)}r.parse(i)}var s=t.bytes;if(n){s=Pm(s)}r.parse(s);r.flush()}},{key:"updateTimeMapping_",value:function(e,t,a){var n=e.segment;if(!t){return}if(!e.cues.length){n.empty=!0;return}var r=e.timestampmap,i=r.MPEGTS/9e4-r.LOCAL+t.mapping;e.cues.forEach(function(e){e.startTime+=i;e.endTime+=i});if(!a.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;a.syncInfo={mediaSequence:a.mediaSequence+e.mediaIndex,time:Math.min(s,o-n.duration)}}}}]);return a}(Lm),Am=function(e,t){for(var a=e.cues,n=0,r;n<a.length;n++){r=a[n];if(t>=r.adStartTime&&t<=r.adEndTime){return r}}return null},Om=function(t,a){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:0;if(!t.segments){return}for(var r=n,s=void 0,o=0,l;o<t.segments.length;o++){l=t.segments[o];if(!s){s=Am(a,r+l.duration/2)}if(s){if("cueIn"in l){s.endTime=r;s.adEndTime=r;r+=l.duration;s=null;continue}if(r<s.endTime){r+=l.duration;continue}s.endTime+=l.duration}else{if("cueOut"in l){s=new e.VTTCue(r,r+l.duration,l.cueOut);s.adStartTime=r;s.adEndTime=r+parseFloat(l.cueOut);a.addCue(s)}if("cueOutCont"in l){var d=void 0,p=void 0,u=l.cueOutCont.split("/").map(parseFloat),c=Yp(u,2);d=c[0];p=c[1];s=new e.VTTCue(r,r+l.duration,"");s.adStartTime=r-d;s.adEndTime=s.adStartTime+p;a.addCue(s)}}r+=l.duration}},Rm={inspect:function(e,t){var a=Tp.aac.isLikelyAacData(e),n;if(a){n=xp(e)}else{n=Lp(e)}if(!n||!n.audio&&!n.video){return null}Ip(n,t);return n},parseAudioPes_:Cp}.inspect,Nm=[{name:"VOD",run:function(e,t,a){if(a!==1/0){return{time:0,segmentIndex:0}}return null}},{name:"ProgramDateTime",run:function(e,t,a,n,r){if(!e.datetimeToDisplayTime){return null}var s=t.segments||[],o=null,l=null;r=r||0;for(var d=0,p;d<s.length;d++){p=s[d];if(p.dateTimeObject){var u=p.dateTimeObject.getTime()/1e3,c=u+e.datetimeToDisplayTime,m=Math.abs(r-c);if(null!==l&&(0===m||l<m)){break}l=m;o={time:c,segmentIndex:d}}}return o}},{name:"Segment",run:function(e,t,a,n,r){var s=t.segments||[],o=null,l=null;r=r||0;for(var d=0,p;d<s.length;d++){p=s[d];if(p.timeline===n&&"undefined"!=typeof p.start){var u=Math.abs(r-p.start);if(null!==l&&l<u){break}if(!o||null===l||l>=u){l=u;o={time:p.start,segmentIndex:d}}}}return o}},{name:"Discontinuity",run:function(e,t,a,n,r){var s=null;r=r||0;if(t.discontinuityStarts&&t.discontinuityStarts.length){for(var o=null,l=0;l<t.discontinuityStarts.length;l++){var d=t.discontinuityStarts[l],p=t.discontinuitySequence+l+1,u=e.discontinuities[p];if(u){var c=Math.abs(r-u.time);if(null!==o&&o<c){break}if(!s||null===o||o>=c){o=c;s={time:u.time,segmentIndex:d}}}}}return s}},{name:"Playlist",run:function(e,t){if(t.syncInfo){var a={time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence};return a}return null}}],Um=function(e){Gp(t,e);function t(){Vp(this,t);var e=Kp(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));e.inspectCache_=void 0;e.timelines=[];e.discontinuities=[];e.datetimeToDisplayTime=null;e.logger_=em("SyncController");return e}Wp(t,[{key:"getSyncPoint",value:function(e,t,a,n){var r=this.runStrategies_(e,t,a,n);if(!r.length){return null}return this.selectSyncPoint_(r,{key:"time",value:n})}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments){return null}var a=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!a.length){return null}var n=this.selectSyncPoint_(a,{key:"segmentIndex",value:0});if(0<n.segmentIndex){n.time*=-1}return Math.abs(n.time+cu(e,n.segmentIndex,0))}},{key:"runStrategies_",value:function(e,t,a,n){for(var r=[],s=0;s<Nm.length;s++){var o=Nm[s],l=o.run(this,e,t,a,n);if(l){l.strategy=o.name;r.push({strategy:o.name,syncPoint:l})}}return r}},{key:"selectSyncPoint_",value:function(e,t){for(var a=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,s=1,o;s<e.length;s++){o=Math.abs(e[s].syncPoint[t.key]-t.value);if(o<n){n=o;a=e[s].syncPoint;r=e[s].strategy}}this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy"+(" ["+r+"]: [time:"+a.time+",")+(" segmentIndex:"+a.segmentIndex+"]"));return a}},{key:"saveExpiredSegmentInfo",value:function(e,t){for(var a=t.mediaSequence-e.mediaSequence,n=a-1,r;0<=n;n--){r=e.segments[n];if(r&&"undefined"!=typeof r.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.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=e.segment,a=e.playlist,n=void 0;if(t.map){n=this.probeMp4Segment_(e)}else{n=this.probeTsSegment_(e)}if(n){if(this.calculateSegmentTimeMapping_(e,n)){this.saveDiscontinuitySyncInfo_(e);if(!a.syncInfo){a.syncInfo={mediaSequence:a.mediaSequence+e.mediaIndex,time:t.start}}}}return n}},{key:"probeMp4Segment_",value:function(e){var t=e.segment,a=Ed.timescale(t.map.bytes),n=Ed.compositionStartTime(a,e.bytes);if(null!==e.timestampOffset){e.timestampOffset-=n}return{start:n,end:n+t.duration}}},{key:"probeTsSegment_",value:function(e){var t=Rm(e.bytes,this.inspectCache_),a=void 0,n=void 0,r=void 0;if(!t){return null}if(t.video&&2===t.video.length){this.inspectCache_=t.video[1].dts;a=t.video[0].dtsTime;n=t.video[1].dtsTime;r=t.video}else if(t.audio&&2===t.audio.length){this.inspectCache_=t.audio[1].dts;a=t.audio[0].dtsTime;n=t.audio[1].dtsTime;r=t.audio}var i={segmentTimestampInfo:r,start:a,end:n,containsVideo:t.video&&2===t.video.length,containsAudio:t.audio&&2===t.audio.length};return i}},{key:"timestampOffsetForTimeline",value:function(e){if("undefined"==typeof this.timelines[e]){return null}return this.timelines[e].time}},{key:"mappingForTimeline",value:function(e){if("undefined"==typeof this.timelines[e]){return null}return this.timelines[e].mapping}},{key:"calculateSegmentTimeMapping_",value:function(e,t){var a=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+"]"));a.start=e.startOfSegment;a.end=t.end+n.mapping}else if(n){a.start=t.start+n.mapping;a.end=t.end+n.mapping}else{return!1}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(e){var t=e.playlist,a=e.segment;if(a.discontinuity){this.discontinuities[a.timeline]={time:a.start,accuracy:0}}else if(t.discontinuityStarts&&t.discontinuityStarts.length){for(var n=0;n<t.discontinuityStarts.length;n++){var r=t.discontinuityStarts[n],s=t.discontinuitySequence+n+1,o=r-e.mediaIndex,l=Math.abs(o);if(!this.discontinuities[s]||this.discontinuities[s].accuracy>l){var d=void 0;if(0>o){d=a.start-cu(t,e.mediaIndex,r)}else{d=a.end+cu(t,e.mediaIndex+1,r)}this.discontinuities[s]={time:d,accuracy:l}}}}}},{key:"dispose",value:function(){this.trigger("dispose");this.off()}}]);return t}(Ze.EventTarget),Mm=new oa("./decrypter-worker.worker.js",function(){var e=this,t=function(){function t(e){return e.subarray(0,e.byteLength-e[e.byteLength-1])}var a=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}},n=function(){function e(e,t){for(var a=0,n;a<t.length;a++){n=t[a];n.enumerable=n.enumerable||!1;n.configurable=!0;if("value"in n)n.writable=!0;Object.defineProperty(e,n.key,n)}}return function(t,a,n){if(a)e(t.prototype,a);if(n)e(t,n);return t}}(),r=function(e,t){if("function"!=typeof t&&null!==t){throw new TypeError("Super expression must either be null or a function, not "+_typeof2(t))}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t},i=function(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&("object"===_typeof2(t)||"function"==typeof t)?t:e},s=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],a=e[1],n=t[4],r=a[4],o=void 0,l=void 0,p=void 0,u=[],d=[],c=void 0,m=void 0,g=void 0,y=void 0,h=void 0,_=void 0;for(o=0;256>o;o++){d[(u[o]=o<<1^283*(o>>7))^o]=o}for(l=p=0;!n[l];l^=c||1,p=d[p]||1){y=p^p<<1^p<<2^p<<3^p<<4;y=99^(y>>8^255&y);n[l]=y;r[y]=l;g=u[m=u[c=u[l]]];_=16843009*g^65537*m^257*c^16843008*l;h=257*u[y]^16843008*y;for(o=0;4>o;o++){t[o][l]=h=h<<24^h>>>8;a[o][y]=_=_<<24^_>>>8}}for(o=0;5>o;o++){t[o]=t[o].slice(0);a[o]=a[o].slice(0)}return e},o=null,l=function(){function e(t){a(this,e);if(!o){o=s()}this._tables=[[o[0][0].slice(),o[0][1].slice(),o[0][2].slice(),o[0][3].slice(),o[0][4].slice()],[o[1][0].slice(),o[1][1].slice(),o[1][2].slice(),o[1][3].slice(),o[1][4].slice()]];var n=void 0,r=void 0,l=void 0,d=void 0,p=void 0,u=this._tables[0][4],c=this._tables[1],m=t.length,g=1;if(4!==m&&6!==m&&8!==m){throw new Error("Invalid aes key size")}d=t.slice(0);p=[];this._key=[d,p];for(n=m;n<4*m+28;n++){l=d[n-1];if(0==n%m||8===m&&4==n%m){l=u[l>>>24]<<24^u[255&l>>16]<<16^u[255&l>>8]<<8^u[255&l];if(0==n%m){l=l<<8^l>>>24^g<<24;g=g<<1^283*(g>>7)}}d[n]=d[n-m]^l}for(r=0;n;r++,n--){l=d[3&r?n:n-4];if(4>=n||4>r){p[r]=l}else{p[r]=c[0][u[l>>>24]]^c[1][u[255&l>>16]]^c[2][u[255&l>>8]]^c[3][u[255&l]]}}}e.prototype.decrypt=function(e,t,n,r,s,o){var l=this._key[1],p=e^l[0],u=r^l[1],m=n^l[2],g=t^l[3],y=void 0,h=void 0,_=void 0,f=l.length/4-2,T=void 0,v=4,S=this._tables[1],k=S[0],C=S[1],E=S[2],I=S[3],x=S[4];for(T=0;T<f;T++){y=k[p>>>24]^C[255&u>>16]^E[255&m>>8]^I[255&g]^l[v];h=k[u>>>24]^C[255&m>>16]^E[255&g>>8]^I[255&p]^l[v+1];_=k[m>>>24]^C[255&g>>16]^E[255&p>>8]^I[255&u]^l[v+2];g=k[g>>>24]^C[255&p>>16]^E[255&u>>8]^I[255&m]^l[v+3];v+=4;p=y;u=h;m=_}for(T=0;4>T;T++){s[(3&-T)+o]=x[p>>>24]<<24^x[255&u>>16]<<16^x[255&m>>8]<<8^x[255&g]^l[v++];y=p;p=u;u=m;m=g;g=y}};return e}(),d=function(){function e(){a(this,e);this.listeners={}}e.prototype.on=function(e,t){if(!this.listeners[e]){this.listeners[e]=[]}this.listeners[e].push(t)};e.prototype.off=function(e,t){if(!this.listeners[e]){return!1}var a=this.listeners[e].indexOf(t);this.listeners[e].splice(a,1);return-1<a};e.prototype.trigger=function(e){var t=this.listeners[e];if(!t){return}if(2===arguments.length){for(var a=t.length,n=0;n<a;++n){t[n].call(this,arguments[1])}}else{for(var r=Array.prototype.slice.call(arguments,1),s=t.length,o=0;o<s;++o){t[o].apply(this,r)}}};e.prototype.dispose=function(){this.listeners={}};e.prototype.pipe=function(e){this.on("data",function(t){e.push(t)})};return e}(),p=function(e){r(t,e);function t(){a(this,t);var n=i(this,e.call(this,d));n.jobs=[];n.delay=1;n.timeout_=null;return n}t.prototype.processJob_=function(){this.jobs.shift()();if(this.jobs.length){this.timeout_=setTimeout(this.processJob_.bind(this),this.delay)}else{this.timeout_=null}};t.prototype.push=function(e){this.jobs.push(e);if(!this.timeout_){this.timeout_=setTimeout(this.processJob_.bind(this),this.delay)}};return t}(d),u=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},c=function(e,t,a){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),r=new l(Array.prototype.slice.call(t)),i=new Uint8Array(e.byteLength),s=new Int32Array(i.buffer),o=void 0,d=void 0,p=void 0,c=void 0,m=void 0,g=void 0,y=void 0,h=void 0,_=void 0;o=a[0];d=a[1];p=a[2];c=a[3];for(_=0;_<n.length;_+=4){m=u(n[_]);g=u(n[_+1]);y=u(n[_+2]);h=u(n[_+3]);r.decrypt(m,g,y,h,s,_);s[_]=u(s[_]^o);s[_+1]=u(s[_+1]^d);s[_+2]=u(s[_+2]^p);s[_+3]=u(s[_+3]^c);o=m;d=g;p=y;c=h}return i},m=function(){function e(n,r,s,o){a(this,e);var l=e.STEP,d=new Int32Array(n.buffer),c=new Uint8Array(n.byteLength),m=0;this.asyncStream_=new p;this.asyncStream_.push(this.decryptChunk_(d.subarray(m,m+l),r,s,c));for(m=l;m<d.length;m+=l){s=new Uint32Array([u(d[m-4]),u(d[m-3]),u(d[m-2]),u(d[m-1])]);this.asyncStream_.push(this.decryptChunk_(d.subarray(m,m+l),r,s,c))}this.asyncStream_.push(function(){o(null,t(c))})}e.prototype.decryptChunk_=function(e,t,a,n){return function(){var r=c(e,t,a);n.set(r,e.byteOffset)}};n(e,null,[{key:"STEP",get:function(){return 32e3}}]);return e}(),g=function(e){var t={};Object.keys(e).forEach(function(a){var n=e[a];if(ArrayBuffer.isView(n)){t[a]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}}else{t[a]=n}});return t},y=new function(e){e.onmessage=function(t){var a=t.data,n=new Uint8Array(a.encrypted.bytes,a.encrypted.byteOffset,a.encrypted.byteLength),r=new Uint32Array(a.key.bytes,a.key.byteOffset,a.key.byteLength/4),i=new Uint32Array(a.iv.bytes,a.iv.byteOffset,a.iv.byteLength/4);new m(n,r,i,function(t,n){e.postMessage(g({source:a.source,decrypted:n}),[n.buffer])})}}(e);return y}()}),Bm=function(e){var t=e["default"]?"main":"alternative";if(e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")){t="main-desc"}return t},jm=function(e,t){e.abort();e.pause();if(t&&t.activePlaylistLoader){t.activePlaylistLoader.pause();t.activePlaylistLoader=null}},Fm=function(e,t){t.activePlaylistLoader=e;e.load()},Hm=function(e,t){return function(){var a=t.segmentLoaders,n=a[e],r=a.main,i=t.mediaTypes[e],s=i.activeTrack(),o=i.activeGroup(s),l=i.activePlaylistLoader;jm(n,i);if(!o){return}if(!o.playlistLoader){if(l){r.resetEverything()}return}n.resyncLoader();Fm(o.playlistLoader,i)}},qm=function(e,t){return function(){var a=t.segmentLoaders,n=a[e],r=a.main,i=t.mediaTypes[e],s=i.activeTrack(),o=i.activeGroup(s),l=i.activePlaylistLoader;jm(n,i);if(!o){return}if(!o.playlistLoader){r.resetEverything();return}if(l===o.playlistLoader){Fm(o.playlistLoader,i);return}if(n.track){n.track(s)}n.resetEverything();Fm(o.playlistLoader,i)}},Vm={AUDIO:function(e,t){return function(){var a=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;jm(a,n);var i=n.activeTrack(),s=n.activeGroup(),o=(s.filter(function(e){return e["default"]})[0]||s[0]).id,l=n.tracks[o];if(i===l){r({message:"Problem encountered loading the default audio track."});return}Ze.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(var d in n.tracks){n.tracks[d].enabled=n.tracks[d]===l}n.onTrackChanged()}},SUBTITLES:function(e,t){return function(){var a=t.segmentLoaders[e],n=t.mediaTypes[e];Ze.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");jm(a,n);var r=n.activeTrack();if(r){r.mode="disabled"}n.onTrackChanged()}}},Wm={AUDIO:function(e,t,a){if(!t){return}var n=a.tech,r=a.requestOptions,i=a.segmentLoaders[e];t.on("loadedmetadata",function(){var e=t.media();i.playlist(e,r);if(!n.paused()||e.endList&&"none"!==n.preload()){i.load()}});t.on("loadedplaylist",function(){i.playlist(t.media(),r);if(!n.paused()){i.load()}});t.on("error",Vm[e](e,a))},SUBTITLES:function(e,t,a){var n=a.tech,r=a.requestOptions,i=a.segmentLoaders[e],s=a.mediaTypes[e];t.on("loadedmetadata",function(){var e=t.media();i.playlist(e,r);i.track(s.activeTrack());if(!n.paused()||e.endList&&"none"!==n.preload()){i.load()}});t.on("loadedplaylist",function(){i.playlist(t.media(),r);if(!n.paused()){i.load()}});t.on("error",Vm[e](e,a))}},zm={AUDIO:function(e,t){var a=t.hls,n=t.sourceType,r=t.segmentLoaders[e],i=t.requestOptions,s=t.master.mediaGroups,o=t.mediaTypes[e],l=o.groups,d=o.tracks,p=t.masterPlaylistLoader;if(!s[e]||0===Object.keys(s[e]).length){s[e]={main:{default:{default:!0}}}}for(var u in s[e]){if(!l[u]){l[u]=[]}for(var c in s[e][u]){var m=s[e][u][c],g=void 0;if(m.resolvedUri){g=new su(m.resolvedUri,a,i)}else if(m.playlists&&"dash"===n){g=new Zc(m.playlists[0],a,i,p)}else{g=null}m=Ze.mergeOptions({id:c,playlistLoader:g},m);Wm[e](e,m.playlistLoader,t);l[u].push(m);if("undefined"==typeof d[c]){var y=new Ze.AudioTrack({id:c,kind:Bm(m),enabled:!1,language:m.language,default:m["default"],label:c});d[c]=y}}}r.on("error",Vm[e](e,t))},SUBTITLES:function(e,t){var a=t.tech,n=t.hls,r=t.sourceType,i=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,l=t.mediaTypes[e],d=l.groups,p=l.tracks,u=t.masterPlaylistLoader;for(var c in o[e]){if(!d[c]){d[c]=[]}for(var m in o[e][c]){if(o[e][c][m].forced){continue}var g=o[e][c][m],y=void 0;if("hls"===r){y=new su(g.resolvedUri,n,s)}else if("dash"===r){y=new Zc(g.playlists[0],n,s,u)}g=Ze.mergeOptions({id:m,playlistLoader:y},g);Wm[e](e,g.playlistLoader,t);d[c].push(g);if("undefined"==typeof p[m]){var h=a.addRemoteTextTrack({id:m,kind:"subtitles",default:g["default"]&&g.autoselect,language:g.language,label:m},!1).track;p[m]=h}}}i.on("error",Vm[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var a=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],i=r.groups,s=r.tracks;for(var o in n[e]){if(!i[o]){i[o]=[]}for(var l in n[e][o]){var d=n[e][o][l];if(!d.instreamId.match(/CC\d/)){continue}i[o].push(Ze.mergeOptions({id:l},d));if("undefined"==typeof s[l]){var p=a.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d["default"]&&d.autoselect,language:d.language,label:l},!1).track;s[l]=p}}}}},Gm=function(e,t){return function(a){var n=t.masterPlaylistLoader,r=t.mediaTypes[e].groups,i=n.media();if(!i){return null}var s=null;if(i.attributes[e]){s=r[i.attributes[e]]}s=s||r.main;if("undefined"==typeof a){return s}if(null===a){return null}return s.filter(function(e){return e.id===a.id})[0]||null}},Km={AUDIO:function(e,t){return function(){var a=t.mediaTypes[e].tracks;for(var n in a){if(a[n].enabled){return a[n]}}return null}},SUBTITLES:function(e,t){return function(){var a=t.mediaTypes[e].tracks;for(var n in a){if("showing"===a[n].mode||"hidden"===a[n].mode){return a[n]}}return null}}},Ym=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){zm[t](t,e)});var t=e.mediaTypes,a=e.masterPlaylistLoader,n=e.tech,r=e.hls;["AUDIO","SUBTITLES"].forEach(function(a){t[a].activeGroup=Gm(a,e);t[a].activeTrack=Km[a](a,e);t[a].onGroupChanged=Hm(a,e);t[a].onTrackChanged=qm(a,e)});var i=t.AUDIO.activeGroup(),s=(i.filter(function(e){return e["default"]})[0]||i[0]).id;t.AUDIO.tracks[s].enabled=!0;t.AUDIO.onTrackChanged();a.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(e){return t[e].onGroupChanged()})});var o=function(){t.AUDIO.onTrackChanged();n.trigger({type:"usage",name:"hls-audio-change"})};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");for(var l in t.AUDIO.tracks){n.audioTracks().addTrack(t.AUDIO.tracks[l])}},Xm=function(){var e={};["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:pa,activeTrack:pa,onGroupChanged:pa,onTrackChanged:pa}});return e},$m=void 0,Qm=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],Jm=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},Zm=function(t){Gp(a,t);function a(e){Vp(this,a);var t=Kp(this,(a.__proto__||Object.getPrototypeOf(a)).call(this)),n=e.url,r=e.handleManifestRedirects,i=e.withCredentials,s=e.tech,o=e.bandwidth,l=e.externHls,d=e.useCueTags,p=e.blacklistDuration,u=e.enableLowInitialPlaylist,c=e.sourceType,m=e.seekTo,g=e.cacheEncryptionKeys;if(!n){throw new Error("A non-empty playlist URL is required")}$m=l;t.withCredentials=i;t.tech_=s;t.hls_=s.hls;t.seekTo_=m;t.sourceType_=c;t.useCueTags_=d;t.blacklistDuration=p;t.enableLowInitialPlaylist=u;if(t.useCueTags_){t.cueTagsTrack_=t.tech_.addTextTrack("metadata","ad-cues");t.cueTagsTrack_.inBandMetadataTrackDispatchType=""}t.requestOptions_={withCredentials:i,handleManifestRedirects:r,timeout:null};t.mediaTypes_=Xm();t.mediaSource=new Ze.MediaSource;t.mediaSource.addEventListener("sourceopen",t.handleSourceOpen_.bind(t));t.seekable_=Ze.createTimeRanges();t.hasPlayed_=!1;t.syncController_=new Um(e);t.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track;t.decrypter_=new Mm;t.inbandTextTracks_={};var y={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:o,syncController:t.syncController_,decrypter:t.decrypter_,sourceType:t.sourceType_,inbandTextTracks:t.inbandTextTracks_,cacheEncryptionKeys:g};t.masterPlaylistLoader_="dash"===t.sourceType_?new Zc(n,t.hls_,t.requestOptions_):new su(n,t.hls_,t.requestOptions_);t.setupMasterPlaylistLoaderListeners_();t.mainSegmentLoader_=new Lm(Ze.mergeOptions(y,{segmentMetadataTrack:t.segmentMetadataTrack_,loaderType:"main"}),e);t.audioSegmentLoader_=new Lm(Ze.mergeOptions(y,{loaderType:"audio"}),e);t.subtitleSegmentLoader_=new wm(Ze.mergeOptions(y,{loaderType:"vtt",featuresNativeTextTracks:t.tech_.featuresNativeTextTracks}),e);t.setupSegmentLoaderListeners_();Qm.forEach(function(e){t[e+"_"]=Jm.bind(t,e)});t.logger_=em("MPC");t.masterPlaylistLoader_.load();return t}Wp(a,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var t=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var e=t.masterPlaylistLoader_.media(),a=1e3*(1.5*e.targetDuration);if(Iu(t.masterPlaylistLoader_.master,t.masterPlaylistLoader_.media())){t.requestOptions_.timeout=0}else{t.requestOptions_.timeout=a}if(e.endList&&"none"!==t.tech_.preload()){t.mainSegmentLoader_.playlist(e,t.requestOptions_);t.mainSegmentLoader_.load()}Ym({sourceType:t.sourceType_,segmentLoaders:{AUDIO:t.audioSegmentLoader_,SUBTITLES:t.subtitleSegmentLoader_,main:t.mainSegmentLoader_},tech:t.tech_,requestOptions:t.requestOptions_,masterPlaylistLoader:t.masterPlaylistLoader_,hls:t.hls_,master:t.master(),mediaTypes:t.mediaTypes_,blacklistCurrentPlaylist:t.blacklistCurrentPlaylist.bind(t)});t.triggerPresenceUsage_(t.master(),e);try{t.setupSourceBuffers_()}catch(a){Ze.log.warn("Failed to create SourceBuffers",a);return t.mediaSource.endOfStream("decode")}t.setupFirstPlay();if(!t.mediaTypes_.AUDIO.activePlaylistLoader||t.mediaTypes_.AUDIO.activePlaylistLoader.media()){t.trigger("selectedinitialmedia")}else{t.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",function(){t.trigger("selectedinitialmedia")})}});this.masterPlaylistLoader_.on("loadedplaylist",function(){var e=t.masterPlaylistLoader_.media();if(!e){t.excludeUnsupportedVariants_();var a;if(t.enableLowInitialPlaylist){a=t.selectInitialPlaylist()}if(!a){a=t.selectPlaylist()}t.initialMedia_=a;t.masterPlaylistLoader_.media(t.initialMedia_);return}if(t.useCueTags_){t.updateAdCues_(e)}t.mainSegmentLoader_.playlist(e,t.requestOptions_);t.updateDuration();if(!t.tech_.paused()){t.mainSegmentLoader_.load();if(t.audioSegmentLoader_){t.audioSegmentLoader_.load()}}if(!e.endList){var n=function(){var e=t.seekable();if(0!==e.length){t.mediaSource.addSeekableRange_(e.start(0),e.end(0))}};if(t.duration()!==1/0){var r=function e(){if(t.duration()===1/0){n()}else{t.tech_.one("durationchange",e)}};t.tech_.one("durationchange",r)}else{n()}}});this.masterPlaylistLoader_.on("error",function(){t.blacklistCurrentPlaylist(t.masterPlaylistLoader_.error)});this.masterPlaylistLoader_.on("mediachanging",function(){t.mainSegmentLoader_.abort();t.mainSegmentLoader_.pause()});this.masterPlaylistLoader_.on("mediachange",function(){var e=t.masterPlaylistLoader_.media(),a=1e3*(1.5*e.targetDuration);if(Iu(t.masterPlaylistLoader_.master,t.masterPlaylistLoader_.media())){t.requestOptions_.timeout=0}else{t.requestOptions_.timeout=a}t.mainSegmentLoader_.playlist(e,t.requestOptions_);t.mainSegmentLoader_.load();t.tech_.trigger({type:"mediachange",bubbles:!0})});this.masterPlaylistLoader_.on("playlistunchanged",function(){var e=t.masterPlaylistLoader_.media(),a=t.stuckAtPlaylistEnd_(e);if(a){t.blacklistCurrentPlaylist({message:"Playlist no longer updating."});t.tech_.trigger("playliststuck")}});this.masterPlaylistLoader_.on("renditiondisabled",function(){t.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})});this.masterPlaylistLoader_.on("renditionenabled",function(){t.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})})}},{key:"triggerPresenceUsage_",value:function(e,t){var a=e.mediaGroups||{},n=!0,r=Object.keys(a.AUDIO);for(var i in a.AUDIO){for(var s in a.AUDIO[i]){var o=a.AUDIO[i][s];if(!o.uri){n=!1}}}if(n){this.tech_.trigger({type:"usage",name:"hls-demuxed"})}if(Object.keys(a.SUBTITLES).length){this.tech_.trigger({type:"usage",name:"hls-webvtt"})}if($m.Playlist.isAes(t)){this.tech_.trigger({type:"usage",name:"hls-aes"})}if($m.Playlist.isFmp4(t)){this.tech_.trigger({type:"usage",name:"hls-fmp4"})}if(r.length&&1<Object.keys(a.AUDIO[r[0]]).length){this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})}if(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(),a=e.masterPlaylistLoader_.media(),n=e.tech_.buffered(),r=n.length?n.end(n.length-1)-e.tech_.currentTime():0,i=e.bufferLowWaterLine();if(!a.endList||e.duration()<am.MAX_BUFFER_LOW_WATER_LINE||t.attributes.BANDWIDTH<a.attributes.BANDWIDTH||r>=i){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();if(this.mediaTypes_.AUDIO.activePlaylistLoader){this.audioSegmentLoader_.load()}if(this.mediaTypes_.SUBTITLES.activePlaylistLoader){this.subtitleSegmentLoader_.load()}}},{key:"smoothQualityChange_",value:function(){var e=this.selectPlaylist();if(e!==this.masterPlaylistLoader_.media()){this.masterPlaylistLoader_.media(e);this.mainSegmentLoader_.resetLoader()}}},{key:"fastQualityChange_",value:function(){var e=this,t=this.selectPlaylist();if(t===this.masterPlaylistLoader_.media()){return}this.masterPlaylistLoader_.media(t);this.mainSegmentLoader_.resetEverything(function(){if(Ze.browser.IE_VERSION||Ze.browser.IS_EDGE){e.tech_.setCurrentTime(e.tech_.currentTime()+.04)}else{e.tech_.setCurrentTime(e.tech_.currentTime())}})}},{key:"play",value:function(){if(this.setupFirstPlay()){return}if(this.tech_.ended()){this.seekTo_(0)}if(this.hasPlayed_){this.load()}var e=this.tech_.seekable();if(this.tech_.duration()===1/0){if(this.tech_.currentTime()<e.start(0)){return this.seekTo_(e.end(e.length-1))}}}},{key:"setupFirstPlay",value:function(){var e=this,t=this.masterPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_){return!1}if(!t.endList){var a=this.seekable();if(!a.length){return!1}if(Ze.browser.IE_VERSION&&0===this.tech_.readyState()){this.tech_.one("loadedmetadata",function(){e.trigger("firstplay");e.seekTo_(a.end(0));e.hasPlayed_=!0});return!1}this.trigger("firstplay");this.seekTo_(a.end(0))}this.hasPlayed_=!0;this.load();return!0}},{key:"handleSourceOpen_",value:function(){try{this.setupSourceBuffers_()}catch(t){Ze.log.warn("Failed to create Source Buffers",t);return this.mediaSource.endOfStream("decode")}if(this.tech_.autoplay()){var e=this.tech_.play();if("undefined"!=typeof e&&"function"==typeof e.then){e.then(null,function(){})}}this.trigger("sourceopen")}},{key:"onEndOfStream",value:function(){var e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(!this.mainSegmentLoader_.startingMedia_||this.mainSegmentLoader_.startingMedia_.containsVideo){e=e&&this.audioSegmentLoader_.ended_}else{e=this.audioSegmentLoader_.ended_}}if(!e){return}this.logger_("calling mediaSource.endOfStream()");try{this.mediaSource.endOfStream()}catch(t){Ze.log.warn("Failed to call media source endOfStream",t)}}},{key:"stuckAtPlaylistEnd_",value:function(e){var t=this.seekable();if(!t.length){return!1}var a=this.syncController_.getExpiredTime(e,this.mediaSource.duration);if(null===a){return!1}var n=$m.Playlist.playlistEnd(e,a),r=this.tech_.currentTime(),i=this.tech_.buffered();if(!i.length){return n-r<=Ju}var s=i.end(i.length-1);return s-r<=Ju&&n-s<=Ju}},{key:"blacklistCurrentPlaylist",value:function(){var e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},t=arguments[1],a=void 0,n=void 0;a=e.playlist||this.masterPlaylistLoader_.media();t=t||e.blacklistDuration||this.blacklistDuration;if(!a){this.error=e;try{return this.mediaSource.endOfStream("network")}catch(t){return this.trigger("error")}}var r=1===this.masterPlaylistLoader_.master.playlists.filter(Su).length,i=this.masterPlaylistLoader_.master.playlists;if(1===i.length){Ze.log.warn("Problem encountered with the current HLS playlist. Trying again since it is the only playlist.");this.tech_.trigger("retryplaylist");return this.masterPlaylistLoader_.load(r)}if(r){Ze.log.warn("Removing all playlists from the blacklist because the last rendition is about to be blacklisted.");i.forEach(function(e){if(e.excludeUntil!==1/0){delete e.excludeUntil}});this.tech_.trigger("retryplaylist")}a.excludeUntil=Date.now()+1e3*t;this.tech_.trigger("blacklistplaylist");this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});n=this.selectPlaylist();Ze.log.warn("Problem encountered with the current HLS playlist."+(e.message?" "+e.message:"")+" Switching to another playlist.");return this.masterPlaylistLoader_.media(n,r)}},{key:"pauseLoading",value:function(){this.mainSegmentLoader_.pause();if(this.mediaTypes_.AUDIO.activePlaylistLoader){this.audioSegmentLoader_.pause()}if(this.mediaTypes_.SUBTITLES.activePlaylistLoader){this.subtitleSegmentLoader_.pause()}}},{key:"setCurrentTime",value:function(e){var t=ec(this.tech_.buffered(),e);if(!(this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media())){return 0}if(!this.masterPlaylistLoader_.media().segments){return 0}if(t&&t.length){return e}this.mainSegmentLoader_.resetEverything();this.mainSegmentLoader_.abort();if(this.mediaTypes_.AUDIO.activePlaylistLoader){this.audioSegmentLoader_.resetEverything();this.audioSegmentLoader_.abort()}if(this.mediaTypes_.SUBTITLES.activePlaylistLoader){this.subtitleSegmentLoader_.resetEverything();this.subtitleSegmentLoader_.abort()}this.load()}},{key:"duration",value:function(){if(!this.masterPlaylistLoader_){return 0}if(this.mediaSource){return this.mediaSource.duration}return $m.Playlist.duration(this.masterPlaylistLoader_.media())}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var e;if(!this.masterPlaylistLoader_){return}var t=this.masterPlaylistLoader_.media();if(!t){return}var a=this.syncController_.getExpiredTime(t,this.mediaSource.duration);if(null===a){return}var n=this.masterPlaylistLoader_.master.suggestedPresentationDelay,r=$m.Playlist.seekable(t,a,n);if(0===r.length){return}if(this.mediaTypes_.AUDIO.activePlaylistLoader){t=this.mediaTypes_.AUDIO.activePlaylistLoader.media();a=this.syncController_.getExpiredTime(t,this.mediaSource.duration);if(null===a){return}e=$m.Playlist.seekable(t,a,n);if(0===e.length){return}}var i=void 0,s=void 0;if(this.seekable_&&this.seekable_.length){i=this.seekable_.end(0);s=this.seekable_.start(0)}if(!e){this.seekable_=r}else if(e.start(0)>r.end(0)||r.start(0)>e.end(0)){this.seekable_=r}else{this.seekable_=Ze.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)<r.end(0)?e.end(0):r.end(0)]])}if(this.seekable_&&this.seekable_.length){if(this.seekable_.end(0)===i&&this.seekable_.start(0)===s){return}}this.logger_("seekable updated ["+nc(this.seekable_)+"]");this.tech_.trigger("seekablechanged")}},{key:"updateDuration",value:function(){var e=this,t=this.mediaSource.duration,a=$m.Playlist.duration(this.masterPlaylistLoader_.media()),n=this.tech_.buffered(),r=function t(){e.logger_("Setting duration from "+e.mediaSource.duration+" => "+a);try{e.mediaSource.duration=a}catch(t){Ze.log.warn("Failed to set media source duration",t)}e.tech_.trigger("durationchange");e.mediaSource.removeEventListener("sourceopen",t)};if(0<n.length){a=Math.max(a,n.end(n.length-1))}if(t!==a){if("open"!==this.mediaSource.readyState){this.mediaSource.addEventListener("sourceopen",r)}else{r()}}}},{key:"dispose",value:function(){var e=this;this.trigger("dispose");this.decrypter_.terminate();this.masterPlaylistLoader_.dispose();this.mainSegmentLoader_.dispose();["AUDIO","SUBTITLES"].forEach(function(t){var a=e.mediaTypes_[t].groups;for(var n in a){a[n].forEach(function(e){if(e.playlistLoader){e.playlistLoader.dispose()}})}});this.audioSegmentLoader_.dispose();this.subtitleSegmentLoader_.dispose();this.off();if(this.mediaSource.dispose){this.mediaSource.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=this.masterPlaylistLoader_.media(),t=void 0;if(!e||"open"!==this.mediaSource.readyState){return}t=Lc(this.masterPlaylistLoader_.master,e);if(1>t.length){this.error="No compatible SourceBuffer configuration for the variant stream:"+e.resolvedUri;return this.mediaSource.endOfStream("decode")}this.configureLoaderMimeTypes_(t);this.excludeIncompatibleVariants_(e)}},{key:"configureLoaderMimeTypes_",value:function(e){var t=1<e.length&&-1===e[0].indexOf(",")&&e[0]!==e[1]?new Ze.EventTarget:null;this.mainSegmentLoader_.mimeType(e[0],t);if(e[1]){this.audioSegmentLoader_.mimeType(e[1],t)}}},{key:"excludeUnsupportedVariants_",value:function(){this.master().playlists.forEach(function(t){if(t.attributes.CODECS&&e.MediaSource&&e.MediaSource.isTypeSupported&&!e.MediaSource.isTypeSupported("video/mp4; codecs=\""+kc(t.attributes.CODECS)+"\"")){t.excludeUntil=1/0}})}},{key:"excludeIncompatibleVariants_",value:function(e){var t=2,a=null,n=void 0;if(e.attributes.CODECS){n=Sc(e.attributes.CODECS);a=n.videoCodec;t=n.codecCount}this.master().playlists.forEach(function(e){var n={codecCount:2,videoCodec:null};if(e.attributes.CODECS){n=Sc(e.attributes.CODECS)}if(n.codecCount!==t){e.excludeUntil=1/0}if(n.videoCodec!==a){e.excludeUntil=1/0}})}},{key:"updateAdCues_",value:function(e){var t=0,a=this.seekable();if(a.length){t=a.start(0)}Om(e,this.cueTagsTrack_,t)}},{key:"goalBufferLength",value:function(){var e=this.tech_.currentTime(),t=am.GOAL_BUFFER_LENGTH,a=am.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,am.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*a,n)}},{key:"bufferLowWaterLine",value:function(){var e=this.tech_.currentTime(),t=am.BUFFER_LOW_WATER_LINE,a=am.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,am.MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*a,n)}}]);return a}(Ze.EventTarget),eg=function(e,t,a){return function(n){var r=e.master.playlists[t],i=vu(r),s=Su(r);if("undefined"==typeof n){return s}if(n){delete r.disabled}else{r.disabled=!0}if(n!==s&&!i){a();if(n){e.trigger("renditionenabled")}else{e.trigger("renditiondisabled")}}return n}},tg=function e(t,a,n){Vp(this,e);var r=t.masterPlaylistController_,i=t.options_.smoothQualityChange,s=i?"smooth":"fast",o=r[s+"QualityChange_"].bind(r);if(a.attributes.RESOLUTION){var l=a.attributes.RESOLUTION;this.width=l.width;this.height=l.height}this.bandwidth=a.attributes.BANDWIDTH;this.id=n;this.enabled=eg(t.playlists,a.id,o)},ag=function(t){var a=t.playlists;t.representations=function(){if(!a||!a.master||!a.master.playlists){return[]}return a.master.playlists.filter(function(e){return!vu(e)}).map(function(a){return new tg(t,a,a.id)})}},ng=["seeking","seeked","pause","playing","error"],rg=function(){function t(a){var n=this;Vp(this,t);this.tech_=a.tech;this.seekable=a.seekable;this.seekTo=a.seekTo;this.allowSeeksWithinUnsafeLiveWindow=a.allowSeeksWithinUnsafeLiveWindow;this.media=a.media;this.consecutiveUpdates=0;this.lastRecordedTime=null;this.timer_=null;this.checkCurrentTimeTimeout_=null;this.logger_=em("PlaybackWatcher");this.logger_("initialize");var r=function(){return n.monitorCurrentTime_()},i=function(){return n.techWaiting_()},s=function(){return n.cancelTimer_()},o=function(){return n.fixesBadSeeks_()};this.tech_.on("seekablechanged",o);this.tech_.on("waiting",i);this.tech_.on(ng,s);this.tech_.on("canplay",r);this.dispose=function(){n.logger_("dispose");n.tech_.off("seekablechanged",o);n.tech_.off("waiting",i);n.tech_.off(ng,s);n.tech_.off("canplay",r);if(n.checkCurrentTimeTimeout_){e.clearTimeout(n.checkCurrentTimeTimeout_)}n.cancelTimer_()}}Wp(t,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_();if(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_()){this.consecutiveUpdates=0;this.lastRecordedTime=this.tech_.currentTime();return}if(this.tech_.paused()||this.tech_.seeking()){return}var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+Ju>=t.end(t.length-1))){return this.techWaiting_()}if(5<=this.consecutiveUpdates&&e===this.lastRecordedTime){this.consecutiveUpdates++;this.waiting_()}else if(e===this.lastRecordedTime){this.consecutiveUpdates++}else{this.consecutiveUpdates=0;this.lastRecordedTime=e}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0;if(this.timer_){this.logger_("cancelTimer_");clearTimeout(this.timer_)}this.timer_=null}},{key:"fixesBadSeeks_",value:function(){var e=this.tech_.seeking();if(!e){return!1}var t=this.seekable(),a=this.tech_.currentTime(),n=this.afterSeekableWindow_(t,a,this.media(),this.allowSeeksWithinUnsafeLiveWindow),r=void 0;if(n){var i=t.end(t.length-1);r=i}if(this.beforeSeekableWindow_(t,a)){var s=t.start(0);r=s+Ju}if("undefined"!=typeof r){this.logger_("Trying to seek outside of seekable at time "+a+" with "+("seekable range "+nc(t)+". Seeking to ")+(r+"."));this.seekTo(r);return!0}return!1}},{key:"waiting_",value:function(){if(this.techWaiting_()){return}var e=this.tech_.currentTime(),t=this.tech_.buffered(),a=ec(t,e);if(a.length&&e+3<=a.end(0)){this.cancelTimer_();this.seekTo(e);this.logger_("Stopped at "+e+" while inside a buffered region "+("["+a.start(0)+" -> "+a.end(0)+"]. Attempting to resume playback by seeking to the current time."));this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})}}},{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 a=e.end(e.length-1);this.logger_("Fell out of live window at time "+t+". Seeking to "+("live point (seekable end) "+a));this.cancelTimer_();this.seekTo(a);this.tech_.trigger({type:"usage",name:"hls-live-resync"});return!0}var n=this.tech_.buffered(),r=tc(n,t);if(this.videoUnderflow_(r,n,t)){this.cancelTimer_();this.seekTo(t);this.tech_.trigger({type:"usage",name:"hls-video-underflow"});return!0}if(0<r.length){var i=r.start(0)-t;this.logger_("Stopped at "+t+", setting timer for "+i+", seeking "+("to "+r.start(0)));this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*i,t);return!0}return!1}},{key:"afterSeekableWindow_",value:function(e,t,a){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:!1;if(!e.length){return!1}var r=e.end(e.length-1)+Ju,i=!a.endList;if(i&&n){r=e.end(e.length-1)+3*a.targetDuration}if(t>r){return!0}return!1}},{key:"beforeSeekableWindow_",value:function(e,t){if(e.length&&0<e.start(0)&&t<e.start(0)-Ju){return!0}return!1}},{key:"videoUnderflow_",value:function(e,t,a){if(0===e.length){var n=this.gapFromVideoUnderflow_(t,a);if(n){this.logger_("Encountered a gap in video from "+n.start+" to "+n.end+". "+("Seeking to current time "+a));return!0}}return!1}},{key:"skipTheGap_",value:function(e){var t=this.tech_.buffered(),a=this.tech_.currentTime(),n=tc(t,a);this.cancelTimer_();if(0===n.length||a!==e){return}this.logger_("skipTheGap_:","currentTime:",a,"scheduled currentTime:",e,"nextRange start:",n.start(0));this.seekTo(n.start(0)+Qu);this.tech_.trigger({type:"usage",name:"hls-gap-skip"})}},{key:"gapFromVideoUnderflow_",value:function(e,t){for(var a=ac(e),n=0;n<a.length;n++){var r=a.start(n),s=a.end(n);if(4>t-r&&2<t-r){return{start:r,end:s}}}return null}}]);return t}(),ig={errorInterval:30,getSource:function(e){var t=this.tech({IWillNotUseThisInPlugins:!0}),a=t.currentSource_;return e(a)}},sg=function e(t,a){var n=0,r=0,i=Ze.mergeOptions(ig,a);t.ready(function(){t.trigger({type:"usage",name:"hls-error-reload-initialized"})});var s=function(){if(r){t.currentTime(r)}},o=function(e){if(null===e||e===void 0){return}r=t.duration()!==1/0&&t.currentTime()||0;t.one("loadedmetadata",s);t.src(e);t.trigger({type:"usage",name:"hls-error-reload"});t.play()},l=function(){if(Date.now()-n<1e3*i.errorInterval){t.trigger({type:"usage",name:"hls-error-reload-canceled"});return}if(!i.getSource||"function"!=typeof i.getSource){Ze.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}n=Date.now();return i.getSource.call(t,o)},d=function e(){t.off("loadedmetadata",s);t.off("error",l);t.off("dispose",e)};t.on("error",l);t.on("dispose",d);t.reloadSourceOnError=function(a){d();e(t,a)}},og=function(e){sg(this,e)};Ze.use("*",function(e){return{setSource:function(e,t){t(null,e)},setCurrentTime:function(t){if(e.vhs&&e.currentSource().src===e.vhs.source_.src){e.vhs.setCurrentTime(t)}return t},play:function(){if(e.vhs&&e.currentSource().src===e.vhs.source_.src){e.vhs.setCurrentTime(e.tech_.currentTime())}}}});var lg={PlaylistLoader:su,Playlist:xu,Decrypter:Fp,AsyncStream:Mp,decrypt:jp,utils:Hu,STANDARD_PLAYLIST_SELECTOR:function(){return Tm(this.playlists.master,this.systemBandwidth,parseInt(ym(this.tech_.el(),"width"),10),parseInt(ym(this.tech_.el(),"height"),10),this.limitRenditionByPlayerDimensions)},INITIAL_PLAYLIST_SELECTOR:function(){var e=this.playlists.master.playlists.filter(xu.isEnabled);hm(e,function(e,t){return _m(e,t)});var t=e.filter(function(e){return Sc(e.attributes.CODECS).videoCodec});return t[0]||null},comparePlaylistBandwidth:_m,comparePlaylistResolution:fm,xhr:Du()};["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(lg,e,{get:function(){Ze.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing");return am[e]},set:function(t){Ze.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing");if("number"!=typeof t||0>t){Ze.log.warn("value of Hls."+e+" must be greater than or equal to 0");return}am[e]=t}})});var dg=function(e){if(/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e)){return"hls"}if(/^application\/dash\+xml/i.test(e)){return"dash"}return null},pg=function(e,t){for(var a=t.media(),n=-1,r=0;r<e.length;r++){if(e[r].id===a.id){n=r;break}}e.selectedIndex_=n;e.trigger({selectedIndex:n,type:"change"})},ug=function(e,t){t.representations().forEach(function(t){e.addQualityLevel(t)});pg(e,t.playlists)};lg.canPlaySource=function(){return Ze.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var cg=function(e,t,a){if(!e){return e}var n=void 0,r=void 0;if(a.mimeType_){n=t.mimeType_;r=a.mimeType_}else{var i=Pc(t.mimeType_),s=i.parameters.codecs.split(","),o=void 0,l=void 0;s.forEach(function(e){e=e.trim();if(Dc(e)){o=e}else if(wc(e)){l=e}});n=i.type+"; codecs=\""+l+"\"";r=i.type.replace("video","audio")+"; codecs=\""+o+"\""}var d={},p=t.playlist_;for(var u in e){d[u]={audioContentType:r,videoContentType:n};if(p.contentProtection&&p.contentProtection[u]&&p.contentProtection[u].pssh){d[u].pssh=p.contentProtection[u].pssh}if("string"==typeof e[u]){d[u].url=e[u]}}return Ze.mergeOptions(e,d)},mg=function(e){var t=e.masterPlaylistController_.mainSegmentLoader_,a=e.masterPlaylistController_.audioSegmentLoader_,n=Ze.players[e.tech_.options_.playerId];if(n.eme){var r=cg(e.source_.keySystems,t,a);if(r){n.currentSource().keySystems=r;if(!(11===Ze.browser.IE_VERSION)&&n.eme.initializeMediaKeys){n.eme.initializeMediaKeys()}}}},gg=function(){if(!window.localStorage){return null}var e=window.localStorage.getItem("videojs-vhs");if(!e){return null}try{return JSON.parse(e)}catch(t){return null}},yg=function(e){if(!window.localStorage){return!1}var t=gg();t=t?Ze.mergeOptions(t,e):e;try{window.localStorage.setItem("videojs-vhs",JSON.stringify(t))}catch(t){return!1}return t};lg.supportsNativeHls=function(){var e=t.createElement("video");if(!Ze.getTech("Html5").isSupported()){return!1}return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return /maybe|probably/i.test(e.canPlayType(t))})}();lg.supportsNativeDash=function(){if(!Ze.getTech("Html5").isSupported()){return!1}return /maybe|probably/i.test(t.createElement("video").canPlayType("application/dash+xml"))}();lg.supportsTypeNatively=function(e){if("hls"===e){return lg.supportsNativeHls}if("dash"===e){return lg.supportsNativeDash}return!1};lg.isSupported=function(){return Ze.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var hg=Ze.getComponent("Component"),_g=function(e){Gp(a,e);function a(e,n,r){Vp(this,a);var i=Kp(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,n,r.hls));if(n.options_&&n.options_.playerId){var s=Ze(n.options_.playerId);if(!s.hasOwnProperty("hls")){Object.defineProperty(s,"hls",{get:function(){Ze.log.warn("player.hls is deprecated. Use player.tech().hls instead.");n.trigger({type:"usage",name:"hls-player-access"});return i},configurable:!0})}s.vhs=i;s.dash=i;i.player_=s}i.tech_=n;i.source_=e;i.stats={};i.setOptions_();if(i.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks){n.overrideNativeAudioTracks(!0);n.overrideNativeVideoTracks(!0)}else if(i.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks)){throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB")}i.on(t,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(){var e=t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement;if(e&&e.contains(i.tech_.el())){i.masterPlaylistController_.smoothQualityChange_()}});i.on(i.tech_,"seeking",function(){if(0===this.tech_.currentTime()&&this.tech_.player_.loop()){this.setCurrentTime(0)}});i.on(i.tech_,"error",function(){if(this.masterPlaylistController_){this.masterPlaylistController_.pauseLoading()}});i.on(i.tech_,"play",i.play);return i}Wp(a,[{key:"setOptions_",value:function(){var e=this;this.options_.withCredentials=this.options_.withCredentials||!1;this.options_.handleManifestRedirects=this.options_.handleManifestRedirects||!1;this.options_.limitRenditionByPlayerDimensions=!1===this.options_.limitRenditionByPlayerDimensions?!1:!0;this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1;this.options_.useBandwidthFromLocalStorage="undefined"!=typeof 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;if("number"!=typeof this.options_.blacklistDuration){this.options_.blacklistDuration=300}if("number"!=typeof this.options_.bandwidth){if(this.options_.useBandwidthFromLocalStorage){var t=gg();if(t&&t.bandwidth){this.options_.bandwidth=t.bandwidth;this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})}if(t&&t.throughput){this.options_.throughput=t.throughput;this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"})}}}if("number"!=typeof this.options_.bandwidth){this.options_.bandwidth=am.INITIAL_BANDWIDTH}this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===am.INITIAL_BANDWIDTH;["withCredentials","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys"].forEach(function(t){if("undefined"!=typeof e.source_[t]){e.options_[t]=e.source_[t]}});this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions}},{key:"src",value:function(e,t){var a=this;if(!e){return}this.setOptions_();this.options_.url=this.source_.src;this.options_.tech=this.tech_;this.options_.externHls=lg;this.options_.sourceType=dg(t);this.options_.seekTo=function(e){a.tech_.setCurrentTime(e);a.setCurrentTime(e)};this.masterPlaylistController_=new Zm(this.options_);this.playbackWatcher_=new rg(Ze.mergeOptions(this.options_,{seekable:function(){return a.seekable()},media:function(){return a.masterPlaylistController_.media()}}));this.masterPlaylistController_.on("error",function(){var e=Ze.players[a.tech_.options_.playerId];e.error(a.masterPlaylistController_.error)});this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):lg.STANDARD_PLAYLIST_SELECTOR.bind(this);this.masterPlaylistController_.selectInitialPlaylist=lg.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=1/(this.bandwidth||1),t=void 0;if(0<this.throughput){t=1/this.throughput}else{t=0}var a=Math.floor(1/(e+t));return a},set:function(){Ze.log.error("The \"systemBandwidth\" property is read-only")}}});if(this.options_.bandwidth){this.bandwidth=this.options_.bandwidth}if(this.options_.throughput){this.throughput=this.options_.throughput}Object.defineProperties(this.stats,{bandwidth:{get:function(){return a.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return a.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return a.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return a.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return a.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return a.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return a.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return a.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return ic(a.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return a.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return a.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return a.tech_.name_},enumerable:!0},duration:{get:function(){return a.tech_.duration()},enumerable:!0},master:{get:function(){return a.playlists.master},enumerable:!0},playerDimensions:{get:function(){return a.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return ic(a.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return a.tech_.getVideoPlaybackQuality()},enumerable:!0}});this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_));this.tech_.on("bandwidthupdate",function(){if(a.options_.useBandwidthFromLocalStorage){yg({bandwidth:a.bandwidth,throughput:Math.round(a.throughput)})}});this.masterPlaylistController_.on("selectedinitialmedia",function(){ag(a);mg(a)});this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")});this.setupQualityLevels_();if(!this.tech_.el()){return}this.tech_.src(Ze.URL.createObjectURL(this.masterPlaylistController_.mediaSource))}},{key:"setupQualityLevels_",value:function(){var e=this,t=Ze.players[this.tech_.options_.playerId];if(!t||!t.qualityLevels||this.qualityLevels_){return}this.qualityLevels_=t.qualityLevels();this.masterPlaylistController_.on("selectedinitialmedia",function(){ug(e.qualityLevels_,e)});this.playlists.on("mediachange",function(){pg(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(){if(this.playbackWatcher_){this.playbackWatcher_.dispose()}if(this.masterPlaylistController_){this.masterPlaylistController_.dispose()}if(this.qualityLevels_){this.qualityLevels_.dispose()}if(this.player_){delete this.player_.vhs;delete this.player_.dash;delete this.player_.hls}if(this.tech_&&this.tech_.hls){delete this.tech_.hls}zp(a.prototype.__proto__||Object.getPrototypeOf(a.prototype),"dispose",this).call(this)}},{key:"convertToProgramTime",value:function(e,t){return Xu({playlist:this.masterPlaylistController_.media(),time:e,callback:t})}},{key:"seekToProgramTime",value:function(e,t){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:!0,n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:2;return $u({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:a,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}]);return a}(hg),fg={name:"videojs-http-streaming",VERSION:"1.12.3",canHandleSource:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},a=Ze.mergeOptions(Ze.options,t);return fg.canPlayType(e.type,a)},handleSource:function(e,t){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},n=Ze.mergeOptions(Ze.options,a);t.hls=new _g(e,t,n);t.hls.xhr=Du();t.hls.src(e.src,e.type);return t.hls},canPlayType:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},a=Ze.mergeOptions(Ze.options,t),n=a.hls.overrideNative,r=dg(e),i=r&&(!lg.supportsTypeNatively(r)||n);return i?"maybe":""}};if("undefined"==typeof Ze.MediaSource||"undefined"==typeof Ze.URL){Ze.MediaSource=Vc;Ze.URL=Wc}if(Vc.supportsNativeMediaSources()){Ze.getTech("Html5").registerSourceHandler(fg,0)}Ze.HlsHandler=_g;Ze.HlsSourceHandler=fg;Ze.Hls=lg;if(!Ze.use){Ze.registerComponent("Hls",lg)}Ze.options.hls=Ze.options.hls||{};if(Ze.registerPlugin){Ze.registerPlugin("reloadSourceOnError",og)}else{Ze.plugin("reloadSourceOnError",og)}return Ze});
//# sourceMappingURL=video-lazy.min.js.map