1 |
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("global/window"),require("global/document")):"function"==typeof define&&define.amd?define(["global/window","global/document"],t):(e=e||self).videojs=t(e.window,e.document)}(this,function(e,t){e=e&&e.hasOwnProperty("default")?e.default:e,t=t&&t.hasOwnProperty("default")?t.default:t;var i="7.6.3",n=[],r=function(t,i){return function(r,a,s){var o=i.levels[a],u=new RegExp("^("+o+")$");if("log"!==r&&s.unshift(r.toUpperCase()+":"),s.unshift(t+":"),n&&n.push([].concat(s)),e.console){var l=e.console[r];l||"debug"!==r||(l=e.console.info||e.console.log),l&&o&&u.test(r)&&l[Array.isArray(s)?"apply":"call"](e.console,s)}}};var a=function e(t){var i,a="info",s=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];i("log",a,t)};return i=r(t,s),s.createLogger=function(i){return e(t+": "+i)},s.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:a},s.level=function(e){if("string"==typeof e){if(!s.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');a=e}return a},(s.history=function(){return n?[].concat(n):[]}).filter=function(e){return(n||[]).filter(function(t){return new RegExp(".*"+e+".*").test(t[0])})},s.history.clear=function(){n&&(n.length=0)},s.history.disable=function(){null!==n&&(n.length=0,n=null)},s.history.enable=function(){null===n&&(n=[])},s.error=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i("error",a,t)},s.warn=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i("warn",a,t)},s.debug=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i("debug",a,t)},s}("VIDEOJS"),s=a.createLogger,o=Object.prototype.toString,u=function(e){return d(e)?Object.keys(e):[]};function l(e,t){u(e).forEach(function(i){return t(e[i],i)})}function c(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return Object.assign?Object.assign.apply(Object,[e].concat(i)):(i.forEach(function(t){t&&l(t,function(t,i){e[i]=t})}),e)}function d(e){return!!e&&"object"==typeof e}function h(e){return d(e)&&"[object Object]"===o.call(e)&&e.constructor===Object}function f(t,i){if(!t||!i)return"";if("function"==typeof e.getComputedStyle){var n=e.getComputedStyle(t);return n?n.getPropertyValue(i)||n[i]:""}return""}function p(e){return"string"==typeof e&&/\S/.test(e)}function m(e){if(/\s/.test(e))throw new Error("class has illegal whitespace characters")}function g(){return t===e.document}function v(e){return d(e)&&1===e.nodeType}function y(){try{return e.parent!==e.self}catch(e){return!0}}function _(e){return function(i,n){if(!p(i))return t[e](null);p(n)&&(n=t.querySelector(n));var r=v(n)?n:t;return r[e]&&r[e](i)}}function b(e,i,n,r){void 0===e&&(e="div"),void 0===i&&(i={}),void 0===n&&(n={});var s=t.createElement(e);return Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(a.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+t+"."),s.setAttribute(e,t)):"textContent"===e?T(s,t):s[e]=t}),Object.getOwnPropertyNames(n).forEach(function(e){s.setAttribute(e,n[e])}),r&&F(s,r),s}function T(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function S(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function k(e,t){return m(t),e.classList?e.classList.contains(t):(i=t,new RegExp("(^|\\s)"+i+"($|\\s)")).test(e.className);var i}function E(e,t){return e?(e.classList?e.classList.add(t):k(e,t)||(e.className=(e.className+" "+t).trim()),e):e}function w(e,t){return e?(e.classList?e.classList.remove(t):(m(t),e.className=e.className.split(/\s+/).filter(function(e){return e!==t}).join(" ")),e):e}function C(e,t,i){var n=k(e,t);return"function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=!n),i===n?e:(i?E(e,t):w(e,t),e)}function P(e,t){Object.getOwnPropertyNames(t).forEach(function(i){var n=t[i];null===n||void 0===n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)})}function A(e){var t={},i=",autoplay,stretch,fluent,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0)for(var n=e.attributes,r=n.length-1;r>=0;r--){var a=n[r].name,s=n[r].value;"boolean"!=typeof e[a]&&-1===i.indexOf(","+a+",")||(s=null!==s),t[a]=s}return t}function R(e,t){return e.getAttribute(t)}function L(e,t,i){e.setAttribute(t,i)}function O(e,t){e.removeAttribute(t)}function I(){t.body.focus(),t.onselectstart=function(){return!1}}function x(){t.onselectstart=function(){return!0}}function D(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach(function(e){void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(f(e,"height"))),i.width||(i.width=parseFloat(f(e,"width"))),i}}function M(i){var n;if(i.getBoundingClientRect&&i.parentNode&&(n=i.getBoundingClientRect()),!n)return{left:0,top:0};var r=t.documentElement,a=t.body,s=r.clientLeft||a.clientLeft||0,o=e.pageXOffset||a.scrollLeft,u=n.left+o-s,l=r.clientTop||a.clientTop||0,c=e.pageYOffset||a.scrollTop,d=n.top+c-l;return{left:Math.round(u),top:Math.round(d)}}function U(e,t){var i={},n=M(e),r=e.offsetWidth,a=e.offsetHeight,s=n.top,o=n.left,u=t.pageY,l=t.pageX;return t.changedTouches&&(l=t.changedTouches[0].pageX,u=t.changedTouches[0].pageY),i.y=Math.max(0,Math.min(1,(s-u+a)/a)),i.x=Math.max(0,Math.min(1,(l-o)/r)),i}function j(e){return d(e)&&3===e.nodeType}function B(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function N(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(function(e){return"function"==typeof e&&(e=e()),v(e)||j(e)?e:"string"==typeof e&&/\S/.test(e)?t.createTextNode(e):void 0}).filter(function(e){return e})}function F(e,t){return N(t).forEach(function(t){return e.appendChild(t)}),e}function V(e,t){return F(B(e),t)}function G(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}var H=_("querySelector"),z=_("querySelectorAll"),q=Object.freeze({isReal:g,isEl:v,isInFrame:y,createEl:b,textContent:T,prependTo:S,hasClass:k,addClass:E,removeClass:w,toggleClass:C,setAttributes:P,getAttributes:A,getAttribute:R,setAttribute:L,removeAttribute:O,blockTextSelection:I,unblockTextSelection:x,getBoundingClientRect:D,findPosition:M,getPointerPosition:U,isTextNode:j,emptyEl:B,normalizeContent:N,appendContent:F,insertContent:V,isSingleLeftClick:G,$:H,$$:z}),W=new WeakMap,K=1;function $(){return K++}function X(e,t){if(W.has(e)){var i=W.get(e);0===i.handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&W.delete(e)}}function Y(e,t,i,n){i.forEach(function(i){e(t,i,n)})}function J(i){function n(){return!0}function r(){return!1}if(!i||!i.isPropagationStopped){var a=i||e.event;for(var s in i={},a)"layerX"!==s&&"layerY"!==s&&"keyLocation"!==s&&"webkitMovementX"!==s&&"webkitMovementY"!==s&&("returnValue"!==s&&"path"!==s||!a.preventDefault)&&(i[s]=a[s]);if(i.target||(i.target=i.srcElement||t),i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement),i.preventDefault=function(){a.preventDefault&&a.preventDefault(),i.returnValue=!1,a.returnValue=!1,i.defaultPrevented=!0},i.defaultPrevented=!1,i.stopPropagation=function(){a.stopPropagation&&a.stopPropagation(),i.cancelBubble=!0,a.cancelBubble=!0,i.isPropagationStopped=n},i.isPropagationStopped=r,i.stopImmediatePropagation=function(){a.stopImmediatePropagation&&a.stopImmediatePropagation(),i.isImmediatePropagationStopped=n,i.stopPropagation()},i.isImmediatePropagationStopped=r,null!==i.clientX&&void 0!==i.clientX){var o=t.documentElement,u=t.body;i.pageX=i.clientX+(o&&o.scrollLeft||u&&u.scrollLeft||0)-(o&&o.clientLeft||u&&u.clientLeft||0),i.pageY=i.clientY+(o&&o.scrollTop||u&&u.scrollTop||0)-(o&&o.clientTop||u&&u.clientTop||0)}i.which=i.charCode||i.keyCode,null!==i.button&&void 0!==i.button&&(i.button=1&i.button?0:4&i.button?1:2&i.button?2:0)}return i}var Q=!1;!function(){try{var t=Object.defineProperty({},"passive",{get:function(){Q=!0}});e.addEventListener("test",null,t),e.removeEventListener("test",null,t)}catch(e){}}();var Z=["touchstart","touchmove"];function ee(e,t,i){if(Array.isArray(t))return Y(ee,e,t,i);W.has(e)||W.set(e,{});var n=W.get(e);if(n.handlers||(n.handlers={}),n.handlers[t]||(n.handlers[t]=[]),i.guid||(i.guid=$()),n.handlers[t].push(i),n.dispatcher||(n.disabled=!1,n.dispatcher=function(t,i){if(!n.disabled){t=J(t);var r=n.handlers[t.type];if(r)for(var s=r.slice(0),o=0,u=s.length;o<u&&!t.isImmediatePropagationStopped();o++)try{s[o].call(e,t,i)}catch(e){a.error(e)}}}),1===n.handlers[t].length)if(e.addEventListener){var r=!1;Q&&Z.indexOf(t)>-1&&(r={passive:!0}),e.addEventListener(t,n.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function te(e,t,i){if(W.has(e)){var n=W.get(e);if(n.handlers){if(Array.isArray(t))return Y(te,e,t,i);var r=function(e,t){n.handlers[t]=[],X(e,t)};if(void 0!==t){var a=n.handlers[t];if(a)if(i){if(i.guid)for(var s=0;s<a.length;s++)a[s].guid===i.guid&&a.splice(s--,1);X(e,t)}else r(e,t)}else for(var o in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},o)&&r(e,o)}}}function ie(e,t,i){var n=W.has(e)?W.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=J(t),n.dispatcher&&n.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles)ie.call(null,r,t,i);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){W.has(t.target)||W.set(t.target,{});var a=W.get(t.target);t.target[t.type]&&(a.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),a.disabled=!1)}return!t.defaultPrevented}function ne(e,t,i){if(Array.isArray(t))return Y(ne,e,t,i);var n=function n(){te(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||$(),ee(e,t,n)}function re(e,t,i){var n=function n(){te(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||$(),ee(e,t,n)}var ae,se=Object.freeze({fixEvent:J,on:ee,off:te,trigger:ie,one:ne,any:re}),oe=!1,ue=function(){if(g()&&!1!==ae.options.autoSetup){var e=Array.prototype.slice.call(t.getElementsByTagName("video")),i=Array.prototype.slice.call(t.getElementsByTagName("audio")),n=Array.prototype.slice.call(t.getElementsByTagName("video-js")),r=e.concat(i,n);if(r&&r.length>0)for(var a=0,s=r.length;a<s;a++){var o=r[a];if(!o||!o.getAttribute){le(1);break}void 0===o.player&&null!==o.getAttribute("data-setup")&&ae(o)}else oe||le(1)}};function le(t,i){i&&(ae=i),e.setTimeout(ue,t)}g()&&"complete"===t.readyState?oe=!0:ne(e,"load",function(){oe=!0});var ce,de=function(e){var i=t.createElement("style");return i.className=e,i},he=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t},fe=30,pe=function(e,t,i){t.guid||(t.guid=$());var n=t.bind(e);return n.guid=i?i+"_"+t.guid:t.guid,n},me=function(t,i){var n=e.performance.now();return function(){var r=e.performance.now();r-n>=i&&(t.apply(void 0,arguments),n=r)}},ge=function(t,i,n,r){var a;void 0===r&&(r=e);var s=function(){var e=this,s=arguments,o=function(){a=null,o=null,n||t.apply(e,s)};!a&&n&&t.apply(e,s),r.clearTimeout(a),a=r.setTimeout(o,i)};return s.cancel=function(){r.clearTimeout(a),a=null},s},ve=function(){};ve.prototype.allowedEvents_={},ve.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},ee(this,e,t),this.addEventListener=i},ve.prototype.addEventListener=ve.prototype.on,ve.prototype.off=function(e,t){te(this,e,t)},ve.prototype.removeEventListener=ve.prototype.off,ve.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},ne(this,e,t),this.addEventListener=i},ve.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},re(this,e,t),this.addEventListener=i},ve.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=J(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ie(this,e)},ve.prototype.dispatchEvent=ve.prototype.trigger,ve.prototype.queueTrigger=function(t){var i=this;ce||(ce=new Map);var n=t.type||t,r=ce.get(this);r||(r=new Map,ce.set(this,r));var a=r.get(n);r.delete(n),e.clearTimeout(a);var s=e.setTimeout(function(){0===r.size&&(r=null,ce.delete(i)),i.trigger(t)},0);r.set(n,s)};var ye=function(e){return e instanceof ve||!!e.eventBusEl_&&["on","one","off","trigger"].every(function(t){return"function"==typeof e[t]})},_e=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},be=function(e){if(!e.nodeName&&!ye(e))throw new Error("Invalid target; must be a DOM node or evented object.")},Te=function(e){if(!_e(e))throw new Error("Invalid event type; must be a non-empty string or array.")},Se=function(e){if("function"!=typeof e)throw new Error("Invalid listener; must be a function.")},ke=function(e,t){var i,n,r,a=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return a?(i=e.eventBusEl_,t.length>=3&&t.shift(),n=t[0],r=t[1]):(i=t[0],n=t[1],r=t[2]),be(i),Te(n),Se(r),{isTargetingSelf:a,target:i,type:n,listener:r=pe(e,r)}},Ee=function(e,t,i,n){be(e),e.nodeName?se[t](e,i,n):e[t](i,n)},we={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=ke(this,i),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(Ee(s,"on",o,u),!a){var l=function(){return e.off(s,o,u)};l.guid=u.guid;var c=function(){return e.off("dispose",l)};c.guid=u.guid,Ee(this,"on","dispose",l),Ee(s,"on","dispose",c)}},one:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=ke(this,i),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)Ee(s,"one",o,u);else{var l=function t(){e.off(s,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)};l.guid=u.guid,Ee(s,"one",o,l)}},any:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=ke(this,i),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)Ee(s,"any",o,u);else{var l=function t(){e.off(s,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)};l.guid=u.guid,Ee(s,"any",o,l)}},off:function(e,t,i){if(!e||_e(e))te(this.eventBusEl_,e,t);else{var n=e,r=t;be(n),Te(r),Se(i),i=pe(this,i),this.off("dispose",i),n.nodeName?(te(n,r,i),te(n,"dispose",i)):ye(n)&&(n.off(r,i),n.off("dispose",i))}},trigger:function(e,t){return ie(this.eventBusEl_,e,t)}};function Ce(t,i){void 0===i&&(i={});var n=i.eventBusKey;if(n){if(!t[n].nodeName)throw new Error('The eventBusKey "'+n+'" does not refer to an element.');t.eventBusEl_=t[n]}else t.eventBusEl_=b("span",{className:"vjs-event-bus"});return c(t,we),t.eventedCallbacks&&t.eventedCallbacks.forEach(function(e){e()}),t.on("dispose",function(){t.off(),e.setTimeout(function(){t.eventBusEl_=null},0)}),t}var Pe={state:{},setState:function(e){var t,i=this;return"function"==typeof e&&(e=e()),l(e,function(e,n){i.state[n]!==e&&((t=t||{})[n]={from:i.state[n],to:e}),i.state[n]=e}),t&&ye(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function Ae(e,t){return c(e,Pe),e.state=c({},e.state,t),"function"==typeof e.handleStateChanged&&ye(e)&&e.on("statechanged",e.handleStateChanged),e}var Re=function(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toLowerCase()})},Le=function(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toUpperCase()})};function Oe(){for(var e={},t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.forEach(function(t){t&&l(t,function(t,i){h(t)?(h(e[i])||(e[i]={}),e[i]=Oe(e[i],t)):e[i]=t})}),e}var Ie=function(){function t(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.parentComponent_=null,this.options_=Oe({},this.options_),t=this.options_=Oe(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){var n=e&&e.id&&e.id()||"no_player";this.id_=n+"_component_"+$()}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),!1!==t.evented&&Ce(this,{eventBusKey:this.el_?"el_":null}),Ae(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.clearingTimersOnDispose_=!1,!1!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var i=t.prototype;return i.dispose=function(){if(this.trigger({type:"dispose",bubbles:!1}),this.children_)for(var e=this.children_.length-1;e>=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),W.has(this.el_)&&W.delete(this.el_),this.el_=null),this.player_=null},i.player=function(){return this.player_},i.options=function(e){return e?(this.options_=Oe(this.options_,e),this.options_):this.options_},i.el=function(){return this.el_},i.createEl=function(e,t,i){return b(e,t,i)},i.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],s=n&&n.split("-")[0],o=r&&r[s],u=i;return a&&a[e]?u=a[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,function(e,i){var n=t[i-1],r=n;return void 0===n&&(r=e),r})),u},i.contentEl=function(){return this.contentEl_||this.el_},i.id=function(){return this.id_},i.name=function(){return this.name_},i.children=function(){return this.children_},i.getChildById=function(e){return this.childIndex_[e]},i.getChild=function(e){if(e)return this.childNameIndex_[e]},i.addChild=function(e,i,n){var r,a;if(void 0===i&&(i={}),void 0===n&&(n=this.children_.length),"string"==typeof e){a=Le(e);var s=i.componentClass||a;i.name=a;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,i)}else r=e;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(n,0,r),r.parentComponent_=this,"function"==typeof r.id&&(this.childIndex_[r.id()]=r),(a=a||r.name&&Le(r.name()))&&(this.childNameIndex_[a]=r,this.childNameIndex_[Re(a)]=r),"function"==typeof r.el&&r.el()){var u=this.contentEl().children[n]||null;this.contentEl().insertBefore(r.el(),u)}return r},i.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,i=this.children_.length-1;i>=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Le(e.name())]=null,this.childNameIndex_[Re(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},i.initChildren=function(){var e=this,i=this.options_.children;if(i){var n,r=this.options_,a=t.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter(function(e){return!n.some(function(t){return"string"==typeof t?e===t:e===t.name})})).map(function(t){var n,r;return"string"==typeof t?r=i[n=t]||e.options_[n]||{}:(n=t.name,r=t),{name:n,opts:r}}).filter(function(e){var i=t.getComponent(e.opts.componentClass||Le(e.name));return i&&!a.isTech(i)}).forEach(function(t){var i=t.name,n=t.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=e.options_.playerOptions;var a=e.addChild(i,n);a&&(e[i]=a)}})}},i.buildCSSClass=function(){return""},i.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},i.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)},i.$=function(e,t){return H(e,t||this.contentEl())},i.$$=function(e,t){return z(e,t||this.contentEl())},i.hasClass=function(e){return k(this.el_,e)},i.addClass=function(e){E(this.el_,e)},i.removeClass=function(e){w(this.el_,e)},i.toggleClass=function(e,t){C(this.el_,e,t)},i.show=function(){this.removeClass("vjs-hidden")},i.hide=function(){this.addClass("vjs-hidden")},i.lockShowing=function(){this.addClass("vjs-lock-showing")},i.unlockShowing=function(){this.removeClass("vjs-lock-showing")},i.getAttribute=function(e){return R(this.el_,e)},i.setAttribute=function(e,t){L(this.el_,e,t)},i.removeAttribute=function(e){O(this.el_,e)},i.width=function(e,t){return this.dimension("width",e,t)},i.height=function(e,t){return this.dimension("height",e,t)},i.dimensions=function(e,t){this.width(e,!0),this.height(t)},i.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+Le(e)],10)},i.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=f(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+Le(e);t=this.el_[i]}return t},i.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},i.currentWidth=function(){return this.currentDimension("width")},i.currentHeight=function(){return this.currentDimension("height")},i.focus=function(){this.el_.focus()},i.blur=function(){this.el_.blur()},i.handleKeyDown=function(e){this.player_&&(e.stopPropagation(),this.player_.handleKeyDown(e))},i.handleKeyPress=function(e){this.handleKeyDown(e)},i.emitTapEvents=function(){var t,i=0,n=null;this.on("touchstart",function(r){1===r.touches.length&&(n={pageX:r.touches[0].pageX,pageY:r.touches[0].pageY},i=e.performance.now(),t=!0)}),this.on("touchmove",function(e){if(e.touches.length>1)t=!1;else if(n){var i=e.touches[0].pageX-n.pageX,r=e.touches[0].pageY-n.pageY;Math.sqrt(i*i+r*r)>10&&(t=!1)}});var r=function(){t=!1};this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",function(r){(n=null,!0===t)&&(e.performance.now()-i<200&&(r.preventDefault(),this.trigger("tap")))})},i.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=pe(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},i.setTimeout=function(t,i){var n,r=this;return t=pe(this,t),this.clearTimersOnDispose_(),n=e.setTimeout(function(){r.setTimeoutIds_.has(n)&&r.setTimeoutIds_.delete(n),t()},i),this.setTimeoutIds_.add(n),n},i.clearTimeout=function(t){return this.setTimeoutIds_.has(t)&&(this.setTimeoutIds_.delete(t),e.clearTimeout(t)),t},i.setInterval=function(t,i){t=pe(this,t),this.clearTimersOnDispose_();var n=e.setInterval(t,i);return this.setIntervalIds_.add(n),n},i.clearInterval=function(t){return this.setIntervalIds_.has(t)&&(this.setIntervalIds_.delete(t),e.clearInterval(t)),t},i.requestAnimationFrame=function(t){var i,n=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),t=pe(this,t),i=e.requestAnimationFrame(function(){n.rafIds_.has(i)&&n.rafIds_.delete(i),t()}),this.rafIds_.add(i),i):this.setTimeout(t,1e3/60)},i.cancelAnimationFrame=function(t){return this.supportsRaf_?(this.rafIds_.has(t)&&(this.rafIds_.delete(t),e.cancelAnimationFrame(t)),t):this.clearTimeout(t)},i.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",function(){[["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(t){var i=t[0],n=t[1];e[i].forEach(e[n],e)}),e.clearingTimersOnDispose_=!1}))},t.registerComponent=function(e,i){if("string"!=typeof e||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var n,r=t.getComponent("Tech"),a=r&&r.isTech(i),s=t===i||t.prototype.isPrototypeOf(i.prototype);if(a||!s)throw n=a?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+e+'"; '+n+".");e=Le(e),t.components_||(t.components_={});var o=t.getComponent("Player");if("Player"===e&&o&&o.players){var u=o.players,l=Object.keys(u);if(u&&l.length>0&&l.map(function(e){return u[e]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return t.components_[e]=i,t.components_[Re(e)]=i,i},t.getComponent=function(e){if(e&&t.components_)return t.components_[e]},t}();function xe(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function De(e,t){return(De=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Me(e,t,i){return(Me=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&De(r,i.prototype),r}).apply(null,arguments)}function Ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}Ie.prototype.supportsRaf_="function"==typeof e.requestAnimationFrame&&"function"==typeof e.cancelAnimationFrame,Ie.registerComponent("Component",Ie);var je,Be=e.navigator&&e.navigator.userAgent||"",Ne=/AppleWebKit\/([\d.]+)/i.exec(Be),Fe=Ne?parseFloat(Ne.pop()):null,Ve=/iPad/i.test(Be),Ge=/iPhone/i.test(Be)&&!Ve,He=/iPod/i.test(Be),ze=Ge||Ve||He,qe=(je=Be.match(/OS (\d+)_/i))&&je[1]?je[1]:null,We=/Android/i.test(Be),Ke=function(){var e=Be.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),$e=We&&Ke<5&&Fe<537,Xe=/Firefox/i.test(Be),Ye=/Edge/i.test(Be),Je=!Ye&&(/Chrome/i.test(Be)||/CriOS/i.test(Be)),Qe=function(){var e=Be.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Ze=function(){var e=/MSIE\s(\d+)\.\d/.exec(Be),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(Be)&&/rv:11.0/.test(Be)&&(t=11),t}(),et=/Safari/i.test(Be)&&!Je&&!We&&!Ye,tt=(et||ze)&&!Je,it=/Windows/i.test(Be),nt=g()&&("ontouchstart"in e||e.navigator.maxTouchPoints||e.DocumentTouch&&e.document instanceof e.DocumentTouch),rt=Object.freeze({IS_IPAD:Ve,IS_IPHONE:Ge,IS_IPOD:He,IS_IOS:ze,IOS_VERSION:qe,IS_ANDROID:We,ANDROID_VERSION:Ke,IS_NATIVE_ANDROID:$e,IS_FIREFOX:Xe,IS_EDGE:Ye,IS_CHROME:Je,CHROME_VERSION:Qe,IE_VERSION:Ze,IS_SAFARI:et,IS_ANY_SAFARI:tt,IS_WINDOWS:it,TOUCH_ENABLED:nt});function at(e,t,i,n){return function(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function st(e){return void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:at.bind(null,"start",0,e),end:at.bind(null,"end",1,e)}}function ot(e,t){return Array.isArray(e)?st(e):void 0===e||void 0===t?st():st([[e,t]])}function ut(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=ot(0,0));for(var a=0;a<e.length;a++)i=e.start(a),(n=e.end(a))>t&&(n=t),r+=n-i;return r/t}for(var lt,ct={prefixed:!0},dt=[["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"]],ht=dt[0],ft=0;ft<dt.length;ft++)if(dt[ft][1]in t){lt=dt[ft];break}if(lt){for(var pt=0;pt<lt.length;pt++)ct[ht[pt]]=lt[pt];ct.prefixed=lt[0]!==ht[0]}function mt(e){if(e instanceof mt)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:d(e)&&("number"==typeof e.code&&(this.code=e.code),c(this,e)),this.message||(this.message=mt.defaultMessages[this.code]||"")}mt.prototype.code=0,mt.prototype.message="",mt.prototype.status=null,mt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],mt.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var gt=0;gt<mt.errorTypes.length;gt++)mt[mt.errorTypes[gt]]=gt,mt.prototype[mt.errorTypes[gt]]=gt;var vt=function(e,t){var i,n=null;try{i=JSON.parse(e,t)}catch(e){n=e}return[n,i]};function yt(e){return void 0!==e&&null!==e&&"function"==typeof e.then}function _t(e){yt(e)&&e.then(null,function(e){})}var bt=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(t,i,n){return e[i]&&(t[i]=e[i]),t},{cues:e.cues&&Array.prototype.map.call(e.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})},Tt=function(e){var t=e.$$("track"),i=Array.prototype.map.call(t,function(e){return e.track});return Array.prototype.map.call(t,function(e){var t=bt(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===i.indexOf(e)}).map(bt))},St=function(e,t){return e.forEach(function(e){var i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(function(e){return i.addCue(e)})}),t.textTracks()};function kt(e,t){return e(t={exports:{}},t.exports),t.exports}var Et=kt(function(e,t){function i(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return s[e];var i,a=String(e);return(i=n[a.toLowerCase()])?i:(i=r[a.toLowerCase()])||(1===a.length?a.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null===i||void 0===i)return!1;if("string"==typeof t){var a;if(a=n[t.toLowerCase()])return a===i;if(a=r[t.toLowerCase()])return a===i}else if("number"==typeof t)return t===i;return!1}};var n=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(a=97;a<123;a++)n[String.fromCharCode(a)]=a-32;for(var a=48;a<58;a++)n[a-48]=a;for(a=1;a<13;a++)n["f"+a]=a+111;for(a=0;a<10;a++)n["numpad "+a]=a+96;var s=t.names=t.title={};for(a in n)s[n[a]]=a;for(var o in r)n[o]=r[o]}),wt=(Et.code,Et.codes,Et.aliases,Et.names,Et.title,"vjs-modal-dialog"),Ct=function(i){function n(e,t){var n;return(n=i.call(this,e,t)||this).opened_=n.hasBeenOpened_=n.hasBeenFilled_=!1,n.closeable(!n.options_.uncloseable),n.content(n.options_.content),n.contentEl_=b("div",{className:wt+"-content"},{role:"document"}),n.descEl_=b("p",{className:wt+"-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_),n}xe(n,i);var r=n.prototype;return r.createEl=function(){return i.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},r.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,i.prototype.dispose.call(this)},r.buildCSSClass=function(){return wt+" vjs-hidden "+i.prototype.buildCSSClass.call(this)},r.label=function(){return this.localize(this.options_.label||"Modal Window")},r.description=function(){var e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e},r.open=function(){if(!this.opened_){var e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}},r.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},r.close=function(){if(this.opened_){var e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}},r.closeable=function(e){if("boolean"==typeof e){var t=this.closeable_=!!e,i=this.getChild("closeButton");if(t&&!i){var n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close)}!t&&i&&(this.off(i,"close",this.close),this.removeChild(i),i.dispose())}return this.closeable_},r.fill=function(){this.fillWith(this.content())},r.fillWith=function(e){var t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),V(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);var r=this.getChild("closeButton");r&&i.appendChild(r.el_)},r.empty=function(){this.trigger("beforemodalempty"),B(this.contentEl()),this.trigger("modalempty")},r.content=function(e){return void 0!==e&&(this.content_=e),this.content_},r.conditionalFocus_=function(){var e=t.activeElement,i=this.player_.el_;this.previouslyActiveEl_=null,(i.contains(e)||i===e)&&(this.previouslyActiveEl_=e,this.focus())},r.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},r.handleKeyDown=function(e){if(e.stopPropagation(),Et.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(Et.isEventKey(e,"Tab")){for(var i,n=this.focusableEls_(),r=this.el_.querySelector(":focus"),a=0;a<n.length;a++)if(r===n[a]){i=a;break}t.activeElement===this.el_&&(i=0),e.shiftKey&&0===i?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||i!==n.length-1||(n[0].focus(),e.preventDefault())}},r.focusableEls_=function(){var t=this.el_.querySelectorAll("*");return Array.prototype.filter.call(t,function(t){return(t instanceof e.HTMLAnchorElement||t instanceof e.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof e.HTMLInputElement||t instanceof e.HTMLSelectElement||t instanceof e.HTMLTextAreaElement||t instanceof e.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof e.HTMLIFrameElement||t instanceof e.HTMLObjectElement||t instanceof e.HTMLEmbedElement||t.hasAttribute("tabindex")&&-1!==t.getAttribute("tabindex")||t.hasAttribute("contenteditable")})},n}(Ie);Ct.prototype.options_={pauseOnOpen:!0,temporary:!0},Ie.registerComponent("ModalDialog",Ct);var Pt=function(e){function t(t){var i;void 0===t&&(t=[]),(i=e.call(this)||this).tracks_=[],Object.defineProperty(Ue(i),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<t.length;n++)i.addTrack(t[n]);return i}xe(t,e);var i=t.prototype;return i.addTrack=function(e){var t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.tracks_[t]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this}))},i.removeTrack=function(e){for(var t,i=0,n=this.length;i<n;i++)if(this[i]===e){(t=this[i]).off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},i.getTrackById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},t}(ve);for(var At in Pt.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"},Pt.prototype.allowedEvents_)Pt.prototype["on"+At]=null;var Rt=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)},Lt=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].enabled){Rt(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}xe(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&Rt(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,Rt(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(Pt),Ot=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)},It=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].selected){Ot(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(Ue(i),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),i}xe(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.selected&&Ot(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,Ot(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)},t}(Pt),xt=function(e){function t(){return e.apply(this,arguments)||this}xe(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;e.prototype.addTrack.call(this,t),this.queueChange_||(this.queueChange_=function(){return i.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return i.trigger("selectedlanguagechange")}),t.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&(this.queueChange_&&t.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&t.removeEventListener("modechange",this.triggerSelectedlanguagechange_))},t}(Pt),Dt=function(){function e(e){void 0===e&&(e=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}var t=e.prototype;return t.addTrackElement_=function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)},t.getTrackElementByTrack_=function(e){for(var t,i=0,n=this.trackElements_.length;i<n;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t},t.removeTrackElement_=function(e){for(var t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}},e}(),Mt=function(){function e(t){e.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var t=e.prototype;return t.setCues_=function(e){var t=this.length||0,i=0,n=e.length;this.cues_=e,this.length_=e.length;var r=function(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})};if(t<n)for(i=t;i<n;i++)r.call(this,i)},t.getCueById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},e}(),Ut={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},jt={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Bt={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Nt={disabled:"disabled",hidden:"hidden",showing:"showing"},Ft=function(e){function t(t){var i;void 0===t&&(t={}),i=e.call(this)||this;var n={id:t.id||"vjs_track_"+$(),kind:t.kind||"",label:t.label||"",language:t.language||""},r=function(e){Object.defineProperty(Ue(i),e,{get:function(){return n[e]},set:function(){}})};for(var a in n)r(a);return i}return xe(t,e),t}(ve),Vt=function(i){var n=["protocol","hostname","port","pathname","search","hash","host"],r=t.createElement("a");r.href=i;var a,s=""===r.host&&"file:"!==r.protocol;s&&((a=t.createElement("div")).innerHTML='<a href="'+i+'"></a>',r=a.firstChild,a.setAttribute("style","display:none; position:absolute;"),t.body.appendChild(a));for(var o={},u=0;u<n.length;u++)o[n[u]]=r[n[u]];return"http:"===o.protocol&&(o.host=o.host.replace(/:80$/,"")),"https:"===o.protocol&&(o.host=o.host.replace(/:443$/,"")),o.protocol||(o.protocol=e.location.protocol),s&&t.body.removeChild(a),o},Gt=function(e){if(!e.match(/^https?:\/\//)){var i=t.createElement("div");i.innerHTML='<a href="'+e+'">x</a>',e=i.firstChild.href}return e},Ht=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},zt=function(t){var i=e.location,n=Vt(t);return(":"===n.protocol?i.protocol:n.protocol)+n.host!==i.protocol+i.host},qt=Object.freeze({parseUrl:Vt,getAbsoluteURL:Gt,getFileExtension:Ht,isCrossOrigin:zt}),Wt=function(e){var t=Kt.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)},Kt=Object.prototype.toString;var $t,Xt=Array.prototype.slice,Yt=Object.prototype.toString,Jt=Function.prototype.bind||function(e){var t=this;if("function"!=typeof t||"[object Function]"!==Yt.call(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var i,n=Xt.call(arguments,1),r=Math.max(0,t.length-n.length),a=[],s=0;s<r;s++)a.push("$"+s);if(i=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof i){var r=t.apply(this,n.concat(Xt.call(arguments)));return Object(r)===r?r:this}return t.apply(e,n.concat(Xt.call(arguments)))}),t.prototype){var o=function(){};o.prototype=t.prototype,i.prototype=new o,o.prototype=null}return i},Qt=Object.prototype.toString,Zt=function(e){var t=Qt.call(e),i="[object Arguments]"===t;return i||(i="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===Qt.call(e.callee)),i};if(!Object.keys){var ei=Object.prototype.hasOwnProperty,ti=Object.prototype.toString,ii=Zt,ni=Object.prototype.propertyIsEnumerable,ri=!ni.call({toString:null},"toString"),ai=ni.call(function(){},"prototype"),si=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],oi=function(e){var t=e.constructor;return t&&t.prototype===e},ui={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},li=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!ui["$"+e]&&ei.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{oi(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();$t=function(e){var t=null!==e&&"object"==typeof e,i="[object Function]"===ti.call(e),n=ii(e),r=t&&"[object String]"===ti.call(e),a=[];if(!t&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var s=ai&&i;if(r&&e.length>0&&!ei.call(e,0))for(var o=0;o<e.length;++o)a.push(String(o));if(n&&e.length>0)for(var u=0;u<e.length;++u)a.push(String(u));else for(var l in e)s&&"prototype"===l||!ei.call(e,l)||a.push(String(l));if(ri)for(var c=function(e){if("undefined"==typeof window||!li)return oi(e);try{return oi(e)}catch(e){return!1}}(e),d=0;d<si.length;++d)c&&"constructor"===si[d]||!ei.call(e,si[d])||a.push(si[d]);return a}}var ci=$t,di=Array.prototype.slice,hi=Object.keys,fi=hi?function(e){return hi(e)}:ci,pi=Object.keys;fi.shim=function(){Object.keys?function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2)||(Object.keys=function(e){return Zt(e)?pi(di.call(e)):pi(e)}):Object.keys=fi;return Object.keys||fi};var mi=fi,gi="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),vi=Object.prototype.toString,yi=Array.prototype.concat,_i=Object.defineProperty,bi=_i&&function(){var e={};try{for(var t in _i(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),Ti=function(e,t,i,n){var r;t in e&&("function"!=typeof(r=n)||"[object Function]"!==vi.call(r)||!n())||(bi?_i(e,t,{configurable:!0,enumerable:!1,value:i,writable:!0}):e[t]=i)},Si=function(e,t){var i=arguments.length>2?arguments[2]:{},n=mi(t);gi&&(n=yi.call(n,Object.getOwnPropertySymbols(t)));for(var r=0;r<n.length;r+=1)Ti(e,n[r],t[n[r]],i[n[r]])};Si.supportsDescriptors=!!bi;var ki=Si,Ei=Object.getOwnPropertyDescriptor?function(){return Object.getOwnPropertyDescriptor(arguments,"callee").get}():function(){throw new TypeError},wi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,Ci=Object.getPrototypeOf||function(e){return e.__proto__},Pi="undefined"==typeof Uint8Array?void 0:Ci(Uint8Array),Ai={"$ %Array%":Array,"$ %ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"$ %ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer.prototype,"$ %ArrayIteratorPrototype%":wi?Ci([][Symbol.iterator]()):void 0,"$ %ArrayPrototype%":Array.prototype,"$ %ArrayProto_entries%":Array.prototype.entries,"$ %ArrayProto_forEach%":Array.prototype.forEach,"$ %ArrayProto_keys%":Array.prototype.keys,"$ %ArrayProto_values%":Array.prototype.values,"$ %AsyncFromSyncIteratorPrototype%":void 0,"$ %AsyncFunction%":void 0,"$ %AsyncFunctionPrototype%":void 0,"$ %AsyncGenerator%":void 0,"$ %AsyncGeneratorFunction%":void 0,"$ %AsyncGeneratorPrototype%":void 0,"$ %AsyncIteratorPrototype%":void 0,"$ %Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"$ %Boolean%":Boolean,"$ %BooleanPrototype%":Boolean.prototype,"$ %DataView%":"undefined"==typeof DataView?void 0:DataView,"$ %DataViewPrototype%":"undefined"==typeof DataView?void 0:DataView.prototype,"$ %Date%":Date,"$ %DatePrototype%":Date.prototype,"$ %decodeURI%":decodeURI,"$ %decodeURIComponent%":decodeURIComponent,"$ %encodeURI%":encodeURI,"$ %encodeURIComponent%":encodeURIComponent,"$ %Error%":Error,"$ %ErrorPrototype%":Error.prototype,"$ %eval%":eval,"$ %EvalError%":EvalError,"$ %EvalErrorPrototype%":EvalError.prototype,"$ %Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"$ %Float32ArrayPrototype%":"undefined"==typeof Float32Array?void 0:Float32Array.prototype,"$ %Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"$ %Float64ArrayPrototype%":"undefined"==typeof Float64Array?void 0:Float64Array.prototype,"$ %Function%":Function,"$ %FunctionPrototype%":Function.prototype,"$ %Generator%":void 0,"$ %GeneratorFunction%":void 0,"$ %GeneratorPrototype%":void 0,"$ %Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"$ %Int8ArrayPrototype%":"undefined"==typeof Int8Array?void 0:Int8Array.prototype,"$ %Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"$ %Int16ArrayPrototype%":"undefined"==typeof Int16Array?void 0:Int8Array.prototype,"$ %Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"$ %Int32ArrayPrototype%":"undefined"==typeof Int32Array?void 0:Int32Array.prototype,"$ %isFinite%":isFinite,"$ %isNaN%":isNaN,"$ %IteratorPrototype%":wi?Ci(Ci([][Symbol.iterator]())):void 0,"$ %JSON%":JSON,"$ %JSONParse%":JSON.parse,"$ %Map%":"undefined"==typeof Map?void 0:Map,"$ %MapIteratorPrototype%":"undefined"!=typeof Map&&wi?Ci((new Map)[Symbol.iterator]()):void 0,"$ %MapPrototype%":"undefined"==typeof Map?void 0:Map.prototype,"$ %Math%":Math,"$ %Number%":Number,"$ %NumberPrototype%":Number.prototype,"$ %Object%":Object,"$ %ObjectPrototype%":Object.prototype,"$ %ObjProto_toString%":Object.prototype.toString,"$ %ObjProto_valueOf%":Object.prototype.valueOf,"$ %parseFloat%":parseFloat,"$ %parseInt%":parseInt,"$ %Promise%":"undefined"==typeof Promise?void 0:Promise,"$ %PromisePrototype%":"undefined"==typeof Promise?void 0:Promise.prototype,"$ %PromiseProto_then%":"undefined"==typeof Promise?void 0:Promise.prototype.then,"$ %Promise_all%":"undefined"==typeof Promise?void 0:Promise.all,"$ %Promise_reject%":"undefined"==typeof Promise?void 0:Promise.reject,"$ %Promise_resolve%":"undefined"==typeof Promise?void 0:Promise.resolve,"$ %Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"$ %RangeError%":RangeError,"$ %RangeErrorPrototype%":RangeError.prototype,"$ %ReferenceError%":ReferenceError,"$ %ReferenceErrorPrototype%":ReferenceError.prototype,"$ %Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"$ %RegExp%":RegExp,"$ %RegExpPrototype%":RegExp.prototype,"$ %Set%":"undefined"==typeof Set?void 0:Set,"$ %SetIteratorPrototype%":"undefined"!=typeof Set&&wi?Ci((new Set)[Symbol.iterator]()):void 0,"$ %SetPrototype%":"undefined"==typeof Set?void 0:Set.prototype,"$ %SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"$ %SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer.prototype,"$ %String%":String,"$ %StringIteratorPrototype%":wi?Ci(""[Symbol.iterator]()):void 0,"$ %StringPrototype%":String.prototype,"$ %Symbol%":wi?Symbol:void 0,"$ %SymbolPrototype%":wi?Symbol.prototype:void 0,"$ %SyntaxError%":SyntaxError,"$ %SyntaxErrorPrototype%":SyntaxError.prototype,"$ %ThrowTypeError%":Ei,"$ %TypedArray%":Pi,"$ %TypedArrayPrototype%":Pi?Pi.prototype:void 0,"$ %TypeError%":TypeError,"$ %TypeErrorPrototype%":TypeError.prototype,"$ %Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"$ %Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?void 0:Uint8Array.prototype,"$ %Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"$ %Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray.prototype,"$ %Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"$ %Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?void 0:Uint16Array.prototype,"$ %Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"$ %Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?void 0:Uint32Array.prototype,"$ %URIError%":URIError,"$ %URIErrorPrototype%":URIError.prototype,"$ %WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"$ %WeakMapPrototype%":"undefined"==typeof WeakMap?void 0:WeakMap.prototype,"$ %WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet,"$ %WeakSetPrototype%":"undefined"==typeof WeakSet?void 0:WeakSet.prototype},Ri=function(e,t){if(arguments.length>1&&"boolean"!=typeof t)throw new TypeError('"allowMissing" argument must be a boolean');var i="$ "+e;if(!(i in Ai))throw new SyntaxError("intrinsic "+e+" does not exist!");if(void 0===Ai[i]&&!t)throw new TypeError("intrinsic "+e+" exists, but is not available. Please file an issue!");return Ai[i]},Li=Jt.call(Function.call,Object.prototype.hasOwnProperty),Oi=Ri("%TypeError%"),Ii=Ri("%SyntaxError%"),xi={"Property Descriptor":function(e,t){if("Object"!==e.Type(t))return!1;var i={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var n in t)if(Li(t,n)&&!i[n])return!1;var r=Li(t,"[[Value]]"),a=Li(t,"[[Get]]")||Li(t,"[[Set]]");if(r&&a)throw new Oi("Property Descriptors may not be both accessor and data descriptors");return!0}},Di=function(e,t,i,n){var r=xi[t];if("function"!=typeof r)throw new Ii("unknown record type: "+t);if(!r(e,n))throw new Oi(i+" must be a "+t);console.log(r(e,n),n)},Mi=Number.isNaN||function(e){return e!=e},Ui=Number.isNaN||function(e){return e!=e},ji=Number.isFinite||function(e){return"number"==typeof e&&!Ui(e)&&e!==1/0&&e!==-1/0},Bi=function(e){return e>=0?1:-1},Ni=Function.prototype.toString,Fi=/^\s*class\b/,Vi=function(e){try{var t=Ni.call(e);return Fi.test(t)}catch(e){return!1}},Gi=Object.prototype.toString,Hi="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,zi=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if("function"==typeof e&&!e.prototype)return!0;if(Hi)return function(e){try{return!Vi(e)&&(Ni.call(e),!0)}catch(e){return!1}}(e);if(Vi(e))return!1;var t=Gi.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t},qi=function(e){return null===e||"function"!=typeof e&&"object"!=typeof e},Wi=Object.prototype.toString,Ki=function(e){var t;if((t=arguments.length>1?arguments[1]:"[object Date]"===Wi.call(e)?String:Number)===String||t===Number){var i,n,r=t===String?["toString","valueOf"]:["valueOf","toString"];for(n=0;n<r.length;++n)if(zi(e[r[n]])&&(i=e[r[n]](),qi(i)))return i;throw new TypeError("No default value")}throw new TypeError("invalid [[DefaultValue]] hint supplied")},$i=Ri("%Object%"),Xi=Ri("%TypeError%"),Yi=Ri("%String%"),Ji={ToPrimitive:function(e){return qi(e)?e:arguments.length>1?Ki(e,arguments[1]):Ki(e)},ToBoolean:function(e){return!!e},ToNumber:function(e){return+e},ToInteger:function(e){var t=this.ToNumber(e);return Mi(t)?0:0!==t&&ji(t)?Bi(t)*Math.floor(Math.abs(t)):t},ToInt32:function(e){return this.ToNumber(e)>>0},ToUint32:function(e){return this.ToNumber(e)>>>0},ToUint16:function(e){var t=this.ToNumber(e);return Mi(t)||0===t||!ji(t)?0:function(e,t){var i=e%t;return Math.floor(i>=0?i:i+t)}(Bi(t)*Math.floor(Math.abs(t)),65536)},ToString:function(e){return Yi(e)},ToObject:function(e){return this.CheckObjectCoercible(e),$i(e)},CheckObjectCoercible:function(e,t){if(null==e)throw new Xi(t||"Cannot call method on "+e);return e},IsCallable:zi,SameValue:function(e,t){return e===t?0!==e||1/e==1/t:Mi(e)&&Mi(t)},Type:function(e){return null===e?"Null":void 0===e?"Undefined":"function"==typeof e||"object"==typeof e?"Object":"number"==typeof e?"Number":"boolean"==typeof e?"Boolean":"string"==typeof e?"String":void 0},IsPropertyDescriptor:function(e){if("Object"!==this.Type(e))return!1;var t={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var i in e)if(Li(e,i)&&!t[i])return!1;var n=Li(e,"[[Value]]"),r=Li(e,"[[Get]]")||Li(e,"[[Set]]");if(n&&r)throw new Xi("Property Descriptors may not be both accessor and data descriptors");return!0},IsAccessorDescriptor:function(e){return void 0!==e&&(Di(this,"Property Descriptor","Desc",e),!(!Li(e,"[[Get]]")&&!Li(e,"[[Set]]")))},IsDataDescriptor:function(e){return void 0!==e&&(Di(this,"Property Descriptor","Desc",e),!(!Li(e,"[[Value]]")&&!Li(e,"[[Writable]]")))},IsGenericDescriptor:function(e){return void 0!==e&&(Di(this,"Property Descriptor","Desc",e),!this.IsAccessorDescriptor(e)&&!this.IsDataDescriptor(e))},FromPropertyDescriptor:function(e){if(void 0===e)return e;if(Di(this,"Property Descriptor","Desc",e),this.IsDataDescriptor(e))return{value:e["[[Value]]"],writable:!!e["[[Writable]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};if(this.IsAccessorDescriptor(e))return{get:e["[[Get]]"],set:e["[[Set]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};throw new Xi("FromPropertyDescriptor must be called with a fully populated Property Descriptor")},ToPropertyDescriptor:function(e){if("Object"!==this.Type(e))throw new Xi("ToPropertyDescriptor requires an object");var t={};if(Li(e,"enumerable")&&(t["[[Enumerable]]"]=this.ToBoolean(e.enumerable)),Li(e,"configurable")&&(t["[[Configurable]]"]=this.ToBoolean(e.configurable)),Li(e,"value")&&(t["[[Value]]"]=e.value),Li(e,"writable")&&(t["[[Writable]]"]=this.ToBoolean(e.writable)),Li(e,"get")){var i=e.get;if(void 0!==i&&!this.IsCallable(i))throw new TypeError("getter must be a function");t["[[Get]]"]=i}if(Li(e,"set")){var n=e.set;if(void 0!==n&&!this.IsCallable(n))throw new Xi("setter must be a function");t["[[Set]]"]=n}if((Li(t,"[[Get]]")||Li(t,"[[Set]]"))&&(Li(t,"[[Value]]")||Li(t,"[[Writable]]")))throw new Xi("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t}},Qi=Jt.call(Function.call,String.prototype.replace),Zi=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,en=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/,tn=function(){var e=Ji.ToString(Ji.CheckObjectCoercible(this));return Qi(Qi(e,Zi,""),en,"")},nn=function(){return String.prototype.trim&&""==="".trim()?String.prototype.trim:tn},rn=Jt.call(Function.call,nn());ki(rn,{getPolyfill:nn,implementation:tn,shim:function(){var e=nn();return ki(String.prototype,{trim:e},{trim:function(){return String.prototype.trim!==e}}),e}});var an=rn,sn=Object.prototype.toString,on=Object.prototype.hasOwnProperty,un=function(e,t,i){if(!zi(t))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),"[object Array]"===sn.call(e)?function(e,t,i){for(var n=0,r=e.length;n<r;n++)on.call(e,n)&&(null==i?t(e[n],n,e):t.call(i,e[n],n,e))}(e,t,n):"string"==typeof e?function(e,t,i){for(var n=0,r=e.length;n<r;n++)null==i?t(e.charAt(n),n,e):t.call(i,e.charAt(n),n,e)}(e,t,n):function(e,t,i){for(var n in e)on.call(e,n)&&(null==i?t(e[n],n,e):t.call(i,e[n],n,e))}(e,t,n)},ln=function(e){if(!e)return{};var t={};return un(an(e).split("\n"),function(e){var i,n=e.indexOf(":"),r=an(e.slice(0,n)).toLowerCase(),a=an(e.slice(n+1));void 0===t[r]?t[r]=a:(i=t[r],"[object Array]"===Object.prototype.toString.call(i)?t[r].push(a):t[r]=[t[r],a])}),t},cn=function(){for(var e={},t=0;t<arguments.length;t++){var i=arguments[t];for(var n in i)dn.call(i,n)&&(e[n]=i[n])}return e},dn=Object.prototype.hasOwnProperty;var hn=pn;function fn(e,t,i){var n=e;return Wt(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=cn(t,{uri:e}),n.callback=i,n}function pn(e,t,i){return mn(t=fn(e,t,i))}function mn(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,n,r){t||(t=!0,e.callback(i,n,r))};function n(e){return clearTimeout(u),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,m)}function r(){if(!s){var t;clearTimeout(u),t=e.useXDR&&void 0===o.status?200:1223===o.status?204:o.status;var n=m,r=null;return 0!==t?(n={body:function(){var e=void 0;if(e=o.response?o.response:o.responseText||function(e){if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;return""!==e.responseType||t?null:e.responseXML}(o),p)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:t,method:c,headers:{},url:l,rawRequest:o},o.getAllResponseHeaders&&(n.headers=ln(o.getAllResponseHeaders()))):r=new Error("Internal XMLHttpRequest Error"),i(r,n,n.body)}}var a,s,o=e.xhr||null;o||(o=e.cors||e.useXDR?new pn.XDomainRequest:new pn.XMLHttpRequest);var u,l=o.url=e.uri||e.url,c=o.method=e.method||"GET",d=e.body||e.data,h=o.headers=e.headers||{},f=!!e.sync,p=!1,m={body:void 0,headers:{},statusCode:0,method:c,url:l,rawRequest:o};if("json"in e&&!1!==e.json&&(p=!0,h.accept||h.Accept||(h.Accept="application/json"),"GET"!==c&&"HEAD"!==c&&(h["content-type"]||h["Content-Type"]||(h["Content-Type"]="application/json"),d=JSON.stringify(!0===e.json?d:e.json))),o.onreadystatechange=function(){4===o.readyState&&setTimeout(r,0)},o.onload=r,o.onerror=n,o.onprogress=function(){},o.onabort=function(){s=!0},o.ontimeout=n,o.open(c,l,!f,e.username,e.password),f||(o.withCredentials=!!e.withCredentials),!f&&e.timeout>0&&(u=setTimeout(function(){if(!s){s=!0,o.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}},e.timeout)),o.setRequestHeader)for(a in h)h.hasOwnProperty(a)&&o.setRequestHeader(a,h[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(o.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(o),o.send(d||null),o}pn.XMLHttpRequest=e.XMLHttpRequest||function(){},pn.XDomainRequest="withCredentials"in new pn.XMLHttpRequest?pn.XMLHttpRequest:e.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],function(e){pn["delete"===e?"del":e]=function(t,i,n){return(i=fn(t,i,n)).method=e.toUpperCase(),mn(i)}});var gn=function(t,i){var n=new e.WebVTT.Parser(e,e.vttjs,e.WebVTT.StringDecoder()),r=[];n.oncue=function(e){i.addCue(e)},n.onparsingerror=function(e){r.push(e)},n.onflush=function(){i.trigger({type:"loadeddata",target:i})},n.parse(t),r.length>0&&(e.console&&e.console.groupCollapsed&&e.console.groupCollapsed("Text Track parsing errors for "+i.src),r.forEach(function(e){return a.error(e)}),e.console&&e.console.groupEnd&&e.console.groupEnd()),n.flush()},vn=function(t,i){var n={uri:t},r=zt(t);r&&(n.cors=r),hn(n,pe(this,function(t,n,r){if(t)return a.error(t,n);i.loaded_=!0,"function"!=typeof e.WebVTT?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],function(e){if("vttjserror"!==e.type)return gn(r,i);a.error("vttjs failed to load, stopping trying to process "+i.src)}):gn(r,i)}))},yn=function(t){function i(e){var i;if(void 0===e&&(e={}),!e.tech)throw new Error("A tech was not provided.");var n=Oe(e,{kind:Bt[e.kind]||"subtitles",language:e.language||e.srclang||""}),r=Nt[n.mode]||"disabled",a=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=t.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[];var s=new Mt(i.cues_),o=new Mt(i.activeCues_),u=!1,l=pe(Ue(i),function(){this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1)});return"disabled"!==r&&i.tech_.ready(function(){i.tech_.on("timeupdate",l)},!0),Object.defineProperties(Ue(i),{default:{get:function(){return a},set:function(){}},mode:{get:function(){return r},set:function(e){var t=this;Nt[e]&&("disabled"!==(r=e)?this.tech_.ready(function(){t.tech_.on("timeupdate",l)},!0):this.tech_.off("timeupdate",l),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i<n;i++){var r=this.cues[i];r.startTime<=e&&r.endTime>=e?t.push(r):r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e&&t.push(r)}if(u=!1,t.length!==this.activeCues_.length)u=!0;else for(var a=0;a<t.length;a++)-1===this.activeCues_.indexOf(t[a])&&(u=!0);return this.activeCues_=t,o.setCues_(this.activeCues_),o},set:function(){}}}),n.src?(i.src=n.src,vn(n.src,Ue(i))):i.loaded_=!0,i}xe(i,t);var n=i.prototype;return n.addCue=function(t){var i=t;if(e.vttjs&&!(t instanceof e.vttjs.VTTCue)){for(var n in i=new e.vttjs.VTTCue(t.startTime,t.endTime,t.text),t)n in i||(i[n]=t[n]);i.id=t.id,i.originalCue_=t}for(var r=this.tech_.textTracks(),a=0;a<r.length;a++)r[a]!==this&&r[a].removeCue(i);this.cues_.push(i),this.cues.setCues_(this.cues_)},n.removeCue=function(e){for(var t=this.cues_.length;t--;){var i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}},i}(Ft);yn.prototype.allowedEvents_={cuechange:"cuechange"};var _n=function(e){function t(t){var i;void 0===t&&(t={});var n=Oe(t,{kind:jt[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(Ue(i),"enabled",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("enabledchange"))}}),n.enabled&&(i.enabled=n.enabled),i.loaded_=!0,i}return xe(t,e),t}(Ft),bn=function(e){function t(t){var i;void 0===t&&(t={});var n=Oe(t,{kind:Ut[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(Ue(i),"selected",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("selectedchange"))}}),n.selected&&(i.selected=n.selected),i}return xe(t,e),t}(Ft),Tn=0,Sn=2,kn=function(e){function t(t){var i,n;void 0===t&&(t={}),i=e.call(this)||this;var r=new yn(t);return i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i.default=r.default,Object.defineProperties(Ue(i),{readyState:{get:function(){return n}},track:{get:function(){return r}}}),n=Tn,r.addEventListener("loadeddata",function(){n=Sn,i.trigger({type:"load",target:Ue(i)})}),i}return xe(t,e),t}(ve);kn.prototype.allowedEvents_={load:"load"},kn.NONE=Tn,kn.LOADING=1,kn.LOADED=Sn,kn.ERROR=3;var En={audio:{ListClass:Lt,TrackClass:_n,capitalName:"Audio"},video:{ListClass:It,TrackClass:bn,capitalName:"Video"},text:{ListClass:xt,TrackClass:yn,capitalName:"Text"}};Object.keys(En).forEach(function(e){En[e].getterName=e+"Tracks",En[e].privateName=e+"Tracks_"});var wn={remoteText:{ListClass:xt,TrackClass:yn,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Dt,TrackClass:kn,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Cn=Oe(En,wn);wn.names=Object.keys(wn),En.names=Object.keys(En),Cn.names=[].concat(wn.names).concat(En.names);var Pn=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function An(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function Rn(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/1e3}var i=e.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function Ln(){this.values=Pn(null)}function On(e,t,i,n){var r=n?e.split(n):[e];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(i);if(2===s.length)t(s[0],s[1])}}function In(e,t,i){var n=e;function r(){var t=Rn(e);if(null===t)throw new An(An.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.substr(0,3))throw new An(An.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),a(),t.endTime=r(),a(),function(e,t){var n=new Ln;On(e,function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){n.set(e,i[r].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),s=a[0];n.integer(e,s),n.percent(e,s)&&n.set("snapToLines",!1),n.alt(e,s,["auto"]),2===a.length&&n.alt("lineAlign",a[1],["start","middle","end"]);break;case"position":a=t.split(","),n.percent(e,a[0]),2===a.length&&n.alt("positionAlign",a[1],["start","middle","end"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start","middle","end","left","right"])}},/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical",""),t.line=n.get("line","auto"),t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100),t.align=n.get("align","middle"),t.position=n.get("position",{start:0,left:0,middle:50,end:100,right:100},t.align),t.positionAlign=n.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},t.align)}(e,t)}An.prototype=Pn(Error.prototype),An.prototype.constructor=An,An.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Ln.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var xn={"&":"&","<":"<",">":">","‎":"","‏":""," ":" "},Dn={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Mn={v:"title",lang:"lang"},Un={rt:"ruby"};function jn(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function n(e){return xn[e]}function r(e){for(;f=e.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)e=e.replace(f[0],n);return e}function a(e,t){return!Un[t.localName]||Un[t.localName]===e.localName}function s(t,i){var n=Dn[t];if(!n)return null;var r=e.document.createElement(n);r.localName=n;var a=Mn[t];return a&&i&&(r[a]=i.trim()),r}for(var o,u=e.document.createElement("div"),l=u,c=[];null!==(o=i());)if("<"!==o[0])l.appendChild(e.document.createTextNode(r(o)));else{if("/"===o[1]){c.length&&c[c.length-1]===o.substr(2).replace(">","")&&(c.pop(),l=l.parentNode);continue}var d,h=Rn(o.substr(1,o.length-2));if(h){d=e.document.createProcessingInstruction("timestamp",h),l.appendChild(d);continue}var f=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!f)continue;if(!(d=s(f[1],f[3])))continue;if(!a(l,d))continue;f[2]&&(d.className=f[2].substr(1).replace("."," ")),c.push(f[1]),l.appendChild(d),l=d}return u}var Bn=[[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 Nn(e){for(var t=0;t<Bn.length;t++){var i=Bn[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function Fn(){}function Vn(e,t,i){Fn.call(this),this.cue=t,this.cueDiv=jn(e,t.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:function(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function n(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var a=i.match(/^.*(\n|\r)/);return a?(e.length=0,a[0]):i}return"ruby"===t.tagName?r(e):t.childNodes?(n(e,t),r(e)):void 0}for(n(t,e);i=r(t);)for(var a=0;a<i.length;a++)if(Nn(i.charCodeAt(a)))return"rtl";return"ltr"}(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":r=t.position;break;case"middle":r=t.position-t.size/2;break;case"end":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function Gn(e){var t,i,n,r;if(e.div){i=e.div.offsetHeight,n=e.div.offsetWidth,r=e.div.offsetTop;var a=(a=e.div.childNodes)&&(a=a[0])&&a.getClientRects&&a.getClientRects();e=e.div.getBoundingClientRect(),t=a?Math.max(a[0]&&a[0].height||0,e.height/a.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||i,this.bottom=e.bottom||r+(e.height||i),this.width=e.width||n,this.lineHeight=void 0!==t?t:e.lineHeight}function Hn(e,t,i,n){var r=new Gn(t),a=t.cue,s=function(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,n=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&n++;return-1*++n}(a),o=[];if(a.snapToLines){var u;switch(a.vertical){case"":o=["+y","-y"],u="height";break;case"rl":o=["+x","-x"],u="width";break;case"lr":o=["-x","+x"],u="width"}var l=r.lineHeight,c=l*Math.round(s),d=i[u]+l,h=o[0];Math.abs(c)>d&&(c=c<0?-1:1,c*=Math.ceil(d/l)*l),s<0&&(c+=""===a.vertical?i.height:i.width,o=o.reverse()),r.move(h,c)}else{var f=r.lineHeight/i.height*100;switch(a.lineAlign){case"middle":s-=f/2;break;case"end":s-=f}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(s,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}o=["+y","-x","+x","-y"],r=new Gn(t)}var p=function(e,t){for(var r,a=new Gn(e),s=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(i,t[o])||e.within(i)&&e.overlapsAny(n);)e.move(t[o]);if(e.within(i))return e;var u=e.intersectPercentage(i);s>u&&(r=new Gn(e),s=u),e=new Gn(a)}return r||a}(r,o);t.move(p.toCSSCompatValues(i))}function zn(){}Fn.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},Fn.prototype.formatStyle=function(e,t){return 0===e?0:e+t},Vn.prototype=Pn(Fn.prototype),Vn.prototype.constructor=Vn,Gn.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},Gn.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},Gn.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},Gn.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},Gn.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}},Gn.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},Gn.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}},Gn.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},zn.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},zn.convertCueToDOMTree=function(e,t){return e&&t?jn(e,t):null};zn.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}(t)){var r=[],a=Gn.getSimpleBoxPosition(n),s={font:Math.round(.05*a.height*100)/100+"px sans-serif"};!function(){for(var i,o,u=0;u<t.length;u++)o=t[u],i=new Vn(e,o,s),n.appendChild(i.div),Hn(0,i,a,r),o.displayState=i.div,r.push(Gn.getSimpleBoxPosition(i))}()}else for(var o=0;o<t.length;o++)n.appendChild(t[o].displayState)},zn.Parser=function(e,t,i){i||(i=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]},zn.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof An))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var n=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),n}function n(e){e.match(/X-TIMESTAMP-MAP/)?On(e,function(e,i){switch(e){case"X-TIMESTAMP-MAP":n=i,r=new Ln,On(n,function(e,t){switch(e){case"MPEGT":r.integer(e+"S",t);break;case"LOCA":r.set(e+"L",Rn(t))}},/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:r.get("MPEGTS"),LOCAL:r.get("LOCAL")})}var n,r},/=/):On(e,function(e,i){switch(e){case"Region":!function(e){var i=new Ln;if(On(e,function(e,t){switch(e){case"id":i.set(e,t);break;case"width":i.percent(e,t);break;case"lines":i.integer(e,t);break;case"regionanchor":case"viewportanchor":var n=t.split(",");if(2!==n.length)break;var r=new Ln;if(r.percent("x",n[0]),r.percent("y",n[1]),!r.has("x")||!r.has("y"))break;i.set(e+"X",r.get("x")),i.set(e+"Y",r.get("y"));break;case"scroll":i.alt(e,t,["up"])}},/=/,/\s/),i.has("id")){var n=new(t.vttjs.VTTRegion||t.window.VTTRegion);n.width=i.get("width",100),n.lines=i.get("lines",3),n.regionAnchorX=i.get("regionanchorX",0),n.regionAnchorY=i.get("regionanchorY",100),n.viewportAnchorX=i.get("viewportanchorX",0),n.viewportAnchorY=i.get("viewportanchorY",100),n.scroll=i.get("scroll",""),t.onregion&&t.onregion(n),t.regionList.push({id:i.get("id"),region:n})}}(i)}},/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var a=(r=i()).match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new An(An.Errors.BadSignature);t.state="HEADER"}for(var s=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:r=i(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;if(t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,""),t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":try{In(r,t.cue,t.regionList)}catch(e){t.reportOrThrowError(e),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(s=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r;continue;case"BADCUE":r||(t.state="ID");continue}}}catch(e){t.reportOrThrowError(e),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){try{if(this.buffer+=this.decoder.decode(),(this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state)throw new An(An.Errors.BadSignature)}catch(e){this.reportOrThrowError(e)}return this.onflush&&this.onflush(),this}};var qn=zn,Wn="auto",Kn={"":1,lr:1,rl:1},$n={start:1,middle:1,end:1,left:1,right:1};function Xn(e){return"string"==typeof e&&(!!$n[e.toLowerCase()]&&e.toLowerCase())}function Yn(e,t,i){this.hasBeenReset=!1;var n="",r=!1,a=e,s=t,o=i,u=null,l="",c=!0,d="auto",h="start",f=50,p="middle",m=50,g="middle";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 a},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");a=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 u},set:function(e){u=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return l},set:function(e){var t=function(e){return"string"==typeof e&&!!Kn[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===t)throw new SyntaxError("An invalid or illegal string was specified.");l=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return d},set:function(e){if("number"!=typeof e&&e!==Wn)throw new SyntaxError("An invalid number or illegal string was specified.");d=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return h},set:function(e){var t=Xn(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");h=t,this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return f},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");f=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return p},set:function(e){var t=Xn(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");p=t,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");m=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){var t=Xn(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Yn.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Jn=Yn,Qn={"":!0,up:!0};function Zn(e){return"number"==typeof e&&e>=0&&e<=100}var er=function(){var e=100,t=3,i=0,n=100,r=0,a=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!Zn(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(!Zn(e))throw new Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!Zn(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!Zn(e))throw new Error("ViewportAnchorY must be between 0 and 100.");a=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!Zn(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=function(e){return"string"==typeof e&&!!Qn[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===t)throw new SyntaxError("An invalid or illegal string was specified.");s=t}}})},tr=kt(function(t){var i=t.exports={WebVTT:qn,VTTCue:Jn,VTTRegion:er};e.vttjs=i,e.WebVTT=i.WebVTT;var n=i.VTTCue,r=i.VTTRegion,a=e.VTTCue,s=e.VTTRegion;i.shim=function(){e.VTTCue=n,e.VTTRegion=r},i.restore=function(){e.VTTCue=a,e.VTTRegion=s},e.VTTCue||i.shim()});tr.WebVTT,tr.VTTCue,tr.VTTRegion;var ir=function(i){function n(e,t){var n;return void 0===e&&(e={}),void 0===t&&(t=function(){}),e.reportTouchActivity=!1,(n=i.call(this,null,e,t)||this).hasStarted_=!1,n.on("playing",function(){this.hasStarted_=!0}),n.on("loadstart",function(){this.hasStarted_=!1}),Cn.names.forEach(function(t){var i=Cn[t];e&&e[i.getterName]&&(n[i.privateName]=e[i.getterName])}),n.featuresProgressEvents||n.manualProgressOn(),n.featuresTimeupdateEvents||n.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(t){!1===e["native"+t+"Tracks"]&&(n["featuresNative"+t+"Tracks"]=!1)}),!1===e.nativeCaptions||!1===e.nativeTextTracks?n.featuresNativeTextTracks=!1:!0!==e.nativeCaptions&&!0!==e.nativeTextTracks||(n.featuresNativeTextTracks=!0),n.featuresNativeTextTracks||n.emulateTextTracks(),n.autoRemoteTextTracks_=new Cn.text.ListClass,n.initTrackListeners(),e.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}xe(n,i);var r=n.prototype;return r.triggerSourceset=function(e){var t=this;this.isReady_||this.one("ready",function(){return t.setTimeout(function(){return t.triggerSourceset(e)},1)}),this.trigger({src:e,type:"sourceset"})},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(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(pe(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()}),500)},r.onDurationChange=function(e){this.duration_=this.duration()},r.buffered=function(){return ot(0,0)},r.bufferedPercent=function(){return ut(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(){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(En.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),i.prototype.dispose.call(this)},r.clearTracks=function(e){var t=this;(e=[].concat(e)).forEach(function(e){for(var i=t[e+"Tracks"]()||[],n=i.length;n--;){var r=i[n];"text"===e&&t.removeRemoteTextTrack(r),i.removeTrack(r)}})},r.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var i=e[t];this.removeRemoteTextTrack(i)}},r.reset=function(){},r.error=function(e){return void 0!==e&&(this.error_=new mt(e),this.trigger("error")),this.error_},r.played=function(){return this.hasStarted_?ot(0,0):ot()},r.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},r.initTrackListeners=function(){var e=this;En.names.forEach(function(t){var i=En[t],n=function(){e.trigger(t+"trackchange")},r=e[i.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),e.on("dispose",function(){r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)})})},r.addWebVttScript_=function(){var i=this;if(!e.WebVTT)if(t.body.contains(this.el())){if(!this.options_["vtt.js"]&&h(tr)&&Object.keys(tr).length>0)return void this.trigger("vttjsloaded");var n=t.createElement("script");n.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",n.onload=function(){i.trigger("vttjsloaded")},n.onerror=function(){i.trigger("vttjserror")},this.on("dispose",function(){n.onload=null,n.onerror=null}),e.WebVTT=!0,this.el().parentNode.appendChild(n)}else this.ready(this.addWebVttScript_)},r.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),n=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e<t.length;e++){var i=t[e];i.removeEventListener("cuechange",a),"showing"===i.mode&&i.addEventListener("cuechange",a)}};s(),t.addEventListener("change",s),t.addEventListener("addtrack",s),t.addEventListener("removetrack",s),this.on("dispose",function(){i.off("addtrack",n),i.off("removetrack",r),t.removeEventListener("change",s),t.removeEventListener("addtrack",s),t.removeEventListener("removetrack",s);for(var e=0;e<t.length;e++){t[e].removeEventListener("cuechange",a)}})},r.addTextTrack=function(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,i,n,r){void 0===r&&(r={});var a=e.textTracks();r.kind=t,i&&(r.label=i),n&&(r.language=n),r.tech=e;var s=new Cn.text.TrackClass(r);return a.addTrack(s),s}(this,e,t,i)},r.createRemoteTextTrack=function(e){var t=Oe(e,{tech:this});return new wn.remoteTextEl.TrackClass(t)},r.addRemoteTextTrack=function(e,t){var i=this;void 0===e&&(e={});var n=this.createRemoteTextTrack(e);return!0!==t&&!1!==t&&(a.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),t=!0),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!0!==t&&this.ready(function(){return i.autoRemoteTextTracks_.addTrack(n.track)}),n},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,t){return n.canPlayType(e.type)},n.isTech=function(e){return e.prototype instanceof n||e instanceof n||e===n},n.registerTech=function(e,t){if(n.techs_||(n.techs_={}),!n.isTech(t))throw new Error("Tech "+e+" must be a Tech");if(!n.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!n.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Le(e),n.techs_[e]=t,n.techs_[Re(e)]=t,"Tech"!==e&&n.defaultTechOrder_.push(e),t},n.getTech=function(t){if(t)return n.techs_&&n.techs_[t]?n.techs_[t]:(t=Le(t),e&&e.videojs&&e.videojs[t]?(a.warn("The "+t+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),e.videojs[t]):void 0)},n}(Ie);Cn.names.forEach(function(e){var t=Cn[e];ir.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),ir.prototype.featuresVolumeControl=!0,ir.prototype.featuresMuteControl=!0,ir.prototype.featuresFullscreenResize=!1,ir.prototype.featuresPlaybackRate=!1,ir.prototype.featuresProgressEvents=!1,ir.prototype.featuresSourceset=!1,ir.prototype.featuresTimeupdateEvents=!1,ir.prototype.featuresNativeTextTracks=!1,ir.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){var n=e.sourceHandlers;n||(n=e.sourceHandlers=[]),void 0===i&&(i=n.length),n.splice(i,0,t)},e.canPlayType=function(t){for(var i,n=e.sourceHandlers||[],r=0;r<n.length;r++)if(i=n[r].canPlayType(t))return i;return""},e.selectSourceHandler=function(t,i){for(var n=e.sourceHandlers||[],r=0;r<n.length;r++)if(n[r].canHandleSource(t,i))return n[r];return null},e.canPlaySource=function(t,i){var n=e.selectSourceHandler(t,i);return n?n.canHandleSource(t,i):""};["seekable","seeking","duration"].forEach(function(e){var t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},e.prototype),e.prototype.setSource=function(t){var i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:a.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler),i!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},Ie.registerComponent("Tech",ir),ir.registerTech("Tech",ir),ir.defaultTechOrder_=[];var nr={},rr={},ar={};function sr(e,t,i){e.setTimeout(function(){return function e(t,i,n,r,a,s){void 0===t&&(t={});void 0===i&&(i=[]);void 0===a&&(a=[]);void 0===s&&(s=!1);var o=i,u=o[0],l=o.slice(1);if("string"==typeof u)e(t,nr[u],n,r,a,s);else if(u){var d=function(e,t){var i=rr[e.id()],n=null;if(void 0===i||null===i)return n=t(e),rr[e.id()]=[[t,n]],n;for(var r=0;r<i.length;r++){var a=i[r],s=a[0],o=a[1];s===t&&(n=o)}null===n&&(n=t(e),i.push([t,n]));return n}(r,u);if(!d.setSource)return a.push(d),e(t,l,n,r,a,s);d.setSource(c({},t),function(i,o){if(i)return e(t,l,n,r,a,s);a.push(d),e(o,t.type===o.type?l:nr[o.type],n,r,a,s)})}else l.length?e(t,l,n,r,a,s):s?n(t,a):e(t,nr["*"],n,r,a,!0)}(t,nr[t.type],i,e)},1)}function or(e,t,i,n){void 0===n&&(n=null);var r="call"+Le(i),a=e.reduce(dr(r),n),s=a===ar,o=s?null:t[i](a);return function(e,t,i,n){for(var r=e.length-1;r>=0;r--){var a=e[r];a[t]&&a[t](n,i)}}(e,i,o,s),o}var ur={buffered:1,currentTime:1,duration:1,seekable:1,played:1,paused:1,volume:1},lr={setCurrentTime:1,setVolume:1},cr={play:1,pause:1};function dr(e){return function(t,i){return t===ar?ar:i[e]?i[e](t):t}}var hr={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"},fr=function(e){void 0===e&&(e="");var t=Ht(e);return hr[t.toLowerCase()]||""};function pr(e){if(!e.type){var t=fr(e.src);t&&(e.type=t)}return e}var mr=function(e){function t(t,i,n){var r,a=Oe({createEl:!1},i);if(r=e.call(this,t,a,n)||this,i.playerOptions.sources&&0!==i.playerOptions.sources.length)t.src(i.playerOptions.sources);else for(var s=0,o=i.playerOptions.techOrder;s<o.length;s++){var u=Le(o[s]),l=ir.getTech(u);if(u||(l=Ie.getComponent(u)),l&&l.isSupported()){t.loadTech_(u);break}}return r}return xe(t,e),t}(Ie);Ie.registerComponent("MediaLoader",mr);var gr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).emitTapEvents(),n.enable(),n}xe(t,e);var i=t.prototype;return i.createEl=function(t,i,n){void 0===t&&(t="div"),void 0===i&&(i={}),void 0===n&&(n={}),i=c({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass(),tabIndex:0},i),"button"===t&&a.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead."),n=c({role:"button"},n),this.tabIndex_=i.tabIndex;var r=e.prototype.createEl.call(this,t,i,n);return this.createControlTextEl(r),r},i.dispose=function(){this.controlTextEl_=null,e.prototype.dispose.call(this)},i.createControlTextEl=function(e){return this.controlTextEl_=b("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_},i.controlText=function(e,t){if(void 0===t&&(t=this.el()),void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,T(this.controlTextEl_,i),this.nonIconControl||t.setAttribute("title",i)},i.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)},i.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick),this.on("keydown",this.handleKeyDown))},i.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver),this.off("mouseout",this.handleMouseOut),this.off(["tap","click"],this.handleClick),this.off("keydown",this.handleKeyDown)},i.handleClick=function(e){},i.handleKeyDown=function(t){Et.isEventKey(t,"Space")||Et.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(Ie);Ie.registerComponent("ClickableComponent",gr);var vr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update(),t.on("posterchange",pe(Ue(n),n.update)),n}xe(t,e);var i=t.prototype;return i.dispose=function(){this.player().off("posterchange",this.update),e.prototype.dispose.call(this)},i.createEl=function(){return b("div",{className:"vjs-poster",tabIndex:-1})},i.update=function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()},i.setSrc=function(e){var t="";e&&(t='url("'+e+'")'),this.el_.style.backgroundImage=t},i.handleClick=function(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?_t(this.player_.play()):this.player_.pause())},t}(gr);Ie.registerComponent("PosterImage",vr);var yr={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 _r(e,t){var i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function br(e,t,i){try{e.style[t]=i}catch(e){return}}var Tr=function(t){function i(i,n,r){var a;a=t.call(this,i,n,r)||this;var s=pe(Ue(a),a.updateDisplay);return i.on("loadstart",pe(Ue(a),a.toggleDisplay)),i.on("texttrackchange",s),i.on("loadedmetadata",pe(Ue(a),a.preselectTrack)),i.ready(pe(Ue(a),function(){if(i.tech_&&i.tech_.featuresNativeTextTracks)this.hide();else{i.on("fullscreenchange",s),i.on("playerresize",s),e.addEventListener("orientationchange",s),i.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()}})),a}xe(i,t);var n=i.prototype;return n.preselectTrack=function(){for(var e,t,i,n={captions:1,subtitles:1},r=this.player_.textTracks(),a=this.player_.cache_.selectedLanguage,s=0;s<r.length;s++){var o=r[s];a&&a.enabled&&a.language&&a.language===o.language&&o.kind in n?o.kind===a.kind?i=o:i||(i=o):a&&!a.enabled?(i=null,e=null,t=null):o.default&&("descriptions"!==o.kind||e?o.kind in n&&!t&&(t=o):e=o)}i?i.mode="showing":t?t.mode="showing":e&&(e.mode="showing")},n.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},n.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},n.clearDisplay=function(){"function"==typeof e.WebVTT&&e.WebVTT.processCues(e,[],this.el_)},n.updateDisplay=function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var i=[],n=0;n<e.length;++n){var r=e[n];"showing"===r.mode&&i.push(r)}this.updateForTrack(i)}else{for(var a=null,s=null,o=e.length;o--;){var u=e[o];"showing"===u.mode&&("descriptions"===u.kind?a=u:s=u)}s?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):a&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(a))}},n.updateDisplayState=function(t){for(var i=this.player_.textTrackSettings.getValues(),n=t.activeCues,r=n.length;r--;){var a=n[r];if(a){var s=a.displayState;if(i.color&&(s.firstChild.style.color=i.color),i.textOpacity&&br(s.firstChild,"color",_r(i.color||"#fff",i.textOpacity)),i.backgroundColor&&(s.firstChild.style.backgroundColor=i.backgroundColor),i.backgroundOpacity&&br(s.firstChild,"backgroundColor",_r(i.backgroundColor||"#000",i.backgroundOpacity)),i.windowColor&&(i.windowOpacity?br(s,"backgroundColor",_r(i.windowColor,i.windowOpacity)):s.style.backgroundColor=i.windowColor),i.edgeStyle&&("dropshadow"===i.edgeStyle?s.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===i.edgeStyle?s.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===i.edgeStyle?s.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===i.edgeStyle&&(s.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),i.fontPercent&&1!==i.fontPercent){var o=e.parseFloat(s.style.fontSize);s.style.fontSize=o*i.fontPercent+"px",s.style.height="auto",s.style.top="auto",s.style.bottom="2px"}i.fontFamily&&"default"!==i.fontFamily&&("small-caps"===i.fontFamily?s.firstChild.style.fontVariant="small-caps":s.firstChild.style.fontFamily=yr[i.fontFamily])}}},n.updateForTrack=function(t){if(Array.isArray(t)||(t=[t]),"function"==typeof e.WebVTT&&!t.every(function(e){return!e.activeCues})){for(var i=[],n=0;n<t.length;++n)for(var r=t[n],a=0;a<r.activeCues.length;++a)i.push(r.activeCues[a]);e.WebVTT.processCues(e,i,this.el_);for(var s=0;s<t.length;++s){for(var o=t[s],u=0;u<o.activeCues.length;++u){var l=o.activeCues[u].displayState;E(l,"vjs-text-track-cue"),E(l,"vjs-text-track-cue-"+(o.language?o.language:s))}this.player_.textTrackSettings&&this.updateDisplayState(o)}}},i}(Ie);Ie.registerComponent("TextTrackDisplay",Tr);var Sr=function(e){function t(){return e.apply(this,arguments)||this}return xe(t,e),t.prototype.createEl=function(){var t=this.player_.isAudio(),i=this.localize(t?"Audio Player":"Video Player"),n=b("span",{className:"vjs-control-text",innerHTML:this.localize("{1} is loading.",[i])}),r=e.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(n),r},t}(Ie);Ie.registerComponent("LoadingSpinner",Sr);var kr=function(e){function t(){return e.apply(this,arguments)||this}xe(t,e);var i=t.prototype;return i.createEl=function(e,t,i){void 0===t&&(t={}),void 0===i&&(i={}),t=c({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass()},t),i=c({type:"button"},i);var n=Ie.prototype.createEl.call(this,"button",t,i);return this.createControlTextEl(n),n},i.addChild=function(e,t){void 0===t&&(t={});var i=this.constructor.name;return a.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),Ie.prototype.addChild.call(this,e,t)},i.enable=function(){e.prototype.enable.call(this),this.el_.removeAttribute("disabled")},i.disable=function(){e.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},i.handleKeyDown=function(t){Et.isEventKey(t,"Space")||Et.isEventKey(t,"Enter")?t.stopPropagation():e.prototype.handleKeyDown.call(this,t)},t}(gr);Ie.registerComponent("Button",kr);var Er=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).mouseused_=!1,n.on("mousedown",n.handleMouseDown),n}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-big-play-button"},i.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY)return _t(t),void(this.player_.tech(!0)&&this.player_.tech(!0).focus());var i=this.player_.getChild("controlBar"),n=i&&i.getChild("playToggle");if(n){var r=function(){return n.focus()};yt(t)?t.then(r,function(){}):this.setTimeout(r,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(kr);Er.prototype.controlText_="Play Video",Ie.registerComponent("BigPlayButton",Er);var wr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){Et.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(kr);Ie.registerComponent("CloseButton",wr);var Cr=function(e){function t(t,i){var n;return void 0===i&&(i={}),n=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,n.on(t,"play",n.handlePlay),n.on(t,"pause",n.handlePause),i.replay&&n.on(t,"ended",n.handleEnded),n}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",this.handleSeeked)},t}(kr);Cr.prototype.controlText_="Play",Ie.registerComponent("PlayToggle",Cr);var Pr=function(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),a=Math.floor(t/60%60),s=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=i="-"),(r=r>0||s>0?r+":":"")+(n=((r||a>=10)&&n<10?"0"+n:n)+":")+(i=i<10?"0"+i:i)},Ar=Pr;function Rr(e,t){return void 0===t&&(t=e),Ar(e,t)}var Lr=function(e){function i(t,i){var n;return(n=e.call(this,t,i)||this).throttledUpdateContent=me(pe(Ue(n),n.updateContent),fe),n.on(t,"timeupdate",n.throttledUpdateContent),n}xe(i,e);var n=i.prototype;return n.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control",innerHTML:'<span class="vjs-control-text" role="presentation">'+this.localize(this.labelText_)+" </span>"});return this.contentEl_=b("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),this.updateTextNode_(),i.appendChild(this.contentEl_),i},n.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},n.updateTextNode_=function(){if(this.contentEl_){for(;this.contentEl_.firstChild;)this.contentEl_.removeChild(this.contentEl_.firstChild);this.textNode_=t.createTextNode(this.formattedTime_||this.formatTime_(0)),this.contentEl_.appendChild(this.textNode_)}},n.formatTime_=function(e){return Rr(e)},n.updateFormattedTime_=function(e){var t=this.formatTime_(e);t!==this.formattedTime_&&(this.formattedTime_=t,this.requestAnimationFrame(this.updateTextNode_))},n.updateContent=function(e){},i}(Ie);Lr.prototype.labelText_="Time",Lr.prototype.controlText_="Time",Ie.registerComponent("TimeDisplay",Lr);var Or=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"ended",n.handleEnded),n}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(t)},i.handleEnded=function(e){this.player_.duration()&&this.updateFormattedTime_(this.player_.duration())},t}(Lr);Or.prototype.labelText_="Current Time",Or.prototype.controlText_="Current Time",Ie.registerComponent("CurrentTimeDisplay",Or);var Ir=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",n.updateContent),n.on(t,"loadstart",n.updateContent),n.on(t,"loadedmetadata",n.throttledUpdateContent),n}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.duration_!==t&&(this.duration_=t,this.updateFormattedTime_(t))},t}(Lr);Ir.prototype.labelText_="Duration",Ir.prototype.controlText_="Duration",Ie.registerComponent("DurationDisplay",Ir);var xr=function(e){function t(){return e.apply(this,arguments)||this}return xe(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"<div><span>/</span></div>"},{"aria-hidden":!0})},t}(Ie);Ie.registerComponent("TimeDivider",xr);var Dr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",n.throttledUpdateContent),n.on(t,"ended",n.handleEnded),n}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return t.insertBefore(b("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){"number"==typeof this.player_.duration()&&(this.player_.remainingTimeDisplay?this.updateFormattedTime_(this.player_.remainingTimeDisplay()):this.updateFormattedTime_(this.player_.remainingTime()))},i.handleEnded=function(e){this.player_.duration()&&this.updateFormattedTime_(0)},t}(Lr);Dr.prototype.labelText_="Remaining Time",Dr.prototype.controlText_="Remaining Time",Ie.registerComponent("RemainingTimeDisplay",Dr);var Mr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateShowing(),n.on(n.player(),"durationchange",n.updateShowing),n}xe(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=b("div",{className:"vjs-live-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Stream Type")+" </span>"+this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(Ie);Ie.registerComponent("LiveDisplay",Mr);var Ur=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateLiveEdgeStatus(),n.player_.liveTracker&&n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatus),n}xe(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=b("span",{className:"vjs-seek-to-live-text",innerHTML:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(e){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatus),this.textEl_=null,e.prototype.dispose.call(this)},t}(kr);Ur.prototype.controlText_="Seek to live, currently playing live",Ie.registerComponent("SeekToLive",Ur);var jr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}xe(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown),this.on("touchstart",this.handleMouseDown),this.on("keydown",this.handleKeyDown),this.on("click",this.handleClick),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown),this.off("touchstart",this.handleMouseDown),this.off("keydown",this.handleKeyDown),this.off("click",this.handleClick),this.off(this.player_,"controlsvisible",this.update),this.off(e,"mousemove",this.handleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchmove",this.handleMouseMove),this.off(e,"touchend",this.handleMouseUp),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},i.createEl=function(t,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),i.className=i.className+" vjs-slider",i=c({tabIndex:0},i),n=c({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),e.prototype.createEl.call(this,t,i,n)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Je||e.preventDefault(),I(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchmove",this.handleMouseMove),this.on(t,"touchend",this.handleMouseUp),this.handleMouseMove(e)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;x(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchmove",this.handleMouseMove),this.off(e,"touchend",this.handleMouseUp),this.update()},i.update=function(){if(this.el_){var e=this.getPercent(),t=this.bar;if(t){("number"!=typeof e||e!=e||e<0||e===1/0)&&(e=0);var i=(100*e).toFixed(2)+"%",n=t.el().style,r=this.vertical()?"height":"width";return n[r]!==i&&(n[r]=i),e}}},i.calculateDistance=function(e){var t=U(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){Et.isEventKey(t,"Left")||Et.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):Et.isEventKey(t,"Right")||Et.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(Ie);Ie.registerComponent("Slider",jr);var Br=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",n.update),n}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Loaded")+'</span>: <span class="vjs-control-text-loaded-percentage">0%</span></span>'})},i.dispose=function(){this.partEls_=null,e.prototype.dispose.call(this)},i.update=function(e){var t=this.player_.liveTracker,i=this.player_.buffered(),n=t&&t.isLive()?t.seekableEnd():this.player_.duration(),r=this.player_.bufferedEnd(),a=this.partEls_,s=this.$(".vjs-control-text-loaded-percentage"),o=function(e,t,i){var n=e/t||0;return n=100*(n>=1?1:n),i&&(n=n.toFixed(2)),n+"%"};this.el_.style.width=o(r,n),T(s,o(r,n,!0));for(var u=0;u<i.length;u++){var l=i.start(u),c=i.end(u),d=a[u];d||(d=this.el_.appendChild(b()),a[u]=d),d.style.left=o(l,r),d.style.width=o(c-l,r)}for(var h=a.length;h>i.length;h--)this.el_.removeChild(a[h-1]);a.length=i.length},t}(Ie);Ie.registerComponent("LoadProgressBar",Br);var Nr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=me(pe(Ue(n),n.update),fe),n}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var n=D(this.el_),r=D(this.player_.el()),a=e.width*t;if(r&&n){var s=e.left-r.left+a,o=e.width-a+(r.right-e.right),u=n.width/2;s<u?u+=u-s:o<u&&(u=o),u<0?u=0:u>n.width&&(u=n.width),this.el_.style.right="-"+u+"px",this.write(i)}},i.write=function(e){T(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var a,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),u=o-t*o;a=(u<1?"":"-")+Rr(u,o)}else a=Rr(i,s);r.update(e,t,a),n&&n()})},t}(Ie);Ie.registerComponent("TimeTooltip",Nr);var Fr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=me(pe(Ue(n),n.update),fe),n}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}},t}(Ie);Fr.prototype.options_={children:[]},ze||We||Fr.prototype.options_.children.push("timeTooltip"),Ie.registerComponent("PlayProgressBar",Fr);var Vr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=me(pe(Ue(n),n.update),fe),n}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,function(){i.el_.style.left=e.width*t+"px"})},t}(Ie);Vr.prototype.options_={children:["timeTooltip"]},Ie.registerComponent("MouseTimeDisplay",Vr);var Gr=function(e){function i(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}xe(i,e);var n=i.prototype;return n.setEventHandlers_=function(){this.update=me(pe(this,this.update),30),this.on(this.player_,"timeupdate",this.update),this.on(this.player_,"ended",this.handleEnded),this.on(this.player_,"durationchange",this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.on(this.player_,["playing"],this.enableInterval_),this.on(this.player_,["ended","pause","waiting"],this.disableInterval_),"hidden"in t&&"visibilityState"in t&&this.on(t,"visibilitychange",this.toggleVisibility_)},n.toggleVisibility_=function(e){t.hidden?this.disableInterval_(e):(this.enableInterval_(),this.requestAnimationFrame(this.update))},n.enableInterval_=function(){var e=this;this.clearInterval(this.updateInterval),this.updateInterval=this.setInterval(function(){e.requestAnimationFrame(e.update)},30)},n.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&"ended"!==e.type||this.clearInterval(this.updateInterval)},n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},n.update_=function(e,t){var i=this.player_.liveTracker,n=this.player_.duration();i&&i.isLive()&&(n=this.player_.liveTracker.liveCurrentTime()),this.el_.setAttribute("aria-valuenow",(100*t).toFixed(2)),this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Rr(e,n),Rr(n,n)],"{1} of {2}")),this.bar&&this.bar.update(D(this.el_),t)},n.update=function(t){if(null!==this.el().offsetParent){var i=e.prototype.update.call(this);return this.update_(this.getCurrentTime_(),i),i}},n.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},n.handleEnded=function(e){this.update_(this.player_.duration(),1)},n.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e>=1?1:e||0},n.handleMouseDown=function(t){G(t)&&(t.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},n.handleMouseMove=function(e){if(G(e)){var t,i=this.calculateDistance(e),n=this.player_.liveTracker;if(n&&n.isLive()){var r=n.seekableStart(),a=n.liveCurrentTime();if((t=r+i*n.liveWindow())>=a&&(t=a),t<=r&&(t=r+.1),t===1/0)return}else(t=i*this.player_.duration())===this.player_.duration()&&(t-=.1);this.player_.currentTime(t)}},n.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},n.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},n.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying&&_t(this.player_.play())},n.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},n.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},n.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},n.handleKeyDown=function(t){if(Et.isEventKey(t,"Space")||Et.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(Et.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(0);else if(Et.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.duration());else if(/^[0-9]$/.test(Et(t))){t.preventDefault(),t.stopPropagation();var i=10*(Et.codes[Et(t)]-Et.codes[0])/100;this.player_.currentTime(this.player_.duration()*i)}else Et.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()-60)):Et.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i}(jr);Gr.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},ze||We||Gr.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Ie.registerComponent("SeekBar",Gr);var Hr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=me(pe(Ue(n),n.handleMouseMove),fe),n.throttledHandleMouseSeek=me(pe(Ue(n),n.handleMouseSeek),fe),n.enable(),n}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("mouseTimeDisplay"),n=t.el(),r=D(n),a=U(n,e).x;a>1?a=1:a<0&&(a=0),i&&i.update(r,a)}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){this.children().forEach(function(e){return e.disable&&e.disable()}),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDown),this.off(this.el_,"mousemove",this.handleMouseMove),this.handleMouseUp(),this.addClass("disabled"),this.enabled_=!1)},i.enable=function(){this.children().forEach(function(e){return e.enable&&e.enable()}),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDown),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseUp(e),this.off(t,"mousemove",this.throttledHandleMouseSeek),this.off(t,"touchmove",this.throttledHandleMouseSeek),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchend",this.handleMouseUp)},t}(Ie);Hr.prototype.options_={children:["seekBar"]},Ie.registerComponent("ProgressControl",Hr);var zr=function(e){function i(i,n){var r;return(r=e.call(this,i,n)||this).on(i,["enterpictureinpicture","leavepictureinpicture"],r.handlePictureInPictureChange),t.pictureInPictureEnabled||r.disable(),r}xe(i,e);var n=i.prototype;return n.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},n.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture")},n.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},i}(kr);zr.prototype.controlText_="Picture-in-Picture",Ie.registerComponent("PictureInPictureToggle",zr);var qr=function(e){function i(i,n){var r;return(r=e.call(this,i,n)||this).on(i,"fullscreenchange",r.handleFullscreenChange),!1===t[i.fsApi_.fullscreenEnabled]&&r.disable(),r}xe(i,e);var n=i.prototype;return n.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},n.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},n.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},i}(kr);qr.prototype.controlText_="Fullscreen",Ie.registerComponent("FullscreenToggle",qr);var Wr=function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})},Kr=function(e){function t(){return e.apply(this,arguments)||this}return xe(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})},t}(Ie);Ie.registerComponent("VolumeLevel",Kr);var $r=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on("slideractive",n.updateLastVolume_),n.on(t,"volumechange",n.updateARIAAttributes),t.ready(function(){return n.updateARIAAttributes()}),n}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(t){G(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){G(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",function(){0===e.player_.volume()&&e.player_.lastVolume_(t)})},t}(jr);$r.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},$r.prototype.playerEvent="volumechange",Ie.registerComponent("VolumeBar",$r);var Xr=function(e){function t(t,i){var n;return void 0===i&&(i={}),i.vertical=i.vertical||!1,(void 0===i.volumeBar||h(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),n=e.call(this,t,i)||this,Wr(Ue(n),t),n.throttledHandleMouseMove=me(pe(Ue(n),n.handleMouseMove),fe),n.on("mousedown",n.handleMouseDown),n.on("touchstart",n.handleMouseDown),n.on(n.volumeBar,["focus","slideractive"],function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")}),n.on(n.volumeBar,["blur","sliderinactive"],function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")}),n}xe(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchend",this.handleMouseUp)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(Ie);Xr.prototype.options_={children:["volumeBar"]},Ie.registerComponent("VolumeControl",Xr);var Yr=function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})},Jr=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,Yr(Ue(n),t),n.on(t,["loadstart","volumechange"],n.update),n}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;ze&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)w(this.el_,"vjs-vol-"+i);E(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}(kr);Jr.prototype.controlText_="Mute",Ie.registerComponent("MuteToggle",Jr);var Qr=function(e){function i(t,i){var n;return void 0===i&&(i={}),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||h(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).on(t,["loadstart"],n.volumePanelState_),n.on(n.muteToggle,"keyup",n.handleKeyPress),n.on(n.volumeControl,"keyup",n.handleVolumeControlKeyUp),n.on("keydown",n.handleKeyPress),n.on("mouseover",n.handleMouseOver),n.on("mouseout",n.handleMouseOut),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}xe(i,e);var n=i.prototype;return n.sliderActive_=function(){this.addClass("vjs-slider-active")},n.sliderInactive_=function(){this.removeClass("vjs-slider-active")},n.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},n.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},n.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},n.handleVolumeControlKeyUp=function(e){Et.isEventKey(e,"Esc")&&this.muteToggle.focus()},n.handleMouseOver=function(e){this.addClass("vjs-hover"),ee(t,"keyup",pe(this,this.handleKeyPress))},n.handleMouseOut=function(e){this.removeClass("vjs-hover"),te(t,"keyup",pe(this,this.handleKeyPress))},n.handleKeyPress=function(e){Et.isEventKey(e,"Esc")&&this.handleMouseOut()},i}(Ie);Qr.prototype.options_={children:["muteToggle","volumeControl"]},Ie.registerComponent("VolumePanel",Qr);var Zr=function(e){function i(t,i){var n;return n=e.call(this,t,i)||this,i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",n.handleKeyDown),n.boundHandleBlur_=pe(Ue(n),n.handleBlur),n.boundHandleTapClick_=pe(Ue(n),n.handleTapClick),n}xe(i,e);var n=i.prototype;return n.addEventListenerForItem=function(e){e instanceof Ie&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},n.removeEventListenerForItem=function(e){e instanceof Ie&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},n.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},n.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},n.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=b(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),ee(i,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),i},n.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},n.handleBlur=function(e){var i=e.relatedTarget||t.activeElement;if(!this.children().some(function(e){return e.el()===i})){var n=this.menuButton_;n&&n.buttonPressed_&&i!==n.el().firstChild&&n.unpressButton()}},n.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var i=t.filter(function(t){return t.el()===e.target})[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},n.handleKeyDown=function(e){Et.isEventKey(e,"Left")||Et.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(Et.isEventKey(e,"Right")||Et.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},n.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},n.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},n.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].className&&/vjs-menu-title/.test(t[0].className)&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())},i}(Ie);Ie.registerComponent("Menu",Zr);var ea=function(e){function i(i,n){var r;void 0===n&&(n={}),(r=e.call(this,i,n)||this).menuButton_=new kr(i,n),r.menuButton_.controlText(r.controlText_),r.menuButton_.el_.setAttribute("aria-haspopup","true");var a=kr.prototype.buildCSSClass();return r.menuButton_.el_.className=r.buildCSSClass()+" "+a,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(),ee(t,"keyup",pe(Ue(r),r.handleMenuKeyUp))}),r.on("mouseleave",r.handleMouseLeave),r.on("keydown",r.handleSubmenuKeyDown),r}xe(i,e);var n=i.prototype;return n.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},n.createMenu=function(){var e=new Zr(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=b("li",{className:"vjs-menu-title",innerHTML:Le(this.options_.title),tabIndex:-1});this.hideThreshold_+=1;var i=new Ie(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var n=0;n<this.items.length;n++)e.addItem(this.items[n]);return e},n.createItems=function(){},n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},n.buildWrapperCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+kr.prototype.buildCSSClass()+" "+e.prototype.buildCSSClass.call(this)},n.buildCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+e.prototype.buildCSSClass.call(this)},n.controlText=function(e,t){return void 0===t&&(t=this.menuButton_.el()),this.menuButton_.controlText(e,t)},n.dispose=function(){this.handleMouseLeave(),e.prototype.dispose.call(this)},n.handleClick=function(e){this.buttonPressed_?this.unpressButton():this.pressButton()},n.handleMouseLeave=function(e){this.removeClass("vjs-hover"),te(t,"keyup",pe(this,this.handleMenuKeyUp))},n.focus=function(){this.menuButton_.focus()},n.blur=function(){this.menuButton_.blur()},n.handleKeyDown=function(e){Et.isEventKey(e,"Esc")||Et.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),Et.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(Et.isEventKey(e,"Up")||Et.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))},n.handleMenuKeyUp=function(e){(Et.isEventKey(e,"Esc")||Et.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},n.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},n.handleSubmenuKeyDown=function(e){(Et.isEventKey(e,"Esc")||Et.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),Et.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))},n.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),ze&&y())return;this.menu.focus()}},n.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},n.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},n.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},i}(Ie);Ie.registerComponent("MenuButton",ea);var ta=function(e){function t(t,i){var n,r=i.tracks;if((n=e.call(this,t,i)||this).items.length<=1&&n.hide(),!r)return Ue(n);var a=pe(Ue(n),n.update);return r.addEventListener("removetrack",a),r.addEventListener("addtrack",a),n.player_.on("ready",a),n.player_.on("dispose",function(){r.removeEventListener("removetrack",a),r.removeEventListener("addtrack",a)}),n}return xe(t,e),t}(ea);Ie.registerComponent("TrackButton",ta);var ia=["Tab","Esc","Up","Down","Right","Left"],na=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).selectable=i.selectable,n.isSelected_=i.selected||!1,n.multiSelectable=i.multiSelectable,n.selected(n.isSelected_),n.selectable?n.multiSelectable?n.el_.setAttribute("role","menuitemcheckbox"):n.el_.setAttribute("role","menuitemradio"):n.el_.setAttribute("role","menuitem"),n}xe(t,e);var i=t.prototype;return i.createEl=function(t,i,n){return this.nonIconControl=!0,e.prototype.createEl.call(this,"li",c({className:"vjs-menu-item",innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+"</span>",tabIndex:-1},i),n)},i.handleKeyDown=function(t){ia.some(function(e){return Et.isEventKey(t,e)})||e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){this.selected(!0)},i.selected=function(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))},t}(gr);Ie.registerComponent("MenuItem",na);var ra=function(i){function n(n,r){var a,s=r.track,o=n.textTracks();r.label=s.label||s.language||"Unknown",r.selected="showing"===s.mode,(a=i.call(this,n,r)||this).track=s,a.kinds=(r.kinds||[r.kind||a.track.kind]).filter(Boolean);var u,l=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];a.handleTracksChange.apply(Ue(a),t)},c=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];a.handleSelectedLanguageChange.apply(Ue(a),t)};(n.on(["loadstart","texttrackchange"],l),o.addEventListener("change",l),o.addEventListener("selectedlanguagechange",c),a.on("dispose",function(){n.off(["loadstart","texttrackchange"],l),o.removeEventListener("change",l),o.removeEventListener("selectedlanguagechange",c)}),void 0===o.onchange)&&a.on(["tap","click"],function(){if("object"!=typeof e.Event)try{u=new e.Event("change")}catch(e){}u||(u=t.createEvent("Event")).initEvent("change",!0,!0),o.dispatchEvent(u)});return a.handleTracksChange(),a}xe(n,i);var r=n.prototype;return r.handleClick=function(e){var t=this.track,n=this.player_.textTracks();if(i.prototype.handleClick.call(this,e),n)for(var r=0;r<n.length;r++){var a=n[r];-1!==this.kinds.indexOf(a.kind)&&(a===t?"showing"!==a.mode&&(a.mode="showing"):"disabled"!==a.mode&&(a.mode="disabled"))}},r.handleTracksChange=function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)},r.handleSelectedLanguageChange=function(e){if("showing"===this.track.mode){var t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},r.dispose=function(){this.track=null,i.prototype.dispose.call(this)},n}(na);Ie.registerComponent("TextTrackMenuItem",ra);var aa=function(e){function t(t,i){return i.track={player:t,kind:i.kind,kinds:i.kinds,default:!1,mode:"disabled"},i.kinds||(i.kinds=[i.kind]),i.label?i.track.label=i.label:i.track.label=i.kinds.join(" and ")+" off",i.selectable=!0,i.multiSelectable=!1,e.call(this,t,i)||this}xe(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var a=t[n];if(this.options_.kinds.indexOf(a.kind)>-1&&"showing"===a.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var a=t[n];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&"showing"===a.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(ra);Ie.registerComponent("OffTextTrackMenuItem",aa);var sa=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return xe(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=ra),this.label_&&(i=this.label_+" off"),e.push(new aa(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<n.length;r++){var a=n[r];if(this.kinds_.indexOf(a.kind)>-1){var s=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+a.kind+"-menu-item"),e.push(s)}}return e},t}(ta);Ie.registerComponent("TextTrackButton",sa);var oa=function(e){function t(t,i){var n,r=i.track,a=i.cue,s=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=a.text,i.selected=a.startTime<=s&&s<a.endTime,(n=e.call(this,t,i)||this).track=r,n.cue=a,r.addEventListener("cuechange",pe(Ue(n),n.update)),n}xe(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},i.update=function(e){var t=this.cue,i=this.player_.currentTime();this.selected(t.startTime<=i&&i<t.endTime)},t}(na);Ie.registerComponent("ChaptersTrackMenuItem",oa);var ua=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildWrapperCSSClass.call(this)},i.update=function(t){this.track_&&(!t||"addtrack"!==t.type&&"removetrack"!==t.type)||this.setTrack(this.findChaptersTrack()),e.prototype.update.call(this)},i.setTrack=function(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";var i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.addEventListener("load",this.updateHandler_)}}},i.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1;t>=0;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Le(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i<n;i++){var r=t[i],a=new oa(this.player_,{track:this.track_,cue:r});e.push(a)}return e},t}(sa);ua.prototype.kind_="chapters",ua.prototype.controlText_="Chapters",Ie.registerComponent("ChaptersButton",ua);var la=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var a=t.textTracks(),s=pe(Ue(r),r.handleTracksChange);return a.addEventListener("change",s),r.on("dispose",function(){a.removeEventListener("change",s)}),r}xe(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!1,n=0,r=t.length;n<r;n++){var a=t[n];if(a.kind!==this.kind_&&"showing"===a.mode){i=!0;break}}i?this.disable():this.enable()},i.buildCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(sa);la.prototype.kind_="descriptions",la.prototype.controlText_="Descriptions",Ie.registerComponent("DescriptionsButton",la);var ca=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(sa);ca.prototype.kind_="subtitles",ca.prototype.controlText_="Subtitles",Ie.registerComponent("SubtitlesButton",ca);var da=function(e){function t(t,i){var n;return i.track={player:t,kind:i.kind,label:i.kind+" settings",selectable:!1,default:!1,mode:"disabled"},i.selectable=!1,i.name="CaptionSettingsMenuItem",(n=e.call(this,t,i)||this).addClass("vjs-texttrack-settings"),n.controlText(", opens "+i.kind+" settings dialog"),n}return xe(t,e),t.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},t}(ra);Ie.registerComponent("CaptionSettingsMenuItem",da);var ha=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-captions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-captions-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new da(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t)},t}(sa);ha.prototype.kind_="captions",ha.prototype.controlText_="Captions",Ie.registerComponent("CaptionsButton",ha);var fa=function(e){function t(){return e.apply(this,arguments)||this}return xe(t,e),t.prototype.createEl=function(t,i,n){var r='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"captions"===this.options_.track.kind&&(r+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Captions")+"</span>\n "),r+="</span>",e.prototype.createEl.call(this,t,c({innerHTML:r},i),n)},t}(ra);Ie.registerComponent("SubsCapsMenuItem",fa);var pa=function(e){function t(t,i){var n;return void 0===i&&(i={}),(n=e.call(this,t,i)||this).label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)>-1&&(n.label_="captions"),n.menuButton_.controlText(Le(n.label_)),n}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new da(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=e.prototype.createItems.call(this,t,fa)},t}(sa);pa.prototype.kinds_=["captions","subtitles"],pa.prototype.controlText_="Subtitles",Ie.registerComponent("SubsCapsButton",pa);var ma=function(e){function t(t,i){var n,r=i.track,a=t.audioTracks();i.label=r.label||r.language||"Unknown",i.selected=r.enabled,(n=e.call(this,t,i)||this).track=r,n.addClass("vjs-"+r.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(Ue(n),t)};return a.addEventListener("change",s),n.on("dispose",function(){a.removeEventListener("change",s)}),n}xe(t,e);var i=t.prototype;return i.createEl=function(t,i,n){var r='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"main-desc"===this.options_.track.kind&&(r+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Descriptions")+"</span>\n "),r+="</span>",e.prototype.createEl.call(this,t,c({innerHTML:r},i),n)},i.handleClick=function(t){var i=this.player_.audioTracks();e.prototype.handleClick.call(this,t);for(var n=0;n<i.length;n++){var r=i[n];r.enabled=r===this.track}},i.handleTracksChange=function(e){this.selected(this.track.enabled)},t}(na);Ie.registerComponent("AudioTrackMenuItem",ma);var ga=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.audioTracks(),e.call(this,t,i)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-audio-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-audio-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(e){void 0===e&&(e=[]),this.hideThreshold_=1;for(var t=this.player_.audioTracks(),i=0;i<t.length;i++){var n=t[i];e.push(new ma(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e},t}(ta);ga.prototype.controlText_="Audio Track",Ie.registerComponent("AudioTrackButton",ga);var va=function(e){function t(t,i){var n,r=i.rate,a=parseFloat(r,10);return i.label=r,i.selected=1===a,i.selectable=!0,i.multiSelectable=!1,(n=e.call(this,t,i)||this).label=r,n.rate=a,n.on(t,"ratechange",n.update),n}xe(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},i.update=function(e){this.selected(this.player().playbackRate()===this.rate)},t}(na);va.prototype.contentElType="button",Ie.registerComponent("PlaybackRateMenuItem",va);var ya=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateVisibility(),n.updateLabel(),n.on(t,"loadstart",n.updateVisibility),n.on(t,"ratechange",n.updateLabel),n}xe(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this);return this.labelEl_=b("div",{className:"vjs-playback-rate-value",innerHTML:"1x"}),t.appendChild(this.labelEl_),t},i.dispose=function(){this.labelEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildWrapperCSSClass.call(this)},i.createMenu=function(){var e=new Zr(this.player()),t=this.playbackRates();if(t)for(var i=t.length-1;i>=0;i--)e.addChild(new va(this.player(),{rate:t[i]+"x"}));return e},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){for(var t=this.player().playbackRate(),i=this.playbackRates(),n=i[0],r=0;r<i.length;r++)if(i[r]>t){n=i[r];break}this.player().playbackRate(n)},i.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},t}(ea);ya.prototype.controlText_="Playback Rate",Ie.registerComponent("PlaybackRateMenuButton",ya);var _a=function(e){function t(){return e.apply(this,arguments)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},t}(Ie);Ie.registerComponent("Spacer",_a);var ba=function(e){function t(){return e.apply(this,arguments)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){var t=e.prototype.createEl.call(this,{className:this.buildCSSClass()});return t.innerHTML=" ",t},t}(_a);Ie.registerComponent("CustomControlSpacer",ba);var Ta=function(e){function t(){return e.apply(this,arguments)||this}return xe(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(Ie);Ta.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in t&&Ta.prototype.options_.children.splice(Ta.prototype.options_.children.length-1,0,"pictureInPictureToggle"),Ie.registerComponent("ControlBar",Ta);var Sa=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",n.open),n}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(Ct);Sa.prototype.options_=Oe(Ct.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Ie.registerComponent("ErrorDisplay",Sa);var ka=["#000","Black"],Ea=["#00F","Blue"],wa=["#0FF","Cyan"],Ca=["#0F0","Green"],Pa=["#F0F","Magenta"],Aa=["#F00","Red"],Ra=["#FFF","White"],La=["#FF0","Yellow"],Oa=["1","Opaque"],Ia=["0.5","Semi-Transparent"],xa=["0","Transparent"],Da={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[ka,Ra,Aa,Ca,Ea,La,Pa,wa]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Oa,Ia,xa]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Ra,ka,Aa,Ca,Ea,La,Pa,wa]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Oa,Ia]},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:[xa,Ia,Oa]}};function Ma(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}Da.windowColor.options=Da.backgroundColor.options;var Ua=function(t){function i(e,i){var n;return i.temporary=!1,(n=t.call(this,e,i)||this).updateDisplay=pe(Ue(n),n.updateDisplay),n.fill(),n.hasBeenOpened_=n.hasBeenFilled_=!0,n.endDialog=b("p",{className:"vjs-control-text",textContent:n.localize("End of dialog window.")}),n.el().appendChild(n.endDialog),n.setDefaults(),void 0===i.persistTextTrackSettings&&(n.options_.persistTextTrackSettings=n.options_.playerOptions.persistTextTrackSettings),n.on(n.$(".vjs-done-button"),"click",function(){n.saveSettings(),n.close()}),n.on(n.$(".vjs-default-button"),"click",function(){n.setDefaults(),n.updateDisplay()}),l(Da,function(e){n.on(n.$(e.selector),"change",n.updateDisplay)}),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}xe(i,t);var n=i.prototype;return n.dispose=function(){this.endDialog=null,t.prototype.dispose.call(this)},n.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var r=Da[e],a=r.id.replace("%s",this.id_),s=[t,a].join(" ").trim();return["<"+i+' id="'+a+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(r.label),"</"+i+">",'<select aria-labelledby="'+s+'">'].concat(r.options.map(function(e){var t=a+"-"+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 b("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},n.createElFont_=function(){return b("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 b("div",{className:"vjs-track-settings-controls",innerHTML:['<button type="button" class="vjs-default-button" title="'+e+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+e+"</span>","</button>",'<button type="button" class="vjs-done-button">'+this.localize("Done")+"</button>"].join("")})},n.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},n.label=function(){return this.localize("Caption Settings Dialog")},n.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},n.buildCSSClass=function(){return t.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},n.getValues=function(){var e,t,i,n=this;return e=Da,t=function(e,t,i){var r,a,s=(r=n.$(t.selector),a=t.parser,Ma(r.options[r.options.selectedIndex].value,a));return void 0!==s&&(e[i]=s),e},void 0===(i={})&&(i=0),u(e).reduce(function(i,n){return t(i,e[n],n)},i)},n.setValues=function(e){var t=this;l(Da,function(i,n){!function(e,t,i){if(t)for(var n=0;n<e.options.length;n++)if(Ma(e.options[n].value,i)===t){e.selectedIndex=n;break}}(t.$(i.selector),e[n],i.parser)})},n.setDefaults=function(){var e=this;l(Da,function(t){var i=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=i})},n.restoreSettings=function(){var t;try{t=JSON.parse(e.localStorage.getItem("vjs-text-track-settings"))}catch(e){a.warn(e)}t&&this.setValues(t)},n.saveSettings=function(){if(this.options_.persistTextTrackSettings){var t=this.getValues();try{Object.keys(t).length?e.localStorage.setItem("vjs-text-track-settings",JSON.stringify(t)):e.localStorage.removeItem("vjs-text-track-settings")}catch(e){a.warn(e)}}},n.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},n.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,i=e&&e.captionsButton;t?t.focus():i&&i.focus()},i}(Ct);Ie.registerComponent("TextTrackSettings",Ua);var ja=function(t){function i(i,n){var r,a=n.ResizeObserver||e.ResizeObserver;null===n.ResizeObserver&&(a=!1);var s=Oe({createEl:!a,reportTouchActivity:!1},n);return(r=t.call(this,i,s)||this).ResizeObserver=n.ResizeObserver||e.ResizeObserver,r.loadListener_=null,r.resizeObserver_=null,r.debouncedHandler_=ge(function(){r.resizeHandler()},100,!1,Ue(r)),a?(r.resizeObserver_=new r.ResizeObserver(r.debouncedHandler_),r.resizeObserver_.observe(i.el())):(r.loadListener_=function(){if(r.el_&&r.el_.contentWindow){var e=r.debouncedHandler_,t=r.unloadListener_=function(){te(this,"resize",e),te(this,"unload",t),t=null};ee(r.el_.contentWindow,"unload",t),ee(r.el_.contentWindow,"resize",e)}},r.one("load",r.loadListener_)),r}xe(i,t);var n=i.prototype;return n.createEl=function(){return t.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1},{"aria-hidden":"true"})},n.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},n.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,t.prototype.dispose.call(this)},i}(Ie);Ie.registerComponent("ResizeManager",ja);var Ba=function(e){function i(i,n){var r,a=Oe({createEl:!1},n);return(r=e.call(this,i,a)||this).reset_(),r.on(r.player_,"durationchange",r.handleDurationchange),Ze&&"hidden"in t&&"visibilityState"in t&&r.on(t,"visibilitychange",r.handleVisibilityChange),r}xe(i,e);var n=i.prototype;return n.handleVisibilityChange=function(){this.player_.duration()===1/0&&(t.hidden?this.stopTracking():this.startTracking())},n.isBehind_=function(){if(!this.timeupdateSeen_)return!1;var e=this.liveCurrentTime(),t=this.player_.currentTime(),i=this.seekableIncrement_;return e!==1/0&&e-(2*i+.07)>=t},n.trackLive_=function(){this.pastSeekEnd_=this.pastSeekEnd_;var e=this.player_.seekable();if(e&&e.length){var t=this.seekableEnd();t!==this.lastSeekEnd_&&(this.lastSeekEnd_&&(this.seekableIncrement_=Math.abs(t-this.lastSeekEnd_)),this.pastSeekEnd_=0,this.lastSeekEnd_=t,this.trigger("seekableendchange")),this.pastSeekEnd_=this.pastSeekEnd()+.03,this.isBehind_()!==this.behindLiveEdge()&&(this.behindLiveEdge_=this.isBehind_(),this.trigger("liveedgechange"))}},n.handleDurationchange=function(){this.player_.duration()===1/0?this.startTracking():this.stopTracking()},n.startTracking=function(){var e=this;this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLive_,30),this.trackLive_(),this.on(this.player_,"play",this.trackLive_),this.on(this.player_,"pause",this.trackLive_),this.timeupdateSeen_||(this.one(this.player_,"play",this.handlePlay),this.handleTimeupdate=function(){e.timeupdateSeen_=!0,e.handleTimeupdate=null},this.one(this.player_,"timeupdate",this.handleTimeupdate)))},n.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge)},n.reset_=function(){this.pastSeekEnd_=0,this.lastSeekEnd_=null,this.behindLiveEdge_=null,this.timeupdateSeen_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.seekableIncrement_=12,this.off(this.player_,"play",this.trackLive_),this.off(this.player_,"pause",this.trackLive_),this.off(this.player_,"play",this.handlePlay),this.off(this.player_,"timeupdate",this.seekToLiveEdge),this.handleTimeupdate&&(this.off(this.player_,"timeupdate",this.handleTimeupdate),this.handleTimeupdate=null)},n.stopTracking=function(){this.isTracking()&&this.reset_()},n.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},n.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},n.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?1/0:e-this.seekableStart()},n.isLive=function(){return this.isTracking()},n.atLiveEdge=function(){return!this.behindLiveEdge()},n.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},n.pastSeekEnd=function(){return this.pastSeekEnd_},n.behindLiveEdge=function(){return this.behindLiveEdge_},n.isTracking=function(){return"number"==typeof this.trackingInterval_},n.seekToLiveEdge=function(){this.atLiveEdge()||(this.player_.currentTime(this.liveCurrentTime()),this.player_.paused()&&this.player_.play())},n.dispose=function(){this.stopTracking(),e.prototype.dispose.call(this)},i}(Ie);Ie.registerComponent("LiveTracker",Ba);var Na=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),n=[],r="";if(!i.length)return!1;for(var a=0;a<i.length;a++){var s=i[a].src;s&&-1===n.indexOf(s)&&n.push(s)}return!!n.length&&(1===n.length&&(r=n[0]),e.triggerSourceset(r),!0)},Fa=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(i){var n=t.createElement(this.nodeName.toLowerCase());n.innerHTML=i;for(var r=t.createDocumentFragment();n.childNodes.length;)r.appendChild(n.childNodes[0]);return this.innerText="",e.Element.prototype.appendChild.call(this,r),this.innerHTML}}),Va=function(e,t){for(var i={},n=0;n<e.length&&!((i=Object.getOwnPropertyDescriptor(e[n],t))&&i.set&&i.get);n++);return i.enumerable=!0,i.configurable=!0,i},Ga=function(t){var i=t.el();if(!i.resetSourceWatch_){var n={},r=function(t){return Va([t.el(),e.HTMLMediaElement.prototype,e.Element.prototype,Fa],"innerHTML")}(t),a=function(e){return function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];var s=e.apply(i,r);return Na(t),s}};["append","appendChild","insertAdjacentHTML"].forEach(function(e){i[e]&&(n[e]=i[e],i[e]=a(n[e]))}),Object.defineProperty(i,"innerHTML",Oe(r,{set:a(r.set)})),i.resetSourceWatch_=function(){i.resetSourceWatch_=null,Object.keys(n).forEach(function(e){i[e]=n[e]}),Object.defineProperty(i,"innerHTML",r)},t.one("sourceset",i.resetSourceWatch_)}},Ha=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?Gt(e.Element.prototype.getAttribute.call(this,"src")):""},set:function(t){return e.Element.prototype.setAttribute.call(this,"src",t),t}}),za=function(t){if(t.featuresSourceset){var i=t.el();if(!i.resetSourceset_){var n=function(t){return Va([t.el(),e.HTMLMediaElement.prototype,Ha],"src")}(t),r=i.setAttribute,a=i.load;Object.defineProperty(i,"src",Oe(n,{set:function(e){var r=n.set.call(i,e);return t.triggerSourceset(i.src),r}})),i.setAttribute=function(e,n){var a=r.call(i,e,n);return/src/i.test(e)&&t.triggerSourceset(i.src),a},i.load=function(){var e=a.call(i);return Na(t)||(t.triggerSourceset(""),Ga(t)),e},i.currentSrc?t.triggerSourceset(i.currentSrc):Na(t)||Ga(t),i.resetSourceset_=function(){i.resetSourceset_=null,i.load=a,i.setAttribute=r,Object.defineProperty(i,"src",n),i.resetSourceWatch_&&i.resetSourceWatch_()}}}},qa=function(i){function n(e,t){var n;n=i.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):n.handleLateInit_(n.el_),e.enableSourceset&&n.setupSourcesetHandling_(),n.el_.hasChildNodes()){for(var o=n.el_.childNodes,u=o.length,l=[];u--;){var c=o[u];"track"===c.nodeName.toLowerCase()&&(n.featuresNativeTextTracks?(n.remoteTextTrackEls().addTrackElement_(c),n.remoteTextTracks().addTrack(c.track),n.textTracks().addTrack(c.track),s||n.el_.hasAttribute("crossorigin")||!zt(c.src)||(s=!0)):l.push(c))}for(var d=0;d<l.length;d++)n.el_.removeChild(l[d])}return n.proxyNativeTracks_(),n.featuresNativeTextTracks&&s&&a.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_(),(nt||Ge||$e)&&!0===e.nativeControlsForTouch&&n.setControls(!0),n.proxyWebkitFullscreen_(),n.triggerReady(),n}xe(n,i);var r=n.prototype;return r.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),n.disposeMediaElement(this.el_),this.options_=null,i.prototype.dispose.call(this)},r.setupSourcesetHandling_=function(){za(this)},r.restoreMetadataTracksInIOSNativePlayer_=function(){var e,t=this.textTracks(),i=function(){e=[];for(var i=0;i<t.length;i++){var n=t[i];"metadata"===n.kind&&e.push({track:n,storedMode:n.mode})}};i(),t.addEventListener("change",i),this.on("dispose",function(){return t.removeEventListener("change",i)});var n=function i(){for(var n=0;n<e.length;n++){var r=e[n];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}t.removeEventListener("change",i)};this.on("webkitbeginfullscreen",function(){t.removeEventListener("change",i),t.removeEventListener("change",n),t.addEventListener("change",n)}),this.on("webkitendfullscreen",function(){t.removeEventListener("change",i),t.addEventListener("change",i),t.removeEventListener("change",n)})},r.overrideNative_=function(e,t){var i=this;if(t===this["featuresNative"+e+"Tracks"]){var n=e.toLowerCase();this[n+"TracksListeners_"]&&Object.keys(this[n+"TracksListeners_"]).forEach(function(e){i.el()[n+"Tracks"].removeEventListener(e,i[n+"TracksListeners_"][e])}),this["featuresNative"+e+"Tracks"]=!t,this[n+"TracksListeners_"]=null,this.proxyNativeTracksForType_(n)}},r.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)},r.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)},r.proxyNativeTracksForType_=function(e){var t=this,i=En[e],n=this.el()[i.getterName],r=this[i.getterName]();if(this["featuresNative"+i.capitalName+"Tracks"]&&n&&n.addEventListener){var a={change:function(e){r.trigger({type:"change",target:r,currentTarget:r,srcElement:r})},addtrack:function(e){r.addTrack(e.track)},removetrack:function(e){r.removeTrack(e.track)}},s=function(){for(var e=[],t=0;t<r.length;t++){for(var i=!1,a=0;a<n.length;a++)if(n[a]===r[t]){i=!0;break}i||e.push(r[t])}for(;e.length;)r.removeTrack(e.shift())};this[i.getterName+"Listeners_"]=a,Object.keys(a).forEach(function(e){var i=a[e];n.addEventListener(e,i),t.on("dispose",function(t){return n.removeEventListener(e,i)})}),this.on("loadstart",s),this.on("dispose",function(e){return t.off("loadstart",s)})}},r.proxyNativeTracks_=function(){var e=this;En.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 i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),n.disposeMediaElement(e),e=i}else{e=t.createElement("video");var r=Oe({},this.options_.tag&&A(this.options_.tag));nt&&!0===this.options_.nativeControlsForTouch||delete r.controls,P(e,c(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&L(e,"preload",this.options_.preload);for(var a=["loop","muted","playsinline","autoplay","stretch","fluent"],s=0;s<a.length;s++){var o=a[s],u=this.options_[o];void 0!==u&&(u?L(e,o,o):O(e,o),e[o]=u)}return e},r.handleLateInit_=function(e){if(0!==e.networkState&&3!==e.networkState){if(0===e.readyState){var t=!1,i=function(){t=!0};this.on("loadstart",i);var n=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",n),void this.ready(function(){this.off("loadstart",i),this.off("loadedmetadata",n),t||this.trigger("loadstart")})}var r=["loadstart"];r.push("loadedmetadata"),e.readyState>=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready(function(){r.forEach(function(e){this.trigger(e)},this)})}},r.setCurrentTime=function(e){try{this.el_.currentTime=e}catch(e){a(e,"Video is not ready. (Video.js)")}},r.duration=function(){var e=this;if(this.el_.duration===1/0&&We&&Je&&0===this.el_.currentTime){return this.on("timeupdate",function t(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))}),NaN}return this.el_.duration||NaN},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_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)})}},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_;e.paused&&e.networkState<=e.HAVE_METADATA?(this.el_.play(),this.setTimeout(function(){e.pause(),e.webkitEnterFullScreen()},0)):e.webkitEnterFullScreen()},r.exitFullScreen=function(){this.el_.webkitExitFullScreen()},r.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},r.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},r.reset=function(){n.resetMediaElement(this.el_)},r.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},r.setControls=function(e){this.el_.controls=!!e},r.addTextTrack=function(e,t,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,n):i.prototype.addTextTrack.call(this,e,t,n)},r.createRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return i.prototype.createRemoteTextTrack.call(this,e);var n=t.createElement("track");return e.kind&&(n.kind=e.kind),e.label&&(n.label=e.label),(e.language||e.srclang)&&(n.srclang=e.language||e.srclang),e.default&&(n.default=e.default),e.id&&(n.id=e.id),e.src&&(n.src=e.src),n},r.addRemoteTextTrack=function(e,t){var n=i.prototype.addRemoteTextTrack.call(this,e,t);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},r.removeRemoteTextTrack=function(e){if(i.prototype.removeRemoteTextTrack.call(this,e),this.featuresNativeTextTracks)for(var t=this.$$("track"),n=t.length;n--;)e!==t[n]&&e!==t[n].track||this.el().removeChild(t[n])},r.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var t={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(t.droppedVideoFrames=this.el().webkitDroppedFrameCount,t.totalVideoFrames=this.el().webkitDecodedFrameCount),e.performance&&"function"==typeof e.performance.now?t.creationTime=e.performance.now():e.performance&&e.performance.timing&&"number"==typeof e.performance.timing.navigationStart&&(t.creationTime=e.Date.now()-e.performance.timing.navigationStart),t},n}(ir);if(g()){qa.TEST_VID=t.createElement("video");var Wa=t.createElement("track");Wa.kind="captions",Wa.srclang="en",Wa.label="English",qa.TEST_VID.appendChild(Wa)}qa.isSupported=function(){try{qa.TEST_VID.volume=.5}catch(e){return!1}return!(!qa.TEST_VID||!qa.TEST_VID.canPlayType)},qa.canPlayType=function(e){return qa.TEST_VID.canPlayType(e)},qa.canPlaySource=function(e,t){return qa.canPlayType(e.type)},qa.canControlVolume=function(){try{var e=qa.TEST_VID.volume;return qa.TEST_VID.volume=e/2+.1,e!==qa.TEST_VID.volume}catch(e){return!1}},qa.canMuteVolume=function(){try{var e=qa.TEST_VID.muted;return qa.TEST_VID.muted=!e,qa.TEST_VID.muted?L(qa.TEST_VID,"muted","muted"):O(qa.TEST_VID,"muted"),e!==qa.TEST_VID.muted}catch(e){return!1}},qa.canControlPlaybackRate=function(){if(We&&Je&&Qe<58)return!1;try{var e=qa.TEST_VID.playbackRate;return qa.TEST_VID.playbackRate=e/2+.1,e!==qa.TEST_VID.playbackRate}catch(e){return!1}},qa.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(t.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(t.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(t.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(t.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},qa.supportsNativeTextTracks=function(){return tt||ze&&Je},qa.supportsNativeVideoTracks=function(){return!(!qa.TEST_VID||!qa.TEST_VID.videoTracks)},qa.supportsNativeAudioTracks=function(){return!(!qa.TEST_VID||!qa.TEST_VID.audioTracks)},qa.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],qa.prototype.featuresVolumeControl=qa.canControlVolume(),qa.prototype.featuresMuteControl=qa.canMuteVolume(),qa.prototype.featuresPlaybackRate=qa.canControlPlaybackRate(),qa.prototype.featuresSourceset=qa.canOverrideAttributes(),qa.prototype.movingMediaElementInDOM=!ze,qa.prototype.featuresFullscreenResize=!0,qa.prototype.featuresProgressEvents=!0,qa.prototype.featuresTimeupdateEvents=!0,qa.prototype.featuresNativeTextTracks=qa.supportsNativeTextTracks(),qa.prototype.featuresNativeVideoTracks=qa.supportsNativeVideoTracks(),qa.prototype.featuresNativeAudioTracks=qa.supportsNativeAudioTracks();var Ka=qa.TEST_VID&&qa.TEST_VID.constructor.prototype.canPlayType,$a=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;qa.patchCanPlayType=function(){Ke>=4&&!Xe&&!Je&&(qa.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&$a.test(e)?"maybe":Ka.call(this,e)})},qa.unpatchCanPlayType=function(){var e=qa.TEST_VID.constructor.prototype.canPlayType;return qa.TEST_VID.constructor.prototype.canPlayType=Ka,e},qa.patchCanPlayType(),qa.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},qa.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","stretch","fluent","controls","loop","playsinline"].forEach(function(e){qa.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){qa.prototype["set"+Le(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(e){qa.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach(function(e){qa.prototype["set"+Le(e)]=function(t){this.el_[e]=t}}),["pause","load","play"].forEach(function(e){qa.prototype[e]=function(){return this.el_[e]()}}),ir.withSourceHandlers(qa),qa.nativeSourceHandler={},qa.nativeSourceHandler.canPlayType=function(e){try{return qa.TEST_VID.canPlayType(e)}catch(e){return""}},qa.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return qa.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=Ht(e.src);return qa.nativeSourceHandler.canPlayType("video/"+i)}return""},qa.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},qa.nativeSourceHandler.dispose=function(){},qa.registerSourceHandler(qa.nativeSourceHandler),ir.registerTech("Html5",qa);var Xa=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Ya={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Ja=["tiny","xsmall","small","medium","large","xlarge","huge"],Qa={};Ja.forEach(function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Qa[e]="vjs-layout-"+t});var Za={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},es=function(n){function r(e,t,a){var o;if(e.id=e.id||t.id||"vjs_video_"+$(),(t=c(r.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language)if("function"==typeof e.closest){var u=e.closest("[lang]");u&&u.getAttribute&&(t.language=u.getAttribute("lang"))}else for(var l=e;l&&1===l.nodeType;){if(A(l).hasOwnProperty("lang")){t.language=l.getAttribute("lang");break}l=l.parentNode}if((o=n.call(this,null,t,a)||this).boundDocumentFullscreenChange_=pe(Ue(o),o.documentFullscreenChange_),o.boundFullWindowOnEscKey_=pe(Ue(o),o.fullWindowOnEscKey),o.log=s(o.id_),o.fsApi_=ct,o.isPosterFromTech_=!1,o.queuedCallbacks_=[],o.isReady_=!1,o.hasStarted_=!1,o.userActive_=!1,!o.options_||!o.options_.techOrder||!o.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(o.tag=e,o.tagAttributes=e&&A(e),o.language(o.options_.language),t.languages){var d={};Object.getOwnPropertyNames(t.languages).forEach(function(e){d[e.toLowerCase()]=t.languages[e]}),o.languages_=d}else o.languages_=r.prototype.options_.languages;o.resetCache_(),o.poster_=t.poster||"",o.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),o.changingSrc_=!1,o.playCallbacks_=[],o.playTerminatedQueue_=[],e.hasAttribute("autoplay")?o.autoplay(!0):o.autoplay(o.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(function(e){if("function"!=typeof o[e])throw new Error('plugin "'+e+'" does not exist')}),o.scrubbing_=!1,o.el_=o.createEl(),Ce(Ue(o),{eventBusKey:"el_"}),o.fluid_&&o.on("playerreset",o.updateStyleEl_);var h=Oe(o.options_);t.plugins&&Object.keys(t.plugins).forEach(function(e){o[e](t.plugins[e])}),o.options_.playerOptions=h,o.middleware_=[],o.initChildren(),o.isAudio("audio"===e.nodeName.toLowerCase()),o.controls()?o.addClass("vjs-controls-enabled"):o.addClass("vjs-controls-disabled"),o.el_.setAttribute("role","region"),o.isAudio()?o.el_.setAttribute("aria-label",o.localize("Audio Player")):o.el_.setAttribute("aria-label",o.localize("Video Player")),o.isAudio()&&o.addClass("vjs-audio"),o.flexNotSupported_()&&o.addClass("vjs-no-flex"),nt&&o.addClass("vjs-touch-enabled"),ze||o.addClass("vjs-workinghover"),r.players[o.id_]=Ue(o);var f=i.split(".")[0];return o.addClass("vjs-v"+f),o.userActive(!0),o.reportUserActivity(),o.one("play",o.listenForUserActivity_),o.on("stageclick",o.handleStageClick_),o.on("keydown",o.handleKeyDown),o.breakpoints(o.options_.breakpoints),o.responsive(o.options_.responsive),o}xe(r,n);var o=r.prototype;return o.dispose=function(){var e=this;this.trigger("dispose"),this.off("dispose"),te(t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),te(t,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),r.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),rr[this.id()]=null,Cn.names.forEach(function(t){var i=Cn[t],n=e[i.getterName]();n&&n.off&&n.off()}),n.prototype.dispose.call(this)},o.createEl=function(){var i,r=this.tag,a=this.playerElIngest_=r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player"),s="video-js"===this.tag.tagName.toLowerCase();a?i=this.el_=r.parentNode:s||(i=this.el_=n.prototype.createEl.call(this,"div"));var o=A(r);if(s){for(i=this.el_=r,r=this.tag=t.createElement("video");i.children.length;)r.appendChild(i.firstChild);k(i,"video-js")||E(i,"video-js"),i.appendChild(r),a=this.playerElIngest_=i,Object.keys(i).forEach(function(e){r[e]=i[e]})}if(r.setAttribute("tabindex","-1"),o.tabindex="-1",(Ze||Je&&it)&&(r.setAttribute("role","application"),o.role="application"),r.removeAttribute("width"),r.removeAttribute("height"),"width"in o&&delete o.width,"height"in o&&delete o.height,Object.getOwnPropertyNames(o).forEach(function(e){s&&"class"===e||i.setAttribute(e,o[e]),s&&r.setAttribute(e,o[e])}),r.playerId=r.id,r.id+="_html5_api",r.className="vjs-tech",r.player=i.player=this,this.addClass("vjs-paused"),!0!==e.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=de("vjs-styles-dimensions");var u=H(".vjs-styles-defaults"),l=H("head");l.insertBefore(this.styleEl_,u?u.nextSibling:l.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio);for(var c=r.getElementsByTagName("a"),d=0;d<c.length;d++){var h=c.item(d);E(h,"vjs-hidden"),h.setAttribute("hidden","hidden")}return r.initNetworkState_=r.networkState,r.parentNode&&!a&&r.parentNode.insertBefore(i,r),S(r,i),this.children_.unshift(r),this.el_.setAttribute("lang",this.language_),this.el_=i,i},o.width=function(e){return this.dimension("width",e)},o.height=function(e){return this.dimension("height",e)},o.dimension=function(e,t){var i=e+"_";if(void 0===t)return this[i]||0;if(""===t)return this[i]=void 0,void this.updateStyleEl_();var n=parseFloat(t);isNaN(n)?a.error('Improper value "'+t+'" supplied for for '+e):(this[i]=n,this.updateStyleEl_())},o.fluid=function(e){if(void 0===e)return!!this.fluid_;var t,i;this.fluid_=!!e,ye(this)&&this.off("playerreset",this.updateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),ye(t=function(){this.on("playerreset",this.updateStyleEl_)})?i():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(i))):this.removeClass("vjs-fluid"),this.updateStyleEl_()},o.fill=function(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},o.aspectRatio=function(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()},o.updateStyleEl_=function(){if(!0!==e.VIDEOJS_NO_DYNAMIC_STYLE){var t,i,n,r=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),a=r[1]/r[0];t=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/a:this.videoWidth()||300,i=void 0!==this.height_?this.height_:t*a,n=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(n),he(this.styleEl_,"\n ."+n+" {\n width: "+t+"px;\n height: "+i+"px;\n }\n\n ."+n+".vjs-fluid {\n padding-top: "+100*a+"%;\n }\n ")}else{var s="number"==typeof this.width_?this.width_:this.options_.width,o="number"==typeof this.height_?this.height_:this.options_.height,u=this.tech_&&this.tech_.el();u&&(s>=0&&(u.width=s),o>=0&&(u.height=o))}},o.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=Le(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(ir.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var a={source:t,autoplay:"string"!=typeof this.autoplay()&&this.autoplay(),nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,stretch:this.options_.stretch,fluent:this.options_.fluent,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};Cn.names.forEach(function(e){var t=Cn[e];a[t.getterName]=i[t.privateName]}),c(a,this.options_[n]),c(a,this.options_[r]),c(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);var s=ir.getTech(e);if(!s)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new s(a),this.tech_.ready(pe(this,this.handleTechReady_),!0),St(this.textTracksJson_||[],this.tech_),Xa.forEach(function(e){i.on(i.tech_,e,i["handleTech"+Le(e)+"_"])}),Object.keys(Ya).forEach(function(e){i.on(i.tech_,e,function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+Ya[e]+"_"].bind(i),event:t}):i["handleTech"+Ya[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_,"fullscreentoggle",this.handleTechFullscreenToggle_),this.on(this.tech_,"enterpictureinpicture",this.handleTechEnterPictureInPicture_),this.on(this.tech_,"leavepictureinpicture",this.handleTechLeavePictureInPicture_),this.on(this.tech_,"error",this.handleTechError_),this.on(this.tech_,"loadedmetadata",this.updateStyleEl_),this.on(this.tech_,"posterchange",this.handleTechPosterChange_),this.on(this.tech_,"textdata",this.handleTechTextData_),this.on(this.tech_,"ratechange",this.handleTechRateChange_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||S(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},o.unloadTech_=function(){var e=this;Cn.names.forEach(function(t){var i=Cn[t];e[i.privateName]=e[i.getterName]()}),this.textTracksJson_=Tt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},o.tech=function(e){return void 0===e&&a.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_},o.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"mouseup",this.handleTechClick_),this.on(this.tech_,"dblclick",this.handleTechDoubleClick_),this.on(this.tech_,"touchstart",this.handleTechTouchStart_),this.on(this.tech_,"touchmove",this.handleTechTouchMove_),this.on(this.tech_,"touchend",this.handleTechTouchEnd_),this.on(this.tech_,"tap",this.handleTechTap_)},o.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.handleTechTap_),this.off(this.tech_,"touchstart",this.handleTechTouchStart_),this.off(this.tech_,"touchmove",this.handleTechTouchMove_),this.off(this.tech_,"touchend",this.handleTechTouchEnd_),this.off(this.tech_,"mouseup",this.handleTechClick_),this.off(this.tech_,"dblclick",this.handleTechDoubleClick_)},o.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},o.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.seekingTimer&&(clearTimeout(this.seekingTimer),this.seekingTimer=0),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(this.autoplay())},o.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"==typeof e){var i,n=function(){var e=t.muted();t.muted(!0);var i=function(){t.muted(e)};t.playTerminatedQueue_.push(i);var n=t.play();if(yt(n))return n.catch(i)};if("any"===e&&!0!==this.muted()?yt(i=this.play())&&(i=i.catch(n)):i="muted"===e&&!0!==this.muted()?n():this.play(),yt(i))return i.then(function(){t.trigger({type:"autoplay-success",autoplay:e})}).catch(function(i){t.trigger({type:"autoplay-failure",autoplay:e})})}},o.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter(function(e){return e.src===t});if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r<n.length;r++){var a=n[r];if(a.type&&a.src&&a.src===t)return a.type}return fr(t)}(this,t)),this.cache_.source=Oe({},e,{src:t,type:i});for(var n=this.cache_.sources.filter(function(e){return e.src&&e.src===t}),r=[],a=this.$$("source"),s=[],o=0;o<a.length;o++){var u=A(a[o]);r.push(u),u.src&&u.src===t&&s.push(u.src)}s.length&&!n.length?this.cache_.sources=r:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t},o.handleTechSourceset_=function(e){var t=this;if(!this.changingSrc_){var i=function(e){return t.updateSourceCaches_(e)},n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n)&&(i=function(){}),i(r),e.src||this.tech_.any(["sourceset","loadstart"],function(e){if("sourceset"!==e.type){var i=t.techGet("currentSrc");t.lastSource_.tech=i,t.updateSourceCaches_(i)}})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})},o.hasStarted=function(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},o.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},o.handleTechRateChange_=function(){this.tech_.playbackRate()>0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach(function(e){return e.callback(e.event)}),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},o.waitingTimer=0,o.seekingTimer=0,o.handleTechWaiting_=function(){var e=this;this.waitingTimer&&clearTimeout(this.waitingTimer),this.waitingTimer=setTimeout(function(){e.addClass("vjs-waiting")},1e3),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",function i(){e.waitingTimer&&(clearTimeout(e.waitingTimer),e.waitingTimer=0),t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))})},o.handleTechCanPlay_=function(){this.waitingTimer&&(clearTimeout(this.waitingTimer),this.waitingTimer=0),this.removeClass("vjs-waiting"),this.trigger("canplay")},o.handleTechCanPlayThrough_=function(){this.waitingTimer&&(clearTimeout(this.waitingTimer),this.waitingTimer=0),this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},o.handleTechPlaying_=function(){this.waitingTimer&&(clearTimeout(this.waitingTimer),this.waitingTimer=0),this.removeClass("vjs-waiting"),this.trigger("playing")},o.handleTechSeeking_=function(){var e=this;this.seekingTimer&&clearTimeout(this.seekingTimer),this.seekingTimer=setTimeout(function(){e.addClass("vjs-seeking")},1e3),this.trigger("seeking")},o.handleTechSeeked_=function(){this.seekingTimer&&(clearTimeout(this.seekingTimer),this.seekingTimer=0),this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},o.handleTechFirstPlay_=function(){this.options_.starttime&&(a.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},o.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},o.handleTechEnded_=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},o.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},o.handleTechClick_=function(e){G(e)&&this.controls_&&this.paused()},o.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(t){return t.contains(e.target)})||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},o.handleTechTap_=function(){this.userActive(!this.userActive())},o.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},o.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},o.handleTechTouchEnd_=function(e){e.preventDefault()},o.handleStageClick_=function(){this.reportUserActivity()},o.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},o.documentFullscreenChange_=function(e){var i=this.el(),n=t[this.fsApi_.fullscreenElement]===i;!n&&i.matches?n=i.matches(":"+this.fsApi_.fullscreen):!n&&i.msMatchesSelector&&(n=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(n),!1===this.isFullscreen()&&te(t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.fsApi_.prefixed&&this.trigger("fullscreenchange")},o.handleTechFullscreenChange_=function(e,t){t&&this.isFullscreen(t.isFullscreen),this.trigger("fullscreenchange")},o.handleTechFullscreenToggle_=function(e,t){this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()},o.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},o.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},o.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},o.handleTechError_=function(){var e=this.tech_.error();this.error(e)},o.handleTechTextData_=function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)},o.getCache=function(){return this.cache_},o.resetCache_=function(){this.cache_={currentTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],volume:1}},o.techCall_=function(e,t){this.ready(function(){if(e in lr)return function(e,t,i,n){return t[i](e.reduce(dr(i),n))}(this.middleware_,this.tech_,e,t);if(e in cr)return or(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw a(e),e}},!0)},o.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in ur)return function(e,t,i){return e.reduceRight(dr(i),t[i]())}(this.middleware_,this.tech_,e);if(e in cr)return or(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw a("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw a("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw a(t),t}}},o.play=function(){var t=this,i=this.options_.Promise||e.Promise;return i?new i(function(e){t.play_(e)}):this.play_()},o.play_=function(e){var t=this;void 0===e&&(e=_t),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!tt&&!ze||this.load());var n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)},o.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})},o.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(t){t(e)})},o.pause=function(){this.techCall_("pause")},o.paused=function(){return!1!==this.techGet_("paused")},o.played=function(){return this.techGet_("played")||ot(0,0)},o.scrubbing=function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},o.currentTime=function(e){return void 0!==e?(e<0&&(e=0),void this.techCall_("setCurrentTime",e)):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},o.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?(this.addClass("vjs-live"),this.options_.liveui&&this.player_.liveTracker&&this.addClass("vjs-liveui")):(this.removeClass("vjs-live"),this.removeClass("vjs-liveui")),isNaN(e)||this.trigger("durationchange"))},o.remainingTime=function(){return this.duration()-this.currentTime()},o.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},o.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=ot(0,0)),e},o.bufferedPercent=function(){return ut(this.buffered(),this.duration())},o.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i},o.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},o.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},o.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},o.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},o.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},o.isFullscreen=function(e){return void 0!==e?(this.isFullscreen_=!!e,void this.toggleFullscreenClass_()):!!this.isFullscreen_},o.requestFullscreen=function(e){var i;this.isFullscreen(!0),this.fsApi_.requestFullscreen?(ee(t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.fsApi_.prefixed||(i=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(i=e)),_t(this.el_[this.fsApi_.requestFullscreen](i))):this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):(this.enterFullWindow(),this.trigger("fullscreenchange"))},o.exitFullscreen=function(){this.isFullscreen(!1),this.fsApi_.requestFullscreen?(t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement)&&_t(t[this.fsApi_.exitFullscreen]()):this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):(this.exitFullWindow(),this.trigger("fullscreenchange"))},o.enterFullWindow=function(){this.isFullWindow=!0,this.docOrigOverflow=t.documentElement.style.overflow,ee(t,"keydown",this.boundFullWindowOnEscKey_),t.documentElement.style.overflow="hidden",E(t.body,"vjs-full-window"),this.trigger("enterFullWindow")},o.fullWindowOnEscKey=function(e){Et.isEventKey(e,"Esc")&&(!0===this.isFullscreen()?this.exitFullscreen():this.exitFullWindow())},o.exitFullWindow=function(){this.isFullWindow=!1,te(t,"keydown",this.boundFullWindowOnEscKey_),t.documentElement.style.overflow=this.docOrigOverflow,w(t.body,"vjs-full-window"),this.trigger("exitFullWindow")},o.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},o.requestPictureInPicture=function(){if("pictureInPictureEnabled"in t)return this.techGet_("requestPictureInPicture")},o.exitPictureInPicture=function(){if("pictureInPictureEnabled"in t)return t.exitPictureInPicture()},o.handleKeyDown=function(e){var t=this.options_.userActions;if(t&&t.hotkeys){(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}},o.handleHotkeys=function(e){var i=this.options_.userActions?this.options_.userActions.hotkeys:{},n=i.fullscreenKey,r=void 0===n?function(e){return Et.isEventKey(e,"f")}:n,a=i.muteKey,s=void 0===a?function(e){return Et.isEventKey(e,"m")}:a,o=i.playPauseKey,u=void 0===o?function(e){return Et.isEventKey(e,"k")||Et.isEventKey(e,"Space")}:o;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();var l=Ie.getComponent("FullscreenToggle");!1!==t[this.fsApi_.fullscreenEnabled]&&l.prototype.handleClick.call(this,e)}else if(s.call(this,e)){e.preventDefault(),e.stopPropagation(),Ie.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(u.call(this,e)){e.preventDefault(),e.stopPropagation(),Ie.getComponent("PlayToggle").prototype.handleClick.call(this,e)}},o.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i<n.length;i++){var r=n[i],s=ir.getTech(r);if(s||(s=Ie.getComponent(r)),s){if(s.isSupported()&&(t=s.canPlayType(e)))return t}else a.error('The "'+r+'" tech is undefined. Skipped browser support check for that tech.')}return""},o.selectSource=function(e){var t,i=this,n=this.options_.techOrder.map(function(e){return[e,ir.getTech(e)]}).filter(function(e){var t=e[0],i=e[1];return i?i.isSupported():(a.error('The "'+t+'" tech is undefined. Skipped browser support check for that tech.'),!1)}),r=function(e,t,i){var n;return e.some(function(e){return t.some(function(t){if(n=i(e,t))return!0})}),n},s=function(e,t){var n=e[0];if(e[1].canPlaySource(t,i.options_[n.toLowerCase()]))return{source:t,tech:n}};return(this.options_.sourceOrder?r(e,n,(t=s,function(e,i){return t(i,e)})):r(n,e,s))||!1},o.src=function(e){var t=this;if(void 0===e)return this.cache_.src||"";var i=function e(t){if(Array.isArray(t)){var i=[];t.forEach(function(t){t=e(t),Array.isArray(t)?i=i.concat(t):d(t)&&i.push(t)}),t=i}else t="string"==typeof t&&t.trim()?[pr({src:t})]:d(t)&&"string"==typeof t.src&&t.src&&t.src.trim()?[pr(t)]:[];return t}(e);i.length?(this.changingSrc_=!0,this.cache_.sources=i,this.updateSourceCaches_(i[0]),sr(this,i[0],function(e,n){var r,a;if(t.middleware_=n,t.cache_.sources=i,t.updateSourceCaches_(e),t.src_(e))return i.length>1?t.src(i.slice(1)):(t.changingSrc_=!1,t.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0),void t.triggerReady());r=n,a=t.tech_,r.forEach(function(e){return e.setTech&&e.setTech(a)})})):this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0)},o.src_=function(e){var t,i,n=this,r=this.selectSource([e]);return!r||(t=r.tech,i=this.techName_,Le(t)!==Le(i)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready(function(){n.changingSrc_=!1}),!1):(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1))},o.load=function(){this.techCall_("load")},o.reset=function(){var t=this,i=this.options_.Promise||e.Promise;this.paused()||!i?this.doReset_():_t(this.play().then(function(){return t.doReset_()}))},o.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),ye(this)&&this.trigger("playerreset")},o.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},o.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar,t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},o.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},o.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},o.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},o.currentSource=function(){return this.cache_.source||{}},o.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},o.currentType=function(){return this.currentSource()&&this.currentSource().type||""},o.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},o.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)?(this.options_.autoplay=e,this.manualAutoplay_(e),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},o.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},o.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},o.stretch=function(e){return void 0!==e?(this.techCall_("setStretch",e),void(this.options_.stretch=e)):this.techGet_("stretch")},o.fluent=function(e){return void 0!=e?(this.techCall_("setFluent",e),this.options_.fluent=e,this):this.techGet_("fluent")},o.poster=function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},o.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},o.controls=function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},o.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},o.error=function(e){if(void 0===e)return this.error_||null;if(this.options_.suppressNotSupportedError&&e&&e.message&&e.message===this.localize(this.options_.notSupportedMessage)){var t=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),void this.one("loadstart",function(){this.off(["click","touchstart"],t)})}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new mt(e),this.addClass("vjs-error"),a.error("(CODE:"+this.error_.code+" "+mt.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error")},o.reportUserActivity=function(e){this.userActivity_=!0},o.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},o.listenForUserActivity_=function(){var e,t,i,n=pe(this,this.reportUserActivity);this.on("mousedown",function(){n(),this.clearInterval(e),e=this.setInterval(n,250)}),this.on("mousemove",function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,n())}),this.on("mouseup",function(t){n(),this.clearInterval(e)});var r,a=this.getChild("controlBar");!a||ze||We||(a.on("mouseenter",function(e){this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout,this.player().options_.inactivityTimeout=0}),a.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",n),this.on("keyup",n),this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(r);var e=this.options_.inactivityTimeout;e<=0||(r=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e))}},250)},o.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},o.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},o.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},o.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},o.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},o.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)},o.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},o.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},o.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},o.language=function(e){if(void 0===e)return this.language_;this.language_=String(e).toLowerCase()},o.languages=function(){return Oe(r.prototype.options_.languages,this.languages_)},o.toJSON=function(){var e=Oe(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i<t.length;i++){var n=t[i];(n=Oe(n)).player=void 0,e.tracks[i]=n}return e},o.createModal=function(e,t){var i=this;(t=t||{}).content=e||"";var n=new Ct(this,t);return this.addChild(n),n.on("dispose",function(){i.removeChild(n)}),n.open(),n},o.updateCurrentBreakpoint_=function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),i=0;i<Ja.length;i++){var n=Ja[i];if(t<=this.breakpoints_[n]){if(e===n)return;e&&this.removeClass(Qa[e]),this.addClass(Qa[n]),this.breakpoint_=n;break}}},o.removeCurrentBreakpoint_=function(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)},o.breakpoints=function(e){return void 0===e?c(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=c({},Za,e),this.updateCurrentBreakpoint_(),c(this.breakpoints_))},o.responsive=function(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?(this.responsive_=e,e?(this.on("playerresize",this.updateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.updateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0},o.currentBreakpoint=function(){return this.breakpoint_},o.currentBreakpointClass=function(){return Qa[this.breakpoint_]||""},o.loadMedia=function(e,t){var i=this;if(e&&"object"==typeof e){this.reset(),this.cache_.media=Oe(e);var n=this.cache_.media,r=n.artwork,a=n.poster,s=n.src,o=n.textTracks;!r&&a&&(this.cache_.media.artwork=[{src:a,type:fr(a)}]),s&&this.src(s),a&&this.poster(a),Array.isArray(o)&&o.forEach(function(e){return i.addRemoteTextTrack(e,!1)}),this.ready(t)}},o.getMedia=function(){if(!this.cache_.media){var e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}})};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:fr(t.poster)}]),t}return Oe(this.cache_.media)},r.getTagSettings=function(e){var t={sources:[],tracks:[]},i=A(e),n=i["data-setup"];if(k(e,"vjs-fill")&&(i.fill=!0),k(e,"vjs-fluid")&&(i.fluid=!0),null!==n){var r=vt(n||"{}"),s=r[0],o=r[1];s&&a.error(s),c(i,o)}if(c(t,i),e.hasChildNodes())for(var u=e.childNodes,l=0,d=u.length;l<d;l++){var h=u[l],f=h.nodeName.toLowerCase();"source"===f?t.sources.push(A(h)):"track"===f&&t.tracks.push(A(h))}return t},o.flexNotSupported_=function(){var e=t.createElement("i");return!("flexBasis"in e.style||"webkitFlexBasis"in e.style||"mozFlexBasis"in e.style||"msFlexBasis"in e.style||"msFlexOrder"in e.style)},r}(Ie);Cn.names.forEach(function(e){var t=Cn[e];es.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),es.players={};var ts=e.navigator;es.prototype.options_={techOrder:ir.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:ts&&(ts.languages&&ts.languages[0]||ts.userLanguage||ts.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){es.prototype[e]=function(){return this.techGet_(e)}}),Xa.forEach(function(e){es.prototype["handleTech"+Le(e)+"_"]=function(){return this.trigger(e)}}),Ie.registerComponent("Player",es);var is={},ns=function(e){return is.hasOwnProperty(e)},rs=function(e){return ns(e)?is[e]:void 0},as=function(e,t){e.activePlugins_=e.activePlugins_||{},e.activePlugins_[t]=!0},ss=function(e,t,i){var n=(i?"before":"")+"pluginsetup";e.trigger(n,t),e.trigger(n+":"+t.name,t)},os=function(e,t){return t.prototype.name=e,function(){ss(this,{name:e,plugin:t,instance:null},!0);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];var a=Me(t,[this].concat(n));return this[e]=function(){return a},ss(this,a.getEventHash()),a}},us=function(){function e(t){if(this.constructor===e)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t,Ce(this),delete this.trigger,Ae(this,this.constructor.defaultState),as(t,this.name),this.dispose=pe(this,this.dispose),t.on("dispose",this.dispose)}var t=e.prototype;return t.version=function(){return this.constructor.VERSION},t.getEventHash=function(e){return void 0===e&&(e={}),e.name=this.name,e.plugin=this.constructor,e.instance=this,e},t.trigger=function(e,t){return void 0===t&&(t={}),ie(this.eventBusEl_,e,this.getEventHash(t))},t.handleStateChanged=function(e){},t.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t.activePlugins_[e]=!1,this.player=this.state=null,t[e]=os(e,is[e])},e.isBasic=function(t){var i="string"==typeof t?rs(t):t;return"function"==typeof i&&!e.prototype.isPrototypeOf(i.prototype)},e.registerPlugin=function(t,i){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+typeof t+".");if(ns(t))a.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(es.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'+t+'", cannot share a name with an existing player method!');if("function"!=typeof i)throw new Error('Illegal plugin for "'+t+'", must be a function, was '+typeof i+".");return is[t]=i,"plugin"!==t&&(e.isBasic(i)?es.prototype[t]=function(e,t){var i=function(){ss(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return as(this,e),ss(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach(function(e){i[e]=t[e]}),i}(t,i):es.prototype[t]=os(t,i)),i},e.deregisterPlugin=function(e){if("plugin"===e)throw new Error("Cannot de-register base plugin.");ns(e)&&(delete is[e],delete es.prototype[e])},e.getPlugins=function(e){var t;return void 0===e&&(e=Object.keys(is)),e.forEach(function(e){var i=rs(e);i&&((t=t||{})[e]=i)}),t},e.getPluginVersion=function(e){var t=rs(e);return t&&t.VERSION||""},e}();us.getPlugin=rs,us.BASE_PLUGIN_NAME="plugin",us.registerPlugin("plugin",us),es.prototype.usingPlugin=function(e){return!!this.activePlugins_&&!0===this.activePlugins_[e]},es.prototype.hasPlugin=function(e){return!!ns(e)};var ls=function(e){return 0===e.indexOf("#")?e.slice(1):e};function cs(e,t,i){var n=cs.getPlayer(e);if(n)return t&&a.warn('Player "'+e+'" is already initialised. Options will not be applied.'),i&&n.ready(i),n;var r="string"==typeof e?H("#"+ls(e)):e;if(!v(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");r.ownerDocument.defaultView&&r.ownerDocument.body.contains(r)||a.warn("The element supplied is not included in the DOM"),t=t||{},cs.hooks("beforesetup").forEach(function(e){var i=e(r,Oe(t));d(i)&&!Array.isArray(i)?t=Oe(t,i):a.error("please return an object in beforesetup hooks")});var s=Ie.getComponent("Player");return n=new s(r,t,i),cs.hooks("setup").forEach(function(e){return e(n)}),n}if(cs.hooks_={},cs.hooks=function(e,t){return cs.hooks_[e]=cs.hooks_[e]||[],t&&(cs.hooks_[e]=cs.hooks_[e].concat(t)),cs.hooks_[e]},cs.hook=function(e,t){cs.hooks(e,t)},cs.hookOnce=function(e,t){cs.hooks(e,[].concat(t).map(function(t){return function i(){return cs.removeHook(e,i),t.apply(void 0,arguments)}}))},cs.removeHook=function(e,t){var i=cs.hooks(e).indexOf(t);return!(i<=-1)&&(cs.hooks_[e]=cs.hooks_[e].slice(),cs.hooks_[e].splice(i,1),!0)},!0!==e.VIDEOJS_NO_DYNAMIC_STYLE&&g()){var ds=H(".vjs-styles-defaults");if(!ds){ds=de("vjs-styles-defaults");var hs=H("head");hs&&hs.insertBefore(ds,hs.firstChild),he(ds,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}le(1,cs),cs.VERSION=i,cs.options=es.prototype.options_,cs.getPlayers=function(){return es.players},cs.getPlayer=function(e){var t,i=es.players;if("string"==typeof e){var n=ls(e),r=i[n];if(r)return r;t=H("#"+n)}else t=e;if(v(t)){var a=t,s=a.player,o=a.playerId;if(s||i[o])return s||i[o]}},cs.getAllPlayers=function(){return Object.keys(es.players).map(function(e){return es.players[e]}).filter(Boolean)},cs.players=es.players,cs.getComponent=Ie.getComponent,cs.registerComponent=function(e,t){ir.isTech(t)&&a.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),Ie.registerComponent.call(Ie,e,t)},cs.getTech=ir.getTech,cs.registerTech=ir.registerTech,cs.use=function(e,t){nr[e]=nr[e]||[],nr[e].push(t)},Object.defineProperty(cs,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(cs.middleware,"TERMINATOR",{value:ar,writeable:!1,enumerable:!0}),cs.browser=rt,cs.TOUCH_ENABLED=nt,cs.extend=function(e,t){void 0===t&&(t={});var i=function(){e.apply(this,arguments)},n={};for(var r in"object"==typeof t?(t.constructor!==Object.prototype.constructor&&(i=t.constructor),n=t):"function"==typeof t&&(i=t),function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.super_=t)}(i,e),n)n.hasOwnProperty(r)&&(i.prototype[r]=n[r]);return i},cs.mergeOptions=Oe,cs.bind=pe,cs.registerPlugin=us.registerPlugin,cs.deregisterPlugin=us.deregisterPlugin,cs.plugin=function(e,t){return a.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),us.registerPlugin(e,t)},cs.getPlugins=us.getPlugins,cs.getPlugin=us.getPlugin,cs.getPluginVersion=us.getPluginVersion,cs.addLanguage=function(e,t){var i;return e=(""+e).toLowerCase(),cs.options.languages=Oe(cs.options.languages,((i={})[e]=t,i)),cs.options.languages[e]},cs.log=a,cs.createLogger=s,cs.createTimeRange=cs.createTimeRanges=ot,cs.formatTime=Rr,cs.setFormatTime=function(e){Ar=e},cs.resetFormatTime=function(){Ar=Pr},cs.parseUrl=Vt,cs.isCrossOrigin=zt,cs.EventTarget=ve,cs.on=ee,cs.one=ne,cs.off=te,cs.trigger=ie,cs.xhr=hn,cs.TextTrack=yn,cs.AudioTrack=_n,cs.VideoTrack=bn,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(e){cs[e]=function(){return a.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead"),q[e].apply(null,arguments)}}),cs.computedStyle=f,cs.dom=q,cs.url=qt;var fs=kt(function(e,t){var i,n,r,a,s;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,n=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=s.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=s.normalizePath(r.path),s.buildURLFromParts(r)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return i.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=n.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var c=o.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;l.path=s.normalizePath(d)}else l.path=o.path,a.params||(l.params=o.params,a.query||(l.query=o.query));return null===l.path&&(l.path=i.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(l)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s});function ps(){return(ps=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function ms(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function gs(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var vs=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t,i,n,r=this.listeners[e];if(r)if(2===arguments.length)for(i=r.length,t=0;t<i;++t)r[t].call(this,arguments[1]);else for(n=Array.prototype.slice.call(arguments,1),i=r.length,t=0;t<i;++t)r[t].apply(this,n)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",function(t){e.push(t)})},e}(),ys=function(e){function t(){var t;return(t=e.call(this)||this).buffer="",t}return ms(t,e),t.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(vs),_s=function(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),n[t[0]]=t[1]);return n},bs=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}ms(t,e);var i=t.prototype;return i.push=function(e){var t,i,n=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce(function(t,i){var n=i(e);return n===e?t:t.concat([n])},[e]).forEach(function(e){for(var r=0;r<n.customParsers.length;r++)if(n.customParsers[r].call(n,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))n.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void n.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"totalduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void n.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"byterange"},t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),void n.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"map"},t[1]){var a=_s(t[1]);if(a.URI&&(i.uri=a.URI),a.BYTERANGE){var s=a.BYTERANGE.split("@"),o=s[0],u=s[1];i.byterange={},o&&(i.byterange.length=parseInt(o,10)),u&&(i.byterange.offset=parseInt(u,10))}}n.trigger("data",i)}else if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=_s(t[1]),i.attributes.RESOLUTION){var l=i.attributes.RESOLUTION.split("x"),c={};l[0]&&(c.width=parseInt(l[0],10)),l[1]&&(c.height=parseInt(l[1],10)),i.attributes.RESOLUTION=c}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}n.trigger("data",i)}else{if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=_s(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e))n.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))n.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return i={type:"tag",tagType:"key"},t[1]&&(i.attributes=_s(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void n.trigger("data",i);if(t=/^#EXT-X-START:?(.*)$/.exec(e))return i={type:"tag",tagType:"start"},t[1]&&(i.attributes=_s(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);n.trigger("data",{type:"tag",data:e.slice(4)})}}}else n.trigger("data",{type:"comment",text:e.slice(1)})}):this.trigger("data",{type:"uri",uri:e}))},i.addParser=function(e){var t=this,i=e.expression,n=e.customType,r=e.dataParser,a=e.segment;"function"!=typeof r&&(r=function(e){return e}),this.customParsers.push(function(e){if(i.exec(e))return t.trigger("data",{type:"custom",data:r(e),customType:n,segment:a}),!0})},i.addTagMapper=function(e){var t=e.expression,i=e.map;this.tagMappers.push(function(e){return t.test(e)?i(e):e})},t}(vs),Ts=function(e){function t(){var t;(t=e.call(this)||this).lineStream=new ys,t.parseStream=new bs,t.lineStream.pipe(t.parseStream);var i,n,r=gs(gs(t)),a=[],s={},o={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},u=0;return t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},t.parseStream.on("data",function(e){var t,l;({tag:function(){(({"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&(s.byterange=t,t.length=e.length,"offset"in e||(this.trigger("info",{message:"defaulting offset to zero"}),e.offset=0)),"offset"in e&&(s.byterange=t,t.offset=e.offset)},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),e.duration>0&&(s.duration=e.duration),0===e.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=a},key:function(){e.attributes?"NONE"!==e.attributes.METHOD?e.attributes.URI?(e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(n.iv=e.attributes.IV)):this.trigger("warn",{message:"ignoring key declaration without URI"}):n=null:this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,u=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||o,e.attributes?(s.attributes||(s.attributes={}),ps(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||o,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(l={default:/yes/i.test(e.attributes.DEFAULT)}).default?l.autoselect=!0:l.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(l.language=e.attributes.LANGUAGE),e.attributes.URI&&(l.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(l.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(l.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(l.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=l}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){u+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(a.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),s.dateTimeString=e.dateTimeString,s.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):this.manifest.targetDuration=e.duration},totalduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+e.duration}):this.manifest.totalDuration=e.duration},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data}})[e.tagType]||function(){}).call(r)},uri:function(){s.uri=e.uri,a.push(s),!this.manifest.targetDuration||"duration"in s||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),n&&(s.key=n),s.timeline=u,i&&(s.map=i),s={}},comment:function(){},custom:function(){e.segment?(s.custom=s.custom||{},s.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(r)}),t}ms(t,e);var i=t.prototype;return i.push=function(e){this.lineStream.push(e)},i.end=function(){this.lineStream.push("\n")},i.addParser=function(e){this.parseStream.addParser(e)},i.addTagMapper=function(e){this.parseStream.addTagMapper(e)},t}(vs),Ss=function(e){return!!e&&"object"==typeof e},ks=function e(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.reduce(function(t,i){return Object.keys(i).forEach(function(n){Array.isArray(t[n])&&Array.isArray(i[n])?t[n]=t[n].concat(i[n]):Ss(t[n])&&Ss(i[n])?t[n]=e(t[n],i[n]):t[n]=i[n]}),t},{})},Es=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},ws=function(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t},Cs="INVALID_NUMBER_OF_PERIOD",Ps="DASH_EMPTY_MANIFEST",As="DASH_INVALID_XML",Rs="NO_BASE_URL",Ls="SEGMENT_TIME_UNSPECIFIED",Os="UNSUPPORTED_UTC_TIMING_SCHEME";var Is,xs=(function(e,t){var i,n,r,a,s;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,n=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=s.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=s.normalizePath(r.path),s.buildURLFromParts(r)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return i.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=n.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var c=o.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;l.path=s.normalizePath(d)}else l.path=o.path,a.params||(l.params=o.params,a.query||(l.query=o.query));return null===l.path&&(l.path=i.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(l)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s}(Is={exports:{}},Is.exports),Is.exports),Ds=function(t,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(t)||(t=xs.buildAbsoluteURL(e.location.href,t)),xs.buildAbsoluteURL(t,i))},Ms=function(e){var t=e.baseUrl,i=void 0===t?"":t,n=e.source,r=void 0===n?"":n,a=e.range,s=void 0===a?"":a,o=e.indexRange,u=void 0===o?"":o,l={uri:r,resolvedUri:Ds(i||"",r)};if(s||u){var c=(s||u).split("-"),d=parseInt(c[0],10),h=parseInt(c[1],10);l.byterange={length:h-d+1,offset:d}}return l},Us={static:function(e){var t=e.duration,i=e.timescale,n=void 0===i?1:i,r=e.sourceDuration;return{start:0,end:Math.ceil(r/(t/n))}},dynamic:function(e){var t=e.NOW,i=e.clientOffset,n=e.availabilityStartTime,r=e.timescale,a=void 0===r?1:r,s=e.duration,o=e.start,u=void 0===o?0:o,l=e.minimumUpdatePeriod,c=void 0===l?0:l,d=e.timeShiftBufferDepth,h=void 0===d?1/0:d,f=(t+i)/1e3,p=n+u,m=f+c-p,g=Math.ceil(m*a/s),v=Math.floor((f-p-h)*a/s),y=Math.floor((f-p)*a/s);return{start:Math.max(0,v),end:Math.min(g,y)}}},js=function(e){var t=e.type,i=void 0===t?"static":t,n=e.duration,r=e.timescale,a=void 0===r?1:r,s=e.sourceDuration,o=Us[i](e),u=function(e,t){for(var i=[],n=e;n<t;n++)i.push(n);return i}(o.start,o.end).map(function(e){return function(t,i){var n=e.duration,r=e.timescale,a=void 0===r?1:r,s=e.periodIndex,o=e.startNumber;return{number:(void 0===o?1:o)+t,duration:n/a,timeline:s,time:i*n}}}(e));if("static"===i){var l=u.length-1;u[l].duration=s-n/a*l}return u},Bs=function(e){var t=e.baseUrl,i=e.initialization,n=void 0===i?{}:i,r=e.sourceDuration,a=e.timescale,s=void 0===a?1:a,o=e.indexRange,u=void 0===o?"":o,l=e.duration;if(!t)throw new Error(Rs);var c=Ms({baseUrl:t,source:n.sourceURL,range:n.range}),d=Ms({baseUrl:t,source:t,indexRange:u});if(d.map=c,l){var h=js(e);h.length&&(d.duration=h[0].duration,d.timeline=h[0].timeline)}else r&&(d.duration=r/s,d.timeline=0);return d.number=0,[d]},Ns=function(e,t,i){for(var n=e.sidx.map?e.sidx.map:null,r=e.sidx.duration,a=e.timeline||0,s=e.sidx.byterange,o=s.offset+s.length,u=t.timescale,l=t.references.filter(function(e){return 1!==e.referenceType}),c=[],d=o+t.firstOffset,h=0;h<l.length;h++){var f=t.references[h],p=f.referencedSize,m=f.subsegmentDuration,g=Bs({baseUrl:i,timescale:u,timeline:a,periodIndex:a,duration:m,sourceDuration:r,indexRange:d+"-"+(d+p-1)})[0];n&&(g.map=n),c.push(g),d+=p}return e.segments=c,e},Fs=function(e){var t;return(t=e.reduce(function(e,t){var i,n=t.attributes.id+(t.attributes.lang||"");e[n]?(t.segments[0]&&(t.segments[0].discontinuity=!0),(i=e[n].segments).push.apply(i,t.segments),t.attributes.contentProtection&&(e[n].attributes.contentProtection=t.attributes.contentProtection)):e[n]=t;return e},{}),Object.keys(t).map(function(e){return t[e]})).map(function(e){var t,i;return e.discontinuityStarts=(t=e.segments,i="discontinuity",t.reduce(function(e,t,n){return t[i]&&e.push(n),e},[])),e})},Vs=function(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e){var n=e[i];if(n.sidx){var r=n.sidx.uri+"-"+(s=n.sidx.byterange,void 0,o=s.offset+s.length-1,s.offset+"-"+o),a=t[r]&&t[r].sidx;n.sidx&&a&&Ns(n,a,n.sidx.resolvedUri)}}var s,o;return e},Gs=function(e){var t,i=e.attributes,n=e.segments,r=e.sidx,a={attributes:(t={NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1};return i.contentProtection&&(a.contentProtection=i.contentProtection),r&&(a.sidx=r),a},Hs=function(e,t){var i;if(void 0===t&&(t={}),!e.length)return{};var n=e[0].attributes,r=n.sourceDuration,a=n.minimumUpdatePeriod,s=void 0===a?0:a,o=Fs(e.filter(function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType})).map(Gs),u=Fs(e.filter(function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio"===t.contentType})),l=e.filter(function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType}),c={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(i={AUDIO:{},VIDEO:{}},i["CLOSED-CAPTIONS"]={},i.SUBTITLES={},i),uri:"",duration:r,playlists:Vs(o,t),minimumUpdatePeriod:1e3*s};return u.length&&(c.mediaGroups.AUDIO.audio=function(e,t){var i;void 0===t&&(t={});var n=e.reduce(function(e,n){var r=n.attributes.role&&n.attributes.role.value||"",a=n.attributes.lang||"",s="main";if(a){var o=r?" ("+r+")":"";s=""+n.attributes.lang+o}return e[s]&&e[s].playlists[0].attributes.BANDWIDTH>n.attributes.bandwidth?e:(e[s]={language:a,autoselect:!0,default:"main"===r,playlists:Vs([function(e){var t,i=e.attributes,n=e.segments,r=e.sidx,a={attributes:(t={NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1};return i.contentProtection&&(a.contentProtection=i.contentProtection),r&&(a.sidx=r),a}(n)],t),uri:""},void 0===i&&"main"===r&&((i=n).default=!0),e)},{});i||(n[Object.keys(n)[0]].default=!0);return n}(u,t)),l.length&&(c.mediaGroups.SUBTITLES.subs=function(e,t){return void 0===t&&(t={}),e.reduce(function(e,i){var n,r,a,s,o=i.attributes.lang||"text";return e[o]?e:(e[o]={language:o,default:!1,autoselect:!1,playlists:Vs([(n=i,a=n.attributes,s=n.segments,void 0===s&&(s=[{uri:a.baseUrl,timeline:a.periodIndex,resolvedUri:a.baseUrl||"",duration:a.sourceDuration,number:0}],a.duration=a.sourceDuration),{attributes:(r={NAME:a.id,BANDWIDTH:a.bandwidth},r["PROGRAM-ID"]=1,r),uri:"",endList:"static"===(a.type||"static"),timeline:a.periodIndex,resolvedUri:a.baseUrl||"",targetDuration:a.duration,segments:s,mediaSequence:s.length?s[0].number:1})],t),uri:""},e)},{})}(l,t)),c},zs=function(e,t,i){var n=e.NOW,r=e.clientOffset,a=e.availabilityStartTime,s=e.timescale,o=void 0===s?1:s,u=e.start,l=void 0===u?0:u,c=e.minimumUpdatePeriod,d=(n+r)/1e3+(void 0===c?0:c)-(a+l);return Math.ceil((d*o-t)/i)},qs=function(e,t){for(var i=e.type,n=void 0===i?"static":i,r=e.minimumUpdatePeriod,a=void 0===r?0:r,s=e.media,o=void 0===s?"":s,u=e.sourceDuration,l=e.timescale,c=void 0===l?1:l,d=e.startNumber,h=void 0===d?1:d,f=e.periodIndex,p=[],m=-1,g=0;g<t.length;g++){var v=t[g],y=v.d,_=v.r||0,b=v.t||0;m<0&&(m=b),b&&b>m&&(m=b);var T=void 0;if(_<0){var S=g+1;T=S===t.length?"dynamic"===n&&a>0&&o.indexOf("$Number$")>0?zs(e,m,y):(u*c-m)/y:(t[S].t-m)/y}else T=_+1;for(var k=h+p.length+T,E=h+p.length;E<k;)p.push({number:E,duration:y/c,time:m,timeline:f}),m+=y,E++}return p},Ws=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,Ks=function(e,t){return e.replace(Ws,function(e){return function(t,i,n,r){if("$$"===t)return"$";if(void 0===e[i])return t;var a=""+e[i];return"RepresentationID"===i?a:(r=n?parseInt(r,10):1,a.length>=r?a:""+new Array(r-a.length+1).join("0")+a)}}(t))},$s=function(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,a=Ms({baseUrl:e.baseUrl,source:Ks(r.sourceURL,i),range:r.range});return function(e,t){return e.duration||t?e.duration?js(e):qs(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}(e,t).map(function(t){i.Number=t.number,i.Time=t.time;var n=Ks(e.media||"",i);return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:Ds(e.baseUrl||"",n),map:a,number:t.number}})},Xs=function(e,t){var i=e.duration,n=e.segmentUrls,r=void 0===n?[]:n;if(!i&&!t||i&&t)throw new Error(Ls);var a,s=r.map(function(t){return function(e,t){var i=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,a=Ms({baseUrl:i,source:r.sourceURL,range:r.range}),s=Ms({baseUrl:i,source:t.media,range:t.mediaRange});return s.map=a,s}(e,t)});return i&&(a=js(e)),t&&(a=qs(e,t)),a.map(function(e,t){if(s[t]){var i=s[t];return i.timeline=e.timeline,i.duration=e.duration,i.number=e.number,i}}).filter(function(e){return e})},Ys=function(e){var t,i,n=e.attributes,r=e.segmentInfo;r.template?(i=$s,t=ks(n,r.template)):r.base?(i=Bs,t=ks(n,r.base)):r.list&&(i=Xs,t=ks(n,r.list));var a={attributes:n};if(!i)return a;var s=i(t,r.timeline);if(t.duration){var o=t,u=o.duration,l=o.timescale,c=void 0===l?1:l;t.duration=u/c}else s.length?t.duration=s.reduce(function(e,t){return Math.max(e,Math.ceil(t.duration))},0):t.duration=0;return a.attributes=t,a.segments=s,r.base&&t.indexRange&&(a.sidx=s[0],a.segments=[]),a},Js=function(e,t){return ws(e.childNodes).filter(function(e){return e.tagName===t})},Qs=function(e){return e.textContent.trim()},Zs=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var i=t.slice(1),n=i[0],r=i[1],a=i[2],s=i[3],o=i[4],u=i[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(r||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(u||0)},eo={mediaPresentationDuration:function(e){return Zs(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return Zs(e)},timeShiftBufferDepth:function(e){return Zs(e)},start:function(e){return Zs(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?Zs(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},to=function(e){return e&&e.attributes?ws(e.attributes).reduce(function(e,t){var i=eo[t.name]||eo.DEFAULT;return e[t.name]=i(t.value),e},{}):{}};var io,no,ro,ao,so,oo,uo,lo,co,ho,fo,po,mo,go,vo,yo,_o,bo,To,So,ko,Eo,wo,Co,Po,Ao,Ro,Lo,Oo,Io,xo,Do,Mo,Uo,jo,Bo,No,Fo,Vo,Go,Ho,zo,qo,Wo,Ko={"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"},$o=function(e,t){return t.length?Es(e.map(function(e){return t.map(function(t){return Ds(e,Qs(t))})})):e},Xo=function(e){var t=Js(e,"SegmentTemplate")[0],i=Js(e,"SegmentList")[0],n=i&&Js(i,"SegmentURL").map(function(e){return ks({tag:"SegmentURL"},to(e))}),r=Js(e,"SegmentBase")[0],a=i||t,s=a&&Js(a,"SegmentTimeline")[0],o=i||r||t,u=o&&Js(o,"Initialization")[0],l=t&&to(t);l&&u?l.initialization=u&&to(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var c={template:l,timeline:s&&Js(s,"S").map(function(e){return to(e)}),list:i&&ks(to(i),{segmentUrls:n,initialization:to(u)}),base:r&&ks(to(r),{initialization:to(u)})};return Object.keys(c).forEach(function(e){c[e]||delete c[e]}),c},Yo=function(t){return t.reduce(function(t,i){var n=to(i),r=Ko[n.schemeIdUri];if(r){t[r]={attributes:n};var a=Js(i,"cenc:pssh")[0];if(a){var s=Qs(a),o=s&&function(t){for(var i=e.atob(t),n=new Uint8Array(i.length),r=0;r<i.length;r++)n[r]=i.charCodeAt(r);return n}(s);t[r].pssh=o}}return t},{})},Jo=function(e,t,i){return function(n){var r=to(n),a=$o(t,Js(n,"BaseURL")),s=Js(n,"Role")[0],o={role:to(s)},u=ks(e,r,o),l=Yo(Js(n,"ContentProtection"));Object.keys(l).length&&(u=ks(u,{contentProtection:l}));var c=Xo(n),d=Js(n,"Representation"),h=ks(i,c);return Es(d.map(function(e,t,i){return function(n){var r=Js(n,"BaseURL"),a=$o(t,r),s=ks(e,to(n)),o=Xo(n);return a.map(function(e){return{segmentInfo:ks(i,o),attributes:ks(s,{baseUrl:e})}})}}(u,a,h)))}},Qo=function(t,i){void 0===i&&(i={});var n=i,r=n.manifestUri,a=void 0===r?"":r,s=n.NOW,o=void 0===s?Date.now():s,u=n.clientOffset,l=void 0===u?0:u,c=Js(t,"Period");if(!c.length)throw new Error(Cs);var d=to(t),h=$o([a],Js(t,"BaseURL"));return d.sourceDuration=d.mediaPresentationDuration||0,d.NOW=o,d.clientOffset=l,Es(c.map(function(t,i){return function(n,r){var a=$o(i,Js(n,"BaseURL")),s=to(n),o=parseInt(s.id,10),u=e.isNaN(o)?r:o,l=ks(t,{periodIndex:u}),c=Js(n,"AdaptationSet"),d=Xo(n);return Es(c.map(Jo(l,a,d)))}}(d,h)))},Zo=function(t){if(""===t)throw new Error(Ps);var i=(new e.DOMParser).parseFromString(t,"application/xml"),n=i&&"MPD"===i.documentElement.tagName?i.documentElement:null;if(!n||n&&n.getElementsByTagName("parsererror").length>0)throw new Error(As);return n},eu=function(e,t){return void 0===t&&(t={}),Hs(Qo(Zo(e),t).map(Ys),t.sidxMapping)},tu=function(e){return function(e){var t=Js(e,"UTCTiming")[0];if(!t)return null;var i=to(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Os)}return i}(Zo(e))},iu=function(e){return e>>>0},nu={findBox:io=function(e,t){var i,n,r,a,s,o=[];if(!t.length)return null;for(i=0;i<e.byteLength;)n=iu(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]),r=no(e.subarray(i+4,i+8)),a=n>1?i+n:e.byteLength,r===t[0]&&(1===t.length?o.push(e.subarray(i+8,a)):(s=io(e.subarray(i+8,a),t.slice(1))).length&&(o=o.concat(s))),i=a;return o},parseType:no=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},timescale:function(e){return io(e,["moov","trak"]).reduce(function(e,t){var i,n,r,a,s;return(i=io(t,["tkhd"])[0])?(n=i[0],a=iu(i[r=0===n?12:20]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3]),(s=io(t,["mdia","mdhd"])[0])?(r=0===(n=s[0])?12:20,e[a]=iu(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3]),e):null):null},{})},startTime:function(e,t){var i,n,r;return i=io(t,["moof","traf"]),n=[].concat.apply([],i.map(function(t){return io(t,["tfhd"]).map(function(i){var n,r;return n=iu(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),r=e[n]||9e4,(io(t,["tfdt"]).map(function(e){var t,i;return t=e[0],i=iu(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(i*=Math.pow(2,32),i+=iu(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),i})[0]||1/0)/r})})),r=Math.min.apply(null,n),isFinite(r)?r:0},videoTrackIds:function(e){var t=[];return io(e,["moov","trak"]).forEach(function(e){var i=io(e,["mdia","hdlr"]),n=io(e,["tkhd"]);i.forEach(function(e,i){var r,a,s=no(e.subarray(8,12)),o=n[i];"vide"===s&&(a=0===(r=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?r.getUint32(12):r.getUint32(20),t.push(a))})}),t}},ru=nu.parseType,au=function(e){return new Date(1e3*e-20828448e5)},su=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]}},ou={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:ro(e.subarray(78,e.byteLength))}},avcC:function(e){var t,i,n,r,a=new DataView(e.buffer,e.byteOffset,e.byteLength),s={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:3&e[4],sps:[],pps:[]},o=31&e[5];for(n=6,r=0;r<o;r++)i=a.getUint16(n),n+=2,s.sps.push(new Uint8Array(e.subarray(n,n+i))),n+=i;for(t=e[n],n++,r=0;r<t;r++)i=a.getUint16(n),n+=2,s.pps.push(new Uint8Array(e.subarray(n,n+i))),n+=i;return s},btrt:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},esds:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),esId:e[6]<<8|e[7],streamPriority:31&e[8],decoderConfig:{objectProfileIndication:e[11],streamType:e[12]>>>2&63,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:e[26]>>>3&31,samplingFrequencyIndex:(7&e[26])<<1|e[27]>>>7&1,channelConfiguration:e[27]>>>3&15}}}},ftyp:function(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={majorBrand:ru(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},n=8;n<e.byteLength;)i.compatibleBrands.push(ru(e.subarray(n,n+4))),n+=4;return i},dinf:function(e){return{boxes:ro(e)}},dref:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),dataReferences:ro(e.subarray(8))}},hdlr:function(e){var t={version:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0),flags:new Uint8Array(e.subarray(1,4)),handlerType:ru(e.subarray(8,12)),name:""},i=8;for(i=24;i<e.byteLength;i++){if(0===e[i]){i++;break}t.name+=String.fromCharCode(e[i])}return t.name=decodeURIComponent(escape(t.name)),t},mdat:function(e){return{byteLength:e.byteLength,nals:function(e){var t,i,n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[];for(t=0;t+4<e.length;t+=i)if(i=n.getUint32(t),t+=4,i<=0)r.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&e[t]){case 1:r.push("slice_layer_without_partitioning_rbsp");break;case 5:r.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:r.push("sei_rbsp");break;case 7:r.push("seq_parameter_set_rbsp");break;case 8:r.push("pic_parameter_set_rbsp");break;case 9:r.push("access_unit_delimiter_rbsp");break;default:r.push("UNKNOWN NAL - "+e[t]&31)}return r}(e)}},mdhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n=4,r={version:i.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};return 1===r.version?(n+=4,r.creationTime=au(i.getUint32(n)),n+=8,r.modificationTime=au(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=8,r.duration=i.getUint32(n)):(r.creationTime=au(i.getUint32(n)),n+=4,r.modificationTime=au(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=4,r.duration=i.getUint32(n)),n+=4,t=i.getUint16(n),r.language+=String.fromCharCode(96+(t>>10)),r.language+=String.fromCharCode(96+((992&t)>>5)),r.language+=String.fromCharCode(96+(31&t)),r},mdia:function(e){return{boxes:ro(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:ro(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(i.streamDescriptor=ro(e.subarray(28))[0]),i},moof:function(e){return{boxes:ro(e)}},moov:function(e){return{boxes:ro(e)}},mvex:function(e){return{boxes:ro(e)}},mvhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,n={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=au(t.getUint32(i)),i+=8,n.modificationTime=au(t.getUint32(i)),i+=4,n.timescale=t.getUint32(i),i+=8,n.duration=t.getUint32(i)):(n.creationTime=au(t.getUint32(i)),i+=4,n.modificationTime=au(t.getUint32(i)),i+=4,n.timescale=t.getUint32(i),i+=4,n.duration=t.getUint32(i)),i+=4,n.rate=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,n.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,i+=8,n.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,i+=24,n.nextTrackId=t.getUint32(i),n},pdin:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t<e.byteLength;t++)i.samples.push({dependsOn:(48&e[t])>>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return i},sidx:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},r=i.getUint16(22);for(t=24;r;t+=12,r--)n.references.push({referenceType:(128&e[t])>>>7,referencedSize:2147483647&i.getUint32(t),subsegmentDuration:i.getUint32(t+4),startsWithSap:!!(128&e[t+8]),sapType:(112&e[t+8])>>>4,sapDeltaTime:268435455&i.getUint32(t+8)});return n},smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:ro(e)}},stco:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},r=i.getUint32(4);for(t=8;r;t+=4,r--)n.chunkOffsets.push(i.getUint32(t));return n},stsc:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n=i.getUint32(4),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;n;t+=12,n--)r.sampleToChunks.push({firstChunk:i.getUint32(t),samplesPerChunk:i.getUint32(t+4),sampleDescriptionIndex:i.getUint32(t+8)});return r},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:ro(e.subarray(8))}},stsz:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(t=12;t<e.byteLength;t+=4)n.entries.push(i.getUint32(t));return n},stts:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},r=i.getUint32(4);for(t=8;r;t+=8,r--)n.timeToSamples.push({sampleCount:i.getUint32(t),sampleDelta:i.getUint32(t+4)});return n},styp:function(e){return ou.ftyp(e)},tfdt:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:e[4]<<24|e[5]<<16|e[6]<<8|e[7]};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=e[8]<<24|e[9]<<16|e[10]<<8|e[11]),t},tfhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],a=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],u=32&n.flags[2],l=65536&n.flags[0],c=131072&n.flags[0];return t=8,r&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),a&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),s&&(n.defaultSampleDuration=i.getUint32(t),t+=4),o&&(n.defaultSampleSize=i.getUint32(t),t+=4),u&&(n.defaultSampleFlags=i.getUint32(t)),l&&(n.durationIsEmpty=!0),!r&&c&&(n.baseDataOffsetIsMoof=!0),n},tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,n={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=au(t.getUint32(i)),i+=8,n.modificationTime=au(t.getUint32(i)),i+=4,n.trackId=t.getUint32(i),i+=4,i+=8,n.duration=t.getUint32(i)):(n.creationTime=au(t.getUint32(i)),i+=4,n.modificationTime=au(t.getUint32(i)),i+=4,n.trackId=t.getUint32(i),i+=4,i+=4,n.duration=t.getUint32(i)),i+=4,i+=8,n.layer=t.getUint16(i),i+=2,n.alternateGroup=t.getUint16(i),i+=2,n.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,n.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,n.width=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,n.height=t.getUint16(i)+t.getUint16(i+2)/16,n},traf:function(e){return{boxes:ro(e)}},trak:function(e){return{boxes:ro(e)}},trex:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:3&e[20],sampleIsDependedOn:(192&e[21])>>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],c=n.getUint32(4),d=8;for(r&&(i.dataOffset=n.getInt32(d),d+=4),a&&c&&(t={flags:su(e.subarray(d,d+4))},d+=4,s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),l&&(t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t),c--);c--;)t={},s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),u&&(t.flags=su(e.subarray(d,d+4)),d+=4),l&&(t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t);return i},"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}},uu={inspect:ro=function(e){for(var t,i,n,r,a,s=0,o=[],u=new ArrayBuffer(e.length),l=new Uint8Array(u),c=0;c<e.length;++c)l[c]=e[c];for(t=new DataView(u);s<e.byteLength;)i=t.getUint32(s),n=ru(e.subarray(s+4,s+8)),r=i>1?s+i:e.byteLength,(a=(ou[n]||function(e){return{data:e}})(e.subarray(s+8,r))).size=i,a.type=n,o.push(a),s=r;return o},textify:ao=function(e,t){var i;return t=t||0,i=new Array(2*t+1).join(" "),e.map(function(e,n){return i+e.type+"\n"+Object.keys(e).filter(function(e){return"type"!==e&&"boxes"!==e}).map(function(t){var n=i+" "+t+": ",r=e[t];if(r instanceof Uint8Array||r instanceof Uint32Array){var a=Array.prototype.slice.call(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map(function(e){return" "+("00"+e.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return a?1===a.length?n+"<"+a.join("").slice(1)+">":n+"<\n"+a.map(function(e){return i+" "+e}).join("\n")+"\n"+i+" >":n+"<>"}return n+JSON.stringify(r,null,2).split("\n").map(function(e,t){return 0===t?e:i+" "+e}).join("\n")}).join("\n")+(e.boxes?"\n"+ao(e.boxes,t+1):"")}).join("\n")},parseTfdt:ou.tfdt,parseHdlr:ou.hdlr,parseTfhd:ou.tfhd,parseTrun:ou.trun,parseSidx:ou.sidx},lu=Math.pow(2,32)-1;!function(){var e;if(Ao={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in Ao)Ao.hasOwnProperty(e)&&(Ao[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);Ro=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),Oo=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),Lo=new Uint8Array([0,0,0,1]),Io=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]),xo=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]),Do={video:Io,audio:xo},jo=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),Uo=new Uint8Array([0,0,0,0,0,0,0,0]),Bo=new Uint8Array([0,0,0,0,0,0,0,0]),No=Bo,Fo=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Vo=Bo,Mo=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),so=function(e){var t,i,n=[],r=0;for(t=1;t<arguments.length;t++)n.push(arguments[t]);for(t=n.length;t--;)r+=n[t].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,r=8;t<n.length;t++)i.set(n[t],r),r+=n[t].byteLength;return i},oo=function(){return so(Ao.dinf,so(Ao.dref,jo))},uo=function(e){return so(Ao.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]))},To=function(e){return so(Ao.hdlr,Do[e])},bo=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),so(Ao.mdhd,t)},_o=function(e){return so(Ao.mdia,bo(e),To(e.type),ho(e))},co=function(e){return so(Ao.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},ho=function(e){return so(Ao.minf,"video"===e.type?so(Ao.vmhd,Mo):so(Ao.smhd,Uo),oo(),ko(e))},fo=function(e,t){for(var i=[],n=t.length;n--;)i[n]=wo(t[n]);return so.apply(null,[Ao.moof,co(e)].concat(i))},po=function(e){for(var t=e.length,i=[];t--;)i[t]=vo(e[t]);return so.apply(null,[Ao.moov,go(4294967295)].concat(i).concat(mo(e)))},mo=function(e){for(var t=e.length,i=[];t--;)i[t]=Co(e[t]);return so.apply(null,[Ao.mvex].concat(i))},go=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 so(Ao.mvhd,t)},So=function(e){var t,i,n=e.samples||[],r=new Uint8Array(4+n.length);for(i=0;i<n.length;i++)t=n[i].flags,r[i+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return so(Ao.sdtp,r)},ko=function(e){return so(Ao.stbl,Eo(e),so(Ao.stts,Vo),so(Ao.stsc,No),so(Ao.stsz,Fo),so(Ao.stco,Bo))},Eo=function(e){return so(Ao.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?Go(e):Ho(e))},Go=function(e){var t,i=e.sps||[],n=e.pps||[],r=[],a=[];for(t=0;t<i.length;t++)r.push((65280&i[t].byteLength)>>>8),r.push(255&i[t].byteLength),r=r.concat(Array.prototype.slice.call(i[t]));for(t=0;t<n.length;t++)a.push((65280&n[t].byteLength)>>>8),a.push(255&n[t].byteLength),a=a.concat(Array.prototype.slice.call(n[t]));return so(Ao.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]),so(Ao.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([i.length]).concat(r).concat([n.length]).concat(a))),so(Ao.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},Ho=function(e){return so(Ao.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]),uo(e))},yo=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 so(Ao.tkhd,t)},wo=function(e){var t,i,n,r,a,s;return t=so(Ao.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),a=Math.floor(e.baseMediaDecodeTime/(lu+1)),s=Math.floor(e.baseMediaDecodeTime%(lu+1)),i=so(Ao.tfdt,new Uint8Array([1,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s])),92,"audio"===e.type?(n=Po(e,92),so(Ao.traf,t,i,n)):(r=So(e),n=Po(e,r.length+92),so(Ao.traf,t,i,n,r))},vo=function(e){return e.duration=e.duration||4294967295,so(Ao.trak,yo(e),_o(e))},Co=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]);return"video"!==e.type&&(t[t.length-1]=0),so(Ao.trex,t)},Wo=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,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]},qo=function(e,t){var i,n,r,a;for(t+=20+16*(n=e.samples||[]).length,i=Wo(n,t),a=0;a<n.length;a++)r=n[a],i=i.concat([(4278190080&r.duration)>>>24,(16711680&r.duration)>>>16,(65280&r.duration)>>>8,255&r.duration,(4278190080&r.size)>>>24,(16711680&r.size)>>>16,(65280&r.size)>>>8,255&r.size,r.flags.isLeading<<2|r.flags.dependsOn,r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,61440&r.flags.degradationPriority,15&r.flags.degradationPriority,(4278190080&r.compositionTimeOffset)>>>24,(16711680&r.compositionTimeOffset)>>>16,(65280&r.compositionTimeOffset)>>>8,255&r.compositionTimeOffset]);return so(Ao.trun,new Uint8Array(i))},zo=function(e,t){var i,n,r,a;for(t+=20+8*(n=e.samples||[]).length,i=Wo(n,t),a=0;a<n.length;a++)r=n[a],i=i.concat([(4278190080&r.duration)>>>24,(16711680&r.duration)>>>16,(65280&r.duration)>>>8,255&r.duration,(4278190080&r.size)>>>24,(16711680&r.size)>>>16,(65280&r.size)>>>8,255&r.size]);return so(Ao.trun,new Uint8Array(i))},Po=function(e,t){return"audio"===e.type?zo(e,t):qo(e,t)};var cu={ftyp:lo=function(){return so(Ao.ftyp,Ro,Lo,Ro,Oo)},mdat:function(e){return so(Ao.mdat,e)},moof:fo,moov:po,initSegment:function(e){var t,i=lo(),n=po(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t}},du=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(a=[],n=arguments.length,n=1;n<arguments.length;++n)a.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,a)}},this.dispose=function(){e={}}}};du.prototype.pipe=function(e){return this.on("data",function(t){e.push(t)}),this.on("done",function(t){e.flush(t)}),e},du.prototype.push=function(e){this.trigger("data",e)},du.prototype.flush=function(e){this.trigger("done",e)};var hu,fu,pu,mu,gu,vu=du,yu=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},_u=function(e){var t,i,n=[],r=[];for(n.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.push(n),r},bu=function(e){var t,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},Tu=function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},Su=function(e,t){var i,n,r,a,s,o=t||0,u=[];for(i=0;i<e.length;i++)for(a=e[i],n=0;n<a.length;n++)s=a[n],o+=(r=yu(s,o)).size,u.push(r);return u},ku=function(e){var t,i,n,r,a,s,o=0,u=e.byteLength,l=e.nalCount,c=new Uint8Array(u+4*l),d=new DataView(c.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(a=r[i],n=0;n<a.length;n++)s=a[n],d.setUint32(o,s.data.byteLength),o+=4,c.set(s.data,o),o+=s.data.byteLength;return c},Eu=[33,16,5,32,164,27],wu=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Cu=function(e){for(var t=[];e--;)t.push(0);return t},Pu={96000:[Eu,[227,64],Cu(154),[56]],88200:[Eu,[231],Cu(170),[56]],64000:[Eu,[248,192],Cu(240),[56]],48000:[Eu,[255,192],Cu(268),[55,148,128],Cu(54),[112]],44100:[Eu,[255,192],Cu(268),[55,163,128],Cu(84),[112]],32000:[Eu,[255,192],Cu(268),[55,234],Cu(226),[112]],24000:[Eu,[255,192],Cu(268),[55,255,128],Cu(268),[111,112],Cu(126),[224]],16000:[Eu,[255,192],Cu(268),[55,255,128],Cu(268),[111,255],Cu(269),[223,108],Cu(195),[1,192]],12000:[wu,Cu(268),[3,127,248],Cu(268),[6,255,240],Cu(268),[13,255,224],Cu(268),[27,253,128],Cu(259),[56]],11025:[wu,Cu(268),[3,127,248],Cu(268),[6,255,240],Cu(268),[13,255,224],Cu(268),[27,255,192],Cu(268),[55,175,128],Cu(108),[112]],8000:[wu,Cu(268),[3,121,16],Cu(47),[7]]},Au=(hu=Pu,Object.keys(hu).reduce(function(e,t){return e[t]=new Uint8Array(hu[t].reduce(function(e,t){return e.concat(t)},[])),e},{})),Ru=(fu=function(e){return 9e4*e},pu=function(e,t){return e*t},mu=function(e){return e/9e4},gu=function(e,t){return e/t},function(e,t){return fu(gu(e,t))}),Lu=function(e,t){return pu(mu(e),t)},Ou=function(e,t,i,n){var r,a,s,o,u=0,l=0,c=0;if(t.length&&(r=Ru(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(9e4/(e.samplerate/1024)),i&&n&&(u=r-Math.max(i,n),c=(l=Math.floor(u/a))*a),!(l<1||c>45e3))){for((s=Au[e.samplerate])||(s=t[0].data),o=0;o<l;o++)t.splice(o,0,{data:s});e.baseMediaDecodeTime-=Math.floor(Lu(c,e.samplerate))}},Iu=function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},xu=function(e){var t,i,n=[];for(t=0;t<e.length;t++)i=e[t],n.push({size:i.data.byteLength,duration:1024});return n},Du=function(e){var t,i,n=0,r=new Uint8Array(function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i}(e));for(t=0;t<e.length;t++)i=e[t],r.set(i.data,n),n+=i.data.byteLength;return r},Mu=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},Uu=function(e,t){var i,n=e.minSegmentDts;return t||(n-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=n,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/9e4,i=Math.floor(i)),i},ju=function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},Bu=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}t+=r,n=0,r=0}return i},Nu=function(e){return 181!==e.payload[0]?null:49!=(e.payload[1]<<8|e.payload[2])?null:"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])?null:3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},Fu=function(e,t){var i,n,r,a,s=[];if(!(64&t[0]))return s;for(n=31&t[0],i=0;i<n;i++)a={type:3&t[2+(r=3*i)],pts:e},4&t[r+2]&&(a.ccData=t[r+3]<<8|t[r+4],s.push(a));return s},Vu=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=e[s];return i},Gu=4,Hu=function e(){e.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new $u(0,0),new $u(0,1),new $u(1,0),new $u(1,1)],this.reset(),this.ccStreams_.forEach(function(e){e.on("data",this.trigger.bind(this,"data")),e.on("done",this.trigger.bind(this,"done"))},this)};(Hu.prototype=new vu).push=function(e){var t,i,n;if("sei_rbsp"===e.nalUnitType&&(t=Bu(e.escapedRBSP)).payloadType===Gu&&(i=Nu(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));n=Fu(e.pts,i),this.captionPackets_=this.captionPackets_.concat(n),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Hu.prototype.flush=function(){this.captionPackets_.length?(this.captionPackets_.forEach(function(e,t){e.presortIndex=t}),this.captionPackets_.sort(function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts}),this.captionPackets_.forEach(function(e){e.type<2&&this.dispatchCea608Packet(e)},this),this.captionPackets_.length=0,this.ccStreams_.forEach(function(e){e.flush()},this)):this.ccStreams_.forEach(function(e){e.flush()},this)},Hu.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(e){e.reset()})},Hu.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},Hu.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Hu.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Hu.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var zu={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},qu=function(e){return null===e?"":(e=zu[e]||e,String.fromCharCode(e))},Wu=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ku=function(){for(var e=[],t=15;t--;)e.push("");return e},$u=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Ku();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ku();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Ku()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))a=qu((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=qu((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=Wu.indexOf(7968&t);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(e.pts,s)),s!==this.row_&&(this.clearFormatting(e.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),a=qu(n),a+=qu(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};$u.prototype=new vu,$u.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e){try{return e.trim()}catch(e){return console.error("Skipping malformed caption."),""}}).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},$u.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ku(),this.nonDisplayed_=Ku(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},$u.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},$u.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},$u.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},$u.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},$u.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},$u.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},$u.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},$u.prototype.isNormalChar=function(e){return e>=32&&e<=127},$u.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Ku(),this.displayed_=Ku()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},$u.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce(function(e,t){return e+"<"+t+">"},"");this[this.mode_](e,i)},$u.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(e,t){return e+"</"+t+">"},"");this.formatting_=[],this[this.mode_](e,t)}},$u.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},$u.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},$u.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},$u.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var Xu={CaptionStream:Hu,Cea608Stream:$u},Yu={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ju=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},Qu=function e(t){var i,n;e.prototype.init.call(this),this.type_=t,this.push=function(e){e.type===this.type_&&(void 0===n&&(n=e.dts),e.dts=Ju(e.dts,n),e.pts=Ju(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.discontinuity=function(){n=void 0,i=void 0}};Qu.prototype=new vu;var Zu,el=Qu,tl=Ju,il=function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r},nl=function(e,t,i){return decodeURIComponent(il(e,t,i))},rl=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},al={TXXX:function(e){var t;if(3===e.data[0]){for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=nl(e.data,1,t),e.value=nl(e.data,t+1,e.data.length).replace(/\0*$/,"");break}e.data=e.value}},WXXX:function(e){var t;if(3===e.data[0])for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=nl(e.data,1,t),e.url=nl(e.data,t+1,e.data.length);break}},PRIV:function(e){var t,i;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(i=e.data,unescape(il(i,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Zu=function(e){var t,i={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},n=0,r=[],a=0;if(Zu.prototype.init.call(this),this.dispatchType=Yu.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,s,o,u,l;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(a=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))i.debug&&console.log("Skipping unrecognized metadata packet");else if(r.push(e),a+=e.data.byteLength,1===r.length&&(n=rl(e.data.subarray(6,10)),n+=10),!(a<n)){for(t={data:new Uint8Array(n),frames:[],pts:r[0].pts,dts:r[0].dts},l=0;l<n;)t.data.set(r[0].data.subarray(0,n-l),l),l+=r[0].data.byteLength,a-=r[0].data.byteLength,r.shift();s=10,64&t.data[5]&&(s+=4,s+=rl(t.data.subarray(10,14)),n-=rl(t.data.subarray(16,20)));do{if((o=rl(t.data.subarray(s+4,s+8)))<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");if((u={id:String.fromCharCode(t.data[s],t.data[s+1],t.data[s+2],t.data[s+3]),data:t.data.subarray(s+10,s+o+10)}).key=u.id,al[u.id]&&(al[u.id](u),"com.apple.streaming.transportStreamTimestamp"===u.owner)){var c=u.data,d=(1&c[3])<<30|c[4]<<22|c[5]<<14|c[6]<<6|c[7]>>>2;d*=4,d+=3&c[7],u.timeStamp=d,void 0===t.pts&&void 0===t.dts&&(t.pts=u.timeStamp,t.dts=u.timeStamp),this.trigger("timestamp",u)}t.frames.push(u),s+=10,s+=o}while(s<n);this.trigger("data",t)}}}).prototype=new vu;var sl,ol,ul,ll=Zu,cl=el;(sl=function(){var e=new Uint8Array(188),t=0;sl.prototype.init.call(this),this.push=function(i){var n,r=0,a=188;for(t?((n=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),n.set(i,t),t=0):n=i;a<n.byteLength;)71!==n[r]||71!==n[a]?(r++,a++):(this.trigger("data",n.subarray(r,a)),r+=188,a+=188);r<n.byteLength&&(e.set(n.subarray(r),0),t=n.byteLength-r)},this.flush=function(){188===t&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")}}).prototype=new vu,(ol=function(){var e,t,i,n;ol.prototype.init.call(this),n=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,n){var r=0;n.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===n.type?t(e.subarray(r),n):i(e.subarray(r),n)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],n.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=n.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var a=e[r],s=(31&e[r+1])<<8|e[r+2];a===Yu.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=s:a===Yu.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=s:a===Yu.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][s]=a),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=n.programMapTable}},this.push=function(t){var i={},n=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Yu.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Yu.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new vu,ol.STREAM_TYPES={h264:27,adts:15},(ul=function(){var e=this,t={data:[],size:0},i={data:[],size:0},n={data:[],size:0},r=function(t,i,n){var r,a,s=new Uint8Array(t.size),o={type:i},u=0,l=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,u=0;u<t.data.length;u++)a=t.data[u],s.set(a.data,l),l+=a.data.byteLength;var c,d,h;c=s,(d=o).packetLength=6+(c[4]<<8|c[5]),d.dataAlignmentIndicator=0!=(4&c[6]),192&(h=c[7])&&(d.pts=(14&c[9])<<27|(255&c[10])<<20|(254&c[11])<<12|(255&c[12])<<5|(254&c[13])>>>3,d.pts*=4,d.pts+=(6&c[13])>>>1,d.dts=d.pts,64&h&&(d.dts=(14&c[14])<<27|(255&c[15])<<20|(254&c[16])<<12|(255&c[17])<<5|(254&c[18])>>>3,d.dts*=4,d.dts+=(6&c[18])>>>1)),d.data=c.subarray(9+c[8]),r="video"===i||o.packetLength<=t.size,(n||r)&&(t.size=0,t.data.length=0),r&&e.trigger("data",o)}};ul.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var e,s;switch(a.streamType){case Yu.H264_STREAM_TYPE:case Yu.H264_STREAM_TYPE:e=t,s="video";break;case Yu.ADTS_STREAM_TYPE:e=i,s="audio";break;case Yu.METADATA_STREAM_TYPE:e=n,s="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&r(e,s,!0),e.data.push(a),e.size+=a.data.byteLength},pmt:function(){var t={type:"metadata",tracks:[]},i=a.programMapTable;null!==i.video&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+i.video,codec:"avc",type:"video"}),null!==i.audio&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+i.audio,codec:"adts",type:"audio"}),e.trigger("data",t)}})[a.type]()},this.flush=function(){r(t,"video"),r(i,"audio"),r(n,"timed-metadata"),this.trigger("done")}}).prototype=new vu;var dl={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:sl,TransportParseStream:ol,ElementaryStream:ul,TimestampRolloverStream:cl,CaptionStream:Xu.CaptionStream,Cea608Stream:Xu.Cea608Stream,MetadataStream:ll};for(var hl in Yu)Yu.hasOwnProperty(hl)&&(dl[hl]=Yu[hl]);var fl,pl=dl,ml=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(fl=function(){var e;fl.prototype.init.call(this),this.push=function(t){var i,n,r,a,s,o,u=0,l=0;if("audio"===t.type)for(e?(a=e,(e=new Uint8Array(a.byteLength+t.data.byteLength)).set(a),e.set(t.data,a.byteLength)):e=t.data;u+5<e.length;)if(255===e[u]&&240==(246&e[u+1])){if(n=2*(1&~e[u+1]),i=(3&e[u+3])<<11|e[u+4]<<3|(224&e[u+5])>>5,o=9e4*(s=1024*(1+(3&e[u+6])))/ml[(60&e[u+2])>>>2],r=u+i,e.byteLength<r)return;if(this.trigger("data",{pts:t.pts+l*o,dts:t.dts+l*o,sampleCount:s,audioobjecttype:1+(e[u+2]>>>6&3),channelcount:(1&e[u+2])<<2|(192&e[u+3])>>>6,samplerate:ml[(60&e[u+2])>>>2],samplingfrequencyindex:(60&e[u+2])>>>2,samplesize:16,data:e.subarray(u+7+n,r)}),e.byteLength===r)return void(e=void 0);l++,e=e.subarray(r)}else u++},this.flush=function(){this.trigger("done")}}).prototype=new vu;var gl,vl,yl,_l=fl,bl=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),i=new DataView(a.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),a=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<<r|this.readBits(r):a},this.skipLeadingZeros=function(){var e;for(e=0;e<n;++e)if(0!=(i&2147483648>>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(vl=function(){var e,t,i=0;vl.prototype.init.call(this),this.push=function(n){var r;for(t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;i<t.byteLength-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<t.byteLength;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<t.length);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")}}).prototype=new vu,yl={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(gl=function(){var e,t,i,n,r,a,s,o=new vl;gl.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",function(s){var o={trackId:t,pts:i,dts:n,data:s};switch(31&s[0]){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)}),o.on("done",function(){e.trigger("done")}),this.flush=function(){o.flush()},s=function(e,t){var i,n=8,r=8;for(i=0;i<e;i++)0!==r&&(r=(n+t.readExpGolomb()+256)%256),n=0===r?n:r},r=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=e[s];return i},a=function(e){var t,i,n,r,a,o,u,l,c,d,h,f,p,m=0,g=0,v=0,y=0,_=1;if(i=(t=new bl(e)).readUnsignedByte(),r=t.readUnsignedByte(),n=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),yl[i]&&(3===(a=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(h=3!==a?8:12,p=0;p<h;p++)t.readBoolean()&&s(p<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),u=t.readUnsignedExpGolomb(),p=0;p<u;p++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),l=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),0===(d=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb(),y=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:f=[1,1];break;case 2:f=[12,11];break;case 3:f=[10,11];break;case 4:f=[16,11];break;case 5:f=[40,33];break;case 6:f=[24,11];break;case 7:f=[20,11];break;case 8:f=[32,11];break;case 9:f=[80,33];break;case 10:f=[18,11];break;case 11:f=[15,11];break;case 12:f=[64,33];break;case 13:f=[160,99];break;case 14:f=[4,3];break;case 15:f=[3,2];break;case 16:f=[2,1];break;case 255:f=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}f&&(_=f[0]/f[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:r,width:Math.ceil((16*(l+1)-2*m-2*g)*_),height:(2-d)*(c+1)*16-2*v-2*y}}}).prototype=new vu;var Tl,Sl={H264Stream:gl,NalByteStream:vl},kl=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],El=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},wl={isLikelyAacData:function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},parseId3TagSize:function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?i+20:i+10},parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return kl[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=El(e.subarray(10,14)));do{if((i=El(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r<n.byteLength;r++)if(0===n[r]){if("com.apple.streaming.transportStreamTimestamp"===unescape(function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r}(n,0,r))){var a=n.subarray(r+1),s=(1&a[3])<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2;return s*=4,s+=3&a[7]}break}}t+=10,t+=i}while(t<e.byteLength);return null}};(Tl=function(){var e=new Uint8Array,t=0;Tl.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var n,r,a,s,o=0,u=0;for(e.length?(s=e.length,(e=new Uint8Array(i.byteLength+s)).set(e.subarray(0,s)),e.set(i,s)):e=i;e.length-u>=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255!=(255&e[u])||240!=(240&e[u+1]))u++;else{if(e.length-u<7)break;if(u+(o=wl.parseAdtsSize(e,u))>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else{if(e.length-u<10)break;if(u+(o=wl.parseId3TagSize(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}n=e.length-u,e=n>0?e.subarray(u):new Uint8Array}}).prototype=new vu;var Cl,Pl,Al,Rl,Ll=Tl,Ol=Sl.H264Stream,Il=wl.isLikelyAacData,xl=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Dl=["width","height","profileIdc","levelIdc","profileCompatibility"],Ml=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},Ul=function(e,t,i,n,r,a){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(n-t),pts:e+(r-i)},prependedContentDuration:a,baseMediaDecodeTime:e}};(Pl=function(e,t){var i=[],n=0,r=0,a=0,s=1/0;t=t||{},Pl.prototype.init.call(this),this.push=function(t){ju(e,t),e&&xl.forEach(function(i){e[i]=t[i]}),i.push(t)},this.setEarliestDts=function(t){r=t-e.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){a=e},this.flush=function(){var o,u,l,c;0!==i.length?(o=Iu(i,e,r),e.baseMediaDecodeTime=Uu(e,t.keepOriginalTimestamps),Ou(e,o,a,s),e.samples=xu(o),l=cu.mdat(Du(o)),i=[],u=cu.moof(n,[e]),c=new Uint8Array(u.byteLength+l.byteLength),n++,c.set(u),c.set(l,u.byteLength),Mu(e),this.trigger("data",{track:e,boxes:c}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")}}).prototype=new vu,(Cl=function(e,t){var i,n,r=0,a=[],s=[];t=t||{},Cl.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){ju(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],Dl.forEach(function(t){e[t]=i[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.data,e.pps=[t.data]),a.push(t)},this.flush=function(){for(var i,n,o,u,l,c,d,h,f=0;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0===a.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(i=_u(a),(o=bu(i))[0][0].keyFrame||((n=this.getGopForFusion_(a[0],e))?(f=n.duration,o.unshift(n),o.byteLength+=n.byteLength,o.nalCount+=n.nalCount,o.pts=n.pts,o.dts=n.dts,o.duration+=n.duration):o=Tu(o)),s.length){var p;if(!(p=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");Mu(e),o=p}ju(e,o),e.samples=Su(o),l=cu.mdat(ku(o)),e.baseMediaDecodeTime=Uu(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}})),d=o[0],h=o[o.length-1],this.trigger("segmentTimingInfo",Ul(e.baseMediaDecodeTime,d.dts,d.pts,h.dts+h.duration,h.pts+h.duration,f)),this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),u=cu.moof(r,[e]),c=new Uint8Array(u.byteLength+l.byteLength),r++,c.set(u),c.set(l,u.byteLength),this.trigger("data",{track:e,boxes:c}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){Mu(e),i=void 0,n=void 0},this.getGopForFusion_=function(t){var i,n,r,a,s,o=1/0;for(s=0;s<this.gopCache_.length;s++)r=(a=this.gopCache_[s]).gop,e.pps&&Ml(e.pps[0],a.pps[0])&&e.sps&&Ml(e.sps[0],a.sps[0])&&(r.dts<e.timelineStartInfo.dts||(i=t.dts-r.dts-r.duration)>=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=i=0;t<s.length&&i<e.length&&(n=s[t],r=e[i],n.pts!==r.pts);)r.pts>n.pts?t++:(i++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===i?e:i===e.length?null:((l=e.slice(i)).byteLength=a,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,i,n,r,a,o,u;for(t=s.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(n=s[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(u=o?i:a))return e;var l=e.slice(u),c=l.reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0});return l.byteLength=c.byteLength,l.duration=c.duration,l.nalCount=c.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){s=e}}).prototype=new vu,(Rl=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps&&(this.keepOriginalTimestamps=e.keepOriginalTimestamps),this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Rl.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBoxes.push(e.boxes),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track),void("audio"===e.track.type&&(this.audioTrack=e.track)))}}).prototype=new vu,Rl.prototype.flush=function(e){var t,i,n,r,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,Dl.forEach(function(e){s.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,xl.forEach(function(e){s.info[e]=this.audioTrack[e]},this)),1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=cu.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)s.data.set(this.pendingBoxes[r],a),a+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=t.startPts,this.keepOriginalTimestamps||(t.startTime-=o),t.startTime/=9e4,t.endTime=t.endPts,this.keepOriginalTimestamps||(t.endTime-=o),t.endTime/=9e4,s.captionStreams[t.stream]=!0,s.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=i.pts,this.keepOriginalTimestamps||(i.cueTime-=o),i.cueTime/=9e4,s.metadata.push(i);s.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",s),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},(Al=function(e){var t,i,n=this,r=!0;Al.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={};this.transmuxPipeline_=t,t.type="aac",t.metadataStream=new pl.MetadataStream,t.aacStream=new Ll,t.audioTimestampRolloverStream=new pl.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new pl.TimestampRolloverStream("timed-metadata"),t.adtsStream=new _l,t.coalesceStream=new Rl(e,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(r){"timed-metadata"!==r.type||t.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new Pl(i,e),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new pl.MetadataStream,r.packetStream=new pl.TransportPacketStream,r.parseStream=new pl.TransportParseStream,r.elementaryStream=new pl.ElementaryStream,r.videoTimestampRolloverStream=new pl.TimestampRolloverStream("video"),r.audioTimestampRolloverStream=new pl.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new pl.TimestampRolloverStream("timed-metadata"),r.adtsStream=new _l,r.h264Stream=new Ol,r.captionStream=new pl.CaptionStream,r.coalesceStream=new Rl(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream),r.elementaryStream.pipe(r.videoTimestampRolloverStream).pipe(r.h264Stream),r.elementaryStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.elementaryStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new Cl(t,e),r.videoSegmentStream.on("timelineStartInfo",function(e){i&&(i.timelineStartInfo=e,r.audioSegmentStream.setEarliestDts(e.dts))}),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new Pl(i,e),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream))}}),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,Mu(i),e.keepOriginalTimestamps||(i.timelineStartInfo.baseMediaDecodeTime=n),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[],r.videoTimestampRolloverStream.discontinuity()),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,Mu(t),r.captionStream.reset(),e.keepOriginalTimestamps||(t.timelineStartInfo.baseMediaDecodeTime=n)),r.timedMetadataTimestampRolloverStream&&r.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.push=function(e){if(r){var t=Il(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new vu;var jl={Transmuxer:Al,VideoSegmentStream:Cl,AudioSegmentStream:Pl,AUDIO_PROPERTIES:xl,VIDEO_PROPERTIES:Dl,generateVideoSegmentTimingInfo:Ul},Bl=Vu,Nl=Xu.CaptionStream,Fl=function(e,t){for(var i=e,n=0;n<t.length;n++){var r=t[n];if(i<r.size)return r;i-=r.size}return null},Vl=function(e,t){var i=nu.findBox(e,["moof","traf"]),n={},r=[];return nu.findBox(e,["mdat"]).forEach(function(e,t){var n=i[t];r.push({mdat:e,traf:n})}),r.forEach(function(e){var i,r=e.mdat,a=e.traf,s=nu.findBox(a,["tfhd"]),o=uu.parseTfhd(s[0]),u=o.trackId,l=nu.findBox(a,["tfdt"]),c=l.length>0?uu.parseTfdt(l[0]).baseMediaDecodeTime:0,d=nu.findBox(a,["trun"]);t===u&&d.length>0&&(i=function(e,t,i){var n,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u=[];for(r=0;r+4<e.length;r+=a)if(a=o.getUint32(r),r+=4,!(a<=0))switch(31&e[r]){case 6:var l=e.subarray(r+1,r+1+a),c=Fl(r,t);n={nalUnitType:"sei_rbsp",size:a,data:l,escapedRBSP:Bl(l),trackId:i},c?(n.pts=c.pts,n.dts=c.dts,s=c):(n.pts=s.pts,n.dts=s.dts),u.push(n)}return u}(r,function(e,t,i){var n=t,r=i.defaultSampleDuration||0,a=i.defaultSampleSize||0,s=i.trackId,o=[];return e.forEach(function(e){var t=uu.parseTrun(e).samples;t.forEach(function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),e.pts=n+e.compositionTimeOffset,n+=e.duration}),o=o.concat(t)}),o}(d,c,o),u),n[u]||(n[u]=[]),n[u]=n[u].concat(i))}),n},Gl={generator:cu,probe:nu,Transmuxer:jl.Transmuxer,AudioSegmentStream:jl.AudioSegmentStream,VideoSegmentStream:jl.VideoSegmentStream,CaptionParser:function(){var e,t,i,n,r,a=!1;this.isInitialized=function(){return a},this.init=function(){e=new Nl,a=!0,e.on("data",function(e){e.startTime=e.startPts/n,e.endTime=e.endPts/n,r.captions.push(e),r.captionStreams[e.stream]=!0})},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length||i===e[0]&&n===t[i])},this.parse=function(e,a,s){var o;if(!this.isInitialized())return null;if(!a||!s)return null;if(this.isNewInit(a,s))i=a[0],n=s[i];else if(!i||!n)return t.push(e),null;for(;t.length>0;){var u=t.shift();this.parse(u,a,s)}return null!==(o=function(e,t,i){return t?{seiNals:Vl(e,t)[t],timescale:i}:null}(e,i,n))&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach(function(t){e.push(t)})},this.flushStream=function(){if(!this.isInitialized())return null;e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()}}.CaptionParser,Hl=function(e){var t=31&e[1];return t<<=8,t|=e[2]},zl=function(e){return!!(64&e[1])},ql=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},Wl=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}},Kl={parseType:function(e,t){var i=Hl(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=zl(e),i=4+ql(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=zl(e),n=4+ql(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var a=12+((15&e[n+10])<<8|e[n+11]);a<r;){var s=n+a;t[(31&e[s+1])<<8|e[s+2]]=e[s],a+=5+((15&e[s+3])<<8|e[s+4])}return t}},parsePayloadUnitStartIndicator:zl,parsePesType:function(e,t){switch(t[Hl(e)]){case Yu.H264_STREAM_TYPE:return"video";case Yu.ADTS_STREAM_TYPE:return"audio";case Yu.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!zl(e))return null;var t=4+ql(e);if(t>=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+ql(e),i=e.subarray(t),n=0,r=0,a=!1;r<i.byteLength-3;r++)if(1===i[r+2]){n=r+5;break}for(;n<i.byteLength;)switch(i[n]){case 0:if(0!==i[n-1]){n+=2;break}if(0!==i[n-2]){n++;break}r+3!==n-2&&"slice_layer_without_partitioning_rbsp_idr"===Wl(31&i[r+3])&&(a=!0);do{n++}while(1!==i[n]&&n<i.length);r=n-2,n+=3;break;case 1:if(0!==i[n-1]||0!==i[n-2]){n+=3;break}"slice_layer_without_partitioning_rbsp_idr"===Wl(31&i[r+3])&&(a=!0),r=n-2,n+=3;break;default:n+=3}return i=i.subarray(r),n-=r,r=0,i&&i.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===Wl(31&i[r+3])&&(a=!0),a}},$l=tl,Xl={};Xl.ts=Kl,Xl.aac=wl;var Yl=function(e,t,i){for(var n,r,a,s,o=0,u=188,l=!1;u<=e.byteLength;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o++,u++;else{switch(n=e.subarray(o,u),Xl.ts.parseType(n,t.pid)){case"pes":r=Xl.ts.parsePesType(n,t.table),a=Xl.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=Xl.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)}if(l)break;o+=188,u+=188}for(o=(u=e.byteLength)-188,l=!1;o>=0;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o--,u--;else{switch(n=e.subarray(o,u),Xl.ts.parseType(n,t.pid)){case"pes":r=Xl.ts.parsePesType(n,t.table),a=Xl.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=Xl.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)}if(l)break;o-=188,u-=188}},Jl=function(e,t,i){for(var n,r,a,s,o,u,l,c=0,d=188,h=!1,f={data:[],size:0};d<e.byteLength;)if(71!==e[c]||71!==e[d])c++,d++;else{switch(n=e.subarray(c,d),Xl.ts.parseType(n,t.pid)){case"pes":if(r=Xl.ts.parsePesType(n,t.table),a=Xl.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(a&&!h&&(s=Xl.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),h=!0),!i.firstKeyFrame)){if(a&&0!==f.size){for(o=new Uint8Array(f.size),u=0;f.data.length;)l=f.data.shift(),o.set(l,u),u+=l.byteLength;if(Xl.ts.videoPacketContainsKeyFrame(o)){var p=Xl.ts.parsePesTime(o);p?(i.firstKeyFrame=p,i.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}f.size=0}f.data.push(n),f.size+=n.byteLength}}if(h&&i.firstKeyFrame)break;c+=188,d+=188}for(c=(d=e.byteLength)-188,h=!1;c>=0;)if(71!==e[c]||71!==e[d])c--,d--;else{switch(n=e.subarray(c,d),Xl.ts.parseType(n,t.pid)){case"pes":r=Xl.ts.parsePesType(n,t.table),a=Xl.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=Xl.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),h=!0)}if(h)break;c-=188,d-=188}},Ql=function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=188;r<e.byteLength;)if(71!==e[n]||71!==e[r])n++,r++;else{switch(i=e.subarray(n,r),Xl.ts.parseType(i,t.pid)){case"pat":t.pid||(t.pid=Xl.ts.parsePat(i));break;case"pmt":t.table||(t.table=Xl.ts.parsePmt(i))}if(t.pid&&t.table)return;n+=188,r+=188}}(e,t),t.table){if(t.table.hasOwnProperty(n))switch(t.table[n]){case Yu.H264_STREAM_TYPE:i.video=[],Jl(e,t,i),0===i.video.length&&delete i.video;break;case Yu.ADTS_STREAM_TYPE:i.audio=[],Yl(e,t,i),0===i.audio.length&&delete i.audio}}return i},Zl=function(e,t){var i;return(i=Xl.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,a=null,s=0,o=0;e.length-o>=3;){switch(Xl.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=Xl.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=Xl.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=Xl.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+s),r=Xl.aac.parseSampleRate(t)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var u=9e4/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*u,pts:a+1024*n*u}]}}(e):Ql(e))&&(i.audio||i.video)?(function(e,t){if(e.audio&&e.audio.length){var i=t;void 0===i&&(i=e.audio[0].dts),e.audio.forEach(function(e){e.dts=$l(e.dts,i),e.pts=$l(e.pts,i),e.dtsTime=e.dts/9e4,e.ptsTime=e.pts/9e4})}if(e.video&&e.video.length){var n=t;if(void 0===n&&(n=e.video[0].dts),e.video.forEach(function(e){e.dts=$l(e.dts,n),e.pts=$l(e.pts,n),e.dtsTime=e.dts/9e4,e.ptsTime=e.pts/9e4}),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=$l(r.dts,n),r.pts=$l(r.pts,n),r.dtsTime=r.dts/9e4,r.ptsTime=r.dts/9e4}}}(i,t),i):null};var ec=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},tc=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),ic=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},nc=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],n=t[4],r=i[4],a=void 0,s=void 0,o=void 0,u=[],l=[],c=void 0,d=void 0,h=void 0,f=void 0,p=void 0;for(a=0;a<256;a++)l[(u[a]=a<<1^283*(a>>7))^a]=a;for(s=o=0;!n[s];s^=c||1,o=l[o]||1)for(h=(h=o^o<<1^o<<2^o<<3^o<<4)>>8^255&h^99,n[s]=h,r[h]=s,p=16843009*u[d=u[c=u[s]]]^65537*d^257*c^16843008*s,f=257*u[h]^16843008*h,a=0;a<4;a++)t[a][s]=f=f<<24^f>>>8,i[a][h]=p=p<<24^p>>>8;for(a=0;a<5;a++)t[a]=t[a].slice(0),i[a]=i[a].slice(0);return e},rc=null,ac=function(){function e(t){ec(this,e),rc||(rc=nc()),this._tables=[[rc[0][0].slice(),rc[0][1].slice(),rc[0][2].slice(),rc[0][3].slice(),rc[0][4].slice()],[rc[1][0].slice(),rc[1][1].slice(),rc[1][2].slice(),rc[1][3].slice(),rc[1][4].slice()]];var i=void 0,n=void 0,r=void 0,a=void 0,s=void 0,o=this._tables[0][4],u=this._tables[1],l=t.length,c=1;if(4!==l&&6!==l&&8!==l)throw new Error("Invalid aes key size");for(a=t.slice(0),s=[],this._key=[a,s],i=l;i<4*l+28;i++)r=a[i-1],(i%l==0||8===l&&i%l==4)&&(r=o[r>>>24]<<24^o[r>>16&255]<<16^o[r>>8&255]<<8^o[255&r],i%l==0&&(r=r<<8^r>>>24^c<<24,c=c<<1^283*(c>>7))),a[i]=a[i-l]^r;for(n=0;i;n++,i--)r=a[3&n?i:i-4],s[n]=i<=4||n<4?r:u[0][o[r>>>24]]^u[1][o[r>>16&255]]^u[2][o[r>>8&255]]^u[3][o[255&r]]}return e.prototype.decrypt=function(e,t,i,n,r,a){var s=this._key[1],o=e^s[0],u=n^s[1],l=i^s[2],c=t^s[3],d=void 0,h=void 0,f=void 0,p=s.length/4-2,m=void 0,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],S=v[4];for(m=0;m<p;m++)d=y[o>>>24]^_[u>>16&255]^b[l>>8&255]^T[255&c]^s[g],h=y[u>>>24]^_[l>>16&255]^b[c>>8&255]^T[255&o]^s[g+1],f=y[l>>>24]^_[c>>16&255]^b[o>>8&255]^T[255&u]^s[g+2],c=y[c>>>24]^_[o>>16&255]^b[u>>8&255]^T[255&l]^s[g+3],g+=4,o=d,u=h,l=f;for(m=0;m<4;m++)r[(3&-m)+a]=S[o>>>24]<<24^S[u>>16&255]<<16^S[l>>8&255]<<8^S[255&c]^s[g++],d=o,o=u,u=l,l=c,c=d},e}(),sc=function(){function e(){ec(this,e),this.listeners={}}return e.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},e.prototype.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},e.prototype.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},e.prototype.dispose=function(){this.listeners={}},e.prototype.pipe=function(e){this.on("data",function(t){e.push(t)})},e}(),oc=function(e){function t(){ec(this,t);var i=ic(this,e.call(this,sc));return i.jobs=[],i.delay=1,i.timeout_=null,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},t.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(sc),uc=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},lc=function(e,t,i){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),r=new ac(Array.prototype.slice.call(t)),a=new Uint8Array(e.byteLength),s=new Int32Array(a.buffer),o=void 0,u=void 0,l=void 0,c=void 0,d=void 0,h=void 0,f=void 0,p=void 0,m=void 0;for(o=i[0],u=i[1],l=i[2],c=i[3],m=0;m<n.length;m+=4)d=uc(n[m]),h=uc(n[m+1]),f=uc(n[m+2]),p=uc(n[m+3]),r.decrypt(d,h,f,p,s,m),s[m]=uc(s[m]^o),s[m+1]=uc(s[m+1]^u),s[m+2]=uc(s[m+2]^l),s[m+3]=uc(s[m+3]^c),o=d,u=h,l=f,c=p;return a},cc=function(){function e(t,i,n,r){ec(this,e);var a=e.STEP,s=new Int32Array(t.buffer),o=new Uint8Array(t.byteLength),u=0;for(this.asyncStream_=new oc,this.asyncStream_.push(this.decryptChunk_(s.subarray(u,u+a),i,n,o)),u=a;u<s.length;u+=a)n=new Uint32Array([uc(s[u-4]),uc(s[u-3]),uc(s[u-2]),uc(s[u-1])]),this.asyncStream_.push(this.decryptChunk_(s.subarray(u,u+a),i,n,o));this.asyncStream_.push(function(){var e;r(null,(e=o).subarray(0,e.byteLength-e[e.byteLength-1]))})}return e.prototype.decryptChunk_=function(e,t,i,n){return function(){var r=lc(e,t,i);n.set(r,e.byteOffset)}},tc(e,null,[{key:"STEP",get:function(){return 32e3}}]),e}(),dc=function(t,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(t)||(t=fs.buildAbsoluteURL(e.location.href,t)),fs.buildAbsoluteURL(t,i))},hc=function(e,t,i){return e&&i.responseURL&&t!==i.responseURL?i.responseURL:t},fc=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},pc=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),mc=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},gc=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},vc=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var i=[],n=!0,r=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(i.push(s.value),!t||i.length!==t);n=!0);}catch(e){r=!0,a=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw a}}return i}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),yc=cs.mergeOptions,_c=cs.EventTarget,bc=cs.log,Tc=function(e,t){["AUDIO","SUBTITLES"].forEach(function(i){for(var n in e.mediaGroups[i])for(var r in e.mediaGroups[i][n]){var a=e.mediaGroups[i][n][r];t(a,i,n,r)}})},Sc=function(e,t){var i=yc(e,{}),n=i.playlists[t.uri];if(!n)return null;if(n.segments&&t.segments&&n.segments.length===t.segments.length&&n.endList===t.endList&&n.mediaSequence===t.mediaSequence)return null;var r=yc(n,t);n.segments&&(r.segments=function(e,t,i){var n=t.slice();i=i||0;for(var r=Math.min(e.length,t.length+i),a=i;a<r;a++)n[a-i]=yc(e[a],n[a-i]);return n}(n.segments,t.segments,t.mediaSequence-n.mediaSequence)),r.segments.forEach(function(e){!function(e,t){e.resolvedUri||(e.resolvedUri=dc(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=dc(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=dc(t,e.map.uri))}(e,r.resolvedUri)});for(var a=0;a<i.playlists.length;a++)i.playlists[a].uri===t.uri&&(i.playlists[a]=r);return i.playlists[t.uri]=r,i},kc=function(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];e.playlists[i.uri]=i,i.resolvedUri=dc(e.uri,i.uri),i.id=t,i.attributes||(i.attributes={},bc.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))}},Ec=function(e){Tc(e,function(t){t.uri&&(t.resolvedUri=dc(e.uri,t.uri))})},wc=function(e,t){var i=e.segments[e.segments.length-1];return t&&i&&i.duration?1e3*i.duration:500*(e.targetDuration||10)},Cc=function(t){function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fc(this,i);var r=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),a=n.withCredentials,s=void 0!==a&&a,o=n.handleManifestRedirects,u=void 0!==o&&o;r.srcUrl=e,r.hls_=t,r.withCredentials=s,r.handleManifestRedirects=u;var l=t.options_;if(r.customTagParsers=l&&l.customTagParsers||[],r.customTagMappers=l&&l.customTagMappers||[],!r.srcUrl)throw new Error("A non-empty playlist URL is required");return r.state="HAVE_NOTHING",r.on("mediaupdatetimeout",function(){"HAVE_METADATA"===r.state&&(r.state="HAVE_CURRENT_METADATA",r.request=r.hls_.xhr({uri:dc(r.master.uri,r.media().uri),withCredentials:r.withCredentials},function(e,t){if(r.request)return e?r.playlistRequestError(r.request,r.media().uri,"HAVE_METADATA"):void r.haveMetadata(r.request,r.media().uri)}))}),r}return mc(i,_c),pc(i,[{key:"playlistRequestError",value:function(e,t,i){this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[t],status:e.status,message:"HLS playlist request error at URL: "+t+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")}},{key:"haveMetadata",value:function(t,i){var n=this;this.request=null,this.state="HAVE_METADATA";var r=new Ts;this.customTagParsers.forEach(function(e){return r.addParser(e)}),this.customTagMappers.forEach(function(e){return r.addTagMapper(e)}),r.push(t.responseText),r.end(),r.manifest.uri=i,r.manifest.attributes=r.manifest.attributes||{};var a=Sc(this.master,r.manifest);this.targetDuration=r.manifest.targetDuration,a?(this.master=a,this.media_=this.master.playlists[r.manifest.uri]):this.trigger("playlistunchanged"),this.media().endList||(e.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=e.setTimeout(function(){n.trigger("mediaupdatetimeout")},wc(this.media(),!!a))),this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.finalRenditionTimeout)}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"media",value:function(t,i){var n=this;if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof t){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}if(e.clearTimeout(this.finalRenditionTimeout),i){var r=t.targetDuration/2*1e3||5e3;this.finalRenditionTimeout=e.setTimeout(this.media.bind(this,t,!1),r)}else{var a=this.state,s=!this.media_||t.uri!==this.media_.uri;if(this.master.playlists[t.uri].endList)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=t,void(s&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(s){if(this.state="SWITCHING_MEDIA",this.request){if(t.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.request=this.hls_.xhr({uri:t.resolvedUri,withCredentials:this.withCredentials},function(e,i){if(n.request){if(t.resolvedUri=hc(n.handleManifestRedirects,t.resolvedUri,i),e)return n.playlistRequestError(n.request,t.uri,a);n.haveMetadata(i,t.uri),"HAVE_MASTER"===a?n.trigger("loadedmetadata"):n.trigger("mediachange")}})}}}},{key:"pause",value:function(){this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}},{key:"load",value:function(t){var i=this;e.clearTimeout(this.mediaUpdateTimeout);var n=this.media();if(t){var r=n?n.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=e.setTimeout(function(){return i.load()},r)}else this.started?n&&!n.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}},{key:"start",value:function(){var t=this;this.started=!0,this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(i,n){if(t.request){if(t.request=null,i)return t.error={status:n.status,message:"HLS playlist request error at URL: "+t.srcUrl+".",responseText:n.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");var r=new Ts;return t.customTagParsers.forEach(function(e){return r.addParser(e)}),t.customTagMappers.forEach(function(e){return r.addTagMapper(e)}),r.push(n.responseText),r.end(),t.state="HAVE_MASTER",t.srcUrl=hc(t.handleManifestRedirects,t.srcUrl,n),r.manifest.uri=t.srcUrl,r.manifest.playlists?(t.master=r.manifest,kc(t.master),Ec(t.master),t.trigger("loadedplaylist"),void(t.request||t.media(r.manifest.playlists[0]))):(t.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:e.location.href,playlists:[{uri:t.srcUrl,id:0,resolvedUri:t.srcUrl,attributes:{}}]},t.master.playlists[t.srcUrl]=t.master.playlists[0],t.haveMetadata(n,t.srcUrl),t.trigger("loadedmetadata"))}})}}]),i}(),Pc=cs.createTimeRange,Ac=function(e,t,i){var n,r;return void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence?0:(n=function(e,t){var i=0,n=t-e.mediaSequence,r=e.segments[n];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if(void 0!==(r=e.segments[n]).end)return{result:i+r.end,precise:!0};if(i+=r.duration,void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(e,t)).precise?n.result:(r=function(e,t){for(var i=0,n=void 0,r=t-e.mediaSequence;r<e.segments.length;r++){if(void 0!==(n=e.segments[r]).start)return{result:n.start-i,precise:!0};if(i+=n.duration,void 0!==n.end)return{result:n.end-i,precise:!0}}return{result:-1,precise:!1}}(e,t)).precise?r.result:n.result+i},Rc=function(t,i,n){if(!t)return 0;if("number"!=typeof n&&(n=0),void 0===i){if(t.totalDuration)return t.totalDuration;if(!t.endList)return e.Infinity}return Ac(t,i,n)},Lc=function(e,t,i){var n=0;if(t>i){var r=[i,t];t=r[0],i=r[1]}if(t<0){for(var a=t;a<Math.min(0,i);a++)n+=e.targetDuration;t=0}for(var s=t;s<i;s++)n+=e.segments[s].duration;return n},Oc=function(e){if(!e.segments.length)return 0;for(var t=e.segments.length-1,i=e.segments[t].duration||e.targetDuration,n=i+2*e.targetDuration;t--&&!((i+=e.segments[t].duration)>=n););return Math.max(0,t)},Ic=function(e,t,i){if(!e||!e.segments)return null;if(e.endList)return Rc(e);if(null===t)return null;t=t||0;var n=i?Oc(e):e.segments.length;return Ac(e,e.mediaSequence+n,t)},xc=function(e){return e-Math.floor(e)==0},Dc=function(e,t){if(xc(t))return t+.1*e;for(var i=t.toString().split(".")[1].length,n=1;n<=i;n++){var r=Math.pow(10,n),a=t*r;if(xc(a)||n===i)return(a+e)/r}},Mc=Dc.bind(null,1),Uc=Dc.bind(null,-1),jc=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},Bc=function(e){return e.excludeUntil&&e.excludeUntil===1/0},Nc=function(e){var t=jc(e);return!e.disabled&&!t},Fc=function(e,t){return t.attributes&&t.attributes[e]},Vc=function(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(function(e){return!!Nc(e)&&(e.attributes.BANDWIDTH||0)<i}).length},Gc={duration:Rc,seekable:function(e,t){var i=t||0,n=Ic(e,t,!0);return null===n?Pc():Pc(i,n)},safeLiveIndex:Oc,getMediaInfoForTime:function(e,t,i,n){var r=void 0,a=void 0,s=e.segments.length,o=t-n;if(o<0){if(i>0)for(r=i-1;r>=0;r--)if(a=e.segments[r],(o+=Uc(a.duration))>0)return{mediaIndex:r,startTime:n-Lc(e,i,r)};return{mediaIndex:0,startTime:t}}if(i<0){for(r=i;r<0;r++)if((o-=e.targetDuration)<0)return{mediaIndex:0,startTime:t};i=0}for(r=i;r<s;r++)if(a=e.segments[r],(o-=Mc(a.duration))<0)return{mediaIndex:r,startTime:n+Lc(e,i,r)};return{mediaIndex:s-1,startTime:t}},isEnabled:Nc,isDisabled:function(e){return e.disabled},isBlacklisted:jc,isIncompatible:Bc,playlistEnd:Ic,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},isFmp4:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].map)return!0;return!1},hasAttribute:Fc,estimateSegmentRequestTime:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return Fc("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*n)/t:NaN},isLowestEnabledRendition:Vc},Hc=cs.xhr,zc=cs.mergeOptions,qc=function(){return function e(t,i){t=zc({timeout:45e3},t);var n=e.beforeRequest||cs.Hls.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);r&&(t=r)}var a=Hc(t,function(e,t){var n=a.response;!e&&n&&(a.responseTime=Date.now(),a.roundTripTime=a.responseTime-a.requestTime,a.bytesReceived=n.byteLength||n.length,a.bandwidth||(a.bandwidth=Math.floor(a.bytesReceived/a.roundTripTime*8*1e3))),t.headers&&(a.responseHeaders=t.headers),e&&"ETIMEDOUT"===e.code&&(a.timedout=!0),e||a.aborted||200===t.statusCode||206===t.statusCode||0===t.statusCode||(e=new Error("XHR Failed with a response of: "+(a&&(n||a.responseText)))),i(e,a)}),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=t.uri,a.requestTime=Date.now(),a}},Wc=function(e){var t,i,n={};return e.byterange&&(n.Range=(t=e.byterange,i=t.offset+t.length-1,"bytes="+t.offset+"-"+i)),n},Kc=function(e,t){return e.start(t)+"-"+e.end(t)},$c=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Xc=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Yc=function(e){var t={};return Object.keys(e).forEach(function(i){var n=e[i];ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n}),t},Jc=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Qc=function(e){return e.resolvedUri},Zc=function(e){for(var t=Array.prototype.slice.call(e),i="",n=0;n<t.length/16;n++)i+=t.slice(16*n,16*n+16).map($c).join("")+" "+t.slice(16*n,16*n+16).map(Xc).join("")+"\n";return i},ed=Object.freeze({createTransferableMessage:Yc,initSegmentId:Jc,segmentKeyId:Qc,hexDump:Zc,tagDump:function(e){var t=e.bytes;return Zc(t)},textRanges:function(e){var t="",i=void 0;for(i=0;i<e.length;i++)t+=Kc(e,i)+" ";return t}}),td=function(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===n)return r({message:"getProgramTime: playlist and time must be provided"});var a=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i=0,n=void 0,r=0;r<t.segments.length&&!(e<=(i=(n=t.segments[r]).videoTimingInfo?n.videoTimingInfo.transmuxedPresentationEnd:i+n.duration));r++);var a=t.segments[t.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>i){if(e>i+.25*a.duration)return null;n=a}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:i-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}}(n,t);if(!a)return r({message:"valid programTime was not found"});if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,a.segment);return o&&(s.programDateTime=o.toISOString()),r(null,s)},id=function e(t){var i=t.programTime,n=t.playlist,r=t.retryCount,a=void 0===r?2:r,s=t.seekTo,o=t.pauseAfterSeek,u=void 0===o||o,l=t.tech,c=t.callback;if(!c)throw new Error("seekToProgramTime: callback must be provided");if(void 0===i||!n||!s)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!l.hasStarted_)return c({message:"player must be playing a live stream to start buffering"});if(!function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;t<e.segments.length;t++)if(!e.segments[t].dateTimeObject)return!1;return!0}(n))return c({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri});var d=function(e,t){var i=void 0;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;var n=t.segments[0];if(i<n.dateTimeObject)return null;for(var r=0;r<t.segments.length-1&&(n=t.segments[r],!(i<t.segments[r+1].dateTimeObject));r++);var a,s=t.segments[t.segments.length-1],o=s.dateTimeObject,u=s.videoTimingInfo?(a=s.videoTimingInfo).transmuxedPresentationEnd-a.transmuxedPresentationStart-a.transmuxerPrependedSeconds:s.duration+.25*s.duration;return i>new Date(o.getTime()+1e3*u)?null:(i>o&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Gc.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(i,n);if(!d)return c({message:i+" was not found in the stream"});var h=d.segment,f=function(e,t){var i=void 0,n=void 0;try{i=new Date(e),n=new Date(t)}catch(e){}var r=i.getTime();return(n.getTime()-r)/1e3}(h.dateTimeObject,i);if("estimate"===d.type)return 0===a?c({message:i+" is not buffered yet. Try again"}):(s(d.estimatedStart+f),void l.one("seeked",function(){e({programTime:i,playlist:n,retryCount:a-1,seekTo:s,pauseAfterSeek:u,tech:l,callback:c})}));var p=h.start+f;l.one("seeked",function(){return c(null,l.currentTime())}),u&&l.pause(),s(p)},nd=function(e,t){var i=[],n=void 0;if(e&&e.length)for(n=0;n<e.length;n++)t(e.start(n),e.end(n))&&i.push([e.start(n),e.end(n)]);return cs.createTimeRanges(i)},rd=function(e,t){return nd(e,function(e,i){return e-1/30<=t&&i+1/30>=t})},ad=function(e,t){return nd(e,function(e){return e-1/30>=t})},sd=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},od=function(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t},ud=function(e,t,i){var n=void 0,r=void 0;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime<=t&&r.endTime>=e&&i.removeCue(r)},ld=function(e){return isNaN(e)||Math.abs(e)===1/0?Number.MAX_VALUE:e},cd=function(t,i,n){var r=e.WebKitDataCue||e.VTTCue;if(i&&i.forEach(function(e){var t=e.stream;this.inbandTextTracks_[t].addCue(new r(e.startTime+this.timestampOffset,e.endTime+this.timestampOffset,e.text))},t),n){var a=ld(t.mediaSource_.duration);if(n.forEach(function(t){var i=t.cueTime+this.timestampOffset;!("number"!=typeof i||e.isNaN(i)||i<0)&&i<1/0&&t.frames.forEach(function(e){var t=new r(i,i,e.value||e.url||e.data||"");t.frame=e,t.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return cs.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return cs.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return cs.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(t),this.metadataTrack_.addCue(t)},this)},t),t.metadataTrack_&&t.metadataTrack_.cues&&t.metadataTrack_.cues.length){for(var s=t.metadataTrack_.cues,o=[],u=0;u<s.length;u++)s[u]&&o.push(s[u]);var l=o.reduce(function(e,t){var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),c=Object.keys(l).sort(function(e,t){return Number(e)-Number(t)});c.forEach(function(e,t){var i=l[e],n=Number(c[t+1])||a;i.forEach(function(e){e.endTime=n})})}}},dd="undefined"!=typeof window?window:{},hd="undefined"==typeof Symbol?"__target":Symbol(),fd="application/javascript",pd=dd.BlobBuilder||dd.WebKitBlobBuilder||dd.MozBlobBuilder||dd.MSBlobBuilder,md=dd.URL||dd.webkitURL||md&&md.msURL,gd=dd.Worker;function vd(e,t){return function(i){var n=this;if(!t)return new gd(e);if(gd&&!i){var r=Td(t.toString().replace(/^function.+?{/,"").slice(0,-1));return this[hd]=new gd(r),function(e,t){if(!e||!t)return;var i=e.terminate;e.objURL=t,e.terminate=function(){e.objURL&&md.revokeObjectURL(e.objURL),i.call(e)}}(this[hd],r),this[hd]}var a={postMessage:function(e){n.onmessage&&setTimeout(function(){n.onmessage({data:e,target:a})})}};t.call(a),this.postMessage=function(e){setTimeout(function(){a.onmessage({data:e,target:n})})},this.isThisThread=!0}}if(gd){var yd,_d=Td("self.onmessage = function () {}"),bd=new Uint8Array(1);try{(yd=new gd(_d)).postMessage(bd,[bd.buffer])}catch(e){gd=null}finally{md.revokeObjectURL(_d),yd&&yd.terminate()}}function Td(e){try{return md.createObjectURL(new Blob([e],{type:fd}))}catch(i){var t=new pd;return t.append(e),md.createObjectURL(t.getBlob(type))}}var Sd=new vd("./transmuxer-worker.worker.js",function(e,t){var i=this;!function(){var e,t,n,r,a,s,o,u,l,c,d,h,f,p,m,g,v,y,_,b,T,S,k,E,w,C,P,A,R,L,O,I,x,D,M,U,j,B,N,F,V=Math.pow(2,32)-1;!function(){var e;if(S={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in S)S.hasOwnProperty(e)&&(S[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);k=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),w=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),E=new Uint8Array([0,0,0,1]),C=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),P=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),A={video:C,audio:P},O=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]),I=new Uint8Array([0,0,0,0,0,0,0,0]),x=I,D=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M=I,R=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),e=function(e){var t,i,n=[],r=0;for(t=1;t<arguments.length;t++)n.push(arguments[t]);for(t=n.length;t--;)r+=n[t].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,r=8;t<n.length;t++)i.set(n[t],r),r+=n[t].byteLength;return i},t=function(){return e(S.dinf,e(S.dref,O))},n=function(t){return e(S.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,t.audioobjecttype<<3|t.samplingfrequencyindex>>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},m=function(t){return e(S.hdlr,A[t])},p=function(t){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(i[12]=t.samplerate>>>24&255,i[13]=t.samplerate>>>16&255,i[14]=t.samplerate>>>8&255,i[15]=255&t.samplerate),e(S.mdhd,i)},f=function(t){return e(S.mdia,p(t),m(t.type),s(t))},a=function(t){return e(S.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},s=function(i){return e(S.minf,"video"===i.type?e(S.vmhd,R):e(S.smhd,L),t(),v(i))},o=function(t,i){for(var n=[],r=i.length;r--;)n[r]=_(i[r]);return e.apply(null,[S.moof,a(t)].concat(n))},u=function(t){for(var i=t.length,n=[];i--;)n[i]=d(t[i]);return e.apply(null,[S.moov,c(4294967295)].concat(n).concat(l(t)))},l=function(t){for(var i=t.length,n=[];i--;)n[i]=b(t[i]);return e.apply(null,[S.mvex].concat(n))},c=function(t){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,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 e(S.mvhd,i)},g=function(t){var i,n,r=t.samples||[],a=new Uint8Array(4+r.length);for(n=0;n<r.length;n++)i=r[n].flags,a[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return e(S.sdtp,a)},v=function(t){return e(S.stbl,y(t),e(S.stts,M),e(S.stsc,x),e(S.stsz,D),e(S.stco,I))},y=function(t){return e(S.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===t.type?U(t):j(t))},U=function(t){var i,n=t.sps||[],r=t.pps||[],a=[],s=[];for(i=0;i<n.length;i++)a.push((65280&n[i].byteLength)>>>8),a.push(255&n[i].byteLength),a=a.concat(Array.prototype.slice.call(n[i]));for(i=0;i<r.length;i++)s.push((65280&r[i].byteLength)>>>8),s.push(255&r[i].byteLength),s=s.concat(Array.prototype.slice.call(r[i]));return e(S.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&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.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]),e(S.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([n.length]).concat(a).concat([r.length]).concat(s))),e(S.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},j=function(t){return e(S.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),n(t))},h=function(t){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.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&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return e(S.tkhd,i)},_=function(t){var i,n,r,a,s,o;return i=e(S.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(t.baseMediaDecodeTime/(V+1)),o=Math.floor(t.baseMediaDecodeTime%(V+1)),n=e(S.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),92,"audio"===t.type?(r=T(t,92),e(S.traf,i,n,r)):(a=g(t),r=T(t,a.length+92),e(S.traf,i,n,r,a))},d=function(t){return t.duration=t.duration||4294967295,e(S.trak,h(t),f(t))},b=function(t){var i=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(i[i.length-1]=0),e(S.trex,i)},F=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,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]},N=function(t,i){var n,r,a,s;for(i+=20+16*(r=t.samples||[]).length,n=F(r,i),s=0;s<r.length;s++)a=r[s],n=n.concat([(4278190080&a.duration)>>>24,(16711680&a.duration)>>>16,(65280&a.duration)>>>8,255&a.duration,(4278190080&a.size)>>>24,(16711680&a.size)>>>16,(65280&a.size)>>>8,255&a.size,a.flags.isLeading<<2|a.flags.dependsOn,a.flags.isDependedOn<<6|a.flags.hasRedundancy<<4|a.flags.paddingValue<<1|a.flags.isNonSyncSample,61440&a.flags.degradationPriority,15&a.flags.degradationPriority,(4278190080&a.compositionTimeOffset)>>>24,(16711680&a.compositionTimeOffset)>>>16,(65280&a.compositionTimeOffset)>>>8,255&a.compositionTimeOffset]);return e(S.trun,new Uint8Array(n))},B=function(t,i){var n,r,a,s;for(i+=20+8*(r=t.samples||[]).length,n=F(r,i),s=0;s<r.length;s++)a=r[s],n=n.concat([(4278190080&a.duration)>>>24,(16711680&a.duration)>>>16,(65280&a.duration)>>>8,255&a.duration,(4278190080&a.size)>>>24,(16711680&a.size)>>>16,(65280&a.size)>>>8,255&a.size]);return e(S.trun,new Uint8Array(n))},T=function(e,t){return"audio"===e.type?B(e,t):N(e,t)};var G,H,z={ftyp:r=function(){return e(S.ftyp,k,E,k,w)},mdat:function(t){return e(S.mdat,t)},moof:o,moov:u,initSegment:function(e){var t,i=r(),n=u(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t}},q=function(e){return e>>>0},W={findBox:G=function(e,t){var i,n,r,a,s,o=[];if(!t.length)return null;for(i=0;i<e.byteLength;)n=q(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]),r=H(e.subarray(i+4,i+8)),a=n>1?i+n:e.byteLength,r===t[0]&&(1===t.length?o.push(e.subarray(i+8,a)):(s=G(e.subarray(i+8,a),t.slice(1))).length&&(o=o.concat(s))),i=a;return o},parseType:H=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},timescale:function(e){return G(e,["moov","trak"]).reduce(function(e,t){var i,n,r,a,s;return(i=G(t,["tkhd"])[0])?(n=i[0],a=q(i[r=0===n?12:20]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3]),(s=G(t,["mdia","mdhd"])[0])?(r=0===(n=s[0])?12:20,e[a]=q(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3]),e):null):null},{})},startTime:function(e,t){var i,n,r;return i=G(t,["moof","traf"]),n=[].concat.apply([],i.map(function(t){return G(t,["tfhd"]).map(function(i){var n,r;return n=q(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),r=e[n]||9e4,(G(t,["tfdt"]).map(function(e){var t,i;return t=e[0],i=q(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(i*=Math.pow(2,32),i+=q(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),i})[0]||1/0)/r})})),r=Math.min.apply(null,n),isFinite(r)?r:0},videoTrackIds:function(e){var t=[];return G(e,["moov","trak"]).forEach(function(e){var i=G(e,["mdia","hdlr"]),n=G(e,["tkhd"]);i.forEach(function(e,i){var r,a,s=H(e.subarray(8,12)),o=n[i];"vide"===s&&(a=0===(r=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?r.getUint32(12):r.getUint32(20),t.push(a))})}),t}},K=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(a=[],n=arguments.length,n=1;n<arguments.length;++n)a.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,a)}},this.dispose=function(){e={}}}};K.prototype.pipe=function(e){return this.on("data",function(t){e.push(t)}),this.on("done",function(t){e.flush(t)}),e},K.prototype.push=function(e){this.trigger("data",e)},K.prototype.flush=function(e){this.trigger("done",e)};var $,X,Y,J,Q,Z=K,ee=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},te=function(e){var t,i,n=[],r=[];for(n.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.push(n),r},ie=function(e){var t,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},ne=function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},re=function(e,t){var i,n,r,a,s,o=t||0,u=[];for(i=0;i<e.length;i++)for(a=e[i],n=0;n<a.length;n++)s=a[n],o+=(r=ee(s,o)).size,u.push(r);return u},ae=function(e){var t,i,n,r,a,s,o=0,u=e.byteLength,l=e.nalCount,c=new Uint8Array(u+4*l),d=new DataView(c.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(a=r[i],n=0;n<a.length;n++)s=a[n],d.setUint32(o,s.data.byteLength),o+=4,c.set(s.data,o),o+=s.data.byteLength;return c},se=[33,16,5,32,164,27],oe=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ue=function(e){for(var t=[];e--;)t.push(0);return t},le={96000:[se,[227,64],ue(154),[56]],88200:[se,[231],ue(170),[56]],64000:[se,[248,192],ue(240),[56]],48000:[se,[255,192],ue(268),[55,148,128],ue(54),[112]],44100:[se,[255,192],ue(268),[55,163,128],ue(84),[112]],32000:[se,[255,192],ue(268),[55,234],ue(226),[112]],24000:[se,[255,192],ue(268),[55,255,128],ue(268),[111,112],ue(126),[224]],16000:[se,[255,192],ue(268),[55,255,128],ue(268),[111,255],ue(269),[223,108],ue(195),[1,192]],12000:[oe,ue(268),[3,127,248],ue(268),[6,255,240],ue(268),[13,255,224],ue(268),[27,253,128],ue(259),[56]],11025:[oe,ue(268),[3,127,248],ue(268),[6,255,240],ue(268),[13,255,224],ue(268),[27,255,192],ue(268),[55,175,128],ue(108),[112]],8000:[oe,ue(268),[3,121,16],ue(47),[7]]},ce=($=le,Object.keys($).reduce(function(e,t){return e[t]=new Uint8Array($[t].reduce(function(e,t){return e.concat(t)},[])),e},{})),de=(X=function(e){return 9e4*e},Y=function(e,t){return e*t},J=function(e){return e/9e4},Q=function(e,t){return e/t},function(e,t){return X(Q(e,t))}),he=function(e,t){return Y(J(e),t)},fe=function(e,t,i,n){var r,a,s,o,u=0,l=0,c=0;if(t.length&&(r=de(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(9e4/(e.samplerate/1024)),i&&n&&(u=r-Math.max(i,n),c=(l=Math.floor(u/a))*a),!(l<1||c>45e3))){for((s=ce[e.samplerate])||(s=t[0].data),o=0;o<l;o++)t.splice(o,0,{data:s});e.baseMediaDecodeTime-=Math.floor(he(c,e.samplerate))}},pe=function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},me=function(e){var t,i,n=[];for(t=0;t<e.length;t++)i=e[t],n.push({size:i.data.byteLength,duration:1024});return n},ge=function(e){var t,i,n=0,r=new Uint8Array(function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i}(e));for(t=0;t<e.length;t++)i=e[t],r.set(i.data,n),n+=i.data.byteLength;return r},ve=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},ye=function(e,t){var i,n=e.minSegmentDts;return t||(n-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=n,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/9e4,i=Math.floor(i)),i},_e=function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},be=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}t+=r,n=0,r=0}return i},Te=function(e){return 181!==e.payload[0]?null:49!=(e.payload[1]<<8|e.payload[2])?null:"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])?null:3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},Se=function(e,t){var i,n,r,a,s=[];if(!(64&t[0]))return s;for(n=31&t[0],i=0;i<n;i++)a={type:3&t[2+(r=3*i)],pts:e},4&t[r+2]&&(a.ccData=t[r+3]<<8|t[r+4],s.push(a));return s},ke=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=e[s];return i},Ee=4,we=function e(){e.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new Le(0,0),new Le(0,1),new Le(1,0),new Le(1,1)],this.reset(),this.ccStreams_.forEach(function(e){e.on("data",this.trigger.bind(this,"data")),e.on("done",this.trigger.bind(this,"done"))},this)};(we.prototype=new Z).push=function(e){var t,i,n;if("sei_rbsp"===e.nalUnitType&&(t=be(e.escapedRBSP)).payloadType===Ee&&(i=Te(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));n=Se(e.pts,i),this.captionPackets_=this.captionPackets_.concat(n),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},we.prototype.flush=function(){this.captionPackets_.length?(this.captionPackets_.forEach(function(e,t){e.presortIndex=t}),this.captionPackets_.sort(function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts}),this.captionPackets_.forEach(function(e){e.type<2&&this.dispatchCea608Packet(e)},this),this.captionPackets_.length=0,this.ccStreams_.forEach(function(e){e.flush()},this)):this.ccStreams_.forEach(function(e){e.flush()},this)},we.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(e){e.reset()})},we.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},we.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},we.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},we.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var Ce={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Pe=function(e){return null===e?"":(e=Ce[e]||e,String.fromCharCode(e))},Ae=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Re=function(){for(var e=[],t=15;t--;)e.push("");return e},Le=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Re();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Re();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Re()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))a=Pe((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=Pe((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=Ae.indexOf(7968&t);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(e.pts,s)),s!==this.row_&&(this.clearFormatting(e.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),a=Pe(n),a+=Pe(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Le.prototype=new Z,Le.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e){try{return e.trim()}catch(e){return console.error("Skipping malformed caption."),""}}).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},Le.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Re(),this.nonDisplayed_=Re(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Le.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Le.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Le.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Le.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Le.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Le.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},Le.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Le.prototype.isNormalChar=function(e){return e>=32&&e<=127},Le.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Re(),this.displayed_=Re()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},Le.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce(function(e,t){return e+"<"+t+">"},"");this[this.mode_](e,i)},Le.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(e,t){return e+"</"+t+">"},"");this.formatting_=[],this[this.mode_](e,t)}},Le.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Le.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Le.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},Le.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var Oe={CaptionStream:we,Cea608Stream:Le},Ie={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},xe=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},De=function e(t){var i,n;e.prototype.init.call(this),this.type_=t,this.push=function(e){e.type===this.type_&&(void 0===n&&(n=e.dts),e.dts=xe(e.dts,n),e.pts=xe(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.discontinuity=function(){n=void 0,i=void 0}};De.prototype=new Z;var Me,Ue=De,je=function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r},Be=function(e,t,i){return decodeURIComponent(je(e,t,i))},Ne=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},Fe={TXXX:function(e){var t;if(3===e.data[0]){for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Be(e.data,1,t),e.value=Be(e.data,t+1,e.data.length).replace(/\0*$/,"");break}e.data=e.value}},WXXX:function(e){var t;if(3===e.data[0])for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Be(e.data,1,t),e.url=Be(e.data,t+1,e.data.length);break}},PRIV:function(e){var t,i;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(i=e.data,unescape(je(i,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Me=function(e){var t,i={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},n=0,r=[],a=0;if(Me.prototype.init.call(this),this.dispatchType=Ie.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,s,o,u,l;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(a=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))i.debug&&console.log("Skipping unrecognized metadata packet");else if(r.push(e),a+=e.data.byteLength,1===r.length&&(n=Ne(e.data.subarray(6,10)),n+=10),!(a<n)){for(t={data:new Uint8Array(n),frames:[],pts:r[0].pts,dts:r[0].dts},l=0;l<n;)t.data.set(r[0].data.subarray(0,n-l),l),l+=r[0].data.byteLength,a-=r[0].data.byteLength,r.shift();s=10,64&t.data[5]&&(s+=4,s+=Ne(t.data.subarray(10,14)),n-=Ne(t.data.subarray(16,20)));do{if((o=Ne(t.data.subarray(s+4,s+8)))<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");if((u={id:String.fromCharCode(t.data[s],t.data[s+1],t.data[s+2],t.data[s+3]),data:t.data.subarray(s+10,s+o+10)}).key=u.id,Fe[u.id]&&(Fe[u.id](u),"com.apple.streaming.transportStreamTimestamp"===u.owner)){var c=u.data,d=(1&c[3])<<30|c[4]<<22|c[5]<<14|c[6]<<6|c[7]>>>2;d*=4,d+=3&c[7],u.timeStamp=d,void 0===t.pts&&void 0===t.dts&&(t.pts=u.timeStamp,t.dts=u.timeStamp),this.trigger("timestamp",u)}t.frames.push(u),s+=10,s+=o}while(s<n);this.trigger("data",t)}}}).prototype=new Z;var Ve,Ge,He,ze=Me,qe=Ue;(Ve=function(){var e=new Uint8Array(188),t=0;Ve.prototype.init.call(this),this.push=function(i){var n,r=0,a=188;for(t?((n=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),n.set(i,t),t=0):n=i;a<n.byteLength;)71!==n[r]||71!==n[a]?(r++,a++):(this.trigger("data",n.subarray(r,a)),r+=188,a+=188);r<n.byteLength&&(e.set(n.subarray(r),0),t=n.byteLength-r)},this.flush=function(){188===t&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")}}).prototype=new Z,(Ge=function(){var e,t,i,n;Ge.prototype.init.call(this),n=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,n){var r=0;n.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===n.type?t(e.subarray(r),n):i(e.subarray(r),n)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],n.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=n.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var a=e[r],s=(31&e[r+1])<<8|e[r+2];a===Ie.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=s:a===Ie.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=s:a===Ie.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][s]=a),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=n.programMapTable}},this.push=function(t){var i={},n=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Ie.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ie.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new Z,Ge.STREAM_TYPES={h264:27,adts:15},(He=function(){var e=this,t={data:[],size:0},i={data:[],size:0},n={data:[],size:0},r=function(t,i,n){var r,a,s=new Uint8Array(t.size),o={type:i},u=0,l=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,u=0;u<t.data.length;u++)a=t.data[u],s.set(a.data,l),l+=a.data.byteLength;var c,d,h;c=s,(d=o).packetLength=6+(c[4]<<8|c[5]),d.dataAlignmentIndicator=0!=(4&c[6]),192&(h=c[7])&&(d.pts=(14&c[9])<<27|(255&c[10])<<20|(254&c[11])<<12|(255&c[12])<<5|(254&c[13])>>>3,d.pts*=4,d.pts+=(6&c[13])>>>1,d.dts=d.pts,64&h&&(d.dts=(14&c[14])<<27|(255&c[15])<<20|(254&c[16])<<12|(255&c[17])<<5|(254&c[18])>>>3,d.dts*=4,d.dts+=(6&c[18])>>>1)),d.data=c.subarray(9+c[8]),r="video"===i||o.packetLength<=t.size,(n||r)&&(t.size=0,t.data.length=0),r&&e.trigger("data",o)}};He.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var e,s;switch(a.streamType){case Ie.H264_STREAM_TYPE:case Ie.H264_STREAM_TYPE:e=t,s="video";break;case Ie.ADTS_STREAM_TYPE:e=i,s="audio";break;case Ie.METADATA_STREAM_TYPE:e=n,s="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&r(e,s,!0),e.data.push(a),e.size+=a.data.byteLength},pmt:function(){var t={type:"metadata",tracks:[]},i=a.programMapTable;null!==i.video&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+i.video,codec:"avc",type:"video"}),null!==i.audio&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+i.audio,codec:"adts",type:"audio"}),e.trigger("data",t)}})[a.type]()},this.flush=function(){r(t,"video"),r(i,"audio"),r(n,"timed-metadata"),this.trigger("done")}}).prototype=new Z;var We={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:Ve,TransportParseStream:Ge,ElementaryStream:He,TimestampRolloverStream:qe,CaptionStream:Oe.CaptionStream,Cea608Stream:Oe.Cea608Stream,MetadataStream:ze};for(var Ke in Ie)Ie.hasOwnProperty(Ke)&&(We[Ke]=Ie[Ke]);var $e,Xe=We,Ye=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];($e=function(){var e;$e.prototype.init.call(this),this.push=function(t){var i,n,r,a,s,o,u=0,l=0;if("audio"===t.type)for(e?(a=e,(e=new Uint8Array(a.byteLength+t.data.byteLength)).set(a),e.set(t.data,a.byteLength)):e=t.data;u+5<e.length;)if(255===e[u]&&240==(246&e[u+1])){if(n=2*(1&~e[u+1]),i=(3&e[u+3])<<11|e[u+4]<<3|(224&e[u+5])>>5,o=9e4*(s=1024*(1+(3&e[u+6])))/Ye[(60&e[u+2])>>>2],r=u+i,e.byteLength<r)return;if(this.trigger("data",{pts:t.pts+l*o,dts:t.dts+l*o,sampleCount:s,audioobjecttype:1+(e[u+2]>>>6&3),channelcount:(1&e[u+2])<<2|(192&e[u+3])>>>6,samplerate:Ye[(60&e[u+2])>>>2],samplingfrequencyindex:(60&e[u+2])>>>2,samplesize:16,data:e.subarray(u+7+n,r)}),e.byteLength===r)return void(e=void 0);l++,e=e.subarray(r)}else u++},this.flush=function(){this.trigger("done")}}).prototype=new Z;var Je,Qe,Ze,et=$e,tt=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),i=new DataView(a.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),a=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<<r|this.readBits(r):a},this.skipLeadingZeros=function(){var e;for(e=0;e<n;++e)if(0!=(i&2147483648>>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(Qe=function(){var e,t,i=0;Qe.prototype.init.call(this),this.push=function(n){var r;for(t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;i<t.byteLength-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<t.byteLength;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<t.length);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")}}).prototype=new Z,Ze={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Je=function(){var e,t,i,n,r,a,s,o=new Qe;Je.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",function(s){var o={trackId:t,pts:i,dts:n,data:s};switch(31&s[0]){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)}),o.on("done",function(){e.trigger("done")}),this.flush=function(){o.flush()},s=function(e,t){var i,n=8,r=8;for(i=0;i<e;i++)0!==r&&(r=(n+t.readExpGolomb()+256)%256),n=0===r?n:r},r=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=e[s];return i},a=function(e){var t,i,n,r,a,o,u,l,c,d,h,f,p,m=0,g=0,v=0,y=0,_=1;if(i=(t=new tt(e)).readUnsignedByte(),r=t.readUnsignedByte(),n=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),Ze[i]&&(3===(a=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(h=3!==a?8:12,p=0;p<h;p++)t.readBoolean()&&s(p<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),u=t.readUnsignedExpGolomb(),p=0;p<u;p++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),l=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),0===(d=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb(),y=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:f=[1,1];break;case 2:f=[12,11];break;case 3:f=[10,11];break;case 4:f=[16,11];break;case 5:f=[40,33];break;case 6:f=[24,11];break;case 7:f=[20,11];break;case 8:f=[32,11];break;case 9:f=[80,33];break;case 10:f=[18,11];break;case 11:f=[15,11];break;case 12:f=[64,33];break;case 13:f=[160,99];break;case 14:f=[4,3];break;case 15:f=[3,2];break;case 16:f=[2,1];break;case 255:f=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}f&&(_=f[0]/f[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:r,width:Math.ceil((16*(l+1)-2*m-2*g)*_),height:(2-d)*(c+1)*16-2*v-2*y}}}).prototype=new Z;var it,nt={H264Stream:Je,NalByteStream:Qe},rt=function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},at=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?i+20:i+10},st=function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i};(it=function(){var e=new Uint8Array,t=0;it.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var n,r,a,s,o=0,u=0;for(e.length?(s=e.length,(e=new Uint8Array(i.byteLength+s)).set(e.subarray(0,s)),e.set(i,s)):e=i;e.length-u>=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255!=(255&e[u])||240!=(240&e[u+1]))u++;else{if(e.length-u<7)break;if(u+(o=st(e,u))>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else{if(e.length-u<10)break;if(u+(o=at(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}n=e.length-u,e=n>0?e.subarray(u):new Uint8Array}}).prototype=new Z;var ot,ut,lt,ct,dt=it,ht=nt.H264Stream,ft=rt,pt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],mt=["width","height","profileIdc","levelIdc","profileCompatibility"],gt=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},vt=function(e,t,i,n,r,a){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(n-t),pts:e+(r-i)},prependedContentDuration:a,baseMediaDecodeTime:e}};(ut=function(e,t){var i=[],n=0,r=0,a=0,s=1/0;t=t||{},ut.prototype.init.call(this),this.push=function(t){_e(e,t),e&&pt.forEach(function(i){e[i]=t[i]}),i.push(t)},this.setEarliestDts=function(t){r=t-e.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){a=e},this.flush=function(){var o,u,l,c;0!==i.length?(o=pe(i,e,r),e.baseMediaDecodeTime=ye(e,t.keepOriginalTimestamps),fe(e,o,a,s),e.samples=me(o),l=z.mdat(ge(o)),i=[],u=z.moof(n,[e]),c=new Uint8Array(u.byteLength+l.byteLength),n++,c.set(u),c.set(l,u.byteLength),ve(e),this.trigger("data",{track:e,boxes:c}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")}}).prototype=new Z,(ot=function(e,t){var i,n,r=0,a=[],s=[];t=t||{},ot.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){_e(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],mt.forEach(function(t){e[t]=i[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.data,e.pps=[t.data]),a.push(t)},this.flush=function(){for(var i,n,o,u,l,c,d,h,f=0;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0===a.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(i=te(a),(o=ie(i))[0][0].keyFrame||((n=this.getGopForFusion_(a[0],e))?(f=n.duration,o.unshift(n),o.byteLength+=n.byteLength,o.nalCount+=n.nalCount,o.pts=n.pts,o.dts=n.dts,o.duration+=n.duration):o=ne(o)),s.length){var p;if(!(p=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");ve(e),o=p}_e(e,o),e.samples=re(o),l=z.mdat(ae(o)),e.baseMediaDecodeTime=ye(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}})),d=o[0],h=o[o.length-1],this.trigger("segmentTimingInfo",vt(e.baseMediaDecodeTime,d.dts,d.pts,h.dts+h.duration,h.pts+h.duration,f)),this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),u=z.moof(r,[e]),c=new Uint8Array(u.byteLength+l.byteLength),r++,c.set(u),c.set(l,u.byteLength),this.trigger("data",{track:e,boxes:c}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){ve(e),i=void 0,n=void 0},this.getGopForFusion_=function(t){var i,n,r,a,s,o=1/0;for(s=0;s<this.gopCache_.length;s++)r=(a=this.gopCache_[s]).gop,e.pps&>(e.pps[0],a.pps[0])&&e.sps&>(e.sps[0],a.sps[0])&&(r.dts<e.timelineStartInfo.dts||(i=t.dts-r.dts-r.duration)>=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=i=0;t<s.length&&i<e.length&&(n=s[t],r=e[i],n.pts!==r.pts);)r.pts>n.pts?t++:(i++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===i?e:i===e.length?null:((l=e.slice(i)).byteLength=a,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,i,n,r,a,o,u;for(t=s.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(n=s[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(u=o?i:a))return e;var l=e.slice(u),c=l.reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0});return l.byteLength=c.byteLength,l.duration=c.duration,l.nalCount=c.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){s=e}}).prototype=new Z,(ct=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps&&(this.keepOriginalTimestamps=e.keepOriginalTimestamps),this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ct.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBoxes.push(e.boxes),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track),void("audio"===e.track.type&&(this.audioTrack=e.track)))}}).prototype=new Z,ct.prototype.flush=function(e){var t,i,n,r,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,mt.forEach(function(e){s.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,pt.forEach(function(e){s.info[e]=this.audioTrack[e]},this)),1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=z.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)s.data.set(this.pendingBoxes[r],a),a+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=t.startPts,this.keepOriginalTimestamps||(t.startTime-=o),t.startTime/=9e4,t.endTime=t.endPts,this.keepOriginalTimestamps||(t.endTime-=o),t.endTime/=9e4,s.captionStreams[t.stream]=!0,s.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=i.pts,this.keepOriginalTimestamps||(i.cueTime-=o),i.cueTime/=9e4,s.metadata.push(i);s.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",s),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},(lt=function(e){var t,i,n=this,r=!0;lt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={};this.transmuxPipeline_=t,t.type="aac",t.metadataStream=new Xe.MetadataStream,t.aacStream=new dt,t.audioTimestampRolloverStream=new Xe.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new Xe.TimestampRolloverStream("timed-metadata"),t.adtsStream=new et,t.coalesceStream=new ct(e,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(r){"timed-metadata"!==r.type||t.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new ut(i,e),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new Xe.MetadataStream,r.packetStream=new Xe.TransportPacketStream,r.parseStream=new Xe.TransportParseStream,r.elementaryStream=new Xe.ElementaryStream,r.videoTimestampRolloverStream=new Xe.TimestampRolloverStream("video"),r.audioTimestampRolloverStream=new Xe.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Xe.TimestampRolloverStream("timed-metadata"),r.adtsStream=new et,r.h264Stream=new ht,r.captionStream=new Xe.CaptionStream,r.coalesceStream=new ct(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream),r.elementaryStream.pipe(r.videoTimestampRolloverStream).pipe(r.h264Stream),r.elementaryStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.elementaryStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new ot(t,e),r.videoSegmentStream.on("timelineStartInfo",function(e){i&&(i.timelineStartInfo=e,r.audioSegmentStream.setEarliestDts(e.dts))}),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new ut(i,e),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream))}}),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,ve(i),e.keepOriginalTimestamps||(i.timelineStartInfo.baseMediaDecodeTime=n),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[],r.videoTimestampRolloverStream.discontinuity()),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,ve(t),r.captionStream.reset(),e.keepOriginalTimestamps||(t.timelineStartInfo.baseMediaDecodeTime=n)),r.timedMetadataTimestampRolloverStream&&r.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.push=function(e){if(r){var t=ft(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new Z;var yt,_t,bt={Transmuxer:lt,VideoSegmentStream:ot,AudioSegmentStream:ut,AUDIO_PROPERTIES:pt,VIDEO_PROPERTIES:mt,generateVideoSegmentTimingInfo:vt},Tt=W.parseType,St=function(e){return new Date(1e3*e-20828448e5)},kt=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]}},Et={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:yt(e.subarray(78,e.byteLength))}},avcC:function(e){var t,i,n,r,a=new DataView(e.buffer,e.byteOffset,e.byteLength),s={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:3&e[4],sps:[],pps:[]},o=31&e[5];for(n=6,r=0;r<o;r++)i=a.getUint16(n),n+=2,s.sps.push(new Uint8Array(e.subarray(n,n+i))),n+=i;for(t=e[n],n++,r=0;r<t;r++)i=a.getUint16(n),n+=2,s.pps.push(new Uint8Array(e.subarray(n,n+i))),n+=i;return s},btrt:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},esds:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),esId:e[6]<<8|e[7],streamPriority:31&e[8],decoderConfig:{objectProfileIndication:e[11],streamType:e[12]>>>2&63,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:e[26]>>>3&31,samplingFrequencyIndex:(7&e[26])<<1|e[27]>>>7&1,channelConfiguration:e[27]>>>3&15}}}},ftyp:function(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={majorBrand:Tt(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},n=8;n<e.byteLength;)i.compatibleBrands.push(Tt(e.subarray(n,n+4))),n+=4;return i},dinf:function(e){return{boxes:yt(e)}},dref:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),dataReferences:yt(e.subarray(8))}},hdlr:function(e){var t={version:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0),flags:new Uint8Array(e.subarray(1,4)),handlerType:Tt(e.subarray(8,12)),name:""},i=8;for(i=24;i<e.byteLength;i++){if(0===e[i]){i++;break}t.name+=String.fromCharCode(e[i])}return t.name=decodeURIComponent(escape(t.name)),t},mdat:function(e){return{byteLength:e.byteLength,nals:function(e){var t,i,n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[];for(t=0;t+4<e.length;t+=i)if(i=n.getUint32(t),t+=4,i<=0)r.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&e[t]){case 1:r.push("slice_layer_without_partitioning_rbsp");break;case 5:r.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:r.push("sei_rbsp");break;case 7:r.push("seq_parameter_set_rbsp");break;case 8:r.push("pic_parameter_set_rbsp");break;case 9:r.push("access_unit_delimiter_rbsp");break;default:r.push("UNKNOWN NAL - "+e[t]&31)}return r}(e)}},mdhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n=4,r={version:i.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};return 1===r.version?(n+=4,r.creationTime=St(i.getUint32(n)),n+=8,r.modificationTime=St(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=8,r.duration=i.getUint32(n)):(r.creationTime=St(i.getUint32(n)),n+=4,r.modificationTime=St(i.getUint32(n)),n+=4,r.timescale=i.getUint32(n),n+=4,r.duration=i.getUint32(n)),n+=4,t=i.getUint16(n),r.language+=String.fromCharCode(96+(t>>10)),r.language+=String.fromCharCode(96+((992&t)>>5)),r.language+=String.fromCharCode(96+(31&t)),r},mdia:function(e){return{boxes:yt(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:yt(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(i.streamDescriptor=yt(e.subarray(28))[0]),i},moof:function(e){return{boxes:yt(e)}},moov:function(e){return{boxes:yt(e)}},mvex:function(e){return{boxes:yt(e)}},mvhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,n={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=St(t.getUint32(i)),i+=8,n.modificationTime=St(t.getUint32(i)),i+=4,n.timescale=t.getUint32(i),i+=8,n.duration=t.getUint32(i)):(n.creationTime=St(t.getUint32(i)),i+=4,n.modificationTime=St(t.getUint32(i)),i+=4,n.timescale=t.getUint32(i),i+=4,n.duration=t.getUint32(i)),i+=4,n.rate=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,n.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,i+=8,n.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,i+=24,n.nextTrackId=t.getUint32(i),n},pdin:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t<e.byteLength;t++)i.samples.push({dependsOn:(48&e[t])>>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return i},sidx:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},r=i.getUint16(22);for(t=24;r;t+=12,r--)n.references.push({referenceType:(128&e[t])>>>7,referencedSize:2147483647&i.getUint32(t),subsegmentDuration:i.getUint32(t+4),startsWithSap:!!(128&e[t+8]),sapType:(112&e[t+8])>>>4,sapDeltaTime:268435455&i.getUint32(t+8)});return n},smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:yt(e)}},stco:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},r=i.getUint32(4);for(t=8;r;t+=4,r--)n.chunkOffsets.push(i.getUint32(t));return n},stsc:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n=i.getUint32(4),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;n;t+=12,n--)r.sampleToChunks.push({firstChunk:i.getUint32(t),samplesPerChunk:i.getUint32(t+4),sampleDescriptionIndex:i.getUint32(t+8)});return r},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:yt(e.subarray(8))}},stsz:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(t=12;t<e.byteLength;t+=4)n.entries.push(i.getUint32(t));return n},stts:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},r=i.getUint32(4);for(t=8;r;t+=8,r--)n.timeToSamples.push({sampleCount:i.getUint32(t),sampleDelta:i.getUint32(t+4)});return n},styp:function(e){return Et.ftyp(e)},tfdt:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:e[4]<<24|e[5]<<16|e[6]<<8|e[7]};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=e[8]<<24|e[9]<<16|e[10]<<8|e[11]),t},tfhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],a=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],u=32&n.flags[2],l=65536&n.flags[0],c=131072&n.flags[0];return t=8,r&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),a&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),s&&(n.defaultSampleDuration=i.getUint32(t),t+=4),o&&(n.defaultSampleSize=i.getUint32(t),t+=4),u&&(n.defaultSampleFlags=i.getUint32(t)),l&&(n.durationIsEmpty=!0),!r&&c&&(n.baseDataOffsetIsMoof=!0),n},tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,n={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=St(t.getUint32(i)),i+=8,n.modificationTime=St(t.getUint32(i)),i+=4,n.trackId=t.getUint32(i),i+=4,i+=8,n.duration=t.getUint32(i)):(n.creationTime=St(t.getUint32(i)),i+=4,n.modificationTime=St(t.getUint32(i)),i+=4,n.trackId=t.getUint32(i),i+=4,i+=4,n.duration=t.getUint32(i)),i+=4,i+=8,n.layer=t.getUint16(i),i+=2,n.alternateGroup=t.getUint16(i),i+=2,n.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,n.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,n.width=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,n.height=t.getUint16(i)+t.getUint16(i+2)/16,n},traf:function(e){return{boxes:yt(e)}},trak:function(e){return{boxes:yt(e)}},trex:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:3&e[20],sampleIsDependedOn:(192&e[21])>>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],c=n.getUint32(4),d=8;for(r&&(i.dataOffset=n.getInt32(d),d+=4),a&&c&&(t={flags:kt(e.subarray(d,d+4))},d+=4,s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),l&&(t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t),c--);c--;)t={},s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),u&&(t.flags=kt(e.subarray(d,d+4)),d+=4),l&&(t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t);return i},"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}},wt={inspect:yt=function(e){for(var t,i,n,r,a,s=0,o=[],u=new ArrayBuffer(e.length),l=new Uint8Array(u),c=0;c<e.length;++c)l[c]=e[c];for(t=new DataView(u);s<e.byteLength;)i=t.getUint32(s),n=Tt(e.subarray(s+4,s+8)),r=i>1?s+i:e.byteLength,(a=(Et[n]||function(e){return{data:e}})(e.subarray(s+8,r))).size=i,a.type=n,o.push(a),s=r;return o},textify:_t=function(e,t){var i;return t=t||0,i=new Array(2*t+1).join(" "),e.map(function(e,n){return i+e.type+"\n"+Object.keys(e).filter(function(e){return"type"!==e&&"boxes"!==e}).map(function(t){var n=i+" "+t+": ",r=e[t];if(r instanceof Uint8Array||r instanceof Uint32Array){var a=Array.prototype.slice.call(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map(function(e){return" "+("00"+e.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return a?1===a.length?n+"<"+a.join("").slice(1)+">":n+"<\n"+a.map(function(e){return i+" "+e}).join("\n")+"\n"+i+" >":n+"<>"}return n+JSON.stringify(r,null,2).split("\n").map(function(e,t){return 0===t?e:i+" "+e}).join("\n")}).join("\n")+(e.boxes?"\n"+_t(e.boxes,t+1):"")}).join("\n")},parseTfdt:Et.tfdt,parseHdlr:Et.hdlr,parseTfhd:Et.tfhd,parseTrun:Et.trun,parseSidx:Et.sidx},Ct=ke,Pt=Oe.CaptionStream,At=function(e,t){for(var i=e,n=0;n<t.length;n++){var r=t[n];if(i<r.size)return r;i-=r.size}return null},Rt=function(e,t){var i=W.findBox(e,["moof","traf"]),n={},r=[];return W.findBox(e,["mdat"]).forEach(function(e,t){var n=i[t];r.push({mdat:e,traf:n})}),r.forEach(function(e){var i,r=e.mdat,a=e.traf,s=W.findBox(a,["tfhd"]),o=wt.parseTfhd(s[0]),u=o.trackId,l=W.findBox(a,["tfdt"]),c=l.length>0?wt.parseTfdt(l[0]).baseMediaDecodeTime:0,d=W.findBox(a,["trun"]);t===u&&d.length>0&&(i=function(e,t,i){var n,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u=[];for(r=0;r+4<e.length;r+=a)if(a=o.getUint32(r),r+=4,!(a<=0))switch(31&e[r]){case 6:var l=e.subarray(r+1,r+1+a),c=At(r,t);n={nalUnitType:"sei_rbsp",size:a,data:l,escapedRBSP:Ct(l),trackId:i},c?(n.pts=c.pts,n.dts=c.dts,s=c):(n.pts=s.pts,n.dts=s.dts),u.push(n)}return u}(r,function(e,t,i){var n=t,r=i.defaultSampleDuration||0,a=i.defaultSampleSize||0,s=i.trackId,o=[];return e.forEach(function(e){var t=wt.parseTrun(e).samples;t.forEach(function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),e.pts=n+e.compositionTimeOffset,n+=e.duration}),o=o.concat(t)}),o}(d,c,o),u),n[u]||(n[u]=[]),n[u]=n[u].concat(i))}),n},Lt={generator:z,probe:W,Transmuxer:bt.Transmuxer,AudioSegmentStream:bt.AudioSegmentStream,VideoSegmentStream:bt.VideoSegmentStream,CaptionParser:function(){var e,t,i,n,r,a=!1;this.isInitialized=function(){return a},this.init=function(){e=new Pt,a=!0,e.on("data",function(e){e.startTime=e.startPts/n,e.endTime=e.endPts/n,r.captions.push(e),r.captionStreams[e.stream]=!0})},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length||i===e[0]&&n===t[i])},this.parse=function(e,a,s){var o;if(!this.isInitialized())return null;if(!a||!s)return null;if(this.isNewInit(a,s))i=a[0],n=s[i];else if(!i||!n)return t.push(e),null;for(;t.length>0;){var u=t.shift();this.parse(u,a,s)}return null!==(o=function(e,t,i){return t?{seiNals:Rt(e,t)[t],timescale:i}:null}(e,i,n))&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach(function(t){e.push(t)})},this.flushStream=function(){if(!this.isInitialized())return null;e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()}},Ot=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},It=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),xt=function(){function e(t,i){Ot(this,e),this.options=i||{},this.self=t,this.init()}return It(e,[{key:"init",value:function(){var e,t;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Lt.Transmuxer(this.options),e=this.self,(t=this.transmuxer).on("data",function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};var n=t.data;t.data=n.buffer,e.postMessage({action:"data",segment:t,byteOffset:n.byteOffset,byteLength:n.byteLength},[t.data])}),t.captionStream&&t.captionStream.on("data",function(t){e.postMessage({action:"caption",data:t})}),t.on("done",function(t){e.postMessage({action:"done"})}),t.on("gopInfo",function(t){e.postMessage({action:"gopInfo",gopInfo:t})}),t.on("videoSegmentTimingInfo",function(t){e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})})}},{key:"push",value:function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}},{key:"reset",value:function(){this.init()}},{key:"setTimestampOffset",value:function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4*t))}},{key:"setAudioAppendStart",value:function(e){this.transmuxer.setAudioAppendStart(Math.ceil(9e4*e.appendStart))}},{key:"flush",value:function(e){this.transmuxer.flush()}},{key:"resetCaptions",value:function(){this.transmuxer.resetCaptions()}},{key:"alignGopsWith",value:function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}]),e}();new function(e){e.onmessage=function(t){"init"===t.data.action&&t.data.options?this.messageHandlers=new xt(e,t.data.options):(this.messageHandlers||(this.messageHandlers=new xt(e)),t.data&&t.data.action&&"init"!==t.data.action&&this.messageHandlers[t.data.action]&&this.messageHandlers[t.data.action](t.data))}}(i)}()}),kd={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},Ed=function(e){return e.map(function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})})},wd=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i={codecCount:0};return i.codecCount=t.split(",").length,i.codecCount=i.codecCount||2,(e=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(t))&&(i.videoCodec=e[2],i.videoObjectTypeIndicator=e[3]),i.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(t),i.audioProfile=i.audioProfile&&i.audioProfile[2],i},Cd=function(e,t,i){return e+"/"+t+'; codecs="'+i.filter(function(e){return!!e}).join(", ")+'"'},Pd=function(e,t){var i=function(e){return e.segments&&e.segments.length&&e.segments[0].map?"mp4":"mp2t"}(t),n=function(e){var t=e.attributes||{};return t.CODECS?wd(t.CODECS):kd}(t),r=t.attributes||{},a=!0,s=!1;if(!t)return[];if(e.mediaGroups.AUDIO&&r.AUDIO){var o=e.mediaGroups.AUDIO[r.AUDIO];if(o)for(var u in s=!0,a=!1,o)if(!o[u].uri&&!o[u].playlists){a=!0;break}}s&&!n.audioProfile&&(a||(n.audioProfile=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return wd(r.playlists[0].attributes.CODECS).audioProfile}return null}(e,r.AUDIO)),n.audioProfile||(cs.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=kd.audioProfile));var l={};n.videoCodec&&(l.video=""+n.videoCodec+n.videoObjectTypeIndicator),n.audioProfile&&(l.audio="mp4a.40."+n.audioProfile);var c=Cd("audio",i,[l.audio]),d=Cd("video",i,[l.video]),h=Cd("video",i,[l.video,l.audio]);return s?!a&&l.video?[d,c]:a||l.video?[h,c]:[c,c]:l.video?[h]:[c]},Ad=function(e){return/mp4a\.\d+.\d+/i.test(e)},Rd=function(e){return/avc1\.[\da-f]+/i.test(e)},Ld=function(e,t,i){var n=null,r=null,a=0,s=[],o=[];if(!e&&!t)return cs.createTimeRange();if(!e)return t.buffered;if(!t)return e.buffered;if(i)return e.buffered;if(0===e.buffered.length&&0===t.buffered.length)return cs.createTimeRange();for(var u=e.buffered,l=t.buffered,c=u.length;c--;)s.push({time:u.start(c),type:"start"}),s.push({time:u.end(c),type:"end"});for(c=l.length;c--;)s.push({time:l.start(c),type:"start"}),s.push({time:l.end(c),type:"end"});for(s.sort(function(e,t){return e.time-t.time}),c=0;c<s.length;c++)"start"===s[c].type?2===++a&&(n=s[c].time):"end"===s[c].type&&1===--a&&(r=s[c].time),null!==n&&null!==r&&(o.push([n,r]),n=null,r=null);return cs.createTimeRanges(o)},Od=function(e){function t(e,i){fc(this,t);var n=gc(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,cs.EventTarget));n.timestampOffset_=0,n.pendingBuffers_=[],n.bufferUpdating_=!1,n.mediaSource_=e,n.codecs_=i,n.audioCodec_=null,n.videoCodec_=null,n.audioDisabled_=!1,n.appendAudioInitSegment_=!0,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=cs.browser.IE_VERSION>=11;var r={remux:!1,alignGopsAtEnd:n.safeAppend_};return n.codecs_.forEach(function(e){Ad(e)?n.audioCodec_=e:Rd(e)&&(n.videoCodec_=e)}),n.transmuxer_=new Sd,n.transmuxer_.postMessage({action:"init",options:r}),n.transmuxer_.onmessage=function(e){return"data"===e.data.action?n.data_(e):"done"===e.data.action?n.done_(e):"gopInfo"===e.data.action?n.appendGopInfo_(e):"videoSegmentTimingInfo"===e.data.action?n.videoSegmentTimingInfo_(e.data.videoSegmentTimingInfo):void 0},Object.defineProperty(n,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(e){"number"==typeof e&&e>=0&&(this.timestampOffset_=e,this.appendAudioInitSegment_=!0,this.gopBuffer_.length=0,this.timeMapping_=0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e}))}}),Object.defineProperty(n,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(e){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=e),this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=e)}}),Object.defineProperty(n,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(n,"buffered",{get:function(){return Ld(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}}),n}return mc(t,e),pc(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),function(e,t,i){var n=t.player_;if(i.captions&&i.captions.length)for(var r in e.inbandTextTracks_||(e.inbandTextTracks_={}),i.captionStreams)if(!e.inbandTextTracks_[r]){n.tech_.trigger({type:"usage",name:"hls-608"});var a=n.textTracks().getTrackById(r);e.inbandTextTracks_[r]=a||n.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track}i.metadata&&i.metadata.length&&!e.metadataTrack_&&(e.metadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=i.metadata.dispatchType)}(this,this.mediaSource_,t),this.pendingBuffers_.push(t)}},{key:"done_",value:function(e){"closed"!==this.mediaSource_.readyState?this.processPendingSegments_():this.pendingBuffers_.length=0}},{key:"videoSegmentTimingInfo_",value:function(e){var t={start:{decode:e.start.dts/9e4,presentation:e.start.pts/9e4},end:{decode:e.end.dts/9e4,presentation:e.end.pts/9e4},baseMediaDecodeTime:e.baseMediaDecodeTime/9e4};e.prependedContentDuration&&(t.prependedContentDuration=e.prependedContentDuration/9e4),this.trigger({type:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}},{key:"createRealSourceBuffers_",value:function(){var e=this,t=["audio","video"];t.forEach(function(i){if(e[i+"Codec_"]&&!e[i+"Buffer_"]){var n=null;if(e.mediaSource_[i+"Buffer_"])(n=e.mediaSource_[i+"Buffer_"]).updating=!1;else{var r=i+'/mp4;codecs="'+e[i+"Codec_"]+'"';n=function(e,t){var i=e.addSourceBuffer(t),n=Object.create(null);n.updating=!1,n.realBuffer_=i;var r=function(e){"function"==typeof i[e]?n[e]=function(){return i[e].apply(i,arguments)}:void 0===n[e]&&Object.defineProperty(n,e,{get:function(){return i[e]},set:function(t){return i[e]=t}})};for(var a in i)r(a);return n}(e.mediaSource_.nativeMediaSource_,r),e.mediaSource_[i+"Buffer_"]=n}e[i+"Buffer_"]=n,["update","updatestart","updateend"].forEach(function(r){n.addEventListener(r,function(){if("audio"!==i||!e.audioDisabled_)return"updateend"===r&&(e[i+"Buffer_"].updating=!1),t.every(function(t){return!("audio"!==t||!e.audioDisabled_)||(i===t||!e[t+"Buffer_"]||!e[t+"Buffer_"].updating)})?e.trigger(r):void 0})})}})}},{key:"appendBuffer",value:function(e){if(this.bufferUpdating_=!0,this.audioBuffer_&&this.audioBuffer_.buffered.length){var t=this.audioBuffer_.buffered;this.transmuxer_.postMessage({action:"setAudioAppendStart",appendStart:t.end(t.length-1)})}this.videoBuffer_&&this.transmuxer_.postMessage({action:"alignGopsWith",gopsToAlignWith:function(e,t,i){if(void 0===t||null===t||!e.length)return[];var n=Math.ceil(9e4*(t-i+3)),r=void 0;for(r=0;r<e.length&&!(e[r].pts>n);r++);return e.slice(r)}(this.gopBuffer_,this.mediaSource_.player_?this.mediaSource_.player_.currentTime():null,this.timeMapping_)}),this.transmuxer_.postMessage({action:"push",data:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength},[e.buffer]),this.transmuxer_.postMessage({action:"flush"})}},{key:"appendGopInfo_",value:function(e){this.gopBuffer_=function(e,t,i){if(!t.length)return e;if(i)return t.slice();for(var n=t[0].pts,r=0;r<e.length&&!(e[r].pts>=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,e.data.gopInfo,this.safeAppend_)}},{key:"remove",value:function(e,t){if(this.videoBuffer_&&(this.videoBuffer_.updating=!0,this.videoBuffer_.remove(e,t),this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil(9e4*(t-n)),a=Math.ceil(9e4*(i-n)),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var u=o+1;u--&&!(e[u].pts<=r););return u=Math.max(u,0),s.splice(u,o-u+1),s}(this.gopBuffer_,e,t,this.timeMapping_)),!this.audioDisabled_&&this.audioBuffer_&&(this.audioBuffer_.updating=!0,this.audioBuffer_.remove(e,t)),ud(e,t,this.metadataTrack_),this.inbandTextTracks_)for(var i in this.inbandTextTracks_)ud(e,t,this.inbandTextTracks_[i])}},{key:"processPendingSegments_",value:function(){var e={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]},t="";e=this.pendingBuffers_.reduce(function(e,i){var n=i.type,r=i.data,a=i.initSegment;return e[n]?(e[n].segments.push(r),e[n].bytes+=r.byteLength,e[n].initSegment=a,i.captions&&(e.captions=e.captions.concat(i.captions)),i.info&&(e[n].info=i.info),i.metadata&&(e.metadata=e.metadata.concat(i.metadata)),e):(t=n,e)},e),t&&this.mediaSource_&&this.mediaSource_.player_&&this.mediaSource_.player_.trigger({type:"unknow-segment-type",name:t}),this.videoBuffer_||this.audioBuffer_||(0===e.video.bytes&&(this.videoCodec_=null),0===e.audio.bytes&&(this.audioCodec_=null),this.createRealSourceBuffers_()),e.audio.info&&this.mediaSource_.trigger({type:"audioinfo",info:e.audio.info}),e.video.info&&this.mediaSource_.trigger({type:"videoinfo",info:e.video.info}),this.appendAudioInitSegment_&&(!this.audioDisabled_&&this.audioBuffer_&&(e.audio.segments.unshift(e.audio.initSegment),e.audio.bytes+=e.audio.initSegment.byteLength),this.appendAudioInitSegment_=!1);var i=!1;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_)):!this.videoBuffer_||!this.audioDisabled_&&this.audioBuffer_||(i=!0),cd(this,e.captions,e.metadata),!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(e.audio,this.audioBuffer_),this.pendingBuffers_.length=0,i&&this.trigger("updateend"),this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(e,t){var i=0,n=void 0;if(e.bytes){n=new Uint8Array(e.bytes),e.segments.forEach(function(e){n.set(e,i),i+=e.byteLength});try{t.updating=!0,t.appendBuffer(n)}catch(e){this.mediaSource_.player_&&this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:e.message,originalError:e})}}}},{key:"abort",value:function(){this.videoBuffer_&&this.videoBuffer_.abort(),!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"reset"}),this.pendingBuffers_.length=0,this.bufferUpdating_=!1}}]),t}(cs.EventTarget),Id=function(i){function n(){fc(this,n);var i=gc(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),r=void 0;for(r in i.nativeMediaSource_=new e.MediaSource,i.nativeMediaSource_)"handle"===r||r in n.prototype||"function"!=typeof i.nativeMediaSource_[r]||(i[r]=i.nativeMediaSource_[r].bind(i.nativeMediaSource_));return i.duration_=NaN,Object.defineProperty(i,"duration",{get:function(){return this.duration_===1/0?this.duration_:this.nativeMediaSource_.duration},set:function(e){this.duration_=e,e===1/0||(this.nativeMediaSource_.duration=e)}}),Object.defineProperty(i,"seekable",{get:function(){return this.duration_===1/0?cs.createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}}),Object.defineProperty(i,"readyState",{get:function(){return this.nativeMediaSource_.readyState}}),Object.defineProperty(i,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}}),i.sourceBuffers=[],i.activeSourceBuffers_=[],i.updateActiveSourceBuffers_=function(){if(i.activeSourceBuffers_.length=0,1===i.sourceBuffers.length){var e=i.sourceBuffers[0];return e.appendAudioInitSegment_=!0,e.audioDisabled_=!e.audioCodec_,void i.activeSourceBuffers_.push(e)}for(var t=!1,n=!0,r=0;r<i.player_.audioTracks().length;r++){var a=i.player_.audioTracks()[r];if(a.enabled&&"main"!==a.kind){t=!0,n=!1;break}}i.sourceBuffers.forEach(function(e,r){if(e.appendAudioInitSegment_=!0,e.videoCodec_&&e.audioCodec_)e.audioDisabled_=t;else if(e.videoCodec_&&!e.audioCodec_)e.audioDisabled_=!0,n=!1;else if(!e.videoCodec_&&e.audioCodec_&&(e.audioDisabled_=r?n:!n,e.audioDisabled_))return;i.activeSourceBuffers_.push(e)})},i.onPlayerMediachange_=function(){i.sourceBuffers.forEach(function(e){e.appendAudioInitSegment_=!0})},i.onHlsReset_=function(){i.sourceBuffers.forEach(function(e){e.transmuxer_&&e.transmuxer_.postMessage({action:"resetCaptions"})})},i.onHlsSegmentTimeMapping_=function(e){i.sourceBuffers.forEach(function(t){return t.timeMapping_=e.mapping})},["sourceopen","sourceclose","sourceended"].forEach(function(e){this.nativeMediaSource_.addEventListener(e,this.trigger.bind(this))},i),i.on("sourceopen",function(e){var n=t.querySelector('[src="'+i.url_+'"]');n&&(i.player_=cs(n.parentNode),i.player_&&(i.player_.tech_.on("hls-reset",i.onHlsReset_),i.player_.tech_.on("hls-segment-time-mapping",i.onHlsSegmentTimeMapping_),i.player_.audioTracks&&i.player_.audioTracks()&&(i.player_.audioTracks().on("change",i.updateActiveSourceBuffers_),i.player_.audioTracks().on("addtrack",i.updateActiveSourceBuffers_),i.player_.audioTracks().on("removetrack",i.updateActiveSourceBuffers_)),i.player_.on("mediachange",i.onPlayerMediachange_)))}),i.on("sourceended",function(e){for(var t=ld(i.duration),n=0;n<i.sourceBuffers.length;n++){var r=i.sourceBuffers[n],a=r.metadataTrack_&&r.metadataTrack_.cues;a&&a.length&&(a[a.length-1].endTime=t)}}),i.on("sourceclose",function(e){this.sourceBuffers.forEach(function(e){e.transmuxer_&&e.transmuxer_.terminate()}),this.sourceBuffers.length=0,this.player_&&(this.player_.audioTracks&&this.player_.audioTracks()&&(this.player_.audioTracks().off("change",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("addtrack",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("removetrack",this.updateActiveSourceBuffers_)),this.player_.el_&&this.player_.off("mediachange",this.onPlayerMediachange_),this.player_.tech_&&this.player_.tech_.el_&&(this.player_.tech_.off("hls-reset",this.onHlsReset_),this.player_.tech_.off("hls-segment-time-mapping",this.onHlsSegmentTimeMapping_)))}),i}return mc(n,i),pc(n,[{key:"addSeekableRange_",value:function(e,t){var i=void 0;if(this.duration!==1/0)throw(i=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity")).name="InvalidStateError",i.code=11,i;(t>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=t)}},{key:"addSourceBuffer",value:function(e){var t=void 0,i=function(e){var t={type:"",parameters:{}},i=e.trim().split(";");return t.type=i.shift().trim(),i.forEach(function(e){var i=e.trim().split("=");if(i.length>1){var n=i[0].replace(/"/g,"").trim(),r=i[1].replace(/"/g,"").trim();t.parameters[n]=r}}),t}(e);if(/^(video|audio)\/mp2t$/i.test(i.type)){var n=[];i.parameters&&i.parameters.codecs&&(n=i.parameters.codecs.split(","),n=(n=Ed(n)).filter(function(e){return Ad(e)||Rd(e)})),0===n.length&&(n=["avc1.4d400d","mp4a.40.2"]),t=new Od(this,n),0!==this.sourceBuffers.length&&(this.sourceBuffers[0].createRealSourceBuffers_(),t.createRealSourceBuffers_(),this.sourceBuffers[0].audioDisabled_=!0)}else t=this.nativeMediaSource_.addSourceBuffer(e);return this.sourceBuffers.push(t),t}}]),n}(cs.EventTarget),xd=0;cs.mediaSources={};var Dd=function(e,t){var i=cs.mediaSources[e];if(!i)throw new Error("Media Source not found (Video.js)");i.trigger({type:"sourceopen",swfId:t})},Md=function(){return!!e.MediaSource&&!!e.MediaSource.isTypeSupported&&e.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},Ud=function(){if(this.MediaSource={open:Dd,supportsNativeMediaSources:Md},Md())return new Id;throw new Error("Cannot use create a virtual MediaSource for this video")};Ud.open=Dd,Ud.supportsNativeMediaSources=Md;var jd={createObjectURL:function(t){var i=void 0;return t instanceof Id?(i=e.URL.createObjectURL(t.nativeMediaSource_),t.url_=i,i):t instanceof Id?(i="blob:vjs-media-source/"+xd,xd++,cs.mediaSources[i]=t,i):(i=e.URL.createObjectURL(t),t.url_=i,i)}};cs.MediaSource=Ud,cs.URL=jd;var Bd=cs.EventTarget,Nd=cs.mergeOptions,Fd=function(e,t){for(var i=void 0,n=Nd(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),r=0;r<t.playlists.length;r++){var a=Sc(n,t.playlists[r]);a?n=a:i=!0}return Tc(t,function(e,t,r,a){if(e.playlists&&e.playlists.length){var s=e.playlists[0].uri,o=Sc(n,e.playlists[0]);o&&((n=o).mediaGroups[t][r][a].playlists[0]=n.playlists[s],i=!1)}}),i?null:n},Vd=function(e){var t=e.byterange.offset+e.byterange.length-1;return e.uri+"-"+e.byterange.offset+"-"+t},Gd=function(e,t){var i,n,r={};for(var a in e){var s=e[a].sidx;if(s){var o=Vd(s);if(!t[o])break;var u=t[o].sidxInfo;i=u,n=s,(Boolean(!i.map&&!n.map)||Boolean(i.map&&n.map&&i.map.byterange.offset===n.map.byterange.offset&&i.map.byterange.length===n.map.byterange.length))&&i.uri===n.uri&&i.byterange.offset===n.byterange.offset&&i.byterange.length===n.byterange.length&&(r[o]=t[o])}}return r},Hd=function(e,t,i,n,r){var a={uri:hc(n.handleManifestRedirects,e.resolvedUri),byterange:e.byterange,playlist:t};return i(cs.mergeOptions(a,{responseType:"arraybuffer",headers:Wc(a)}),r)},zd=function(t){function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments[3];fc(this,i);var a=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),s=n.withCredentials,o=void 0!==s&&s,u=n.handleManifestRedirects,l=void 0!==u&&u;if(a.hls_=t,a.withCredentials=o,a.handleManifestRedirects=l,!e)throw new Error("A non-empty playlist URL or playlist is required");return a.on("minimumUpdatePeriod",function(){a.refreshXml_()}),a.on("mediaupdatetimeout",function(){a.refreshMedia_(a.media().uri)}),a.state="HAVE_NOTHING",a.loadedPlaylists_={},"string"==typeof e?(a.srcUrl=e,a.sidxMapping_={},gc(a)):(a.setupChildLoader(r,e),a)}return mc(i,Bd),pc(i,[{key:"setupChildLoader",value:function(e,t){this.masterPlaylistLoader_=e,this.childPlaylist_=t}},{key:"dispose",value:function(){this.stopRequest(),this.loadedPlaylists_={},e.clearTimeout(this.minimumUpdatePeriodTimeout_),e.clearTimeout(this.mediaRequest_),e.clearTimeout(this.mediaUpdateTimeout)}},{key:"hasPendingRequest",value:function(){return this.request||this.mediaRequest_}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"sidxRequestFinished_",value:function(e,t,i,n){var r=this;return function(a,s){if(r.request){if(r.request=null,a)return r.error={status:s.status,message:"DASH playlist request error at URL: "+e.uri,response:s.response,code:2},i&&(r.state=i),r.trigger("error"),n(t,null);var o=new Uint8Array(s.response),u=uu.parseSidx(o.subarray(8));return n(t,u)}}}},{key:"media",value:function(t){var i=this;if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var n=this.state;if("string"==typeof t){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}var r=!this.media_||t.uri!==this.media_.uri;if(r&&this.loadedPlaylists_[t.uri]&&this.loadedPlaylists_[t.uri].endList)return this.state="HAVE_METADATA",this.media_=t,void(r&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(r)if(this.media_&&this.trigger("mediachanging"),t.sidx){var a=void 0,s=void 0;this.masterPlaylistLoader_?(a=this.masterPlaylistLoader_.master,s=this.masterPlaylistLoader_.sidxMapping_):(a=this.master,s=this.sidxMapping_);var o=Vd(t.sidx);s[o]={sidxInfo:t.sidx},this.request=Hd(t.sidx,t,this.hls_.xhr,{handleManifestRedirects:this.handleManifestRedirects},this.sidxRequestFinished_(t,a,n,function(e,r){if(!e||!r)throw new Error("failed to request sidx");s[o].sidx=r,i.haveMetadata({startingState:n,playlist:e.playlists[t.uri]})}))}else this.mediaRequest_=e.setTimeout(this.haveMetadata.bind(this,{startingState:n,playlist:t}),0)}},{key:"haveMetadata",value:function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.uri]=i,this.mediaRequest_=null,this.refreshMedia_(i.uri),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")}},{key:"pause",value:function(){this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.minimumUpdatePeriodTimeout_),"HAVE_NOTHING"===this.state&&(this.started=!1)}},{key:"load",value:function(t){var i=this;e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.minimumUpdatePeriodTimeout_);var n=this.media();if(t){var r=n?n.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=e.setTimeout(function(){return i.load()},r)}else this.started?this.trigger("loadedplaylist"):this.start()}},{key:"parseMasterXml",value:function(){var e=eu(this.masterXml_,{manifestUri:this.srcUrl,clientOffset:this.clientOffset_,sidxMapping:this.sidxMapping_});e.uri=this.srcUrl;for(var t=0;t<e.playlists.length;t++){var i="placeholder-uri-"+t;e.playlists[t].uri=i,e.playlists[i]=e.playlists[t]}return Tc(e,function(t,i,n,r){if(t.playlists&&t.playlists.length){var a="placeholder-uri-"+i+"-"+n+"-"+r;t.playlists[0].uri=a,e.playlists[a]=t.playlists[0]}}),kc(e),Ec(e),e}},{key:"start",value:function(){var t=this;this.started=!0,this.masterPlaylistLoader_?this.mediaRequest_=e.setTimeout(this.haveMaster_.bind(this),0):this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(e,i){if(t.request){if(t.request=null,e)return t.error={status:i.status,message:"DASH playlist request error at URL: "+t.srcUrl,responseText:i.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");t.masterXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date?t.masterLoaded_=Date.parse(i.responseHeaders.date):t.masterLoaded_=Date.now(),t.srcUrl=hc(t.handleManifestRedirects,t.srcUrl,i),t.syncClientServerClock_(t.onClientServerClockSync_.bind(t))}})}},{key:"syncClientServerClock_",value:function(e){var t=this,i=tu(this.masterXml_);return null===i?(this.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.clientOffset_=i.value-Date.now(),e()):void(this.request=this.hls_.xhr({uri:dc(this.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},function(n,r){if(t.request){if(n)return t.clientOffset_=t.masterLoaded_-Date.now(),e();var a=void 0;a="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText),t.clientOffset_=a-Date.now(),e()}}))}},{key:"haveMaster_",value:function(){this.state="HAVE_MASTER",this.mediaRequest_=null,this.masterPlaylistLoader_?this.media_||this.media(this.childPlaylist_):(this.master=this.parseMasterXml(),this.trigger("loadedplaylist"))}},{key:"onClientServerClockSync_",value:function(){var t=this;this.haveMaster_(),this.hasPendingRequest()||this.media_||this.media(this.master.playlists[0]),this.master&&this.master.minimumUpdatePeriod&&(this.minimumUpdatePeriodTimeout_=e.setTimeout(function(){t.trigger("minimumUpdatePeriod")},this.master.minimumUpdatePeriod))}},{key:"refreshXml_",value:function(){var t=this;this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(i,n){if(t.request){if(t.request=null,i)return t.error={status:n.status,message:"DASH playlist request error at URL: "+t.srcUrl,responseText:n.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");t.masterXml_=n.responseText,t.sidxMapping_=function(e,t,i,n){var r=eu(e,{manifestUri:t,clientOffset:i}),a=Gd(r.playlists,n);return Tc(r,function(e,t,i,r){if(e.playlists&&e.playlists.length){var s=e.playlists;a=Nd(a,Gd(s,n))}}),a}(t.masterXml_,t.srcUrl,t.clientOffset_,t.sidxMapping_);var r=t.parseMasterXml(),a=Fd(t.master,r);if(a){var s=Vd(t.media().sidx);if(t.sidxMapping_[s])t.master=a;else{var o=t.media();t.request=Hd(o.sidx,o,t.hls_.xhr,{handleManifestRedirects:t.handleManifestRedirects},t.sidxRequestFinished_(o,r,t.state,function(i,n){if(!i||!n)throw new Error("failed to request sidx on minimumUpdatePeriod");t.sidxMapping_[s].sidx=n,t.minimumUpdatePeriodTimeout_=e.setTimeout(function(){t.trigger("minimumUpdatePeriod")},t.master.minimumUpdatePeriod),t.refreshMedia_(t.media().uri)}))}}t.minimumUpdatePeriodTimeout_=e.setTimeout(function(){t.trigger("minimumUpdatePeriod")},t.master.minimumUpdatePeriod)}})}},{key:"refreshMedia_",value:function(t){var i=this;if(!t)throw new Error("refreshMedia_ must take a media uri");var n=void 0,r=void 0;this.masterPlaylistLoader_?(n=this.masterPlaylistLoader_.master,r=this.masterPlaylistLoader_.parseMasterXml()):(n=this.master,r=this.parseMasterXml());var a=Fd(n,r);a?(this.masterPlaylistLoader_?this.masterPlaylistLoader_.master=a:this.master=a,this.media_=a.playlists[t]):(this.media_=r.playlists[t],this.trigger("playlistunchanged")),this.media().endList||(this.mediaUpdateTimeout=e.setTimeout(function(){i.trigger("mediaupdatetimeout")},wc(this.media(),!!a))),this.trigger("loadedplaylist")}}]),i}(),qd=function(e){return cs.log.debug?cs.log.debug.bind(cs,"VHS:",e+" >"):function(){}};function Wd(){}var Kd=function(){function e(t,i,n,r){fc(this,e),this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=t,this.processedAppend_=!1,this.type_=n,this.mimeType_=i,this.logger_=qd("SourceUpdater["+n+"]["+i+"]"),"closed"===t.readyState?t.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,i,r)):this.createSourceBuffer_(i,r)}return pc(e,[{key:"createSourceBuffer_",value:function(e,t){var i=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(e),this.logger_("created SourceBuffer"),t&&(t.trigger("sourcebufferadded"),this.mediaSource.sourceBuffers.length<2)?t.on("sourcebufferadded",function(){i.start_()}):this.start_()}},{key:"start_",value:function(){var e=this;this.started_=!0,this.onUpdateendCallback_=function(){var t=e.pendingCallback_;e.pendingCallback_=null,e.sourceBuffer_.removing=!1,e.logger_("buffered ["+sd(e.buffered())+"]"),t&&t(),e.runCallback_()},this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_),this.runCallback_()}},{key:"abort",value:function(e){var t=this;this.processedAppend_&&this.queueCallback_(function(){t.sourceBuffer_.abort()},e)}},{key:"appendBuffer",value:function(e,t){var i=this;this.processedAppend_=!0,this.queueCallback_(function(){e.videoSegmentTimingInfoCallback&&i.sourceBuffer_.addEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback),i.sourceBuffer_.appendBuffer(e.bytes)},function(){e.videoSegmentTimingInfoCallback&&i.sourceBuffer_.removeEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback),t()})}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:cs.createTimeRanges()}},{key:"remove",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Wd;this.processedAppend_&&this.queueCallback_(function(){i.logger_("remove ["+e+" => "+t+"]"),i.sourceBuffer_.removing=!0,i.sourceBuffer_.remove(e,t)},n)}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||!!this.pendingCallback_&&this.pendingCallback_!==Wd}},{key:"timestampOffset",value:function(e){var t=this;return void 0!==e&&(this.queueCallback_(function(){t.sourceBuffer_.timestampOffset=e,t.runCallback_()}),this.timestampOffset_=e),this.timestampOffset_}},{key:"queueCallback_",value:function(e,t){this.callbacks_.push([e.bind(this),t]),this.runCallback_()}},{key:"runCallback_",value:function(){var e=void 0;!this.updating()&&this.callbacks_.length&&this.started_&&(e=this.callbacks_.shift(),this.pendingCallback_=e[1],e[0]())}},{key:"dispose",value:function(){var e=this,t=function t(){e.sourceBuffer_&&"open"===e.mediaSource.readyState&&e.sourceBuffer_.abort(),e.sourceBuffer_.removeEventListener("updateend",t)};this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_),this.sourceBuffer_.removing?this.sourceBuffer_.addEventListener("updateend",t):t()}}]),e}(),$d={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},Xd=2,Yd=-101,Jd=-102,Qd=function(e){e.forEach(function(e){e.abort()})},Zd=function(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Yd,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Jd,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Xd,xhr:t}:null},eh=function(e,t,i){var n=0,r=!1;return function(a,s){if(!r)return a?(r=!0,Qd(e),i(a,s)):(n+=1)===e.length?(s.endOfAllRequests=Date.now(),s.encryptedBytes?function(e,t,i){e.addEventListener("message",function n(r){if(r.data.source===t.requestId){e.removeEventListener("message",n);var a=r.data.decrypted;return t.bytes=new Uint8Array(a.bytes,a.byteOffset,a.byteLength),i(null,t)}});var n=void 0;n=t.key.bytes.slice?t.key.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.key.bytes)),e.postMessage(Yc({source:t.requestId,encrypted:t.encryptedBytes,key:n,iv:t.key.iv}),[t.encryptedBytes.buffer,n.buffer])}(t,s,i):i(null,s)):void 0}},th=function(e,t){return function(i){var n,r,a;return e.stats=cs.mergeOptions(e.stats,(r=(n=i).target,(a={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-r.requestTime||0}).bytesReceived=n.loaded,a.bandwidth=Math.floor(a.bytesReceived/a.roundTripTime*8*1e3),a)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)}},ih=function(e,t,i,n,r,a,s){var o=[],u=eh(o,i,s);if(r.key&&!r.key.bytes){var l=e(cs.mergeOptions(t,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),function(e,t){return function(i,n){var r=n.response,a=Zd(i,n);if(a)return t(a,e);if(16!==r.byteLength)return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:Xd,xhr:n},e);var s=new DataView(r);return e.key.bytes=new Uint32Array([s.getUint32(0),s.getUint32(4),s.getUint32(8),s.getUint32(12)]),t(null,e)}}(r,u));o.push(l)}if(r.map&&!r.map.bytes){var c=e(cs.mergeOptions(t,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Wc(r.map)}),function(e,t,i){return function(n,r){var a=r.response,s=Zd(n,r);return s?i(s,e):0===a.byteLength?i({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:Xd,xhr:r},e):(e.map.bytes=new Uint8Array(r.response),t&&!t.isInitialized()&&t.init(),e.map.timescales=nu.timescale(e.map.bytes),e.map.videoTrackIds=nu.videoTrackIds(e.map.bytes),i(null,e))}}(r,n,u));o.push(c)}var d=e(cs.mergeOptions(t,{uri:r.resolvedUri,responseType:"arraybuffer",headers:Wc(r)}),function(e,t,i){return function(n,r){var a=r.response,s=Zd(n,r),o=void 0;return s?i(s,e):0===a.byteLength?i({status:r.status,message:"Empty HLS segment content at URL: "+r.uri,code:Xd,xhr:r},e):(e.stats=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}}(r),e.key?e.encryptedBytes=new Uint8Array(r.response):e.bytes=new Uint8Array(r.response),t&&e.map&&e.map.bytes&&(t.isInitialized()||t.init(),(o=t.parse(e.bytes,e.map.videoTrackIds,e.map.timescales))&&o.captions&&(e.captionStreams=o.captionStreams,e.fmp4Captions=o.captions)),i(null,e))}}(r,n,u));return d.addEventListener("progress",th(r,a)),o.push(d),function(){return Qd(o)}},nh=function(t,i){var n;return t&&(n=e.getComputedStyle(t))?n[i]:""},rh=function(e,t){var i=e.slice();e.sort(function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r})},ah=function(t,i){var n=void 0,r=void 0;return t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),n=n||e.Number.MAX_VALUE,i.attributes.BANDWIDTH&&(r=i.attributes.BANDWIDTH),n-(r=r||e.Number.MAX_VALUE)},sh=function(e){return"number"==typeof e&&isFinite(e)},oh=function(t){function i(e){fc(this,i);var t=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));if(!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");return t.bandwidth=e.bandwidth,t.throughput={rate:0,count:0},t.roundTrip=NaN,t.resetStats_(),t.mediaIndex=null,t.hasPlayed_=e.hasPlayed,t.currentTime_=e.currentTime,t.seekable_=e.seekable,t.seeking_=e.seeking,t.duration_=e.duration,t.mediaSource_=e.mediaSource,t.hls_=e.hls,t.loaderType_=e.loaderType,t.startingMedia_=void 0,t.segmentMetadataTrack_=e.segmentMetadataTrack,t.goalBufferLength_=e.goalBufferLength,t.sourceType_=e.sourceType,t.inbandTextTracks_=e.inbandTextTracks,t.state_="INIT",t.checkBufferTimeout_=null,t.error_=void 0,t.currentTimeline_=-1,t.pendingSegment_=null,t.mimeType_=null,t.sourceUpdater_=null,t.xhrOptions_=null,t.activeInitSegmentId_=null,t.initSegments_={},t.cacheEncryptionKeys_=e.cacheEncryptionKeys,t.keyCache_={},"main"===t.loaderType_?t.captionParser_=new Gl:t.captionParser_=null,t.decrypter_=e.decrypter,t.syncController_=e.syncController,t.syncPoint_={segmentIndex:0,time:0},t.syncController_.on("syncinfoupdate",function(){return t.trigger("syncinfoupdate")}),t.mediaSource_.addEventListener("sourceopen",function(){return t.ended_=!1}),t.fetchAtBuffer_=!1,t.logger_=qd("SegmentLoader["+t.loaderType_+"]"),Object.defineProperty(t,"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e)}}),t}return mc(i,t),pc(i,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED",this.pause(),this.abort_(),this.sourceUpdater_&&this.sourceUpdater_.dispose(),this.resetStats_(),this.captionParser_&&this.captionParser_.reset()}},{key:"abort",value:function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}},{key:"abort_",value:function(){this.pendingSegment_&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null}},{key:"error",value:function(e){return void 0!==e&&(this.error_=e),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0,this.pause(),this.trigger("ended")}},{key:"buffered_",value:function(){return this.sourceUpdater_?this.sourceUpdater_.buffered():cs.createTimeRanges()}},{key:"initSegment",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=Jc(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,timescales:e.timescales,videoTrackIds:e.videoTrackIds}),n||e}},{key:"segmentKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=Qc(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&(this.sourceUpdater_||this.mimeType_&&"INIT"===this.state)&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_){if(this.syncController_.setDateTimeMapping(this.playlist_),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY")}}},{key:"init_",value:function(){return this.state="READY",this.sourceUpdater_=new Kd(this.mediaSource_,this.mimeType_,this.loaderType_,this.sourceBufferEmitter_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.hasPlayed_()||(e.syncInfo={mediaSequence:e.mediaSequence,time:0});var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(i&&i.uri===e.uri){var a=e.mediaSequence-i.mediaSequence;this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex&&(this.mediaIndex-=a),n&&(n.mediaIndex-=a,n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(i,e)}else null!==this.mediaIndex&&this.resyncLoader()}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(e,t){this.mimeType_||(this.mimeType_=e,this.sourceBufferEmitter_=t,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(e){this.ended_=!1,this.resetLoader(),this.remove(0,this.duration_(),e),this.captionParser_&&this.captionParser_.clearAllCaptions(),this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1,this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null,this.syncPoint_=null,this.abort()}},{key:"remove",value:function(e,t,i){if(this.sourceUpdater_&&this.sourceUpdater_.remove(e,t,i),ud(e,t,this.segmentMetadataTrack_),this.inbandTextTracks_)for(var n in this.inbandTextTracks_)ud(e,t,this.inbandTextTracks_[n])}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var e=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);e&&(this.isEndOfStream_(e.mediaIndex)?this.endOfStream():(e.mediaIndex!==this.playlist_.segments.length-1||"ended"!==this.mediaSource_.readyState||this.seeking_())&&(e.timeline!==this.currentTimeline_&&(this.syncController_.reset(),e.timestampOffset=e.startOfSegment,this.captionParser_&&this.captionParser_.clearAllCaptions()),this.loadSegment_(e)))}}},{key:"isEndOfStream_",value:function(e){return function(e,t,i){if(!e||!t)return!1;var n=i===e.segments.length;return e.endList&&"open"===t.readyState&&n}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.playlist_,this.mediaSource_,e)&&!this.sourceUpdater_.updating()}},{key:"checkBuffer_",value:function(e,t,i,n,r,a){var s=0,o=void 0;e.length&&(s=e.end(e.length-1));var u=Math.max(0,s-r);if(!t.segments.length)return null;if(u>=this.goalBufferLength_())return null;if(!n&&u>=1)return null;if(null===a)return i=this.getSyncSegmentCandidate_(t),this.generateSegmentInfo_(t,i,null,!0);if(null!==i){var l=t.segments[i];return o=l&&l.end?l.end:s,this.generateSegmentInfo_(t,i+1,o,!1)}if(this.fetchAtBuffer_){var c=Gc.getMediaInfoForTime(t,s,a.segmentIndex,a.time);i=c.mediaIndex,o=c.startTime}else{var d=Gc.getMediaInfoForTime(t,r,a.segmentIndex,a.time);i=d.mediaIndex,o=d.startTime}return this.generateSegmentInfo_(t,i,o,!1)}},{key:"getSyncSegmentCandidate_",value:function(e){var t=this;if(-1===this.currentTimeline_)return 0;var i=e.segments.map(function(e,t){return{timeline:e.timeline,segmentIndex:t}}).filter(function(e){return e.timeline===t.currentTimeline_});return i.length?i[Math.min(i.length-1,1)].segmentIndex:Math.max(e.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(e,t,i,n){if(t<0||t>=e.segments.length)return null;var r=e.segments[t];return{requestId:"segment-loader-"+Math.random(),uri:r.resolvedUri,mediaIndex:t,isSyncRequest:n,startOfSegment:i,playlist:e,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:r.timeline,duration:r.duration,segment:r}}},{key:"abortRequestEarly_",value:function(e){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return!1;if(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return!1;var t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=Gc.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),a=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return((e.length?e.end(e.length-1):0)-t)/i}(this.buffered_(),t,this.hls_.tech_.playbackRate())-1;if(r<=a)return!1;var s=function(e){var t=e.master,i=e.currentTime,n=e.bandwidth,r=e.duration,a=e.segmentDuration,s=e.timeUntilRebuffer,o=e.currentTimeline,u=e.syncController,l=t.playlists.filter(function(e){return!Gc.isIncompatible(e)}),c=l.filter(Gc.isEnabled);c.length||(c=l.filter(function(e){return!Gc.isDisabled(e)}));var d=c.filter(Gc.hasAttribute.bind(null,"BANDWIDTH")).map(function(e){var t=u.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:Gc.estimateSegmentRequestTime(a,n,e)*t-s}}),h=d.filter(function(e){return e.rebufferingImpact<=0});return rh(h,function(e,t){return ah(t.playlist,e.playlist)}),h.length?h[0]:(rh(d,function(e,t){return e.rebufferingImpact-t.rebufferingImpact}),d[0]||null)}({master:this.hls_.playlists.master,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var o=r-a-s.rebufferingImpact,u=.5;return a<=1/30&&(u=1),!s.playlist||s.playlist.uri===this.playlist_.uri||o<u?!1:(this.bandwidth=s.playlist.attributes.BANDWIDTH*$d.BANDWIDTH_VARIANCE+1,this.abort(),this.trigger("earlyabort"),!0)}}},{key:"handleProgress_",value:function(e,t){this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId&&!this.abortRequestEarly_(t.stats)&&this.trigger("progress")}},{key:"loadSegment_",value:function(e){this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),e.abortRequests=ih(this.hls_.xhr,this.xhrOptions_,this.decrypter_,this.captionParser_,this.createSimplifiedSegmentObj_(e),this.handleProgress_.bind(this),this.segmentRequestFinished_.bind(this))}},{key:"trimBackBuffer_",value:function(e){var t=function(e,t,i){var n=void 0;return n=e.length&&e.start(0)>0&&e.start(0)<t?e.start(0):t-30,Math.min(n,t-i)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}},{key:"createSimplifiedSegmentObj_",value:function(e){var t=e.segment,i={resolvedUri:t.resolvedUri,byterange:t.byterange,requestId:e.requestId};if(t.key){var n=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);i.key=this.segmentKey(t.key),i.key.iv=n}return t.map&&(i.map=this.initSegment(t.map)),i}},{key:"segmentRequestFinished_",value:function(e,t){if(this.mediaRequests+=1,t.stats&&(this.mediaBytesTransferred+=t.stats.bytesReceived,this.mediaTransferDuration+=t.stats.roundTripTime),this.pendingSegment_){if(t.requestId===this.pendingSegment_.requestId){if(e)return this.pendingSegment_=null,this.state="READY",e.code===Jd?void(this.mediaRequestsAborted+=1):(this.pause(),e.code===Yd?(this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,void this.trigger("bandwidthupdate")):(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error")));this.bandwidth=t.stats.bandwidth,this.roundTrip=t.stats.roundTripTime,t.map&&(t.map=this.initSegment(t.map,!0)),t.key&&this.segmentKey(t.key,!0),this.processSegmentResponse_(t)}}else this.mediaRequestsAborted+=1}},{key:"processSegmentResponse_",value:function(e){var t=this.pendingSegment_;t.bytes=e.bytes,e.map&&(t.segment.map.bytes=e.map.bytes),t.endOfAllRequests=e.endOfAllRequests,e.fmp4Captions&&(!function(e,t,i){for(var n in i)if(!e[n]){t.trigger({type:"usage",name:"hls-608"});var r=t.textTracks().getTrackById(n);e[n]=r||t.addRemoteTextTrack({kind:"captions",id:n,label:n},!1).track}}(this.inbandTextTracks_,this.hls_.tech_,e.captionStreams),function(e){var t=e.inbandTextTracks,i=e.captionArray,n=e.timestampOffset;if(i){var r=window.WebKitDataCue||window.VTTCue;i.forEach(function(e){var i=e.stream,a=e.startTime,s=e.endTime;t[i]&&(a+=n,s+=n,t[i].addCue(new r(a,s,e.text)))})}}({inbandTextTracks:this.inbandTextTracks_,captionArray:e.fmp4Captions,timestampOffset:0}),this.captionParser_&&this.captionParser_.clearParsedCaptions()),this.handleSegment_()}},{key:"handleSegment_",value:function(){var e=this;if(this.pendingSegment_){var t=this.pendingSegment_,i=t.segment,n=this.syncController_.probeSegmentInfo(t);void 0===this.startingMedia_&&n&&(n.containsAudio||n.containsVideo)&&(this.startingMedia_={containsAudio:n.containsAudio,containsVideo:n.containsVideo});var r,a,s,o=(r=this.loaderType_,a=this.startingMedia_,s=n,"main"===r&&a&&s?s.containsAudio||s.containsVideo?a.containsVideo&&!s.containsVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!a.containsVideo&&s.containsVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null);if(o)return this.error({message:o,blacklistDuration:1/0}),void this.trigger("error");if(t.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");null!==t.timestampOffset&&t.timestampOffset!==this.sourceUpdater_.timestampOffset()&&(this.sourceUpdater_.timestampOffset(t.timestampOffset),this.trigger("timestampoffset"));var u=this.syncController_.mappingForTimeline(t.timeline);if(null!==u&&this.trigger({type:"segmenttimemapping",mapping:u}),this.state="APPENDING",i.map){var l=Jc(i.map);if(!this.activeInitSegmentId_||this.activeInitSegmentId_!==l){var c=this.initSegment(i.map);this.sourceUpdater_.appendBuffer({bytes:c.bytes},function(){e.activeInitSegmentId_=l})}}t.byteLength=t.bytes.byteLength,"number"==typeof i.start&&"number"==typeof i.end?this.mediaSecondsLoaded+=i.end-i.start:this.mediaSecondsLoaded+=i.duration,this.logger_(function(e){var t=e.segment,i=t.start,n=t.end,r=e.playlist,a=r.mediaSequence,s=r.id,o=r.segments,u=void 0===o?[]:o,l=e.mediaIndex,c=e.timeline;return["appending ["+l+"] of ["+a+", "+(a+u.length)+"] from playlist ["+s+"]","["+i+" => "+n+"] in timeline ["+c+"]"].join(" ")}(t)),this.sourceUpdater_.appendBuffer({bytes:t.bytes,videoSegmentTimingInfoCallback:this.handleVideoSegmentTimingInfo_.bind(this,t.requestId)},this.handleUpdateEnd_.bind(this))}else this.state="READY"}},{key:"handleVideoSegmentTimingInfo_",value:function(e,t){if(this.pendingSegment_&&e===this.pendingSegment_.requestId){var i=this.pendingSegment_.segment;i.videoTimingInfo||(i.videoTimingInfo={}),i.videoTimingInfo.transmuxerPrependedSeconds=t.videoSegmentTimingInfo.prependedContentDuration||0,i.videoTimingInfo.transmuxedPresentationStart=t.videoSegmentTimingInfo.start.presentation,i.videoTimingInfo.transmuxedPresentationEnd=t.videoSegmentTimingInfo.end.presentation,i.videoTimingInfo.baseMediaDecodeTime=t.videoSegmentTimingInfo.baseMediaDecodeTime}}},{key:"handleUpdateEnd_",value:function(){if(!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_,t=e.segment,i=null!==this.mediaIndex;this.pendingSegment_=null,this.recordThroughput_(e),this.addSegmentMetadataCue_(e),this.state="READY",this.mediaIndex=e.mediaIndex,this.fetchAtBuffer_=!0,this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate"),t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration?this.resetEverything():(i&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.isEndOfStream_(e.mediaIndex+1,e.playlist)&&this.endOfStream(),this.paused()||this.monitorBuffer_())}},{key:"recordThroughput_",value:function(e){var t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(t){if(this.segmentMetadataTrack_){var i=t.segment,n=i.start,r=i.end;if(sh(n)&&sh(r)){ud(n,r,this.segmentMetadataTrack_);var a=e.WebKitDataCue||e.VTTCue,s={custom:i.custom,dateTimeObject:i.dateTimeObject,dateTimeString:i.dateTimeString,bandwidth:t.playlist.attributes.BANDWIDTH,resolution:t.playlist.attributes.RESOLUTION,codecs:t.playlist.attributes.CODECS,byteLength:t.byteLength,uri:t.uri,timeline:t.timeline,playlist:t.playlist.uri,start:n,end:r},o=new a(n,r,JSON.stringify(s));o.value=s,this.segmentMetadataTrack_.addCue(o)}}}}]),i}(cs.EventTarget),uh=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},lh=new Uint8Array("\n\n".split("").map(function(e){return e.charCodeAt(0)})),ch=function(t){function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};fc(this,i);var n=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t));return n.mediaSource_=null,n.subtitlesTrack_=null,n}return mc(i,oh),pc(i,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return cs.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return cs.createTimeRanges([[t,i]])}},{key:"initSegment",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=Jc(e),n=this.initSegments_[i];if(t&&!n&&e.bytes){var r=lh.byteLength+e.bytes.byteLength,a=new Uint8Array(r);a.set(e.bytes),a.set(lh,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return n||e}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"track",value:function(e){return void 0===e?this.subtitlesTrack_:(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}},{key:"remove",value:function(e,t){ud(e,t,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var e=this;this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var t=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(t=this.skipEmptySegments_(t)){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline)){return this.syncController_.one("timestampoffset",function(){e.state="READY",e.paused()||e.monitorBuffer_()}),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(t)}}},{key:"skipEmptySegments_",value:function(e){for(;e&&e.segment.empty;)e=this.generateSegmentInfo_(e.playlist,e.mediaIndex+1,e.startOfSegment+e.duration,e.isSyncRequest);return e}},{key:"handleSegment_",value:function(){var t=this;if(this.pendingSegment_&&this.subtitlesTrack_){this.state="APPENDING";var i=this.pendingSegment_,n=i.segment;if("function"!=typeof e.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var r=void 0,a=function(){t.subtitlesTrack_.tech_.off("vttjsloaded",r),t.error({message:"Error loading vtt.js"}),t.state="READY",t.pause(),t.trigger("error")};return r=function(){t.subtitlesTrack_.tech_.off("vttjserror",a),t.handleSegment_()},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",r),void this.subtitlesTrack_.tech_.one("vttjserror",a)}n.requested=!0;try{this.parseVTTCues_(i)}catch(e){return this.error({message:e.message}),this.state="READY",this.pause(),this.trigger("error")}if(this.updateTimeMapping_(i,this.syncController_.timelines[i.timeline],this.playlist_),i.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");i.byteLength=i.bytes.byteLength,this.mediaSecondsLoaded+=n.duration,i.cues.length&&this.remove(i.cues[0].endTime,i.cues[i.cues.length-1].endTime),i.cues.forEach(function(e){t.subtitlesTrack_.addCue(e)}),this.handleUpdateEnd_()}else this.state="READY"}},{key:"parseVTTCues_",value:function(t){var i=void 0,n=!1;"function"==typeof e.TextDecoder?i=new e.TextDecoder("utf8"):(i=e.WebVTT.StringDecoder(),n=!0);var r=new e.WebVTT.Parser(e,e.vttjs,i);if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},r.oncue=t.cues.push.bind(t.cues),r.ontimestampmap=function(e){return t.timestampmap=e},r.onparsingerror=function(e){cs.log.warn("Error encountered when parsing cues: "+e.message)},t.segment.map){var a=t.segment.map.bytes;n&&(a=uh(a)),r.parse(a)}var s=t.bytes;n&&(s=uh(s)),r.parse(s),r.flush()}},{key:"updateTimeMapping_",value:function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,a=r.MPEGTS/9e4-r.LOCAL+t.mapping;if(e.cues.forEach(function(e){e.startTime+=a,e.endTime+=a}),!i.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,o-n.duration)}}}else n.empty=!0}}]),i}(),dh=function(e,t){for(var i=e.cues,n=0;n<i.length;n++){var r=i[n];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null},hh=Zl,fh=[{name:"VOD",run:function(e,t,i,n,r){if(i!==1/0){return{time:0,segmentIndex:0}}return null}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!e.datetimeToDisplayTime)return null;var a=t.segments||[],s=null,o=null;r=r||0;for(var u=0;u<a.length;u++){var l=a[u];if(l.dateTimeObject){var c=l.dateTimeObject.getTime()/1e3+e.datetimeToDisplayTime,d=Math.abs(r-c);if(null!==o&&(0===d||o<d))break;o=d,s={time:c,segmentIndex:u}}}return s}},{name:"Segment",run:function(e,t,i,n,r){var a=t.segments||[],s=null,o=null;r=r||0;for(var u=0;u<a.length;u++){var l=a[u];if(l.timeline===n&&void 0!==l.start){var c=Math.abs(r-l.start);if(null!==o&&o<c)break;(!s||null===o||o>=c)&&(o=c,s={time:l.start,segmentIndex:u})}}return s}},{name:"Discontinuity",run:function(e,t,i,n,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o<t.discontinuityStarts.length;o++){var u=t.discontinuityStarts[o],l=t.discontinuitySequence+o+1,c=e.discontinuities[l];if(c){var d=Math.abs(r-c.time);if(null!==s&&s<d)break;(!a||null===s||s>=d)&&(s=d,a={time:c.time,segmentIndex:u})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence}:null}}],ph=function(e){function t(){fc(this,t);var e=gc(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.inspectCache_=void 0,e.timelines=[],e.discontinuities=[],e.datetimeToDisplayTime=null,e.logger_=qd("SyncController"),e}return mc(t,e),pc(t,[{key:"getSyncPoint",value:function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+Lc(e,n.segmentIndex,0))}},{key:"runStrategies_",value:function(e,t,i,n){for(var r=[],a=0;a<fh.length;a++){var s=fh[a],o=s.run(this,e,t,i,n);o&&(o.strategy=s.name,r.push({strategy:s.name,syncPoint:o}))}return r}},{key:"selectSyncPoint_",value:function(e,t){for(var i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,a=1;a<e.length;a++){var s=Math.abs(e[a].syncPoint[t.key]-t.value);s<n&&(n=s,i=e[a].syncPoint,r=e[a].strategy)}return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+r+"]: [time:"+i.time+", segmentIndex:"+i.segmentIndex+"]"),i}},{key:"saveExpiredSegmentInfo",value:function(e,t){for(var i=t.mediaSequence-e.mediaSequence-1;i>=0;i--){var n=e.segments[i];if(n&&void 0!==n.start){t.syncInfo={mediaSequence:e.mediaSequence+i,time:n.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMapping",value:function(e){if(!this.datetimeToDisplayTime&&e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0].dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-t}}},{key:"reset",value:function(){this.inspectCache_=void 0}},{key:"probeSegmentInfo",value:function(e){var t=e.segment,i=e.playlist,n=void 0;return(n=t.map?this.probeMp4Segment_(e):this.probeTsSegment_(e))&&this.calculateSegmentTimeMapping_(e,n)&&(this.saveDiscontinuitySyncInfo_(e),i.syncInfo||(i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:t.start})),n}},{key:"probeMp4Segment_",value:function(e){var t=e.segment,i=nu.timescale(t.map.bytes),n=nu.startTime(i,e.bytes);return null!==e.timestampOffset&&(e.timestampOffset-=n),{start:n,end:n+t.duration}}},{key:"probeTsSegment_",value:function(e){var t=hh(e.bytes,this.inspectCache_),i=void 0,n=void 0;return t?(t.video&&2===t.video.length?(this.inspectCache_=t.video[1].dts,i=t.video[0].dtsTime,n=t.video[1].dtsTime):t.audio&&2===t.audio.length&&(this.inspectCache_=t.audio[1].dts,i=t.audio[0].dtsTime,n=t.audio[1].dtsTime),{start:i,end:n,containsVideo:t.video&&2===t.video.length,containsAudio:t.audio&&2===t.audio.length}):null}},{key:"timestampOffsetForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].time}},{key:"mappingForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}},{key:"calculateSegmentTimeMapping_",value:function(e,t){var i=e.segment,n=this.timelines[e.timeline];if(null!==e.timestampOffset)n={time:e.startOfSegment,mapping:e.startOfSegment-t.start},this.timelines[e.timeline]=n,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+n.time+"] [mapping: "+n.mapping+"]"),i.start=e.startOfSegment,i.end=t.end+n.mapping;else{if(!n)return!1;i.start=t.start+n.mapping,i.end=t.end+n.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(e){var t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var n=0;n<t.discontinuityStarts.length;n++){var r=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,s=r-e.mediaIndex,o=Math.abs(s);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>o){var u=void 0;u=s<0?i.start-Lc(t,e.mediaIndex,r):i.end+Lc(t,e.mediaIndex+1,r),this.discontinuities[a]={time:u,accuracy:o}}}}}]),t}(cs.EventTarget),mh=new vd("./decrypter-worker.worker.js",function(e,t){var i=this;!function(){var e=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},t=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},r=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],n=t[4],r=i[4],a=void 0,s=void 0,o=void 0,u=[],l=[],c=void 0,d=void 0,h=void 0,f=void 0,p=void 0;for(a=0;a<256;a++)l[(u[a]=a<<1^283*(a>>7))^a]=a;for(s=o=0;!n[s];s^=c||1,o=l[o]||1)for(h=(h=o^o<<1^o<<2^o<<3^o<<4)>>8^255&h^99,n[s]=h,r[h]=s,p=16843009*u[d=u[c=u[s]]]^65537*d^257*c^16843008*s,f=257*u[h]^16843008*h,a=0;a<4;a++)t[a][s]=f=f<<24^f>>>8,i[a][h]=p=p<<24^p>>>8;for(a=0;a<5;a++)t[a]=t[a].slice(0),i[a]=i[a].slice(0);return e},a=null,s=function(){function t(i){e(this,t),a||(a=r()),this._tables=[[a[0][0].slice(),a[0][1].slice(),a[0][2].slice(),a[0][3].slice(),a[0][4].slice()],[a[1][0].slice(),a[1][1].slice(),a[1][2].slice(),a[1][3].slice(),a[1][4].slice()]];var n=void 0,s=void 0,o=void 0,u=void 0,l=void 0,c=this._tables[0][4],d=this._tables[1],h=i.length,f=1;if(4!==h&&6!==h&&8!==h)throw new Error("Invalid aes key size");for(u=i.slice(0),l=[],this._key=[u,l],n=h;n<4*h+28;n++)o=u[n-1],(n%h==0||8===h&&n%h==4)&&(o=c[o>>>24]<<24^c[o>>16&255]<<16^c[o>>8&255]<<8^c[255&o],n%h==0&&(o=o<<8^o>>>24^f<<24,f=f<<1^283*(f>>7))),u[n]=u[n-h]^o;for(s=0;n;s++,n--)o=u[3&s?n:n-4],l[s]=n<=4||s<4?o:d[0][c[o>>>24]]^d[1][c[o>>16&255]]^d[2][c[o>>8&255]]^d[3][c[255&o]]}return t.prototype.decrypt=function(e,t,i,n,r,a){var s=this._key[1],o=e^s[0],u=n^s[1],l=i^s[2],c=t^s[3],d=void 0,h=void 0,f=void 0,p=s.length/4-2,m=void 0,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],S=v[4];for(m=0;m<p;m++)d=y[o>>>24]^_[u>>16&255]^b[l>>8&255]^T[255&c]^s[g],h=y[u>>>24]^_[l>>16&255]^b[c>>8&255]^T[255&o]^s[g+1],f=y[l>>>24]^_[c>>16&255]^b[o>>8&255]^T[255&u]^s[g+2],c=y[c>>>24]^_[o>>16&255]^b[u>>8&255]^T[255&l]^s[g+3],g+=4,o=d,u=h,l=f;for(m=0;m<4;m++)r[(3&-m)+a]=S[o>>>24]<<24^S[u>>16&255]<<16^S[l>>8&255]<<8^S[255&c]^s[g++],d=o,o=u,u=l,l=c,c=d},t}(),o=function(){function t(){e(this,t),this.listeners={}}return t.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.prototype.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},t.prototype.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.prototype.dispose=function(){this.listeners={}},t.prototype.pipe=function(e){this.on("data",function(t){e.push(t)})},t}(),u=function(t){function i(){e(this,i);var r=n(this,t.call(this,o));return r.jobs=[],r.delay=1,r.timeout_=null,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(i,t),i.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},i}(o),l=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},c=function(){function i(t,n,r,a){e(this,i);var s=i.STEP,o=new Int32Array(t.buffer),c=new Uint8Array(t.byteLength),d=0;for(this.asyncStream_=new u,this.asyncStream_.push(this.decryptChunk_(o.subarray(d,d+s),n,r,c)),d=s;d<o.length;d+=s)r=new Uint32Array([l(o[d-4]),l(o[d-3]),l(o[d-2]),l(o[d-1])]),this.asyncStream_.push(this.decryptChunk_(o.subarray(d,d+s),n,r,c));this.asyncStream_.push(function(){var e;a(null,(e=c).subarray(0,e.byteLength-e[e.byteLength-1]))})}return i.prototype.decryptChunk_=function(e,t,i,n){return function(){var r=function(e,t,i){var n=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),r=new s(Array.prototype.slice.call(t)),a=new Uint8Array(e.byteLength),o=new Int32Array(a.buffer),u=void 0,c=void 0,d=void 0,h=void 0,f=void 0,p=void 0,m=void 0,g=void 0,v=void 0;for(u=i[0],c=i[1],d=i[2],h=i[3],v=0;v<n.length;v+=4)f=l(n[v]),p=l(n[v+1]),m=l(n[v+2]),g=l(n[v+3]),r.decrypt(f,p,m,g,o,v),o[v]=l(o[v]^u),o[v+1]=l(o[v+1]^c),o[v+2]=l(o[v+2]^d),o[v+3]=l(o[v+3]^h),u=f,c=p,d=m,h=g;return a}(e,t,i);n.set(r,e.byteOffset)}},t(i,null,[{key:"STEP",get:function(){return 32e3}}]),i}();new function(e){e.onmessage=function(t){var i=t.data,n=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),r=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),a=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new c(n,r,a,function(t,n){var r,a;e.postMessage((r={source:i.source,decrypted:n},a={},Object.keys(r).forEach(function(e){var t=r[e];ArrayBuffer.isView(t)?a[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:a[e]=t}),a),[n.buffer])})}}(i)}()}),gh=function(e){var t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},vh=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},yh=function(e,t){t.activePlaylistLoader=e,e.load()},_h={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;vh(i,n);var a=n.activeTrack(),s=n.activeGroup(),o=(s.filter(function(e){return e.default})[0]||s[0]).id,u=n.tracks[o];if(a!==u){for(var l in cs.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[l].enabled=n.tracks[l]===u;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];cs.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),vh(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},bh={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e];t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),r),n.paused()||a.load()}),t.on("error",_h[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),r),n.paused()||a.load()}),t.on("error",_h[e](e,i))}},Th={AUDIO:function(e,t){var i=t.hls,n=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.master.mediaGroups,o=t.mediaTypes[e],u=o.groups,l=o.tracks,c=t.masterPlaylistLoader;for(var d in s[e]&&0!==Object.keys(s[e]).length||(s[e]={main:{default:{default:!0}}}),s[e])for(var h in u[d]||(u[d]=[]),s[e][d]){var f=s[e][d][h],p=void 0;if(p=f.resolvedUri?new Cc(f.resolvedUri,i,a):f.playlists&&"dash"===n?new zd(f.playlists[0],i,a,c):null,f=cs.mergeOptions({id:h,playlistLoader:p},f),bh[e](e,f.playlistLoader,t),u[d].push(f),void 0===l[h]){var m=new cs.AudioTrack({id:h,kind:gh(f),enabled:!1,language:f.language,default:f.default,label:h});l[h]=m}}r.on("error",_h[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.hls,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,u=t.mediaTypes[e],l=u.groups,c=u.tracks,d=t.masterPlaylistLoader;for(var h in o[e])for(var f in l[h]||(l[h]=[]),o[e][h])if(!o[e][h][f].forced){var p=o[e][h][f],m=void 0;if("hls"===r?m=new Cc(p.resolvedUri,n,s):"dash"===r&&(m=new zd(p.playlists[0],n,s,d)),p=cs.mergeOptions({id:f,playlistLoader:m},p),bh[e](e,p.playlistLoader,t),l[h].push(p),void 0===c[f]){var g=i.addRemoteTextTrack({id:f,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:f},!1).track;c[f]=g}}a.on("error",_h[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in n[e])for(var u in a[o]||(a[o]=[]),n[e][o]){var l=n[e][o][u];if(l.instreamId.match(/CC\d/)&&(a[o].push(cs.mergeOptions({id:u},l)),void 0===s[u])){var c=i.addRemoteTextTrack({id:l.instreamId,kind:"captions",default:l.default&&l.autoselect,language:l.language,label:u},!1).track;s[u]=c}}}},Sh={AUDIO:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if(i[n].enabled)return i[n];return null}},SUBTITLES:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if("showing"===i[n].mode)return i[n];return null}}},kh=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){Th[t](t,e)});var t=e.mediaTypes,i=e.masterPlaylistLoader,n=e.tech,r=e.hls;["AUDIO","SUBTITLES"].forEach(function(i){t[i].activeGroup=function(e,t){return function(i){var n=t.masterPlaylistLoader,r=t.mediaTypes[e].groups,a=n.media();if(!a)return null;var s=null;return a.attributes[e]&&(s=r[a.attributes[e]]),s=s||r.main,void 0===i?s:null===i?null:s.filter(function(e){return e.id===i.id})[0]||null}}(i,e),t[i].activeTrack=Sh[i](i,e),t[i].onGroupChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.activeGroup(s),u=a.activePlaylistLoader;vh(n,a),o&&(o.playlistLoader?(n.resyncLoader(),yh(o.playlistLoader,a)):u&&r.resetEverything())}}(i,e),t[i].onTrackChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.activeGroup(s),u=a.activePlaylistLoader;vh(n,a),o&&(o.playlistLoader?u!==o.playlistLoader?(n.track&&n.track(s),n.resetEverything(),yh(o.playlistLoader,a)):yh(o.playlistLoader,a):r.resetEverything())}}(i,e)});var a=t.AUDIO.activeGroup(),s=(a.filter(function(e){return e.default})[0]||a[0]).id;t.AUDIO.tracks[s].enabled=!0,t.AUDIO.onTrackChanged(),i.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(e){return t[e].onGroupChanged()})});var o=function(){t.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"hls-audio-change"})};for(var u in n.audioTracks().addEventListener("change",o),n.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",function(){n.audioTracks().removeEventListener("change",o),n.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),n.clearTracks("audio"),t.AUDIO.tracks)n.audioTracks().addTrack(t.AUDIO.tracks[u])},Eh=function(){var e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Wd,activeTrack:Wd,onGroupChanged:Wd,onTrackChanged:Wd}}),e},wh=void 0,Ch=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],Ph=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},Ah=function(t){function i(e){fc(this,i);var t=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),n=e.url,r=e.handleManifestRedirects,a=e.withCredentials,s=e.tech,o=e.bandwidth,u=e.externHls,l=e.useCueTags,c=e.blacklistDuration,d=e.enableLowInitialPlaylist,h=e.sourceType,f=e.seekTo,p=e.cacheEncryptionKeys;if(!n)throw new Error("A non-empty playlist URL is required");wh=u,t.withCredentials=a,t.tech_=s,t.hls_=s.hls,t.seekTo_=f,t.sourceType_=h,t.useCueTags_=l,t.blacklistDuration=c,t.enableLowInitialPlaylist=d,t.useCueTags_&&(t.cueTagsTrack_=t.tech_.addTextTrack("metadata","ad-cues"),t.cueTagsTrack_.inBandMetadataTrackDispatchType=""),t.requestOptions_={withCredentials:a,handleManifestRedirects:r,timeout:null},t.mediaTypes_=Eh(),t.mediaSource=new cs.MediaSource,t.mediaSource.addEventListener("sourceopen",t.handleSourceOpen_.bind(t)),t.seekable_=cs.createTimeRanges(),t.hasPlayed_=function(){return!1},t.syncController_=new ph(e),t.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,t.decrypter_=new mh,t.inbandTextTracks_={};var m={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:p};return t.masterPlaylistLoader_="dash"===t.sourceType_?new zd(n,t.hls_,t.requestOptions_):new Cc(n,t.hls_,t.requestOptions_),t.setupMasterPlaylistLoaderListeners_(),t.mainSegmentLoader_=new oh(cs.mergeOptions(m,{segmentMetadataTrack:t.segmentMetadataTrack_,loaderType:"main"}),e),t.audioSegmentLoader_=new oh(cs.mergeOptions(m,{loaderType:"audio"}),e),t.subtitleSegmentLoader_=new ch(cs.mergeOptions(m,{loaderType:"vtt"}),e),t.setupSegmentLoaderListeners_(),Ch.forEach(function(e){t[e+"_"]=Ph.bind(t,e)}),t.logger_=qd("MPC"),t.masterPlaylistLoader_.load(),t}return mc(i,t),pc(i,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;Vc(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),kh({sourceType:e.sourceType_,segmentLoaders:{AUDIO:e.audioSegmentLoader_,SUBTITLES:e.subtitleSegmentLoader_,main:e.mainSegmentLoader_},tech:e.tech_,requestOptions:e.requestOptions_,masterPlaylistLoader:e.masterPlaylistLoader_,hls:e.hls_,master:e.master(),mediaTypes:e.mediaTypes_,blacklistCurrentPlaylist:e.blacklistCurrentPlaylist.bind(e)}),e.triggerPresenceUsage_(e.master(),t);try{e.setupSourceBuffers_()}catch(t){return cs.log.warn("Failed to create SourceBuffers",t),e.mediaSource.endOfStream("decode")}e.setupFirstPlay(),!e.mediaTypes_.AUDIO.activePlaylistLoader||e.mediaTypes_.AUDIO.activePlaylistLoader.media()?e.trigger("selectedinitialmedia"):e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",function(){e.trigger("selectedinitialmedia")})}),this.masterPlaylistLoader_.on("loadedplaylist",function(){var t=e.masterPlaylistLoader_.media();if(!t){e.excludeUnsupportedVariants_();var i=void 0;return e.enableLowInitialPlaylist&&(i=e.selectInitialPlaylist()),i||(i=e.selectPlaylist()),e.initialMedia_=i,void e.masterPlaylistLoader_.media(e.initialMedia_)}if(e.useCueTags_&&e.updateAdCues_(t),e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.updateDuration(),e.tech_.paused()||(e.mainSegmentLoader_.load(),e.audioSegmentLoader_&&e.audioSegmentLoader_.load()),!t.endList){var n=function(){var t=e.seekable();0!==t.length&&e.mediaSource.addSeekableRange_(t.start(0),t.end(0))};if(e.duration()!==1/0){e.tech_.one("durationchange",function t(){e.duration()===1/0?n():e.tech_.one("durationchange",t)})}else n()}}),this.masterPlaylistLoader_.on("error",function(){e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)}),this.masterPlaylistLoader_.on("mediachanging",function(){e.mainSegmentLoader_.abort(),e.mainSegmentLoader_.pause()}),this.masterPlaylistLoader_.on("mediachange",function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;Vc(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load(),e.tech_.trigger({type:"mediachange",bubbles:!0})}),this.masterPlaylistLoader_.on("playlistunchanged",function(){var t=e.masterPlaylistLoader_.media();e.stuckAtPlaylistEnd_(t)&&(e.blacklistCurrentPlaylist({message:"Playlist no longer updating."}),e.tech_.trigger("playliststuck"))}),this.masterPlaylistLoader_.on("renditiondisabled",function(){e.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})}),this.masterPlaylistLoader_.on("renditionenabled",function(){e.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})})}},{key:"triggerPresenceUsage_",value:function(e,t){var i=e.mediaGroups||{},n=!0,r=Object.keys(i.AUDIO);for(var a in i.AUDIO)for(var s in i.AUDIO[a]){i.AUDIO[a][s].uri||(n=!1)}n&&this.tech_.trigger({type:"usage",name:"hls-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"}),wh.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"hls-aes"}),wh.Playlist.isFmp4(t)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"}),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"hls-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}},{key:"setupSegmentLoaderListeners_",value:function(){var e=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){var t=e.selectPlaylist(),i=e.masterPlaylistLoader_.media(),n=e.tech_.buffered(),r=n.length?n.end(n.length-1)-e.tech_.currentTime():0,a=e.bufferLowWaterLine();(!i.endList||e.duration()<$d.MAX_BUFFER_LOW_WATER_LINE||t.attributes.BANDWIDTH<i.attributes.BANDWIDTH||r>=a)&&e.masterPlaylistLoader_.media(t),e.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("progress",function(){e.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())}),this.mainSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",function(){e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("ended",function(){e.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",function(){e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)}),this.mainSegmentLoader_.on("reseteverything",function(){e.tech_.trigger("hls-reset")}),this.mainSegmentLoader_.on("segmenttimemapping",function(t){e.tech_.trigger({type:"hls-segment-time-mapping",mapping:t.mapping})}),this.audioSegmentLoader_.on("ended",function(){e.onEndOfStream()})}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}},{key:"smoothQualityChange_",value:function(){var e=this.selectPlaylist();e!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(e),this.mainSegmentLoader_.resetLoader())}},{key:"fastQualityChange_",value:function(){var e=this,t=this.selectPlaylist();t!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(t),this.mainSegmentLoader_.resetEverything(function(){cs.browser.IE_VERSION||cs.browser.IS_EDGE?e.tech_.setCurrentTime(e.tech_.currentTime()+.04):e.tech_.setCurrentTime(e.tech_.currentTime())}))}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.seekTo_(0),this.hasPlayed_()&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.seekTo_(e.end(e.length-1)):void 0}}},{key:"setupFirstPlay",value:function(){var e=this,t=this.masterPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_())return!1;if(!t.endList){var i=this.seekable();if(!i.length)return!1;if(cs.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",function(){e.trigger("firstplay"),e.seekTo_(i.end(0)),e.hasPlayed_=function(){return!0}}),!1;this.trigger("firstplay"),this.seekTo_(i.end(0))}return this.hasPlayed_=function(){return!0},this.load(),!0}},{key:"handleSourceOpen_",value:function(){try{this.setupSourceBuffers_()}catch(e){return cs.log.warn("Failed to create Source Buffers",e),this.mediaSource.endOfStream("decode")}if(this.tech_.autoplay()){var e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,function(e){})}this.trigger("sourceopen")}},{key:"onEndOfStream",value:function(){var e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(e=!this.mainSegmentLoader_.startingMedia_||this.mainSegmentLoader_.startingMedia_.containsVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_),e){this.logger_("calling mediaSource.endOfStream()");try{this.mediaSource.endOfStream()}catch(e){cs.log.warn("Failed to call media source endOfStream",e)}}}},{key:"stuckAtPlaylistEnd_",value:function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.mediaSource.duration);if(null===t)return!1;var i=wh.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-n<=.1;var a=r.end(r.length-1);return a-n<=.1&&i-a<=.1}},{key:"blacklistCurrentPlaylist",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments[1],n=void 0;if(n=t.playlist||this.masterPlaylistLoader_.media(),i=i||t.blacklistDuration||this.blacklistDuration,!n){this.error=t;try{return this.mediaSource.endOfStream("network")}catch(e){return this.trigger("error")}}var r=1===this.masterPlaylistLoader_.master.playlists.filter(Nc).length,a=this.masterPlaylistLoader_.master.playlists;return 1===a.length?(cs.log.warn("Problem encountered with the current HLS playlist. Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(r)):(r&&(cs.log.warn("Removing all playlists from the blacklist because the last rendition is about to be blacklisted."),a.forEach(function(e){e.excludeUntil!==1/0&&delete e.excludeUntil}),this.tech_.trigger("retryplaylist")),n.excludeUntil=Date.now()+1e3*i,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),e=this.selectPlaylist(),cs.log.warn("Problem encountered with the current HLS playlist."+(t.message?" "+t.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(e,r))}},{key:"pauseLoading",value:function(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}},{key:"setCurrentTime",value:function(e){var t=rd(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0}},{key:"duration",value:function(){return this.masterPlaylistLoader_?this.mediaSource?this.mediaSource.duration:wh.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var e=void 0,t=void 0;if(this.masterPlaylistLoader_){var i=this.masterPlaylistLoader_.media();if(i){var n=this.syncController_.getExpiredTime(i,this.mediaSource.duration);if(null!==n&&0!==(e=wh.Playlist.seekable(i,n)).length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(i=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(n=this.syncController_.getExpiredTime(i,this.mediaSource.duration)))return;if(0===(t=wh.Playlist.seekable(i,n)).length)return}var r=void 0,a=void 0;this.seekable_&&this.seekable_.length&&(r=this.seekable_.end(0),a=this.seekable_.start(0)),t?t.start(0)>e.end(0)||e.start(0)>t.end(0)?this.seekable_=e:this.seekable_=cs.createTimeRanges([[t.start(0)>e.start(0)?t.start(0):e.start(0),t.end(0)<e.end(0)?t.end(0):e.end(0)]]):this.seekable_=e,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===r&&this.seekable_.start(0)===a||(this.logger_("seekable updated ["+sd(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}}}},{key:"updateDuration",value:function(){var e=this,t=this.mediaSource.duration,i=wh.Playlist.duration(this.masterPlaylistLoader_.media()),n=this.tech_.buffered(),r=function t(){e.logger_("Setting duration from "+e.mediaSource.duration+" => "+i);try{e.mediaSource.duration=i}catch(e){cs.log.warn("Failed to set media source duration",e)}e.tech_.trigger("durationchange"),e.mediaSource.removeEventListener("sourceopen",t)};n.length>0&&(i=Math.max(i,n.end(n.length-1))),t!==i&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",r):r())}},{key:"dispose",value:function(){var e=this;this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),["AUDIO","SUBTITLES"].forEach(function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach(function(e){e.playlistLoader&&e.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function(){var e,t=this.masterPlaylistLoader_.media();if(t&&"open"===this.mediaSource.readyState){if((e=Pd(this.masterPlaylistLoader_.master,t)).length<1)return this.error="No compatible SourceBuffer configuration for the variant stream:"+t.resolvedUri,this.mediaSource.endOfStream("decode");this.configureLoaderMimeTypes_(e),this.excludeIncompatibleVariants_(t)}}},{key:"configureLoaderMimeTypes_",value:function(e){var t=e.length>1&&-1===e[0].indexOf(",")&&e[0]!==e[1]?new cs.EventTarget:null;this.mainSegmentLoader_.mimeType(e[0],t),e[1]&&this.audioSegmentLoader_.mimeType(e[1],t)}},{key:"excludeUnsupportedVariants_",value:function(){this.master().playlists.forEach(function(t){var i;t.attributes.CODECS&&e.MediaSource&&e.MediaSource.isTypeSupported&&!e.MediaSource.isTypeSupported('video/mp4; codecs="'+(i=t.attributes.CODECS,i.replace(/avc1\.(\d+)\.(\d+)/i,function(e){return Ed([e])[0]}))+'"')&&(t.excludeUntil=1/0)})}},{key:"excludeIncompatibleVariants_",value:function(e){var t=2,i=null,n=void 0;e.attributes.CODECS&&(n=wd(e.attributes.CODECS),i=n.videoCodec,t=n.codecCount),this.master().playlists.forEach(function(e){var n={codecCount:2,videoCodec:null};e.attributes.CODECS&&(n=wd(e.attributes.CODECS)),n.codecCount!==t&&(e.excludeUntil=1/0),n.videoCodec!==i&&(e.excludeUntil=1/0)})}},{key:"updateAdCues_",value:function(t){var i=0,n=this.seekable();n.length&&(i=n.start(0)),function(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t.segments)for(var r=n,a=void 0,s=0;s<t.segments.length;s++){var o=t.segments[s];if(a||(a=dh(i,r+o.duration/2)),a){if("cueIn"in o){a.endTime=r,a.adEndTime=r,r+=o.duration,a=null;continue}if(r<a.endTime){r+=o.duration;continue}a.endTime+=o.duration}else if("cueOut"in o&&((a=new e.VTTCue(r,r+o.duration,o.cueOut)).adStartTime=r,a.adEndTime=r+parseFloat(o.cueOut),i.addCue(a)),"cueOutCont"in o){var u,l,c=o.cueOutCont.split("/").map(parseFloat),d=vc(c,2);u=d[0],l=d[1],(a=new e.VTTCue(r,r+o.duration,"")).adStartTime=r-u,a.adEndTime=a.adStartTime+l,i.addCue(a)}r+=o.duration}}(t,this.cueTagsTrack_,i)}},{key:"goalBufferLength",value:function(){var e=this.tech_.currentTime(),t=$d.GOAL_BUFFER_LENGTH,i=$d.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,$d.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)}},{key:"bufferLowWaterLine",value:function(){var e=this.tech_.currentTime(),t=$d.BUFFER_LOW_WATER_LINE,i=$d.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,$d.MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,n)}}]),i}(cs.EventTarget),Rh=function e(t,i,n){fc(this,e);var r,a,s,o=t.masterPlaylistController_,u=o[(t.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(o);if(i.attributes.RESOLUTION){var l=i.attributes.RESOLUTION;this.width=l.width,this.height=l.height}this.bandwidth=i.attributes.BANDWIDTH,this.id=n,this.enabled=(r=t.playlists,a=i.uri,s=u,function(e){var t=r.master.playlists[a],i=Bc(t),n=Nc(t);return void 0===e?n:(e?delete t.disabled:t.disabled=!0,e===n||i||(s(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})},Lh=["seeking","seeked","pause","playing","error"],Oh=function(){function t(i){var n=this;fc(this,t),this.tech_=i.tech,this.seekable=i.seekable,this.seekTo=i.seekTo,this.allowSeeksWithinUnsafeLiveWindow=i.allowSeeksWithinUnsafeLiveWindow,this.media=i.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=qd("PlaybackWatcher"),this.logger_("initialize");var r=function(){return n.monitorCurrentTime_()},a=function(){return n.techWaiting_()},s=function(){return n.cancelTimer_()},o=function(){return n.fixesBadSeeks_()};this.tech_.on("seekablechanged",o),this.tech_.on("waiting",a),this.tech_.on(Lh,s),this.tech_.on("canplay",r),this.dispose=function(){n.logger_("dispose"),n.tech_.off("seekablechanged",o),n.tech_.off("waiting",a),n.tech_.off(Lh,s),n.tech_.off("canplay",r),n.checkCurrentTimeTimeout_&&e.clearTimeout(n.checkCurrentTimeTimeout_),n.cancelTimer_()}}return pc(t,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&e.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=e.setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"checkCurrentTime_",value:function(){if(this.tech_.seeking()&&this.fixesBadSeeks_())return this.consecutiveUpdates=0,void(this.lastRecordedTime=this.tech_.currentTime());if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+.1>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null}},{key:"fixesBadSeeks_",value:function(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime(),i=void 0;this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(i=e.end(e.length-1));this.beforeSeekableWindow_(e,t)&&(i=e.start(0)+.1);return void 0!==i&&(this.logger_("Trying to seek outside of seekable at time "+t+" with seekable range "+sd(e)+". Seeking to "+i+"."),this.seekTo(i),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),i=rd(t,e);return i.length&&e+3<=i.end(0)?(this.cancelTimer_(),this.seekTo(e),this.logger_("Stopped at "+e+" while inside a buffered region ["+i.start(0)+" -> "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.seekTo(i),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.buffered(),r=ad(n,t);if(this.videoUnderflow_(r,n,t))return this.cancelTimer_(),this.seekTo(t),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;if(r.length>0){var a=r.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+a+", seeking to "+r.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*a,t),!0}return!1}},{key:"afterSeekableWindow_",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!e.length)return!1;var r=e.end(e.length-1)+.1;return!i.endList&&n&&(r=e.end(e.length-1)+3*i.targetDuration),t>r}},{key:"beforeSeekableWindow_",value:function(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-.1)}},{key:"videoUnderflow_",value:function(e,t,i){if(0===e.length){var n=this.gapFromVideoUnderflow_(t,i);if(n)return this.logger_("Encountered a gap in video from "+n.start+" to "+n.end+". Seeking to current time "+i),!0}return!1}},{key:"skipTheGap_",value:function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),n=ad(t,i);this.cancelTimer_(),0!==n.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.seekTo(n.start(0)+1/30),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))}},{key:"gapFromVideoUnderflow_",value:function(e,t){for(var i=function(e){if(e.length<2)return cs.createTimeRanges();for(var t=[],i=1;i<e.length;i++){var n=e.end(i-1),r=e.start(i);t.push([n,r])}return cs.createTimeRanges(t)}(e),n=0;n<i.length;n++){var r=i.start(n),a=i.end(n);if(t-r<4&&t-r>2)return{start:r,end:a}}return null}}]),t}(),Ih={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}},xh=function(e){!function e(t,i){var n=0,r=0,a=cs.mergeOptions(Ih,i);t.ready(function(){t.trigger({type:"usage",name:"hls-error-reload-initialized"})});var s=function(){r&&t.currentTime(r)},o=function(e){null!==e&&void 0!==e&&(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())},u=function(){if(Date.now()-n<1e3*a.errorInterval)t.trigger({type:"usage",name:"hls-error-reload-canceled"});else{if(a.getSource&&"function"==typeof a.getSource)return n=Date.now(),a.getSource.call(t,o);cs.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},l=function e(){t.off("loadedmetadata",s),t.off("error",u),t.off("dispose",e)};t.on("error",u),t.on("dispose",l),t.reloadSourceOnError=function(i){l(),e(t,i)}}(this,e)};cs.use("*",function(e){return{setSource:function(e,t){t(null,e)},setCurrentTime:function(t){return e.vhs&&e.currentSource().src===e.vhs.source_.src&&e.vhs.setCurrentTime(t),t},play:function(){e.vhs&&e.currentSource().src===e.vhs.source_.src&&e.vhs.setCurrentTime(e.tech_.currentTime())}}});var Dh={PlaylistLoader:Cc,Playlist:Gc,Decrypter:cc,AsyncStream:oc,decrypt:lc,utils:ed,STANDARD_PLAYLIST_SELECTOR:function(){return function(t,i,n,r,a){var s=t.playlists.map(function(t){var i,n;return i=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width,n=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height,{bandwidth:t.attributes.BANDWIDTH||e.Number.MAX_VALUE,width:i,height:n,playlist:t}});rh(s,function(e,t){return e.bandwidth-t.bandwidth});var o=(s=s.filter(function(e){return!Gc.isIncompatible(e.playlist)})).filter(function(e){return Gc.isEnabled(e.playlist)});o.length||(o=s.filter(function(e){return!Gc.isDisabled(e.playlist)}));var u=o.filter(function(e){return e.bandwidth*$d.BANDWIDTH_VARIANCE<i}),l=u[u.length-1],c=u.filter(function(e){return e.bandwidth===l.bandwidth})[0];if(!1===a){var d=c||o[0]||s[0];return d?d.playlist:null}var h=u.filter(function(e){return e.width&&e.height});rh(h,function(e,t){return e.width-t.width});var f=h.filter(function(e){return e.width===n&&e.height===r});l=f[f.length-1];var p=f.filter(function(e){return e.bandwidth===l.bandwidth})[0],m=void 0,g=void 0,v=void 0;p||(g=(m=h.filter(function(e){return e.width>n||e.height>r})).filter(function(e){return e.width===m[0].width&&e.height===m[0].height}),l=g[g.length-1],v=g.filter(function(e){return e.bandwidth===l.bandwidth})[0]);var y=v||p||c||o[0]||s[0];return y?y.playlist:null}(this.playlists.master,this.systemBandwidth,parseInt(nh(this.tech_.el(),"width"),10),parseInt(nh(this.tech_.el(),"height"),10),this.limitRenditionByPlayerDimensions)},INITIAL_PLAYLIST_SELECTOR:function(){var e=this.playlists.master.playlists.filter(Gc.isEnabled);return rh(e,function(e,t){return ah(e,t)}),e.filter(function(e){return wd(e.attributes.CODECS).videoCodec})[0]||null},comparePlaylistBandwidth:ah,comparePlaylistResolution:function(t,i){var n=void 0,r=void 0;return t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),n=n||e.Number.MAX_VALUE,i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(r=i.attributes.RESOLUTION.width),n===(r=r||e.Number.MAX_VALUE)&&t.attributes.BANDWIDTH&&i.attributes.BANDWIDTH?t.attributes.BANDWIDTH-i.attributes.BANDWIDTH:n-r},xhr:qc()};["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(Dh,e,{get:function(){return cs.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),$d[e]},set:function(t){cs.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?cs.log.warn("value of Hls."+e+" must be greater than or equal to 0"):$d[e]=t}})});var Mh=function(e){if(/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e))return"hls";return/^application\/dash\+xml/i.test(e)?"dash":null},Uh=function(e,t){for(var i=t.media(),n=-1,r=0;r<e.length;r++)if(e[r].id===i.uri){n=r;break}e.selectedIndex_=n,e.trigger({selectedIndex:n,type:"change"})};Dh.canPlaySource=function(){return cs.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var jh=function(e){if("dash"===e.options_.sourceType){var t=cs.players[e.tech_.options_.playerId];if(t.eme){var i=function(e,t,i){if(!e)return e;var n={};for(var r in e)n[r]={audioContentType:'audio/mp4; codecs="'+i.attributes.CODECS+'"',videoContentType:'video/mp4; codecs="'+t.attributes.CODECS+'"'},t.contentProtection&&t.contentProtection[r]&&t.contentProtection[r].pssh&&(n[r].pssh=t.contentProtection[r].pssh),"string"==typeof e[r]&&(n[r].url=e[r]);return cs.mergeOptions(e,n)}(e.source_.keySystems,e.playlists.media(),e.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader.media());i&&(t.currentSource().keySystems=i,t.eme.initializeMediaKeys&&t.eme.initializeMediaKeys())}}},Bh=function(){if(!window.localStorage)return null;var e=window.localStorage.getItem("videojs-vhs");if(!e)return null;try{return JSON.parse(e)}catch(e){return null}};Dh.supportsNativeHls=function(){var e=t.createElement("video");if(!cs.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))})}(),Dh.supportsNativeDash=!!cs.getTech("Html5").isSupported()&&/maybe|probably/i.test(t.createElement("video").canPlayType("application/dash+xml")),Dh.supportsTypeNatively=function(e){return"hls"===e?Dh.supportsNativeHls:"dash"===e&&Dh.supportsNativeDash},Dh.isSupported=function(){return cs.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var Nh=cs.getComponent("Component"),Fh=function(e){function i(e,n,r){fc(this,i);var a=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,n,r.hls));if(n.options_&&n.options_.playerId){var s=cs(n.options_.playerId);s.hasOwnProperty("hls")||Object.defineProperty(s,"hls",{get:function(){return cs.log.warn("player.hls is deprecated. Use player.tech().hls instead."),n.trigger({type:"usage",name:"hls-player-access"}),a},configurable:!0}),s.vhs=a,s.dash=a,a.player_=s}if(a.tech_=n,a.source_=e,a.stats={},a.setOptions_(),a.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(a.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return a.on(t,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(e){var i=t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement;i&&i.contains(a.tech_.el())&&a.masterPlaylistController_.smoothQualityChange_()}),a.on(a.tech_,"seeking",function(){0===this.tech_.currentTime()&&this.tech_.player_.loop()&&this.setCurrentTime(0)}),a.on(a.tech_,"error",function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()}),a.on(a.tech_,"play",a.play),a}return mc(i,Nh),pc(i,[{key:"setOptions_",value:function(){var e=this;if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.handleManifestRedirects=this.options_.handleManifestRedirects||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){var t=Bh();t&&t.bandwidth&&(this.options_.bandwidth=t.bandwidth,this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})),t&&t.throughput&&(this.options_.throughput=t.throughput,this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=$d.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===$d.INITIAL_BANDWIDTH,["withCredentials","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys"].forEach(function(t){void 0!==e.source_[t]&&(e.options_[t]=e.source_[t])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions}},{key:"src",value:function(e,t){var i=this;e&&(this.setOptions_(),this.options_.url=this.source_.src,this.options_.tech=this.tech_,this.options_.externHls=Dh,this.options_.sourceType=Mh(t),this.options_.seekTo=function(e){i.tech_.setCurrentTime(e),i.setCurrentTime(e)},this.masterPlaylistController_=new Ah(this.options_),this.playbackWatcher_=new Oh(cs.mergeOptions(this.options_,{seekable:function(){return i.seekable()},media:function(){return i.masterPlaylistController_.media()}})),this.masterPlaylistController_.on("error",function(){cs.players[i.tech_.options_.playerId].error(i.masterPlaylistController_.error)}),this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):Dh.STANDARD_PLAYLIST_SELECTOR.bind(this),this.masterPlaylistController_.selectInitialPlaylist=Dh.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;return t=this.throughput>0?1/this.throughput:0,Math.floor(1/(e+t))},set:function(){cs.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return od(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return od(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(!window.localStorage)return!1;var t=Bh();t=t?cs.mergeOptions(t,e):e;try{window.localStorage.setItem("videojs-vhs",JSON.stringify(t))}catch(e){return!1}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})}),this.masterPlaylistController_.on("selectedinitialmedia",function(){var e,t;t=(e=i).playlists,e.representations=function(){return t.master.playlists.filter(function(e){return!Bc(e)}).map(function(t,i){return new Rh(e,t,t.uri)})},jh(i)}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.tech_.ready(function(){return i.setupQualityLevels_()}),this.tech_.el()&&this.tech_.src(cs.URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"setupQualityLevels_",value:function(){var e=this,t=cs.players[this.tech_.options_.playerId];t&&t.qualityLevels&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",function(){var t,i;t=e.qualityLevels_,(i=e).representations().forEach(function(e){t.addQualityLevel(e)}),Uh(t,i.playlists)}),this.playlists.on("mediachange",function(){Uh(e.qualityLevels_,e.playlists)}))}},{key:"play",value:function(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function(e){this.masterPlaylistController_.setCurrentTime(e)}},{key:"duration",value:function(){return this.masterPlaylistController_.duration()}},{key:"seekable",value:function(){return this.masterPlaylistController_.seekable()}},{key:"dispose",value:function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.hls&&delete this.tech_.hls,function e(t,i,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,i);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0}(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"dispose",this).call(this)}},{key:"convertToProgramTime",value:function(e,t){return td({playlist:this.masterPlaylistController_.media(),time:e,callback:t})}},{key:"seekToProgramTime",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return id({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}]),i}(),Vh={name:"videojs-http-streaming",VERSION:"1.10.3",canHandleSource:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=cs.mergeOptions(cs.options,t);return Vh.canPlayType(e.type,i)},handleSource:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=cs.mergeOptions(cs.options,i);return t.hls=new Fh(e,t,n),t.hls.xhr=qc(),t.hls.src(e.src,e.type),t.hls},canPlayType:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=cs.mergeOptions(cs.options,t).hls.overrideNative,n=Mh(e);return n&&(!Dh.supportsTypeNatively(n)||i)?"maybe":""}};return void 0!==cs.MediaSource&&void 0!==cs.URL||(cs.MediaSource=Ud,cs.URL=jd),Ud.supportsNativeMediaSources()&&cs.getTech("Html5").registerSourceHandler(Vh,0),cs.HlsHandler=Fh,cs.HlsSourceHandler=Vh,cs.Hls=Dh,cs.use||cs.registerComponent("Hls",Dh),cs.options.hls=cs.options.hls||{},cs.registerPlugin?cs.registerPlugin("reloadSourceOnError",xh):cs.plugin("reloadSourceOnError",xh),cs}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):e.videojsSnapshot=t(e.videojs)}(this,function(e){"use strict";e="default"in e?e.default:e;var t,i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};return function(t){var n,r;n=i,r=function(e){var t,i,n={},r=e.registerPlugin||e.plugin,a=e.getComponent("Component"),s=e.getComponent("Button");e.SnapshoterBaseComponent=e.extend(a,{constructor:function(e,t){a.call(this,e,t)},dispose:function(){}}),e.SnapshoterComponent=e.extend(e.SnapshoterBaseComponent,{constructor:function(t,i){a.call(this,t,i),this.loadOptions(),this.resetState(),this.player().one("ready",this.setupUI.bind(this));var n=e.ImageCaptureEngine;try{this.engine=new n(this.player())}catch(t){throw new Error("Could not load "+e.ImageCaptureEngine+" plugin")}},loadOptions:function(){},setupUI:function(){for(var e=this.player().controlBar.children().length,t=e-1;t>=0;t--)if("FullscreenToggle"==this.player().controlBar.children()[t].name_){e=t;break}this.player().controlBar.addChild(this.player().cameraButton,{},e),this.player().options_.controls&&(this.player().controlBar.show(),this.player().controlBar.el().style.display="flex")},isSnapshoting:function(){return this._snapshoting},isProcessing:function(){return this._processing},isDestroyed:function(){return this.player()&&null===this.player().children()},start:function(){this.isProcessing()||(this._snapshoting=!0,this._processing=!0,this.player().controlBar.playToggle.hide(),this.createSnapshot())},stop:function(){this.isProcessing()&&(this._snapshoting=!1,this._processing=!1),this.player().controlBar.playToggle.show()},destroy:function(){this.stop(),this.player().dispose(),this.resetState()},reset:function(){this.stop(),this.loadOptions(),this.resetState(),this.player().reset(),this.player().snapshotCanvas.hide(),this.player().cameraButton.hide()},resetState:function(){this._snapshoting=!1,this._processing=!1},createSnapshot:function(){var e=this;this.captureFrame().then(function(t){e.player().trigger("snap",t),e.stop()}).catch(function(t){console.log(t),e.player().trigger("snap",""),e.stop()})},retrySnapshot:function(){this._processing=!1,this.player().snapshotCanvas.hide()},captureFrame:function(){var e=this,t=this.player().snapshotCanvas.el().firstChild;return t.width=this.player().videoWidth(),t.height=this.player().videoHeight(),new Promise(function(i,n){try{return i(e.engine.imageCaptureByIdAndCanvasDom(e.player().id(),t))}catch(e){return n(e)}})}}),i=e.extend(a),(t=e.extend(s,{constructor:function(e,t){s.call(this,e,t),this.on("click",this.onClick),this.on("tap",this.onClick)}})).prototype.onClick=function(e){e.stopImmediatePropagation();var t=this.player().snapshoter;t.isProcessing()?(t.retrySnapshot(),this.onStop()):t.start()},t.prototype.onStart=function(){this.removeClass("vjs-icon-photo-camera"),this.addClass("vjs-icon-photo-retry"),this.el().firstChild.firstChild.innerHTML=this.localize("Retry")},t.prototype.onStop=function(){this.removeClass("vjs-icon-photo-retry"),this.addClass("vjs-icon-photo-camera"),this.el().firstChild.firstChild.innerHTML=this.localize("Image")};var o=function(r){var s,o,u=this,l=e.mergeOptions(n,r),c=this;c.ready(function(){var t;t=u,e.mergeOptions(n,r),t.addClass("vjs-snapshot")}),c.on("play",function(){try{c.tech_.el_.setAttribute("crossorigin","anonymous")}catch(e){}}),c.snapshoter=new e.SnapshoterComponent(this,{options:l}),c.addChild(c.snapshoter),c.snapshotCanvas=new i(c,{el:(s="snapshot",o={className:"vjs-"+s+"-canvas",innerHTML:"<canvas></canvas>"},a.prototype.createEl("div",o))}),c.snapshotCanvas.hide(),c.snapshoter.addChild(c.snapshotCanvas),c.cameraButton=new t(c,{el:function(e,t,i){var n={className:"vjs-"+e+"-control vjs-control vjs-button",innerHTML:'<span aria-hidden="true" class="vjs-icon-'+i+'"></span><span class="vjs-control-text" aria-live="polite">'+t+"</span>"},r={title:t,type:"button","aria-disabled":"false"};return a.prototype.createEl("button",n,r)}("snapshot",c.localize("Snapshot"),"spinner"),name:"SnapButton"}),c.cameraButton.show()};return r("snapshot",o),o},t.exports?t.exports=r(e):n.returnExports=r(n.videojs),function(i,n){t.exports?t.exports=n(e):i.returnExports=n(i.videojs)}(i,function(e){var t=e.getComponent("Component");e.ImageCaptureEngine=e.extend(t,{constructor:function(e,i){t.call(this,e,i)},formatTag:function(e){if(e&&0!==(e=e.trim()).length)return e},getDomByIdAndTag:function(e,t){t=this.formatTag(t);var i=document.getElementById(e);if(t&&0!==t.trim().length)return i.tagName.toUpperCase()===t.toUpperCase()?i:i.getElementsByTagName(t)[0]},getScreenContainerDomByIdAndTag:function(e,t){if(t=this.formatTag(t))return this.getDomByIdAndTag(e,t);var i=this.getDomByIdAndTag(e,"object");return i||this.getDomByIdAndTag(e,"video")},drawCanvas:function(e,t){e.width=t.videoWidth,e.height=t.videoHeight,e.getContext("2d").drawImage(t,0,0,e.width,e.height)},imageCaptureByDom:function(e,t){var i;return e&&e.tagName.toUpperCase()==="object".toUpperCase()?i=e.vjs_snap():(this.drawCanvas(t,e),i=t.toDataURL("image/png")),i},imageCaptureById:function(e,t){return this.imageCaptureByDom(this.getScreenContainerDomByIdAndTag(e),this.getDomByIdAndTag(t,"canvas"))},imageCaptureByIdAndCanvasDom:function(e,t){return this.imageCaptureByDom(this.getScreenContainerDomByIdAndTag(e),t)}})})}(t={exports:{}},t.exports),t.exports}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).flvjs=e()}}(function(){return function(){return function e(t,i,n){function r(s,o){if(!i[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[s]={exports:{}};t[s][0].call(c.exports,function(e){return r(t[s][1][e]||e)},c,c.exports,e,t,i,n)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}}()({1:[function(e,t,i){(function(n,r){!function(e,n){"object"==typeof i&&void 0!==t?t.exports=n():e.ES6Promise=n()}(this,function(){"use strict";function t(e){return"function"==typeof e}var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=0,s=void 0,o=void 0,u=function(e,t){m[a]=e,m[a+1]=t,2===(a+=2)&&(o?o(g):T())};var l="undefined"!=typeof window?window:void 0,c=l||{},d=c.MutationObserver||c.WebKitMutationObserver,h="undefined"==typeof self&&void 0!==n&&"[object process]"==={}.toString.call(n),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(g,1)}}var m=new Array(1e3);function g(){for(var e=0;e<a;e+=2){(0,m[e])(m[e+1]),m[e]=void 0,m[e+1]=void 0}a=0}var v,y,_,b,T=void 0;function S(e,t){var i=this,n=new this.constructor(w);void 0===n[E]&&F(n);var r=i._state;if(r){var a=arguments[r-1];u(function(){return B(r,n,a,i._result)})}else U(i,n,e,t);return n}function k(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(w);return I(t,e),t}h?T=function(){return n.nextTick(g)}:d?(y=0,_=new d(g),b=document.createTextNode(""),_.observe(b,{characterData:!0}),T=function(){b.data=y=++y%2}):f?((v=new MessageChannel).port1.onmessage=g,T=function(){return v.port2.postMessage(0)}):T=void 0===l&&"function"==typeof e?function(){try{var e=Function("return this")().require("vertx");return void 0!==(s=e.runOnLoop||e.runOnContext)?function(){s(g)}:p()}catch(e){return p()}}():p();var E=Math.random().toString(36).substring(2);function w(){}var C=void 0,P=1,A=2,R={error:null};function L(e){try{return e.then}catch(e){return R.error=e,R}}function O(e,i,n){i.constructor===e.constructor&&n===S&&i.constructor.resolve===k?function(e,t){t._state===P?D(e,t._result):t._state===A?M(e,t._result):U(t,void 0,function(t){return I(e,t)},function(t){return M(e,t)})}(e,i):n===R?(M(e,R.error),R.error=null):void 0===n?D(e,i):t(n)?function(e,t,i){u(function(e){var n=!1,r=function(e,t,i,n){try{e.call(t,i,n)}catch(e){return e}}(i,t,function(i){n||(n=!0,t!==i?I(e,i):D(e,i))},function(t){n||(n=!0,M(e,t))},e._label);!n&&r&&(n=!0,M(e,r))},e)}(e,i,n):D(e,i)}function I(e,t){var i,n;e===t?M(e,new TypeError("You cannot resolve a promise with itself")):(n=typeof(i=t),null===i||"object"!==n&&"function"!==n?D(e,t):O(e,t,L(t)))}function x(e){e._onerror&&e._onerror(e._result),j(e)}function D(e,t){e._state===C&&(e._result=t,e._state=P,0!==e._subscribers.length&&u(j,e))}function M(e,t){e._state===C&&(e._state=A,e._result=t,u(x,e))}function U(e,t,i,n){var r=e._subscribers,a=r.length;e._onerror=null,r[a]=t,r[a+P]=i,r[a+A]=n,0===a&&e._state&&u(j,e)}function j(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var n=void 0,r=void 0,a=e._result,s=0;s<t.length;s+=3)n=t[s],r=t[s+i],n?B(i,n,r,a):r(a);e._subscribers.length=0}}function B(e,i,n,r){var a=t(n),s=void 0,o=void 0,u=void 0,l=void 0;if(a){if((s=function(e,t){try{return e(t)}catch(e){return R.error=e,R}}(n,r))===R?(l=!0,o=s.error,s.error=null):u=!0,i===s)return void M(i,new TypeError("A promises callback cannot return that same promise."))}else s=r,u=!0;i._state!==C||(a&&u?I(i,s):l?M(i,o):e===P?D(i,s):e===A&&M(i,s))}var N=0;function F(e){e[E]=N++,e._state=void 0,e._result=void 0,e._subscribers=[]}var V=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(w),this.promise[E]||F(this.promise),i(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?D(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&D(this.promise,this._result))):M(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===C&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,n=i.resolve;if(n===k){var r=L(e);if(r===S&&e._state!==C)this._settledAt(e._state,t,e._result);else if("function"!=typeof r)this._remaining--,this._result[t]=e;else if(i===G){var a=new i(w);O(a,e,r),this._willSettleAt(a,t)}else this._willSettleAt(new i(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},e.prototype._settledAt=function(e,t,i){var n=this.promise;n._state===C&&(this._remaining--,e===A?M(n,i):this._result[t]=i),0===this._remaining&&D(n,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;U(e,void 0,function(e){return i._settledAt(P,t,e)},function(e){return i._settledAt(A,t,e)})},e}();var G=function(){function e(t){this[E]=N++,this._result=this._state=void 0,this._subscribers=[],w!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){I(e,t)},function(t){M(e,t)})}catch(t){M(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var i=this.constructor;return t(e)?this.then(function(t){return i.resolve(e()).then(function(){return t})},function(t){return i.resolve(e()).then(function(){throw t})}):this.then(e,e)},e}();return G.prototype.then=S,G.all=function(e){return new V(this,e).promise},G.race=function(e){var t=this;return i(e)?new t(function(i,n){for(var r=e.length,a=0;a<r;a++)t.resolve(e[a]).then(i,n)}):new t(function(e,t){return t(new TypeError("You must pass an array to race."))})},G.resolve=k,G.reject=function(e){var t=new this(w);return M(t,e),t},G._setScheduler=function(e){o=e},G._setAsap=function(e){u=e},G._asap=u,G.polyfill=function(){var e=void 0;if(void 0!==r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var i=null;try{i=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===i&&!t.cast)return}e.Promise=G},G.Promise=G,G})}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],2:[function(e,t,i){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,i,n,o,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(s(i=this._events[e]))return!1;if(r(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),i.apply(this,o)}else if(a(i))for(o=Array.prototype.slice.call(arguments,1),n=(l=i.slice()).length,u=0;u<n;u++)l[u].apply(this,o);return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(i=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var i=!1;function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var i,n,s,o;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(i=this._events[e]).length,n=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(i)){for(o=s;o-- >0;)if(i[o]===t||i[o].listener&&i[o].listener===t){n=o;break}if(n<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(i=this._events[e]))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},{}],3:[function(e,t,i){var n,r,a=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var l,c=[],d=!1,h=-1;function f(){d&&l&&(d=!1,l.length?c=l.concat(c):h=-1,c.length&&p())}function p(){if(!d){var e=u(f);d=!0;for(var t=c.length;t;){for(l=c,c=[];++h<t;)l&&l[h].run();h=-1,t=c.length}l=null,d=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function g(){}a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];c.push(new m(e,t)),1!==c.length||d||u(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=g,a.addListener=g,a.once=g,a.off=g,a.removeListener=g,a.removeAllListeners=g,a.emit=g,a.prependListener=g,a.prependOnceListener=g,a.listeners=function(e){return[]},a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],4:[function(e,t,i){var n=arguments[3],r=arguments[4],a=arguments[5],s=JSON.stringify;t.exports=function(e,t){for(var i,o=Object.keys(a),u=0,l=o.length;u<l;u++){var c=o[u],d=a[c].exports;if(d===e||d&&d.default===e){i=c;break}}if(!i){i=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var h={};for(u=0,l=o.length;u<l;u++){h[c=o[u]]=c}r[i]=["function(require,module,exports){"+e+"(self); }",h]}var f=Math.floor(Math.pow(16,8)*Math.random()).toString(16),p={};p[i]=i,r[f]=["function(require,module,exports){var f = require("+s(i)+");(f.default ? f.default : f)(self);}",p];var m={};!function e(t){m[t]=!0;for(var i in r[t][1]){var n=r[t][1][i];m[n]||e(n)}}(f);var g="("+n+")({"+Object.keys(m).map(function(e){return s(e)+":["+r[e][0]+","+s(r[e][1])+"]"}).join(",")+"},{},["+s(f)+"])",v=window.URL||window.webkitURL||window.mozURL||window.msURL,y=new Blob([g],{type:"text/javascript"});if(t&&t.bare)return y;var _=v.createObjectURL(y),b=new Worker(_);return b.objectURL=_,b}},{}],5:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.createDefaultConfig=function(){return Object.assign({},n)};var n=i.defaultConfig={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0}},{}],6:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n,r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=e("../io/io-controller.js"),s=(n=a)&&n.__esModule?n:{default:n},o=e("../config.js");var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"supportMSEH264Playback",value:function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"supportNetworkStreamIO",value:function(){var e=new s.default({},(0,o.createDefaultConfig)()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t}},{key:"getNetworkLoaderTypeName",value:function(){var e=new s.default({},(0,o.createDefaultConfig)()),t=e.loaderType;return e.destroy(),t}},{key:"supportNativeMediaPlayback",value:function(t){void 0==e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"==i}},{key:"getFeatureList",value:function(){var t={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.mseFlvPlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLiveFlvPlayback=t.mseFlvPlayback&&t.networkStreamIO,t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeMP4H265Playback=e.supportNativeMediaPlayback('video/mp4; codecs="hvc1.1.6.L93.B0, mp4a.40.2"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t}}]),e}();i.default=u},{"../config.js":5,"../io/io-controller.js":23}],7:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return n(e,[{key:"isComplete",value:function(){var e=!1===this.hasAudio||!0===this.hasAudio&&this.audioCodec,t=!1===this.hasVideo||!0===this.hasVideo&&this.videoCodec;return e&&t}},{key:"isSeekable",value:function(){return!0===this.hasKeyframesIndex}},{key:"getNearestKeyframe",value:function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}}},{key:"_search",value:function(e,t){var i=0,n=e.length-1,r=0,a=0,s=n;for(t<e[0]&&(i=0,a=s+1);a<=s;){if((r=a+Math.floor((s-a)/2))===n||t>=e[r]&&t<e[r+1]){i=r;break}e[r]<t?a=r+1:s=r-1}return i}}]),e}();i.default=r},{}],8:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}i.SampleInfo=function e(t,i,n,a,s){r(this,e),this.dts=t,this.pts=i,this.duration=n,this.originalDts=a,this.isSyncPoint=s,this.fileposition=null},i.MediaSegmentInfo=function(){function e(){r(this,e),this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return n(e,[{key:"appendSyncPoint",value:function(e){e.isSyncPoint=!0,this.syncPoints.push(e)}}]),e}(),i.IDRSampleList=function(){function e(){r(this,e),this._list=[]}return n(e,[{key:"clear",value:function(){this._list=[]}},{key:"appendArray",value:function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))}},{key:"getLastSyncPointBeforeDts",value:function(e){if(0==this._list.length)return null;var t=this._list,i=0,n=t.length-1,r=0,a=0,s=n;for(e<t[0].dts&&(i=0,a=s+1);a<=s;){if((r=a+Math.floor((s-a)/2))===n||e>=t[r].dts&&e<t[r+1].dts){i=r;break}t[r].dts<e?a=r+1:s=r-1}return this._list[i]}}]),e}(),i.MediaSegmentInfoList=function(){function e(t){r(this,e),this._type=t,this._list=[],this._lastAppendLocation=-1}return n(e,[{key:"isEmpty",value:function(){return 0===this._list.length}},{key:"clear",value:function(){this._list=[],this._lastAppendLocation=-1}},{key:"_searchNearestSegmentBefore",value:function(e){var t=this._list;if(0===t.length)return-2;var i=t.length-1,n=0,r=0,a=i,s=0;if(e<t[0].originalBeginDts)return s=-1;for(;r<=a;){if((n=r+Math.floor((a-r)/2))===i||e>t[n].lastSample.originalDts&&e<t[n+1].originalBeginDts){s=n;break}t[n].originalBeginDts<e?r=n+1:a=n-1}return s}},{key:"_searchNearestSegmentAfter",value:function(e){return this._searchNearestSegmentBefore(e)+1}},{key:"append",value:function(e){var t=this._list,i=e,n=this._lastAppendLocation,r=0;-1!==n&&n<t.length&&i.originalBeginDts>=t[n].lastSample.originalDts&&(n===t.length-1||n<t.length-1&&i.originalBeginDts<t[n+1].originalBeginDts)?r=n+1:t.length>0&&(r=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=r,this._list.splice(r,0,i)}},{key:"getLastSegmentBefore",value:function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null}},{key:"getLastSampleBefore",value:function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null}},{key:"getLastSyncPointBefore",value:function(e){for(var t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null}},{key:"type",get:function(){return this._type}},{key:"length",get:function(){return this._list.length}}]),e}()},{}],9:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=c(e("events")),a=c(e("../utils/logger.js")),s=c(e("../utils/browser.js")),o=c(e("./mse-events.js")),u=e("./media-segment-info.js"),l=e("../utils/exception.js");function c(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="MSEController",this._config=t,this._emitter=new r.default,this._config.isLive&&void 0==this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new u.IDRSampleList}return n(e,[{key:"destroy",value:function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter&&this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"attachMediaElement",value:function(e){if(this._mediaSource)throw new l.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");var t=this._mediaSource=new window.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL}},{key:"detachMediaElement",value:function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var n=this._sourceBuffers[t];if(n){if("closed"!==e.readyState){try{e.removeSourceBuffer(n)}catch(e){a.default.e(this.TAG,e.message)}n.removeEventListener("error",this.e.onSourceBufferError),n.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){a.default.e(this.TAG,e.message)}e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)}},{key:"appendInitSegment",value:function(e,t){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var i=e,n=""+i.container;i.codec&&i.codec.length>0&&(n+=";codecs="+i.codec);var r=!1;if(a.default.v(this.TAG,"Received Initialization Segment, mimeType: "+n),this._lastInitSegments[i.type]=i,n!==this._mimeTypes[i.type]){if(this._mimeTypes[i.type])a.default.v(this.TAG,"Notice: "+i.type+" mimeType changed, origin: "+this._mimeTypes[i.type]+", target: "+n);else{r=!0;try{var u=this._sourceBuffers[i.type]=this._mediaSource.addSourceBuffer(n);u.addEventListener("error",this.e.onSourceBufferError),u.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return a.default.e(this.TAG,e.message),void this._emitter.emit(o.default.ERROR,{code:e.code,msg:e.message})}}this._mimeTypes[i.type]=n}t||this._pendingSegments[i.type].push(i),r||this._sourceBuffers[i.type]&&!this._sourceBuffers[i.type].updating&&this._doAppendSegments(),s.default.safari&&"audio/mpeg"===i.container&&i.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=i.mediaDuration/1e3,this._updateMediaSourceDuration())}},{key:"appendMediaSegment",value:function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()}},{key:"seek",value:function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var i=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{i.abort()}catch(e){a.default.e(this.TAG,e.message)}this._idrList.clear();var n=this._pendingSegments[t];if(n.splice(0,n.length),"closed"!==this._mediaSource.readyState){for(var r=0;r<i.buffered.length;r++){var o=i.buffered.start(r),u=i.buffered.end(r);this._pendingRemoveRanges[t].push({start:o,end:u})}if(i.updating||this._doRemoveRanges(),s.default.safari){var l=this._lastInitSegments[t];l&&(this._pendingSegments[t].push(l),i.updating||this._doAppendSegments())}}}}},{key:"endOfStream",value:function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)}},{key:"getNearestKeyframe",value:function(e){return this._idrList.getLastSyncPointBeforeDts(e)}},{key:"_needCleanupSourceBuffer",value:function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){var n=i.buffered;if(n.length>=1&&e-n.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1}},{key:"_doCleanupSourceBuffer",value:function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){for(var n=i.buffered,r=!1,a=0;a<n.length;a++){var s=n.start(a),o=n.end(a);if(s<=e&&e<o+3){if(e-s>=this._config.autoCleanupMaxBackwardDuration){r=!0;var u=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:s,end:u})}}else o<e&&(r=!0,this._pendingRemoveRanges[t].push({start:s,end:o}))}r&&!i.updating&&this._doRemoveRanges()}}}},{key:"_updateMediaSourceDuration",value:function(){var e=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,i=this._pendingMediaDuration;i>0&&(isNaN(t)||i>t)&&(a.default.v(this.TAG,"Update MediaSource duration from "+t+" to "+i),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}}},{key:"_doRemoveRanges",value:function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];i.length&&!t.updating;){var n=i.shift();t.remove(n.start,n.end)}}},{key:"_doAppendSegments",value:function(){var e=this._pendingSegments;for(var t in e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&e[t].length>0){var i=e[t].shift();if(i.timestampOffset){var n=this._sourceBuffers[t].timestampOffset,r=i.timestampOffset/1e3;Math.abs(n-r)>.1&&(a.default.v(this.TAG,"Update MPEG audio timestampOffset from "+n+" to "+r),this._sourceBuffers[t].timestampOffset=r),delete i.timestampOffset}if(!i.data||0===i.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(i.data),this._isBufferFull=!1,"video"===t&&i.hasOwnProperty("info")&&this._idrList.appendArray(i.info.syncPoints)}catch(e){this._pendingSegments[t].unshift(i),22===e.code?(this._isBufferFull||this._emitter.emit(o.default.BUFFER_FULL),this._isBufferFull=!0):(a.default.e(this.TAG,t,e.message),this._emitter.emit(o.default.ERROR,{code:e.code,msg:e.message}))}}}},{key:"_onSourceOpen",value:function(){if(a.default.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(o.default.SOURCE_OPEN)}},{key:"_onSourceEnded",value:function(){a.default.v(this.TAG,"MediaSource onSourceEnded")}},{key:"_onSourceClose",value:function(){a.default.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))}},{key:"_hasPendingSegments",value:function(){var e=this._pendingSegments;return e.video&&e.video.length>0||e.audio&&e.audio.length>0}},{key:"_hasPendingRemoveRanges",value:function(){var e=this._pendingRemoveRanges;return e.video&&e.video.length>0||e.audio&&e.audio.length>0}},{key:"_onSourceBufferUpdateEnd",value:function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(o.default.UPDATE_END)}},{key:"_onSourceBufferError",value:function(e){a.default.e(this.TAG,"SourceBuffer Error: "+e)}}]),e}();i.default=d},{"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./media-segment-info.js":8,"./mse-events.js":10,events:2}],10:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.default={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"}},{}],11:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=d(e("events")),a=d(e("../utils/logger.js")),s=d(e("../utils/logging-control.js")),o=d(e("./transmuxing-controller.js")),u=d(e("./transmuxing-events.js")),l=d(e("./transmuxing-worker.js")),c=d(e("./media-info.js"));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(){function t(i,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.TAG="Transmuxer",this._emitter=new r.default,n.enableWorker&&"undefined"!=typeof Worker)try{var c=e("webworkify");this._worker=c(l.default),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[i,n]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},s.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:s.default.getConfig()})}catch(e){a.default.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new o.default(i,n)}else this._controller=new o.default(i,n);if(this._controller){var d=this._controller;d.on(u.default.IO_ERROR,this._onIOError.bind(this)),d.on(u.default.DEMUX_ERROR,this._onDemuxError.bind(this)),d.on(u.default.INIT_SEGMENT,this._onInitSegment.bind(this)),d.on(u.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),d.on(u.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),d.on(u.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),d.on(u.default.MEDIA_INFO,this._onMediaInfo.bind(this)),d.on(u.default.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),d.on(u.default.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),d.on(u.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),d.on(u.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return n(t,[{key:"destroy",value:function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),s.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter&&this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"hasWorker",value:function(){return null!=this._worker}},{key:"open",value:function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()}},{key:"close",value:function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()}},{key:"seek",value:function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)}},{key:"pause",value:function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()}},{key:"resume",value:function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()}},{key:"_onInitSegment",value:function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(u.default.INIT_SEGMENT,e,t)}).catch(function(){})}},{key:"_onMediaSegment",value:function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(u.default.MEDIA_SEGMENT,e,t)}).catch(function(){})}},{key:"_onLoadingComplete",value:function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(u.default.LOADING_COMPLETE)}).catch(function(){})}},{key:"_onRecoveredEarlyEof",value:function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(u.default.RECOVERED_EARLY_EOF)}).catch(function(){})}},{key:"_onMediaInfo",value:function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(u.default.MEDIA_INFO,e)}).catch(function(){})}},{key:"_onMetaDataArrived",value:function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(u.default.METADATA_ARRIVED,e)}).catch(function(){})}},{key:"_onScriptDataArrived",value:function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(u.default.SCRIPTDATA_ARRIVED,e)}).catch(function(){})}},{key:"_onStatisticsInfo",value:function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(u.default.STATISTICS_INFO,e)}).catch(function(){})}},{key:"_onIOError",value:function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(u.default.IO_ERROR,e,t)}).catch(function(){})}},{key:"_onDemuxError",value:function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(u.default.DEMUX_ERROR,e,t)}).catch(function(){})}},{key:"_onRecommendSeekpoint",value:function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(u.default.RECOMMEND_SEEKPOINT,e)}).catch(function(){})}},{key:"_onLoggingConfigChanged",value:function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})}},{key:"_onWorkerMessage",value:function(e){var t=e.data,i=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case u.default.INIT_SEGMENT:case u.default.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case u.default.LOADING_COMPLETE:case u.default.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case u.default.MEDIA_INFO:Object.setPrototypeOf(i,c.default.prototype),this._emitter.emit(t.msg,i);break;case u.default.METADATA_ARRIVED:case u.default.SCRIPTDATA_ARRIVED:case u.default.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case u.default.IO_ERROR:case u.default.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case u.default.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":a.default.emitter.emit("log",i.type,i.logcat)}}}]),t}();i.default=h},{"../utils/logger.js":41,"../utils/logging-control.js":42,"./media-info.js":7,"./transmuxing-controller.js":12,"./transmuxing-events.js":13,"./transmuxing-worker.js":14,events:2,webworkify:4}],12:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=f(e("events")),a=f(e("../utils/logger.js")),s=f(e("../utils/browser.js")),o=f(e("./media-info.js")),u=f(e("../demux/flv-demuxer.js")),l=f(e("../remux/mp4-remuxer.js")),c=f(e("../demux/demux-errors.js")),d=f(e("../io/io-controller.js")),h=f(e("./transmuxing-events.js"));e("../io/loader.js");function f(e){return e&&e.__esModule?e:{default:e}}var p=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="TransmuxingController",this._emitter=new r.default,this._config=i,t.segments||(t.segments=[{duration:t.duration,filesize:t.filesize,url:t.url}]),"boolean"!=typeof t.cors&&(t.cors=!0),"boolean"!=typeof t.withCredentials&&(t.withCredentials=!1),this._mediaDataSource=t,this._currentSegmentIndex=0;var n=0;this._mediaDataSource.segments.forEach(function(e){e.timestampBase=n,n+=e.duration,e.cors=t.cors,e.withCredentials=t.withCredentials,i.referrerPolicy&&(e.referrerPolicy=i.referrerPolicy)}),isNaN(n)||this._mediaDataSource.duration===n||(this._mediaDataSource.duration=n),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return n(e,[{key:"destroy",value:function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter&&this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"start",value:function(){this._loadSegment(0),this._enableStatisticsReporter()}},{key:"_loadSegment",value:function(e,t){this._currentSegmentIndex=e;var i=this._mediaDataSource.segments[e],n=this._ioctl=new d.default(i,this._config,e);n.onError=this._onIOException.bind(this),n.onSeeked=this._onIOSeeked.bind(this),n.onComplete=this._onIOComplete.bind(this),n.onRedirect=this._onIORedirect.bind(this),n.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):n.onDataArrival=this._onInitChunkArrival.bind(this),n.open(t)}},{key:"stop",value:function(){this._internalAbort(),this._disableStatisticsReporter()}},{key:"_internalAbort",value:function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)}},{key:"pause",value:function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())}},{key:"resume",value:function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())}},{key:"seek",value:function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var i=this._mediaInfo.segments[t];if(void 0==i)this._pendingSeekTime=e;else{var n=i.getNearestKeyframe(e);this._remuxer.seek(n.milliseconds),this._ioctl.seek(n.fileposition),this._pendingResolveSeekPoint=n.milliseconds}}else{var r=this._mediaInfo.segments[t];if(void 0==r)this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t);else{var a=r.getNearestKeyframe(e);this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,a.fileposition),this._pendingResolveSeekPoint=a.milliseconds,this._reportSegmentMediaInfo(t)}}this._enableStatisticsReporter()}}},{key:"_searchSegmentIndexContains",value:function(e){for(var t=this._mediaDataSource.segments,i=t.length-1,n=0;n<t.length;n++)if(e<t[n].timestampBase){i=n-1;break}return i}},{key:"_onInitChunkArrival",value:function(e,t){var i=this,n=null,r=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,r=this._demuxer.parseChunks(e,t);else if((n=u.default.probe(e)).match){this._demuxer=new u.default(n,this._config),this._remuxer||(this._remuxer=new l.default(this._config));var s=this._mediaDataSource;void 0==s.duration||isNaN(s.duration)||(this._demuxer.overridedDuration=s.duration),"boolean"==typeof s.hasAudio&&(this._demuxer.overridedHasAudio=s.hasAudio),"boolean"==typeof s.hasVideo&&(this._demuxer.overridedHasVideo=s.hasVideo),this._demuxer.timestampBase=s.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),r=this._demuxer.parseChunks(e,t)}else n=null,a.default.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(function(){i._internalAbort()}),this._emitter.emit(h.default.DEMUX_ERROR,c.default.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),r=0;return r}},{key:"_onMediaInfo",value:function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,o.default.prototype));var i=Object.assign({},e);Object.setPrototypeOf(i,o.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then(function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)})}},{key:"_onMetaDataArrived",value:function(e){this._emitter.emit(h.default.METADATA_ARRIVED,e)}},{key:"_onScriptDataArrived",value:function(e){this._emitter.emit(h.default.SCRIPTDATA_ARRIVED,e)}},{key:"_onIOSeeked",value:function(){this._remuxer.insertDiscontinuity()}},{key:"_onIOComplete",value:function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer&&this._remuxer.flushStashedSamples(),this._emitter.emit(h.default.LOADING_COMPLETE),this._disableStatisticsReporter())}},{key:"_onIORedirect",value:function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e}},{key:"_onIORecoveredEarlyEof",value:function(){this._emitter.emit(h.default.RECOVERED_EARLY_EOF)}},{key:"_onIOException",value:function(e,t){a.default.e(this.TAG,"IOException: type = "+e+", code = "+t.code+", msg = "+t.msg),this._emitter.emit(h.default.IO_ERROR,e,t),this._disableStatisticsReporter()}},{key:"_onDemuxException",value:function(e,t){a.default.e(this.TAG,"DemuxException: type = "+e+", info = "+t),this._emitter.emit(h.default.DEMUX_ERROR,e,t)}},{key:"_onRemuxerInitSegmentArrival",value:function(e,t){this._emitter.emit(h.default.INIT_SEGMENT,e,t)}},{key:"_onRemuxerMediaSegmentArrival",value:function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(h.default.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var i=t.info.syncPoints,n=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,s.default.safari&&i.length>0&&i[0].originalDts===n&&(n=i[0].pts),this._emitter.emit(h.default.RECOMMEND_SEEKPOINT,n)}}},{key:"_enableStatisticsReporter",value:function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))}},{key:"_disableStatisticsReporter",value:function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"_reportSegmentMediaInfo",value:function(e){var t=this._mediaInfo.segments[e],i=Object.assign({},t);i.duration=this._mediaInfo.duration,i.segmentCount=this._mediaInfo.segmentCount,delete i.segments,delete i.keyframesIndex,this._emitter.emit(h.default.MEDIA_INFO,i)}},{key:"_reportStatisticsInfo",value:function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(h.default.STATISTICS_INFO,e)}}]),e}();i.default=p},{"../demux/demux-errors.js":16,"../demux/flv-demuxer.js":18,"../io/io-controller.js":23,"../io/loader.js":24,"../remux/mp4-remuxer.js":38,"../utils/browser.js":39,"../utils/logger.js":41,"./media-info.js":7,"./transmuxing-events.js":13,events:2}],13:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.default={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},{}],14:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});o(e("../utils/logger.js"));var n=o(e("../utils/logging-control.js")),r=o(e("../utils/polyfill.js")),a=o(e("./transmuxing-controller.js")),s=o(e("./transmuxing-events.js"));function o(e){return e&&e.__esModule?e:{default:e}}i.default=function(e){var t=null,i=function(t,i){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:i}})}.bind(this);r.default.install(),e.addEventListener("message",function(r){switch(r.data.cmd){case"init":(t=new a.default(r.data.param[0],r.data.param[1])).on(s.default.IO_ERROR,function(t,i){e.postMessage({msg:s.default.IO_ERROR,data:{type:t,info:i}})}.bind(this)),t.on(s.default.DEMUX_ERROR,function(t,i){e.postMessage({msg:s.default.DEMUX_ERROR,data:{type:t,info:i}})}.bind(this)),t.on(s.default.INIT_SEGMENT,function(t,i){var n={msg:s.default.INIT_SEGMENT,data:{type:t,data:i}};e.postMessage(n,[i.data])}.bind(this)),t.on(s.default.MEDIA_SEGMENT,function(t,i){var n={msg:s.default.MEDIA_SEGMENT,data:{type:t,data:i}};e.postMessage(n,[i.data])}.bind(this)),t.on(s.default.LOADING_COMPLETE,function(){var t={msg:s.default.LOADING_COMPLETE};e.postMessage(t)}.bind(this)),t.on(s.default.RECOVERED_EARLY_EOF,function(){var t={msg:s.default.RECOVERED_EARLY_EOF};e.postMessage(t)}.bind(this)),t.on(s.default.MEDIA_INFO,function(t){var i={msg:s.default.MEDIA_INFO,data:t};e.postMessage(i)}.bind(this)),t.on(s.default.METADATA_ARRIVED,function(t){var i={msg:s.default.METADATA_ARRIVED,data:t};e.postMessage(i)}.bind(this)),t.on(s.default.SCRIPTDATA_ARRIVED,function(t){var i={msg:s.default.SCRIPTDATA_ARRIVED,data:t};e.postMessage(i)}.bind(this)),t.on(s.default.STATISTICS_INFO,function(t){var i={msg:s.default.STATISTICS_INFO,data:t};e.postMessage(i)}.bind(this)),t.on(s.default.RECOMMEND_SEEKPOINT,function(t){e.postMessage({msg:s.default.RECOMMEND_SEEKPOINT,data:t})}.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(r.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var o=r.data.param;n.default.applyConfig(o),!0===o.enableCallback?n.default.addLogListener(i):n.default.removeLogListener(i)}})}},{"../utils/logger.js":41,"../utils/logging-control.js":42,"../utils/polyfill.js":43,"./transmuxing-controller.js":12,"./transmuxing-events.js":13}],15:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=o(e("../utils/logger.js")),a=o(e("../utils/utf8-conv.js")),s=e("../utils/exception.js");function o(e){return e&&e.__esModule?e:{default:e}}var u,l=(u=new ArrayBuffer(2),new DataView(u).setInt16(0,256,!0),256===new Int16Array(u)[0]),c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return n(e,null,[{key:"parseScriptData",value:function(t,i,n){var r={};try{var a=e.parseValue(t,i,n),s=e.parseValue(t,i+a.size,n-a.size);r[a.data]=s.data}catch(e){}return r}},{key:"parseObject",value:function(t,i,n){if(n<3)throw new s.IllegalStateException("Data not enough when parse ScriptDataObject");var r=e.parseString(t,i,n),a=e.parseValue(t,i+r.size,n-r.size),o=a.objectEnd;return{data:{name:r.data,value:a.data},size:r.size+a.size,objectEnd:o}}},{key:"parseVariable",value:function(t,i,n){return e.parseObject(t,i,n)}},{key:"parseString",value:function(e,t,i){if(i<2)throw new s.IllegalStateException("Data not enough when parse String");var n=new DataView(e,t,i).getUint16(0,!l);return{data:n>0?(0,a.default)(new Uint8Array(e,t+2,n)):"",size:2+n}}},{key:"parseLongString",value:function(e,t,i){if(i<4)throw new s.IllegalStateException("Data not enough when parse LongString");var n=new DataView(e,t,i).getUint32(0,!l);return{data:n>0?(0,a.default)(new Uint8Array(e,t+4,n)):"",size:4+n}}},{key:"parseDate",value:function(e,t,i){if(i<10)throw new s.IllegalStateException("Data size invalid when parse Date");var n=new DataView(e,t,i),r=n.getFloat64(0,!l),a=n.getInt16(8,!l);return{data:new Date(r+=60*a*1e3),size:10}}},{key:"parseValue",value:function(t,i,n){if(n<1)throw new s.IllegalStateException("Data not enough when parse Value");var a=new DataView(t,i,n),o=1,u=a.getUint8(0),c=void 0,d=!1;try{switch(u){case 0:c=a.getFloat64(1,!l),o+=8;break;case 1:c=!!a.getUint8(1),o+=1;break;case 2:var h=e.parseString(t,i+1,n-1);c=h.data,o+=h.size;break;case 3:c={};var f=0;for(9==(16777215&a.getUint32(n-4,!l))&&(f=3);o<n-4;){var p=e.parseObject(t,i+o,n-o-f);if(p.objectEnd)break;c[p.data.name]=p.data.value,o+=p.size}if(o<=n-3)9===(16777215&a.getUint32(o-1,!l))&&(o+=3);break;case 8:c={},o+=4;var m=0;for(9==(16777215&a.getUint32(n-4,!l))&&(m=3);o<n-8;){var g=e.parseVariable(t,i+o,n-o-m);if(g.objectEnd)break;c[g.data.name]=g.data.value,o+=g.size}if(o<=n-3)9===(16777215&a.getUint32(o-1,!l))&&(o+=3);break;case 9:c=void 0,o=1,d=!0;break;case 10:c=[];var v=a.getUint32(1,!l);o+=4;for(var y=0;y<v;y++){var _=e.parseValue(t,i+o,n-o);c.push(_.data),o+=_.size}break;case 11:var b=e.parseDate(t,i+1,n-1);c=b.data,o+=b.size;break;case 12:var T=e.parseString(t,i+1,n-1);c=T.data,o+=T.size;break;default:o=n,r.default.w("AMF","Unsupported AMF value type "+u)}}catch(e){r.default.e("AMF",e.toString())}return{data:c,size:o,objectEnd:d}}}]),e}();i.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"../utils/utf8-conv.js":44}],16:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.default={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},{}],17:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=e("../utils/exception.js");var a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="ExpGolomb",this._buffer=t,this._buffer_index=0,this._total_bytes=t.byteLength,this._total_bits=8*t.byteLength,this._current_word=0,this._current_word_bits_left=0}return n(e,[{key:"destroy",value:function(){this._buffer=null}},{key:"_fillCurrentWord",value:function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new r.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t}},{key:"readBits",value:function(e){if(e>32)throw new r.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var i=this._current_word_bits_left?this._current_word:0;i>>>=32-this._current_word_bits_left;var n=e-this._current_word_bits_left;this._fillCurrentWord();var a=Math.min(n,this._current_word_bits_left),s=this._current_word>>>32-a;return this._current_word<<=a,this._current_word_bits_left-=a,i=i<<a|s}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readByte",value:function(){return this.readBits(8)}},{key:"_skipLeadingZero",value:function(){var e=void 0;for(e=0;e<this._current_word_bits_left;e++)if(0!=(this._current_word&2147483648>>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}},{key:"readUEG",value:function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1}},{key:"readSEG",value:function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}]),e}();i.default=a},{"../utils/exception.js":40}],18:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=h(e("../utils/logger.js")),s=h(e("./amf-parser.js")),o=h(e("./sps-parser.js")),u=h(e("./hevc-sps-parser.js")),l=h(e("./demux-errors.js")),c=h(e("../core/media-info.js")),d=e("../utils/exception.js");function h(e){return e&&e.__esModule?e:{default:e}}var f=function(){function e(t,i){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="FLVDemuxer",this._config=i,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=t.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=t.hasAudioTrack,this._hasVideo=t.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new c.default,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=(n=new ArrayBuffer(2),new DataView(n).setInt16(0,256,!0),256===new Int16Array(n)[0])}return r(e,[{key:"destroy",value:function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null}},{key:"bindDataSource",value:function(e){return e.onDataArrival=this.parseChunks.bind(this),this}},{key:"resetMediaInfo",value:function(){this._mediaInfo=new c.default}},{key:"_isInitialMetadataDispatched",value:function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched}},{key:"parseChunks",value:function(t,i){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new d.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var n=0,r=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;n=e.probe(t).dataOffset}this._firstParse&&(this._firstParse=!1,i+n!==this._dataOffset&&a.default.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==new DataView(t,n).getUint32(0,!r)&&a.default.w(this.TAG,"PrevTagSize0 !== 0 !!!"),n+=4);for(;n<t.byteLength;){this._dispatch=!0;var s=new DataView(t,n);if(n+11+4>t.byteLength)break;var o=s.getUint8(0),u=16777215&s.getUint32(0,!r);if(n+11+u+4>t.byteLength)break;if(8===o||9===o||18===o){var l=s.getUint8(4),c=s.getUint8(5),h=s.getUint8(6)|c<<8|l<<16|s.getUint8(7)<<24;0!==(16777215&s.getUint32(7,!r))&&a.default.w(this.TAG,"Meet tag which has StreamID != 0!");var f=n+11;switch(o){case 8:this._parseAudioData(t,f,u,h);break;case 9:this._parseVideoData(t,f,u,h,i+n);break;case 18:this._parseScriptData(t,f,u)}var p=s.getUint32(11+u,!r);p!==11+u&&a.default.w(this.TAG,"Invalid PrevTagSize "+p),n+=11+u+4}else a.default.w(this.TAG,"Unsupported tag type "+o+", skipped"),n+=11+u+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),n}},{key:"_parseScriptData",value:function(e,t,i){var r=s.default.parseScriptData(e,t,i);if(r.hasOwnProperty("onMetaData")){if(null==r.onMetaData||"object"!==n(r.onMetaData))return void a.default.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&a.default.w(this.TAG,"Found another onMetaData tag!"),this._metadata=r;var o=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},o)),"boolean"==typeof o.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=o.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof o.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=o.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof o.audiodatarate&&(this._mediaInfo.audioDataRate=o.audiodatarate),"number"==typeof o.videodatarate&&(this._mediaInfo.videoDataRate=o.videodatarate),"number"==typeof o.width&&(this._mediaInfo.width=o.width),"number"==typeof o.height&&(this._mediaInfo.height=o.height),"number"==typeof o.duration){if(!this._durationOverrided){var u=Math.floor(o.duration*this._timescale);this._duration=u,this._mediaInfo.duration=u}}else this._mediaInfo.duration=0;if("number"==typeof o.framerate){var l=Math.floor(1e3*o.framerate);if(l>0){var c=l/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=c,this._referenceFrameRate.fps_num=l,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=c}}if("object"===n(o.keyframes)){this._mediaInfo.hasKeyframesIndex=!0;var d=o.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(d),o.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=o,a.default.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(r).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},r))}},{key:"_parseKeyframesIndex",value:function(e){for(var t=[],i=[],n=1;n<e.times.length;n++){var r=this._timestampBase+Math.floor(1e3*e.times[n]);t.push(r),i.push(e.filepositions[n])}return{times:t,filepositions:i}}},{key:"_parseAudioData",value:function(e,t,i,n){if(i<=1)a.default.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var r=new DataView(e,t,i).getUint8(0),s=r>>>4;if(2===s||10===s){var o=0,u=(12&r)>>>2;if(u>=0&&u<=4){o=this._flvSoundRateTable[u];var c=1&r,d=this._audioMetadata,h=this._audioTrack;if(d||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(d=this._audioMetadata={}).type="audio",d.id=h.id,d.timescale=this._timescale,d.duration=this._duration,d.audioSampleRate=o,d.channelCount=0===c?1:2),10===s){var f=this._parseAACAudioData(e,t+1,i-1);if(void 0==f)return;if(0===f.packetType){if(d.config)return void a.default.w(this.TAG,"Found another AudioSpecificConfig!");var p=f.data;d.audioSampleRate=p.samplingRate,d.channelCount=p.channelCount,d.codec=p.codec,d.originalCodec=p.originalCodec,d.config=p.config,d.refSampleDuration=1024/d.audioSampleRate*d.timescale,a.default.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",d);var m=this._mediaInfo;m.audioCodec=d.originalCodec,m.audioSampleRate=d.audioSampleRate,m.audioChannelCount=d.channelCount,m.hasVideo?null!=m.videoCodec&&(m.mimeType='video/x-flv; codecs="'+m.videoCodec+","+m.audioCodec+'"'):m.mimeType='video/x-flv; codecs="'+m.audioCodec+'"',m.isComplete()&&this._onMediaInfo(m)}else if(1===f.packetType){var g=this._timestampBase+n,v={unit:f.data,length:f.data.byteLength,dts:g,pts:g};h.samples.push(v),h.length+=f.data.length}else a.default.e(this.TAG,"Flv: Unsupported AAC data type "+f.packetType)}else if(2===s){if(!d.codec){var y=this._parseMP3AudioData(e,t+1,i-1,!0);if(void 0==y)return;d.audioSampleRate=y.samplingRate,d.channelCount=y.channelCount,d.codec=y.codec,d.originalCodec=y.originalCodec,d.refSampleDuration=1152/d.audioSampleRate*d.timescale,a.default.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",d);var _=this._mediaInfo;_.audioCodec=d.codec,_.audioSampleRate=d.audioSampleRate,_.audioChannelCount=d.channelCount,_.audioDataRate=y.bitRate,_.hasVideo?null!=_.videoCodec&&(_.mimeType='video/x-flv; codecs="'+_.videoCodec+","+_.audioCodec+'"'):_.mimeType='video/x-flv; codecs="'+_.audioCodec+'"',_.isComplete()&&this._onMediaInfo(_)}var b=this._parseMP3AudioData(e,t+1,i-1,!1);if(void 0==b)return;var T=this._timestampBase+n,S={unit:b,length:b.byteLength,dts:T,pts:T};h.samples.push(S),h.length+=b.length}}else this._onError(l.default.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+u)}else this._onError(l.default.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+s)}}},{key:"_parseAACAudioData",value:function(e,t,i){if(!(i<=1)){var n={},r=new Uint8Array(e,t,i);return n.packetType=r[0],0===r[0]?n.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):n.data=r.subarray(1),n}a.default.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")}},{key:"_parseAACAudioSpecificConfig",value:function(e,t,i){var n,r,a=new Uint8Array(e,t,i),s=null,o=0,u=null;if(o=n=a[0]>>>3,(r=(7&a[0])<<1|a[1]>>>7)<0||r>=this._mpegSamplingRates.length)this._onError(l.default.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var c=this._mpegSamplingRates[r],d=(120&a[1])>>>3;if(!(d<0||d>=8)){5===o&&(u=(7&a[1])<<1|a[2]>>>7,(124&a[2])>>>2);var h=self.navigator.userAgent.toLowerCase();return-1!==h.indexOf("firefox")?r>=6?(o=5,s=new Array(4),u=r-3):(o=2,s=new Array(2),u=r):-1!==h.indexOf("android")?(o=2,s=new Array(2),u=r):(o=5,u=r,s=new Array(4),r>=6?u=r-3:1===d&&(o=2,s=new Array(2),u=r)),s[0]=o<<3,s[0]|=(15&r)>>>1,s[1]=(15&r)<<7,s[1]|=(15&d)<<3,5===o&&(s[1]|=(15&u)>>>1,s[2]=(1&u)<<7,s[2]|=8,s[3]=0),{config:s,samplingRate:c,channelCount:d,codec:"mp4a.40."+o,originalCodec:"mp4a.40."+n}}this._onError(l.default.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}}},{key:"_parseMP3AudioData",value:function(e,t,i,n){if(!(i<4)){this._littleEndian;var r=new Uint8Array(e,t,i),s=null;if(n){if(255!==r[0])return;var o=r[1]>>>3&3,u=(6&r[1])>>1,l=(240&r[2])>>>4,c=(12&r[2])>>>2,d=3!==(r[3]>>>6&3)?2:1,h=0,f=0;switch(o){case 0:h=this._mpegAudioV25SampleRateTable[c];break;case 2:h=this._mpegAudioV20SampleRateTable[c];break;case 3:h=this._mpegAudioV10SampleRateTable[c]}switch(u){case 1:34,l<this._mpegAudioL3BitRateTable.length&&(f=this._mpegAudioL3BitRateTable[l]);break;case 2:33,l<this._mpegAudioL2BitRateTable.length&&(f=this._mpegAudioL2BitRateTable[l]);break;case 3:32,l<this._mpegAudioL1BitRateTable.length&&(f=this._mpegAudioL1BitRateTable[l])}s={bitRate:f,samplingRate:h,channelCount:d,codec:"mp3",originalCodec:"mp3"}}else s=r;return s}a.default.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")}},{key:"_parseVideoData",value:function(e,t,i,n,r){if(i<=1)a.default.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var s=new Uint8Array(e,t,i)[0],o=(240&s)>>>4,u=15&s;7===u||12===u?7===u?this._parseAVCVideoPacket(e,t+1,i-1,n,r,o):12===u&&this._parseHVCVideoPacket(e,t+1,i-1,n,r,o):this._onError(l.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+u)}}},{key:"_parseAVCVideoPacket",value:function(e,t,i,n,r,s){if(i<4)a.default.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var o=this._littleEndian,u=new DataView(e,t,i),c=u.getUint8(0),d=(16777215&u.getUint32(0,!o))<<8>>8;if(0===c)this._parseAVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===c)this._parseAVCVideoData(e,t+4,i-4,n,r,s,d);else if(2!==c)return void this._onError(l.default.FORMAT_ERROR,"Flv: Invalid video packet type "+c)}}},{key:"_parseAVCDecoderConfigurationRecord",value:function(e,t,i){if(i<7)a.default.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,r=this._videoTrack,s=this._littleEndian,u=new DataView(e,t,i);if(n){if(void 0!==n.avcc)return void a.default.w(this.TAG,"Found another AVCDecoderConfigurationRecord!")}else!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=r.id,n.timescale=this._timescale,n.duration=this._duration;var c=u.getUint8(0),d=u.getUint8(1);u.getUint8(2),u.getUint8(3);if(1===c&&0!==d)if(this._naluLengthSize=1+(3&u.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var h=31&u.getUint8(5);if(0!==h){h>1&&a.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+h);for(var f=6,p=0;p<h;p++){var m=u.getUint16(f,!s);if(f+=2,0!==m){var g=new Uint8Array(e,t+f,m);f+=m;var v=o.default.parseSPS(g);if(0===p){n.codecWidth=v.codec_size.width,n.codecHeight=v.codec_size.height,n.presentWidth=v.present_size.width,n.presentHeight=v.present_size.height,n.profile=v.profile_string,n.level=v.level_string,n.bitDepth=v.bit_depth,n.chromaFormat=v.chroma_format,n.sarRatio=v.sar_ratio,n.frameRate=v.frame_rate,!1!==v.frame_rate.fixed&&0!==v.frame_rate.fps_num&&0!==v.frame_rate.fps_den||(n.frameRate=this._referenceFrameRate);var y=n.frameRate.fps_den,_=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(y/_);for(var b=g.subarray(1,4),T="avc1.",S=0;S<3;S++){var k=b[S].toString(16);k.length<2&&(k="0"+k),T+=k}n.codec=T;var E=this._mediaInfo;E.width=n.codecWidth,E.height=n.codecHeight,E.fps=n.frameRate.fps,E.profile=n.profile,E.level=n.level,E.refFrames=v.ref_frames,E.chromaFormat=v.chroma_format_string,E.sarNum=n.sarRatio.width,E.sarDen=n.sarRatio.height,E.videoCodec=T,E.hasAudio?null!=E.audioCodec&&(E.mimeType='video/x-flv; codecs="'+E.videoCodec+","+E.audioCodec+'"'):E.mimeType='video/x-flv; codecs="'+E.videoCodec+'"',E.isComplete()&&this._onMediaInfo(E)}}}var w=u.getUint8(f);if(0!==w){w>1&&a.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+w),f++;for(var C=0;C<w;C++){var P=u.getUint16(f,!s);f+=2,0!==P&&(f+=P)}n.avcc=new Uint8Array(i),n.avcc.set(new Uint8Array(e,t,i),0),a.default.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",n)}else this._onError(l.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(l.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(l.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(l.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}}},{key:"_parseAVCVideoData",value:function(e,t,i,n,r,s,o){for(var u=this._littleEndian,l=new DataView(e,t,i),c=[],d=0,h=0,f=this._naluLengthSize,p=this._timestampBase+n,m=1===s;h<i;){if(h+4>=i){a.default.w(this.TAG,"Malformed Nalu near timestamp "+p+", offset = "+h+", dataSize = "+i);break}var g=l.getUint32(h,!u);if(3===f&&(g>>>=8),g>i-f)return void a.default.w(this.TAG,"Malformed Nalus near timestamp "+p+", NaluSize > DataSize!");var v=31&l.getUint8(h+f);5===v&&(m=!0);var y=new Uint8Array(e,t+h,f+g),_={type:v,data:y};c.push(_),d+=y.byteLength,h+=f+g}if(c.length){var b=this._videoTrack,T={units:c,length:d,isKeyframe:m,dts:p,cts:o,pts:p+o};m&&(T.fileposition=r),b.samples.push(T),b.length+=d}}},{key:"_parseHVCVideoPacket",value:function(e,t,i,n,r,s){if(i<4)a.default.w(this.TAG,"Flv: Invalid HVC packet, missing HVCPacketType or/and CompositionTime");else{var o=this._littleEndian,u=new DataView(e,t,i),c=u.getUint8(0),d=(16777215&u.getUint32(0,!o))<<8>>8;if(0===c)this._parseHVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===c)this._parseHVCVideoData(e,t+4,i-4,n,r,s,d);else if(2!==c)return void this._onError(l.default.FORMAT_ERROR,"Flv: Invalid video packet type "+c)}}},{key:"_parseHVCDecoderConfigurationRecord",value:function(e,t,i){if(i<23)a.default.w(this.TAG,"Flv: Invalid HVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,r=this._videoTrack,s=this._littleEndian,o=new DataView(e,t,i);if(n){if(void 0!==n.avcc)return void a.default.w(this.TAG,"Found another HVCDecoderConfigurationRecord!")}else!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=r.id,n.timescale=this._timescale,n.duration=this._duration;if(1===o.getUint8(0))if(this._naluLengthSize=1+(3&o.getUint8(21)),3===this._naluLengthSize||4===this._naluLengthSize){for(var c,d,h,f=o.getUint8(22),p=23,m=[],g=0;g<f;g++){var v=63&o.getUint8(p++),y=o.getUint16(p,!s);if(p+=2,0!==y){switch(v){case 32:c+=y;break;case 33:d+=y;break;case 34:h+=y}for(var _=0;_<y;_++){var b=o.getUint16(p,!s);if(p+=2,0!==b){if(33===v){var T=new Uint8Array(e,t+p,b);m.push(T)}p+=b}}}}if(0!==c)if(c>1&&a.default.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: VPS Count = "+c),0!==d)if(d>1&&a.default.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: SPS Count = "+d),0!==h){h>1&&a.default.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: PPS Count = "+d);T=m[0];var S=u.default.parseSPS(T);n.codecWidth=S.codec_size.width,n.codecHeight=S.codec_size.height,n.presentWidth=S.present_size.width,n.presentHeight=S.present_size.height,n.profile=S.profile_string,n.level=S.level_string,n.profile_idc=S.profile_idc,n.level_idc=S.level_idc,n.bitDepth=S.bit_depth,n.chromaFormat=S.chroma_format,n.sarRatio=S.sar_ratio,n.frameRate=S.frame_rate,!1!==S.frame_rate.fixed&&0!==S.frame_rate.fps_num&&0!==S.frame_rate.fps_den||(n.frameRate=this._referenceFrameRate);var k=n.frameRate.fps_den,E=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(k/E);var w="hvc1."+n.profile_idc+".1.L"+n.level_idc+".B0";n.codec=w;var C=this._mediaInfo;C.width=n.codecWidth,C.height=n.codecHeight,C.fps=n.frameRate.fps,C.profile=n.profile,C.level=n.level,C.refFrames=S.ref_frames,C.chromaFormat=S.chroma_format_string,C.sarNum=n.sarRatio.width,C.sarDen=n.sarRatio.height,C.videoCodec=w,C.hasAudio?null!=C.audioCodec&&(C.mimeType='video/x-flv; codecs="'+C.videoCodec+","+C.audioCodec+'"'):C.mimeType='video/x-flv; codecs="'+C.videoCodec+'"',C.isComplete()&&this._onMediaInfo(C),n.avcc=new Uint8Array(i),n.avcc.set(new Uint8Array(e,t,i),0),a.default.v(this.TAG,"Parsed HVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",n)}else this._onError(l.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No PPS");else this._onError(l.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No SPS");else this._onError(l.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No VPS")}else this._onError(l.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(l.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord")}}},{key:"_parseHVCVideoData",value:function(e,t,i,n,r,s,o){for(var u=this._littleEndian,l=new DataView(e,t,i),c=[],d=0,h=0,f=this._naluLengthSize,p=this._timestampBase+n,m=1===s;h<i;){if(h+4>=i){a.default.w(this.TAG,"Malformed Nalu near timestamp "+p+", offset = "+h+", dataSize = "+i);break}var g=l.getUint32(h,!u);if(3===f&&(g>>>=8),g>i-f)return void a.default.w(this.TAG,"Malformed Nalus near timestamp "+p+", NaluSize > DataSize!");var v=l.getUint8(h+f)>>1&63;v>=16&&v<=23&&(m=!0);var y=new Uint8Array(e,t+h,f+g),_={type:v,data:y};c.push(_),d+=y.byteLength,h+=f+g}if(c.length){var b=this._videoTrack,T={units:c,length:d,isKeyframe:m,dts:p,cts:o,pts:p+o};m&&(T.fileposition=r),b.samples.push(T),b.length+=d}}},{key:"onTrackMetadata",get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e}},{key:"onMediaInfo",get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e}},{key:"onMetaDataArrived",get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e}},{key:"onScriptDataArrived",get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onDataAvailable",get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e}},{key:"timestampBase",get:function(){return this._timestampBase},set:function(e){this._timestampBase=e}},{key:"overridedDuration",get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e}},{key:"overridedHasAudio",set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e}},{key:"overridedHasVideo",set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e}}],[{key:"probe",value:function(e){var t=new Uint8Array(e),i={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;var n,r,a=(4&t[4])>>>2!=0,s=0!=(1&t[4]),o=(n=t)[r=5]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3];return o<9?i:{match:!0,consumed:o,dataOffset:o,hasAudioTrack:a,hasVideoTrack:s}}}]),e}();i.default=f},{"../core/media-info.js":7,"../utils/exception.js":40,"../utils/logger.js":41,"./amf-parser.js":15,"./demux-errors.js":16,"./sps-parser.js":19,"./hevc-sps-parser.js":45}],19:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n,r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=e("./exp-golomb.js"),s=(n=a)&&n.__esModule?n:{default:n};var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"_ebsp2rbsp",value:function(e){for(var t=e,i=t.byteLength,n=new Uint8Array(i),r=0,a=0;a<i;a++)a>=2&&3===t[a]&&0===t[a-1]&&0===t[a-2]||(n[r]=t[a],r++);return new Uint8Array(n.buffer,0,r)}},{key:"parseSPS",value:function(t){var i=e._ebsp2rbsp(t),n=new s.default(i);n.readByte();var r=n.readByte();n.readByte();var a=n.readByte();n.readUEG();var o=e.getProfileString(r),u=e.getLevelString(a),l=1,c=420,d=8;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r)&&(3===(l=n.readUEG())&&n.readBits(1),l<=3&&(c=[0,420,422,444][l]),d=n.readUEG()+8,n.readUEG(),n.readBits(1),n.readBool()))for(var h=3!==l?8:12,f=0;f<h;f++)n.readBool()&&(f<6?e._skipScalingList(n,16):e._skipScalingList(n,64));n.readUEG();var p=n.readUEG();if(0===p)n.readUEG();else if(1===p){n.readBits(1),n.readSEG(),n.readSEG();for(var m=n.readUEG(),g=0;g<m;g++)n.readSEG()}var v=n.readUEG();n.readBits(1);var y=n.readUEG(),_=n.readUEG(),b=n.readBits(1);0===b&&n.readBits(1),n.readBits(1);var T=0,S=0,k=0,E=0;n.readBool()&&(T=n.readUEG(),S=n.readUEG(),k=n.readUEG(),E=n.readUEG());var w=1,C=1,P=0,A=!0,R=0,L=0;if(n.readBool()){if(n.readBool()){var O=n.readByte();O>0&&O<16?(w=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][O-1],C=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][O-1]):255===O&&(w=n.readByte()<<8|n.readByte(),C=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){var I=n.readBits(32),x=n.readBits(32);A=n.readBool(),P=(R=x)/(L=2*I)}}var D=1;1===w&&1===C||(D=w/C);var M=0,U=0;0===l?(M=1,U=2-b):(M=3===l?1:2,U=(1===l?2:1)*(2-b));var j=16*(y+1),B=16*(_+1)*(2-b);j-=(T+S)*M,B-=(k+E)*U;var N=Math.ceil(j*D);return n.destroy(),n=null,{profile_string:o,level_string:u,bit_depth:d,ref_frames:v,chroma_format:c,chroma_format_string:e.getChromaFormatString(c),frame_rate:{fixed:A,fps:P,fps_den:L,fps_num:R},sar_ratio:{width:w,height:C},codec_size:{width:j,height:B},present_size:{width:N,height:B}}}},{key:"_skipScalingList",value:function(e,t){for(var i=8,n=8,r=0;r<t;r++)0!==n&&(n=(i+e.readSEG()+256)%256),i=0===n?i:n}},{key:"getProfileString",value:function(e){switch(e){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}}},{key:"getLevelString",value:function(e){return(e/10).toFixed(1)}},{key:"getChromaFormatString",value:function(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}}}]),e}();i.default=o},{"./exp-golomb.js":17}],45:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=s(e("./exp-golomb.js")),a=s(e("./sps-parser.js"));function s(e){return e&&e.__esModule?e:{default:e}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return n(e,null,[{key:"parseSPS",value:function(t){var i=a.default._ebsp2rbsp(t),n=new r.default(i),s={};n.readBits(16),n.readBits(4);var o=n.readBits(3);n.readBits(1),e._hvcc_parse_ptl(n,s,o),n.readUEG();var u=0,l=n.readUEG();3==l&&(u=n.readBits(1)),s.sar_width=s.sar_height=1,s.conf_win_left_offset=s.conf_win_right_offset=s.conf_win_top_offset=s.conf_win_bottom_offset=0,s.def_disp_win_left_offset=s.def_disp_win_right_offset=s.def_disp_win_top_offset=s.def_disp_win_bottom_offset=0;var c=n.readUEG(),d=n.readUEG();n.readBits(1)&&(s.conf_win_left_offset=n.readUEG(),s.conf_win_right_offset=n.readUEG(),s.conf_win_top_offset=n.readUEG(),s.conf_win_bottom_offset=n.readUEG(),1===s.default_display_window_flag&&(s.conf_win_left_offset+s.def_disp_win_left_offset,s.conf_win_right_offset+s.def_disp_win_right_offset,s.conf_win_top_offset+s.def_disp_win_top_offset,s.conf_win_bottom_offset,s.def_disp_win_bottom_offset));var h=n.readUEG()+8;n.readUEG();for(var f=n.readUEG(),p=n.readBits(1)?0:o;p<=o;p++)e._skip_sub_layer_ordering_info(n);n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readBits(1)&&n.readBits(1)&&e._skip_scaling_list_data(n),n.readBits(1),n.readBits(1),n.readBits(1)&&(n.readBits(4),n.readBits(4),n.readUEG(),n.readUEG(),n.readBits(1));var m=[],g=n.readUEG();for(p=0;p<g;p++){var v=e._parse_rps(n,p,g,m);if(v<0)return v}if(n.readBits(1)){var y=n.readUEG();for(p=0;p<y;p++){var _=Math.min(f+4,16);if(_>32){for(var b=_/32,T=_%32,S=0;S<b;S++)n.readBits(32);n.readBits(T)}else n.readBits(_);n.readBits(1)}}n.readBits(1),n.readBits(1),n.readBits(1)&&e._hvcc_parse_vui(n,s,o);var k=e.getProfileString(s.profile_idc),E=e.getLevelString(s.level_idc),w=1;1===s.sar_width&&1===s.sar_height||(w=s.sar_width/s.sar_height);var C=c,P=d,A=1===l&&0===u?2:1;C-=(1!==l&&2!=l||0!==u?1:2)*(s.conf_win_left_offset+s.conf_win_right_offset),P-=A*(s.conf_win_top_offset+s.conf_win_bottom_offset);var R=Math.ceil(C*w);return n.destroy(),n=null,{profile_string:k,level_string:E,profile_idc:s.profile_idc,level_idc:s.level_idc,bit_depth:h,ref_frames:1,chroma_format:l,chroma_format_string:e.getChromaFormatString(l),frame_rate:{fixed:s.fps_fixed,fps:s.fps,fps_den:s.fps_den,fps_num:s.fps_num},sar_ratio:{width:s.sar_width,height:s.sar_height},codec_size:{width:C,height:P},present_size:{width:R,height:P}}}},{key:"_hvcc_parse_ptl",value:function(e,t,i){e.readBits(2);var n=e.readBits(1),r=e.readBits(5);e.readBits(32),e.readBits(32),e.readBits(16);var a=e.readByte();void 0===t.tier_flag||void 0===t.level_idc||t.tier_flag<n?t.level_idc=a:t.level_idc=Math.max(t.level_idc,a),t.profile_idc=Math.max(void 0===t.profile_idc?0:t.profile_idc,r);for(var s=[],o=[],u=0;u<i;u++)s.push(e.readBits(1)),o.push(e.readBits(1));if(i>0)for(u=i;u<8;u++)e.readBits(2);for(u=0;u<i;u++)s[u]&&(e.readBits(32),e.readBits(32),e.readBits(24)),o[u]&&e.readByte()}},{key:"_parse_rps",value:function(e,t,i,n){if(t&&e.readBits(1)){if(t>=i)return-1;e.readBits(1),e.readUEG(),n[t]=0;for(var r=0;r<=n[t-1];r++){var a=0,s=e.readBits(1);s||(a=e.readBits(1)),(s||a)&&n[t]++}}else{var o=e.readUEG(),u=e.readUEG();n[t]=o+u;for(r=0;r<o;r++)e.readUEG(),e.readBits(1);for(r=0;r<u;r++)e.readUEG(),e.readBits(1)}return 0}},{key:"_hvcc_parse_vui",value:function(t,i,n){t.readBits(1)&&255==t.readByte()&&(i.sar_width=t.readBits(16),i.sar_height=t.readBits(16)),t.readBits(1)&&t.readBits(1),t.readBits(1)&&(t.readBits(4),t.readBits(1)&&t.readBits(24)),t.readBits(1)&&(t.readUEG(),t.readUEG()),t.readBits(3),i.default_display_window_flag=t.readBits(1),i.default_display_window_flag&&(i.def_disp_win_left_offset=t.readUEG(),i.def_disp_win_right_offset=t.readUEG(),i.def_disp_win_top_offset=t.readUEG(),i.def_disp_win_bottom_offset=t.readUEG()),t.readBits(1)&&(e._skip_timing_info(t,i),t.readBits(1)&&e._skip_hrd_parameters(t,i,1,n)),t.readBits(1)&&(t.readBits(3),t.readUEG(),t.readUEG(),t.readUEG(),t.readUEG(),t.readUEG())}},{key:"_skip_sub_layer_ordering_info",value:function(e,t){e.readUEG(),e.readUEG(),e.readUEG()}},{key:"_skip_scaling_list_data",value:function(e){for(var t=0;t<4;t++)for(var i=0;i<(3==t?2:6);i++)if(e.readBits(1)){var n=Math.min(64,1<<4+(t<<1));t>1&&e.readSEG();for(var r=0;r<n;r++)e.readSEG()}else e.readUEG()}},{key:"_skip_sub_layer_hrd_parameters",value:function(e,t,i){for(var n=0;n<=t;n++)e.readUEG(),e.readUEG(),i&&(e.readUEG(),e.readUEG()),e.readBits(1)}},{key:"_skip_timing_info",value:function(e,t){t.fps_den=e.readBits(32),t.fps_num=e.readBits(32),t.fps_den>0&&(t.fps=t.fps_num/t.fps_den);var i=0;e.readBits(1)&&(i=e.readUEG())>=0&&(t.fps/=i+1)}},{key:"_skip_hrd_parameters",value:function(t,i,n){var r=0,a=0;if(i&&(r=t.readBits(1),a=t.readBits(1),r||a)){var s=t.readBits(1);s&&t.readBits(19),t.readByte(),s&&t.readBits(4),t.readBits(15)}for(var o=0;o<=n;o++){var u=0,l=0,c=0,d=t.readBits(1);hvcc.fps_fixed=d,d||(c=t.readBits(1)),c?t.readUEG():l=t.readBits(1),l||(u=t.readUEG(t)),r&&e._skip_sub_layer_hrd_parameters(t,u,0),a&&e._skip_sub_layer_hrd_parameters(t,u,0)}}},{key:"getProfileString",value:function(e){switch(e){case 1:return"Main";case 2:return"Main10";case 3:return"MainSP";case 4:return"Rext";case 9:return"SCC";default:return"Unknown"}}},{key:"getLevelString",value:function(e){return(e/10).toFixed(1)}},{key:"getChromaFormatString",value:function(e){switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}}}]),e}();i.default=o},{"./exp-golomb.js":17,"./sps-parser.js":19}],20:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=f(e("./utils/polyfill.js")),a=f(e("./core/features.js")),s=e("./io/loader.js"),o=f(e("./player/flv-player.js")),u=f(e("./player/native-player.js")),l=f(e("./player/player-events.js")),c=e("./player/player-errors.js"),d=f(e("./utils/logging-control.js")),h=e("./utils/exception.js");function f(e){return e&&e.__esModule?e:{default:e}}r.default.install();var p={createPlayer:function(e,t){var i=e;if(null==i||"object"!==(void 0===i?"undefined":n(i)))throw new h.InvalidArgumentException("MediaDataSource must be an javascript object!");if(!i.hasOwnProperty("type"))throw new h.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");switch(i.type){case"flv":return new o.default(i,t);default:return new u.default(i,t)}},isSupported:function(){return a.default.supportMSEH264Playback()},getFeatureList:function(){return a.default.getFeatureList()}};p.BaseLoader=s.BaseLoader,p.LoaderStatus=s.LoaderStatus,p.LoaderErrors=s.LoaderErrors,p.Events=l.default,p.ErrorTypes=c.ErrorTypes,p.ErrorDetails=c.ErrorDetails,p.FlvPlayer=o.default,p.NativePlayer=u.default,p.LoggingControl=d.default,p.reconnect=!1,Object.defineProperty(p,"version",{enumerable:!0,get:function(){return"1.4.2"}}),i.default=p},{"./core/features.js":6,"./io/loader.js":24,"./player/flv-player.js":32,"./player/native-player.js":33,"./player/player-errors.js":34,"./player/player-events.js":35,"./utils/exception.js":40,"./utils/logging-control.js":42,"./utils/polyfill.js":43}],21:[function(e,t,i){"use strict";t.exports=e("./flv.js").default},{"./flv.js":20}],22:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=(u(e("../utils/logger.js")),u(e("../utils/browser.js"))),s=e("./loader.js"),o=e("../utils/exception.js");function u(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"fetch-stream-loader"));return n.TAG="FetchStreamLoader",n._seekHandler=e,n._config=i,n._needStash=!0,n._requestAbort=!1,n._contentLength=null,n._receivedLength=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.BaseLoader),r(t,null,[{key:"isSupported",value:function(){try{var e=a.default.msedge&&a.default.version.minor>=15048,t=!a.default.msedge||e;return self.fetch&&self.ReadableStream&&t}catch(e){return!1}}}]),r(t,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),function e(t,i,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,i);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function(e,t){var i=this;this._dataSource=e,this._range=t;var r=e.url;this._config.reuseRedirectedURL&&void 0!=e.redirectedURL&&(r=e.redirectedURL);var a=this._seekHandler.getConfig(r,t),u=new self.Headers;if("object"===n(a.headers)){var l=a.headers;for(var c in l)l.hasOwnProperty(c)&&u.append(c,l[c])}var d={method:"GET",headers:u,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"===n(this._config.headers))for(var h in this._config.headers)u.append(h,this._config.headers[h]);!1===e.cors&&(d.mode="same-origin"),e.withCredentials&&(d.credentials="include"),e.referrerPolicy&&(d.referrerPolicy=e.referrerPolicy),this._status=s.LoaderStatus.kConnecting,self.fetch(a.url,d).then(function(e){if(i._requestAbort){try{var t=e.body.getReader();t&&t.cancel()}catch(e){}return i._requestAbort=!1,void(i._status=s.LoaderStatus.kIdle)}if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==a.url&&i._onURLRedirect){var n=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(n)}var r=e.headers.get("Content-Length");return null!=r&&(i._contentLength=parseInt(r),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,e.body.getReader())}if(i._status=s.LoaderStatus.kError,!i._onError)throw new o.RuntimeException("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(s.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})}).catch(function(e){if(i._status=s.LoaderStatus.kError,!i._onError)throw e;i._onError(s.LoaderErrors.EXCEPTION,{code:-1,msg:e.message})})}},{key:"abort",value:function(){this._requestAbort=!0}},{key:"_pump",value:function(e){var t=this;return e.read().then(function(i){if(i.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=s.LoaderStatus.kError;var n=s.LoaderErrors.EARLY_EOF,r={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new o.RuntimeException(r.msg);t._onError(n,r)}else t._status=s.LoaderStatus.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(!0===t._requestAbort)return t._requestAbort=!1,t._status=s.LoaderStatus.kComplete,e.cancel();t._status=s.LoaderStatus.kBuffering;var a=i.value.buffer,u=t._range.from+t._receivedLength;t._receivedLength+=a.byteLength,t._onDataArrival&&t._onDataArrival(a,u,t._receivedLength),t._pump(e)}}).catch(function(e){if(11!==e.code||!a.default.msedge){t._status=s.LoaderStatus.kError;var i=0,n=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(i=s.LoaderErrors.EXCEPTION,n={code:e.code,msg:e.message}):(i=s.LoaderErrors.EARLY_EOF,n={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new o.RuntimeException(n.msg);t._onError(i,n)}})}}]),t}();i.default=l},{"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],23:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=p(e("../utils/logger.js")),a=p(e("./speed-sampler.js")),s=e("./loader.js"),o=p(e("./fetch-stream-loader.js")),u=p(e("./xhr-moz-chunked-loader.js")),l=(p(e("./xhr-msstream-loader.js")),p(e("./xhr-range-loader.js"))),c=p(e("./websocket-loader.js")),d=p(e("./range-seek-handler.js")),h=p(e("./param-seek-handler.js")),f=e("../utils/exception.js");function p(e){return e&&e.__esModule?e:{default:e}}var m=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="IOController",this._config=i,this._extraData=n,this._stashInitialSize=393216,void 0!=i.stashInitialSize&&i.stashInitialSize>0&&(this._stashInitialSize=i.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===i.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=t,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(t.url),this._refTotalLength=t.filesize?t.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new a.default,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return n(e,[{key:"destroy",value:function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null}},{key:"isWorking",value:function(){return this._loader&&this._loader.isWorking()&&!this._paused}},{key:"isPaused",value:function(){return this._paused}},{key:"_selectSeekHandler",value:function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new d.default(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new h.default(t,i)}else{if("custom"!==e.seekType)throw new f.InvalidArgumentException("Invalid seekType in config: "+e.seekType);if("function"!=typeof e.customSeekHandler)throw new f.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}}},{key:"_selectLoader",value:function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=c.default;else if(o.default.isSupported())this._loaderClass=o.default;else if(u.default.isSupported())this._loaderClass=u.default;else{if(!l.default.isSupported())throw new f.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=l.default}}},{key:"_createLoader",value:function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)}},{key:"open",value:function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))}},{key:"abort",value:function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)}},{key:"pause",value:function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}},{key:"resume",value:function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}}},{key:"seek",value:function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)}},{key:"_internalSeek",value:function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var i={from:e,to:-1};this._currentRange={from:i.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,i),this._onSeeked&&this._onSeeked()}},{key:"updateUrl",value:function(e){if(!e||"string"!=typeof e||0===e.length)throw new f.InvalidArgumentException("Url must be a non-empty string!");this._dataSource.url=e}},{key:"_expandBuffer",value:function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var i=new ArrayBuffer(t);if(this._stashUsed>0){var n=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(i,0,t).set(n,0)}this._stashBuffer=i,this._bufferSize=t}}},{key:"_normalizeSpeed",value:function(e){var t=this._speedNormalizeList,i=t.length-1,n=0,r=0,a=i;if(e<t[0])return t[0];for(;r<=a;){if((n=r+Math.floor((a-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:a=n-1}}},{key:"_adjustStashSize",value:function(e){var t=0;(t=this._config.isLive?e:e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var i=1024*t+1048576;this._bufferSize<i&&this._expandBuffer(i),this._stashSize=1024*t}},{key:"_dispatchChunks",value:function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)}},{key:"_onURLRedirect",value:function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)}},{key:"_onContentLengthKnown",value:function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)}},{key:"_onLoaderChunkArrival",value:function(e,t,i){if(!this._onDataArrival)throw new f.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var n=this._speedSampler.lastSecondKBps;if(0!==n){var r=this._normalizeSpeed(n);this._speedNormalized!==r&&(this._speedNormalized=r,this._adjustStashSize(r))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize){new Uint8Array(this._stashBuffer,0,this._stashSize).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{var a=new Uint8Array(this._stashBuffer,0,this._bufferSize);if(this._stashUsed>0){var s=this._stashBuffer.slice(0,this._stashUsed),o=this._dispatchChunks(s,this._stashByteStart);if(o<s.byteLength){if(o>0){var u=new Uint8Array(s,o);a.set(u,0),this._stashUsed=u.byteLength,this._stashByteStart+=o}}else this._stashUsed=0,this._stashByteStart+=o;this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{var l=this._dispatchChunks(e,t);if(l<e.byteLength){var c=e.byteLength-l;c>this._bufferSize&&(this._expandBuffer(c),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e,l),0),this._stashUsed+=c,this._stashByteStart=t+l}}}else if(0===this._stashUsed){var d=this._dispatchChunks(e,t);if(d<e.byteLength){var h=e.byteLength-d;h>this._bufferSize&&this._expandBuffer(h),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(e,d),0),this._stashUsed+=h,this._stashByteStart=t+d}}else{this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength);var p=new Uint8Array(this._stashBuffer,0,this._bufferSize);p.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;var m=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(m<this._stashUsed&&m>0){var g=new Uint8Array(this._stashBuffer,m);p.set(g,0)}this._stashUsed-=m,this._stashByteStart+=m}}}},{key:"_flushStashBuffer",value:function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),n=t.byteLength-i;if(i<t.byteLength){if(!e){if(i>0){var a=new Uint8Array(this._stashBuffer,0,this._bufferSize),s=new Uint8Array(t,i);a.set(s,0),this._stashUsed=s.byteLength,this._stashByteStart+=i}return 0}r.default.w(this.TAG,n+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,n}return 0}},{key:"_onLoaderComplete",value:function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}},{key:"_onLoaderError",value:function(e,t){switch(r.default.e(this.TAG,"Loader error, code = "+t.code+", msg = "+t.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=s.LoaderErrors.UNRECOVERABLE_EARLY_EOF),e){case s.LoaderErrors.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var i=this._currentRange.to+1;return void(i<this._totalLength&&(r.default.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(i,!1)))}e=s.LoaderErrors.UNRECOVERABLE_EARLY_EOF;break;case s.LoaderErrors.UNRECOVERABLE_EARLY_EOF:case s.LoaderErrors.CONNECTING_TIMEOUT:case s.LoaderErrors.HTTP_STATUS_CODE_INVALID:case s.LoaderErrors.EXCEPTION:}if(!this._onError)throw new f.RuntimeException("IOException: "+t.msg);this._onError(e,t)}},{key:"status",get:function(){return this._loader.status}},{key:"extraData",get:function(){return this._extraData},set:function(e){this._extraData=e}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e}},{key:"onSeeked",get:function(){return this._onSeeked},set:function(e){this._onSeeked=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onComplete",get:function(){return this._onComplete},set:function(e){this._onComplete=e}},{key:"onRedirect",get:function(){return this._onRedirect},set:function(e){this._onRedirect=e}},{key:"onRecoveredEarlyEof",get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e}},{key:"currentURL",get:function(){return this._dataSource.url}},{key:"hasRedirect",get:function(){return null!=this._redirectedURL||void 0!=this._dataSource.redirectedURL}},{key:"currentRedirectedURL",get:function(){return this._redirectedURL||this._dataSource.redirectedURL}},{key:"currentSpeed",get:function(){return this._loaderClass===l.default?this._loader.currentSpeed:this._speedSampler.lastSecondKBps}},{key:"loaderType",get:function(){return this._loader.type}}]),e}();i.default=m},{"../utils/exception.js":40,"../utils/logger.js":41,"./fetch-stream-loader.js":22,"./loader.js":24,"./param-seek-handler.js":25,"./range-seek-handler.js":26,"./speed-sampler.js":27,"./websocket-loader.js":28,"./xhr-moz-chunked-loader.js":29,"./xhr-msstream-loader.js":30,"./xhr-range-loader.js":31}],24:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.BaseLoader=i.LoaderErrors=i.LoaderStatus=void 0;var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=e("../utils/exception.js");var a=i.LoaderStatus={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4};i.LoaderErrors={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},i.BaseLoader=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._type=t||"undefined",this._status=a.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return n(e,[{key:"destroy",value:function(){this._status=a.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}},{key:"isWorking",value:function(){return this._status===a.kConnecting||this._status===a.kBuffering}},{key:"open",value:function(e,t){throw new r.NotImplementedException("Unimplemented abstract function!")}},{key:"abort",value:function(){throw new r.NotImplementedException("Unimplemented abstract function!")}},{key:"type",get:function(){return this._type}},{key:"status",get:function(){return this._status}},{key:"needStashBuffer",get:function(){return this._needStash}},{key:"onContentLengthKnown",get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e}},{key:"onURLRedirect",get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onComplete",get:function(){return this._onComplete},set:function(e){this._onComplete=e}}]),e}()},{"../utils/exception.js":40}],25:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();var r=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._startName=t,this._endName=i}return n(e,[{key:"getConfig",value:function(e,t){var i=e;if(0!==t.from||-1!==t.to){var n=!0;-1===i.indexOf("?")&&(i+="?",n=!1),n&&(i+="&"),i+=this._startName+"="+t.from.toString(),-1!==t.to&&(i+="&"+this._endName+"="+t.to.toString())}return{url:i,headers:{}}}},{key:"removeURLParameters",value:function(e){var t=e.split("?")[0],i=void 0,n=e.indexOf("?");-1!==n&&(i=e.substring(n+1));var r="";if(void 0!=i&&i.length>0)for(var a=i.split("&"),s=0;s<a.length;s++){var o=a[s].split("="),u=s>0;o[0]!==this._startName&&o[0]!==this._endName&&(u&&(r+="&"),r+=a[s])}return 0===r.length?t:t+"?"+r}}]),e}();i.default=r},{}],26:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._zeroStart=t||!1}return n(e,[{key:"getConfig",value:function(e,t){var i={};if(0!==t.from||-1!==t.to){var n=void 0;n=-1!==t.to?"bytes="+t.from.toString()+"-"+t.to.toString():"bytes="+t.from.toString()+"-",i.Range=n}else this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}}},{key:"removeURLParameters",value:function(e){return e}}]),e}();i.default=r},{}],27:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return n(e,[{key:"reset",value:function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}},{key:"addBytes",value:function(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())}},{key:"currentKBps",get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024}},{key:"lastSecondKBps",get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}},{key:"averageKBps",get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024}}]),e}();i.default=r},{}],28:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n,r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=e("../utils/logger.js"),s=((n=a)&&n.__esModule,e("./loader.js")),o=e("../utils/exception.js");var u=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"websocket-loader"));return e.TAG="WebSocketLoader",e._needStash=!0,e._ws=null,e._requestAbort=!1,e._receivedLength=0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.BaseLoader),r(t,null,[{key:"isSupported",value:function(){try{return void 0!==self.WebSocket}catch(e){return!1}}}]),r(t,[{key:"destroy",value:function(){this._ws&&this.abort(),function e(t,i,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,i);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType="arraybuffer",t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=s.LoaderStatus.kConnecting}catch(e){this._status=s.LoaderStatus.kError;var i={code:e.code,msg:e.message};if(!this._onError)throw new o.RuntimeException(i.msg);this._onError(s.LoaderErrors.EXCEPTION,i)}}},{key:"abort",value:function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=s.LoaderStatus.kComplete}},{key:"_onWebSocketOpen",value:function(e){this._status=s.LoaderStatus.kBuffering}},{key:"_onWebSocketClose",value:function(e){!0!==this._requestAbort?(this._status=s.LoaderStatus.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1}},{key:"_onWebSocketMessage",value:function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var i=new FileReader;i.onload=function(){t._dispatchArrayBuffer(i.result)},i.readAsArrayBuffer(e.data)}else{this._status=s.LoaderStatus.kError;var n={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new o.RuntimeException(n.msg);this._onError(s.LoaderErrors.EXCEPTION,n)}}},{key:"_dispatchArrayBuffer",value:function(e){var t=e,i=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}},{key:"_onWebSocketError",value:function(e){this._status=s.LoaderStatus.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new o.RuntimeException(t.msg);this._onError(s.LoaderErrors.EXCEPTION,t)}}]),t}();i.default=u},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],29:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),s=e("../utils/logger.js"),o=(n=s)&&n.__esModule?n:{default:n},u=e("./loader.js"),l=e("../utils/exception.js");var c=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"xhr-moz-chunked-loader"));return n.TAG="MozChunkedLoader",n._seekHandler=e,n._config=i,n._needStash=!0,n._xhr=null,n._requestAbort=!1,n._contentLength=null,n._receivedLength=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u.BaseLoader),a(t,null,[{key:"isSupported",value:function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return o.default.w("MozChunkedLoader",e.message),!1}}}]),a(t,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),function e(t,i,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,i);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function(e,t){this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&void 0!=e.redirectedURL&&(i=e.redirectedURL);var n=this._seekHandler.getConfig(i,t);this._requestURL=n.url;var a=this._xhr=new XMLHttpRequest;if(a.open("GET",n.url,!0),a.responseType="moz-chunked-arraybuffer",a.onreadystatechange=this._onReadyStateChange.bind(this),a.onprogress=this._onProgress.bind(this),a.onloadend=this._onLoadEnd.bind(this),a.onerror=this._onXhrError.bind(this),e.withCredentials&&(a.withCredentials=!0),"object"===r(n.headers)){var s=n.headers;for(var o in s)s.hasOwnProperty(o)&&a.setRequestHeader(o,s[o])}if("object"===r(this._config.headers)){var l=this._config.headers;for(var c in l)l.hasOwnProperty(c)&&a.setRequestHeader(c,l[c])}this._status=u.LoaderStatus.kConnecting,a.send()}},{key:"abort",value:function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=u.LoaderStatus.kComplete}},{key:"_onReadyStateChange",value:function(e){var t=e.target;if(2===t.readyState){if(void 0!=t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var i=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(i)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=u.LoaderStatus.kError,!this._onError)throw new l.RuntimeException("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(u.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=u.LoaderStatus.kBuffering}}},{key:"_onProgress",value:function(e){if(this._status!==u.LoaderStatus.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}}},{key:"_onLoadEnd",value:function(e){!0!==this._requestAbort?this._status!==u.LoaderStatus.kError&&(this._status=u.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1}},{key:"_onXhrError",value:function(e){this._status=u.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&e.loaded<this._contentLength?(t=u.LoaderErrors.EARLY_EOF,i={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=u.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new l.RuntimeException(i.msg);this._onError(t,i)}}]),t}();i.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],30:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),s=e("../utils/logger.js"),o=(n=s)&&n.__esModule?n:{default:n},u=e("./loader.js"),l=e("../utils/exception.js");var c=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"xhr-msstream-loader"));return n.TAG="MSStreamLoader",n._seekHandler=e,n._config=i,n._needStash=!0,n._xhr=null,n._reader=null,n._totalRange=null,n._currentRange=null,n._currentRequestURL=null,n._currentRedirectedURL=null,n._contentLength=null,n._receivedLength=0,n._bufferLimit=16777216,n._lastTimeBufferSize=0,n._isReconnecting=!1,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u.BaseLoader),a(t,null,[{key:"isSupported",value:function(){try{if(void 0===self.MSStream||void 0===self.MSStreamReader)return!1;var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="ms-stream","ms-stream"===e.responseType}catch(e){return o.default.w("MSStreamLoader",e.message),!1}}}]),a(t,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),this._reader&&(this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr=null),function e(t,i,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,i);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function(e,t){this._internalOpen(e,t,!1)}},{key:"_internalOpen",value:function(e,t,i){this._dataSource=e,i?this._currentRange=t:this._totalRange=t;var n=e.url;this._config.reuseRedirectedURL&&(void 0!=this._currentRedirectedURL?n=this._currentRedirectedURL:void 0!=e.redirectedURL&&(n=e.redirectedURL));var a=this._seekHandler.getConfig(n,t);this._currentRequestURL=a.url;var s=this._reader=new self.MSStreamReader;s.onprogress=this._msrOnProgress.bind(this),s.onload=this._msrOnLoad.bind(this),s.onerror=this._msrOnError.bind(this);var o=this._xhr=new XMLHttpRequest;if(o.open("GET",a.url,!0),o.responseType="ms-stream",o.onreadystatechange=this._xhrOnReadyStateChange.bind(this),o.onerror=this._xhrOnError.bind(this),e.withCredentials&&(o.withCredentials=!0),"object"===r(a.headers)){var l=a.headers;for(var c in l)l.hasOwnProperty(c)&&o.setRequestHeader(c,l[c])}if("object"===r(this._config.headers)){var d=this._config.headers;for(var h in d)d.hasOwnProperty(h)&&o.setRequestHeader(h,d[h])}this._isReconnecting?this._isReconnecting=!1:this._status=u.LoaderStatus.kConnecting,o.send()}},{key:"abort",value:function(){this._internalAbort(),this._status=u.LoaderStatus.kComplete}},{key:"_internalAbort",value:function(){this._reader&&(1===this._reader.readyState&&this._reader.abort(),this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.abort(),this._xhr.onreadystatechange=null,this._xhr=null)}},{key:"_xhrOnReadyStateChange",value:function(e){var t=e.target;if(2===t.readyState)if(t.status>=200&&t.status<=299){if(this._status=u.LoaderStatus.kBuffering,void 0!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}var n=t.getResponseHeader("Content-Length");if(null!=n&&null==this._contentLength){var r=parseInt(n);r>0&&(this._contentLength=r,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength))}}else{if(this._status=u.LoaderStatus.kError,!this._onError)throw new l.RuntimeException("MSStreamLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(u.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else if(3===t.readyState&&t.status>=200&&t.status<=299){this._status=u.LoaderStatus.kBuffering;var a=t.response;this._reader.readAsArrayBuffer(a)}}},{key:"_xhrOnError",value:function(e){this._status=u.LoaderStatus.kError;var t=u.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type};if(!this._onError)throw new l.RuntimeException(i.msg);this._onError(t,i)}},{key:"_msrOnProgress",value:function(e){var t=e.target.result;if(null!=t){var i=t.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=t.byteLength;var n=this._totalRange.from+this._receivedLength;this._receivedLength+=i.byteLength,this._onDataArrival&&this._onDataArrival(i,n,this._receivedLength),t.byteLength>=this._bufferLimit&&(o.default.v(this.TAG,"MSStream buffer exceeded max size near "+(n+i.byteLength)+", reconnecting..."),this._doReconnectIfNeeded())}else this._doReconnectIfNeeded()}},{key:"_doReconnectIfNeeded",value:function(){if(null==this._contentLength||this._receivedLength<this._contentLength){this._isReconnecting=!0,this._lastTimeBufferSize=0,this._internalAbort();var e={from:this._totalRange.from+this._receivedLength,to:-1};this._internalOpen(this._dataSource,e,!0)}}},{key:"_msrOnLoad",value:function(e){this._status=u.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._totalRange.from,this._totalRange.from+this._receivedLength-1)}},{key:"_msrOnError",value:function(e){this._status=u.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength<this._contentLength?(t=u.LoaderErrors.EARLY_EOF,i={code:-1,msg:"MSStream meet Early-Eof"}):(t=u.LoaderErrors.EARLY_EOF,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new l.RuntimeException(i.msg);this._onError(t,i)}}]),t}();i.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],31:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=l(e("../utils/logger.js")),s=l(e("./speed-sampler.js")),o=e("./loader.js"),u=e("../utils/exception.js");function l(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"xhr-range-loader"));return n.TAG="RangeLoader",n._seekHandler=e,n._config=i,n._needStash=!1,n._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],n._currentChunkSizeKB=384,n._currentSpeedNormalized=0,n._zeroSpeedChunkCount=0,n._xhr=null,n._speedSampler=new s.default,n._requestAbort=!1,n._waitForTotalLength=!1,n._totalLengthReceived=!1,n._currentRequestURL=null,n._currentRedirectedURL=null,n._currentRequestRange=null,n._totalLength=null,n._contentLength=null,n._receivedLength=0,n._lastTimeLoaded=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o.BaseLoader),r(t,null,[{key:"isSupported",value:function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="arraybuffer","arraybuffer"===e.responseType}catch(e){return a.default.w("RangeLoader",e.message),!1}}}]),r(t,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),function e(t,i,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,i);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function(e,t){this._dataSource=e,this._range=t,this._status=o.LoaderStatus.kConnecting;var i=!1;void 0!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(i=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||i?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))}},{key:"_openSubRange",value:function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,i=t+e;null!=this._contentLength&&i-this._range.from>=this._contentLength&&(i=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:i},this._internalOpen(this._dataSource,this._currentRequestRange)}},{key:"_internalOpen",value:function(e,t){this._lastTimeLoaded=0;var i=e.url;this._config.reuseRedirectedURL&&(void 0!=this._currentRedirectedURL?i=this._currentRedirectedURL:void 0!=e.redirectedURL&&(i=e.redirectedURL));var r=this._seekHandler.getConfig(i,t);this._currentRequestURL=r.url;var a=this._xhr=new XMLHttpRequest;if(a.open("GET",r.url,!0),a.responseType="arraybuffer",a.onreadystatechange=this._onReadyStateChange.bind(this),a.onprogress=this._onProgress.bind(this),a.onload=this._onLoad.bind(this),a.onerror=this._onXhrError.bind(this),e.withCredentials&&(a.withCredentials=!0),"object"===n(r.headers)){var s=r.headers;for(var o in s)s.hasOwnProperty(o)&&a.setRequestHeader(o,s[o])}if("object"===n(this._config.headers)){var u=this._config.headers;for(var l in u)u.hasOwnProperty(l)&&a.setRequestHeader(l,u[l])}a.send()}},{key:"abort",value:function(){this._requestAbort=!0,this._internalAbort(),this._status=o.LoaderStatus.kComplete}},{key:"_internalAbort",value:function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}},{key:"_onReadyStateChange",value:function(e){var t=e.target;if(2===t.readyState){if(void 0!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=o.LoaderStatus.kBuffering}else{if(this._status=o.LoaderStatus.kError,!this._onError)throw new u.RuntimeException("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}}},{key:"_onProgress",value:function(e){if(this._status!==o.LoaderStatus.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var i=e.total;this._internalAbort(),null!=i&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var n=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(n)}}},{key:"_normalizeSpeed",value:function(e){var t=this._chunkSizeKBList,i=t.length-1,n=0,r=0,a=i;if(e<t[0])return t[0];for(;r<=a;){if((n=r+Math.floor((a-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:a=n-1}}},{key:"_onLoad",value:function(e){if(this._status!==o.LoaderStatus.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(0===t&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),0!==t){var i=this._normalizeSpeed(t);this._currentSpeedNormalized!==i&&(this._currentSpeedNormalized=i,this._currentChunkSizeKB=i)}var n=e.target.response,r=this._range.from+this._receivedLength;this._receivedLength+=n.byteLength;var a=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():a=!0,this._onDataArrival&&this._onDataArrival(n,r,this._receivedLength),a&&(this._status=o.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}}},{key:"_onXhrError",value:function(e){this._status=o.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=o.LoaderErrors.EARLY_EOF,i={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=o.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new u.RuntimeException(i.msg);this._onError(t,i)}},{key:"currentSpeed",get:function(){return this._speedSampler.lastSecondKBps}}]),t}();i.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24,"./speed-sampler.js":27}],32:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=g(e("events")),s=g(e("../utils/logger.js")),o=g(e("../utils/browser.js")),u=g(e("./player-events.js")),l=g(e("../core/transmuxer.js")),c=g(e("../core/transmuxing-events.js")),d=g(e("../core/mse-controller.js")),h=g(e("../core/mse-events.js")),f=e("./player-errors.js"),p=e("../config.js"),m=e("../utils/exception.js");function g(e){return e&&e.__esModule?e:{default:e}}var v=function(){function e(t,i){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new a.default,this._config=(0,p.createDefaultConfig)(),"object"===(void 0===i?"undefined":n(i))&&Object.assign(this._config,i),"flv"!==t.type.toLowerCase())throw new m.InvalidArgumentException("FlvPlayer requires an flv MediaDataSource input!");!0===t.isLive&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=t,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var r=o.default.chrome&&(o.default.version.major<50||50===o.default.version.major&&o.default.version.build<2661);this._alwaysSeekKeyframe=!!(r||o.default.msedge||o.default.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return r(e,[{key:"destroy",value:function(){null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter&&this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){var i=this;e===u.default.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then(function(){i._emitter.emit(u.default.MEDIA_INFO,i.mediaInfo)}):e===u.default.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then(function(){i._emitter.emit(u.default.STATISTICS_INFO,i.statisticsInfo)}),this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"attachMediaElement",value:function(e){var t=this;if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),e.addEventListener("seeking",this.e.onvSeeking),e.addEventListener("canplay",this.e.onvCanPlay),e.addEventListener("stalled",this.e.onvStalled),e.addEventListener("progress",this.e.onvProgress),this._msectl=new d.default(this._config),this._msectl.on(h.default.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(h.default.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(h.default.SOURCE_OPEN,function(){t._mseSourceOpened=!0,t._hasPendingLoad&&(t._hasPendingLoad=!1,t.load())}),this._msectl.on(h.default.ERROR,function(e){t._emitter.emit(u.default.ERROR,f.ErrorTypes.MEDIA_ERROR,f.ErrorDetails.MEDIA_MSE_ERROR,e)}),this._msectl.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}}},{key:"detachMediaElement",value:function(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)}},{key:"load",value:function(){var e=this,t=!1,i=0;if(!this._mediaElement)throw new m.IllegalStateException("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new m.IllegalStateException("FlvPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened?this._hasPendingLoad=!0:(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new l.default(this._mediaDataSource,this._config),this._transmuxer.on(c.default.INIT_SEGMENT,function(t,i){e._msectl.appendInitSegment(i)}),this._transmuxer.on(c.default.MEDIA_SEGMENT,function(n,r){if(e._msectl.appendMediaSegment(r),e._config.isLive&&"video"==r.type){flvjs.reconnect&&(e.dataRetryTimer&&(clearTimeout(e.dataRetryTimer),e.dataRetryTimer=0),e.dataRetryTimer=setTimeout(function(){e._mediaElement&&(e.unload(),e.load(),setTimeout(function(){e.play().catch(function(){})},1e3),console.log("reconnect"))},1e3));var a=e._mediaElement.currentTime,o=e._mediaElement.paused,l=r.info.beginPts-1e3*a;if(l>=3e3&&!t&&!o&&a){if(i&&i==a)return void(l>=5e3&&e._emitter.emit(u.default.ERROR,f.ErrorTypes.OTHER_ERROR,"got wrong timestamp ",r.info.beginPts));var c=r.info.beginPts/1e3-1;s.default.w(e.TAG,"Live seems stuck at "+a+", try seek to "+c),t=!0,e._requestSetTime=!0,e.currentTime=c,i=a}else l>=2e3&&t&&(t=!1)}if(e._config.lazyLoad&&!e._config.isLive){a=e._mediaElement.currentTime;r.info.endDts>=1e3*(a+e._config.lazyLoadMaxDuration)&&null==e._progressChecker&&(s.default.v(e.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),e._suspendTransmuxer())}}),this._transmuxer.on(c.default.LOADING_COMPLETE,function(){e._msectl.endOfStream(),e._emitter.emit(u.default.LOADING_COMPLETE)}),this._transmuxer.on(c.default.RECOVERED_EARLY_EOF,function(){e._emitter.emit(u.default.RECOVERED_EARLY_EOF)}),this._transmuxer.on(c.default.IO_ERROR,function(t,i){e._emitter.emit(u.default.ERROR,f.ErrorTypes.NETWORK_ERROR,t,i)}),this._transmuxer.on(c.default.DEMUX_ERROR,function(t,i){e._emitter.emit(u.default.ERROR,f.ErrorTypes.MEDIA_ERROR,t,{code:-1,msg:i})}),this._transmuxer.on(c.default.MEDIA_INFO,function(t){e._mediaInfo=t,e._emitter.emit(u.default.MEDIA_INFO,Object.assign({},t))}),this._transmuxer.on(c.default.METADATA_ARRIVED,function(t){e._emitter.emit(u.default.METADATA_ARRIVED,t)}),this._transmuxer.on(c.default.SCRIPTDATA_ARRIVED,function(t){e._emitter.emit(u.default.SCRIPTDATA_ARRIVED,t)}),this._transmuxer.on(c.default.STATISTICS_INFO,function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(u.default.STATISTICS_INFO,Object.assign({},e._statisticsInfo))}),this._transmuxer.on(c.default.RECOMMEND_SEEKPOINT,function(t){e._mediaElement&&!e._config.accurateSeek&&(console.log("recommend seekpoint",t/1e3),e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)}),this._transmuxer.open()))}},{key:"unload",value:function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)}},{key:"play",value:function(){return this._mediaElement.play()}},{key:"pause",value:function(){this._mediaElement.pause()}},{key:"_fillStatisticsInfo",value:function(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();i=r.totalVideoFrames,n=r.droppedVideoFrames}else void 0!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e}},{key:"_onmseUpdateEnd",value:function(){if(this._config.lazyLoad&&!this._config.isLive){for(var e=this._mediaElement.buffered,t=this._mediaElement.currentTime,i=0,n=0;n<e.length;n++){var r=e.start(n),a=e.end(n);if(r<=t&&t<a){r,i=a;break}}i>=t+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(s.default.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}}},{key:"_onmseBufferFull",value:function(){s.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()}},{key:"_suspendTransmuxer",value:function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))}},{key:"_checkProgressAndResume",value:function(){for(var e=this._mediaElement.currentTime,t=this._mediaElement.buffered,i=!1,n=0;n<t.length;n++){var r=t.start(n),a=t.end(n);if(e>=r&&e<a){e>=a-this._config.lazyLoadRecoverDuration&&(i=!0);break}}i&&(window.clearInterval(this._progressChecker),this._progressChecker=null,i&&(s.default.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))}},{key:"_isTimepointBuffered",value:function(e){for(var t=this._mediaElement.buffered,i=0;i<t.length;i++){var n=t.start(i),r=t.end(i);if(e>=n&&e<r)return!0}return!1}},{key:"_internalSeek",value:function(e){var t=this._isTimepointBuffered(e),i=!1,n=0;if(e<1&&this._mediaElement.buffered.length>0){var r=this._mediaElement.buffered.start(0);(r<1&&e<r||o.default.safari)&&(i=!0,n=o.default.safari?.1:r)}if(i)this._requestSetTime=!0,this._mediaElement.currentTime=n;else if(t){if(this._alwaysSeekKeyframe){var a=this._msectl.getNearestKeyframe(Math.floor(1e3*e));this._requestSetTime=!0,this._mediaElement.currentTime=null!=a?a.dts/1e3:e}else this._requestSetTime=!0,this._mediaElement.currentTime=e;null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e)}},{key:"_checkAndApplyUnbufferedSeekpoint",value:function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var e=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(e)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},{key:"_checkAndResumeStuckPlayback",value:function(e){var t=this._mediaElement;if(e||!this._receivedCanPlay||t.readyState<2){var i=t.buffered;if(i.length>0&&t.currentTime<i.end(0)){if(this._config.isLive&&i.end(0)-t.currentTime>3600)return s.default.w(this.TAG,"Playback seems stuck at "+t.currentTime+", try seek to "+i.end(0)+", cancle"),this._mediaElement.removeEventListener("progress",this.e.onvProgress),void this._emitter.emit(u.default.ERROR,f.ErrorTypes.MEDIA_ERROR,"got wrong timestamp ",i.end(0));i.end(0)-t.currentTime>1||t.currentTime>0?(s.default.w(this.TAG,"Playback seems stuck at "+t.currentTime+", seek to "+i.end(0)),this._requestSetTime=!0,this._mediaElement.currentTime=i.end(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress)):s.default.w(this.TAG,"Playback seems stuck at "+t.currentTime+", skip seek to "+i.end(0))}}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)}},{key:"_onvLoadedMetadata",value:function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)}},{key:"_onvSeeking",value:function(e){var t=this._mediaElement.currentTime,i=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(t<1&&i.length>0){var n=i.start(0);if(n<1&&t<n||o.default.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=o.default.safari?.1:n)}if(this._isTimepointBuffered(t)){if(this._alwaysSeekKeyframe){var r=this._msectl.getNearestKeyframe(Math.floor(1e3*t));null!=r&&(this._requestSetTime=!0,this._mediaElement.currentTime=r.dts/1e3)}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:t,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}}},{key:"_onvCanPlay",value:function(e){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)}},{key:"_onvStalled",value:function(e){this._checkAndResumeStuckPlayback(!0)}},{key:"_onvProgress",value:function(e){this._checkAndResumeStuckPlayback()}},{key:"type",get:function(){return this._type}},{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e}},{key:"mediaInfo",get:function(){return Object.assign({},this._mediaInfo)}},{key:"statisticsInfo",get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}}]),e}();i.default=v},{"../config.js":5,"../core/mse-controller.js":9,"../core/mse-events.js":10,"../core/transmuxer.js":11,"../core/transmuxing-events.js":13,"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./player-errors.js":34,"./player-events.js":35,events:2}],33:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=l(e("events")),s=l(e("./player-events.js")),o=e("../config.js"),u=e("../utils/exception.js");function l(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(t,i){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new a.default,this._config=(0,o.createDefaultConfig)(),"object"===(void 0===i?"undefined":n(i))&&Object.assign(this._config,i),"flv"===t.type.toLowerCase())throw new u.InvalidArgumentException("NativePlayer does't support flv MediaDataSource input!");if(t.hasOwnProperty("segments"))throw new u.InvalidArgumentException("NativePlayer("+t.type+") doesn't support multipart playback!");this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=t,this._mediaElement=null}return r(e,[{key:"destroy",value:function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter&&this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){var i=this;e===s.default.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){i._emitter.emit(s.default.MEDIA_INFO,i.mediaInfo)}):e===s.default.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){i._emitter.emit(s.default.STATISTICS_INFO,i.statisticsInfo)}),this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"attachMediaElement",value:function(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}}},{key:"detachMediaElement",value:function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"load",value:function(){if(!this._mediaElement)throw new u.IllegalStateException("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)}},{key:"unload",value:function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"play",value:function(){return this._mediaElement.play()}},{key:"pause",value:function(){this._mediaElement.pause()}},{key:"_onvLoadedMetadata",value:function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(s.default.MEDIA_INFO,this.mediaInfo)}},{key:"_reportStatisticsInfo",value:function(){this._emitter.emit(s.default.STATISTICS_INFO,this.statisticsInfo)}},{key:"type",get:function(){return this._type}},{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e}},{key:"mediaInfo",get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e}},{key:"statisticsInfo",get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();i=r.totalVideoFrames,n=r.droppedVideoFrames}else void 0!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e}}]),e}();i.default=c},{"../config.js":5,"../utils/exception.js":40,"./player-events.js":35,events:2}],34:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.ErrorDetails=i.ErrorTypes=void 0;var n,r=e("../io/loader.js"),a=e("../demux/demux-errors.js"),s=(n=a)&&n.__esModule?n:{default:n};i.ErrorTypes={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},i.ErrorDetails={NETWORK_EXCEPTION:r.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:r.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:r.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:r.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:s.default.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:s.default.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:s.default.CODEC_UNSUPPORTED}},{"../demux/demux-errors.js":16,"../io/loader.js":24}],35:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.default={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info"}},{}],36:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return n(e,null,[{key:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null}}]),e}();i.default=r},{}],37:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return n(e,null,[{key:"init",value:function(){for(var t in e.types={hvc1:[],hvcC:[],avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],pasp:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.HDLR_VIDEO=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]),i.HDLR_AUDIO=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]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function(e){for(var t=8,i=null,n=Array.prototype.slice.call(arguments,1),r=n.length,a=0;a<r;a++)t+=n[a].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);for(var s=8,o=0;o<r;o++)i.set(n[o],s),s+=n[o].byteLength;return i}},{key:"generateInitSegment",value:function(t){var i=e.box(e.types.ftyp,e.constants.FTYP),n=e.moov(t),r=new Uint8Array(i.byteLength+n.byteLength);return r.set(i,0),r.set(n,i.byteLength),r}},{key:"moov",value:function(t){var i=e.mvhd(t.timescale,t.duration),n=e.trak(t),r=e.mvex(t);return e.box(e.types.moov,i,n,r)}},{key:"mvhd",value:function(t,i){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,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]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"tkhd",value:function(t){var i=t.id,n=t.duration,r=t.presentWidth,a=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,a>>>8&255,255&a,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))}},{key:"mdhd",value:function(t){var i=t.timescale,n=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,85,196,0,0]))}},{key:"hdlr",value:function(t){var i=null;return i="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,i)}},{key:"minf",value:function(t){var i=null;return i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,i,e.dinf(),e.stbl(t))}},{key:"dinf",value:function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))}},{key:"stsd",value:function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))}},{key:"mp3",value:function(t){var i=t.channelCount,n=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,n>>>8&255,255&n,0,0]);return e.box(e.types[".mp3"],r)}},{key:"mp4a",value:function(t){var i=t.channelCount,n=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,n>>>8&255,255&n,0,0]);return e.box(e.types.mp4a,r,e.esds(t))}},{key:"esds",value:function(t){var i=t.config||[],n=i.length,r=new Uint8Array([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([n]).concat(i).concat([6,1,2]));return e.box(e.types.esds,r)}},{key:"avc1",value:function(t){var i=t.avcc,n=t.codecWidth,r=t.codecHeight,a=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,n>>>8&255,255&n,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return t.codec.indexOf("hvc1")>=0?e.box(e.types.hvc1,a,e.box(e.types.hvcC,i)):e.box(e.types.avc1,a,e.box(e.types.avcC,i))}},{key:"mvex",value:function(t){return e.box(e.types.mvex,e.trex(t))}},{key:"trex",value:function(t){var i=t.id,n=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,n)}},{key:"moof",value:function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))}},{key:"mfhd",value:function(t){var i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,i)}},{key:"traf",value:function(t,i){var n=t.id,r=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n])),a=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),s=e.sdtp(t),o=e.trun(t,s.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,a,o,s)}},{key:"sdtp",value:function(t){for(var i=t.samples||[],n=i.length,r=new Uint8Array(4+n),a=0;a<n;a++){var s=i[a].flags;r[a+4]=s.isLeading<<6|s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy}return e.box(e.types.sdtp,r)}},{key:"trun",value:function(t,i){var n=t.samples||[],r=n.length,a=12+16*r,s=new Uint8Array(a);i+=8+a,s.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var o=0;o<r;o++){var u=n[o].duration,l=n[o].size,c=n[o].flags,d=n[o].cts;s.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,l>>>24&255,l>>>16&255,l>>>8&255,255&l,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.isNonSync,0,0,d>>>24&255,d>>>16&255,d>>>8&255,255&d],12+16*o)}return e.box(e.types.trun,s)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();r.init(),i.default=r},{}],38:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=c(e("../utils/logger.js")),a=c(e("./mp4-generator.js")),s=c(e("./aac-silent.js")),o=c(e("../utils/browser.js")),u=e("../core/media-segment-info.js"),l=e("../utils/exception.js");function c(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="MP4Remuxer",this._config=t,this._isLive=!0===t.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new u.MediaSegmentInfoList("audio"),this._videoSegmentInfoList=new u.MediaSegmentInfoList("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!o.default.chrome||!(o.default.version.major<50||50===o.default.version.major&&o.default.version.build<2661)),this._fillSilentAfterSeek=o.default.msedge||o.default.msie,this._mp3UseMpegAudio=!o.default.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return n(e,[{key:"destroy",value:function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null}},{key:"bindDataSource",value:function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this}},{key:"insertDiscontinuity",value:function(){this._audioNextDts=this._videoNextDts=void 0}},{key:"seek",value:function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()}},{key:"remux",value:function(e,t){if(!this._onMediaSegment)throw new l.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),this._remuxVideo(t),this._remuxAudio(e)}},{key:"_onTrackMetadataReceived",value:function(e,t){var i=null,n="mp4",r=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(n="mpeg",r="",i=new Uint8Array):i=a.default.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=a.default.generateInitSegment(t)}if(!this._onInitSegment)throw new l.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:i.buffer,codec:r,container:e+"/"+n,mediaDuration:t.duration})}},{key:"_calculateDtsBase",value:function(e,t){this._dtsBaseInited||(e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)}},{key:"flushStashedSamples",value:function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=e.length);var n={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(n.samples.push(t),n.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(n,!0)}},{key:"_remuxAudio",value:function(e,t){if(null!=this._audioMeta){var i,n=e,l=n.samples,c=void 0,d=-1,h=this._audioMeta.refSampleDuration,f="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,p=this._dtsBaseInited&&void 0===this._audioNextDts,m=!1;if(l&&0!==l.length&&(1!==l.length||t)){var g=0,v=null,y=0;f?(g=0,y=n.length):(g=8,y=8+n.length);var _=null;if(l.length>1&&(y-=(_=l.pop()).length),null!=this._audioStashedLastSample){var b=this._audioStashedLastSample;this._audioStashedLastSample=null,l.unshift(b),y+=b.length}null!=_&&(this._audioStashedLastSample=_);var T=l[0].dts-this._dtsBase;if(this._audioNextDts)c=T-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())c=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(m=!0);else{var S=this._audioSegmentInfoList.getLastSampleBefore(T);if(null!=S){var k=T-(S.originalDts+S.duration);k<=3&&(k=0),c=T-(S.dts+S.duration+k)}else c=0}if(m){var E=T-c,w=this._videoSegmentInfoList.getLastSegmentBefore(T);if(null!=w&&w.beginDts<E){var C=s.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(C){var P=w.beginDts,A=E-w.beginDts;r.default.v(this.TAG,"InsertPrefixSilentAudio: dts: "+P+", duration: "+A),l.unshift({unit:C,dts:P,pts:P}),y+=C.byteLength}}else m=!1}for(var R=[],L=0;L<l.length;L++){var O=l[L],I=O.unit,x=O.dts-this._dtsBase,D=x,M=!1,U=null,j=0;if(!(x<-.001)){if("mp3"!==this._audioMeta.codec){var B=x;if(this._audioNextDts&&(B=this._audioNextDts),(c=x-B)<=-3*h){r.default.w(this.TAG,"Dropping 1 audio frame (originalDts: "+x+" ms ,curRefDts: "+B+" ms) due to dtsCorrection: "+c+" ms overlap.");continue}if(c>=3*h&&this._fillAudioTimestampGap&&!o.default.safari){M=!0;var N=Math.floor(c/h);r.default.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: "+x+" ms, curRefDts: "+B+" ms, dtsCorrection: "+Math.round(c)+" ms, generate: "+N+" frames"),D=Math.floor(B),j=Math.floor(B+h)-D;var F=s.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);null==F&&(r.default.w(this.TAG,"Unable to generate silent frame for "+this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame"),F=I),U=[];for(var V=0;V<N;V++){B+=h;var G=Math.floor(B),H=Math.floor(B+h)-G,z={dts:G,pts:G,cts:0,unit:F,size:F.byteLength,duration:H,originalDts:x,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};U.push(z),y+=z.size}this._audioNextDts=B+h}else D=Math.floor(B),j=Math.floor(B+h)-D,this._audioNextDts=B+h}else{if(D=x-c,L!==l.length-1)j=l[L+1].dts-this._dtsBase-c-D;else if(null!=_)j=_.dts-this._dtsBase-c-D;else j=R.length>=1?R[R.length-1].duration:Math.floor(h);this._audioNextDts=D+j}-1===d&&(d=D),R.push({dts:D,pts:D,cts:0,unit:O.unit,size:O.unit.byteLength,duration:j,originalDts:x,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),M&&R.push.apply(R,U)}}if(0===R.length)return n.samples=[],void(n.length=0);f?v=new Uint8Array(y):((v=new Uint8Array(y))[0]=y>>>24&255,v[1]=y>>>16&255,v[2]=y>>>8&255,v[3]=255&y,v.set(a.default.types.mdat,4));for(var q=0;q<R.length;q++){var W=R[q].unit;v.set(W,g),g+=W.byteLength}var K=R[R.length-1];i=K.dts+K.duration;var $=new u.MediaSegmentInfo;$.beginDts=d,$.endDts=i,$.beginPts=d,$.endPts=i,$.originalBeginDts=R[0].originalDts,$.originalEndDts=K.originalDts+K.duration,$.firstSample=new u.SampleInfo(R[0].dts,R[0].pts,R[0].duration,R[0].originalDts,!1),$.lastSample=new u.SampleInfo(K.dts,K.pts,K.duration,K.originalDts,!1),this._isLive||this._audioSegmentInfoList.append($),n.samples=R,n.sequenceNumber++;var X=null;X=f?new Uint8Array:a.default.moof(n,d),n.samples=[],n.length=0;var Y={type:"audio",data:this._mergeBoxes(X,v).buffer,sampleCount:R.length,info:$};f&&p&&(Y.timestampOffset=d),this._onMediaSegment("audio",Y)}}}},{key:"_remuxVideo",value:function(e,t){if(null!=this._videoMeta){var i,n,s=e,o=s.samples,l=void 0,c=-1,d=-1;if(o&&0!==o.length&&(1!==o.length||t)){var h=8,f=null,p=8+e.length,m=null;if(o.length>1&&(p-=(m=o.pop()).length),null!=this._videoStashedLastSample){var g=this._videoStashedLastSample;this._videoStashedLastSample=null,o.unshift(g),p+=g.length}null!=m&&(this._videoStashedLastSample=m);var v=o[0].dts-this._dtsBase;if(this._videoNextDts)l=v-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())l=0;else{var y=this._videoSegmentInfoList.getLastSampleBefore(v);if(null!=y){var _=v-(y.originalDts+y.duration);_<=3&&(_=0),l=v-(y.dts+y.duration+_)}else l=0}for(var b=new u.MediaSegmentInfo,T=[],S=0;S<o.length;S++){var k=o[S],E=k.dts-this._dtsBase,w=k.isKeyframe,C=E-l,P=k.cts,A=C+P;-1===c&&(c=C,d=A);var R=0;if(S!==o.length-1)R=o[S+1].dts-this._dtsBase-l-C;else if(null!=m)R=m.dts-this._dtsBase-l-C;else R=T.length>=1?T[T.length-1].duration:Math.floor(this._videoMeta.refSampleDuration);if(R<=0&&(r.default.w(this.TAG,"remux video got invalid sample duration "+R+", force to 1"),R=1),w){var L=new u.SampleInfo(C,A,R,k.dts,!0);L.fileposition=k.fileposition,b.appendSyncPoint(L)}T.push({dts:C,pts:A,cts:P,units:k.units,size:k.length,isKeyframe:w,duration:R,originalDts:E,flags:{isLeading:0,dependsOn:w?2:1,isDependedOn:w?1:0,hasRedundancy:0,isNonSync:w?0:1}})}(f=new Uint8Array(p))[0]=p>>>24&255,f[1]=p>>>16&255,f[2]=p>>>8&255,f[3]=255&p,f.set(a.default.types.mdat,4);for(var O=0;O<T.length;O++)for(var I=T[O].units;I.length;){var x=I.shift().data;f.set(x,h),h+=x.byteLength}var D=T[T.length-1];if(i=D.dts+D.duration,n=D.pts+D.duration,this._videoNextDts=i,b.beginDts=c,b.endDts=i,b.beginPts=d,b.endPts=n,b.originalBeginDts=T[0].originalDts,b.originalEndDts=D.originalDts+D.duration,b.firstSample=new u.SampleInfo(T[0].dts,T[0].pts,T[0].duration,T[0].originalDts,T[0].isKeyframe),b.lastSample=new u.SampleInfo(D.dts,D.pts,D.duration,D.originalDts,D.isKeyframe),this._isLive||this._videoSegmentInfoList.append(b),s.samples=T,s.sequenceNumber++,this._forceFirstIDR){var M=T[0].flags;M.dependsOn=2,M.isNonSync=0}var U=a.default.moof(s,c);s.samples=[],s.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(U,f).buffer,sampleCount:T.length,info:b})}}}},{key:"_mergeBoxes",value:function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i}},{key:"onInitSegment",get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e}},{key:"onMediaSegment",get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e}}]),e}();i.default=d},{"../core/media-segment-info.js":8,"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./aac-silent.js":36,"./mp4-generator.js":37}],39:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],i=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],r={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},a={};if(r.browser){a[r.browser]=!0;var s=r.majorVersion.split(".");a.version={major:parseInt(r.majorVersion,10),string:r.version},s.length>1&&(a.version.minor=parseInt(s[1],10)),s.length>2&&(a.version.build=parseInt(s[2],10))}r.platform&&(a[r.platform]=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),(a.rv||a.iemobile)&&(a.rv&&delete a.rv,r.browser="msie",a.msie=!0);a.edge&&(delete a.edge,r.browser="msedge",a.msedge=!0);a.opr&&(r.browser="opera",a.opera=!0);a.safari&&a.android&&(r.browser="android",a.android=!0);for(var o in a.name=r.browser,a.platform=r.platform,n)n.hasOwnProperty(o)&&delete n[o];Object.assign(n,a)}(),i.default=n},{}],40:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=i.RuntimeException=function(){function e(t){s(this,e),this._message=t}return n(e,[{key:"toString",value:function(){return this.name+": "+this.message}},{key:"name",get:function(){return"RuntimeException"}},{key:"message",get:function(){return this._message}}]),e}();i.IllegalStateException=function(e){function t(e){return s(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,o),n(t,[{key:"name",get:function(){return"IllegalStateException"}}]),t}(),i.InvalidArgumentException=function(e){function t(e){return s(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,o),n(t,[{key:"name",get:function(){return"InvalidArgumentException"}}]),t}(),i.NotImplementedException=function(e){function t(e){return s(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,o),n(t,[{key:"name",get:function(){return"NotImplementedException"}}]),t}()},{}],41:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n,r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=e("events"),s=(n=a)&&n.__esModule?n:{default:n};var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"e",value:function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",n),e.ENABLE_ERROR&&(console.error?console.error(n):console.warn?console.warn(n):console.log(n))}},{key:"i",value:function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",n),e.ENABLE_INFO&&(console.info?console.info(n):console.log(n))}},{key:"w",value:function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",n),e.ENABLE_WARN&&(console.warn?console.warn(n):console.log(n))}},{key:"d",value:function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",n),e.ENABLE_DEBUG&&(console.debug?console.debug(n):console.log(n))}},{key:"v",value:function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",n),e.ENABLE_VERBOSE&&console.log(n)}}]),e}();o.GLOBAL_TAG="flv.js",o.FORCE_GLOBAL_TAG=!1,o.ENABLE_ERROR=!0,o.ENABLE_INFO=!0,o.ENABLE_WARN=!0,o.ENABLE_DEBUG=!0,o.ENABLE_VERBOSE=!0,o.ENABLE_CALLBACK=!1,o.emitter=new s.default,i.default=o},{events:2}],42:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=s(e("events")),a=s(e("./logger.js"));function s(e){return e&&e.__esModule?e:{default:e}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return n(e,null,[{key:"getConfig",value:function(){return{globalTag:a.default.GLOBAL_TAG,forceGlobalTag:a.default.FORCE_GLOBAL_TAG,enableVerbose:a.default.ENABLE_VERBOSE,enableDebug:a.default.ENABLE_DEBUG,enableInfo:a.default.ENABLE_INFO,enableWarn:a.default.ENABLE_WARN,enableError:a.default.ENABLE_ERROR,enableCallback:a.default.ENABLE_CALLBACK}}},{key:"applyConfig",value:function(e){a.default.GLOBAL_TAG=e.globalTag,a.default.FORCE_GLOBAL_TAG=e.forceGlobalTag,a.default.ENABLE_VERBOSE=e.enableVerbose,a.default.ENABLE_DEBUG=e.enableDebug,a.default.ENABLE_INFO=e.enableInfo,a.default.ENABLE_WARN=e.enableWarn,a.default.ENABLE_ERROR=e.enableError,a.default.ENABLE_CALLBACK=e.enableCallback}},{key:"_notifyChange",value:function(){var t=e.emitter;if(t.listenerCount("change")>0){var i=e.getConfig();t.emit("change",i)}}},{key:"registerListener",value:function(t){e.emitter.addListener("change",t)}},{key:"removeListener",value:function(t){e.emitter.removeListener("change",t)}},{key:"addLogListener",value:function(t){a.default.emitter.addListener("log",t),a.default.emitter.listenerCount("log")>0&&(a.default.ENABLE_CALLBACK=!0,e._notifyChange())}},{key:"removeLogListener",value:function(t){a.default.emitter.removeListener("log",t),0===a.default.emitter.listenerCount("log")&&(a.default.ENABLE_CALLBACK=!1,e._notifyChange())}},{key:"forceGlobalTag",get:function(){return a.default.FORCE_GLOBAL_TAG},set:function(t){a.default.FORCE_GLOBAL_TAG=t,e._notifyChange()}},{key:"globalTag",get:function(){return a.default.GLOBAL_TAG},set:function(t){a.default.GLOBAL_TAG=t,e._notifyChange()}},{key:"enableAll",get:function(){return a.default.ENABLE_VERBOSE&&a.default.ENABLE_DEBUG&&a.default.ENABLE_INFO&&a.default.ENABLE_WARN&&a.default.ENABLE_ERROR},set:function(t){a.default.ENABLE_VERBOSE=t,a.default.ENABLE_DEBUG=t,a.default.ENABLE_INFO=t,a.default.ENABLE_WARN=t,a.default.ENABLE_ERROR=t,e._notifyChange()}},{key:"enableDebug",get:function(){return a.default.ENABLE_DEBUG},set:function(t){a.default.ENABLE_DEBUG=t,e._notifyChange()}},{key:"enableVerbose",get:function(){return a.default.ENABLE_VERBOSE},set:function(t){a.default.ENABLE_VERBOSE=t,e._notifyChange()}},{key:"enableInfo",get:function(){return a.default.ENABLE_INFO},set:function(t){a.default.ENABLE_INFO=t,e._notifyChange()}},{key:"enableWarn",get:function(){return a.default.ENABLE_WARN},set:function(t){a.default.ENABLE_WARN=t,e._notifyChange()}},{key:"enableError",get:function(){return a.default.ENABLE_ERROR},set:function(t){a.default.ENABLE_ERROR=t,e._notifyChange()}}]),e}();o.emitter=new r.default,i.default=o},{"./logger.js":41,events:2}],43:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();var r=function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}return n(t,null,[{key:"install",value:function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(void 0!==n&&null!==n)for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t},"function"!=typeof self.Promise&&e("es6-promise").polyfill()}}]),t}();r.install(),i.default=r},{"es6-promise":1}],44:[function(e,t,i){"use strict";function n(e,t,i){var n=e;if(t+i<n.length){for(;i--;)if(128!=(192&n[++t]))return!1;return!0}return!1}Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(e){for(var t=[],i=e,r=0,a=e.length;r<a;)if(i[r]<128)t.push(String.fromCharCode(i[r])),++r;else{if(i[r]<192);else if(i[r]<224){if(n(i,r,1)){var s=(31&i[r])<<6|63&i[r+1];if(s>=128){t.push(String.fromCharCode(65535&s)),r+=2;continue}}}else if(i[r]<240){if(n(i,r,2)){var o=(15&i[r])<<12|(63&i[r+1])<<6|63&i[r+2];if(o>=2048&&55296!=(63488&o)){t.push(String.fromCharCode(65535&o)),r+=3;continue}}}else if(i[r]<248&&n(i,r,3)){var u=(7&i[r])<<18|(63&i[r+1])<<12|(63&i[r+2])<<6|63&i[r+3];if(u>65536&&u<1114112){u-=65536,t.push(String.fromCharCode(u>>>10|55296)),t.push(String.fromCharCode(1023&u|56320)),r+=4;continue}}t.push(String.fromCharCode(65533)),++r}return t.join("")}},{}]},{},[21])(21)}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):e.videojsFlash=t(e.videojs)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},a=e.getComponent("Tech"),s=e.dom,o=e.url,u=e.createTimeRange,l=e.mergeOptions,c=i&&i.navigator||{},d=function(e){function t(a,s){n(this,t);var o=r(this,e.call(this,a,s));return a.source&&o.ready(function(){this.setSource(a.source)},!0),a.startTime&&o.ready(function(){this.load(),this.play(),this.currentTime(a.startTime)},!0),i.videojs=i.videojs||{},i.videojs.Flash=i.videojs.Flash||{},i.videojs.Flash.onReady=t.onReady,i.videojs.Flash.onEvent=t.onEvent,i.videojs.Flash.onError=t.onError,o.on("seeked",function(){this.lastSeekTarget_=void 0}),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.createEl=function(){var e=this.options_;e.swf||(e.swf="https://vjs.zencdn.net/swf/5.4.2/video-js.swf");var i=e.techId,n=l({readyFunction:"videojs.Flash.onReady",eventProxyFunction:"videojs.Flash.onEvent",errorEventProxyFunction:"videojs.Flash.onError",autoplay:e.autoplay,stretch:e.stretch||!1,fluent:e.fluent||!1,preload:e.preload,loop:e.loop,muted:e.muted},e.flashVars),r=l({wmode:"opaque",bgcolor:"#000000"},e.params),a=l({id:i,name:i,class:"vjs-tech"},e.attributes);return this.el_=t.embed(e.swf,n,r,a),this.el_.tech=this,this.el_},t.prototype.play=function(){this.ended()&&this.setCurrentTime(0),this.el_.vjs_play()},t.prototype.pause=function(){this.el_.vjs_pause()},t.prototype.src=function(e){return void 0===e?this.currentSrc():this.setSrc(e)},t.prototype.setSrc=function(e){var t=this;e=o.getAbsoluteURL(e),this.el_.vjs_src(e),this.autoplay()&&this.setTimeout(function(){return t.play()},0)},t.prototype.seeking=function(){return void 0!==this.lastSeekTarget_},t.prototype.setCurrentTime=function(t){var i=this.seekable();i.length&&(t=(t=t>i.start(0)?t:i.start(0))<i.end(i.length-1)?t:i.end(i.length-1),this.lastSeekTarget_=t,this.trigger("seeking"),this.el_.vjs_setProperty("currentTime",t),e.prototype.setCurrentTime.call(this))},t.prototype.currentTime=function(){return this.seeking()?this.lastSeekTarget_||0:this.el_.vjs_getProperty("currentTime")},t.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.vjs_getProperty("currentSrc")},t.prototype.duration=function(){if(0===this.readyState())return NaN;var e=this.el_.vjs_getProperty("duration");return e>=0?e:1/0},t.prototype.load=function(){this.el_.vjs_load()},t.prototype.poster=function(){this.el_.vjs_getProperty("poster")},t.prototype.setPoster=function(){},t.prototype.seekable=function(){var e=this.duration();return 0===e?u():u(0,e)},t.prototype.buffered=function(){var e=this.el_.vjs_getProperty("buffered");return 0===e.length?u():u(e[0][0],e[0][1])},t.prototype.supportsFullScreen=function(){return!1},t.prototype.enterFullScreen=function(){return!1},t.prototype.getVideoPlaybackQuality=function(){var e=this.el_.vjs_getProperty("getVideoPlaybackQuality");return i.performance&&"function"==typeof i.performance.now?e.creationTime=i.performance.now():i.performance&&i.performance.timing&&"number"==typeof i.performance.timing.navigationStart&&(e.creationTime=i.Date.now()-i.performance.timing.navigationStart),e},t}(a),h=["rtmpConnection","rtmpStream","preload","defaultPlaybackRate","playbackRate","autoplay","stretch","fluent","loop","controls","volume","muted","defaultMuted"],f=["networkState","readyState","initialTime","startOffsetTime","paused","ended","videoWidth","videoHeight"],p=d.prototype;function m(e){var t=e.charAt(0).toUpperCase()+e.slice(1);p["set"+t]=function(t){return this.el_.vjs_setProperty(e,t)}}function g(e){p[e]=function(){return this.el_.vjs_getProperty(e)}}for(var v=0;v<h.length;v++)g(h[v]),m(h[v]);for(var y=0;y<f.length;y++)g(f[y]);return d.isSupported=function(){return!!(e.browser.IS_CHROME&&!e.browser.IS_ANDROID||e.browser.IS_SAFARI&&!e.browser.IS_IOS)||d.version()[0]>=10},a.withSourceHandlers(d),d.nativeSourceHandler={},d.nativeSourceHandler.canPlayType=function(e){return e in d.formats?"maybe":""},d.nativeSourceHandler.canHandleSource=function(e,t){var i,n,r=void 0;return e.type?r=e.type.replace(/;.*/,"").toLowerCase():(i=e.src,r=(n=o.getFileExtension(i))?"video/"+n:""),d.nativeSourceHandler.canPlayType(r)},d.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},d.nativeSourceHandler.dispose=function(){},d.registerSourceHandler(d.nativeSourceHandler),d.formats={"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"},d.onReady=function(e){var t=s.$("#"+e),i=t&&t.tech;i&&i.el()&&d.checkReady(i)},d.checkReady=function(e){e.el()&&(e.el().vjs_getProperty?e.triggerReady():this.setTimeout(function(){d.checkReady(e)},50))},d.onEvent=function(e,t){var i=s.$("#"+e).tech,n=Array.prototype.slice.call(arguments,2);i.setTimeout(function(){i.trigger(t,n)},1)},d.onError=function(e,t){var i=s.$("#"+e).tech;if("srcnotfound"===t)return i.error(4);"string"==typeof t?i.error("FLASH: "+t):(t.origin="flash",i.error(t))},d.version=function(){var e="0,0,0";try{e=new i.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(t){try{c.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(e=(c.plugins["Shockwave Flash 2.0"]||c.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(e){}}return e.split(",")},d.embed=function(e,t,i,n){var r=d.getEmbedCode(e,t,i,n);return s.createEl("div",{innerHTML:r}).childNodes[0]},d.getEmbedCode=function(e,t,i,n){var r="",a="",s="";return t&&Object.getOwnPropertyNames(t).forEach(function(e){r+=e+"="+t[e]+"&"}),i=l({movie:e,flashvars:r,allowScriptAccess:"always",allowNetworking:"all"},i),Object.getOwnPropertyNames(i).forEach(function(e){a+='<param name="'+e+'" value="'+i[e]+'" />'}),n=l({data:e,width:"100%",height:"100%"},n),Object.getOwnPropertyNames(n).forEach(function(e){s+=e+'="'+n[e]+'" '}),'<object type="application/x-shockwave-flash" '+s+">"+a+"</object>"},function(e){e.streamingFormats={"rtmp/mp4":"MP4","rtmp/flv":"FLV"},e.streamFromParts=function(e,t){return e+"&"+t},e.streamToParts=function(e){var t={connection:"",stream:""};if(!e)return t;var i=e.search(/&(?![\w-]+=)/),n=void 0;return-1!==i?n=i+1:0===(i=n=e.lastIndexOf("/")+1)&&(i=n=e.length),t.connection=e.substring(0,i),t.stream=e.substring(n,e.length),t},e.isStreamingType=function(t){return t in e.streamingFormats},e.RTMP_RE=/^rtmp[set]?:\/\//i,e.isStreamingSrc=function(t){return e.RTMP_RE.test(t)},e.rtmpSourceHandler={},e.rtmpSourceHandler.canPlayType=function(t){return e.isStreamingType(t)?"maybe":""},e.rtmpSourceHandler.canHandleSource=function(t,i){var n=e.rtmpSourceHandler.canPlayType(t.type);return n||(e.isStreamingSrc(t.src)?"maybe":"")},e.rtmpSourceHandler.handleSource=function(t,i,n){var r=e.streamToParts(t.src);i.setRtmpConnection(r.connection),i.setRtmpStream(r.stream)},e.registerSourceHandler(e.rtmpSourceHandler)}(d),a.getTech("Flash")?(e.log.warn("Not using videojs-flash as it appears to already be registered"),e.log.warn("videojs-flash should only be used with video.js@6 and above")):e.registerTech("Flash",d),d.VERSION="2.1.2",d}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).videojsFlvjs=e()}}(function(){return function e(t,i,n){function r(s,o){if(!i[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[s]={exports:{}};t[s][0].call(c.exports,function(e){var i=t[s][1][e];return r(i||e)},c,c.exports,e,t,i,n)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}({1:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t,n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r="undefined"!=typeof window?window.videojs:void 0!==e?e.videojs:null,a=(t=r)&&t.__esModule?t:{default:t};var s=a.default.getTech("Html5"),o=a.default.mergeOptions||a.default.util.mergeOptions,u={mediaDataSource:{},config:{}},l=function(e){function t(e,i){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=o(u,e),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,i))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s),n(t,[{key:"setSrc",value:function(e){this.flvPlayer&&(this.flvPlayer.unload(),this.flvPlayer.detachMediaElement(),this.flvPlayer.destroy());var t=this.options_.mediaDataSource,i=this.options_.config;t.type=void 0===t.type?"flv":t.type,t.url=e,this.flvPlayer=window.flvjs.createPlayer(t,i),this.flvPlayer.attachMediaElement(this.el_),this.flvPlayer.load()}},{key:"dispose",value:function(){this.flvPlayer&&(this.flvPlayer.detachMediaElement(),this.flvPlayer.unload(),this.flvPlayer.destroy(),this.flvPlayer=null),function e(t,i,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,i);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"dispose",this).call(this)}}]),t}();l.isSupported=function(){return window.flvjs&&window.flvjs.isSupported()},l.formats={"video/flv":"FLV","video/x-flv":"FLV"},l.canPlayType=function(e){return l.isSupported()&&e in l.formats?"maybe":""},l.canPlaySource=function(e,t){return l.canPlayType(e.type)},l.VERSION="0.2.0",a.default.registerTech("Flvjs",l),i.default=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).adapter=e()}}(function(){return function(){return function e(t,i,n){function r(s,o){if(!i[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[s]={exports:{}};t[s][0].call(c.exports,function(e){return r(t[s][1][e]||e)},c,c.exports,e,t,i,n)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}}()({1:[function(e,t,i){"use strict";var n=(0,e("./adapter_factory.js").adapterFactory)({window:"undefined"==typeof window?void 0:window});t.exports=n},{"./adapter_factory.js":2}],2:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.adapterFactory=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).window,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0},i=n.log,l=n.detectBrowser(e),c={browserDetails:l,commonShim:u,extractVersion:n.extractVersion,disableLog:n.disableLog,disableWarnings:n.disableWarnings};switch(l.browser){case"chrome":if(!r||!r.shimPeerConnection||!t.shimChrome)return i("Chrome shim is not included in this adapter release."),c;if(null===l.version)return i("Chrome shim can not determine version, not shimming."),c;i("adapter.js shimming chrome."),c.browserShim=r,r.shimGetUserMedia(e),r.shimMediaStream(e),r.shimPeerConnection(e),r.shimOnTrack(e),r.shimAddTrackRemoveTrack(e),r.shimGetSendersWithDtmf(e),r.shimGetStats(e),r.shimSenderReceiverGetStats(e),r.fixNegotiationNeeded(e),u.shimRTCIceCandidate(e),u.shimConnectionState(e),u.shimMaxMessageSize(e),u.shimSendThrowTypeError(e),u.removeAllowExtmapMixed(e);break;case"firefox":if(!s||!s.shimPeerConnection||!t.shimFirefox)return i("Firefox shim is not included in this adapter release."),c;i("adapter.js shimming firefox."),c.browserShim=s,s.shimGetUserMedia(e),s.shimPeerConnection(e),s.shimOnTrack(e),s.shimRemoveStream(e),s.shimSenderGetStats(e),s.shimReceiverGetStats(e),s.shimRTCDataChannel(e),s.shimAddTransceiver(e),s.shimGetParameters(e),s.shimCreateOffer(e),s.shimCreateAnswer(e),u.shimRTCIceCandidate(e),u.shimConnectionState(e),u.shimMaxMessageSize(e),u.shimSendThrowTypeError(e);break;case"edge":if(!a||!a.shimPeerConnection||!t.shimEdge)return i("MS edge shim is not included in this adapter release."),c;i("adapter.js shimming edge."),c.browserShim=a,a.shimGetUserMedia(e),a.shimGetDisplayMedia(e),a.shimPeerConnection(e),a.shimReplaceTrack(e),u.shimMaxMessageSize(e),u.shimSendThrowTypeError(e);break;case"safari":if(!o||!t.shimSafari)return i("Safari shim is not included in this adapter release."),c;i("adapter.js shimming safari."),c.browserShim=o,o.shimRTCIceServerUrls(e),o.shimCreateOfferLegacy(e),o.shimCallbacksAPI(e),o.shimLocalStreamsAPI(e),o.shimRemoteStreamsAPI(e),o.shimTrackEventTransceiver(e),o.shimGetUserMedia(e),o.shimAudioContext(e),u.shimRTCIceCandidate(e),u.shimMaxMessageSize(e),u.shimSendThrowTypeError(e),u.removeAllowExtmapMixed(e);break;default:i("Unsupported browser!")}return c};var n=l(e("./utils")),r=l(e("./chrome/chrome_shim")),a=l(e("./edge/edge_shim")),s=l(e("./firefox/firefox_shim")),o=l(e("./safari/safari_shim")),u=l(e("./common_shim"));function l(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}},{"./chrome/chrome_shim":3,"./common_shim":6,"./edge/edge_shim":7,"./firefox/firefox_shim":11,"./safari/safari_shim":14,"./utils":15}],3:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=i.shimGetUserMedia=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=e("./getusermedia");Object.defineProperty(i,"shimGetUserMedia",{enumerable:!0,get:function(){return r.shimGetUserMedia}});var a=e("./getdisplaymedia");Object.defineProperty(i,"shimGetDisplayMedia",{enumerable:!0,get:function(){return a.shimGetDisplayMedia}}),i.shimMediaStream=function(e){e.MediaStream=e.MediaStream||e.webkitMediaStream},i.shimOnTrack=function(e){if("object"!==(void 0===e?"undefined":n(e))||!e.RTCPeerConnection||"ontrack"in e.RTCPeerConnection.prototype)s.wrapPeerConnectionEvent(e,"track",function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e});else{Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var i=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",function(n){var r=void 0;r=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find(function(e){return e.track&&e.track.id===n.track.id}):{track:n.track};var a=new Event("track");a.track=n.track,a.receiver=r,a.transceiver={receiver:r},a.streams=[t.stream],i.dispatchEvent(a)}),t.stream.getTracks().forEach(function(n){var r=void 0;r=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find(function(e){return e.track&&e.track.id===n.id}):{track:n};var a=new Event("track");a.track=n,a.receiver=r,a.transceiver={receiver:r},a.streams=[t.stream],i.dispatchEvent(a)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}},i.shimGetSendersWithDtmf=function(e){if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var r=i.apply(this,arguments);return r||(r=t(this,e),this._senders.push(r)),r};var r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var a=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var i=this;this._senders=this._senders||[],a.apply(this,[e]),e.getTracks().forEach(function(e){i._senders.push(t(i,e))})};var s=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],s.apply(this,[e]),e.getTracks().forEach(function(e){var i=t._senders.find(function(t){return t.track===e});i&&t._senders.splice(t._senders.indexOf(i),1)})}}else if("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var o=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=o.apply(this,[]);return t.forEach(function(t){return t._pc=e}),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}},i.shimGetStats=function(e){if(!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,i=Array.prototype.slice.call(arguments),n=i[0],r=i[1],a=i[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))return t.apply(this,[]);var s=function(e){var t={},i=e.result();return i.forEach(function(e){var i={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(function(t){i[t]=e.stat(t)}),t[i.id]=i}),t},o=function(e){return new Map(Object.keys(e).map(function(t){return[t,e[t]]}))};if(arguments.length>=2){return t.apply(this,[function(e){r(o(s(e)))},n])}return new Promise(function(i,n){t.apply(e,[function(e){i(o(s(e)))},n])}).then(r,a)}},i.shimSenderReceiverGetStats=function(e){if(!("object"===(void 0===e?"undefined":n(e))&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,i=t.apply(this,[]);return i.forEach(function(t){return t._pc=e}),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then(function(t){return s.filterStats(t,e.track,!0)})}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var r=e.RTCPeerConnection.prototype.getReceivers;r&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=r.apply(this,[]);return t.forEach(function(t){return t._pc=e}),t}),s.wrapPeerConnectionEvent(e,"track",function(e){return e.receiver._pc=e.srcElement,e}),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then(function(t){return s.filterStats(t,e.track,!1)})}}if(!("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype))return;var a=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t=arguments[0],i=void 0,n=void 0,r=void 0;return this.getSenders().forEach(function(e){e.track===t&&(i?r=!0:i=e)}),this.getReceivers().forEach(function(e){return e.track===t&&(n?r=!0:n=e),e.track===t}),r||i&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return a.apply(this,arguments)}},i.shimAddTrackRemoveTrackWithNative=u,i.shimAddTrackRemoveTrack=function(e){if(!e.RTCPeerConnection)return;var t=s.detectBrowser(e);if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return u(e);var i=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=i.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map(function(t){return e._reverseStreams[t.id]})};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var i=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(function(e){var t=i.getSenders().find(function(t){return t.track===e});if(t)throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){var r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};var r=e.RTCPeerConnection.prototype.removeStream;function a(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(function(t){var n=e._reverseStreams[t],r=e._streams[n.id];i=i.replace(new RegExp(r.id,"g"),n.id)}),new RTCSessionDescription({type:t.type,sdp:i})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,i){var n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find(function(e){return e===t}))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var a=this.getSenders().find(function(e){return e.track===t});if(a)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var s=this._streams[i.id];if(s)s.addTrack(t),Promise.resolve().then(function(){n.dispatchEvent(new Event("negotiationneeded"))});else{var o=new e.MediaStream([t]);this._streams[i.id]=o,this._reverseStreams[o.id]=i,this.addStream(o)}return this.getSenders().find(function(e){return e.track===t})},["createOffer","createAnswer"].forEach(function(t){var i=e.RTCPeerConnection.prototype[t],n=o({},t,function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?i.apply(this,[function(i){var n=a(e,i);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):i.apply(this,arguments).then(function(t){return a(e,t)})});e.RTCPeerConnection.prototype[t]=n[t]});var l=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=(e=this,t=arguments[0],i=t.sdp,Object.keys(e._reverseStreams||[]).forEach(function(t){var n=e._reverseStreams[t],r=e._streams[n.id];i=i.replace(new RegExp(n.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:i})),l.apply(this,arguments)):l.apply(this,arguments);var e,t,i};var c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=c.get.apply(this);return""===e.type?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");var i=e._pc===this;if(!i)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var n=void 0;Object.keys(this._streams).forEach(function(i){var r=t._streams[i].getTracks().find(function(t){return e.track===t});r&&(n=t._streams[i])}),n&&(1===n.getTracks().length?this.removeStream(this._reverseStreams[n.id]):n.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}},i.shimPeerConnection=function(e){var t=s.detectBrowser(e);!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection);if(!e.RTCPeerConnection)return;var i=0===e.RTCPeerConnection.prototype.addIceCandidate.length;t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var i=e.RTCPeerConnection.prototype[t],n=o({},t,function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)});e.RTCPeerConnection.prototype[t]=n[t]});var n=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return i||arguments[0]?t.version<78&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}},i.fixNegotiationNeeded=function(e){var t=s.detectBrowser(e);s.wrapPeerConnectionEvent(e,"negotiationneeded",function(e){var i=e.target;if(!(t.version<72||i.getConfiguration&&"plan-b"===i.getConfiguration().sdpSemantics)||"stable"===i.signalingState)return e})};var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils.js"));function o(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function u(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(function(t){return e._shimmedLocalStreams[t][0]})};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){if(!i)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(n)&&this._shimmedLocalStreams[i.id].push(n):this._shimmedLocalStreams[i.id]=[i,n],n};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(function(e){if(t.getSenders().find(function(t){return t.track===e}))throw new DOMException("Track already exists.","InvalidAccessError")});var n=this.getSenders();i.apply(this,arguments);var r=this.getSenders().filter(function(e){return-1===n.indexOf(e)});this._shimmedLocalStreams[e.id]=[e].concat(r)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(function(i){var n=t._shimmedLocalStreams[i].indexOf(e);-1!==n&&t._shimmedLocalStreams[i].splice(n,1),1===t._shimmedLocalStreams[i].length&&delete t._shimmedLocalStreams[i]}),r.apply(this,arguments)}}},{"../utils.js":15,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=function(e,t){if(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices)return;if(!e.navigator.mediaDevices)return;if("function"!=typeof t)return void console.error("shimGetDisplayMedia: getSourceId argument is not a function");e.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then(function(t){var n=i.video&&i.video.width,r=i.video&&i.video.height,a=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:a||3}},n&&(i.video.mandatory.maxWidth=n),r&&(i.video.mandatory.maxHeight=r),e.navigator.mediaDevices.getUserMedia(i)})}}},{}],5:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};i.shimGetUserMedia=function(e){var t=e&&e.navigator;if(!t.mediaDevices)return;var i=r.detectBrowser(e),s=function(e){if("object"!==(void 0===e?"undefined":n(e))||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(i){if("require"!==i&&"advanced"!==i&&"mediaSource"!==i){var r="object"===n(e[i])?e[i]:{ideal:e[i]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var a=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var s={};"number"==typeof r.ideal?(s[a("min",i)]=r.ideal,t.optional.push(s),(s={})[a("max",i)]=r.ideal,t.optional.push(s)):(s[a("",i)]=r.ideal,t.optional.push(s))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[a("",i)]=r.exact):["min","max"].forEach(function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[a(e,i)]=r[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},o=function(e,r){if(i.version>=61)return r(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===n(e.audio)){var o=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),o(e.audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=s(e.audio)}if(e&&"object"===n(e.video)){var u=e.video.facingMode;u=u&&("object"===(void 0===u?"undefined":n(u))?u:{ideal:u});var l=i.version<66;if(u&&("user"===u.exact||"environment"===u.exact||"user"===u.ideal||"environment"===u.ideal)&&(!t.mediaDevices.getSupportedConstraints||!t.mediaDevices.getSupportedConstraints().facingMode||l)){delete e.video.facingMode;var c=void 0;if("environment"===u.exact||"environment"===u.ideal?c=["back","rear"]:"user"!==u.exact&&"user"!==u.ideal||(c=["front"]),c)return t.mediaDevices.enumerateDevices().then(function(t){var i=(t=t.filter(function(e){return"videoinput"===e.kind})).find(function(e){return c.some(function(t){return e.label.toLowerCase().includes(t)})});return!i&&t.length&&c.includes("back")&&(i=t[t.length-1]),i&&(e.video.deviceId=u.exact?{exact:i.deviceId}:{ideal:i.deviceId}),e.video=s(e.video),a("chrome: "+JSON.stringify(e)),r(e)})}e.video=s(e.video)}return a("chrome: "+JSON.stringify(e)),r(e)},u=function(e){return i.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(t.getUserMedia=function(e,i,n){o(e,function(e){t.webkitGetUserMedia(e,i,function(e){n&&n(u(e))})})}.bind(t),t.mediaDevices.getUserMedia){var l=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return o(e,function(e){return l(e).then(function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach(function(e){e.stop()}),new DOMException("","NotFoundError");return t},function(e){return Promise.reject(u(e))})})}}};var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils.js"));var a=r.log},{"../utils.js":15}],6:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};i.shimRTCIceCandidate=function(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===(void 0===e?"undefined":n(e))&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var i=new t(e),r=s.default.parseCandidate(e.candidate),a=Object.assign(i,r);return a.toJSON=function(){return{candidate:a.candidate,sdpMid:a.sdpMid,sdpMLineIndex:a.sdpMLineIndex,usernameFragment:a.usernameFragment}},a}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,o.wrapPeerConnectionEvent(e,"icecandidate",function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t})},i.shimMaxMessageSize=function(e){if(!e.RTCPeerConnection)return;var t=o.detectBrowser(e);"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),n=e.sdpSemantics;"plan-b"===n&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;var t=s.default.splitSections(e.sdp);return t.shift(),t.some(function(e){var t=s.default.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})}(arguments[0])){var r=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var i=parseInt(t[1],10);return i!=i?-1:i}(arguments[0]),a=function(e){var i=65536;"firefox"===t.browser&&(i=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637);return i}(r),o=function(e,i){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var r=s.default.matchPrefix(e.sdp,"a=max-message-size:");r.length>0?n=parseInt(r[0].substr(19),10):"firefox"===t.browser&&-1!==i&&(n=2147483637);return n}(arguments[0],r),u=void 0;u=0===a&&0===o?Number.POSITIVE_INFINITY:0===a||0===o?Math.max(a,o):Math.min(a,o);var l={};Object.defineProperty(l,"maxMessageSize",{get:function(){return u}}),this._sctp=l}return i.apply(this,arguments)}},i.shimSendThrowTypeError=function(e){if(!(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){var i=e.send;e.send=function(){var n=arguments[0],r=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&r>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return i.apply(e,arguments)}}var i=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=i.apply(this,arguments);return t(e,this),e},o.wrapPeerConnectionEvent(e,"datachannel",function(e){return t(e.channel,e.target),e})},i.shimConnectionState=function(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(function(e){var i=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var i=new Event("connectionstatechange",e);t.dispatchEvent(i)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}})},i.removeAllowExtmapMixed=function(e){if(!e.RTCPeerConnection)return;var t=o.detectBrowser(e);if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(e){return e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")&&(e.sdp=e.sdp.split("\n").filter(function(e){return"a=extmap-allow-mixed"!==e.trim()}).join("\n")),i.apply(this,arguments)}};var r,a=e("sdp"),s=(r=a)&&r.__esModule?r:{default:r},o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("./utils"))},{"./utils":15,sdp:17}],7:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=i.shimGetUserMedia=void 0;var n=e("./getusermedia");Object.defineProperty(i,"shimGetUserMedia",{enumerable:!0,get:function(){return n.shimGetUserMedia}});var r=e("./getdisplaymedia");Object.defineProperty(i,"shimGetDisplayMedia",{enumerable:!0,get:function(){return r.shimGetDisplayMedia}}),i.shimPeerConnection=function(e){var t=s.detectBrowser(e);if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){var i=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){i.set.call(this,e);var t=new Event("enabled");t.enabled=e,this.dispatchEvent(t)}})}!e.RTCRtpSender||"dtmf"in e.RTCRtpSender.prototype||Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}});e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);var n=(0,l.default)(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=(0,o.filterIceServers)(e.iceServers,t.version),s.log("ICE servers after filtering:",e.iceServers)),new n(e)},e.RTCPeerConnection.prototype=n.prototype},i.shimReplaceTrack=function(e){!e.RTCRtpSender||"replaceTrack"in e.RTCRtpSender.prototype||(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)};var a,s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils")),o=e("./filtericeservers"),u=e("rtcpeerconnection-shim"),l=(a=u)&&a.__esModule?a:{default:a}},{"../utils":15,"./filtericeservers":8,"./getdisplaymedia":9,"./getusermedia":10,"rtcpeerconnection-shim":16}],8:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.filterIceServers=function(e,t){var i=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var t=e.urls||e.url;e.url&&!e.urls&&n.deprecated("RTCIceServer.url","RTCIceServer.urls");var r="string"==typeof t;return r&&(t=[t]),t=t.filter(function(e){if(0===e.indexOf("stun:"))return!1;var t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!i?(i=!0,!0):t&&!i}),delete e.url,e.urls=r?t[0]:t,!!t.length}})};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils"))},{"../utils":15}],9:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=function(e){if(!("getDisplayMedia"in e.navigator))return;if(!e.navigator.mediaDevices)return;if(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices)return;e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)}},{}],10:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetUserMedia=function(e){var t=e&&e.navigator,i=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return i(e).catch(function(e){return Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}}(e))})}}},{}],11:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=i.shimGetUserMedia=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=e("./getusermedia");Object.defineProperty(i,"shimGetUserMedia",{enumerable:!0,get:function(){return r.shimGetUserMedia}});var a=e("./getdisplaymedia");Object.defineProperty(i,"shimGetDisplayMedia",{enumerable:!0,get:function(){return a.shimGetDisplayMedia}}),i.shimOnTrack=function(e){"object"===(void 0===e?"undefined":n(e))&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},i.shimPeerConnection=function(e){var t=s.detectBrowser(e);if("object"!==(void 0===e?"undefined":n(e))||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection);t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var i=e.RTCPeerConnection.prototype[t],n=function(e,t,i){t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i;return e}({},t,function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)});e.RTCPeerConnection.prototype[t]=n[t]});if(t.version<68){var i=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},a=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),i=e[0],n=e[1],s=e[2];return a.apply(this,[i||null]).then(function(e){if(t.version<53&&!n)try{e.forEach(function(e){e.type=r[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach(function(t,i){e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))})}return e}).then(n,s)}},i.shimSenderGetStats=function(e){if("object"!==(void 0===e?"undefined":n(e))||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,i=t.apply(this,[]);return i.forEach(function(t){return t._pc=e}),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e});e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}},i.shimReceiverGetStats=function(e){if("object"!==(void 0===e?"undefined":n(e))||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,i=t.apply(this,[]);return i.forEach(function(t){return t._pc=e}),i});s.wrapPeerConnectionEvent(e,"track",function(e){return e.receiver._pc=e.srcElement,e}),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}},i.shimRemoveStream=function(e){if(!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype)return;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;s.deprecated("removeStream","removeTrack"),this.getSenders().forEach(function(i){i.track&&e.getTracks().includes(i.track)&&t.removeTrack(i)})}},i.shimRTCDataChannel=function(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)},i.shimAddTransceiver=function(e){if("object"!==(void 0===e?"undefined":n(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],i=e&&"sendEncodings"in e;i&&e.sendEncodings.forEach(function(e){if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});var n=t.apply(this,arguments);if(i){var r=n.sender,a=r.getParameters();"encodings"in a&&(1!==a.encodings.length||0!==Object.keys(a.encodings[0]).length)||(a.encodings=e.sendEncodings,r.sendEncodings=e.sendEncodings,this.setParametersPromises.push(r.setParameters(a).then(function(){delete r.sendEncodings}).catch(function(){delete r.sendEncodings})))}return n})},i.shimGetParameters=function(e){if("object"!==(void 0===e?"undefined":n(e))||!e.RTCRtpSender)return;var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})},i.shimCreateOffer=function(e){if("object"!==(void 0===e?"undefined":n(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=this,i=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return t.apply(e,i)}).finally(function(){e.setParametersPromises=[]}):t.apply(this,arguments)}},i.shimCreateAnswer=function(e){if("object"!==(void 0===e?"undefined":n(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=this,i=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return t.apply(e,i)}).finally(function(){e.setParametersPromises=[]}):t.apply(this,arguments)}};var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils"))},{"../utils":15,"./getdisplaymedia":12,"./getusermedia":13}],12:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=function(e,t){if(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices)return;if(!e.navigator.mediaDevices)return;e.navigator.mediaDevices.getDisplayMedia=function(i){if(!i||!i.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Promise.reject(n)}return!0===i.video?i.video={mediaSource:t}:i.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(i)}}},{}],13:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};i.shimGetUserMedia=function(e){var t=r.detectBrowser(e),i=e&&e.navigator,a=e&&e.MediaStreamTrack;if(i.getUserMedia=function(e,t,n){r.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){var s=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])},o=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(e){return"object"===(void 0===e?"undefined":n(e))&&"object"===n(e.audio)&&(e=JSON.parse(JSON.stringify(e)),s(e.audio,"autoGainControl","mozAutoGainControl"),s(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},a&&a.prototype.getSettings){var u=a.prototype.getSettings;a.prototype.getSettings=function(){var e=u.apply(this,arguments);return s(e,"mozAutoGainControl","autoGainControl"),s(e,"mozNoiseSuppression","noiseSuppression"),e}}if(a&&a.prototype.applyConstraints){var l=a.prototype.applyConstraints;a.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===(void 0===e?"undefined":n(e))&&(e=JSON.parse(JSON.stringify(e)),s(e,"autoGainControl","mozAutoGainControl"),s(e,"noiseSuppression","mozNoiseSuppression")),l.apply(this,[e])}}}};var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils"))},{"../utils":15}],14:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};i.shimLocalStreamsAPI=function(e){if("object"!==(void 0===e?"undefined":n(e))||!e.RTCPeerConnection)return;"getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams});if(!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(function(n){return t.call(i,n,e)}),e.getVideoTracks().forEach(function(n){return t.call(i,n,e)})},e.RTCPeerConnection.prototype.addTrack=function(e){for(var i=this,n=arguments.length,r=Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r&&r.forEach(function(e){i._localStreams?i._localStreams.includes(e)||i._localStreams.push(e):i._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var i=this._localStreams.indexOf(e);if(-1!==i){this._localStreams.splice(i,1);var n=e.getTracks();this.getSenders().forEach(function(e){n.includes(e.track)&&t.removeTrack(e)})}})},i.shimRemoteStreamsAPI=function(e){if("object"!==(void 0===e?"undefined":n(e))||!e.RTCPeerConnection)return;"getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]});if(!("onaddstream"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach(function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var i=new Event("addstream");i.stream=e,t.dispatchEvent(i)}})})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var i=new Event("addstream");i.stream=t,e.dispatchEvent(i)}})}),t.apply(e,arguments)}}},i.shimCallbacksAPI=function(e){if("object"!==(void 0===e?"undefined":n(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype,i=t.createOffer,r=t.createAnswer,a=t.setLocalDescription,s=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],r=i.apply(this,[n]);return t?(r.then(e,t),Promise.resolve()):r},t.createAnswer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n};var u=function(e,t,i){var n=a.apply(this,[e]);return i?(n.then(t,i),Promise.resolve()):n};t.setLocalDescription=u,u=function(e,t,i){var n=s.apply(this,[e]);return i?(n.then(t,i),Promise.resolve()):n},t.setRemoteDescription=u,u=function(e,t,i){var n=o.apply(this,[e]);return i?(n.then(t,i),Promise.resolve()):n},t.addIceCandidate=u},i.shimGetUserMedia=function(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var i=t.mediaDevices,n=i.getUserMedia.bind(i);t.mediaDevices.getUserMedia=function(e){return n(a(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,i,n){t.mediaDevices.getUserMedia(e).then(i,n)}.bind(t))},i.shimConstraints=a,i.shimRTCIceServerUrls=function(e){if(!e.RTCPeerConnection)return;var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,i){if(e&&e.iceServers){for(var n=[],a=0;a<e.iceServers.length;a++){var s=e.iceServers[a];!s.hasOwnProperty("urls")&&s.hasOwnProperty("url")?(r.deprecated("RTCIceServer.url","RTCIceServer.urls"),(s=JSON.parse(JSON.stringify(s))).urls=s.url,delete s.url,n.push(s)):n.push(e.iceServers[a])}e.iceServers=n}return new t(e,i)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})},i.shimTrackEventTransceiver=function(e){"object"===(void 0===e?"undefined":n(e))&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},i.shimCreateOfferLegacy=function(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=this.getTransceivers().find(function(e){return"audio"===e.receiver.track.kind});!1===e.offerToReceiveAudio&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveAudio||i||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var n=this.getTransceivers().find(function(e){return"video"===e.receiver.track.kind});!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video")}return t.apply(this,arguments)}},i.shimAudioContext=function(e){if("object"!==(void 0===e?"undefined":n(e))||e.AudioContext)return;e.AudioContext=e.webkitAudioContext};var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils"));function a(e){return e&&void 0!==e.video?Object.assign({},e,{video:r.compactObject(e.video)}):e}},{"../utils":15}],15:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};i.extractVersion=s,i.wrapPeerConnectionEvent=function(e,t,i){if(!e.RTCPeerConnection)return;var n=e.RTCPeerConnection.prototype,r=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return r.apply(this,arguments);var a=function(e){var t=i(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,a),r.apply(this,[e,a])};var a=n.removeEventListener;n.removeEventListener=function(e,i){if(e!==t||!this._eventMap||!this._eventMap[t])return a.apply(this,arguments);if(!this._eventMap[t].has(i))return a.apply(this,arguments);var n=this._eventMap[t].get(i);return this._eventMap[t].delete(i),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,a.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})},i.disableLog=function(e){if("boolean"!=typeof e)return new Error("Argument type: "+(void 0===e?"undefined":n(e))+". Please use a boolean.");return r=e,e?"adapter.js logging disabled":"adapter.js logging enabled"},i.disableWarnings=function(e){if("boolean"!=typeof e)return new Error("Argument type: "+(void 0===e?"undefined":n(e))+". Please use a boolean.");return a=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled")},i.log=function(){if("object"===("undefined"==typeof window?"undefined":n(window))){if(r)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}},i.deprecated=function(e,t){if(!a)return;console.warn(e+" is deprecated, please use "+t+" instead.")},i.detectBrowser=function(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var i=e.navigator;if(i.mozGetUserMedia)t.browser="firefox",t.version=s(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=s(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(i.mediaDevices&&i.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=s(i.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!i.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=s(i.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t},i.compactObject=function e(t){if(!o(t))return t;return Object.keys(t).reduce(function(i,n){var r=o(t[n]),a=r?e(t[n]):t[n],s=r&&!Object.keys(a).length;return void 0===a||s?i:Object.assign(i,function(e,t,i){t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i;return e}({},n,a))},{})},i.walkStats=u,i.filterStats=function(e,t,i){var n=i?"outbound-rtp":"inbound-rtp",r=new Map;if(null===t)return r;var a=[];return e.forEach(function(e){"track"===e.type&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(function(t){e.forEach(function(i){i.type===n&&i.trackId===t.id&&u(e,i,r)})}),r};var r=!0,a=!0;function s(e,t,i){var n=e.match(t);return n&&n.length>=i&&parseInt(n[i],10)}function o(e){return"[object Object]"===Object.prototype.toString.call(e)}function u(e,t,i){t&&!i.has(t.id)&&(i.set(t.id,t),Object.keys(t).forEach(function(n){n.endsWith("Id")?u(e,e.get(t[n]),i):n.endsWith("Ids")&&t[n].forEach(function(t){u(e,e.get(t),i)})}))}},{}],16:[function(e,t,i){"use strict";var n=e("sdp");function r(e,t,i,r,a){var s=n.writeRtpDescription(e.kind,t);if(s+=n.writeIceParameters(e.iceGatherer.getLocalParameters()),s+=n.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===i?"actpass":a||"active"),s+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?s+="a=sendrecv\r\n":e.rtpSender?s+="a=sendonly\r\n":e.rtpReceiver?s+="a=recvonly\r\n":s+="a=inactive\r\n",e.rtpSender){var o=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=o;var u="msid:"+(r?r.id:"-")+" "+o+"\r\n";s+="a="+u,s+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+u,e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+u,s+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return s+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+n.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+n.localCName+"\r\n"),s}function a(e,t){var i={codecs:[],headerExtensions:[],fecMechanisms:[]},n=function(e,t){e=parseInt(e,10);for(var i=0;i<t.length;i++)if(t[i].payloadType===e||t[i].preferredPayloadType===e)return t[i]},r=function(e,t,i,r){var a=n(e.parameters.apt,i),s=n(t.parameters.apt,r);return a&&s&&a.name.toLowerCase()===s.name.toLowerCase()};return e.codecs.forEach(function(n){for(var a=0;a<t.codecs.length;a++){var s=t.codecs[a];if(n.name.toLowerCase()===s.name.toLowerCase()&&n.clockRate===s.clockRate){if("rtx"===n.name.toLowerCase()&&n.parameters&&s.parameters.apt&&!r(n,s,e.codecs,t.codecs))continue;(s=JSON.parse(JSON.stringify(s))).numChannels=Math.min(n.numChannels,s.numChannels),i.codecs.push(s),s.rtcpFeedback=s.rtcpFeedback.filter(function(e){for(var t=0;t<n.rtcpFeedback.length;t++)if(n.rtcpFeedback[t].type===e.type&&n.rtcpFeedback[t].parameter===e.parameter)return!0;return!1});break}}}),e.headerExtensions.forEach(function(e){for(var n=0;n<t.headerExtensions.length;n++){var r=t.headerExtensions[n];if(e.uri===r.uri){i.headerExtensions.push(r);break}}}),i}function s(e,t,i){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(i)}function o(e,t){var i=e.getRemoteCandidates().find(function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type});return i||e.addRemoteCandidate(t),!i}function u(e,t){var i=new Error(t);return i.name=e,i.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],i}t.exports=function(e,t){function i(t,i){i.addTrack(t),i.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function l(t,i,n,r){var a=new Event("track");a.track=i,a.receiver=n,a.transceiver={receiver:n},a.streams=r,e.setTimeout(function(){t._dispatchEvent("track",a)})}var c=function(i){var r=this,a=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){r[e]=a[e].bind(a)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",i=JSON.parse(JSON.stringify(i||{})),this.usingBundle="max-bundle"===i.bundlePolicy,"negotiate"===i.rtcpMuxPolicy)throw u("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(i.rtcpMuxPolicy||(i.rtcpMuxPolicy="require"),i.iceTransportPolicy){case"all":case"relay":break;default:i.iceTransportPolicy="all"}switch(i.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:i.bundlePolicy="balanced"}if(i.iceServers=function(e,t){var i=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var n=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var r="string"==typeof n;return r&&(n=[n]),n=n.filter(function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||i?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(i=!0,!0)}),delete e.url,e.urls=r?n[0]:n,!!n.length}})}(i.iceServers||[],t),this._iceGatherers=[],i.iceCandidatePoolSize)for(var s=i.iceCandidatePoolSize;s>0;s--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:i.iceServers,gatherPolicy:i.iceTransportPolicy}));else i.iceCandidatePoolSize=0;this._config=i,this.transceivers=[],this._sdpSessionId=n.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(c.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(c.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),c.prototype.onicecandidate=null,c.prototype.onaddstream=null,c.prototype.ontrack=null,c.prototype.onremovestream=null,c.prototype.onsignalingstatechange=null,c.prototype.oniceconnectionstatechange=null,c.prototype.onconnectionstatechange=null,c.prototype.onicegatheringstatechange=null,c.prototype.onnegotiationneeded=null,c.prototype.ondatachannel=null,c.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},c.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},c.prototype.getConfiguration=function(){return this._config},c.prototype.getLocalStreams=function(){return this.localStreams},c.prototype.getRemoteStreams=function(){return this.remoteStreams},c.prototype._createTransceiver=function(e,t){var i=this.transceivers.length>0,n={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&i)n.iceTransport=this.transceivers[0].iceTransport,n.dtlsTransport=this.transceivers[0].dtlsTransport;else{var r=this._createIceAndDtlsTransports();n.iceTransport=r.iceTransport,n.dtlsTransport=r.dtlsTransport}return t||this.transceivers.push(n),n},c.prototype.addTrack=function(t,i){if(this._isClosed)throw u("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var n;if(this.transceivers.find(function(e){return e.track===t}))throw u("InvalidAccessError","Track already exists.");for(var r=0;r<this.transceivers.length;r++)this.transceivers[r].track||this.transceivers[r].kind!==t.kind||(n=this.transceivers[r]);return n||(n=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(i)&&this.localStreams.push(i),n.track=t,n.stream=i,n.rtpSender=new e.RTCRtpSender(t,n.dtlsTransport),n.rtpSender},c.prototype.addStream=function(e){var i=this;if(t>=15025)e.getTracks().forEach(function(t){i.addTrack(t,e)});else{var n=e.clone();e.getTracks().forEach(function(e,t){var i=n.getTracks()[t];e.addEventListener("enabled",function(e){i.enabled=e.enabled})}),n.getTracks().forEach(function(e){i.addTrack(e,n)})}},c.prototype.removeTrack=function(t){if(this._isClosed)throw u("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var i=this.transceivers.find(function(e){return e.rtpSender===t});if(!i)throw u("InvalidAccessError","Sender was not created by this connection.");var n=i.stream;i.rtpSender.stop(),i.rtpSender=null,i.track=null,i.stream=null,-1===this.transceivers.map(function(e){return e.stream}).indexOf(n)&&this.localStreams.indexOf(n)>-1&&this.localStreams.splice(this.localStreams.indexOf(n),1),this._maybeFireNegotiationNeeded()},c.prototype.removeStream=function(e){var t=this;e.getTracks().forEach(function(e){var i=t.getSenders().find(function(t){return t.track===e});i&&t.removeTrack(i)})},c.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},c.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},c.prototype._createIceGatherer=function(t,i){var n=this;if(i&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var r=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(r,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var i=!e.candidate||0===Object.keys(e.candidate).length;r.state=i?"completed":"gathering",null!==n.transceivers[t].bufferedCandidateEvents&&n.transceivers[t].bufferedCandidateEvents.push(e)},r.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),r},c.prototype._gather=function(t,i){var r=this,a=this.transceivers[i].iceGatherer;if(!a.onlocalcandidate){var s=this.transceivers[i].bufferedCandidateEvents;this.transceivers[i].bufferedCandidateEvents=null,a.removeEventListener("localcandidate",this.transceivers[i].bufferCandidates),a.onlocalcandidate=function(e){if(!(r.usingBundle&&i>0)){var s=new Event("icecandidate");s.candidate={sdpMid:t,sdpMLineIndex:i};var o=e.candidate,u=!o||0===Object.keys(o).length;if(u)"new"!==a.state&&"gathering"!==a.state||(a.state="completed");else{"new"===a.state&&(a.state="gathering"),o.component=1,o.ufrag=a.getLocalParameters().usernameFragment;var l=n.writeCandidate(o);s.candidate=Object.assign(s.candidate,n.parseCandidate(l)),s.candidate.candidate=l,s.candidate.toJSON=function(){return{candidate:s.candidate.candidate,sdpMid:s.candidate.sdpMid,sdpMLineIndex:s.candidate.sdpMLineIndex,usernameFragment:s.candidate.usernameFragment}}}var c=n.getMediaSections(r._localDescription.sdp);c[s.candidate.sdpMLineIndex]+=u?"a=end-of-candidates\r\n":"a="+s.candidate.candidate+"\r\n",r._localDescription.sdp=n.getDescription(r._localDescription.sdp)+c.join("");var d=r.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),u||r._dispatchEvent("icecandidate",s),d&&(r._dispatchEvent("icecandidate",new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange())}},e.setTimeout(function(){s.forEach(function(e){a.onlocalcandidate(e)})},0)}},c.prototype._createIceAndDtlsTransports=function(){var t=this,i=new e.RTCIceTransport(null);i.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var n=new e.RTCDtlsTransport(i);return n.ondtlsstatechange=function(){t._updateConnectionState()},n.onerror=function(){Object.defineProperty(n,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:i,dtlsTransport:n}},c.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var i=this.transceivers[e].iceTransport;i&&(delete i.onicestatechange,delete this.transceivers[e].iceTransport);var n=this.transceivers[e].dtlsTransport;n&&(delete n.ondtlsstatechange,delete n.onerror,delete this.transceivers[e].dtlsTransport)},c.prototype._transceive=function(e,i,r){var s=a(e.localCapabilities,e.remoteCapabilities);i&&e.rtpSender&&(s.encodings=e.sendEncodingParameters,s.rtcp={cname:n.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(s.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(s)),r&&e.rtpReceiver&&s.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach(function(e){delete e.rtx}),e.recvEncodingParameters.length?s.encodings=e.recvEncodingParameters:s.encodings=[{}],s.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(s.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(s.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(s))},c.prototype.setLocalDescription=function(e){var t,i,r=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(u("TypeError",'Unsupported type "'+e.type+'"'));if(!s("setLocalDescription",e.type,r.signalingState)||r._isClosed)return Promise.reject(u("InvalidStateError","Can not set local "+e.type+" in state "+r.signalingState));if("offer"===e.type)t=n.splitSections(e.sdp),i=t.shift(),t.forEach(function(e,t){var i=n.parseRtpParameters(e);r.transceivers[t].localCapabilities=i}),r.transceivers.forEach(function(e,t){r._gather(e.mid,t)});else if("answer"===e.type){t=n.splitSections(r._remoteDescription.sdp),i=t.shift();var o=n.matchPrefix(i,"a=ice-lite").length>0;t.forEach(function(e,t){var s=r.transceivers[t],u=s.iceGatherer,l=s.iceTransport,c=s.dtlsTransport,d=s.localCapabilities,h=s.remoteCapabilities;if(!(n.isRejected(e)&&0===n.matchPrefix(e,"a=bundle-only").length)&&!s.rejected){var f=n.getIceParameters(e,i),p=n.getDtlsParameters(e,i);o&&(p.role="server"),r.usingBundle&&0!==t||(r._gather(s.mid,t),"new"===l.state&&l.start(u,f,o?"controlling":"controlled"),"new"===c.state&&c.start(p));var m=a(d,h);r._transceive(s,m.codecs.length>0,!1)}})}return r._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?r._updateSignalingState("have-local-offer"):r._updateSignalingState("stable"),Promise.resolve()},c.prototype.setRemoteDescription=function(r){var c=this;if(-1===["offer","answer"].indexOf(r.type))return Promise.reject(u("TypeError",'Unsupported type "'+r.type+'"'));if(!s("setRemoteDescription",r.type,c.signalingState)||c._isClosed)return Promise.reject(u("InvalidStateError","Can not set remote "+r.type+" in state "+c.signalingState));var d={};c.remoteStreams.forEach(function(e){d[e.id]=e});var h=[],f=n.splitSections(r.sdp),p=f.shift(),m=n.matchPrefix(p,"a=ice-lite").length>0,g=n.matchPrefix(p,"a=group:BUNDLE ").length>0;c.usingBundle=g;var v=n.matchPrefix(p,"a=ice-options:")[0];return c.canTrickleIceCandidates=!!v&&v.substr(14).split(" ").indexOf("trickle")>=0,f.forEach(function(s,u){var l=n.splitLines(s),f=n.getKind(s),v=n.isRejected(s)&&0===n.matchPrefix(s,"a=bundle-only").length,y=l[0].substr(2).split(" ")[2],_=n.getDirection(s,p),b=n.parseMsid(s),T=n.getMid(s)||n.generateIdentifier();if(v||"application"===f&&("DTLS/SCTP"===y||"UDP/DTLS/SCTP"===y))c.transceivers[u]={mid:T,kind:f,protocol:y,rejected:!0};else{var S,k,E,w,C,P,A,R,L;!v&&c.transceivers[u]&&c.transceivers[u].rejected&&(c.transceivers[u]=c._createTransceiver(f,!0));var O,I,x=n.parseRtpParameters(s);v||(O=n.getIceParameters(s,p),(I=n.getDtlsParameters(s,p)).role="client"),A=n.parseRtpEncodingParameters(s);var D=n.parseRtcpParameters(s),M=n.matchPrefix(s,"a=end-of-candidates",p).length>0,U=n.matchPrefix(s,"a=candidate:").map(function(e){return n.parseCandidate(e)}).filter(function(e){return 1===e.component});if(("offer"===r.type||"answer"===r.type)&&!v&&g&&u>0&&c.transceivers[u]&&(c._disposeIceAndDtlsTransports(u),c.transceivers[u].iceGatherer=c.transceivers[0].iceGatherer,c.transceivers[u].iceTransport=c.transceivers[0].iceTransport,c.transceivers[u].dtlsTransport=c.transceivers[0].dtlsTransport,c.transceivers[u].rtpSender&&c.transceivers[u].rtpSender.setTransport(c.transceivers[0].dtlsTransport),c.transceivers[u].rtpReceiver&&c.transceivers[u].rtpReceiver.setTransport(c.transceivers[0].dtlsTransport)),"offer"!==r.type||v){if("answer"===r.type&&!v){k=(S=c.transceivers[u]).iceGatherer,E=S.iceTransport,w=S.dtlsTransport,C=S.rtpReceiver,P=S.sendEncodingParameters,R=S.localCapabilities,c.transceivers[u].recvEncodingParameters=A,c.transceivers[u].remoteCapabilities=x,c.transceivers[u].rtcpParameters=D,U.length&&"new"===E.state&&(!m&&!M||g&&0!==u?U.forEach(function(e){o(S.iceTransport,e)}):E.setRemoteCandidates(U)),g&&0!==u||("new"===E.state&&E.start(k,O,"controlling"),"new"===w.state&&w.start(I)),!a(S.localCapabilities,S.remoteCapabilities).codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&S.sendEncodingParameters[0].rtx&&delete S.sendEncodingParameters[0].rtx,c._transceive(S,"sendrecv"===_||"recvonly"===_,"sendrecv"===_||"sendonly"===_),!C||"sendrecv"!==_&&"sendonly"!==_?delete S.rtpReceiver:(L=C.track,b?(d[b.stream]||(d[b.stream]=new e.MediaStream),i(L,d[b.stream]),h.push([L,C,d[b.stream]])):(d.default||(d.default=new e.MediaStream),i(L,d.default),h.push([L,C,d.default])))}}else{(S=c.transceivers[u]||c._createTransceiver(f)).mid=T,S.iceGatherer||(S.iceGatherer=c._createIceGatherer(u,g)),U.length&&"new"===S.iceTransport.state&&(!M||g&&0!==u?U.forEach(function(e){o(S.iceTransport,e)}):S.iceTransport.setRemoteCandidates(U)),R=e.RTCRtpReceiver.getCapabilities(f),t<15019&&(R.codecs=R.codecs.filter(function(e){return"rtx"!==e.name})),P=S.sendEncodingParameters||[{ssrc:1001*(2*u+2)}];var j,B=!1;if("sendrecv"===_||"sendonly"===_){if(B=!S.rtpReceiver,C=S.rtpReceiver||new e.RTCRtpReceiver(S.dtlsTransport,f),B)L=C.track,b&&"-"===b.stream||(b?(d[b.stream]||(d[b.stream]=new e.MediaStream,Object.defineProperty(d[b.stream],"id",{get:function(){return b.stream}})),Object.defineProperty(L,"id",{get:function(){return b.track}}),j=d[b.stream]):(d.default||(d.default=new e.MediaStream),j=d.default)),j&&(i(L,j),S.associatedRemoteMediaStreams.push(j)),h.push([L,C,j])}else S.rtpReceiver&&S.rtpReceiver.track&&(S.associatedRemoteMediaStreams.forEach(function(t){var i,n,r=t.getTracks().find(function(e){return e.id===S.rtpReceiver.track.id});r&&(i=r,(n=t).removeTrack(i),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:i})))}),S.associatedRemoteMediaStreams=[]);S.localCapabilities=R,S.remoteCapabilities=x,S.rtpReceiver=C,S.rtcpParameters=D,S.sendEncodingParameters=P,S.recvEncodingParameters=A,c._transceive(c.transceivers[u],!1,B)}}}),void 0===c._dtlsRole&&(c._dtlsRole="offer"===r.type?"active":"passive"),c._remoteDescription={type:r.type,sdp:r.sdp},"offer"===r.type?c._updateSignalingState("have-remote-offer"):c._updateSignalingState("stable"),Object.keys(d).forEach(function(t){var i=d[t];if(i.getTracks().length){if(-1===c.remoteStreams.indexOf(i)){c.remoteStreams.push(i);var n=new Event("addstream");n.stream=i,e.setTimeout(function(){c._dispatchEvent("addstream",n)})}h.forEach(function(e){var t=e[0],n=e[1];i.id===e[2].id&&l(c,t,n,[i])})}}),h.forEach(function(e){e[2]||l(c,e[0],e[1],[])}),e.setTimeout(function(){c&&c.transceivers&&c.transceivers.forEach(function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},c.prototype.close=function(){this.transceivers.forEach(function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},c.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},c.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}},0))},c.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++}),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var i=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",i)}},c.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)}),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var i=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",i)}},c.prototype.createOffer=function(){var i=this;if(i._isClosed)return Promise.reject(u("InvalidStateError","Can not call createOffer after close"));var a=i.transceivers.filter(function(e){return"audio"===e.kind}).length,s=i.transceivers.filter(function(e){return"video"===e.kind}).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(a=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(s=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(i.transceivers.forEach(function(e){"audio"===e.kind?--a<0&&(e.wantReceive=!1):"video"===e.kind&&--s<0&&(e.wantReceive=!1)});a>0||s>0;)a>0&&(i._createTransceiver("audio"),a--),s>0&&(i._createTransceiver("video"),s--);var l=n.writeSessionBoilerplate(i._sdpSessionId,i._sdpSessionVersion++);i.transceivers.forEach(function(r,a){var s=r.track,o=r.kind,u=r.mid||n.generateIdentifier();r.mid=u,r.iceGatherer||(r.iceGatherer=i._createIceGatherer(a,i.usingBundle));var l=e.RTCRtpSender.getCapabilities(o);t<15019&&(l.codecs=l.codecs.filter(function(e){return"rtx"!==e.name})),l.codecs.forEach(function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),r.remoteCapabilities&&r.remoteCapabilities.codecs&&r.remoteCapabilities.codecs.forEach(function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)})}),l.headerExtensions.forEach(function(e){(r.remoteCapabilities&&r.remoteCapabilities.headerExtensions||[]).forEach(function(t){e.uri===t.uri&&(e.id=t.id)})});var c=r.sendEncodingParameters||[{ssrc:1001*(2*a+1)}];s&&t>=15019&&"video"===o&&!c[0].rtx&&(c[0].rtx={ssrc:c[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,o)),r.localCapabilities=l,r.sendEncodingParameters=c}),"max-compat"!==i._config.bundlePolicy&&(l+="a=group:BUNDLE "+i.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),l+="a=ice-options:trickle\r\n",i.transceivers.forEach(function(e,t){l+=r(e,e.localCapabilities,"offer",e.stream,i._dtlsRole),l+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===i.iceGatheringState||0!==t&&i.usingBundle||(e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1,l+="a="+n.writeCandidate(e)+"\r\n"}),"completed"===e.iceGatherer.state&&(l+="a=end-of-candidates\r\n"))});var c=new e.RTCSessionDescription({type:"offer",sdp:l});return Promise.resolve(c)},c.prototype.createAnswer=function(){var i=this;if(i._isClosed)return Promise.reject(u("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==i.signalingState&&"have-local-pranswer"!==i.signalingState)return Promise.reject(u("InvalidStateError","Can not call createAnswer in signalingState "+i.signalingState));var s=n.writeSessionBoilerplate(i._sdpSessionId,i._sdpSessionVersion++);i.usingBundle&&(s+="a=group:BUNDLE "+i.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),s+="a=ice-options:trickle\r\n";var o=n.getMediaSections(i._remoteDescription.sdp).length;i.transceivers.forEach(function(e,n){if(!(n+1>o)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?s+="m=application 0 DTLS/SCTP 5000\r\n":s+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?s+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(s+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(s+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var u;if(e.stream)"audio"===e.kind?u=e.stream.getAudioTracks()[0]:"video"===e.kind&&(u=e.stream.getVideoTracks()[0]),u&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var l=a(e.localCapabilities,e.remoteCapabilities);!l.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,s+=r(e,l,"answer",e.stream,i._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(s+="a=rtcp-rsize\r\n")}});var l=new e.RTCSessionDescription({type:"answer",sdp:s});return Promise.resolve(l)},c.prototype.addIceCandidate=function(e){var t,i=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(r,a){if(!i._remoteDescription)return a(u("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var s=e.sdpMLineIndex;if(e.sdpMid)for(var l=0;l<i.transceivers.length;l++)if(i.transceivers[l].mid===e.sdpMid){s=l;break}var c=i.transceivers[s];if(!c)return a(u("OperationError","Can not add ICE candidate"));if(c.rejected)return r();var d=Object.keys(e.candidate).length>0?n.parseCandidate(e.candidate):{};if("tcp"===d.protocol&&(0===d.port||9===d.port))return r();if(d.component&&1!==d.component)return r();if((0===s||s>0&&c.iceTransport!==i.transceivers[0].iceTransport)&&!o(c.iceTransport,d))return a(u("OperationError","Can not add ICE candidate"));var h=e.candidate.trim();0===h.indexOf("a=")&&(h=h.substr(2)),(t=n.getMediaSections(i._remoteDescription.sdp))[s]+="a="+(d.type?h:"end-of-candidates")+"\r\n",i._remoteDescription.sdp=n.getDescription(i._remoteDescription.sdp)+t.join("")}else for(var f=0;f<i.transceivers.length&&(i.transceivers[f].rejected||(i.transceivers[f].iceTransport.addRemoteCandidate({}),(t=n.getMediaSections(i._remoteDescription.sdp))[f]+="a=end-of-candidates\r\n",i._remoteDescription.sdp=n.getDescription(i._remoteDescription.sdp)+t.join(""),!i.usingBundle));f++);r()})},c.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var i=null;if(this.transceivers.forEach(function(e){e.rtpSender&&e.rtpSender.track===t?i=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(i=e.rtpReceiver)}),!i)throw u("InvalidAccessError","Invalid selector.");return i.getStats()}var n=[];return this.transceivers.forEach(function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(t){e[t]&&n.push(e[t].getStats())})}),Promise.all(n).then(function(e){var t=new Map;return e.forEach(function(e){e.forEach(function(e){t.set(e.id,e)})}),t})};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(t){var i=e[t];if(i&&i.prototype&&i.prototype.getStats){var n=i.prototype.getStats;i.prototype.getStats=function(){return n.apply(this).then(function(e){var t=new Map;return Object.keys(e).forEach(function(i){var n;e[i].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(n=e[i]).type]||n.type,t.set(i,e[i])}),t})}}});var d=["createOffer","createAnswer"];return d.forEach(function(e){var t=c.prototype[e];c.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then(function(t){"function"==typeof e[0]&&e[0].apply(null,[t])},function(t){"function"==typeof e[1]&&e[1].apply(null,[t])}):t.apply(this,arguments)}}),(d=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(e){var t=c.prototype[e];c.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)},function(t){"function"==typeof e[2]&&e[2].apply(null,[t])}):t.apply(this,arguments)}}),["getStats"].forEach(function(e){var t=c.prototype[e];c.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)}):t.apply(this,arguments)}}),c}},{sdp:17}],17:[function(e,t,i){"use strict";var n={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})},n.splitSections=function(e){return e.split("\nm=").map(function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"})},n.getDescription=function(e){var t=n.splitSections(e);return t&&t[0]},n.getMediaSections=function(e){var t=n.splitSections(e);return t.shift(),t},n.matchPrefix=function(e,t){return n.splitLines(e).filter(function(e){return 0===e.indexOf(t)})},n.parseCandidate=function(e){for(var t,i={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":i.relatedAddress=t[n+1];break;case"rport":i.relatedPort=parseInt(t[n+1],10);break;case"tcptype":i.tcpType=t[n+1];break;case"ufrag":i.ufrag=t[n+1],i.usernameFragment=t[n+1];break;default:i[t[n]]=t[n+1]}return i},n.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var i=e.type;return t.push("typ"),t.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},n.parseIceOptions=function(e){return e.substr(14).split(" ")},n.parseRtpMap=function(e){var t=e.substr(9).split(" "),i={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),i.name=t[0],i.clockRate=parseInt(t[1],10),i.channels=3===t.length?parseInt(t[2],10):1,i.numChannels=i.channels,i},n.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var i=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==i?"/"+i:"")+"\r\n"},n.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},n.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},n.parseFmtp=function(e){for(var t,i={},n=e.substr(e.indexOf(" ")+1).split(";"),r=0;r<n.length;r++)i[(t=n[r].trim().split("="))[0].trim()]=t[1];return i},n.writeFmtp=function(e){var t="",i=e.payloadType;if(void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach(function(t){e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)}),t+="a=fmtp:"+i+" "+n.join(";")+"\r\n"}return t},n.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},n.writeRtcpFb=function(e){var t="",i=e.payloadType;return void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+i+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},n.parseSsrcMedia=function(e){var t=e.indexOf(" "),i={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(i.attribute=e.substr(t+1,n-t-1),i.value=e.substr(n+1)):i.attribute=e.substr(t+1),i},n.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(function(e){return parseInt(e,10)})}},n.getMid=function(e){var t=n.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},n.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},n.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:n.matchPrefix(e+t,"a=fingerprint:").map(n.parseFingerprint)}},n.writeDtlsParameters=function(e,t){var i="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){i+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),i},n.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},n.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?n.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},n.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},n.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},n.getCryptoParameters=function(e,t){return n.matchPrefix(e+t,"a=crypto:").map(n.parseCryptoLine)},n.getIceParameters=function(e,t){var i=n.matchPrefix(e+t,"a=ice-ufrag:")[0],r=n.matchPrefix(e+t,"a=ice-pwd:")[0];return i&&r?{usernameFragment:i.substr(12),password:r.substr(10)}:null},n.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},n.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=n.splitLines(e)[0].split(" "),r=3;r<i.length;r++){var a=i[r],s=n.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(s){var o=n.parseRtpMap(s),u=n.matchPrefix(e,"a=fmtp:"+a+" ");switch(o.parameters=u.length?n.parseFmtp(u[0]):{},o.rtcpFeedback=n.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(n.parseRtcpFb),t.codecs.push(o),o.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(o.name.toUpperCase())}}}return n.matchPrefix(e,"a=extmap:").forEach(function(e){t.headerExtensions.push(n.parseExtmap(e))}),t},n.writeRtpDescription=function(e,t){var i="";i+="m="+e+" ",i+=t.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=t.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(function(e){i+=n.writeRtpMap(e),i+=n.writeFmtp(e),i+=n.writeRtcpFb(e)});var r=0;return t.codecs.forEach(function(e){e.maxptime>r&&(r=e.maxptime)}),r>0&&(i+="a=maxptime:"+r+"\r\n"),i+="a=rtcp-mux\r\n",t.headerExtensions&&t.headerExtensions.forEach(function(e){i+=n.writeExtmap(e)}),i},n.parseRtpEncodingParameters=function(e){var t,i=[],r=n.parseRtpParameters(e),a=-1!==r.fecMechanisms.indexOf("RED"),s=-1!==r.fecMechanisms.indexOf("ULPFEC"),o=n.matchPrefix(e,"a=ssrc:").map(function(e){return n.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),u=o.length>0&&o[0].ssrc,l=n.matchPrefix(e,"a=ssrc-group:FID").map(function(e){return e.substr(17).split(" ").map(function(e){return parseInt(e,10)})});l.length>0&&l[0].length>1&&l[0][0]===u&&(t=l[0][1]),r.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var n={ssrc:u,codecPayloadType:parseInt(e.parameters.apt,10)};u&&t&&(n.rtx={ssrc:t}),i.push(n),a&&((n=JSON.parse(JSON.stringify(n))).fec={ssrc:u,mechanism:s?"red+ulpfec":"red"},i.push(n))}}),0===i.length&&u&&i.push({ssrc:u});var c=n.matchPrefix(e,"b=");return c.length&&(c=0===c[0].indexOf("b=TIAS:")?parseInt(c[0].substr(7),10):0===c[0].indexOf("b=AS:")?1e3*parseInt(c[0].substr(5),10)*.95-16e3:void 0,i.forEach(function(e){e.maxBitrate=c})),i},n.parseRtcpParameters=function(e){var t={},i=n.matchPrefix(e,"a=ssrc:").map(function(e){return n.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];i&&(t.cname=i.value,t.ssrc=i.ssrc);var r=n.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=r.length>0,t.compound=0===r.length;var a=n.matchPrefix(e,"a=rtcp-mux");return t.mux=a.length>0,t},n.parseMsid=function(e){var t,i=n.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(t=i[0].substr(7).split(" "))[0],track:t[1]};var r=n.matchPrefix(e,"a=ssrc:").map(function(e){return n.parseSsrcMedia(e)}).filter(function(e){return"msid"===e.attribute});return r.length>0?{stream:(t=r[0].value.split(" "))[0],track:t[1]}:void 0},n.parseSctpDescription=function(e){var t,i=n.parseMLine(e),r=n.matchPrefix(e,"a=max-message-size:");r.length>0&&(t=parseInt(r[0].substr(19),10)),isNaN(t)&&(t=65536);var a=n.matchPrefix(e,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substr(12),10),protocol:i.fmt,maxMessageSize:t};if(n.matchPrefix(e,"a=sctpmap:").length>0){var s=n.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:t}}},n.writeSctpDescription=function(e,t){var i=[];return i="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&i.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),i.join("")},n.generateSessionId=function(){return Math.random().toString().substr(2,21)},n.writeSessionBoilerplate=function(e,t,i){var r,a=void 0!==t?t:2;return r=e||n.generateSessionId(),"v=0\r\no="+(i||"thisisadapterortc")+" "+r+" "+a+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},n.writeMediaSection=function(e,t,i,r){var a=n.writeRtpDescription(e.kind,t);if(a+=n.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=n.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===i?"actpass":"active"),a+="a=mid:"+e.mid+"\r\n",e.direction?a+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var s="msid:"+r.id+" "+e.rtpSender.track.id+"\r\n";a+="a="+s,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+n.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+n.localCName+"\r\n"),a},n.getDirection=function(e,t){for(var i=n.splitLines(e),r=0;r<i.length;r++)switch(i[r]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[r].substr(2)}return t?n.getDirection(t):"sendrecv"},n.getKind=function(e){return n.splitLines(e)[0].split(" ")[0].substr(2)},n.isRejected=function(e){return"0"===e.split(" ",2)[1]},n.parseMLine=function(e){var t=n.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},n.parseOLine=function(e){var t=n.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},n.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=n.splitLines(e),i=0;i<t.length;i++)if(t[i].length<2||"="!==t[i].charAt(1))return!1;return!0},"object"==typeof t&&(t.exports=n)},{}]},{},[1])(1)}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).videojsFlvjs=e()}}(function(){return function e(t,i,n){function r(s,o){if(!i[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[s]={exports:{}};t[s][0].call(c.exports,function(e){var i=t[s][1][e];return r(i||e)},c,c.exports,e,t,i,n)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}({1:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t,n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r="undefined"!=typeof window?window.videojs:void 0!==e?e.videojs:null,a=(t=r)&&t.__esModule?t:{default:t};var s=a.default.getTech("Html5"),o=a.default.mergeOptions||a.default.util.mergeOptions,u={dataInterval:3e3},l=function(e){function t(e,i){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=o(u,e),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,i))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s),n(t,[{key:"setSrc",value:function(e){var t=this,i=!!this.options_.debug;this.options_.autoplay;this.debug=i;var n=this.options_.dataInterval;i&&console.log("rtc debug on"),this.src=e,this.stream=new MediaStream;var r=new RTCPeerConnection;this.pc=r,r.ontrack=function(e){t.stream.addTrack(e.track),t.el_.srcObject!=t.stream&&(t.el_.srcObject=t.stream),i&&console.log(e.streams.length,"track",e.track.kind,"is delivered")},r.oniceconnectionstatechange=function(e){"disconnected"==r.iceConnectionState&&t.sendChannelTicker&&(t.eventBusEl_&&t.trigger({type:"error",name:"ice disconnected"}),clearInterval(t.sendChannelTicker),t.sendChannelTicker=0),i&&console.log("ice connection state change: "+r.iceConnectionState)};var a=r.createDataChannel("keepalive");this.sendChannel=a,a.onclose=function(){t.sendChannelTicker&&(t.eventBusEl_&&t.trigger({type:"error",name:"send channel closed"}),clearInterval(t.sendChannelTicker),t.sendChannelTicker=0),i&&console.log("sendChannel has closed")},a.onopen=function(){i&&console.log("sendChannel has opened"),a.send("ping");var e=setInterval(function(){i&&console.log("sendChannel ping..."),a.send("ping")},n);t.sendChannelTicker=e},a.onmessage=function(e){i&&console.log("sendChannel message",e.data)},r.createOffer({offerToReceiveVideo:!0,offerToReceiveAudio:!0}).then(function(n){r.setLocalDescription(n).then(function(){var n=new XMLHttpRequest;n.open("POST",e.replace("webrtc","http"),!0),n.onreadystatechange=function(){if(4==n.readyState)if(n.status>=200&&n.status<300||304===n.status)try{r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:atob(n.responseText)})).catch(function(e){t.eventBusEl_&&t.trigger({type:"error",name:"set rtc remote sdp failed"}),i&&console.log("set rtc remote sdp error",e)})}catch(e){t.eventBusEl_&&t.trigger({type:"error",name:"set rtc remote sdp failed"}),i&&console.log("set rtc remote sdp error",e)}else t.eventBusEl_&&t.trigger({type:"error",name:"post rtc status "+n.status}),i&&console.log("post rtc status",n.status,n.statusText)},n.send(btoa(r.localDescription.sdp))}).catch(function(e){i&&console.log("pc setLocalDescription error",e)})}).catch(function(e){i&&console.log("pc createOffer error",e)})}},{key:"dispose",value:function(){this.debug&&console.log("rtc dispose"),this.sendChannelTicker&&(clearInterval(this.sendChannelTicker),this.sendChannelTicker=0),this.sendChannel&&(this.sendChannel.close(),this.sendChannel=null),this.pc&&(this.pc.close(),this.pc=null),this.el_.srcObject&&(this.el_.srcObject=null),function e(t,i,n){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,i);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"dispose",this).call(this)}},{key:"reload",value:function(){this.sendChannelTicker&&(clearInterval(this.sendChannelTicker),this.sendChannelTicker=0),this.sendChannel&&(this.sendChannel.close(),this.sendChannel=null),this.pc&&(this.pc.close(),this.pc=null),this.el_.srcObject&&(this.el_.srcObject=null),this.src?this.setSrc(this.src):this.debug&&console.log("reload error, src not found")}}]),t}();l.isSupported=function(){return!!window.RTCPeerConnection},l.formats={"video/webrtc":"RTC"},l.canPlayType=function(e){return l.isSupported()?"maybe":""},l.canPlaySource=function(e,t){return l.canPlayType(e.type)},l.VERSION="0.2.0",a.default.registerTech("Webrtc",l),i.default=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}),function(){"use strict";var e=null;e=void 0===window.videojs&&"function"==typeof require?require("video.js"):window.videojs,function(e,t){var i,n={},r={},a={};function s(e,t,i,n){return r={label:i,sources:t},"function"==typeof n?n(e,t,i):e.src(t.map(function(e){return{src:e.src,type:e.type,res:e.res}}))}var o=t.getComponent("MenuItem"),u=t.extend(o,{constructor:function(e,t,i,n){this.onClickListener=i,this.label=n,o.call(this,e,t),this.src=t.src,this.on("click",this.onClick),this.on("touchstart",this.onClick),t.initialySelected&&(this.showAsLabel(),this.selected(!0),this.addClass("vjs-selected"))},showAsLabel:function(){this.label&&(this.label.innerHTML=this.options_.label)},onClick:function(e){this.onClickListener(this);var t=this.player_.currentTime(),i=this.player_.paused();this.showAsLabel(),this.addClass("vjs-selected"),i||this.player_.bigPlayButton.hide(),"function"!=typeof e&&"function"==typeof this.options_.customSourcePicker&&(e=this.options_.customSourcePicker);var n="loadeddata";"Youtube"!==this.player_.techName_&&"none"===this.player_.preload()&&"Flash"!==this.player_.techName_&&(n="timeupdate"),s(this.player_,this.src,this.options_.label,e),this.player_.one(n,function(){this.player_.currentTime(t),this.player_.handleTechSeeked_(),this.player_.trigger("resolutionchange")})}}),l=t.getComponent("MenuButton"),c=t.extend(l,{constructor:function(e,i,n,r){if(this.sources=i.sources,this.label=r,this.label.innerHTML=i.initialySelectedLabel,l.call(this,e,i,n),this.controlText("Quality"),n.dynamicLabel)this.el().appendChild(r);else{var a=document.createElement("span");t.dom.addClass(a,"vjs-resolution-button-staticlabel"),this.el().appendChild(a)}},createItems:function(){var e=[],t=this.sources&&this.sources.label||{},i=function(t){e.map(function(e){e.selected(e===t),e.removeClass("vjs-selected")})};for(var n in t)t.hasOwnProperty(n)&&(e.push(new u(this.player_,{label:n,src:t[n],initialySelected:n===this.options_.initialySelectedLabel,customSourcePicker:this.options_.customSourcePicker},i,this.label)),a[n]=e[e.length-1]);return e}});i=function(e){var i=t.mergeOptions(n,e),o=this,u=document.createElement("span"),l={};function d(e,t){return e.res&&t.res?+t.res-+e.res:0}function h(e){var t={label:{},res:{},type:{}};return e.map(function(e){f(t,"label",e),f(t,"res",e),f(t,"type",e),p(t,"label",e),p(t,"res",e),p(t,"type",e)}),t}function f(e,t,i){null==e[t][i[t]]&&(e[t][i[t]]=[])}function p(e,t,i){e[t][i[t]].push(i)}t.dom.addClass(u,"vjs-menu"),t.browser.IE_VERSION?t.dom.addClass(u,"vjs-resolution-button-label-ie"):t.dom.addClass(u,"vjs-resolution-button-label"),o.updateSrc=function(e){if(!e)return o.src();o.controlBar.resolutionSwitcher&&(o.controlBar.resolutionSwitcher.dispose(),delete o.controlBar.resolutionSwitcher),e=e.sort(d);var n=function(e,t){var n=i.default,r="";"high"===n?(n=t[0].res,r=t[0].label):"low"!==n&&null!=n&&e.res[n]?e.res[n]&&(r=e.res[n][0].label):(n=t[t.length-1].res,r=t[t.length-1].label);return{res:n,label:r,sources:e.res[n]}}(l=h(e),e),r=new c(o,{sources:l,initialySelectedLabel:n.label,initialySelectedRes:n.res,customSourcePicker:i.customSourcePicker},i,u);return t.dom.addClass(r.el(),"vjs-resolution-button"),o.controlBar.resolutionSwitcher=o.controlBar.el_.insertBefore(r.el_,o.controlBar.getChild("fullscreenToggle").el_),o.controlBar.resolutionSwitcher.dispose=function(){this.parentNode.removeChild(this)},s(o,n.sources,n.label)},o.currentResolution=function(e,t){return null==e?r:(null!=a[e]&&a[e].onClick(t),o)},o.getGroupedSrc=function(){return l},o.ready(function(){o.options_.sources.length>1&&o.updateSrc(o.options_.sources),"Youtube"===o.techName_&&function(e){e.tech_.ytPlayer.setPlaybackQuality("default"),e.tech_.ytPlayer.addEventListener("onPlaybackQualityChange",function(){e.trigger("resolutionchange")}),e.one("play",function(){var t={highres:{res:1080,label:"1080",yt:"highres"},hd1080:{res:1080,label:"1080",yt:"hd1080"},hd720:{res:720,label:"720",yt:"hd720"},large:{res:480,label:"480",yt:"large"},medium:{res:360,label:"360",yt:"medium"},small:{res:240,label:"240",yt:"small"},tiny:{res:144,label:"144",yt:"tiny"},auto:{res:0,label:"auto",yt:"default"}},n=[];e.tech_.ytPlayer.getAvailableQualityLevels().map(function(i){n.push({src:e.src().src,type:e.src().type,label:t[i].label,res:t[i].res,_yt:t[i].yt})});var r="auto",a=0,s=((l=h(n)).label.auto,new c(e,{sources:l,initialySelectedLabel:r,initialySelectedRes:a,customSourcePicker:function(t,i,n){return e.tech_.ytPlayer.setPlaybackQuality(i[0]._yt),e}},i,u));s.el().classList.add("vjs-resolution-button"),e.controlBar.resolutionSwitcher=e.controlBar.addChild(s)})}(o)})},t.registerPlugin("videoJsResolutionSwitcher",i)}(window,e)}(),function(e,t){"undefined"!=typeof window&&window.videojs?t(window.videojs):"function"==typeof define&&define.amd?define("videojs-hotkeys",["video.js"],function(e){return t(e.default||e)}):"undefined"!=typeof module&&module.exports&&(module.exports=t(require("video.js")))}(0,function(e){"use strict";"undefined"!=typeof window&&(window.videojs_hotkeys={version:"0.2.22"});(e.registerPlugin||e.plugin)("hotkeys",function(t){var i=this,n=i.el(),r=document,a={volumeStep:.1,seekStep:5,enableMute:!0,enableVolumeScroll:!0,enableFullscreen:!0,enableNumbers:!0,enableJogStyle:!1,alwaysCaptureHotkeys:!1,enableModifiersForNumbers:!0,enableInactiveFocus:!0,skipInitialFocus:!1,playPauseKey:function(e){return 32===e.which||179===e.which},rewindKey:function(e){return 37===e.which||177===e.which},forwardKey:function(e){return 39===e.which||176===e.which},volumeUpKey:function(e){return 38===e.which},volumeDownKey:function(e){return 40===e.which},muteKey:function(e){return 77===e.which},fullscreenKey:function(e){return 70===e.which},customKeys:{}},s=e.mergeOptions||e.util.mergeOptions,o=(t=s(a,t||{})).volumeStep,u=t.seekStep,l=t.enableMute,c=t.enableVolumeScroll,d=t.enableFullscreen,h=t.enableNumbers,f=t.enableJogStyle,p=t.alwaysCaptureHotkeys,m=t.enableModifiersForNumbers,g=t.enableInactiveFocus,v=t.skipInitialFocus;n.hasAttribute("tabIndex")||n.setAttribute("tabIndex","-1"),n.style.outline="none",!p&&i.autoplay()||v||i.one("play",function(){n.focus({preventScroll:!0})}),g&&i.on("userinactive",function(){var e=function(){clearTimeout(t)},t=setTimeout(function(){i.off("useractive",e);var t=r.activeElement,a=n.querySelector(".vjs-control-bar");t&&t.parentElement==a&&n.focus()},10);i.one("useractive",e)}),i.on("play",function(){var e=n.querySelector(".iframeblocker");e&&""===e.style.display&&(e.style.display="block",e.style.bottom="39px")});var y=function(e){if(i.controls()){var t=r.activeElement;if((p||t==n||t==n.querySelector(".vjs-tech")||t==n.querySelector(".iframeblocker")||t==n.querySelector(".vjs-control-bar"))&&c){e=window.event||e;var a=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));e.preventDefault(),1==a?i.volume(i.volume()+o):-1==a&&i.volume(i.volume()-o)}}},_=function(e,i){return t.playPauseKey(e,i)?1:t.rewindKey(e,i)?2:t.forwardKey(e,i)?3:t.volumeUpKey(e,i)?4:t.volumeDownKey(e,i)?5:t.muteKey(e,i)?6:t.fullscreenKey(e,i)?7:void 0};function b(e){return"function"==typeof u?u(e):u}return i.on("keydown",function(e){var a,s,u=e.which,c=e.preventDefault,g=i.duration();if(i.controls()){var v=r.activeElement;if(p||v==n||v==n.querySelector(".vjs-tech")||v==n.querySelector(".vjs-control-bar")||v==n.querySelector(".iframeblocker"))switch(_(e,i)){case 1:c(),p&&e.stopPropagation(),i.paused()?i.play():i.pause();break;case 2:a=!i.paused(),c(),a&&i.pause(),(s=i.currentTime()-b(e))<=0&&(s=0),i.currentTime(s),a&&i.play();break;case 3:a=!i.paused(),c(),a&&i.pause(),(s=i.currentTime()+b(e))>=g&&(s=a?g-.001:g),i.currentTime(s),a&&i.play();break;case 5:c(),f?(s=i.currentTime()-1,i.currentTime()<=1&&(s=0),i.currentTime(s)):i.volume(i.volume()-o);break;case 4:c(),f?((s=i.currentTime()+1)>=g&&(s=g),i.currentTime(s)):i.volume(i.volume()+o);break;case 6:l&&i.muted(!i.muted());break;case 7:d&&(i.isFullscreen()?i.exitFullscreen():i.requestFullscreen());break;default:if((u>47&&u<59||u>95&&u<106)&&(m||!(e.metaKey||e.ctrlKey||e.altKey))&&h){var y=48;u>95&&(y=96);var T=u-y;c(),i.currentTime(i.duration()*T*.1)}for(var S in t.customKeys){var k=t.customKeys[S];k&&k.key&&k.handler&&k.key(e)&&(c(),k.handler(i,t,e))}}}}),i.on("mousewheel",y),i.on("DOMMouseScroll",y),this})}),function(e){e.URL=e.URL||e.webkitURL,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;var t=function(t,i){(i=i||{}).sampleBits=i.sampleBits||8,i.sampleRate=i.sampleRate||8e3;var n=new(e.webkitAudioContext||e.AudioContext),r=n.createMediaStreamSource(t),a=(n.createScriptProcessor||n.createJavaScriptNode).apply(n,[4096,1,1]),s=!1,o={size:0,buffer:[],level:0,inputSampleRate:n.sampleRate,inputSampleBits:16,outputSampleRate:i.sampleRate,oututSampleBits:i.sampleBits,input:function(e){this.buffer.push(new Float32Array(e)),this.size+=e.length,i.pcmCallback&&(i.pcmCallback(this.encodePCM(),this.level),this.buffer.splice(0,this.size),this.size=0)},compress:function(){for(var e=new Float32Array(this.size),t=0,i=0;i<this.buffer.length;i++)e.set(this.buffer[i],t),t+=this.buffer[i].length;for(var n=parseInt(this.inputSampleRate/this.outputSampleRate),r=e.length/n,a=new Float32Array(r),s=0,o=0;s<r;)a[s]=e[o],o+=n,s++;return a},powerLevel:function(e,t){var i=e/t||0;return i<1251?Math.round(i/1250*10):Math.round(Math.min(100,Math.max(0,100*(1+Math.log(i/1e4)/Math.log(10)))))},encodePCM:function(){var e=Math.min(this.inputSampleBits,this.oututSampleBits),t=this.compress(),i=t.length*(e/8),n=new ArrayBuffer(i),r=new DataView(n),a=0,s=0;if(8===e)for(var o=0;o<t.length;o++,a++){var u=(l=Math.max(-1,Math.min(1,t[o])))<0?32768*l:32767*l;u=parseInt(255/(65535/(u+32768))),s+=Math.abs(u),r.setInt8(a,u,!0)}else for(o=0;o<t.length;o++,a+=2){var l;u=(l=Math.max(-1,Math.min(1,t[o])))<0?32768*l:32767*l;s+=Math.abs(u),r.setInt16(a,u,!0)}return this.level=this.powerLevel(s,t.length),new Blob([r],{type:"audio/pcm"})},encodeWAV:function(){var e=Math.min(this.inputSampleRate,this.outputSampleRate),t=Math.min(this.inputSampleBits,this.oututSampleBits),i=this.compress(),n=i.length*(t/8),r=new ArrayBuffer(44+n),a=new DataView(r),s=0,o=0,u=function(e){for(var t=0;t<e.length;t++)a.setUint8(s+t,e.charCodeAt(t))};if(u("RIFF"),s+=4,a.setUint32(s,36+n,!0),s+=4,u("WAVE"),s+=4,u("fmt "),s+=4,a.setUint32(s,16,!0),s+=4,a.setUint16(s,1,!0),s+=2,a.setUint16(s,1,!0),s+=2,a.setUint32(s,e,!0),s+=4,a.setUint32(s,1*e*(t/8),!0),s+=4,a.setUint16(s,t/8*1,!0),s+=2,a.setUint16(s,t,!0),s+=2,u("data"),s+=4,a.setUint32(s,n,!0),s+=4,8===t)for(var l=0;l<i.length;l++,s++){var c=(d=Math.max(-1,Math.min(1,i[l])))<0?32768*d:32767*d;c=parseInt(255/(65535/(c+32768))),o+=Math.abs(c),a.setInt8(s,c,!0)}else for(l=0;l<i.length;l++,s+=2){var d;c=(d=Math.max(-1,Math.min(1,i[l])))<0?32768*d:32767*d;o+=Math.abs(c),a.setInt16(s,c,!0)}return this.level=this.powerLevel(o,i.length),new Blob([a],{type:"audio/wav"})}};this.start=function(){s||(r.connect(a),a.connect(n.destination),s=!0)},this.stop=function(){s&&(a.disconnect(),s=!1)},this.destroy=function(){this.stop(),n&&(n.close(),n=null,t.getAudioTracks().forEach(function(e){e.stop()}))},this.getBlob=function(){return this.stop(),o.encodeWAV()},this.getPCMBlob=function(){return this.stop(),o.encodePCM()},this.getLevel=function(){return o.level},this.play=function(t){t.src=e.URL.createObjectURL(this.getBlob())},this.recording=function(){return s},this.upload=function(e,t){var i=new FormData;i.append("audioData",this.getBlob()),i.append("pcmData",this.getPCMBlob());var n=new XMLHttpRequest;t&&(n.upload.addEventListener("progress",function(e){t("uploading",e)},!1),n.addEventListener("load",function(e){t("ok",e)},!1),n.addEventListener("error",function(e){t("error",e)},!1),n.addEventListener("abort",function(e){t("cancel",e)},!1)),n.open("POST",e),n.send(i)},a.onaudioprocess=function(e){o.input(e.inputBuffer.getChannelData(0))}};t.canRecording=null!=navigator.getUserMedia,t.get=function(e,i){if(e){if(!navigator.getUserMedia)return"https:"!=String(location.protocol).toLowerCase()?void e(null,"当前浏览器不支持录音功能, 请确认当前是否访问 HTTPS 服务!"):void e(null,"当前浏览器不支持录音功能。");navigator.getUserMedia({audio:!0},function(n){var r=new t(n,i);e(r,null)},function(t){switch(t.name||t.code){case"PERMISSION_DENIED":case"PermissionDeniedError":e(null,"用户拒绝提供信息。");break;case"NOT_SUPPORTED_ERROR":case"NotSupportedError":e(null,"浏览器不支持硬件设备。");break;case"MANDATORY_UNSATISFIED_ERROR":case"MandatoryUnsatisfiedError":e(null,"无法发现指定的硬件设备。");break;default:e(null,"无法打开麦克风。异常信息:"+(t.name||t.code))}})}},e.LiveRecorder=t}(window),videojs.addLanguage("zh-CN",{Play:"播放",Pause:"暂停","Current Time":"当前时间",Duration:"时长","Remaining Time":"剩余时间","Stream Type":"媒体流类型",LIVE:"直播",Loaded:"加载完毕",Progress:"进度",Fullscreen:"全屏","Non-Fullscreen":"退出全屏",Mute:"静音",Unmute:"取消静音","Playback Rate":"播放速度",Subtitles:"字幕","subtitles off":"关闭字幕",Captions:"内嵌字幕","captions off":"关闭内嵌字幕",Chapters:"节目段落","Close Modal Dialog":"关闭弹窗",Descriptions:"描述","descriptions off":"关闭描述","Audio Track":"音轨","You aborted the media playback":"视频播放被终止","A network error caused the media download to fail part-way.":"网络错误导致视频下载中途失败。","The media could not be loaded, either because the server or network failed or because the format is not supported.":"视频因格式不支持或者服务器或网络的问题无法加载。","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"由于视频文件损坏或是该视频使用了你的浏览器不支持的功能,播放终止。","No compatible source was found for this media.":"无法找到此视频兼容的源。","The media is encrypted and we do not have the keys to decrypt it.":"视频已加密,无法解密。","Play Video":"播放视频",Close:"关闭","Modal Window":"弹窗","This is a modal window":"这是一个弹窗","This modal can be closed by pressing the Escape key or activating the close button.":"可以按ESC按键或启用关闭按钮来关闭此弹窗。",", opens captions settings dialog":", 开启标题设置弹窗",", opens subtitles settings dialog":", 开启字幕设置弹窗",", opens descriptions settings dialog":", 开启描述设置弹窗",", selected":", 选择","captions settings":"字幕设定","Audio Player":"音频播放器","Video Player":"视频播放器",Replay:"重播","Progress Bar":"进度条","Volume Level":"音量","subtitles settings":"字幕设定","descriptions settings":"描述设定",Text:"文字",White:"白",Black:"黑",Red:"红",Green:"绿",Blue:"蓝",Yellow:"黄",Magenta:"紫红",Cyan:"青",Background:"背景",Window:"视窗",Transparent:"透明","Semi-Transparent":"半透明",Opaque:"不透明","Font Size":"字体尺寸","Text Edge Style":"字体边缘样式",None:"无",Raised:"浮雕",Depressed:"压低",Uniform:"均匀",Dropshadow:"下阴影","Font Family":"字体库","Proportional Sans-Serif":"比例无细体","Monospace Sans-Serif":"单间隔无细体","Proportional Serif":"比例细体","Monospace Serif":"单间隔细体",Casual:"舒适",Script:"手写体","Small Caps":"小型大写字体",Reset:"重置","restore all settings to the default values":"恢复全部设定至预设值",Done:"完成","Caption Settings Dialog":"字幕设定视窗","Beginning of dialog window. Escape will cancel and close the window.":"开始对话视窗。离开会取消及关闭视窗","End of dialog window.":"结束对话视窗","Seek to live, currently behind live":"试图直播,当前延时播放","Seek to live, currently playing live":"试图直播,当前实时播放","progress bar timing: currentTime={1} duration={2}":"{1}/{2}","{1} is loading.":"正在加载 {1}。","Picture-in-Picture":"画中画","Exit Picture-in-Picture":"退出画中画",Snapshot:"截图",STD:"标准",STR:"拉伸","Click switch to standard display":"点击切换到标准显示","Click switch to stretch display":"点击切换到拉伸显示",Fluent:"流畅",Fast:"极速","Click switch to fast play":"点击切换到极速播放","Click switch to fluent play":"点击切换到流畅播放"});
|