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 n="7.6.3",i=[],r=function(t,n){return function(r,a,s){var o=n.levels[a],u=new RegExp("^("+o+")$");if("log"!==r&&s.unshift(r.toUpperCase()+":"),s.unshift(t+":"),i&&i.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 n,a="info",s=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n("log",a,t)};return n=r(t,s),s.createLogger=function(n){return e(t+": "+n)},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 i?[].concat(i):[]}).filter=function(e){return(i||[]).filter(function(t){return new RegExp(".*"+e+".*").test(t[0])})},s.history.clear=function(){i&&(i.length=0)},s.history.disable=function(){null!==i&&(i.length=0,i=null)},s.history.enable=function(){null===i&&(i=[])},s.error=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n("error",a,t)},s.warn=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n("warn",a,t)},s.debug=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n("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(n){return t(e[n],n)})}function c(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Object.assign?Object.assign.apply(Object,[e].concat(n)):(n.forEach(function(t){t&&l(t,function(t,n){e[n]=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,n){if(!t||!n)return"";if("function"==typeof e.getComputedStyle){var i=e.getComputedStyle(t);return i?i.getPropertyValue(n)||i[n]:""}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(n,i){if(!p(n))return t[e](null);p(i)&&(i=t.querySelector(i));var r=v(i)?i:t;return r[e]&&r[e](n)}}function b(e,n,i,r){void 0===e&&(e="div"),void 0===n&&(n={}),void 0===i&&(i={});var s=t.createElement(e);return Object.getOwnPropertyNames(n).forEach(function(e){var t=n[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(i).forEach(function(e){s.setAttribute(e,i[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):(n=t,new RegExp("(^|\\s)"+n+"($|\\s)")).test(e.className);var n}function E(e,t){return e?(e.classList?e.classList.add(t):k(e,t)||(e.className=(e.className+" "+t).trim()),e):e}function C(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 w(e,t,n){var i=k(e,t);return"function"==typeof n&&(n=n(e,t)),"boolean"!=typeof n&&(n=!i),n===i?e:(n?E(e,t):C(e,t),e)}function P(e,t){Object.getOwnPropertyNames(t).forEach(function(n){var i=t[n];null===i||void 0===i||!1===i?e.removeAttribute(n):e.setAttribute(n,!0===i?"":i)})}function A(e){var t={},n=",autoplay,stretch,fluent,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0)for(var i=e.attributes,r=i.length-1;r>=0;r--){var a=i[r].name,s=i[r].value;"boolean"!=typeof e[a]&&-1===n.indexOf(","+a+",")||(s=null!==s),t[a]=s}return t}function R(e,t){return e.getAttribute(t)}function L(e,t,n){e.setAttribute(t,n)}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(),n={};return["bottom","height","left","right","top","width"].forEach(function(e){void 0!==t[e]&&(n[e]=t[e])}),n.height||(n.height=parseFloat(f(e,"height"))),n.width||(n.width=parseFloat(f(e,"width"))),n}}function M(n){var i;if(n.getBoundingClientRect&&n.parentNode&&(i=n.getBoundingClientRect()),!i)return{left:0,top:0};var r=t.documentElement,a=t.body,s=r.clientLeft||a.clientLeft||0,o=e.pageXOffset||a.scrollLeft,u=i.left+o-s,l=r.clientTop||a.clientTop||0,c=e.pageYOffset||a.scrollTop,d=i.top+c-l;return{left:Math.round(u),top:Math.round(d)}}function U(e,t){var n={},i=M(e),r=e.offsetWidth,a=e.offsetHeight,s=i.top,o=i.left,u=t.pageY,l=t.pageX;return t.changedTouches&&(l=t.changedTouches[0].pageX,u=t.changedTouches[0].pageY),n.y=Math.max(0,Math.min(1,(s-u+a)/a)),n.x=Math.max(0,Math.min(1,(l-o)/r)),n}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:C,toggleClass:w,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 n=W.get(e);0===n.handlers[t].length&&(delete n.handlers[t],e.removeEventListener?e.removeEventListener(t,n.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,n.dispatcher)),Object.getOwnPropertyNames(n.handlers).length<=0&&(delete n.handlers,delete n.dispatcher,delete n.disabled),0===Object.getOwnPropertyNames(n).length&&W.delete(e)}}function Y(e,t,n,i){n.forEach(function(n){e(t,n,i)})}function J(n){function i(){return!0}function r(){return!1}if(!n||!n.isPropagationStopped){var a=n||e.event;for(var s in n={},a)"layerX"!==s&&"layerY"!==s&&"keyLocation"!==s&&"webkitMovementX"!==s&&"webkitMovementY"!==s&&("returnValue"===s&&a.preventDefault||(n[s]=a[s]));if(n.target||(n.target=n.srcElement||t),n.relatedTarget||(n.relatedTarget=n.fromElement===n.target?n.toElement:n.fromElement),n.preventDefault=function(){a.preventDefault&&a.preventDefault(),n.returnValue=!1,a.returnValue=!1,n.defaultPrevented=!0},n.defaultPrevented=!1,n.stopPropagation=function(){a.stopPropagation&&a.stopPropagation(),n.cancelBubble=!0,a.cancelBubble=!0,n.isPropagationStopped=i},n.isPropagationStopped=r,n.stopImmediatePropagation=function(){a.stopImmediatePropagation&&a.stopImmediatePropagation(),n.isImmediatePropagationStopped=i,n.stopPropagation()},n.isImmediatePropagationStopped=r,null!==n.clientX&&void 0!==n.clientX){var o=t.documentElement,u=t.body;n.pageX=n.clientX+(o&&o.scrollLeft||u&&u.scrollLeft||0)-(o&&o.clientLeft||u&&u.clientLeft||0),n.pageY=n.clientY+(o&&o.scrollTop||u&&u.scrollTop||0)-(o&&o.clientTop||u&&u.clientTop||0)}n.which=n.charCode||n.keyCode,null!==n.button&&void 0!==n.button&&(n.button=1&n.button?0:4&n.button?1:2&n.button?2:0)}return n}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,n){if(Array.isArray(t))return Y(ee,e,t,n);W.has(e)||W.set(e,{});var i=W.get(e);if(i.handlers||(i.handlers={}),i.handlers[t]||(i.handlers[t]=[]),n.guid||(n.guid=$()),i.handlers[t].push(n),i.dispatcher||(i.disabled=!1,i.dispatcher=function(t,n){if(!i.disabled){t=J(t);var r=i.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,n)}catch(e){a.error(e)}}}),1===i.handlers[t].length)if(e.addEventListener){var r=!1;Q&&Z.indexOf(t)>-1&&(r={passive:!0}),e.addEventListener(t,i.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,i.dispatcher)}function te(e,t,n){if(W.has(e)){var i=W.get(e);if(i.handlers){if(Array.isArray(t))return Y(te,e,t,n);var r=function(e,t){i.handlers[t]=[],X(e,t)};if(void 0!==t){var a=i.handlers[t];if(a)if(n){if(n.guid)for(var s=0;s<a.length;s++)a[s].guid===n.guid&&a.splice(s--,1);X(e,t)}else r(e,t)}else for(var o in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},o)&&r(e,o)}}}function ne(e,t,n){var i=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),i.dispatcher&&i.dispatcher.call(e,t,n),r&&!t.isPropagationStopped()&&!0===t.bubbles)ne.call(null,r,t,n);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 ie(e,t,n){if(Array.isArray(t))return Y(ie,e,t,n);var i=function i(){te(e,t,i),n.apply(this,arguments)};i.guid=n.guid=n.guid||$(),ee(e,t,i)}function re(e,t,n){var i=function i(){te(e,t,i),n.apply(this,arguments)};i.guid=n.guid=n.guid||$(),ee(e,t,i)}var ae,se=Object.freeze({fixEvent:J,on:ee,off:te,trigger:ne,one:ie,any:re}),oe=!1,ue=function(){if(g()&&!1!==ae.options.autoSetup){var e=Array.prototype.slice.call(t.getElementsByTagName("video")),n=Array.prototype.slice.call(t.getElementsByTagName("audio")),i=Array.prototype.slice.call(t.getElementsByTagName("video-js")),r=e.concat(n,i);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,n){n&&(ae=n),e.setTimeout(ue,t)}g()&&"complete"===t.readyState?oe=!0:ie(e,"load",function(){oe=!0});var ce,de=function(e){var n=t.createElement("style");return n.className=e,n},he=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t},fe=30,pe=function(e,t,n){t.guid||(t.guid=$());var i=t.bind(e);return i.guid=n?n+"_"+t.guid:t.guid,i},me=function(t,n){var i=e.performance.now();return function(){var r=e.performance.now();r-i>=n&&(t.apply(void 0,arguments),i=r)}},ge=function(t,n,i,r){var a;void 0===r&&(r=e);var s=function(){var e=this,s=arguments,o=function(){a=null,o=null,i||t.apply(e,s)};!a&&i&&t.apply(e,s),r.clearTimeout(a),a=r.setTimeout(o,n)};return s.cancel=function(){r.clearTimeout(a),a=null},s},ve=function(){};ve.prototype.allowedEvents_={},ve.prototype.on=function(e,t){var n=this.addEventListener;this.addEventListener=function(){},ee(this,e,t),this.addEventListener=n},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 n=this.addEventListener;this.addEventListener=function(){},ie(this,e,t),this.addEventListener=n},ve.prototype.any=function(e,t){var n=this.addEventListener;this.addEventListener=function(){},re(this,e,t),this.addEventListener=n},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),ne(this,e)},ve.prototype.dispatchEvent=ve.prototype.trigger,ve.prototype.queueTrigger=function(t){var n=this;ce||(ce=new Map);var i=t.type||t,r=ce.get(this);r||(r=new Map,ce.set(this,r));var a=r.get(i);r.delete(i),e.clearTimeout(a);var s=e.setTimeout(function(){0===r.size&&(r=null,ce.delete(n)),n.trigger(t)},0);r.set(i,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 n,i,r,a=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return a?(n=e.eventBusEl_,t.length>=3&&t.shift(),i=t[0],r=t[1]):(n=t[0],i=t[1],r=t[2]),be(n),Te(i),Se(r),{isTargetingSelf:a,target:n,type:i,listener:r=pe(e,r)}},Ee=function(e,t,n,i){be(e),e.nodeName?se[t](e,n,i):e[t](n,i)},Ce={on:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=ke(this,n),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,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=ke(this,n),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 n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];u.apply(null,i)};l.guid=u.guid,Ee(s,"one",o,l)}},any:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=ke(this,n),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 n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];u.apply(null,i)};l.guid=u.guid,Ee(s,"any",o,l)}},off:function(e,t,n){if(!e||_e(e))te(this.eventBusEl_,e,t);else{var i=e,r=t;be(i),Te(r),Se(n),n=pe(this,n),this.off("dispose",n),i.nodeName?(te(i,r,n),te(i,"dispose",n)):ye(i)&&(i.off(r,n),i.off("dispose",n))}},trigger:function(e,t){return ne(this.eventBusEl_,e,t)}};function we(t,n){void 0===n&&(n={});var i=n.eventBusKey;if(i){if(!t[i].nodeName)throw new Error('The eventBusKey "'+i+'" does not refer to an element.');t.eventBusEl_=t[i]}else t.eventBusEl_=b("span",{className:"vjs-event-bus"});return c(t,Ce),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,n=this;return"function"==typeof e&&(e=e()),l(e,function(e,i){n.state[i]!==e&&((t=t||{})[i]={from:n.state[i],to:e}),n.state[i]=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,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return n.forEach(function(t){t&&l(t,function(t,n){h(t)?(h(e[n])||(e[n]={}),e[n]=Oe(e[n],t)):e[n]=t})}),e}var Ie=function(){function t(e,t,n){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 i=e&&e.id&&e.id()||"no_player";this.id_=i+"_component_"+$()}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),!1!==t.evented&&we(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(n),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var n=t.prototype;return n.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},n.player=function(){return this.player_},n.options=function(e){return e?(this.options_=Oe(this.options_,e),this.options_):this.options_},n.el=function(){return this.el_},n.createEl=function(e,t,n){return b(e,t,n)},n.localize=function(e,t,n){void 0===n&&(n=e);var i=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[i],s=i&&i.split("-")[0],o=r&&r[s],u=n;return a&&a[e]?u=a[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,function(e,n){var i=t[n-1],r=i;return void 0===i&&(r=e),r})),u},n.contentEl=function(){return this.contentEl_||this.el_},n.id=function(){return this.id_},n.name=function(){return this.name_},n.children=function(){return this.children_},n.getChildById=function(e){return this.childIndex_[e]},n.getChild=function(e){if(e)return this.childNameIndex_[e]},n.addChild=function(e,n,i){var r,a;if(void 0===n&&(n={}),void 0===i&&(i=this.children_.length),"string"==typeof e){a=Le(e);var s=n.componentClass||a;n.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,n)}else r=e;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(i,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[i]||null;this.contentEl().insertBefore(r.el(),u)}return r},n.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,n=this.children_.length-1;n>=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,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 i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},n.initChildren=function(){var e=this,n=this.options_.children;if(n){var i,r=this.options_,a=t.getComponent("Tech");(i=Array.isArray(n)?n:Object.keys(n)).concat(Object.keys(this.options_).filter(function(e){return!i.some(function(t){return"string"==typeof t?e===t:e===t.name})})).map(function(t){var i,r;return"string"==typeof t?r=n[i=t]||e.options_[i]||{}:(i=t.name,r=t),{name:i,opts:r}}).filter(function(e){var n=t.getComponent(e.opts.componentClass||Le(e.name));return n&&!a.isTech(n)}).forEach(function(t){var n=t.name,i=t.opts;if(void 0!==r[n]&&(i=r[n]),!1!==i){!0===i&&(i={}),i.playerOptions=e.options_.playerOptions;var a=e.addChild(n,i);a&&(e[n]=a)}})}},n.buildCSSClass=function(){return""},n.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))},n.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)},n.$=function(e,t){return H(e,t||this.contentEl())},n.$$=function(e,t){return z(e,t||this.contentEl())},n.hasClass=function(e){return k(this.el_,e)},n.addClass=function(e){E(this.el_,e)},n.removeClass=function(e){C(this.el_,e)},n.toggleClass=function(e,t){w(this.el_,e,t)},n.show=function(){this.removeClass("vjs-hidden")},n.hide=function(){this.addClass("vjs-hidden")},n.lockShowing=function(){this.addClass("vjs-lock-showing")},n.unlockShowing=function(){this.removeClass("vjs-lock-showing")},n.getAttribute=function(e){return R(this.el_,e)},n.setAttribute=function(e,t){L(this.el_,e,t)},n.removeAttribute=function(e){O(this.el_,e)},n.width=function(e,t){return this.dimension("width",e,t)},n.height=function(e,t){return this.dimension("height",e,t)},n.dimensions=function(e,t){this.width(e,!0),this.height(t)},n.dimension=function(e,t,n){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(n||this.trigger("componentresize"));if(!this.el_)return 0;var i=this.el_.style[e],r=i.indexOf("px");return-1!==r?parseInt(i.slice(0,r),10):parseInt(this.el_["offset"+Le(e)],10)},n.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 n="offset"+Le(e);t=this.el_[n]}return t},n.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},n.currentWidth=function(){return this.currentDimension("width")},n.currentHeight=function(){return this.currentDimension("height")},n.focus=function(){this.el_.focus()},n.blur=function(){this.el_.blur()},n.handleKeyDown=function(e){this.player_&&(e.stopPropagation(),this.player_.handleKeyDown(e))},n.handleKeyPress=function(e){this.handleKeyDown(e)},n.emitTapEvents=function(){var t,n=0,i=null;this.on("touchstart",function(r){1===r.touches.length&&(i={pageX:r.touches[0].pageX,pageY:r.touches[0].pageY},n=e.performance.now(),t=!0)}),this.on("touchmove",function(e){if(e.touches.length>1)t=!1;else if(i){var n=e.touches[0].pageX-i.pageX,r=e.touches[0].pageY-i.pageY;Math.sqrt(n*n+r*r)>10&&(t=!1)}});var r=function(){t=!1};this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",function(r){(i=null,!0===t)&&(e.performance.now()-n<200&&(r.preventDefault(),this.trigger("tap")))})},n.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 n=function(n){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",n),this.on("touchcancel",n)}},n.setTimeout=function(t,n){var i,r=this;return t=pe(this,t),this.clearTimersOnDispose_(),i=e.setTimeout(function(){r.setTimeoutIds_.has(i)&&r.setTimeoutIds_.delete(i),t()},n),this.setTimeoutIds_.add(i),i},n.clearTimeout=function(t){return this.setTimeoutIds_.has(t)&&(this.setTimeoutIds_.delete(t),e.clearTimeout(t)),t},n.setInterval=function(t,n){t=pe(this,t),this.clearTimersOnDispose_();var i=e.setInterval(t,n);return this.setIntervalIds_.add(i),i},n.clearInterval=function(t){return this.setIntervalIds_.has(t)&&(this.setIntervalIds_.delete(t),e.clearInterval(t)),t},n.requestAnimationFrame=function(t){var n,i=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),t=pe(this,t),n=e.requestAnimationFrame(function(){i.rafIds_.has(n)&&i.rafIds_.delete(n),t()}),this.rafIds_.add(n),n):this.setTimeout(t,1e3/60)},n.cancelAnimationFrame=function(t){return this.supportsRaf_?(this.rafIds_.has(t)&&(this.rafIds_.delete(t),e.cancelAnimationFrame(t)),t):this.clearTimeout(t)},n.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",function(){[["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(t){var n=t[0],i=t[1];e[n].forEach(e[i],e)}),e.clearingTimersOnDispose_=!1}))},t.registerComponent=function(e,n){if("string"!=typeof e||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var i,r=t.getComponent("Tech"),a=r&&r.isTech(n),s=t===n||t.prototype.isPrototypeOf(n.prototype);if(a||!s)throw i=a?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+e+'"; '+i+".");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]=n,t.components_[Re(e)]=n,n},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,n){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,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&De(r,n.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]),n=e[2]&&parseFloat(e[2]);return t&&n?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,nt=/Windows/i.test(Be),it=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:nt,TOUCH_ENABLED:it});function at(e,t,n,i){return function(e,t,n){if("number"!=typeof t||t<0||t>n)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+n+").")}(e,i,n.length-1),n[i][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 n,i,r=0;if(!t)return 0;e&&e.length||(e=ot(0,0));for(var a=0;a<e.length;a++)n=e.start(a),(i=e.end(a))>t&&(i=t),r+=i-n;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 n,i=null;try{n=JSON.parse(e,t)}catch(e){i=e}return[i,n]};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,n,i){return e[n]&&(t[n]=e[n]),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"),n=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===n.indexOf(e)}).map(bt))},St=function(e,t){return e.forEach(function(e){var n=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(function(e){return n.addCue(e)})}),t.textTracks()};function kt(e,t){return e(t={exports:{}},t.exports),t.exports}var Et=kt(function(e,t){function n(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 n,a=String(e);return(n=i[a.toLowerCase()])?n:(n=r[a.toLowerCase()])||(1===a.length?a.charCodeAt(0):void 0)}n.isEventKey=function(e,t){if(e&&"object"==typeof e){var n=e.which||e.keyCode||e.charCode;if(null===n||void 0===n)return!1;if("string"==typeof t){var a;if(a=i[t.toLowerCase()])return a===n;if(a=r[t.toLowerCase()])return a===n}else if("number"==typeof t)return t===n;return!1}};var i=(t=e.exports=n).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++)i[String.fromCharCode(a)]=a-32;for(var a=48;a<58;a++)i[a-48]=a;for(a=1;a<13;a++)i["f"+a]=a+111;for(a=0;a<10;a++)i["numpad "+a]=a+96;var s=t.names=t.title={};for(a in i)s[i[a]]=a;for(var o in r)i[o]=r[o]}),Ct=(Et.code,Et.codes,Et.aliases,Et.names,Et.title,"vjs-modal-dialog"),wt=function(n){function i(e,t){var i;return(i=n.call(this,e,t)||this).opened_=i.hasBeenOpened_=i.hasBeenFilled_=!1,i.closeable(!i.options_.uncloseable),i.content(i.options_.content),i.contentEl_=b("div",{className:Ct+"-content"},{role:"document"}),i.descEl_=b("p",{className:Ct+"-description vjs-control-text",id:i.el().getAttribute("aria-describedby")}),T(i.descEl_,i.description()),i.el_.appendChild(i.descEl_),i.el_.appendChild(i.contentEl_),i}xe(i,n);var r=i.prototype;return r.createEl=function(){return n.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,n.prototype.dispose.call(this)},r.buildCSSClass=function(){return Ct+" vjs-hidden "+n.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,n=this.getChild("closeButton");if(t&&!n){var i=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(n,"close",this.close)}!t&&n&&(this.off(n,"close",this.close),this.removeChild(n),n.dispose())}return this.closeable_},r.fill=function(){this.fillWith(this.content())},r.fillWith=function(e){var t=this.contentEl(),n=t.parentNode,i=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(t),this.empty(),V(t,e),this.trigger("modalfill"),i?n.insertBefore(t,i):n.appendChild(t);var r=this.getChild("closeButton");r&&n.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,n=this.player_.el_;this.previouslyActiveEl_=null,(n.contains(e)||n===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 n,i=this.focusableEls_(),r=this.el_.querySelector(":focus"),a=0;a<i.length;a++)if(r===i[a]){n=a;break}t.activeElement===this.el_&&(n=0),e.shiftKey&&0===n?(i[i.length-1].focus(),e.preventDefault()):e.shiftKey||n!==i.length-1||(i[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")})},i}(Ie);wt.prototype.options_={pauseOnOpen:!0,temporary:!0},Ie.registerComponent("ModalDialog",wt);var Pt=function(e){function t(t){var n;void 0===t&&(t=[]),(n=e.call(this)||this).tracks_=[],Object.defineProperty(Ue(n),"length",{get:function(){return this.tracks_.length}});for(var i=0;i<t.length;i++)n.addTrack(t[i]);return n}xe(t,e);var n=t.prototype;return n.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}))},n.removeTrack=function(e){for(var t,n=0,i=this.length;n<i;n++)if(this[n]===e){(t=this[n]).off&&t.off(),this.tracks_.splice(n,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},n.getTrackById=function(e){for(var t=null,n=0,i=this.length;n<i;n++){var r=this[n];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 n=0;n<e.length;n++)Object.keys(e[n]).length&&t.id!==e[n].id&&(e[n].enabled=!1)},Lt=function(e){function t(t){var n;void 0===t&&(t=[]);for(var i=t.length-1;i>=0;i--)if(t[i].enabled){Rt(t,t[i]);break}return(n=e.call(this,t)||this).changing_=!1,n}xe(t,e);var n=t.prototype;return n.addTrack=function(t){var n=this;t.enabled&&Rt(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){n.changing_||(n.changing_=!0,Rt(n,t),n.changing_=!1,n.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},n.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 n=0;n<e.length;n++)Object.keys(e[n]).length&&t.id!==e[n].id&&(e[n].selected=!1)},It=function(e){function t(t){var n;void 0===t&&(t=[]);for(var i=t.length-1;i>=0;i--)if(t[i].selected){Ot(t,t[i]);break}return(n=e.call(this,t)||this).changing_=!1,Object.defineProperty(Ue(n),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),n}xe(t,e);var n=t.prototype;return n.addTrack=function(t){var n=this;t.selected&&Ot(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.selectedChange_=function(){n.changing_||(n.changing_=!0,Ot(n,t),n.changing_=!1,n.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))},n.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 n=t.prototype;return n.addTrack=function(t){var n=this;e.prototype.addTrack.call(this,t),this.queueChange_||(this.queueChange_=function(){return n.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return n.trigger("selectedlanguagechange")}),t.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)},n.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,n=e.length;t<n;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,n=0,i=this.trackElements_.length;n<i;n++)if(e===this.trackElements_[n].track){t=this.trackElements_[n];break}return t},t.removeTrackElement_=function(e){for(var t=0,n=this.trackElements_.length;t<n;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,n=0,i=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<i)for(n=t;n<i;n++)r.call(this,n)},t.getCueById=function(e){for(var t=null,n=0,i=this.length;n<i;n++){var r=this[n];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 n;void 0===t&&(t={}),n=e.call(this)||this;var i={id:t.id||"vjs_track_"+$(),kind:t.kind||"",label:t.label||"",language:t.language||""},r=function(e){Object.defineProperty(Ue(n),e,{get:function(){return i[e]},set:function(){}})};for(var a in i)r(a);return n}return xe(t,e),t}(ve),Vt=function(n){var i=["protocol","hostname","port","pathname","search","hash","host"],r=t.createElement("a");r.href=n;var a,s=""===r.host&&"file:"!==r.protocol;s&&((a=t.createElement("div")).innerHTML='<a href="'+n+'"></a>',r=a.firstChild,a.setAttribute("style","display:none; position:absolute;"),t.body.appendChild(a));for(var o={},u=0;u<i.length;u++)o[i[u]]=r[i[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 n=t.createElement("div");n.innerHTML='<a href="'+e+'">x</a>',e=n.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 n=e.location,i=Vt(t);return(":"===i.protocol?n.protocol:i.protocol)+i.host!==n.protocol+n.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 n,i=Xt.call(arguments,1),r=Math.max(0,t.length-i.length),a=[],s=0;s<r;s++)a.push("$"+s);if(n=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof n){var r=t.apply(this,i.concat(Xt.call(arguments)));return Object(r)===r?r:this}return t.apply(e,i.concat(Xt.call(arguments)))}),t.prototype){var o=function(){};o.prototype=t.prototype,n.prototype=new o,o.prototype=null}return n},Qt=Object.prototype.toString,Zt=function(e){var t=Qt.call(e),n="[object Arguments]"===t;return n||(n="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===Qt.call(e.callee)),n};if(!Object.keys){var en=Object.prototype.hasOwnProperty,tn=Object.prototype.toString,nn=Zt,rn=Object.prototype.propertyIsEnumerable,an=!rn.call({toString:null},"toString"),sn=rn.call(function(){},"prototype"),on=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],un=function(e){var t=e.constructor;return t&&t.prototype===e},ln={$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},cn=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!ln["$"+e]&&en.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{un(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();$t=function(e){var t=null!==e&&"object"==typeof e,n="[object Function]"===tn.call(e),i=nn(e),r=t&&"[object String]"===tn.call(e),a=[];if(!t&&!n&&!i)throw new TypeError("Object.keys called on a non-object");var s=sn&&n;if(r&&e.length>0&&!en.call(e,0))for(var o=0;o<e.length;++o)a.push(String(o));if(i&&e.length>0)for(var u=0;u<e.length;++u)a.push(String(u));else for(var l in e)s&&"prototype"===l||!en.call(e,l)||a.push(String(l));if(an)for(var c=function(e){if("undefined"==typeof window||!cn)return un(e);try{return un(e)}catch(e){return!1}}(e),d=0;d<on.length;++d)c&&"constructor"===on[d]||!en.call(e,on[d])||a.push(on[d]);return a}}var dn=$t,hn=Array.prototype.slice,fn=Object.keys,pn=fn?function(e){return fn(e)}:dn,mn=Object.keys;pn.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)?mn(hn.call(e)):mn(e)}):Object.keys=pn;return Object.keys||pn};var gn=pn,vn="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),yn=Object.prototype.toString,_n=Array.prototype.concat,bn=Object.defineProperty,Tn=bn&&function(){var e={};try{for(var t in bn(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),Sn=function(e,t,n,i){var r;t in e&&("function"!=typeof(r=i)||"[object Function]"!==yn.call(r)||!i())||(Tn?bn(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},kn=function(e,t){var n=arguments.length>2?arguments[2]:{},i=gn(t);vn&&(i=_n.call(i,Object.getOwnPropertySymbols(t)));for(var r=0;r<i.length;r+=1)Sn(e,i[r],t[i[r]],n[i[r]])};kn.supportsDescriptors=!!Tn;var En=kn,Cn=Object.getOwnPropertyDescriptor?function(){return Object.getOwnPropertyDescriptor(arguments,"callee").get}():function(){throw new TypeError},wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,Pn=Object.getPrototypeOf||function(e){return e.__proto__},An="undefined"==typeof Uint8Array?void 0:Pn(Uint8Array),Rn={"$ %Array%":Array,"$ %ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"$ %ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer.prototype,"$ %ArrayIteratorPrototype%":wn?Pn([][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%":wn?Pn(Pn([][Symbol.iterator]())):void 0,"$ %JSON%":JSON,"$ %JSONParse%":JSON.parse,"$ %Map%":"undefined"==typeof Map?void 0:Map,"$ %MapIteratorPrototype%":"undefined"!=typeof Map&&wn?Pn((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&&wn?Pn((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%":wn?Pn(""[Symbol.iterator]()):void 0,"$ %StringPrototype%":String.prototype,"$ %Symbol%":wn?Symbol:void 0,"$ %SymbolPrototype%":wn?Symbol.prototype:void 0,"$ %SyntaxError%":SyntaxError,"$ %SyntaxErrorPrototype%":SyntaxError.prototype,"$ %ThrowTypeError%":Cn,"$ %TypedArray%":An,"$ %TypedArrayPrototype%":An?An.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},Ln=function(e,t){if(arguments.length>1&&"boolean"!=typeof t)throw new TypeError('"allowMissing" argument must be a boolean');var n="$ "+e;if(!(n in Rn))throw new SyntaxError("intrinsic "+e+" does not exist!");if(void 0===Rn[n]&&!t)throw new TypeError("intrinsic "+e+" exists, but is not available. Please file an issue!");return Rn[n]},On=Jt.call(Function.call,Object.prototype.hasOwnProperty),In=Ln("%TypeError%"),xn=Ln("%SyntaxError%"),Dn={"Property Descriptor":function(e,t){if("Object"!==e.Type(t))return!1;var n={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var i in t)if(On(t,i)&&!n[i])return!1;var r=On(t,"[[Value]]"),a=On(t,"[[Get]]")||On(t,"[[Set]]");if(r&&a)throw new In("Property Descriptors may not be both accessor and data descriptors");return!0}},Mn=function(e,t,n,i){var r=Dn[t];if("function"!=typeof r)throw new xn("unknown record type: "+t);if(!r(e,i))throw new In(n+" must be a "+t);console.log(r(e,i),i)},Un=Number.isNaN||function(e){return e!=e},jn=Number.isNaN||function(e){return e!=e},Bn=Number.isFinite||function(e){return"number"==typeof e&&!jn(e)&&e!==1/0&&e!==-1/0},Nn=function(e){return e>=0?1:-1},Fn=Function.prototype.toString,Vn=/^\s*class\b/,Gn=function(e){try{var t=Fn.call(e);return Vn.test(t)}catch(e){return!1}},Hn=Object.prototype.toString,zn="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,qn=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if("function"==typeof e&&!e.prototype)return!0;if(zn)return function(e){try{return!Gn(e)&&(Fn.call(e),!0)}catch(e){return!1}}(e);if(Gn(e))return!1;var t=Hn.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t},Wn=function(e){return null===e||"function"!=typeof e&&"object"!=typeof e},Kn=Object.prototype.toString,$n=function(e){var t;if((t=arguments.length>1?arguments[1]:"[object Date]"===Kn.call(e)?String:Number)===String||t===Number){var n,i,r=t===String?["toString","valueOf"]:["valueOf","toString"];for(i=0;i<r.length;++i)if(qn(e[r[i]])&&(n=e[r[i]](),Wn(n)))return n;throw new TypeError("No default value")}throw new TypeError("invalid [[DefaultValue]] hint supplied")},Xn=Ln("%Object%"),Yn=Ln("%TypeError%"),Jn=Ln("%String%"),Qn={ToPrimitive:function(e){return Wn(e)?e:arguments.length>1?$n(e,arguments[1]):$n(e)},ToBoolean:function(e){return!!e},ToNumber:function(e){return+e},ToInteger:function(e){var t=this.ToNumber(e);return Un(t)?0:0!==t&&Bn(t)?Nn(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 Un(t)||0===t||!Bn(t)?0:function(e,t){var n=e%t;return Math.floor(n>=0?n:n+t)}(Nn(t)*Math.floor(Math.abs(t)),65536)},ToString:function(e){return Jn(e)},ToObject:function(e){return this.CheckObjectCoercible(e),Xn(e)},CheckObjectCoercible:function(e,t){if(null==e)throw new Yn(t||"Cannot call method on "+e);return e},IsCallable:qn,SameValue:function(e,t){return e===t?0!==e||1/e==1/t:Un(e)&&Un(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 n in e)if(On(e,n)&&!t[n])return!1;var i=On(e,"[[Value]]"),r=On(e,"[[Get]]")||On(e,"[[Set]]");if(i&&r)throw new Yn("Property Descriptors may not be both accessor and data descriptors");return!0},IsAccessorDescriptor:function(e){return void 0!==e&&(Mn(this,"Property Descriptor","Desc",e),!(!On(e,"[[Get]]")&&!On(e,"[[Set]]")))},IsDataDescriptor:function(e){return void 0!==e&&(Mn(this,"Property Descriptor","Desc",e),!(!On(e,"[[Value]]")&&!On(e,"[[Writable]]")))},IsGenericDescriptor:function(e){return void 0!==e&&(Mn(this,"Property Descriptor","Desc",e),!this.IsAccessorDescriptor(e)&&!this.IsDataDescriptor(e))},FromPropertyDescriptor:function(e){if(void 0===e)return e;if(Mn(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 Yn("FromPropertyDescriptor must be called with a fully populated Property Descriptor")},ToPropertyDescriptor:function(e){if("Object"!==this.Type(e))throw new Yn("ToPropertyDescriptor requires an object");var t={};if(On(e,"enumerable")&&(t["[[Enumerable]]"]=this.ToBoolean(e.enumerable)),On(e,"configurable")&&(t["[[Configurable]]"]=this.ToBoolean(e.configurable)),On(e,"value")&&(t["[[Value]]"]=e.value),On(e,"writable")&&(t["[[Writable]]"]=this.ToBoolean(e.writable)),On(e,"get")){var n=e.get;if(void 0!==n&&!this.IsCallable(n))throw new TypeError("getter must be a function");t["[[Get]]"]=n}if(On(e,"set")){var i=e.set;if(void 0!==i&&!this.IsCallable(i))throw new Yn("setter must be a function");t["[[Set]]"]=i}if((On(t,"[[Get]]")||On(t,"[[Set]]"))&&(On(t,"[[Value]]")||On(t,"[[Writable]]")))throw new Yn("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t}},Zn=Jt.call(Function.call,String.prototype.replace),ei=/^[\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]+/,ti=/[\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]+$/,ni=function(){var e=Qn.ToString(Qn.CheckObjectCoercible(this));return Zn(Zn(e,ei,""),ti,"")},ii=function(){return String.prototype.trim&&""==="".trim()?String.prototype.trim:ni},ri=Jt.call(Function.call,ii());En(ri,{getPolyfill:ii,implementation:ni,shim:function(){var e=ii();return En(String.prototype,{trim:e},{trim:function(){return String.prototype.trim!==e}}),e}});var ai=ri,si=Object.prototype.toString,oi=Object.prototype.hasOwnProperty,ui=function(e,t,n){if(!qn(t))throw new TypeError("iterator must be a function");var i;arguments.length>=3&&(i=n),"[object Array]"===si.call(e)?function(e,t,n){for(var i=0,r=e.length;i<r;i++)oi.call(e,i)&&(null==n?t(e[i],i,e):t.call(n,e[i],i,e))}(e,t,i):"string"==typeof e?function(e,t,n){for(var i=0,r=e.length;i<r;i++)null==n?t(e.charAt(i),i,e):t.call(n,e.charAt(i),i,e)}(e,t,i):function(e,t,n){for(var i in e)oi.call(e,i)&&(null==n?t(e[i],i,e):t.call(n,e[i],i,e))}(e,t,i)},li=function(e){if(!e)return{};var t={};return ui(ai(e).split("\n"),function(e){var n,i=e.indexOf(":"),r=ai(e.slice(0,i)).toLowerCase(),a=ai(e.slice(i+1));void 0===t[r]?t[r]=a:(n=t[r],"[object Array]"===Object.prototype.toString.call(n)?t[r].push(a):t[r]=[t[r],a])}),t},ci=function(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var i in n)di.call(n,i)&&(e[i]=n[i])}return e},di=Object.prototype.hasOwnProperty;var hi=pi;function fi(e,t,n){var i=e;return Wt(t)?(n=t,"string"==typeof e&&(i={uri:e})):i=ci(t,{uri:e}),i.callback=n,i}function pi(e,t,n){return mi(t=fi(e,t,n))}function mi(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,i,r){t||(t=!0,e.callback(n,i,r))};function i(e){return clearTimeout(u),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(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 i=m,r=null;return 0!==t?(i={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&&(i.headers=li(o.getAllResponseHeaders()))):r=new Error("Internal XMLHttpRequest Error"),n(r,i,i.body)}}var a,s,o=e.xhr||null;o||(o=e.cors||e.useXDR?new pi.XDomainRequest:new pi.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=i,o.onprogress=function(){},o.onabort=function(){s=!0},o.ontimeout=i,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",i(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}pi.XMLHttpRequest=e.XMLHttpRequest||function(){},pi.XDomainRequest="withCredentials"in new pi.XMLHttpRequest?pi.XMLHttpRequest:e.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){pi["delete"===e?"del":e]=function(t,n,i){return(n=fi(t,n,i)).method=e.toUpperCase(),mi(n)}});var gi=function(t,n){var i=new e.WebVTT.Parser(e,e.vttjs,e.WebVTT.StringDecoder()),r=[];i.oncue=function(e){n.addCue(e)},i.onparsingerror=function(e){r.push(e)},i.onflush=function(){n.trigger({type:"loadeddata",target:n})},i.parse(t),r.length>0&&(e.console&&e.console.groupCollapsed&&e.console.groupCollapsed("Text Track parsing errors for "+n.src),r.forEach(function(e){return a.error(e)}),e.console&&e.console.groupEnd&&e.console.groupEnd()),i.flush()},vi=function(t,n){var i={uri:t},r=zt(t);r&&(i.cors=r),hi(i,pe(this,function(t,i,r){if(t)return a.error(t,i);n.loaded_=!0,"function"!=typeof e.WebVTT?n.tech_&&n.tech_.any(["vttjsloaded","vttjserror"],function(e){if("vttjserror"!==e.type)return gi(r,n);a.error("vttjs failed to load, stopping trying to process "+n.src)}):gi(r,n)}))},yi=function(t){function n(e){var n;if(void 0===e&&(e={}),!e.tech)throw new Error("A tech was not provided.");var i=Oe(e,{kind:Bt[e.kind]||"subtitles",language:e.language||e.srclang||""}),r=Nt[i.mode]||"disabled",a=i.default;"metadata"!==i.kind&&"chapters"!==i.kind||(r="hidden"),(n=t.call(this,i)||this).tech_=i.tech,n.cues_=[],n.activeCues_=[];var s=new Mt(n.cues_),o=new Mt(n.activeCues_),u=!1,l=pe(Ue(n),function(){this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1)});return"disabled"!==r&&n.tech_.ready(function(){n.tech_.on("timeupdate",l)},!0),Object.defineProperties(Ue(n),{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=[],n=0,i=this.cues.length;n<i;n++){var r=this.cues[n];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(){}}}),i.src?(n.src=i.src,vi(i.src,Ue(n))):n.loaded_=!0,n}xe(n,t);var i=n.prototype;return i.addCue=function(t){var n=t;if(e.vttjs&&!(t instanceof e.vttjs.VTTCue)){for(var i in n=new e.vttjs.VTTCue(t.startTime,t.endTime,t.text),t)i in n||(n[i]=t[i]);n.id=t.id,n.originalCue_=t}for(var r=this.tech_.textTracks(),a=0;a<r.length;a++)r[a]!==this&&r[a].removeCue(n);this.cues_.push(n),this.cues.setCues_(this.cues_)},i.removeCue=function(e){for(var t=this.cues_.length;t--;){var n=this.cues_[t];if(n===e||n.originalCue_&&n.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}},n}(Ft);yi.prototype.allowedEvents_={cuechange:"cuechange"};var _i=function(e){function t(t){var n;void 0===t&&(t={});var i=Oe(t,{kind:jt[t.kind]||""});n=e.call(this,i)||this;var r=!1;return Object.defineProperty(Ue(n),"enabled",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("enabledchange"))}}),i.enabled&&(n.enabled=i.enabled),n.loaded_=!0,n}return xe(t,e),t}(Ft),bi=function(e){function t(t){var n;void 0===t&&(t={});var i=Oe(t,{kind:Ut[t.kind]||""});n=e.call(this,i)||this;var r=!1;return Object.defineProperty(Ue(n),"selected",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("selectedchange"))}}),i.selected&&(n.selected=i.selected),n}return xe(t,e),t}(Ft),Ti=0,Si=2,ki=function(e){function t(t){var n,i;void 0===t&&(t={}),n=e.call(this)||this;var r=new yi(t);return n.kind=r.kind,n.src=r.src,n.srclang=r.language,n.label=r.label,n.default=r.default,Object.defineProperties(Ue(n),{readyState:{get:function(){return i}},track:{get:function(){return r}}}),i=Ti,r.addEventListener("loadeddata",function(){i=Si,n.trigger({type:"load",target:Ue(n)})}),n}return xe(t,e),t}(ve);ki.prototype.allowedEvents_={load:"load"},ki.NONE=Ti,ki.LOADING=1,ki.LOADED=Si,ki.ERROR=3;var Ei={audio:{ListClass:Lt,TrackClass:_i,capitalName:"Audio"},video:{ListClass:It,TrackClass:bi,capitalName:"Video"},text:{ListClass:xt,TrackClass:yi,capitalName:"Text"}};Object.keys(Ei).forEach(function(e){Ei[e].getterName=e+"Tracks",Ei[e].privateName=e+"Tracks_"});var Ci={remoteText:{ListClass:xt,TrackClass:yi,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Dt,TrackClass:ki,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},wi=Oe(Ei,Ci);Ci.names=Object.keys(Ci),Ei.names=Object.keys(Ei),wi.names=[].concat(Ci.names).concat(Ei.names);var Pi=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 Ai(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function Ri(e){function t(e,t,n,i){return 3600*(0|e)+60*(0|t)+(0|n)+(0|i)/1e3}var n=e.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return n?n[3]?t(n[1],n[2],n[3].replace(":",""),n[4]):n[1]>59?t(n[1],n[2],0,n[4]):t(0,n[1],n[2],n[4]):null}function Li(){this.values=Pi(null)}function Oi(e,t,n,i){var r=i?e.split(i):[e];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(n);if(2===s.length)t(s[0],s[1])}}function Ii(e,t,n){var i=e;function r(){var t=Ri(e);if(null===t)throw new Ai(Ai.Errors.BadTimeStamp,"Malformed timestamp: "+i);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 Ai(Ai.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.substr(3),a(),t.endTime=r(),a(),function(e,t){var i=new Li;Oi(e,function(e,t){switch(e){case"region":for(var r=n.length-1;r>=0;r--)if(n[r].id===t){i.set(e,n[r].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),s=a[0];i.integer(e,s),i.percent(e,s)&&i.set("snapToLines",!1),i.alt(e,s,["auto"]),2===a.length&&i.alt("lineAlign",a[1],["start","middle","end"]);break;case"position":a=t.split(","),i.percent(e,a[0]),2===a.length&&i.alt("positionAlign",a[1],["start","middle","end"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start","middle","end","left","right"])}},/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical",""),t.line=i.get("line","auto"),t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align","middle"),t.position=i.get("position",{start:0,left:0,middle:50,end:100,right:100},t.align),t.positionAlign=i.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},t.align)}(e,t)}Ai.prototype=Pi(Error.prototype),Ai.prototype.constructor=Ai,Ai.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Li.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,n){for(var i=0;i<n.length;++i)if(t===n[i]){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 xi={"&":"&","<":"<",">":">","‎":"","‏":""," ":" "},Di={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Mi={v:"title",lang:"lang"},Ui={rt:"ruby"};function ji(e,t){function n(){if(!t)return null;var e,n=t.match(/^([^<]*)(<[^>]*>?)?/);return e=n[1]?n[1]:n[2],t=t.substr(e.length),e}function i(e){return xi[e]}function r(e){for(;f=e.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)e=e.replace(f[0],i);return e}function a(e,t){return!Ui[t.localName]||Ui[t.localName]===e.localName}function s(t,n){var i=Di[t];if(!i)return null;var r=e.document.createElement(i);r.localName=i;var a=Mi[t];return a&&n&&(r[a]=n.trim()),r}for(var o,u=e.document.createElement("div"),l=u,c=[];null!==(o=n());)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=Ri(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 Bi=[[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 Ni(e){for(var t=0;t<Bi.length;t++){var n=Bi[t];if(e>=n[0]&&e<=n[1])return!0}return!1}function Fi(){}function Vi(e,t,n){Fi.call(this),this.cue=t,this.cueDiv=ji(e,t.text);var i={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(i,this.cueDiv),this.div=e.document.createElement("div"),i={direction:function(e){var t=[],n="";if(!e||!e.childNodes)return"ltr";function i(e,t){for(var n=t.childNodes.length-1;n>=0;n--)e.push(t.childNodes[n])}function r(e){if(!e||!e.length)return null;var t=e.pop(),n=t.textContent||t.innerText;if(n){var a=n.match(/^.*(\n|\r)/);return a?(e.length=0,a[0]):n}return"ruby"===t.tagName?r(e):t.childNodes?(i(e,t),r(e)):void 0}for(i(t,e);n=r(t);)for(var a=0;a<n.length;a++)if(Ni(n.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:n.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(i),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 Gi(e){var t,n,i,r;if(e.div){n=e.div.offsetHeight,i=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||n,this.bottom=e.bottom||r+(e.height||n),this.width=e.width||i,this.lineHeight=void 0!==t?t:e.lineHeight}function Hi(e,t,n,i){var r=new Gi(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,n=t.textTrackList,i=0,r=0;r<n.length&&n[r]!==t;r++)"showing"===n[r].mode&&i++;return-1*++i}(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=n[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?n.height:n.width,o=o.reverse()),r.move(h,c)}else{var f=r.lineHeight/n.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 Gi(t)}var p=function(e,t){for(var r,a=new Gi(e),s=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(n,t[o])||e.within(n)&&e.overlapsAny(i);)e.move(t[o]);if(e.within(n))return e;var u=e.intersectPercentage(n);s>u&&(r=new Gi(e),s=u),e=new Gi(a)}return r||a}(r,o);t.move(p.toCSSCompatValues(n))}function zi(){}Fi.prototype.applyStyles=function(e,t){for(var n in t=t||this.div,e)e.hasOwnProperty(n)&&(t.style[n]=e[n])},Fi.prototype.formatStyle=function(e,t){return 0===e?0:e+t},Vi.prototype=Pi(Fi.prototype),Vi.prototype.constructor=Vi,Gi.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}},Gi.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},Gi.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},Gi.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},Gi.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}},Gi.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)},Gi.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}},Gi.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,n=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,i=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||i,height:e.height||t,bottom:e.bottom||i+(e.height||t),width:e.width||n}},zi.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},zi.convertCueToDOMTree=function(e,t){return e&&t?ji(e,t):null};zi.processCues=function(e,t,n){if(!e||!t||!n)return null;for(;n.firstChild;)n.removeChild(n.firstChild);var i=e.document.createElement("div");if(i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.margin="1.5%",n.appendChild(i),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=Gi.getSimpleBoxPosition(i),s={font:Math.round(.05*a.height*100)/100+"px sans-serif"};!function(){for(var n,o,u=0;u<t.length;u++)o=t[u],n=new Vi(e,o,s),i.appendChild(n.div),Hi(0,n,a,r),o.displayState=n.div,r.push(Gi.getSimpleBoxPosition(n))}()}else for(var o=0;o<t.length;o++)i.appendChild(t[o].displayState)},zi.Parser=function(e,t,n){n||(n=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=n||new TextDecoder("utf8"),this.regionList=[]},zi.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof Ai))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function n(){for(var e=t.buffer,n=0;n<e.length&&"\r"!==e[n]&&"\n"!==e[n];)++n;var i=e.substr(0,n);return"\r"===e[n]&&++n,"\n"===e[n]&&++n,t.buffer=e.substr(n),i}function i(e){e.match(/X-TIMESTAMP-MAP/)?Oi(e,function(e,n){switch(e){case"X-TIMESTAMP-MAP":i=n,r=new Li,Oi(i,function(e,t){switch(e){case"MPEGT":r.integer(e+"S",t);break;case"LOCA":r.set(e+"L",Ri(t))}},/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:r.get("MPEGTS"),LOCAL:r.get("LOCAL")})}var i,r},/=/):Oi(e,function(e,n){switch(e){case"Region":!function(e){var n=new Li;if(Oi(e,function(e,t){switch(e){case"id":n.set(e,t);break;case"width":n.percent(e,t);break;case"lines":n.integer(e,t);break;case"regionanchor":case"viewportanchor":var i=t.split(",");if(2!==i.length)break;var r=new Li;if(r.percent("x",i[0]),r.percent("y",i[1]),!r.has("x")||!r.has("y"))break;n.set(e+"X",r.get("x")),n.set(e+"Y",r.get("y"));break;case"scroll":n.alt(e,t,["up"])}},/=/,/\s/),n.has("id")){var i=new(t.vttjs.VTTRegion||t.window.VTTRegion);i.width=n.get("width",100),i.lines=n.get("lines",3),i.regionAnchorX=n.get("regionanchorX",0),i.regionAnchorY=n.get("regionanchorY",100),i.viewportAnchorX=n.get("viewportanchorX",0),i.viewportAnchorY=n.get("viewportanchorY",100),i.scroll=n.get("scroll",""),t.onregion&&t.onregion(i),t.regionList.push({id:n.get("id"),region:i})}}(n)}},/:/)}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=n()).match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new Ai(Ai.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=n(),t.state){case"HEADER":/:/.test(r)?i(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{Ii(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 Ai(Ai.Errors.BadSignature)}catch(e){this.reportOrThrowError(e)}return this.onflush&&this.onflush(),this}};var qi=zi,Wi="auto",Ki={"":1,lr:1,rl:1},$i={start:1,middle:1,end:1,left:1,right:1};function Xi(e){return"string"==typeof e&&(!!$i[e.toLowerCase()]&&e.toLowerCase())}function Yi(e,t,n){this.hasBeenReset=!1;var i="",r=!1,a=e,s=t,o=n,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 i},set:function(e){i=""+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&&!!Ki[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!==Wi)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=Xi(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=Xi(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=Xi(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Yi.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Ji=Yi,Qi={"":!0,up:!0};function Zi(e){return"number"==typeof e&&e>=0&&e<=100}var er=function(){var e=100,t=3,n=0,i=100,r=0,a=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!Zi(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 i},set:function(e){if(!Zi(e))throw new Error("RegionAnchorX must be between 0 and 100.");i=e}},regionAnchorX:{enumerable:!0,get:function(){return n},set:function(e){if(!Zi(e))throw new Error("RegionAnchorY must be between 0 and 100.");n=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!Zi(e))throw new Error("ViewportAnchorY must be between 0 and 100.");a=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!Zi(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&&!!Qi[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 n=t.exports={WebVTT:qi,VTTCue:Ji,VTTRegion:er};e.vttjs=n,e.WebVTT=n.WebVTT;var i=n.VTTCue,r=n.VTTRegion,a=e.VTTCue,s=e.VTTRegion;n.shim=function(){e.VTTCue=i,e.VTTRegion=r},n.restore=function(){e.VTTCue=a,e.VTTRegion=s},e.VTTCue||n.shim()});tr.WebVTT,tr.VTTCue,tr.VTTRegion;var nr=function(n){function i(e,t){var i;return void 0===e&&(e={}),void 0===t&&(t=function(){}),e.reportTouchActivity=!1,(i=n.call(this,null,e,t)||this).hasStarted_=!1,i.on("playing",function(){this.hasStarted_=!0}),i.on("loadstart",function(){this.hasStarted_=!1}),wi.names.forEach(function(t){var n=wi[t];e&&e[n.getterName]&&(i[n.privateName]=e[n.getterName])}),i.featuresProgressEvents||i.manualProgressOn(),i.featuresTimeupdateEvents||i.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(t){!1===e["native"+t+"Tracks"]&&(i["featuresNative"+t+"Tracks"]=!1)}),!1===e.nativeCaptions||!1===e.nativeTextTracks?i.featuresNativeTextTracks=!1:!0!==e.nativeCaptions&&!0!==e.nativeTextTracks||(i.featuresNativeTextTracks=!0),i.featuresNativeTextTracks||i.emulateTextTracks(),i.autoRemoteTextTracks_=new wi.text.ListClass,i.initTrackListeners(),e.nativeControlsForTouch||i.emitTapEvents(),i.constructor&&(i.name_=i.constructor.name||"Unknown Tech"),i}xe(i,n);var r=i.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(Ei.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),n.prototype.dispose.call(this)},r.clearTracks=function(e){var t=this;(e=[].concat(e)).forEach(function(e){for(var n=t[e+"Tracks"]()||[],i=n.length;i--;){var r=n[i];"text"===e&&t.removeRemoteTextTrack(r),n.removeTrack(r)}})},r.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var n=e[t];this.removeRemoteTextTrack(n)}},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;Ei.names.forEach(function(t){var n=Ei[t],i=function(){e.trigger(t+"trackchange")},r=e[n.getterName]();r.addEventListener("removetrack",i),r.addEventListener("addtrack",i),e.on("dispose",function(){r.removeEventListener("removetrack",i),r.removeEventListener("addtrack",i)})})},r.addWebVttScript_=function(){var n=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 i=t.createElement("script");i.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",i.onload=function(){n.trigger("vttjsloaded")},i.onerror=function(){n.trigger("vttjserror")},this.on("dispose",function(){i.onload=null,i.onerror=null}),e.WebVTT=!0,this.el().parentNode.appendChild(i)}else this.ready(this.addWebVttScript_)},r.emulateTextTracks=function(){var e=this,t=this.textTracks(),n=this.remoteTextTracks(),i=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};n.on("addtrack",i),n.on("removetrack",r),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e<t.length;e++){var n=t[e];n.removeEventListener("cuechange",a),"showing"===n.mode&&n.addEventListener("cuechange",a)}};s(),t.addEventListener("change",s),t.addEventListener("addtrack",s),t.addEventListener("removetrack",s),this.on("dispose",function(){n.off("addtrack",i),n.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,n){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,n,i,r){void 0===r&&(r={});var a=e.textTracks();r.kind=t,n&&(r.label=n),i&&(r.language=i),r.tech=e;var s=new wi.text.TrackClass(r);return a.addTrack(s),s}(this,e,t,n)},r.createRemoteTextTrack=function(e){var t=Oe(e,{tech:this});return new Ci.remoteTextEl.TrackClass(t)},r.addRemoteTextTrack=function(e,t){var n=this;void 0===e&&(e={});var i=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_(i),this.remoteTextTracks().addTrack(i.track),!0!==t&&this.ready(function(){return n.autoRemoteTextTracks_.addTrack(i.track)}),i},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""},i.canPlayType=function(){return""},i.canPlaySource=function(e,t){return i.canPlayType(e.type)},i.isTech=function(e){return e.prototype instanceof i||e instanceof i||e===i},i.registerTech=function(e,t){if(i.techs_||(i.techs_={}),!i.isTech(t))throw new Error("Tech "+e+" must be a Tech");if(!i.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!i.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Le(e),i.techs_[e]=t,i.techs_[Re(e)]=t,"Tech"!==e&&i.defaultTechOrder_.push(e),t},i.getTech=function(t){if(t)return i.techs_&&i.techs_[t]?i.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)},i}(Ie);wi.names.forEach(function(e){var t=wi[e];nr.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),nr.prototype.featuresVolumeControl=!0,nr.prototype.featuresMuteControl=!0,nr.prototype.featuresFullscreenResize=!1,nr.prototype.featuresPlaybackRate=!1,nr.prototype.featuresProgressEvents=!1,nr.prototype.featuresSourceset=!1,nr.prototype.featuresTimeupdateEvents=!1,nr.prototype.featuresNativeTextTracks=!1,nr.withSourceHandlers=function(e){e.registerSourceHandler=function(t,n){var i=e.sourceHandlers;i||(i=e.sourceHandlers=[]),void 0===n&&(n=i.length),i.splice(n,0,t)},e.canPlayType=function(t){for(var n,i=e.sourceHandlers||[],r=0;r<i.length;r++)if(n=i[r].canPlayType(t))return n;return""},e.selectSourceHandler=function(t,n){for(var i=e.sourceHandlers||[],r=0;r<i.length;r++)if(i[r].canHandleSource(t,n))return i[r];return null},e.canPlaySource=function(t,n){var i=e.selectSourceHandler(t,n);return i?i.canHandleSource(t,n):""};["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 n=e.selectSourceHandler(t,this.options_);n||(e.nativeSourceHandler?n=e.nativeSourceHandler:a.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler),n!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=n.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",nr),nr.registerTech("Tech",nr),nr.defaultTechOrder_=[];var ir={},rr={},ar={};function sr(e,t,n){e.setTimeout(function(){return function e(t,n,i,r,a,s){void 0===t&&(t={});void 0===n&&(n=[]);void 0===a&&(a=[]);void 0===s&&(s=!1);var o=n,u=o[0],l=o.slice(1);if("string"==typeof u)e(t,ir[u],i,r,a,s);else if(u){var d=function(e,t){var n=rr[e.id()],i=null;if(void 0===n||null===n)return i=t(e),rr[e.id()]=[[t,i]],i;for(var r=0;r<n.length;r++){var a=n[r],s=a[0],o=a[1];s===t&&(i=o)}null===i&&(i=t(e),n.push([t,i]));return i}(r,u);if(!d.setSource)return a.push(d),e(t,l,i,r,a,s);d.setSource(c({},t),function(n,o){if(n)return e(t,l,i,r,a,s);a.push(d),e(o,t.type===o.type?l:ir[o.type],i,r,a,s)})}else l.length?e(t,l,i,r,a,s):s?i(t,a):e(t,ir["*"],i,r,a,!0)}(t,ir[t.type],n,e)},1)}function or(e,t,n,i){void 0===i&&(i=null);var r="call"+Le(n),a=e.reduce(dr(r),i),s=a===ar,o=s?null:t[n](a);return function(e,t,n,i){for(var r=e.length-1;r>=0;r--){var a=e[r];a[t]&&a[t](i,n)}}(e,n,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,n){return t===ar?ar:n[e]?n[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,n,i){var r,a=Oe({createEl:!1},n);if(r=e.call(this,t,a,i)||this,n.playerOptions.sources&&0!==n.playerOptions.sources.length)t.src(n.playerOptions.sources);else for(var s=0,o=n.playerOptions.techOrder;s<o.length;s++){var u=Le(o[s]),l=nr.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,n){var i;return(i=e.call(this,t,n)||this).emitTapEvents(),i.enable(),i}xe(t,e);var n=t.prototype;return n.createEl=function(t,n,i){void 0===t&&(t="div"),void 0===n&&(n={}),void 0===i&&(i={}),n=c({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass(),tabIndex:0},n),"button"===t&&a.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead."),i=c({role:"button"},i),this.tabIndex_=n.tabIndex;var r=e.prototype.createEl.call(this,t,n,i);return this.createControlTextEl(r),r},n.dispose=function(){this.controlTextEl_=null,e.prototype.dispose.call(this)},n.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_},n.controlText=function(e,t){if(void 0===t&&(t=this.el()),void 0===e)return this.controlText_||"Need Text";var n=this.localize(e);this.controlText_=e,T(this.controlTextEl_,n),this.nonIconControl||t.setAttribute("title",n)},n.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)},n.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))},n.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)},n.handleClick=function(e){},n.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,n){var i;return(i=e.call(this,t,n)||this).update(),t.on("posterchange",pe(Ue(i),i.update)),i}xe(t,e);var n=t.prototype;return n.dispose=function(){this.player().off("posterchange",this.update),e.prototype.dispose.call(this)},n.createEl=function(){return b("div",{className:"vjs-poster",tabIndex:-1})},n.update=function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()},n.setSrc=function(e){var t="";e&&(t='url("'+e+'")'),this.el_.style.backgroundImage=t},n.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 n;if(4===e.length)n=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");n=e.slice(1)}return"rgba("+parseInt(n.slice(0,2),16)+","+parseInt(n.slice(2,4),16)+","+parseInt(n.slice(4,6),16)+","+t+")"}function br(e,t,n){try{e.style[t]=n}catch(e){return}}var Tr=function(t){function n(n,i,r){var a;a=t.call(this,n,i,r)||this;var s=pe(Ue(a),a.updateDisplay);return n.on("loadstart",pe(Ue(a),a.toggleDisplay)),n.on("texttrackchange",s),n.on("loadedmetadata",pe(Ue(a),a.preselectTrack)),n.ready(pe(Ue(a),function(){if(n.tech_&&n.tech_.featuresNativeTextTracks)this.hide();else{n.on("fullscreenchange",s),n.on("playerresize",s),e.addEventListener("orientationchange",s),n.on("dispose",function(){return e.removeEventListener("orientationchange",s)});for(var t=this.options_.playerOptions.tracks||[],i=0;i<t.length;i++)this.player_.addRemoteTextTrack(t[i],!0);this.preselectTrack()}})),a}xe(n,t);var i=n.prototype;return i.preselectTrack=function(){for(var e,t,n,i={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 i?o.kind===a.kind?n=o:n||(n=o):a&&!a.enabled?(n=null,e=null,t=null):o.default&&("descriptions"!==o.kind||e?o.kind in i&&!t&&(t=o):e=o)}n?n.mode="showing":t?t.mode="showing":e&&(e.mode="showing")},i.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},i.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},i.clearDisplay=function(){"function"==typeof e.WebVTT&&e.WebVTT.processCues(e,[],this.el_)},i.updateDisplay=function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var n=[],i=0;i<e.length;++i){var r=e[i];"showing"===r.mode&&n.push(r)}this.updateForTrack(n)}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))}},i.updateDisplayState=function(t){for(var n=this.player_.textTrackSettings.getValues(),i=t.activeCues,r=i.length;r--;){var a=i[r];if(a){var s=a.displayState;if(n.color&&(s.firstChild.style.color=n.color),n.textOpacity&&br(s.firstChild,"color",_r(n.color||"#fff",n.textOpacity)),n.backgroundColor&&(s.firstChild.style.backgroundColor=n.backgroundColor),n.backgroundOpacity&&br(s.firstChild,"backgroundColor",_r(n.backgroundColor||"#000",n.backgroundOpacity)),n.windowColor&&(n.windowOpacity?br(s,"backgroundColor",_r(n.windowColor,n.windowOpacity)):s.style.backgroundColor=n.windowColor),n.edgeStyle&&("dropshadow"===n.edgeStyle?s.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===n.edgeStyle?s.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===n.edgeStyle?s.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===n.edgeStyle&&(s.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),n.fontPercent&&1!==n.fontPercent){var o=e.parseFloat(s.style.fontSize);s.style.fontSize=o*n.fontPercent+"px",s.style.height="auto",s.style.top="auto",s.style.bottom="2px"}n.fontFamily&&"default"!==n.fontFamily&&("small-caps"===n.fontFamily?s.firstChild.style.fontVariant="small-caps":s.firstChild.style.fontFamily=yr[n.fontFamily])}}},i.updateForTrack=function(t){if(Array.isArray(t)||(t=[t]),"function"==typeof e.WebVTT&&!t.every(function(e){return!e.activeCues})){for(var n=[],i=0;i<t.length;++i)for(var r=t[i],a=0;a<r.activeCues.length;++a)n.push(r.activeCues[a]);e.WebVTT.processCues(e,n,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)}}},n}(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(),n=this.localize(t?"Audio Player":"Video Player"),i=b("span",{className:"vjs-control-text",innerHTML:this.localize("{1} is loading.",[n])}),r=e.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(i),r},t}(Ie);Ie.registerComponent("LoadingSpinner",Sr);var kr=function(e){function t(){return e.apply(this,arguments)||this}xe(t,e);var n=t.prototype;return n.createEl=function(e,t,n){void 0===t&&(t={}),void 0===n&&(n={}),t=c({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass()},t),n=c({type:"button"},n);var i=Ie.prototype.createEl.call(this,"button",t,n);return this.createControlTextEl(i),i},n.addChild=function(e,t){void 0===t&&(t={});var n=this.constructor.name;return a.warn("Adding an actionable (user controllable) child to a Button ("+n+") is not supported; use a ClickableComponent instead."),Ie.prototype.addChild.call(this,e,t)},n.enable=function(){e.prototype.enable.call(this),this.el_.removeAttribute("disabled")},n.disable=function(){e.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},n.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,n){var i;return(i=e.call(this,t,n)||this).mouseused_=!1,i.on("mousedown",i.handleMouseDown),i}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-big-play-button"},n.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 n=this.player_.getChild("controlBar"),i=n&&n.getChild("playToggle");if(i){var r=function(){return i.focus()};yt(t)?t.then(r,function(){}):this.setTimeout(r,1)}else this.player_.tech(!0).focus()},n.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},n.handleMouseDown=function(e){this.mouseused_=!0},t}(kr);Er.prototype.controlText_="Play Video",Ie.registerComponent("BigPlayButton",Er);var Cr=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).controlText(n&&n.controlText||i.localize("Close")),i}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},n.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},n.handleKeyDown=function(t){Et.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(kr);Ie.registerComponent("CloseButton",Cr);var wr=function(e){function t(t,n){var i;return void 0===n&&(n={}),i=e.call(this,t,n)||this,n.replay=void 0===n.replay||n.replay,i.on(t,"play",i.handlePlay),i.on(t,"pause",i.handlePause),n.replay&&i.on(t,"ended",i.handleEnded),i}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},n.handleClick=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},n.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},n.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},n.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},n.handleEnded=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",this.handleSeeked)},t}(kr);wr.prototype.controlText_="Play",Ie.registerComponent("PlayToggle",wr);var Pr=function(e,t){e=e<0?0:e;var n=Math.floor(e%60),i=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=i=n="-"),(r=r>0||s>0?r+":":"")+(i=((r||a>=10)&&i<10?"0"+i:i)+":")+(n=n<10?"0"+n:n)},Ar=Pr;function Rr(e,t){return void 0===t&&(t=e),Ar(e,t)}var Lr=function(e){function n(t,n){var i;return(i=e.call(this,t,n)||this).throttledUpdateContent=me(pe(Ue(i),i.updateContent),fe),i.on(t,"timeupdate",i.throttledUpdateContent),i}xe(n,e);var i=n.prototype;return i.createEl=function(){var t=this.buildCSSClass(),n=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_(),n.appendChild(this.contentEl_),n},i.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},i.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_)}},i.formatTime_=function(e){return Rr(e)},i.updateFormattedTime_=function(e){var t=this.formatTime_(e);t!==this.formattedTime_&&(this.formattedTime_=t,this.requestAnimationFrame(this.updateTextNode_))},i.updateContent=function(e){},n}(Ie);Lr.prototype.labelText_="Time",Lr.prototype.controlText_="Time",Ie.registerComponent("TimeDisplay",Lr);var Or=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).on(t,"ended",i.handleEnded),i}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-current-time"},n.updateContent=function(e){var t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(t)},n.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,n){var i;return(i=e.call(this,t,n)||this).on(t,"durationchange",i.updateContent),i.on(t,"loadstart",i.updateContent),i.on(t,"loadedmetadata",i.throttledUpdateContent),i}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-duration"},n.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,n){var i;return(i=e.call(this,t,n)||this).on(t,"durationchange",i.throttledUpdateContent),i.on(t,"ended",i.handleEnded),i}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-remaining-time"},n.createEl=function(){var t=e.prototype.createEl.call(this);return t.insertBefore(b("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},n.updateContent=function(e){"number"==typeof this.player_.duration()&&(this.player_.remainingTimeDisplay?this.updateFormattedTime_(this.player_.remainingTimeDisplay()):this.updateFormattedTime_(this.player_.remainingTime()))},n.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,n){var i;return(i=e.call(this,t,n)||this).updateShowing(),i.on(i.player(),"durationchange",i.updateShowing),i}xe(t,e);var n=t.prototype;return n.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=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},n.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},n.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(Ie);Ie.registerComponent("LiveDisplay",Mr);var Ur=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).updateLiveEdgeStatus(),i.player_.liveTracker&&i.on(i.player_.liveTracker,"liveedgechange",i.updateLiveEdgeStatus),i}xe(t,e);var n=t.prototype;return n.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=b("span",{className:"vjs-seek-to-live-text",innerHTML:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},n.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"))},n.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},n.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,n){var i;return(i=e.call(this,t,n)||this).bar=i.getChild(i.options_.barName),i.vertical(!!i.options_.vertical),i.enable(),i}xe(t,e);var n=t.prototype;return n.enabled=function(){return this.enabled_},n.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown),this.on("touchstart",this.handleMouseDown),this.on("keydown",this.handleKeyDown),this.on("click",this.handleClick),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},n.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown),this.off("touchstart",this.handleMouseDown),this.off("keydown",this.handleKeyDown),this.off("click",this.handleClick),this.off(this.player_,"controlsvisible",this.update),this.off(e,"mousemove",this.handleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchmove",this.handleMouseMove),this.off(e,"touchend",this.handleMouseUp),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},n.createEl=function(t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),n.className=n.className+" vjs-slider",n=c({tabIndex:0},n),i=c({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},i),e.prototype.createEl.call(this,t,n,i)},n.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)},n.handleMouseMove=function(e){},n.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()},n.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 n=(100*e).toFixed(2)+"%",i=t.el().style,r=this.vertical()?"height":"width";return i[r]!==n&&(i[r]=n),e}}},n.calculateDistance=function(e){var t=U(this.el_,e);return this.vertical()?t.y:t.x},n.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)},n.handleClick=function(e){e.stopPropagation(),e.preventDefault()},n.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(Ie);Ie.registerComponent("Slider",jr);var Br=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).partEls_=[],i.on(t,"progress",i.update),i}xe(t,e);var n=t.prototype;return n.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>'})},n.dispose=function(){this.partEls_=null,e.prototype.dispose.call(this)},n.update=function(e){var t=this.player_.liveTracker,n=this.player_.buffered(),i=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,n){var i=e/t||0;return i=100*(i>=1?1:i),n&&(i=i.toFixed(2)),i+"%"};this.el_.style.width=o(r,i),T(s,o(r,i,!0));for(var u=0;u<n.length;u++){var l=n.start(u),c=n.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>n.length;h--)this.el_.removeChild(a[h-1]);a.length=n.length},t}(Ie);Ie.registerComponent("LoadProgressBar",Br);var Nr=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).update=me(pe(Ue(i),i.update),fe),i}xe(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},n.update=function(e,t,n){var i=D(this.el_),r=D(this.player_.el()),a=e.width*t;if(r&&i){var s=e.left-r.left+a,o=e.width-a+(r.right-e.right),u=i.width/2;s<u?u+=u-s:o<u&&(u=o),u<0?u=0:u>i.width&&(u=i.width),this.el_.style.right="-"+u+"px",this.write(n)}},n.write=function(e){T(this.el_,e)},n.updateTime=function(e,t,n,i){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(n,s);r.update(e,t,a),i&&i()})},t}(Ie);Ie.registerComponent("TimeTooltip",Nr);var Fr=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).update=me(pe(Ue(i),i.update),fe),i}xe(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},n.update=function(e,t){var n=this.getChild("timeTooltip");if(n){var i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,i)}},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,n){var i;return(i=e.call(this,t,n)||this).update=me(pe(Ue(i),i.update),fe),i}xe(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},n.update=function(e,t){var n=this,i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,function(){n.el_.style.left=e.width*t+"px"})},t}(Ie);Vr.prototype.options_={children:["timeTooltip"]},Ie.registerComponent("MouseTimeDisplay",Vr);var Gr=function(e){function n(t,n){var i;return(i=e.call(this,t,n)||this).setEventHandlers_(),i}xe(n,e);var i=n.prototype;return i.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_)},i.toggleVisibility_=function(e){t.hidden?this.disableInterval_(e):(this.enableInterval_(),this.requestAnimationFrame(this.update))},i.enableInterval_=function(){var e=this;this.clearInterval(this.updateInterval),this.updateInterval=this.setInterval(function(){e.requestAnimationFrame(e.update)},30)},i.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&"ended"!==e.type||this.clearInterval(this.updateInterval)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update_=function(e,t){var n=this.player_.liveTracker,i=this.player_.duration();n&&n.isLive()&&(i=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,i),Rr(i,i)],"{1} of {2}")),this.bar&&this.bar.update(D(this.el_),t)},i.update=function(t){if(null!==this.el().offsetParent){var n=e.prototype.update.call(this);return this.update_(this.getCurrentTime_(),n),n}},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.handleEnded=function(e){this.update_(this.player_.duration(),1)},i.getPercent=function(){var e,t=this.getCurrentTime_(),n=this.player_.liveTracker;return n&&n.isLive()?(e=(t-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e>=1?1:e||0},i.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))},i.handleMouseMove=function(e){if(G(e)){var t,n=this.calculateDistance(e),i=this.player_.liveTracker;if(i&&i.isLive()){var r=i.seekableStart(),a=i.liveCurrentTime();if((t=r+n*i.liveWindow())>=a&&(t=a),t<=r&&(t=r+.1),t===1/0)return}else(t=n*this.player_.duration())===this.player_.duration()&&(t-=.1);this.player_.currentTime(t)}},i.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},i.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},i.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())},i.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},i.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},i.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.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 n=10*(Et.codes[Et(t)]-Et.codes[0])/100;this.player_.currentTime(this.player_.duration()*n)}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)},n}(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,n){var i;return(i=e.call(this,t,n)||this).handleMouseMove=me(pe(Ue(i),i.handleMouseMove),fe),i.throttledHandleMouseSeek=me(pe(Ue(i),i.handleMouseSeek),fe),i.enable(),i}xe(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},n.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var n=t.getChild("mouseTimeDisplay"),i=t.el(),r=D(i),a=U(i,e).x;a>1?a=1:a<0&&(a=0),n&&n.update(r,a)}},n.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},n.enabled=function(){return this.enabled_},n.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)},n.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)},n.handleMouseDown=function(e){var t=this.el_.ownerDocument,n=this.getChild("seekBar");n&&n.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},n.handleMouseUp=function(e){var t=this.el_.ownerDocument,n=this.getChild("seekBar");n&&n.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 n(n,i){var r;return(r=e.call(this,n,i)||this).on(n,["enterpictureinpicture","leavepictureinpicture"],r.handlePictureInPictureChange),t.pictureInPictureEnabled||r.disable(),r}xe(n,e);var i=n.prototype;return i.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},i.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture")},i.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},n}(kr);zr.prototype.controlText_="Picture-in-Picture",Ie.registerComponent("PictureInPictureToggle",zr);var qr=function(e){function n(n,i){var r;return(r=e.call(this,n,i)||this).on(n,"fullscreenchange",r.handleFullscreenChange),!1===t[n.fsApi_.fullscreenEnabled]&&r.disable(),r}xe(n,e);var i=n.prototype;return i.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},i.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},i.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},n}(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,n){var i;return(i=e.call(this,t,n)||this).on("slideractive",i.updateLastVolume_),i.on(t,"volumechange",i.updateARIAAttributes),t.ready(function(){return i.updateARIAAttributes()}),i}xe(t,e);var n=t.prototype;return n.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},n.handleMouseDown=function(t){G(t)&&e.prototype.handleMouseDown.call(this,t)},n.handleMouseMove=function(e){G(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},n.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},n.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},n.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},n.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},n.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},n.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},n.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",function(){0===e.player_.volume()&&e.player_.lastVolume_(t)})},t}(jr);$r.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},$r.prototype.playerEvent="volumechange",Ie.registerComponent("VolumeBar",$r);var Xr=function(e){function t(t,n){var i;return void 0===n&&(n={}),n.vertical=n.vertical||!1,(void 0===n.volumeBar||h(n.volumeBar))&&(n.volumeBar=n.volumeBar||{},n.volumeBar.vertical=n.vertical),i=e.call(this,t,n)||this,Wr(Ue(i),t),i.throttledHandleMouseMove=me(pe(Ue(i),i.handleMouseMove),fe),i.on("mousedown",i.handleMouseDown),i.on("touchstart",i.handleMouseDown),i.on(i.volumeBar,["focus","slideractive"],function(){i.volumeBar.addClass("vjs-slider-active"),i.addClass("vjs-slider-active"),i.trigger("slideractive")}),i.on(i.volumeBar,["blur","sliderinactive"],function(){i.volumeBar.removeClass("vjs-slider-active"),i.removeClass("vjs-slider-active"),i.trigger("sliderinactive")}),i}xe(t,e);var n=t.prototype;return n.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},n.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},n.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchend",this.handleMouseUp)},n.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,n){var i;return i=e.call(this,t,n)||this,Yr(Ue(i),t),i.on(t,["loadstart","volumechange"],i.update),i}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},n.handleClick=function(e){var t=this.player_.volume(),n=this.player_.lastVolume_();if(0===t){var i=n<.1?.1:n;this.player_.volume(i),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},n.update=function(e){this.updateIcon_(),this.updateControlText_()},n.updateIcon_=function(){var e=this.player_.volume(),t=3;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 n=0;n<4;n++)C(this.el_,"vjs-vol-"+n);E(this.el_,"vjs-vol-"+t)},n.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 n(t,n){var i;return void 0===n&&(n={}),void 0!==n.inline?n.inline=n.inline:n.inline=!0,(void 0===n.volumeControl||h(n.volumeControl))&&(n.volumeControl=n.volumeControl||{},n.volumeControl.vertical=!n.inline),(i=e.call(this,t,n)||this).on(t,["loadstart"],i.volumePanelState_),i.on(i.muteToggle,"keyup",i.handleKeyPress),i.on(i.volumeControl,"keyup",i.handleVolumeControlKeyUp),i.on("keydown",i.handleKeyPress),i.on("mouseover",i.handleMouseOver),i.on("mouseout",i.handleMouseOut),i.on(i.volumeControl,["slideractive"],i.sliderActive_),i.on(i.volumeControl,["sliderinactive"],i.sliderInactive_),i}xe(n,e);var i=n.prototype;return i.sliderActive_=function(){this.addClass("vjs-slider-active")},i.sliderInactive_=function(){this.removeClass("vjs-slider-active")},i.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")},i.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})},i.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(e){Et.isEventKey(e,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(e){this.addClass("vjs-hover"),ee(t,"keyup",pe(this,this.handleKeyPress))},i.handleMouseOut=function(e){this.removeClass("vjs-hover"),te(t,"keyup",pe(this,this.handleKeyPress))},i.handleKeyPress=function(e){Et.isEventKey(e,"Esc")&&this.handleMouseOut()},n}(Ie);Qr.prototype.options_={children:["muteToggle","volumeControl"]},Ie.registerComponent("VolumePanel",Qr);var Zr=function(e){function n(t,n){var i;return i=e.call(this,t,n)||this,n&&(i.menuButton_=n.menuButton),i.focusedChild_=-1,i.on("keydown",i.handleKeyDown),i.boundHandleBlur_=pe(Ue(i),i.handleBlur),i.boundHandleTapClick_=pe(Ue(i),i.handleTapClick),i}xe(n,e);var i=n.prototype;return i.addEventListenerForItem=function(e){e instanceof Ie&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},i.removeEventListenerForItem=function(e){e instanceof Ie&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},i.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},i.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=b(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var n=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return n.appendChild(this.contentEl_),ee(n,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),n},i.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},i.handleBlur=function(e){var n=e.relatedTarget||t.activeElement;if(!this.children().some(function(e){return e.el()===n})){var i=this.menuButton_;i&&i.buttonPressed_&&n!==i.el().firstChild&&i.unpressButton()}},i.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var n=t.filter(function(t){return t.el()===e.target})[0];if(!n)return;"CaptionSettingsMenuItem"!==n.name()&&this.menuButton_.focus()}},i.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())},i.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},i.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},i.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())},n}(Ie);Ie.registerComponent("Menu",Zr);var ea=function(e){function n(n,i){var r;void 0===i&&(i={}),(r=e.call(this,n,i)||this).menuButton_=new kr(n,i),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(n,e);var i=n.prototype;return i.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()},i.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 n=new Ie(this.player_,{el:t});e.addItem(n)}if(this.items=this.createItems(),this.items)for(var i=0;i<this.items.length;i++)e.addItem(this.items[i]);return e},i.createItems=function(){},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},i.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)},i.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)},i.controlText=function(e,t){return void 0===t&&(t=this.menuButton_.el()),this.menuButton_.controlText(e,t)},i.dispose=function(){this.handleMouseLeave(),e.prototype.dispose.call(this)},i.handleClick=function(e){this.buttonPressed_?this.unpressButton():this.pressButton()},i.handleMouseLeave=function(e){this.removeClass("vjs-hover"),te(t,"keyup",pe(this,this.handleMenuKeyUp))},i.focus=function(){this.menuButton_.focus()},i.blur=function(){this.menuButton_.blur()},i.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()))},i.handleMenuKeyUp=function(e){(Et.isEventKey(e,"Esc")||Et.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},i.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},i.handleSubmenuKeyDown=function(e){(Et.isEventKey(e,"Esc")||Et.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),Et.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))},i.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()}},i.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},i.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},i.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},n}(Ie);Ie.registerComponent("MenuButton",ea);var ta=function(e){function t(t,n){var i,r=n.tracks;if((i=e.call(this,t,n)||this).items.length<=1&&i.hide(),!r)return Ue(i);var a=pe(Ue(i),i.update);return r.addEventListener("removetrack",a),r.addEventListener("addtrack",a),i.player_.on("ready",a),i.player_.on("dispose",function(){r.removeEventListener("removetrack",a),r.removeEventListener("addtrack",a)}),i}return xe(t,e),t}(ea);Ie.registerComponent("TrackButton",ta);var na=["Tab","Esc","Up","Down","Right","Left"],ia=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).selectable=n.selectable,i.isSelected_=n.selected||!1,i.multiSelectable=n.multiSelectable,i.selected(i.isSelected_),i.selectable?i.multiSelectable?i.el_.setAttribute("role","menuitemcheckbox"):i.el_.setAttribute("role","menuitemradio"):i.el_.setAttribute("role","menuitem"),i}xe(t,e);var n=t.prototype;return n.createEl=function(t,n,i){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},n),i)},n.handleKeyDown=function(t){na.some(function(e){return Et.isEventKey(t,e)})||e.prototype.handleKeyDown.call(this,t)},n.handleClick=function(e){this.selected(!0)},n.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",ia);var ra=function(n){function i(i,r){var a,s=r.track,o=i.textTracks();r.label=s.label||s.language||"Unknown",r.selected="showing"===s.mode,(a=n.call(this,i,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),n=0;n<e;n++)t[n]=arguments[n];a.handleTracksChange.apply(Ue(a),t)},c=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];a.handleSelectedLanguageChange.apply(Ue(a),t)};(i.on(["loadstart","texttrackchange"],l),o.addEventListener("change",l),o.addEventListener("selectedlanguagechange",c),a.on("dispose",function(){i.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(i,n);var r=i.prototype;return r.handleClick=function(e){var t=this.track,i=this.player_.textTracks();if(n.prototype.handleClick.call(this,e),i)for(var r=0;r<i.length;r++){var a=i[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,n.prototype.dispose.call(this)},i}(ia);Ie.registerComponent("TextTrackMenuItem",ra);var aa=function(e){function t(t,n){return n.track={player:t,kind:n.kind,kinds:n.kinds,default:!1,mode:"disabled"},n.kinds||(n.kinds=[n.kind]),n.label?n.track.label=n.label:n.track.label=n.kinds.join(" and ")+" off",n.selectable=!0,n.multiSelectable=!1,e.call(this,t,n)||this}xe(t,e);var n=t.prototype;return n.handleTracksChange=function(e){for(var t=this.player().textTracks(),n=!0,i=0,r=t.length;i<r;i++){var a=t[i];if(this.options_.kinds.indexOf(a.kind)>-1&&"showing"===a.mode){n=!1;break}}n!==this.isSelected_&&this.selected(n)},n.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),n=!0,i=0,r=t.length;i<r;i++){var a=t[i];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&"showing"===a.mode){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(ra);Ie.registerComponent("OffTextTrackMenuItem",aa);var sa=function(e){function t(t,n){return void 0===n&&(n={}),n.tracks=t.textTracks(),e.call(this,t,n)||this}return xe(t,e),t.prototype.createItems=function(e,t){var n;void 0===e&&(e=[]),void 0===t&&(t=ra),this.label_&&(n=this.label_+" off"),e.push(new aa(this.player_,{kinds:this.kinds_,kind:this.kind_,label:n})),this.hideThreshold_+=1;var i=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<i.length;r++){var a=i[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,n){var i,r=n.track,a=n.cue,s=t.currentTime();return n.selectable=!0,n.multiSelectable=!1,n.label=a.text,n.selected=a.startTime<=s&&s<a.endTime,(i=e.call(this,t,n)||this).track=r,i.cue=a,r.addEventListener("cuechange",pe(Ue(i),i.update)),i}xe(t,e);var n=t.prototype;return n.handleClick=function(t){e.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},n.update=function(e){var t=this.cue,n=this.player_.currentTime();this.selected(t.startTime<=n&&n<t.endTime)},t}(ia);Ie.registerComponent("ChaptersTrackMenuItem",oa);var ua=function(e){function t(t,n,i){return e.call(this,t,n,i)||this}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildCSSClass.call(this)},n.buildWrapperCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildWrapperCSSClass.call(this)},n.update=function(t){this.track_&&(!t||"addtrack"!==t.type&&"removetrack"!==t.type)||this.setTrack(this.findChaptersTrack()),e.prototype.update.call(this)},n.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 n=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);n&&n.addEventListener("load",this.updateHandler_)}}},n.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1;t>=0;t--){var n=e[t];if(n.kind===this.kind_)return n}},n.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Le(this.kind_))},n.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},n.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var n=0,i=t.length;n<i;n++){var r=t[n],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,n,i){var r;r=e.call(this,t,n,i)||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 n=t.prototype;return n.handleTracksChange=function(e){for(var t=this.player().textTracks(),n=!1,i=0,r=t.length;i<r;i++){var a=t[i];if(a.kind!==this.kind_&&"showing"===a.mode){n=!0;break}}n?this.disable():this.enable()},n.buildCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildCSSClass.call(this)},n.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,n,i){return e.call(this,t,n,i)||this}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildCSSClass.call(this)},n.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,n){var i;return n.track={player:t,kind:n.kind,label:n.kind+" settings",selectable:!1,default:!1,mode:"disabled"},n.selectable=!1,n.name="CaptionSettingsMenuItem",(i=e.call(this,t,n)||this).addClass("vjs-texttrack-settings"),i.controlText(", opens "+n.kind+" settings dialog"),i}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,n,i){return e.call(this,t,n,i)||this}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-captions-button "+e.prototype.buildCSSClass.call(this)},n.buildWrapperCSSClass=function(){return"vjs-captions-button "+e.prototype.buildWrapperCSSClass.call(this)},n.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new 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,n,i){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},n),i)},t}(ra);Ie.registerComponent("SubsCapsMenuItem",fa);var pa=function(e){function t(t,n){var i;return void 0===n&&(n={}),(i=e.call(this,t,n)||this).label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(i.player_.language_)>-1&&(i.label_="captions"),i.menuButton_.controlText(Le(i.label_)),i}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},n.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},n.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new 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,n){var i,r=n.track,a=t.audioTracks();n.label=r.label||r.language||"Unknown",n.selected=r.enabled,(i=e.call(this,t,n)||this).track=r,i.addClass("vjs-"+r.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];i.handleTracksChange.apply(Ue(i),t)};return a.addEventListener("change",s),i.on("dispose",function(){a.removeEventListener("change",s)}),i}xe(t,e);var n=t.prototype;return n.createEl=function(t,n,i){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},n),i)},n.handleClick=function(t){var n=this.player_.audioTracks();e.prototype.handleClick.call(this,t);for(var i=0;i<n.length;i++){var r=n[i];r.enabled=r===this.track}},n.handleTracksChange=function(e){this.selected(this.track.enabled)},t}(ia);Ie.registerComponent("AudioTrackMenuItem",ma);var ga=function(e){function t(t,n){return void 0===n&&(n={}),n.tracks=t.audioTracks(),e.call(this,t,n)||this}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-audio-button "+e.prototype.buildCSSClass.call(this)},n.buildWrapperCSSClass=function(){return"vjs-audio-button "+e.prototype.buildWrapperCSSClass.call(this)},n.createItems=function(e){void 0===e&&(e=[]),this.hideThreshold_=1;for(var t=this.player_.audioTracks(),n=0;n<t.length;n++){var i=t[n];e.push(new ma(this.player_,{track:i,selectable:!0,multiSelectable:!1}))}return e},t}(ta);ga.prototype.controlText_="Audio Track",Ie.registerComponent("AudioTrackButton",ga);var va=function(e){function t(t,n){var i,r=n.rate,a=parseFloat(r,10);return n.label=r,n.selected=1===a,n.selectable=!0,n.multiSelectable=!1,(i=e.call(this,t,n)||this).label=r,i.rate=a,i.on(t,"ratechange",i.update),i}xe(t,e);var n=t.prototype;return n.handleClick=function(t){e.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},n.update=function(e){this.selected(this.player().playbackRate()===this.rate)},t}(ia);va.prototype.contentElType="button",Ie.registerComponent("PlaybackRateMenuItem",va);var ya=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).updateVisibility(),i.updateLabel(),i.on(t,"loadstart",i.updateVisibility),i.on(t,"ratechange",i.updateLabel),i}xe(t,e);var n=t.prototype;return n.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},n.dispose=function(){this.labelEl_=null,e.prototype.dispose.call(this)},n.buildCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildCSSClass.call(this)},n.buildWrapperCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildWrapperCSSClass.call(this)},n.createMenu=function(){var e=new Zr(this.player()),t=this.playbackRates();if(t)for(var n=t.length-1;n>=0;n--)e.addChild(new va(this.player(),{rate:t[n]+"x"}));return e},n.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},n.handleClick=function(e){for(var t=this.player().playbackRate(),n=this.playbackRates(),i=n[0],r=0;r<n.length;r++)if(n[r]>t){i=n[r];break}this.player().playbackRate(i)},n.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},n.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},n.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},n.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.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 n=t.prototype;return n.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},n.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 n=t.prototype;return n.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},n.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,n){var i;return(i=e.call(this,t,n)||this).on(t,"error",i.open),i}xe(t,e);var n=t.prototype;return n.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},n.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(wt);Sa.prototype.options_=Oe(wt.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Ie.registerComponent("ErrorDisplay",Sa);var ka=["#000","Black"],Ea=["#00F","Blue"],Ca=["#0FF","Cyan"],wa=["#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,wa,Ea,La,Pa,Ca]},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,wa,Ea,La,Pa,Ca]},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 n(e,n){var i;return n.temporary=!1,(i=t.call(this,e,n)||this).updateDisplay=pe(Ue(i),i.updateDisplay),i.fill(),i.hasBeenOpened_=i.hasBeenFilled_=!0,i.endDialog=b("p",{className:"vjs-control-text",textContent:i.localize("End of dialog window.")}),i.el().appendChild(i.endDialog),i.setDefaults(),void 0===n.persistTextTrackSettings&&(i.options_.persistTextTrackSettings=i.options_.playerOptions.persistTextTrackSettings),i.on(i.$(".vjs-done-button"),"click",function(){i.saveSettings(),i.close()}),i.on(i.$(".vjs-default-button"),"click",function(){i.setDefaults(),i.updateDisplay()}),l(Da,function(e){i.on(i.$(e.selector),"change",i.updateDisplay)}),i.options_.persistTextTrackSettings&&i.restoreSettings(),i}xe(n,t);var i=n.prototype;return i.dispose=function(){this.endDialog=null,t.prototype.dispose.call(this)},i.createElSelect_=function(e,t,n){var i=this;void 0===t&&(t=""),void 0===n&&(n="label");var r=Da[e],a=r.id.replace("%s",this.id_),s=[t,a].join(" ").trim();return["<"+n+' id="'+a+'" class="'+("label"===n?"vjs-label":"")+'">',this.localize(r.label),"</"+n+">",'<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+'">',i.localize(e[1]),"</option>"].join("")})).concat("</select>").join("")},i.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("")},i.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("")},i.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("")},i.createElColors_=function(){return b("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.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("")})},i.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("")})},i.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},i.label=function(){return this.localize("Caption Settings Dialog")},i.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},i.buildCSSClass=function(){return t.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var e,t,n,i=this;return e=Da,t=function(e,t,n){var r,a,s=(r=i.$(t.selector),a=t.parser,Ma(r.options[r.options.selectedIndex].value,a));return void 0!==s&&(e[n]=s),e},void 0===(n={})&&(n=0),u(e).reduce(function(n,i){return t(n,e[i],i)},n)},i.setValues=function(e){var t=this;l(Da,function(n,i){!function(e,t,n){if(t)for(var i=0;i<e.options.length;i++)if(Ma(e.options[i].value,n)===t){e.selectedIndex=i;break}}(t.$(n.selector),e[i],n.parser)})},i.setDefaults=function(){var e=this;l(Da,function(t){var n=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=n})},i.restoreSettings=function(){var t;try{t=JSON.parse(e.localStorage.getItem("vjs-text-track-settings"))}catch(e){a.warn(e)}t&&this.setValues(t)},i.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)}}},i.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},i.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,n=e&&e.captionsButton;t?t.focus():n&&n.focus()},n}(wt);Ie.registerComponent("TextTrackSettings",Ua);var ja=function(t){function n(n,i){var r,a=i.ResizeObserver||e.ResizeObserver;null===i.ResizeObserver&&(a=!1);var s=Oe({createEl:!a,reportTouchActivity:!1},i);return(r=t.call(this,n,s)||this).ResizeObserver=i.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(n.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(n,t);var i=n.prototype;return i.createEl=function(){return t.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1},{"aria-hidden":"true"})},i.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},i.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)},n}(Ie);Ie.registerComponent("ResizeManager",ja);var Ba=function(e){function n(n,i){var r,a=Oe({createEl:!1},i);return(r=e.call(this,n,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(n,e);var i=n.prototype;return i.handleVisibilityChange=function(){this.player_.duration()===1/0&&(t.hidden?this.stopTracking():this.startTracking())},i.isBehind_=function(){if(!this.timeupdateSeen_)return!1;var e=this.liveCurrentTime(),t=this.player_.currentTime(),n=this.seekableIncrement_;return e!==1/0&&e-(2*n+.07)>=t},i.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"))}},i.handleDurationchange=function(){this.player_.duration()===1/0?this.startTracking():this.stopTracking()},i.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)))},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge)},i.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)},i.stopTracking=function(){this.isTracking()&&this.reset_()},i.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],n=e?e.length:0;n--;)t.push(e.end(n));return t.length?t.sort()[t.length-1]:1/0},i.seekableStart=function(){for(var e=this.player_.seekable(),t=[],n=e?e.length:0;n--;)t.push(e.start(n));return t.length?t.sort()[0]:0},i.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?1/0:e-this.seekableStart()},i.isLive=function(){return this.isTracking()},i.atLiveEdge=function(){return!this.behindLiveEdge()},i.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},i.pastSeekEnd=function(){return this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return"number"==typeof this.trackingInterval_},i.seekToLiveEdge=function(){this.atLiveEdge()||(this.player_.currentTime(this.liveCurrentTime()),this.player_.paused()&&this.player_.play())},i.dispose=function(){this.stopTracking(),e.prototype.dispose.call(this)},n}(Ie);Ie.registerComponent("LiveTracker",Ba);var Na=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var n=e.$$("source"),i=[],r="";if(!n.length)return!1;for(var a=0;a<n.length;a++){var s=n[a].src;s&&-1===i.indexOf(s)&&i.push(s)}return!!i.length&&(1===i.length&&(r=i[0]),e.triggerSourceset(r),!0)},Fa=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(n){var i=t.createElement(this.nodeName.toLowerCase());i.innerHTML=n;for(var r=t.createDocumentFragment();i.childNodes.length;)r.appendChild(i.childNodes[0]);return this.innerText="",e.Element.prototype.appendChild.call(this,r),this.innerHTML}}),Va=function(e,t){for(var n={},i=0;i<e.length&&!((n=Object.getOwnPropertyDescriptor(e[i],t))&&n.set&&n.get);i++);return n.enumerable=!0,n.configurable=!0,n},Ga=function(t){var n=t.el();if(!n.resetSourceWatch_){var i={},r=function(t){return Va([t.el(),e.HTMLMediaElement.prototype,e.Element.prototype,Fa],"innerHTML")}(t),a=function(e){return function(){for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];var s=e.apply(n,r);return Na(t),s}};["append","appendChild","insertAdjacentHTML"].forEach(function(e){n[e]&&(i[e]=n[e],n[e]=a(i[e]))}),Object.defineProperty(n,"innerHTML",Oe(r,{set:a(r.set)})),n.resetSourceWatch_=function(){n.resetSourceWatch_=null,Object.keys(i).forEach(function(e){n[e]=i[e]}),Object.defineProperty(n,"innerHTML",r)},t.one("sourceset",n.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 n=t.el();if(!n.resetSourceset_){var i=function(t){return Va([t.el(),e.HTMLMediaElement.prototype,Ha],"src")}(t),r=n.setAttribute,a=n.load;Object.defineProperty(n,"src",Oe(i,{set:function(e){var r=i.set.call(n,e);return t.triggerSourceset(n.src),r}})),n.setAttribute=function(e,i){var a=r.call(n,e,i);return/src/i.test(e)&&t.triggerSourceset(n.src),a},n.load=function(){var e=a.call(n);return Na(t)||(t.triggerSourceset(""),Ga(t)),e},n.currentSrc?t.triggerSourceset(n.currentSrc):Na(t)||Ga(t),n.resetSourceset_=function(){n.resetSourceset_=null,n.load=a,n.setAttribute=r,Object.defineProperty(n,"src",i),n.resetSourceWatch_&&n.resetSourceWatch_()}}}},qa=function(n){function i(e,t){var i;i=n.call(this,e,t)||this;var r=e.source,s=!1;if(r&&(i.el_.currentSrc!==r.src||e.tag&&3===e.tag.initNetworkState_)?i.setSource(r):i.handleLateInit_(i.el_),e.enableSourceset&&i.setupSourcesetHandling_(),i.el_.hasChildNodes()){for(var o=i.el_.childNodes,u=o.length,l=[];u--;){var c=o[u];"track"===c.nodeName.toLowerCase()&&(i.featuresNativeTextTracks?(i.remoteTextTrackEls().addTrackElement_(c),i.remoteTextTracks().addTrack(c.track),i.textTracks().addTrack(c.track),s||i.el_.hasAttribute("crossorigin")||!zt(c.src)||(s=!0)):l.push(c))}for(var d=0;d<l.length;d++)i.el_.removeChild(l[d])}return i.proxyNativeTracks_(),i.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."),i.restoreMetadataTracksInIOSNativePlayer_(),(it||Ge||$e)&&!0===e.nativeControlsForTouch&&i.setControls(!0),i.proxyWebkitFullscreen_(),i.triggerReady(),i}xe(i,n);var r=i.prototype;return r.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),i.disposeMediaElement(this.el_),this.options_=null,n.prototype.dispose.call(this)},r.setupSourcesetHandling_=function(){za(this)},r.restoreMetadataTracksInIOSNativePlayer_=function(){var e,t=this.textTracks(),n=function(){e=[];for(var n=0;n<t.length;n++){var i=t[n];"metadata"===i.kind&&e.push({track:i,storedMode:i.mode})}};n(),t.addEventListener("change",n),this.on("dispose",function(){return t.removeEventListener("change",n)});var i=function n(){for(var i=0;i<e.length;i++){var r=e[i];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}t.removeEventListener("change",n)};this.on("webkitbeginfullscreen",function(){t.removeEventListener("change",n),t.removeEventListener("change",i),t.addEventListener("change",i)}),this.on("webkitendfullscreen",function(){t.removeEventListener("change",n),t.addEventListener("change",n),t.removeEventListener("change",i)})},r.overrideNative_=function(e,t){var n=this;if(t===this["featuresNative"+e+"Tracks"]){var i=e.toLowerCase();this[i+"TracksListeners_"]&&Object.keys(this[i+"TracksListeners_"]).forEach(function(e){n.el()[i+"Tracks"].removeEventListener(e,n[i+"TracksListeners_"][e])}),this["featuresNative"+e+"Tracks"]=!t,this[i+"TracksListeners_"]=null,this.proxyNativeTracksForType_(i)}},r.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)},r.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)},r.proxyNativeTracksForType_=function(e){var t=this,n=Ei[e],i=this.el()[n.getterName],r=this[n.getterName]();if(this["featuresNative"+n.capitalName+"Tracks"]&&i&&i.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 n=!1,a=0;a<i.length;a++)if(i[a]===r[t]){n=!0;break}n||e.push(r[t])}for(;e.length;)r.removeTrack(e.shift())};this[n.getterName+"Listeners_"]=a,Object.keys(a).forEach(function(e){var n=a[e];i.addEventListener(e,n),t.on("dispose",function(t){return i.removeEventListener(e,n)})}),this.on("loadstart",s),this.on("dispose",function(e){return t.off("loadstart",s)})}},r.proxyNativeTracks_=function(){var e=this;Ei.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 n=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(n,e),i.disposeMediaElement(e),e=n}else{e=t.createElement("video");var r=Oe({},this.options_.tag&&A(this.options_.tag));it&&!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,n=function(){t=!0};this.on("loadstart",n);var i=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",i),void this.ready(function(){this.off("loadstart",n),this.off("loadedmetadata",i),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})},n=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0}))};this.on("webkitbeginfullscreen",n),this.on("dispose",function(){e.off("webkitbeginfullscreen",n),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(){i.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,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):n.prototype.addTextTrack.call(this,e,t,i)},r.createRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return n.prototype.createRemoteTextTrack.call(this,e);var i=t.createElement("track");return e.kind&&(i.kind=e.kind),e.label&&(i.label=e.label),(e.language||e.srclang)&&(i.srclang=e.language||e.srclang),e.default&&(i.default=e.default),e.id&&(i.id=e.id),e.src&&(i.src=e.src),i},r.addRemoteTextTrack=function(e,t){var i=n.prototype.addRemoteTextTrack.call(this,e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i},r.removeRemoteTextTrack=function(e){if(n.prototype.removeRemoteTextTrack.call(this,e),this.featuresNativeTextTracks)for(var t=this.$$("track"),i=t.length;i--;)e!==t[i]&&e!==t[i].track||this.el().removeChild(t[i])},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},i}(nr);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"),n=t.length;n--;)e.removeChild(t[n]);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]()}}),nr.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 n=Ht(e.src);return qa.nativeSourceHandler.canPlayType("video/"+n)}return""},qa.nativeSourceHandler.handleSource=function(e,t,n){t.setSrc(e.src)},qa.nativeSourceHandler.dispose=function(){},qa.registerSourceHandler(qa.nativeSourceHandler),nr.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(i){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=i.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(),we(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"),it&&o.addClass("vjs-touch-enabled"),ze||o.addClass("vjs-workinghover"),r.players[o.id_]=Ue(o);var f=n.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,i);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,wi.names.forEach(function(t){var n=wi[t],i=e[n.getterName]();i&&i.off&&i.off()}),i.prototype.dispose.call(this)},o.createEl=function(){var n,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?n=this.el_=r.parentNode:s||(n=this.el_=i.prototype.createEl.call(this,"div"));var o=A(r);if(s){for(n=this.el_=r,r=this.tag=t.createElement("video");n.children.length;)r.appendChild(n.firstChild);k(n,"video-js")||E(n,"video-js"),n.appendChild(r),a=this.playerElIngest_=n,Object.keys(n).forEach(function(e){r[e]=n[e]})}if(r.setAttribute("tabindex","-1"),o.tabindex="-1",(Ze||Je&&nt)&&(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||n.setAttribute(e,o[e]),s&&r.setAttribute(e,o[e])}),r.playerId=r.id,r.id+="_html5_api",r.className="vjs-tech",r.player=n.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(n,r),S(r,n),this.children_.unshift(r),this.el_.setAttribute("lang",this.language_),this.el_=n,n},o.width=function(e){return this.dimension("width",e)},o.height=function(e){return this.dimension("height",e)},o.dimension=function(e,t){var n=e+"_";if(void 0===t)return this[n]||0;if(""===t)return this[n]=void 0,void this.updateStyleEl_();var i=parseFloat(t);isNaN(i)?a.error('Improper value "'+t+'" supplied for for '+e):(this[n]=i,this.updateStyleEl_())},o.fluid=function(e){if(void 0===e)return!!this.fluid_;var t,n;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_)})?n():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(n))):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,n,i,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,n=void 0!==this.height_?this.height_:t*a,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),he(this.styleEl_,"\n ."+i+" {\n width: "+t+"px;\n height: "+n+"px;\n }\n\n ."+i+".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 n=this;this.tech_&&this.unloadTech_();var i=Le(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(nr.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,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};wi.names.forEach(function(e){var t=wi[e];a[t.getterName]=n[t.privateName]}),c(a,this.options_[i]),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=nr.getTech(e);if(!s)throw new Error("No Tech named '"+i+"' exists! '"+i+"' 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){n.on(n.tech_,e,n["handleTech"+Le(e)+"_"])}),Object.keys(Ya).forEach(function(e){n.on(n.tech_,e,function(t){0===n.tech_.playbackRate()&&n.tech_.seeking()?n.queuedCallbacks_.push({callback:n["handleTech"+Ya[e]+"_"].bind(n),event:t}):n["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"===i&&this.tag||S(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},o.unloadTech_=function(){var e=this;wi.names.forEach(function(t){var n=wi[t];e[n.privateName]=e[n.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 n,i=function(){var e=t.muted();t.muted(!0);var n=function(){t.muted(e)};t.playTerminatedQueue_.push(n);var i=t.play();if(yt(i))return i.catch(n)};if("any"===e&&!0!==this.muted()?yt(n=this.play())&&(n=n.catch(i)):n="muted"===e&&!0!==this.muted()?i():this.play(),yt(n))return n.then(function(){t.trigger({type:"autoplay-success",autoplay:e})}).catch(function(n){t.trigger({type:"autoplay-failure",autoplay:e})})}},o.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,n="";"string"!=typeof t&&(t=e.src,n=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!n&&(n=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var n=e.cache_.sources.filter(function(e){return e.src===t});if(n.length)return n[0].type;for(var i=e.$$("source"),r=0;r<i.length;r++){var a=i[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:n});for(var i=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&&!i.length?this.cache_.sources=r:i.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t},o.handleTechSourceset_=function(e){var t=this;if(!this.changingSrc_){var n=function(e){return t.updateSourceCaches_(e)},i=this.currentSource().src,r=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==i)&&(n=function(){}),n(r),e.src||this.tech_.any(["sourceset","loadstart"],function(e){if("sourceset"!==e.type){var n=t.techGet("currentSrc");t.lastSource_.tech=n,t.updateSourceCaches_(n)}})}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 n(){e.waitingTimer&&(clearTimeout(e.waitingTimer),e.waitingTimer=0),t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",n))})},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 n=this.el(),i=t[this.fsApi_.fullscreenElement]===n;!i&&n.matches?i=n.matches(":"+this.fsApi_.fullscreen):!i&&n.msMatchesSelector&&(i=n.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(i),!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,n,i){return t[n](e.reduce(dr(n),i))}(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,n){return e.reduceRight(dr(n),t[n]())}(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,n=this.options_.Promise||e.Promise;return n?new n(function(e){t.play_(e)}):this.play_()},o.play_=function(e){var t=this;void 0===e&&(e=_t),this.playCallbacks_.push(e);var n=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!n)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(n||!tt&&!ze||this.load());var i=this.techGet_("play");null===i?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(i)},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(),n=e.end(e.length-1);return n>t&&(n=t),n},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 n;this.isFullscreen(!0),this.fsApi_.requestFullscreen?(ee(t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.fsApi_.prefixed||(n=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(n=e)),_t(this.el_[this.fsApi_.requestFullscreen](n))):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,C(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 n=this.options_.userActions?this.options_.userActions.hotkeys:{},i=n.fullscreenKey,r=void 0===i?function(e){return Et.isEventKey(e,"f")}:i,a=n.muteKey,s=void 0===a?function(e){return Et.isEventKey(e,"m")}:a,o=n.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,n=0,i=this.options_.techOrder;n<i.length;n++){var r=i[n],s=nr.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,n=this,i=this.options_.techOrder.map(function(e){return[e,nr.getTech(e)]}).filter(function(e){var t=e[0],n=e[1];return n?n.isSupported():(a.error('The "'+t+'" tech is undefined. Skipped browser support check for that tech.'),!1)}),r=function(e,t,n){var i;return e.some(function(e){return t.some(function(t){if(i=n(e,t))return!0})}),i},s=function(e,t){var i=e[0];if(e[1].canPlaySource(t,n.options_[i.toLowerCase()]))return{source:t,tech:i}};return(this.options_.sourceOrder?r(e,i,(t=s,function(e,n){return t(n,e)})):r(i,e,s))||!1},o.src=function(e){var t=this;if(void 0===e)return this.cache_.src||"";var n=function e(t){if(Array.isArray(t)){var n=[];t.forEach(function(t){t=e(t),Array.isArray(t)?n=n.concat(t):d(t)&&n.push(t)}),t=n}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);n.length?(this.changingSrc_=!0,this.cache_.sources=n,this.updateSourceCaches_(n[0]),sr(this,n[0],function(e,i){var r,a;if(t.middleware_=i,t.cache_.sources=n,t.updateSourceCaches_(e),t.src_(e))return n.length>1?t.src(n.slice(1)):(t.changingSrc_=!1,t.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0),void t.triggerReady());r=i,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,n,i=this,r=this.selectSource([e]);return!r||(t=r.tech,n=this.techName_,Le(t)!==Le(n)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready(function(){i.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,n=this.options_.Promise||e.Promise;this.paused()||!n?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,n=e.remainingTimeDisplay;t&&t.updateContent(),n&&n.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,n,i=pe(this,this.reportUserActivity);this.on("mousedown",function(){i(),this.clearInterval(e),e=this.setInterval(i,250)}),this.on("mousemove",function(e){e.screenX===t&&e.screenY===n||(t=e.screenX,n=e.screenY,i())}),this.on("mouseup",function(t){i(),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",i),this.on("keyup",i),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,n){if(this.tech_)return this.tech_.addTextTrack(e,t,n)},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 n=0;n<t.length;n++){var i=t[n];(i=Oe(i)).player=void 0,e.tracks[n]=i}return e},o.createModal=function(e,t){var n=this;(t=t||{}).content=e||"";var i=new wt(this,t);return this.addChild(i),i.on("dispose",function(){n.removeChild(i)}),i.open(),i},o.updateCurrentBreakpoint_=function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),n=0;n<Ja.length;n++){var i=Ja[n];if(t<=this.breakpoints_[i]){if(e===i)return;e&&this.removeClass(Qa[e]),this.addClass(Qa[i]),this.breakpoint_=i;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 n=this;if(e&&"object"==typeof e){this.reset(),this.cache_.media=Oe(e);var i=this.cache_.media,r=i.artwork,a=i.poster,s=i.src,o=i.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 n.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:[]},n=A(e),i=n["data-setup"];if(k(e,"vjs-fill")&&(n.fill=!0),k(e,"vjs-fluid")&&(n.fluid=!0),null!==i){var r=vt(i||"{}"),s=r[0],o=r[1];s&&a.error(s),c(n,o)}if(c(t,n),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);wi.names.forEach(function(e){var t=wi[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:nr.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 ns={},is=function(e){return ns.hasOwnProperty(e)},rs=function(e){return is(e)?ns[e]:void 0},as=function(e,t){e.activePlugins_=e.activePlugins_||{},e.activePlugins_[t]=!0},ss=function(e,t,n){var i=(n?"before":"")+"pluginsetup";e.trigger(i,t),e.trigger(i+":"+t.name,t)},os=function(e,t){return t.prototype.name=e,function(){ss(this,{name:e,plugin:t,instance:null},!0);for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];var a=Me(t,[this].concat(i));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,we(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={}),ne(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,ns[e])},e.isBasic=function(t){var n="string"==typeof t?rs(t):t;return"function"==typeof n&&!e.prototype.isPrototypeOf(n.prototype)},e.registerPlugin=function(t,n){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+typeof t+".");if(is(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 n)throw new Error('Illegal plugin for "'+t+'", must be a function, was '+typeof n+".");return ns[t]=n,"plugin"!==t&&(e.isBasic(n)?es.prototype[t]=function(e,t){var n=function(){ss(this,{name:e,plugin:t,instance:null},!0);var n=t.apply(this,arguments);return as(this,e),ss(this,{name:e,plugin:t,instance:n}),n};return Object.keys(t).forEach(function(e){n[e]=t[e]}),n}(t,n):es.prototype[t]=os(t,n)),n},e.deregisterPlugin=function(e){if("plugin"===e)throw new Error("Cannot de-register base plugin.");is(e)&&(delete ns[e],delete es.prototype[e])},e.getPlugins=function(e){var t;return void 0===e&&(e=Object.keys(ns)),e.forEach(function(e){var n=rs(e);n&&((t=t||{})[e]=n)}),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!!is(e)};var ls=function(e){return 0===e.indexOf("#")?e.slice(1):e};function cs(e,t,n){var i=cs.getPlayer(e);if(i)return t&&a.warn('Player "'+e+'" is already initialised. Options will not be applied.'),n&&i.ready(n),i;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 n=e(r,Oe(t));d(n)&&!Array.isArray(n)?t=Oe(t,n):a.error("please return an object in beforesetup hooks")});var s=Ie.getComponent("Player");return i=new s(r,t,n),cs.hooks("setup").forEach(function(e){return e(i)}),i}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 n(){return cs.removeHook(e,n),t.apply(void 0,arguments)}}))},cs.removeHook=function(e,t){var n=cs.hooks(e).indexOf(t);return!(n<=-1)&&(cs.hooks_[e]=cs.hooks_[e].slice(),cs.hooks_[e].splice(n,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=n,cs.options=es.prototype.options_,cs.getPlayers=function(){return es.players},cs.getPlayer=function(e){var t,n=es.players;if("string"==typeof e){var i=ls(e),r=n[i];if(r)return r;t=H("#"+i)}else t=e;if(v(t)){var a=t,s=a.player,o=a.playerId;if(s||n[o])return s||n[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){nr.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=nr.getTech,cs.registerTech=nr.registerTech,cs.use=function(e,t){ir[e]=ir[e]||[],ir[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=it,cs.extend=function(e,t){void 0===t&&(t={});var n=function(){e.apply(this,arguments)},i={};for(var r in"object"==typeof t?(t.constructor!==Object.prototype.constructor&&(n=t.constructor),i=t):"function"==typeof t&&(n=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)}(n,e),i)i.hasOwnProperty(r)&&(n.prototype[r]=i[r]);return n},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 n;return e=(""+e).toLowerCase(),cs.options.languages=Oe(cs.options.languages,((n={})[e]=t,n)),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=ie,cs.off=te,cs.trigger=ne,cs.xhr=hi,cs.TextTrack=yi,cs.AudioTrack=_i,cs.VideoTrack=bi,["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 n,i,r,a,s;n=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,i=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.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 n.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=i.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=n.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(l)},parseURL:function(e){var t=n.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 n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}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 n=this.listeners[e].indexOf(t);return this.listeners[e].splice(n,1),n>-1},t.trigger=function(e){var t,n,i,r=this.listeners[e];if(r)if(2===arguments.length)for(n=r.length,t=0;t<n;++t)r[t].call(this,arguments[1]);else for(i=Array.prototype.slice.call(arguments,1),n=r.length,t=0;t<n;++t)r[t].apply(this,i)},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,n=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),i={},r=n.length;r--;)""!==n[r]&&((t=/([^=]*)=(.*)/.exec(n[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"),i[t[0]]=t[1]);return i},bs=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}ms(t,e);var n=t.prototype;return n.push=function(e){var t,n,i=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce(function(t,n){var i=n(e);return i===e?t:t.concat([i])},[e]).forEach(function(e){for(var r=0;r<i.customParsers.length;r++)if(i.customParsers[r].call(i,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))i.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return n={type:"tag",tagType:"inf"},t[1]&&(n.duration=parseFloat(t[1])),t[2]&&(n.title=t[2]),void i.trigger("data",n);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"targetduration"},t[1]&&(n.duration=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"totalduration"},t[1]&&(n.duration=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"version"},t[1]&&(n.version=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return n={type:"tag",tagType:"media-sequence"},t[1]&&(n.number=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return n={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(n.number=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return n={type:"tag",tagType:"playlist-type"},t[1]&&(n.playlistType=t[1]),void i.trigger("data",n);if(t=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"byterange"},t[1]&&(n.length=parseInt(t[1],10)),t[2]&&(n.offset=parseInt(t[2],10)),void i.trigger("data",n);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return n={type:"tag",tagType:"allow-cache"},t[1]&&(n.allowed=!/NO/.test(t[1])),void i.trigger("data",n);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(n={type:"tag",tagType:"map"},t[1]){var a=_s(t[1]);if(a.URI&&(n.uri=a.URI),a.BYTERANGE){var s=a.BYTERANGE.split("@"),o=s[0],u=s[1];n.byterange={},o&&(n.byterange.length=parseInt(o,10)),u&&(n.byterange.offset=parseInt(u,10))}}i.trigger("data",n)}else if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(n={type:"tag",tagType:"stream-inf"},t[1]){if(n.attributes=_s(t[1]),n.attributes.RESOLUTION){var l=n.attributes.RESOLUTION.split("x"),c={};l[0]&&(c.width=parseInt(l[0],10)),l[1]&&(c.height=parseInt(l[1],10)),n.attributes.RESOLUTION=c}n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes["PROGRAM-ID"]&&(n.attributes["PROGRAM-ID"]=parseInt(n.attributes["PROGRAM-ID"],10))}i.trigger("data",n)}else{if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return n={type:"tag",tagType:"media"},t[1]&&(n.attributes=_s(t[1])),void i.trigger("data",n);if(t=/^#EXT-X-ENDLIST/.exec(e))i.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))i.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return n={type:"tag",tagType:"program-date-time"},t[1]&&(n.dateTimeString=t[1],n.dateTimeObject=new Date(t[1])),void i.trigger("data",n);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return n={type:"tag",tagType:"key"},t[1]&&(n.attributes=_s(t[1]),n.attributes.IV&&("0x"===n.attributes.IV.substring(0,2).toLowerCase()&&(n.attributes.IV=n.attributes.IV.substring(2)),n.attributes.IV=n.attributes.IV.match(/.{8}/g),n.attributes.IV[0]=parseInt(n.attributes.IV[0],16),n.attributes.IV[1]=parseInt(n.attributes.IV[1],16),n.attributes.IV[2]=parseInt(n.attributes.IV[2],16),n.attributes.IV[3]=parseInt(n.attributes.IV[3],16),n.attributes.IV=new Uint32Array(n.attributes.IV))),void i.trigger("data",n);if(t=/^#EXT-X-START:?(.*)$/.exec(e))return n={type:"tag",tagType:"start"},t[1]&&(n.attributes=_s(t[1]),n.attributes["TIME-OFFSET"]=parseFloat(n.attributes["TIME-OFFSET"]),n.attributes.PRECISE=/YES/.test(n.attributes.PRECISE)),void i.trigger("data",n);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-out-cont"},t[1]?n.data=t[1]:n.data="",void i.trigger("data",n);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-out"},t[1]?n.data=t[1]:n.data="",void i.trigger("data",n);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-in"},t[1]?n.data=t[1]:n.data="",void i.trigger("data",n);i.trigger("data",{type:"tag",data:e.slice(4)})}}}else i.trigger("data",{type:"comment",text:e.slice(1)})}):this.trigger("data",{type:"uri",uri:e}))},n.addParser=function(e){var t=this,n=e.expression,i=e.customType,r=e.dataParser,a=e.segment;"function"!=typeof r&&(r=function(e){return e}),this.customParsers.push(function(e){if(n.exec(e))return t.trigger("data",{type:"custom",data:r(e),customType:i,segment:a}),!0})},n.addTagMapper=function(e){var t=e.expression,n=e.map;this.tagMappers.push(function(e){return t.test(e)?n(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 n,i,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"}),i={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(i.iv=e.attributes.IV)):this.trigger("warn",{message:"ignoring key declaration without URI"}):i=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(){n={},e.uri&&(n.uri=e.uri),e.byterange&&(n.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 n=this.manifest.mediaGroups[e.attributes.TYPE];n[e.attributes["GROUP-ID"]]=n[e.attributes["GROUP-ID"]]||{},t=n[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),i&&(s.key=i),s.timeline=u,n&&(s.map=n),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 n=t.prototype;return n.push=function(e){this.lineStream.push(e)},n.end=function(){this.lineStream.push("\n")},n.addParser=function(e){this.parseStream.addParser(e)},n.addTagMapper=function(e){this.parseStream.addTagMapper(e)},t}(vs),Ss=function(e){return!!e&&"object"==typeof e},ks=function e(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return n.reduce(function(t,n){return Object.keys(n).forEach(function(i){Array.isArray(t[i])&&Array.isArray(n[i])?t[i]=t[i].concat(n[i]):Ss(t[i])&&Ss(n[i])?t[i]=e(t[i],n[i]):t[i]=n[i]}),t},{})},Es=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},Cs=function(e){if(!e.length)return[];for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t},ws="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 n,i,r,a,s;n=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,i=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.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 n.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=i.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=n.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(l)},parseURL:function(e){var t=n.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,n){return/^[a-z]+:/i.test(n)?n:(/\/\//i.test(t)||(t=xs.buildAbsoluteURL(e.location.href,t)),xs.buildAbsoluteURL(t,n))},Ms=function(e){var t=e.baseUrl,n=void 0===t?"":t,i=e.source,r=void 0===i?"":i,a=e.range,s=void 0===a?"":a,o=e.indexRange,u=void 0===o?"":o,l={uri:r,resolvedUri:Ds(n||"",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,n=e.timescale,i=void 0===n?1:n,r=e.sourceDuration;return{start:0,end:Math.ceil(r/(t/i))}},dynamic:function(e){var t=e.NOW,n=e.clientOffset,i=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+n)/1e3,p=i+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,n=void 0===t?"static":t,i=e.duration,r=e.timescale,a=void 0===r?1:r,s=e.sourceDuration,o=Us[n](e),u=function(e,t){for(var n=[],i=e;i<t;i++)n.push(i);return n}(o.start,o.end).map(function(e){return function(t,n){var i=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:i/a,timeline:s,time:n*i}}}(e));if("static"===n){var l=u.length-1;u[l].duration=s-i/a*l}return u},Bs=function(e){var t=e.baseUrl,n=e.initialization,i=void 0===n?{}:n,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:i.sourceURL,range:i.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,n){for(var i=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:n,timescale:u,timeline:a,periodIndex:a,duration:m,sourceDuration:r,indexRange:d+"-"+(d+p-1)})[0];i&&(g.map=i),c.push(g),d+=p}return e.segments=c,e},Fs=function(e){var t;return(t=e.reduce(function(e,t){var n,i=t.attributes.id+(t.attributes.lang||"");e[i]?(t.segments[0]&&(t.segments[0].discontinuity=!0),(n=e[i].segments).push.apply(n,t.segments),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):e[i]=t;return e},{}),Object.keys(t).map(function(e){return t[e]})).map(function(e){var t,n;return e.discontinuityStarts=(t=e.segments,n="discontinuity",t.reduce(function(e,t,i){return t[n]&&e.push(i),e},[])),e})},Vs=function(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var n in e){var i=e[n];if(i.sidx){var r=i.sidx.uri+"-"+(s=i.sidx.byterange,void 0,o=s.offset+s.length-1,s.offset+"-"+o),a=t[r]&&t[r].sidx;i.sidx&&a&&Ns(i,a,i.sidx.resolvedUri)}}var s,o;return e},Gs=function(e){var t,n=e.attributes,i=e.segments,r=e.sidx,a={attributes:(t={NAME:n.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:n.width,height:n.height},CODECS:n.codecs,BANDWIDTH:n.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(n.type||"static"),timeline:n.periodIndex,resolvedUri:"",targetDuration:n.duration,segments:i,mediaSequence:i.length?i[0].number:1};return n.contentProtection&&(a.contentProtection=n.contentProtection),r&&(a.sidx=r),a},Hs=function(e,t){var n;if(void 0===t&&(t={}),!e.length)return{};var i=e[0].attributes,r=i.sourceDuration,a=i.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:(n={AUDIO:{},VIDEO:{}},n["CLOSED-CAPTIONS"]={},n.SUBTITLES={},n),uri:"",duration:r,playlists:Vs(o,t),minimumUpdatePeriod:1e3*s};return u.length&&(c.mediaGroups.AUDIO.audio=function(e,t){var n;void 0===t&&(t={});var i=e.reduce(function(e,i){var r=i.attributes.role&&i.attributes.role.value||"",a=i.attributes.lang||"",s="main";if(a){var o=r?" ("+r+")":"";s=""+i.attributes.lang+o}return e[s]&&e[s].playlists[0].attributes.BANDWIDTH>i.attributes.bandwidth?e:(e[s]={language:a,autoselect:!0,default:"main"===r,playlists:Vs([function(e){var t,n=e.attributes,i=e.segments,r=e.sidx,a={attributes:(t={NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(n.type||"static"),timeline:n.periodIndex,resolvedUri:"",targetDuration:n.duration,segments:i,mediaSequence:i.length?i[0].number:1};return n.contentProtection&&(a.contentProtection=n.contentProtection),r&&(a.sidx=r),a}(i)],t),uri:""},void 0===n&&"main"===r&&((n=i).default=!0),e)},{});n||(i[Object.keys(i)[0]].default=!0);return i}(u,t)),l.length&&(c.mediaGroups.SUBTITLES.subs=function(e,t){return void 0===t&&(t={}),e.reduce(function(e,n){var i,r,a,s,o=n.attributes.lang||"text";return e[o]?e:(e[o]={language:o,default:!1,autoselect:!1,playlists:Vs([(i=n,a=i.attributes,s=i.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,n){var i=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=(i+r)/1e3+(void 0===c?0:c)-(a+l);return Math.ceil((d*o-t)/n)},qs=function(e,t){for(var n=e.type,i=void 0===n?"static":n,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"===i&&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,n,i,r){if("$$"===t)return"$";if(void 0===e[n])return t;var a=""+e[n];return"RepresentationID"===n?a:(r=i?parseInt(r,10):1,a.length>=r?a:""+new Array(r-a.length+1).join("0")+a)}}(t))},$s=function(e,t){var n={RepresentationID:e.id,Bandwidth:e.bandwidth||0},i=e.initialization,r=void 0===i?{sourceURL:"",range:""}:i,a=Ms({baseUrl:e.baseUrl,source:Ks(r.sourceURL,n),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){n.Number=t.number,n.Time=t.time;var i=Ks(e.media||"",n);return{uri:i,timeline:t.timeline,duration:t.duration,resolvedUri:Ds(e.baseUrl||"",i),map:a,number:t.number}})},Xs=function(e,t){var n=e.duration,i=e.segmentUrls,r=void 0===i?[]:i;if(!n&&!t||n&&t)throw new Error(Ls);var a,s=r.map(function(t){return function(e,t){var n=e.baseUrl,i=e.initialization,r=void 0===i?{}:i,a=Ms({baseUrl:n,source:r.sourceURL,range:r.range}),s=Ms({baseUrl:n,source:t.media,range:t.mediaRange});return s.map=a,s}(e,t)});return n&&(a=js(e)),t&&(a=qs(e,t)),a.map(function(e,t){if(s[t]){var n=s[t];return n.timeline=e.timeline,n.duration=e.duration,n.number=e.number,n}}).filter(function(e){return e})},Ys=function(e){var t,n,i=e.attributes,r=e.segmentInfo;r.template?(n=$s,t=ks(i,r.template)):r.base?(n=Bs,t=ks(i,r.base)):r.list&&(n=Xs,t=ks(i,r.list));var a={attributes:i};if(!n)return a;var s=n(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 Cs(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 n=t.slice(1),i=n[0],r=n[1],a=n[2],s=n[3],o=n[4],u=n[5];return 31536e3*parseFloat(i||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?Cs(e.attributes).reduce(function(e,t){var n=eo[t.name]||eo.DEFAULT;return e[t.name]=n(t.value),e},{}):{}};var no,io,ro,ao,so,oo,uo,lo,co,ho,fo,po,mo,go,vo,yo,_o,bo,To,So,ko,Eo,Co,wo,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],n=Js(e,"SegmentList")[0],i=n&&Js(n,"SegmentURL").map(function(e){return ks({tag:"SegmentURL"},to(e))}),r=Js(e,"SegmentBase")[0],a=n||t,s=a&&Js(a,"SegmentTimeline")[0],o=n||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:n&&ks(to(n),{segmentUrls:i,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,n){var i=to(n),r=Ko[i.schemeIdUri];if(r){t[r]={attributes:i};var a=Js(n,"cenc:pssh")[0];if(a){var s=Qs(a),o=s&&function(t){for(var n=e.atob(t),i=new Uint8Array(n.length),r=0;r<n.length;r++)i[r]=n.charCodeAt(r);return i}(s);t[r].pssh=o}}return t},{})},Jo=function(e,t,n){return function(i){var r=to(i),a=$o(t,Js(i,"BaseURL")),s=Js(i,"Role")[0],o={role:to(s)},u=ks(e,r,o),l=Yo(Js(i,"ContentProtection"));Object.keys(l).length&&(u=ks(u,{contentProtection:l}));var c=Xo(i),d=Js(i,"Representation"),h=ks(n,c);return Es(d.map(function(e,t,n){return function(i){var r=Js(i,"BaseURL"),a=$o(t,r),s=ks(e,to(i)),o=Xo(i);return a.map(function(e){return{segmentInfo:ks(n,o),attributes:ks(s,{baseUrl:e})}})}}(u,a,h)))}},Qo=function(t,n){void 0===n&&(n={});var i=n,r=i.manifestUri,a=void 0===r?"":r,s=i.NOW,o=void 0===s?Date.now():s,u=i.clientOffset,l=void 0===u?0:u,c=Js(t,"Period");if(!c.length)throw new Error(ws);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,n){return function(i,r){var a=$o(n,Js(i,"BaseURL")),s=to(i),o=parseInt(s.id,10),u=e.isNaN(o)?r:o,l=ks(t,{periodIndex:u}),c=Js(i,"AdaptationSet"),d=Xo(i);return Es(c.map(Jo(l,a,d)))}}(d,h)))},Zo=function(t){if(""===t)throw new Error(Ps);var n=(new e.DOMParser).parseFromString(t,"application/xml"),i=n&&"MPD"===n.documentElement.tagName?n.documentElement:null;if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(As);return i},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 n=to(t);switch(n.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":n.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":n.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":n.method="DIRECT",n.value=Date.parse(n.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 n}(Zo(e))},nu=function(e){return e>>>0},iu={findBox:no=function(e,t){var n,i,r,a,s,o=[];if(!t.length)return null;for(n=0;n<e.byteLength;)i=nu(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]),r=io(e.subarray(n+4,n+8)),a=i>1?n+i:e.byteLength,r===t[0]&&(1===t.length?o.push(e.subarray(n+8,a)):(s=no(e.subarray(n+8,a),t.slice(1))).length&&(o=o.concat(s))),n=a;return o},parseType:io=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 no(e,["moov","trak"]).reduce(function(e,t){var n,i,r,a,s;return(n=no(t,["tkhd"])[0])?(i=n[0],a=nu(n[r=0===i?12:20]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3]),(s=no(t,["mdia","mdhd"])[0])?(r=0===(i=s[0])?12:20,e[a]=nu(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3]),e):null):null},{})},startTime:function(e,t){var n,i,r;return n=no(t,["moof","traf"]),i=[].concat.apply([],n.map(function(t){return no(t,["tfhd"]).map(function(n){var i,r;return i=nu(n[4]<<24|n[5]<<16|n[6]<<8|n[7]),r=e[i]||9e4,(no(t,["tfdt"]).map(function(e){var t,n;return t=e[0],n=nu(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(n*=Math.pow(2,32),n+=nu(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),n})[0]||1/0)/r})})),r=Math.min.apply(null,i),isFinite(r)?r:0},videoTrackIds:function(e){var t=[];return no(e,["moov","trak"]).forEach(function(e){var n=no(e,["mdia","hdlr"]),i=no(e,["tkhd"]);n.forEach(function(e,n){var r,a,s=io(e.subarray(8,12)),o=i[n];"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=iu.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,n,i,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(i=6,r=0;r<o;r++)n=a.getUint16(i),i+=2,s.sps.push(new Uint8Array(e.subarray(i,i+n))),i+=n;for(t=e[i],i++,r=0;r<t;r++)n=a.getUint16(i),i+=2,s.pps.push(new Uint8Array(e.subarray(i,i+n))),i+=n;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),n={majorBrand:ru(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},i=8;i<e.byteLength;)n.compatibleBrands.push(ru(e.subarray(i,i+4))),i+=4;return n},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:""},n=8;for(n=24;n<e.byteLength;n++){if(0===e[n]){n++;break}t.name+=String.fromCharCode(e[n])}return t.name=decodeURIComponent(escape(t.name)),t},mdat:function(e){return{byteLength:e.byteLength,nals:function(e){var t,n,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[];for(t=0;t+4<e.length;t+=n)if(n=i.getUint32(t),t+=4,n<=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,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,r={version:n.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};return 1===r.version?(i+=4,r.creationTime=au(n.getUint32(i)),i+=8,r.modificationTime=au(n.getUint32(i)),i+=4,r.timescale=n.getUint32(i),i+=8,r.duration=n.getUint32(i)):(r.creationTime=au(n.getUint32(i)),i+=4,r.modificationTime=au(n.getUint32(i)),i+=4,r.timescale=n.getUint32(i),i+=4,r.duration=n.getUint32(i)),i+=4,t=n.getUint16(i),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),n={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(n.streamDescriptor=ro(e.subarray(28))[0]),n},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),n=4,i={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===i.version?(n+=4,i.creationTime=au(t.getUint32(n)),n+=8,i.modificationTime=au(t.getUint32(n)),n+=4,i.timescale=t.getUint32(n),n+=8,i.duration=t.getUint32(n)):(i.creationTime=au(t.getUint32(n)),n+=4,i.modificationTime=au(t.getUint32(n)),n+=4,i.timescale=t.getUint32(n),n+=4,i.duration=t.getUint32(n)),n+=4,i.rate=t.getUint16(n)+t.getUint16(n+2)/16,n+=4,i.volume=t.getUint8(n)+t.getUint8(n+1)/8,n+=2,n+=2,n+=8,i.matrix=new Uint32Array(e.subarray(n,n+36)),n+=36,n+=24,i.nextTrackId=t.getUint32(n),i},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,n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t<e.byteLength;t++)n.samples.push({dependsOn:(48&e[t])>>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return n},sidx:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:n.getUint32(4),timescale:n.getUint32(8),earliestPresentationTime:n.getUint32(12),firstOffset:n.getUint32(16)},r=n.getUint16(22);for(t=24;r;t+=12,r--)i.references.push({referenceType:(128&e[t])>>>7,referencedSize:2147483647&n.getUint32(t),subsegmentDuration:n.getUint32(t+4),startsWithSap:!!(128&e[t+8]),sapType:(112&e[t+8])>>>4,sapDeltaTime:268435455&n.getUint32(t+8)});return i},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,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},r=n.getUint32(4);for(t=8;r;t+=4,r--)i.chunkOffsets.push(n.getUint32(t));return i},stsc:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=n.getUint32(4),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;i;t+=12,i--)r.sampleToChunks.push({firstChunk:n.getUint32(t),samplesPerChunk:n.getUint32(t+4),sampleDescriptionIndex:n.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,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:n.getUint32(4),entries:[]};for(t=12;t<e.byteLength;t+=4)i.entries.push(n.getUint32(t));return i},stts:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},r=n.getUint32(4);for(t=8;r;t+=8,r--)i.timeToSamples.push({sampleCount:n.getUint32(t),sampleDelta:n.getUint32(t+4)});return i},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,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:n.getUint32(4)},r=1&i.flags[2],a=2&i.flags[2],s=8&i.flags[2],o=16&i.flags[2],u=32&i.flags[2],l=65536&i.flags[0],c=131072&i.flags[0];return t=8,r&&(t+=4,i.baseDataOffset=n.getUint32(12),t+=4),a&&(i.sampleDescriptionIndex=n.getUint32(t),t+=4),s&&(i.defaultSampleDuration=n.getUint32(t),t+=4),o&&(i.defaultSampleSize=n.getUint32(t),t+=4),u&&(i.defaultSampleFlags=n.getUint32(t)),l&&(i.durationIsEmpty=!0),!r&&c&&(i.baseDataOffsetIsMoof=!0),i},tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=4,i={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===i.version?(n+=4,i.creationTime=au(t.getUint32(n)),n+=8,i.modificationTime=au(t.getUint32(n)),n+=4,i.trackId=t.getUint32(n),n+=4,n+=8,i.duration=t.getUint32(n)):(i.creationTime=au(t.getUint32(n)),n+=4,i.modificationTime=au(t.getUint32(n)),n+=4,i.trackId=t.getUint32(n),n+=4,n+=4,i.duration=t.getUint32(n)),n+=4,n+=8,i.layer=t.getUint16(n),n+=2,i.alternateGroup=t.getUint16(n),n+=2,i.volume=t.getUint8(n)+t.getUint8(n+1)/8,n+=2,n+=2,i.matrix=new Uint32Array(e.subarray(n,n+36)),n+=36,i.width=t.getUint16(n)+t.getUint16(n+2)/16,n+=4,i.height=t.getUint16(n)+t.getUint16(n+2)/16,i},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,n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&n.flags[2],a=4&n.flags[2],s=1&n.flags[1],o=2&n.flags[1],u=4&n.flags[1],l=8&n.flags[1],c=i.getUint32(4),d=8;for(r&&(n.dataOffset=i.getInt32(d),d+=4),a&&c&&(t={flags:su(e.subarray(d,d+4))},d+=4,s&&(t.duration=i.getUint32(d),d+=4),o&&(t.size=i.getUint32(d),d+=4),l&&(t.compositionTimeOffset=i.getUint32(d),d+=4),n.samples.push(t),c--);c--;)t={},s&&(t.duration=i.getUint32(d),d+=4),o&&(t.size=i.getUint32(d),d+=4),u&&(t.flags=su(e.subarray(d,d+4)),d+=4),l&&(t.compositionTimeOffset=i.getUint32(d),d+=4),n.samples.push(t);return n},"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,n,i,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;)n=t.getUint32(s),i=ru(e.subarray(s+4,s+8)),r=n>1?s+n:e.byteLength,(a=(ou[i]||function(e){return{data:e}})(e.subarray(s+8,r))).size=n,a.type=i,o.push(a),s=r;return o},textify:ao=function(e,t){var n;return t=t||0,n=new Array(2*t+1).join(" "),e.map(function(e,i){return n+e.type+"\n"+Object.keys(e).filter(function(e){return"type"!==e&&"boxes"!==e}).map(function(t){var i=n+" "+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?i+"<"+a.join("").slice(1)+">":i+"<\n"+a.map(function(e){return n+" "+e}).join("\n")+"\n"+n+" >":i+"<>"}return i+JSON.stringify(r,null,2).split("\n").map(function(e,t){return 0===t?e:n+" "+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,n,i=[],r=0;for(t=1;t<arguments.length;t++)i.push(arguments[t]);for(t=i.length;t--;)r+=i[t].byteLength;for(n=new Uint8Array(r+8),new DataView(n.buffer,n.byteOffset,n.byteLength).setUint32(0,n.byteLength),n.set(e,4),t=0,r=8;t<i.length;t++)n.set(i[t],r),r+=i[t].byteLength;return n},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 n=[],i=t.length;i--;)n[i]=Co(t[i]);return so.apply(null,[Ao.moof,co(e)].concat(n))},po=function(e){for(var t=e.length,n=[];t--;)n[t]=vo(e[t]);return so.apply(null,[Ao.moov,go(4294967295)].concat(n).concat(mo(e)))},mo=function(e){for(var t=e.length,n=[];t--;)n[t]=wo(e[t]);return so.apply(null,[Ao.mvex].concat(n))},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,n,i=e.samples||[],r=new Uint8Array(4+i.length);for(n=0;n<i.length;n++)t=i[n].flags,r[n+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,n=e.sps||[],i=e.pps||[],r=[],a=[];for(t=0;t<n.length;t++)r.push((65280&n[t].byteLength)>>>8),r.push(255&n[t].byteLength),r=r.concat(Array.prototype.slice.call(n[t]));for(t=0;t<i.length;t++)a.push((65280&i[t].byteLength)>>>8),a.push(255&i[t].byteLength),a=a.concat(Array.prototype.slice.call(i[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([n.length]).concat(r).concat([i.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)},Co=function(e){var t,n,i,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)),n=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?(i=Po(e,92),so(Ao.traf,t,n,i)):(r=So(e),i=Po(e,r.length+92),so(Ao.traf,t,n,i,r))},vo=function(e){return e.duration=e.duration||4294967295,so(Ao.trak,yo(e),_o(e))},wo=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 n=0,i=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(n=1),void 0!==e[0].size&&(i=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,n|i|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 n,i,r,a;for(t+=20+16*(i=e.samples||[]).length,n=Wo(i,t),a=0;a<i.length;a++)r=i[a],n=n.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(n))},zo=function(e,t){var n,i,r,a;for(t+=20+8*(i=e.samples||[]).length,n=Wo(i,t),a=0;a<i.length;a++)r=i[a],n=n.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(n))},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,n=lo(),i=po(e);return(t=new Uint8Array(n.byteLength+i.byteLength)).set(n),t.set(i,n.byteLength),t}},du=function(){this.init=function(){var e={};this.on=function(t,n){e[t]||(e[t]=[]),e[t]=e[t].concat(n)},this.off=function(t,n){var i;return!!e[t]&&(i=e[t].indexOf(n),e[t]=e[t].slice(),e[t].splice(i,1),i>-1)},this.trigger=function(t){var n,i,r,a;if(n=e[t])if(2===arguments.length)for(r=n.length,i=0;i<r;++i)n[i].call(this,arguments[1]);else{for(a=[],i=arguments.length,i=1;i<arguments.length;++i)a.push(arguments[i]);for(r=n.length,i=0;i<r;++i)n[i].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 n={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return n.dataOffset=t,n.compositionTimeOffset=e.pts-e.dts,n.duration=e.duration,n.size=4*e.length,n.size+=e.byteLength,e.keyFrame&&(n.flags.dependsOn=2,n.flags.isNonSyncSample=0),n},_u=function(e){var t,n,i=[],r=[];for(i.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(n=e[t]).nalUnitType?(i.length&&(i.duration=n.dts-i.dts,r.push(i)),(i=[n]).byteLength=n.data.byteLength,i.pts=n.pts,i.dts=n.dts):("slice_layer_without_partitioning_rbsp_idr"===n.nalUnitType&&(i.keyFrame=!0),i.duration=n.dts-i.dts,i.byteLength+=n.data.byteLength,i.push(n));return r.length&&(!i.duration||i.duration<=0)&&(i.duration=r[r.length-1].duration),r.push(i),r},bu=function(e){var t,n,i=[],r=[];for(i.byteLength=0,i.nalCount=0,i.duration=0,i.pts=e[0].pts,i.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++)(n=e[t]).keyFrame?(i.length&&(r.push(i),r.byteLength+=i.byteLength,r.nalCount+=i.nalCount,r.duration+=i.duration),(i=[n]).nalCount=n.length,i.byteLength=n.byteLength,i.pts=n.pts,i.dts=n.dts,i.duration=n.duration):(i.duration+=n.duration,i.nalCount+=n.length,i.byteLength+=n.byteLength,i.push(n));return r.length&&i.duration<=0&&(i.duration=r[r.length-1].duration),r.byteLength+=i.byteLength,r.nalCount+=i.nalCount,r.duration+=i.duration,r.push(i),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 n,i,r,a,s,o=t||0,u=[];for(n=0;n<e.length;n++)for(a=e[n],i=0;i<a.length;i++)s=a[i],o+=(r=yu(s,o)).size,u.push(r);return u},ku=function(e){var t,n,i,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],n=0;n<r.length;n++)for(a=r[n],i=0;i<a.length;i++)s=a[i],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],Cu=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],wu=function(e){for(var t=[];e--;)t.push(0);return t},Pu={96000:[Eu,[227,64],wu(154),[56]],88200:[Eu,[231],wu(170),[56]],64000:[Eu,[248,192],wu(240),[56]],48000:[Eu,[255,192],wu(268),[55,148,128],wu(54),[112]],44100:[Eu,[255,192],wu(268),[55,163,128],wu(84),[112]],32000:[Eu,[255,192],wu(268),[55,234],wu(226),[112]],24000:[Eu,[255,192],wu(268),[55,255,128],wu(268),[111,112],wu(126),[224]],16000:[Eu,[255,192],wu(268),[55,255,128],wu(268),[111,255],wu(269),[223,108],wu(195),[1,192]],12000:[Cu,wu(268),[3,127,248],wu(268),[6,255,240],wu(268),[13,255,224],wu(268),[27,253,128],wu(259),[56]],11025:[Cu,wu(268),[3,127,248],wu(268),[6,255,240],wu(268),[13,255,224],wu(268),[27,255,192],wu(268),[55,175,128],wu(108),[112]],8000:[Cu,wu(268),[3,121,16],wu(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,n,i){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)),n&&i&&(u=r-Math.max(n,i),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,n){return t.minSegmentDts>=n?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=n&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},xu=function(e){var t,n,i=[];for(t=0;t<e.length;t++)n=e[t],i.push({size:n.data.byteLength,duration:1024});return i},Du=function(e){var t,n,i=0,r=new Uint8Array(function(e){var t,n=0;for(t=0;t<e.length;t++)n+=e[t].data.byteLength;return n}(e));for(t=0;t<e.length;t++)n=e[t],r.set(n.data,i),i+=n.data.byteLength;return r},Mu=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},Uu=function(e,t){var n,i=e.minSegmentDts;return t||(i-=e.timelineStartInfo.dts),n=e.timelineStartInfo.baseMediaDecodeTime,n+=i,n=Math.max(0,n),"audio"===e.type&&(n*=e.samplerate/9e4,n=Math.floor(n)),n},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,n={payloadType:-1,payloadSize:0},i=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)i+=255,t++;for(i+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!n.payload&&4===i){n.payloadType=i,n.payloadSize=r,n.payload=e.subarray(t,t+r);break}t+=r,i=0,r=0}return n},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 n,i,r,a,s=[];if(!(64&t[0]))return s;for(i=31&t[0],n=0;n<i;n++)a={type:3&t[2+(r=3*n)],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,n,i=e.byteLength,r=[],a=1;a<i-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=i-r.length,n=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),n[a]=e[s];return n},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,n,i;if("sei_rbsp"===e.nalUnitType&&(t=Bu(e.escapedRBSP)).payloadType===Gu&&(n=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));i=Fu(e.pts,n),this.captionPackets_=this.captionPackets_.concat(i),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,n){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=n||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,n,i,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),i=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),n=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=n,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(i,r))a=qu((i=(3&i)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(i,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((i=(3&i)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(i,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(i,r))this.column_+=3&r;else if(this.isPAC(i,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(i)&&(0===r&&(r=null),a=qu(i),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 n=0;n<this.rollUpRows_;n++)this.displayed_[t-n]=this.displayed_[this.row_-n],this.displayed_[this.row_-n]="";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 n=t.reduce(function(e,t){return e+"<"+t+">"},"");this[this.mode_](e,n)},$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 n=this.nonDisplayed_[this.row_];n+=t,this.nonDisplayed_[this.row_]=n},$u.prototype.rollUp=function(e,t){var n=this.displayed_[this.row_];n+=t,this.displayed_[this.row_]=n},$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 n=this.displayed_[this.row_];n+=t,this.displayed_[this.row_]=n};var Xu={CaptionStream:Hu,Cea608Stream:$u},Yu={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ju=function(e,t){var n=1;for(e>t&&(n=-1);Math.abs(t-e)>4294967296;)e+=8589934592*n;return e},Qu=function e(t){var n,i;e.prototype.init.call(this),this.type_=t,this.push=function(e){e.type===this.type_&&(void 0===i&&(i=e.dts),e.dts=Ju(e.dts,i),e.pts=Ju(e.pts,i),n=e.dts,this.trigger("data",e))},this.flush=function(){i=n,this.trigger("done")},this.discontinuity=function(){i=void 0,n=void 0}};Qu.prototype=new vu;var Zu,el=Qu,tl=Ju,nl=function(e,t,n){var i,r="";for(i=t;i<n;i++)r+="%"+("00"+e[i].toString(16)).slice(-2);return r},il=function(e,t,n){return decodeURIComponent(nl(e,t,n))},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=il(e.data,1,t),e.value=il(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=il(e.data,1,t),e.url=il(e.data,t+1,e.data.length);break}},PRIV:function(e){var t,n;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(n=e.data,unescape(nl(n,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Zu=function(e){var t,n={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},i=0,r=[],a=0;if(Zu.prototype.init.call(this),this.dispatchType=Yu.METADATA_STREAM_TYPE.toString(16),n.descriptor)for(t=0;t<n.descriptor.length;t++)this.dispatchType+=("00"+n.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)))n.debug&&console.log("Skipping unrecognized metadata packet");else if(r.push(e),a+=e.data.byteLength,1===r.length&&(i=rl(e.data.subarray(6,10)),i+=10),!(a<i)){for(t={data:new Uint8Array(i),frames:[],pts:r[0].pts,dts:r[0].dts},l=0;l<i;)t.data.set(r[0].data.subarray(0,i-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)),i-=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<i);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(n){var i,r=0,a=188;for(t?((i=new Uint8Array(n.byteLength+t)).set(e.subarray(0,t)),i.set(n,t),t=0):i=n;a<i.byteLength;)71!==i[r]||71!==i[a]?(r++,a++):(this.trigger("data",i.subarray(r,a)),r+=188,a+=188);r<i.byteLength&&(e.set(i.subarray(r),0),t=i.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,n,i;ol.prototype.init.call(this),i=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,i){var r=0;i.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===i.type?t(e.subarray(r),i):n(e.subarray(r),i)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],i.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=i.pmtPid},n=function(e,t){var n,r;if(1&e[5]){for(i.programMapTable={video:null,audio:null,"timed-metadata":{}},n=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<n;){var a=e[r],s=(31&e[r+1])<<8|e[r+2];a===Yu.H264_STREAM_TYPE&&null===i.programMapTable.video?i.programMapTable.video=s:a===Yu.ADTS_STREAM_TYPE&&null===i.programMapTable.audio?i.programMapTable.audio=s:a===Yu.METADATA_STREAM_TYPE&&(i.programMapTable["timed-metadata"][s]=a),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=i.programMapTable}},this.push=function(t){var n={},i=4;if(n.payloadUnitStartIndicator=!!(64&t[1]),n.pid=31&t[1],n.pid<<=8,n.pid|=t[2],(48&t[3])>>>4>1&&(i+=t[i]+1),0===n.pid)n.type="pat",e(t.subarray(i),n),this.trigger("data",n);else if(n.pid===this.pmtPid)for(n.type="pmt",e(t.subarray(i),n),this.trigger("data",n);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,i,n]):this.processPes_(t,i,n)},this.processPes_=function(e,t,n){n.pid===this.programMapTable.video?n.streamType=Yu.H264_STREAM_TYPE:n.pid===this.programMapTable.audio?n.streamType=Yu.ADTS_STREAM_TYPE:n.streamType=this.programMapTable["timed-metadata"][n.pid],n.type="pes",n.data=e.subarray(t),this.trigger("data",n)}}).prototype=new vu,ol.STREAM_TYPES={h264:27,adts:15},(ul=function(){var e=this,t={data:[],size:0},n={data:[],size:0},i={data:[],size:0},r=function(t,n,i){var r,a,s=new Uint8Array(t.size),o={type:n},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"===n||o.packetLength<=t.size,(i||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=n,s="audio";break;case Yu.METADATA_STREAM_TYPE:e=i,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:[]},n=a.programMapTable;null!==n.video&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+n.video,codec:"avc",type:"video"}),null!==n.audio&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+n.audio,codec:"adts",type:"audio"}),e.trigger("data",t)}})[a.type]()},this.flush=function(){r(t,"video"),r(n,"audio"),r(i,"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 n,i,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(i=2*(1&~e[u+1]),n=(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+n,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+i,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,n=0,i=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+i},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)),n=new DataView(a.buffer).getUint32(0),i=8*s,t-=s},this.skipBits=function(e){var r;i>e?(n<<=e,i-=e):(e-=i,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),n<<=e,i-=e)},this.readBits=function(e){var r=Math.min(i,e),a=n>>>32-r;return(i-=r)>0?n<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<<r|this.readBits(r):a},this.skipLeadingZeros=function(){var e;for(e=0;e<i;++e)if(0!=(n&2147483648>>>e))return n<<=e,i-=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,n=0;vl.prototype.init.call(this),this.push=function(i){var r;for(t?((r=new Uint8Array(t.byteLength+i.data.byteLength)).set(t),r.set(i.data,t.byteLength),t=r):t=i.data;n<t.byteLength-3;n++)if(1===t[n+2]){e=n+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}n+3!==e-2&&this.trigger("data",t.subarray(n+3,e-2));do{e++}while(1!==t[e]&&e<t.length);n=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(n+3,e-2)),n=e-2,e+=3;break;default:e+=3}t=t.subarray(n),e-=n,n=0},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(n+3)),t=null,n=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,n,i,r,a,s,o=new vl;gl.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,n=e.pts,i=e.dts,o.push(e))},o.on("data",function(s){var o={trackId:t,pts:n,dts:i,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 n,i=8,r=8;for(n=0;n<e;n++)0!==r&&(r=(i+t.readExpGolomb()+256)%256),i=0===r?i:r},r=function(e){for(var t,n,i=e.byteLength,r=[],a=1;a<i-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=i-r.length,n=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),n[a]=e[s];return n},a=function(e){var t,n,i,r,a,o,u,l,c,d,h,f,p,m=0,g=0,v=0,y=0,_=1;if(n=(t=new bl(e)).readUnsignedByte(),r=t.readUnsignedByte(),i=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),yl[n]&&(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:n,levelIdc:i,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]},Cl={isLikelyAacData:function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},parseId3TagSize:function(e,t){var n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?n+20:n+10},parseAdtsSize:function(e,t){var n=(224&e[t+5])>>5,i=e[t+4]<<3;return 6144&e[t+3]|i|n},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,n,i;t=10,64&e[5]&&(t+=4,t+=El(e.subarray(10,14)));do{if((n=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])){i=e.subarray(t+10,t+n+10);for(var r=0;r<i.byteLength;r++)if(0===i[r]){if("com.apple.streaming.transportStreamTimestamp"===unescape(function(e,t,n){var i,r="";for(i=t;i<n;i++)r+="%"+("00"+e[i].toString(16)).slice(-2);return r}(i,0,r))){var a=i.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+=n}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(n){var i,r,a,s,o=0,u=0;for(e.length?(s=e.length,(e=new Uint8Array(n.byteLength+s)).set(e.subarray(0,s)),e.set(n,s)):e=n;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=Cl.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=Cl.parseId3TagSize(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}i=e.length-u,e=i>0?e.subarray(u):new Uint8Array}}).prototype=new vu;var wl,Pl,Al,Rl,Ll=Tl,Ol=Sl.H264Stream,Il=Cl.isLikelyAacData,xl=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Dl=["width","height","profileIdc","levelIdc","profileCompatibility"],Ml=function(e,t){var n;if(e.length!==t.length)return!1;for(n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},Ul=function(e,t,n,i,r,a){return{start:{dts:e,pts:e+(n-t)},end:{dts:e+(i-t),pts:e+(r-n)},prependedContentDuration:a,baseMediaDecodeTime:e}};(Pl=function(e,t){var n=[],i=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(n){e[n]=t[n]}),n.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!==n.length?(o=Iu(n,e,r),e.baseMediaDecodeTime=Uu(e,t.keepOriginalTimestamps),Ou(e,o,a,s),e.samples=xu(o),l=cu.mdat(Du(o)),n=[],u=cu.moof(i,[e]),c=new Uint8Array(u.byteLength+l.byteLength),i++,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,(wl=function(e,t){var n,i,r=0,a=[],s=[];t=t||{},wl.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){ju(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.config,e.sps=[t.data],Dl.forEach(function(t){e[t]=n[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.data,e.pps=[t.data]),a.push(t)},this.flush=function(){for(var n,i,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(n=_u(a),(o=bu(n))[0][0].keyFrame||((i=this.getGopForFusion_(a[0],e))?(f=i.duration,o.unshift(i),o.byteLength+=i.byteLength,o.nalCount+=i.nalCount,o.pts=i.pts,o.dts=i.dts,o.duration+=i.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),n=void 0,i=void 0},this.getGopForFusion_=function(t){var n,i,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||(n=t.dts-r.dts-r.duration)>=-1e4&&n<=45e3&&(!i||o>n)&&(i=a,o=n));return i?i.gop:null},this.alignGopsAtStart_=function(e){var t,n,i,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=n=0;t<s.length&&n<e.length&&(i=s[t],r=e[n],i.pts!==r.pts);)r.pts>i.pts?t++:(n++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===n?e:n===e.length?null:((l=e.slice(n)).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,n,i,r,a,o,u;for(t=s.length-1,n=e.length-1,a=null,o=!1;t>=0&&n>=0;){if(i=s[t],r=e[n],i.pts===r.pts){o=!0;break}i.pts>r.pts?t--:(t===s.length-1&&(a=n),n--)}if(!o&&null===a)return null;if(0===(u=o?n: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,n,i,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,i=cu.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(i.byteLength),s.initSegment.set(i),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++)(n=this.pendingMetadata[r]).cueTime=n.pts,this.keepOriginalTimestamps||(n.cueTime-=o),n.cueTime/=9e4,s.metadata.push(n);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,n,i=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||(n=n||{timelineStartInfo:{baseMediaDecodeTime:i.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new Pl(n,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?n||"audio"!==a.tracks[s].type||((n=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new wl(t,e),r.videoSegmentStream.on("timelineStartInfo",function(e){n&&(n.timelineStartInfo=e,r.audioSegmentStream.setEarliestDts(e.dts))}),r.videoSegmentStream.on("processedGopsInfo",i.trigger.bind(i,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",i.trigger.bind(i,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),n&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new Pl(n,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(i){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=i),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,Mu(n),e.keepOriginalTimestamps||(n.timelineStartInfo.baseMediaDecodeTime=i),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=i)),r.timedMetadataTimestampRolloverStream&&r.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&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:wl,AudioSegmentStream:Pl,AUDIO_PROPERTIES:xl,VIDEO_PROPERTIES:Dl,generateVideoSegmentTimingInfo:Ul},Bl=Vu,Nl=Xu.CaptionStream,Fl=function(e,t){for(var n=e,i=0;i<t.length;i++){var r=t[i];if(n<r.size)return r;n-=r.size}return null},Vl=function(e,t){var n=iu.findBox(e,["moof","traf"]),i={},r=[];return iu.findBox(e,["mdat"]).forEach(function(e,t){var i=n[t];r.push({mdat:e,traf:i})}),r.forEach(function(e){var n,r=e.mdat,a=e.traf,s=iu.findBox(a,["tfhd"]),o=uu.parseTfhd(s[0]),u=o.trackId,l=iu.findBox(a,["tfdt"]),c=l.length>0?uu.parseTfdt(l[0]).baseMediaDecodeTime:0,d=iu.findBox(a,["trun"]);t===u&&d.length>0&&(n=function(e,t,n){var i,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);i={nalUnitType:"sei_rbsp",size:a,data:l,escapedRBSP:Bl(l),trackId:n},c?(i.pts=c.pts,i.dts=c.dts,s=c):(i.pts=s.pts,i.dts=s.dts),u.push(i)}return u}(r,function(e,t,n){var i=t,r=n.defaultSampleDuration||0,a=n.defaultSampleSize||0,s=n.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=i,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),e.pts=i+e.compositionTimeOffset,i+=e.duration}),o=o.concat(t)}),o}(d,c,o),u),i[u]||(i[u]=[]),i[u]=i[u].concat(n))}),i},Gl={generator:cu,probe:iu,Transmuxer:jl.Transmuxer,AudioSegmentStream:jl.AudioSegmentStream,VideoSegmentStream:jl.VideoSegmentStream,CaptionParser:function(){var e,t,n,i,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/i,e.endTime=e.endPts/i,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||n===e[0]&&i===t[n])},this.parse=function(e,a,s){var o;if(!this.isInitialized())return null;if(!a||!s)return null;if(this.isNewInit(a,s))n=a[0],i=s[n];else if(!n||!i)return t.push(e),null;for(;t.length>0;){var u=t.shift();this.parse(u,a,s)}return null!==(o=function(e,t,n){return t?{seiNals:Vl(e,t)[t],timescale:n}:null}(e,n,i))&&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=[],n=null,i=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 n=Hl(e);return 0===n?"pat":n===t?"pmt":t?"pes":null},parsePat:function(e){var t=zl(e),n=4+ql(e);return t&&(n+=e[n]+1),(31&e[n+10])<<8|e[n+11]},parsePmt:function(e){var t={},n=zl(e),i=4+ql(e);if(n&&(i+=e[i]+1),1&e[i+5]){var r;r=3+((15&e[i+1])<<8|e[i+2])-4;for(var a=12+((15&e[i+10])<<8|e[i+11]);a<r;){var s=i+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 n,i=null;return 192&(n=e[t+7])&&((i={}).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,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&n&&(i.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,i.dts*=4,i.dts+=(6&e[t+18])>>>1)),i},videoPacketContainsKeyFrame:function(e){for(var t=4+ql(e),n=e.subarray(t),i=0,r=0,a=!1;r<n.byteLength-3;r++)if(1===n[r+2]){i=r+5;break}for(;i<n.byteLength;)switch(n[i]){case 0:if(0!==n[i-1]){i+=2;break}if(0!==n[i-2]){i++;break}r+3!==i-2&&"slice_layer_without_partitioning_rbsp_idr"===Wl(31&n[r+3])&&(a=!0);do{i++}while(1!==n[i]&&i<n.length);r=i-2,i+=3;break;case 1:if(0!==n[i-1]||0!==n[i-2]){i+=3;break}"slice_layer_without_partitioning_rbsp_idr"===Wl(31&n[r+3])&&(a=!0),r=i-2,i+=3;break;default:i+=3}return n=n.subarray(r),i-=r,r=0,n&&n.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===Wl(31&n[r+3])&&(a=!0),a}},$l=tl,Xl={};Xl.ts=Kl,Xl.aac=Cl;var Yl=function(e,t,n){for(var i,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(i=e.subarray(o,u),Xl.ts.parseType(i,t.pid)){case"pes":r=Xl.ts.parsePesType(i,t.table),a=Xl.ts.parsePayloadUnitStartIndicator(i),"audio"===r&&a&&(s=Xl.ts.parsePesTime(i))&&(s.type="audio",n.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(i=e.subarray(o,u),Xl.ts.parseType(i,t.pid)){case"pes":r=Xl.ts.parsePesType(i,t.table),a=Xl.ts.parsePayloadUnitStartIndicator(i),"audio"===r&&a&&(s=Xl.ts.parsePesTime(i))&&(s.type="audio",n.audio.push(s),l=!0)}if(l)break;o-=188,u-=188}},Jl=function(e,t,n){for(var i,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(i=e.subarray(c,d),Xl.ts.parseType(i,t.pid)){case"pes":if(r=Xl.ts.parsePesType(i,t.table),a=Xl.ts.parsePayloadUnitStartIndicator(i),"video"===r&&(a&&!h&&(s=Xl.ts.parsePesTime(i))&&(s.type="video",n.video.push(s),h=!0),!n.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?(n.firstKeyFrame=p,n.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(i),f.size+=i.byteLength}}if(h&&n.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(i=e.subarray(c,d),Xl.ts.parseType(i,t.pid)){case"pes":r=Xl.ts.parsePesType(i,t.table),a=Xl.ts.parsePayloadUnitStartIndicator(i),"video"===r&&a&&(s=Xl.ts.parsePesTime(i))&&(s.type="video",n.video.push(s),h=!0)}if(h)break;c-=188,d-=188}},Ql=function(e){var t={pid:null,table:null},n={};for(var i in function(e,t){for(var n,i=0,r=188;r<e.byteLength;)if(71!==e[i]||71!==e[r])i++,r++;else{switch(n=e.subarray(i,r),Xl.ts.parseType(n,t.pid)){case"pat":t.pid||(t.pid=Xl.ts.parsePat(n));break;case"pmt":t.table||(t.table=Xl.ts.parsePmt(n))}if(t.pid&&t.table)return;i+=188,r+=188}}(e,t),t.table){if(t.table.hasOwnProperty(i))switch(t.table[i]){case Yu.H264_STREAM_TYPE:n.video=[],Jl(e,t,n),0===n.video.length&&delete n.video;break;case Yu.ADTS_STREAM_TYPE:n.audio=[],Yl(e,t,n),0===n.audio.length&&delete n.audio}}return n},Zl=function(e,t){var n;return(n=Xl.aac.isLikelyAacData(e)?function(e){for(var t,n=!1,i=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){n=!0;break}if((s=Xl.aac.parseId3TagSize(e,o))>e.length){n=!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){n=!0;break}if((s=Xl.aac.parseAdtsSize(e,o))>e.length){n=!0;break}null===r&&(t=e.subarray(o,o+s),r=Xl.aac.parseSampleRate(t)),i++,o+=s;break;default:o++}if(n)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*i*u,pts:a+1024*i*u}]}}(e):Ql(e))&&(n.audio||n.video)?(function(e,t){if(e.audio&&e.audio.length){var n=t;void 0===n&&(n=e.audio[0].dts),e.audio.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})}if(e.video&&e.video.length){var i=t;if(void 0===i&&(i=e.video[0].dts),e.video.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}),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=$l(r.dts,i),r.pts=$l(r.pts,i),r.dtsTime=r.dts/9e4,r.ptsTime=r.dts/9e4}}}(n,t),n):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 n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),nc=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},ic=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],n=e[1],i=t[4],r=n[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;!i[s];s^=c||1,o=l[o]||1)for(h=(h=o^o<<1^o<<2^o<<3^o<<4)>>8^255&h^99,i[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,n[a][h]=p=p<<24^p>>>8;for(a=0;a<5;a++)t[a]=t[a].slice(0),n[a]=n[a].slice(0);return e},rc=null,ac=function(){function e(t){ec(this,e),rc||(rc=ic()),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 n=void 0,i=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],n=l;n<4*l+28;n++)r=a[n-1],(n%l==0||8===l&&n%l==4)&&(r=o[r>>>24]<<24^o[r>>16&255]<<16^o[r>>8&255]<<8^o[255&r],n%l==0&&(r=r<<8^r>>>24^c<<24,c=c<<1^283*(c>>7))),a[n]=a[n-l]^r;for(i=0;n;i++,n--)r=a[3&i?n:n-4],s[i]=n<=4||i<4?r:u[0][o[r>>>24]]^u[1][o[r>>16&255]]^u[2][o[r>>8&255]]^u[3][o[255&r]]}return e.prototype.decrypt=function(e,t,n,i,r,a){var s=this._key[1],o=e^s[0],u=i^s[1],l=n^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 n=this.listeners[e].indexOf(t);return this.listeners[e].splice(n,1),n>-1},e.prototype.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var n=t.length,i=0;i<n;++i)t[i].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 n=nc(this,e.call(this,sc));return n.jobs=[],n.delay=1,n.timeout_=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(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,n){var i=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=n[0],u=n[1],l=n[2],c=n[3],m=0;m<i.length;m+=4)d=uc(i[m]),h=uc(i[m+1]),f=uc(i[m+2]),p=uc(i[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,n,i,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),n,i,o)),u=a;u<s.length;u+=a)i=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),n,i,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,n,i){return function(){var r=lc(e,t,n);i.set(r,e.byteOffset)}},tc(e,null,[{key:"STEP",get:function(){return 32e3}}]),e}(),dc=function(t,n){return/^[a-z]+:/i.test(n)?n:(/\/\//i.test(t)||(t=fs.buildAbsoluteURL(e.location.href,t)),fs.buildAbsoluteURL(t,n))},hc=function(e,t,n){return e&&n.responseURL&&t!==n.responseURL?n.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 n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 n=[],i=!0,r=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(i=(s=o.next()).done)&&(n.push(s.value),!t||n.length!==t);i=!0);}catch(e){r=!0,a=e}finally{try{!i&&o.return&&o.return()}finally{if(r)throw a}}return n}(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(n){for(var i in e.mediaGroups[n])for(var r in e.mediaGroups[n][i]){var a=e.mediaGroups[n][i][r];t(a,n,i,r)}})},Sc=function(e,t){var n=yc(e,{}),i=n.playlists[t.uri];if(!i)return null;if(i.segments&&t.segments&&i.segments.length===t.segments.length&&i.endList===t.endList&&i.mediaSequence===t.mediaSequence)return null;var r=yc(i,t);i.segments&&(r.segments=function(e,t,n){var i=t.slice();n=n||0;for(var r=Math.min(e.length,t.length+n),a=n;a<r;a++)i[a-n]=yc(e[a],i[a-n]);return i}(i.segments,t.segments,t.mediaSequence-i.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<n.playlists.length;a++)n.playlists[a].uri===t.uri&&(n.playlists[a]=r);return n.playlists[t.uri]=r,n},kc=function(e){for(var t=e.playlists.length;t--;){var n=e.playlists[t];e.playlists[n.uri]=n,n.resolvedUri=dc(e.uri,n.uri),n.id=t,n.attributes||(n.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))})},Cc=function(e,t){var n=e.segments[e.segments.length-1];return t&&n&&n.duration?1e3*n.duration:500*(e.targetDuration||10)},wc=function(t){function n(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fc(this,n);var r=gc(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),a=i.withCredentials,s=void 0!==a&&a,o=i.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(n,_c),pc(n,[{key:"playlistRequestError",value:function(e,t,n){this.request=null,n&&(this.state=n),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,n){var i=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=n,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(){i.trigger("mediaupdatetimeout")},Cc(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,n){var i=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),n){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,n){if(i.request){if(t.resolvedUri=hc(i.handleManifestRedirects,t.resolvedUri,n),e)return i.playlistRequestError(i.request,t.uri,a);i.haveMetadata(n,t.uri),"HAVE_MASTER"===a?i.trigger("loadedmetadata"):i.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 n=this;e.clearTimeout(this.mediaUpdateTimeout);var i=this.media();if(t){var r=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=e.setTimeout(function(){return n.load()},r)}else this.started?i&&!i.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(n,i){if(t.request){if(t.request=null,n)return t.error={status:i.status,message:"HLS playlist request error at URL: "+t.srcUrl+".",responseText:i.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(i.responseText),r.end(),t.state="HAVE_MASTER",t.srcUrl=hc(t.handleManifestRedirects,t.srcUrl,i),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(i,t.srcUrl),t.trigger("loadedmetadata"))}})}}]),n}(),Pc=cs.createTimeRange,Ac=function(e,t,n){var i,r;return void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence?0:(i=function(e,t){var n=0,i=t-e.mediaSequence,r=e.segments[i];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(;i--;){if(void 0!==(r=e.segments[i]).end)return{result:n+r.end,precise:!0};if(n+=r.duration,void 0!==r.start)return{result:n+r.start,precise:!0}}return{result:n,precise:!1}}(e,t)).precise?i.result:(r=function(e,t){for(var n=0,i=void 0,r=t-e.mediaSequence;r<e.segments.length;r++){if(void 0!==(i=e.segments[r]).start)return{result:i.start-n,precise:!0};if(n+=i.duration,void 0!==i.end)return{result:i.end-n,precise:!0}}return{result:-1,precise:!1}}(e,t)).precise?r.result:i.result+n},Rc=function(t,n,i){if(!t)return 0;if("number"!=typeof i&&(i=0),void 0===n){if(t.totalDuration)return t.totalDuration;if(!t.endList)return e.Infinity}return Ac(t,n,i)},Lc=function(e,t,n){var i=0;if(t>n){var r=[n,t];t=r[0],n=r[1]}if(t<0){for(var a=t;a<Math.min(0,n);a++)i+=e.targetDuration;t=0}for(var s=t;s<n;s++)i+=e.segments[s].duration;return i},Oc=function(e){if(!e.segments.length)return 0;for(var t=e.segments.length-1,n=e.segments[t].duration||e.targetDuration,i=n+2*e.targetDuration;t--&&!((n+=e.segments[t].duration)>=i););return Math.max(0,t)},Ic=function(e,t,n){if(!e||!e.segments)return null;if(e.endList)return Rc(e);if(null===t)return null;t=t||0;var i=n?Oc(e):e.segments.length;return Ac(e,e.mediaSequence+i,t)},xc=function(e){return e-Math.floor(e)==0},Dc=function(e,t){if(xc(t))return t+.1*e;for(var n=t.toString().split(".")[1].length,i=1;i<=n;i++){var r=Math.pow(10,i),a=t*r;if(xc(a)||i===n)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 n=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(function(e){return!!Nc(e)&&(e.attributes.BANDWIDTH||0)<n}).length},Gc={duration:Rc,seekable:function(e,t){var n=t||0,i=Ic(e,t,!0);return null===i?Pc():Pc(n,i)},safeLiveIndex:Oc,getMediaInfoForTime:function(e,t,n,i){var r=void 0,a=void 0,s=e.segments.length,o=t-i;if(o<0){if(n>0)for(r=n-1;r>=0;r--)if(a=e.segments[r],(o+=Uc(a.duration))>0)return{mediaIndex:r,startTime:i-Lc(e,n,r)};return{mediaIndex:0,startTime:t}}if(n<0){for(r=n;r<0;r++)if((o-=e.targetDuration)<0)return{mediaIndex:0,startTime:t};n=0}for(r=n;r<s;r++)if(a=e.segments[r],(o-=Mc(a.duration))<0)return{mediaIndex:r,startTime:i+Lc(e,n,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,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return Fc("BANDWIDTH",n)?(e*n.attributes.BANDWIDTH-8*i)/t:NaN},isLowestEnabledRendition:Vc},Hc=cs.xhr,zc=cs.mergeOptions,qc=function(){return function e(t,n){t=zc({timeout:45e3},t);var i=e.beforeRequest||cs.Hls.xhr.beforeRequest;if(i&&"function"==typeof i){var r=i(t);r&&(t=r)}var a=Hc(t,function(e,t){var i=a.response;!e&&i&&(a.responseTime=Date.now(),a.roundTripTime=a.responseTime-a.requestTime,a.bytesReceived=i.byteLength||i.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&&(i||a.responseText)))),n(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,n,i={};return e.byterange&&(i.Range=(t=e.byterange,n=t.offset+t.length-1,"bytes="+t.offset+"-"+n)),i},Kc=function(e,t){return e.start(t)+"-"+e.end(t)},$c=function(e,t){var n=e.toString(16);return"00".substring(0,2-n.length)+n+(t%2?" ":"")},Xc=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Yc=function(e){var t={};return Object.keys(e).forEach(function(n){var i=e[n];ArrayBuffer.isView(i)?t[n]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:t[n]=i}),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),n="",i=0;i<t.length/16;i++)n+=t.slice(16*i,16*i+16).map($c).join("")+" "+t.slice(16*i,16*i+16).map(Xc).join("")+"\n";return n},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="",n=void 0;for(n=0;n<e.length;n++)t+=Kc(e,n)+" ";return t}}),td=function(e){var t=e.playlist,n=e.time,i=void 0===n?void 0:n,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===i)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 n=0,i=void 0,r=0;r<t.segments.length&&!(e<=(n=(i=t.segments[r]).videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:n+i.duration));r++);var a=t.segments[t.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>n){if(e>n+.25*a.duration)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(i,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:i},o=function(e,t){if(!t.dateTimeObject)return null;var n=t.videoTimingInfo.transmuxerPrependedSeconds,i=e-(t.videoTimingInfo.transmuxedPresentationStart+n);return new Date(t.dateTimeObject.getTime()+1e3*i)}(i,a.segment);return o&&(s.programDateTime=o.toISOString()),r(null,s)},nd=function e(t){var n=t.programTime,i=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===n||!i||!s)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!i.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}(i))return c({message:"programDateTime tags must be provided in the manifest "+i.resolvedUri});var d=function(e,t){var n=void 0;try{n=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;var i=t.segments[0];if(n<i.dateTimeObject)return null;for(var r=0;r<t.segments.length-1&&(i=t.segments[r],!(n<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 n>new Date(o.getTime()+1e3*u)?null:(n>o&&(i=s),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:Gc.duration(t,t.mediaSequence+t.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})}(n,i);if(!d)return c({message:n+" was not found in the stream"});var h=d.segment,f=function(e,t){var n=void 0,i=void 0;try{n=new Date(e),i=new Date(t)}catch(e){}var r=n.getTime();return(i.getTime()-r)/1e3}(h.dateTimeObject,n);if("estimate"===d.type)return 0===a?c({message:n+" is not buffered yet. Try again"}):(s(d.estimatedStart+f),void l.one("seeked",function(){e({programTime:n,playlist:i,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)},id=function(e,t){var n=[],i=void 0;if(e&&e.length)for(i=0;i<e.length;i++)t(e.start(i),e.end(i))&&n.push([e.start(i),e.end(i)]);return cs.createTimeRanges(n)},rd=function(e,t){return id(e,function(e,n){return e-1/30<=t&&n+1/30>=t})},ad=function(e,t){return id(e,function(e){return e-1/30>=t})},sd=function(e){var t=[];if(!e||!e.length)return"";for(var n=0;n<e.length;n++)t.push(e.start(n)+" => "+e.end(n));return t.join(", ")},od=function(e){for(var t=[],n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t},ud=function(e,t,n){var i=void 0,r=void 0;if(n&&n.cues)for(i=n.cues.length;i--;)(r=n.cues[i]).startTime<=t&&r.endTime>=e&&n.removeCue(r)},ld=function(e){return isNaN(e)||Math.abs(e)===1/0?Number.MAX_VALUE:e},cd=function(t,n,i){var r=e.WebKitDataCue||e.VTTCue;if(n&&n.forEach(function(e){var t=e.stream;this.inbandTextTracks_[t].addCue(new r(e.startTime+this.timestampOffset,e.endTime+this.timestampOffset,e.text))},t),i){var a=ld(t.mediaSource_.duration);if(i.forEach(function(t){var n=t.cueTime+this.timestampOffset;!("number"!=typeof n||e.isNaN(n)||n<0)&&n<1/0&&t.frames.forEach(function(e){var t=new r(n,n,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 n=e[t.startTime]||[];return n.push(t),e[t.startTime]=n,e},{}),c=Object.keys(l).sort(function(e,t){return Number(e)-Number(t)});c.forEach(function(e,t){var n=l[e],i=Number(c[t+1])||a;n.forEach(function(e){e.endTime=i})})}}},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(n){var i=this;if(!t)return new gd(e);if(gd&&!n){var r=Td(t.toString().replace(/^function.+?{/,"").slice(0,-1));return this[hd]=new gd(r),function(e,t){if(!e||!t)return;var n=e.terminate;e.objURL=t,e.terminate=function(){e.objURL&&md.revokeObjectURL(e.objURL),n.call(e)}}(this[hd],r),this[hd]}var a={postMessage:function(e){i.onmessage&&setTimeout(function(){i.onmessage({data:e,target:a})})}};t.call(a),this.postMessage=function(e){setTimeout(function(){a.onmessage({data:e,target:i})})},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(n){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 n=this;!function(){var e,t,i,r,a,s,o,u,l,c,d,h,f,p,m,g,v,y,_,b,T,S,k,E,C,w,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)]),C=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),E=new Uint8Array([0,0,0,1]),w=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:w,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,n,i=[],r=0;for(t=1;t<arguments.length;t++)i.push(arguments[t]);for(t=i.length;t--;)r+=i[t].byteLength;for(n=new Uint8Array(r+8),new DataView(n.buffer,n.byteOffset,n.byteLength).setUint32(0,n.byteLength),n.set(e,4),t=0,r=8;t<i.length;t++)n.set(i[t],r),r+=i[t].byteLength;return n},t=function(){return e(S.dinf,e(S.dref,O))},i=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 n=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&&(n[12]=t.samplerate>>>24&255,n[13]=t.samplerate>>>16&255,n[14]=t.samplerate>>>8&255,n[15]=255&t.samplerate),e(S.mdhd,n)},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(n){return e(S.minf,"video"===n.type?e(S.vmhd,R):e(S.smhd,L),t(),v(n))},o=function(t,n){for(var i=[],r=n.length;r--;)i[r]=_(n[r]);return e.apply(null,[S.moof,a(t)].concat(i))},u=function(t){for(var n=t.length,i=[];n--;)i[n]=d(t[n]);return e.apply(null,[S.moov,c(4294967295)].concat(i).concat(l(t)))},l=function(t){for(var n=t.length,i=[];n--;)i[n]=b(t[n]);return e.apply(null,[S.mvex].concat(i))},c=function(t){var n=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,n)},g=function(t){var n,i,r=t.samples||[],a=new Uint8Array(4+r.length);for(i=0;i<r.length;i++)n=r[i].flags,a[i+4]=n.dependsOn<<4|n.isDependedOn<<2|n.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 n,i=t.sps||[],r=t.pps||[],a=[],s=[];for(n=0;n<i.length;n++)a.push((65280&i[n].byteLength)>>>8),a.push(255&i[n].byteLength),a=a.concat(Array.prototype.slice.call(i[n]));for(n=0;n<r.length;n++)s.push((65280&r[n].byteLength)>>>8),s.push(255&r[n].byteLength),s=s.concat(Array.prototype.slice.call(r[n]));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([i.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]),i(t))},h=function(t){var n=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,n)},_=function(t){var n,i,r,a,s,o;return n=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)),i=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,n,i,r)):(a=g(t),r=T(t,a.length+92),e(S.traf,n,i,r,a))},d=function(t){return t.duration=t.duration||4294967295,e(S.trak,h(t),f(t))},b=function(t){var n=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&&(n[n.length-1]=0),e(S.trex,n)},F=function(e,t){var n=0,i=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(n=1),void 0!==e[0].size&&(i=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,n|i|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,n){var i,r,a,s;for(n+=20+16*(r=t.samples||[]).length,i=F(r,n),s=0;s<r.length;s++)a=r[s],i=i.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(i))},B=function(t,n){var i,r,a,s;for(n+=20+8*(r=t.samples||[]).length,i=F(r,n),s=0;s<r.length;s++)a=r[s],i=i.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(i))},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,C)},mdat:function(t){return e(S.mdat,t)},moof:o,moov:u,initSegment:function(e){var t,n=r(),i=u(e);return(t=new Uint8Array(n.byteLength+i.byteLength)).set(n),t.set(i,n.byteLength),t}},q=function(e){return e>>>0},W={findBox:G=function(e,t){var n,i,r,a,s,o=[];if(!t.length)return null;for(n=0;n<e.byteLength;)i=q(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]),r=H(e.subarray(n+4,n+8)),a=i>1?n+i:e.byteLength,r===t[0]&&(1===t.length?o.push(e.subarray(n+8,a)):(s=G(e.subarray(n+8,a),t.slice(1))).length&&(o=o.concat(s))),n=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 n,i,r,a,s;return(n=G(t,["tkhd"])[0])?(i=n[0],a=q(n[r=0===i?12:20]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3]),(s=G(t,["mdia","mdhd"])[0])?(r=0===(i=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 n,i,r;return n=G(t,["moof","traf"]),i=[].concat.apply([],n.map(function(t){return G(t,["tfhd"]).map(function(n){var i,r;return i=q(n[4]<<24|n[5]<<16|n[6]<<8|n[7]),r=e[i]||9e4,(G(t,["tfdt"]).map(function(e){var t,n;return t=e[0],n=q(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(n*=Math.pow(2,32),n+=q(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),n})[0]||1/0)/r})})),r=Math.min.apply(null,i),isFinite(r)?r:0},videoTrackIds:function(e){var t=[];return G(e,["moov","trak"]).forEach(function(e){var n=G(e,["mdia","hdlr"]),i=G(e,["tkhd"]);n.forEach(function(e,n){var r,a,s=H(e.subarray(8,12)),o=i[n];"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,n){e[t]||(e[t]=[]),e[t]=e[t].concat(n)},this.off=function(t,n){var i;return!!e[t]&&(i=e[t].indexOf(n),e[t]=e[t].slice(),e[t].splice(i,1),i>-1)},this.trigger=function(t){var n,i,r,a;if(n=e[t])if(2===arguments.length)for(r=n.length,i=0;i<r;++i)n[i].call(this,arguments[1]);else{for(a=[],i=arguments.length,i=1;i<arguments.length;++i)a.push(arguments[i]);for(r=n.length,i=0;i<r;++i)n[i].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 n={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return n.dataOffset=t,n.compositionTimeOffset=e.pts-e.dts,n.duration=e.duration,n.size=4*e.length,n.size+=e.byteLength,e.keyFrame&&(n.flags.dependsOn=2,n.flags.isNonSyncSample=0),n},te=function(e){var t,n,i=[],r=[];for(i.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(n=e[t]).nalUnitType?(i.length&&(i.duration=n.dts-i.dts,r.push(i)),(i=[n]).byteLength=n.data.byteLength,i.pts=n.pts,i.dts=n.dts):("slice_layer_without_partitioning_rbsp_idr"===n.nalUnitType&&(i.keyFrame=!0),i.duration=n.dts-i.dts,i.byteLength+=n.data.byteLength,i.push(n));return r.length&&(!i.duration||i.duration<=0)&&(i.duration=r[r.length-1].duration),r.push(i),r},ne=function(e){var t,n,i=[],r=[];for(i.byteLength=0,i.nalCount=0,i.duration=0,i.pts=e[0].pts,i.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++)(n=e[t]).keyFrame?(i.length&&(r.push(i),r.byteLength+=i.byteLength,r.nalCount+=i.nalCount,r.duration+=i.duration),(i=[n]).nalCount=n.length,i.byteLength=n.byteLength,i.pts=n.pts,i.dts=n.dts,i.duration=n.duration):(i.duration+=n.duration,i.nalCount+=n.length,i.byteLength+=n.byteLength,i.push(n));return r.length&&i.duration<=0&&(i.duration=r[r.length-1].duration),r.byteLength+=i.byteLength,r.nalCount+=i.nalCount,r.duration+=i.duration,r.push(i),r},ie=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 n,i,r,a,s,o=t||0,u=[];for(n=0;n<e.length;n++)for(a=e[n],i=0;i<a.length;i++)s=a[i],o+=(r=ee(s,o)).size,u.push(r);return u},ae=function(e){var t,n,i,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],n=0;n<r.length;n++)for(a=r[n],i=0;i<a.length;i++)s=a[i],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,n,i){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)),n&&i&&(u=r-Math.max(n,i),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,n){return t.minSegmentDts>=n?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=n&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},me=function(e){var t,n,i=[];for(t=0;t<e.length;t++)n=e[t],i.push({size:n.data.byteLength,duration:1024});return i},ge=function(e){var t,n,i=0,r=new Uint8Array(function(e){var t,n=0;for(t=0;t<e.length;t++)n+=e[t].data.byteLength;return n}(e));for(t=0;t<e.length;t++)n=e[t],r.set(n.data,i),i+=n.data.byteLength;return r},ve=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},ye=function(e,t){var n,i=e.minSegmentDts;return t||(i-=e.timelineStartInfo.dts),n=e.timelineStartInfo.baseMediaDecodeTime,n+=i,n=Math.max(0,n),"audio"===e.type&&(n*=e.samplerate/9e4,n=Math.floor(n)),n},_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,n={payloadType:-1,payloadSize:0},i=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)i+=255,t++;for(i+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!n.payload&&4===i){n.payloadType=i,n.payloadSize=r,n.payload=e.subarray(t,t+r);break}t+=r,i=0,r=0}return n},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 n,i,r,a,s=[];if(!(64&t[0]))return s;for(i=31&t[0],n=0;n<i;n++)a={type:3&t[2+(r=3*n)],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,n,i=e.byteLength,r=[],a=1;a<i-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=i-r.length,n=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),n[a]=e[s];return n},Ee=4,Ce=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)};(Ce.prototype=new Z).push=function(e){var t,n,i;if("sei_rbsp"===e.nalUnitType&&(t=be(e.escapedRBSP)).payloadType===Ee&&(n=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));i=Se(e.pts,n),this.captionPackets_=this.captionPackets_.concat(i),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Ce.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)},Ce.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(e){e.reset()})},Ce.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)},Ce.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Ce.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Ce.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var we={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=we[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,n){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=n||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,n,i,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),i=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),n=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=n,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(i,r))a=Pe((i=(3&i)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(i,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((i=(3&i)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(i,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(i,r))this.column_+=3&r;else if(this.isPAC(i,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(i)&&(0===r&&(r=null),a=Pe(i),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 n=0;n<this.rollUpRows_;n++)this.displayed_[t-n]=this.displayed_[this.row_-n],this.displayed_[this.row_-n]="";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 n=t.reduce(function(e,t){return e+"<"+t+">"},"");this[this.mode_](e,n)},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 n=this.nonDisplayed_[this.row_];n+=t,this.nonDisplayed_[this.row_]=n},Le.prototype.rollUp=function(e,t){var n=this.displayed_[this.row_];n+=t,this.displayed_[this.row_]=n},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 n=this.displayed_[this.row_];n+=t,this.displayed_[this.row_]=n};var Oe={CaptionStream:Ce,Cea608Stream:Le},Ie={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},xe=function(e,t){var n=1;for(e>t&&(n=-1);Math.abs(t-e)>4294967296;)e+=8589934592*n;return e},De=function e(t){var n,i;e.prototype.init.call(this),this.type_=t,this.push=function(e){e.type===this.type_&&(void 0===i&&(i=e.dts),e.dts=xe(e.dts,i),e.pts=xe(e.pts,i),n=e.dts,this.trigger("data",e))},this.flush=function(){i=n,this.trigger("done")},this.discontinuity=function(){i=void 0,n=void 0}};De.prototype=new Z;var Me,Ue=De,je=function(e,t,n){var i,r="";for(i=t;i<n;i++)r+="%"+("00"+e[i].toString(16)).slice(-2);return r},Be=function(e,t,n){return decodeURIComponent(je(e,t,n))},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,n;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(n=e.data,unescape(je(n,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Me=function(e){var t,n={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},i=0,r=[],a=0;if(Me.prototype.init.call(this),this.dispatchType=Ie.METADATA_STREAM_TYPE.toString(16),n.descriptor)for(t=0;t<n.descriptor.length;t++)this.dispatchType+=("00"+n.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)))n.debug&&console.log("Skipping unrecognized metadata packet");else if(r.push(e),a+=e.data.byteLength,1===r.length&&(i=Ne(e.data.subarray(6,10)),i+=10),!(a<i)){for(t={data:new Uint8Array(i),frames:[],pts:r[0].pts,dts:r[0].dts},l=0;l<i;)t.data.set(r[0].data.subarray(0,i-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)),i-=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<i);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(n){var i,r=0,a=188;for(t?((i=new Uint8Array(n.byteLength+t)).set(e.subarray(0,t)),i.set(n,t),t=0):i=n;a<i.byteLength;)71!==i[r]||71!==i[a]?(r++,a++):(this.trigger("data",i.subarray(r,a)),r+=188,a+=188);r<i.byteLength&&(e.set(i.subarray(r),0),t=i.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,n,i;Ge.prototype.init.call(this),i=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,i){var r=0;i.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===i.type?t(e.subarray(r),i):n(e.subarray(r),i)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],i.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=i.pmtPid},n=function(e,t){var n,r;if(1&e[5]){for(i.programMapTable={video:null,audio:null,"timed-metadata":{}},n=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<n;){var a=e[r],s=(31&e[r+1])<<8|e[r+2];a===Ie.H264_STREAM_TYPE&&null===i.programMapTable.video?i.programMapTable.video=s:a===Ie.ADTS_STREAM_TYPE&&null===i.programMapTable.audio?i.programMapTable.audio=s:a===Ie.METADATA_STREAM_TYPE&&(i.programMapTable["timed-metadata"][s]=a),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=i.programMapTable}},this.push=function(t){var n={},i=4;if(n.payloadUnitStartIndicator=!!(64&t[1]),n.pid=31&t[1],n.pid<<=8,n.pid|=t[2],(48&t[3])>>>4>1&&(i+=t[i]+1),0===n.pid)n.type="pat",e(t.subarray(i),n),this.trigger("data",n);else if(n.pid===this.pmtPid)for(n.type="pmt",e(t.subarray(i),n),this.trigger("data",n);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,i,n]):this.processPes_(t,i,n)},this.processPes_=function(e,t,n){n.pid===this.programMapTable.video?n.streamType=Ie.H264_STREAM_TYPE:n.pid===this.programMapTable.audio?n.streamType=Ie.ADTS_STREAM_TYPE:n.streamType=this.programMapTable["timed-metadata"][n.pid],n.type="pes",n.data=e.subarray(t),this.trigger("data",n)}}).prototype=new Z,Ge.STREAM_TYPES={h264:27,adts:15},(He=function(){var e=this,t={data:[],size:0},n={data:[],size:0},i={data:[],size:0},r=function(t,n,i){var r,a,s=new Uint8Array(t.size),o={type:n},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"===n||o.packetLength<=t.size,(i||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=n,s="audio";break;case Ie.METADATA_STREAM_TYPE:e=i,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:[]},n=a.programMapTable;null!==n.video&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+n.video,codec:"avc",type:"video"}),null!==n.audio&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+n.audio,codec:"adts",type:"audio"}),e.trigger("data",t)}})[a.type]()},this.flush=function(){r(t,"video"),r(n,"audio"),r(i,"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 n,i,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(i=2*(1&~e[u+1]),n=(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+n,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+i,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,n=0,i=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+i},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)),n=new DataView(a.buffer).getUint32(0),i=8*s,t-=s},this.skipBits=function(e){var r;i>e?(n<<=e,i-=e):(e-=i,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),n<<=e,i-=e)},this.readBits=function(e){var r=Math.min(i,e),a=n>>>32-r;return(i-=r)>0?n<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<<r|this.readBits(r):a},this.skipLeadingZeros=function(){var e;for(e=0;e<i;++e)if(0!=(n&2147483648>>>e))return n<<=e,i-=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,n=0;Qe.prototype.init.call(this),this.push=function(i){var r;for(t?((r=new Uint8Array(t.byteLength+i.data.byteLength)).set(t),r.set(i.data,t.byteLength),t=r):t=i.data;n<t.byteLength-3;n++)if(1===t[n+2]){e=n+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}n+3!==e-2&&this.trigger("data",t.subarray(n+3,e-2));do{e++}while(1!==t[e]&&e<t.length);n=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(n+3,e-2)),n=e-2,e+=3;break;default:e+=3}t=t.subarray(n),e-=n,n=0},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(n+3)),t=null,n=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,n,i,r,a,s,o=new Qe;Je.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,n=e.pts,i=e.dts,o.push(e))},o.on("data",function(s){var o={trackId:t,pts:n,dts:i,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 n,i=8,r=8;for(n=0;n<e;n++)0!==r&&(r=(i+t.readExpGolomb()+256)%256),i=0===r?i:r},r=function(e){for(var t,n,i=e.byteLength,r=[],a=1;a<i-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=i-r.length,n=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),n[a]=e[s];return n},a=function(e){var t,n,i,r,a,o,u,l,c,d,h,f,p,m=0,g=0,v=0,y=0,_=1;if(n=(t=new tt(e)).readUnsignedByte(),r=t.readUnsignedByte(),i=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),Ze[n]&&(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:n,levelIdc:i,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 nt,it={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 n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?n+20:n+10},st=function(e,t){var n=(224&e[t+5])>>5,i=e[t+4]<<3;return 6144&e[t+3]|i|n};(nt=function(){var e=new Uint8Array,t=0;nt.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(n){var i,r,a,s,o=0,u=0;for(e.length?(s=e.length,(e=new Uint8Array(n.byteLength+s)).set(e.subarray(0,s)),e.set(n,s)):e=n;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}i=e.length-u,e=i>0?e.subarray(u):new Uint8Array}}).prototype=new Z;var ot,ut,lt,ct,dt=nt,ht=it.H264Stream,ft=rt,pt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],mt=["width","height","profileIdc","levelIdc","profileCompatibility"],gt=function(e,t){var n;if(e.length!==t.length)return!1;for(n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},vt=function(e,t,n,i,r,a){return{start:{dts:e,pts:e+(n-t)},end:{dts:e+(i-t),pts:e+(r-n)},prependedContentDuration:a,baseMediaDecodeTime:e}};(ut=function(e,t){var n=[],i=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(n){e[n]=t[n]}),n.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!==n.length?(o=pe(n,e,r),e.baseMediaDecodeTime=ye(e,t.keepOriginalTimestamps),fe(e,o,a,s),e.samples=me(o),l=z.mdat(ge(o)),n=[],u=z.moof(i,[e]),c=new Uint8Array(u.byteLength+l.byteLength),i++,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 n,i,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||n||(n=t.config,e.sps=[t.data],mt.forEach(function(t){e[t]=n[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.data,e.pps=[t.data]),a.push(t)},this.flush=function(){for(var n,i,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(n=te(a),(o=ne(n))[0][0].keyFrame||((i=this.getGopForFusion_(a[0],e))?(f=i.duration,o.unshift(i),o.byteLength+=i.byteLength,o.nalCount+=i.nalCount,o.pts=i.pts,o.dts=i.dts,o.duration+=i.duration):o=ie(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),n=void 0,i=void 0},this.getGopForFusion_=function(t){var n,i,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||(n=t.dts-r.dts-r.duration)>=-1e4&&n<=45e3&&(!i||o>n)&&(i=a,o=n));return i?i.gop:null},this.alignGopsAtStart_=function(e){var t,n,i,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=n=0;t<s.length&&n<e.length&&(i=s[t],r=e[n],i.pts!==r.pts);)r.pts>i.pts?t++:(n++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===n?e:n===e.length?null:((l=e.slice(n)).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,n,i,r,a,o,u;for(t=s.length-1,n=e.length-1,a=null,o=!1;t>=0&&n>=0;){if(i=s[t],r=e[n],i.pts===r.pts){o=!0;break}i.pts>r.pts?t--:(t===s.length-1&&(a=n),n--)}if(!o&&null===a)return null;if(0===(u=o?n: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,n,i,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,i=z.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(i.byteLength),s.initSegment.set(i),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++)(n=this.pendingMetadata[r]).cueTime=n.pts,this.keepOriginalTimestamps||(n.cueTime-=o),n.cueTime/=9e4,s.metadata.push(n);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,n,i=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||(n=n||{timelineStartInfo:{baseMediaDecodeTime:i.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new ut(n,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?n||"audio"!==a.tracks[s].type||((n=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new ot(t,e),r.videoSegmentStream.on("timelineStartInfo",function(e){n&&(n.timelineStartInfo=e,r.audioSegmentStream.setEarliestDts(e.dts))}),r.videoSegmentStream.on("processedGopsInfo",i.trigger.bind(i,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",i.trigger.bind(i,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),n&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new ut(n,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(i){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=i),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,ve(n),e.keepOriginalTimestamps||(n.timelineStartInfo.baseMediaDecodeTime=i),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=i)),r.timedMetadataTimestampRolloverStream&&r.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&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,n,i,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(i=6,r=0;r<o;r++)n=a.getUint16(i),i+=2,s.sps.push(new Uint8Array(e.subarray(i,i+n))),i+=n;for(t=e[i],i++,r=0;r<t;r++)n=a.getUint16(i),i+=2,s.pps.push(new Uint8Array(e.subarray(i,i+n))),i+=n;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),n={majorBrand:Tt(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},i=8;i<e.byteLength;)n.compatibleBrands.push(Tt(e.subarray(i,i+4))),i+=4;return n},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:""},n=8;for(n=24;n<e.byteLength;n++){if(0===e[n]){n++;break}t.name+=String.fromCharCode(e[n])}return t.name=decodeURIComponent(escape(t.name)),t},mdat:function(e){return{byteLength:e.byteLength,nals:function(e){var t,n,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[];for(t=0;t+4<e.length;t+=n)if(n=i.getUint32(t),t+=4,n<=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,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,r={version:n.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};return 1===r.version?(i+=4,r.creationTime=St(n.getUint32(i)),i+=8,r.modificationTime=St(n.getUint32(i)),i+=4,r.timescale=n.getUint32(i),i+=8,r.duration=n.getUint32(i)):(r.creationTime=St(n.getUint32(i)),i+=4,r.modificationTime=St(n.getUint32(i)),i+=4,r.timescale=n.getUint32(i),i+=4,r.duration=n.getUint32(i)),i+=4,t=n.getUint16(i),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),n={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(n.streamDescriptor=yt(e.subarray(28))[0]),n},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),n=4,i={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===i.version?(n+=4,i.creationTime=St(t.getUint32(n)),n+=8,i.modificationTime=St(t.getUint32(n)),n+=4,i.timescale=t.getUint32(n),n+=8,i.duration=t.getUint32(n)):(i.creationTime=St(t.getUint32(n)),n+=4,i.modificationTime=St(t.getUint32(n)),n+=4,i.timescale=t.getUint32(n),n+=4,i.duration=t.getUint32(n)),n+=4,i.rate=t.getUint16(n)+t.getUint16(n+2)/16,n+=4,i.volume=t.getUint8(n)+t.getUint8(n+1)/8,n+=2,n+=2,n+=8,i.matrix=new Uint32Array(e.subarray(n,n+36)),n+=36,n+=24,i.nextTrackId=t.getUint32(n),i},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,n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t<e.byteLength;t++)n.samples.push({dependsOn:(48&e[t])>>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return n},sidx:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:n.getUint32(4),timescale:n.getUint32(8),earliestPresentationTime:n.getUint32(12),firstOffset:n.getUint32(16)},r=n.getUint16(22);for(t=24;r;t+=12,r--)i.references.push({referenceType:(128&e[t])>>>7,referencedSize:2147483647&n.getUint32(t),subsegmentDuration:n.getUint32(t+4),startsWithSap:!!(128&e[t+8]),sapType:(112&e[t+8])>>>4,sapDeltaTime:268435455&n.getUint32(t+8)});return i},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,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},r=n.getUint32(4);for(t=8;r;t+=4,r--)i.chunkOffsets.push(n.getUint32(t));return i},stsc:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=n.getUint32(4),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;i;t+=12,i--)r.sampleToChunks.push({firstChunk:n.getUint32(t),samplesPerChunk:n.getUint32(t+4),sampleDescriptionIndex:n.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,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:n.getUint32(4),entries:[]};for(t=12;t<e.byteLength;t+=4)i.entries.push(n.getUint32(t));return i},stts:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},r=n.getUint32(4);for(t=8;r;t+=8,r--)i.timeToSamples.push({sampleCount:n.getUint32(t),sampleDelta:n.getUint32(t+4)});return i},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,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:n.getUint32(4)},r=1&i.flags[2],a=2&i.flags[2],s=8&i.flags[2],o=16&i.flags[2],u=32&i.flags[2],l=65536&i.flags[0],c=131072&i.flags[0];return t=8,r&&(t+=4,i.baseDataOffset=n.getUint32(12),t+=4),a&&(i.sampleDescriptionIndex=n.getUint32(t),t+=4),s&&(i.defaultSampleDuration=n.getUint32(t),t+=4),o&&(i.defaultSampleSize=n.getUint32(t),t+=4),u&&(i.defaultSampleFlags=n.getUint32(t)),l&&(i.durationIsEmpty=!0),!r&&c&&(i.baseDataOffsetIsMoof=!0),i},tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=4,i={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===i.version?(n+=4,i.creationTime=St(t.getUint32(n)),n+=8,i.modificationTime=St(t.getUint32(n)),n+=4,i.trackId=t.getUint32(n),n+=4,n+=8,i.duration=t.getUint32(n)):(i.creationTime=St(t.getUint32(n)),n+=4,i.modificationTime=St(t.getUint32(n)),n+=4,i.trackId=t.getUint32(n),n+=4,n+=4,i.duration=t.getUint32(n)),n+=4,n+=8,i.layer=t.getUint16(n),n+=2,i.alternateGroup=t.getUint16(n),n+=2,i.volume=t.getUint8(n)+t.getUint8(n+1)/8,n+=2,n+=2,i.matrix=new Uint32Array(e.subarray(n,n+36)),n+=36,i.width=t.getUint16(n)+t.getUint16(n+2)/16,n+=4,i.height=t.getUint16(n)+t.getUint16(n+2)/16,i},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,n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&n.flags[2],a=4&n.flags[2],s=1&n.flags[1],o=2&n.flags[1],u=4&n.flags[1],l=8&n.flags[1],c=i.getUint32(4),d=8;for(r&&(n.dataOffset=i.getInt32(d),d+=4),a&&c&&(t={flags:kt(e.subarray(d,d+4))},d+=4,s&&(t.duration=i.getUint32(d),d+=4),o&&(t.size=i.getUint32(d),d+=4),l&&(t.compositionTimeOffset=i.getUint32(d),d+=4),n.samples.push(t),c--);c--;)t={},s&&(t.duration=i.getUint32(d),d+=4),o&&(t.size=i.getUint32(d),d+=4),u&&(t.flags=kt(e.subarray(d,d+4)),d+=4),l&&(t.compositionTimeOffset=i.getUint32(d),d+=4),n.samples.push(t);return n},"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)])}}},Ct={inspect:yt=function(e){for(var t,n,i,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;)n=t.getUint32(s),i=Tt(e.subarray(s+4,s+8)),r=n>1?s+n:e.byteLength,(a=(Et[i]||function(e){return{data:e}})(e.subarray(s+8,r))).size=n,a.type=i,o.push(a),s=r;return o},textify:_t=function(e,t){var n;return t=t||0,n=new Array(2*t+1).join(" "),e.map(function(e,i){return n+e.type+"\n"+Object.keys(e).filter(function(e){return"type"!==e&&"boxes"!==e}).map(function(t){var i=n+" "+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?i+"<"+a.join("").slice(1)+">":i+"<\n"+a.map(function(e){return n+" "+e}).join("\n")+"\n"+n+" >":i+"<>"}return i+JSON.stringify(r,null,2).split("\n").map(function(e,t){return 0===t?e:n+" "+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},wt=ke,Pt=Oe.CaptionStream,At=function(e,t){for(var n=e,i=0;i<t.length;i++){var r=t[i];if(n<r.size)return r;n-=r.size}return null},Rt=function(e,t){var n=W.findBox(e,["moof","traf"]),i={},r=[];return W.findBox(e,["mdat"]).forEach(function(e,t){var i=n[t];r.push({mdat:e,traf:i})}),r.forEach(function(e){var n,r=e.mdat,a=e.traf,s=W.findBox(a,["tfhd"]),o=Ct.parseTfhd(s[0]),u=o.trackId,l=W.findBox(a,["tfdt"]),c=l.length>0?Ct.parseTfdt(l[0]).baseMediaDecodeTime:0,d=W.findBox(a,["trun"]);t===u&&d.length>0&&(n=function(e,t,n){var i,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);i={nalUnitType:"sei_rbsp",size:a,data:l,escapedRBSP:wt(l),trackId:n},c?(i.pts=c.pts,i.dts=c.dts,s=c):(i.pts=s.pts,i.dts=s.dts),u.push(i)}return u}(r,function(e,t,n){var i=t,r=n.defaultSampleDuration||0,a=n.defaultSampleSize||0,s=n.trackId,o=[];return e.forEach(function(e){var t=Ct.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=i,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),e.pts=i+e.compositionTimeOffset,i+=e.duration}),o=o.concat(t)}),o}(d,c,o),u),i[u]||(i[u]=[]),i[u]=i[u].concat(n))}),i},Lt={generator:z,probe:W,Transmuxer:bt.Transmuxer,AudioSegmentStream:bt.AudioSegmentStream,VideoSegmentStream:bt.VideoSegmentStream,CaptionParser:function(){var e,t,n,i,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/i,e.endTime=e.endPts/i,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||n===e[0]&&i===t[n])},this.parse=function(e,a,s){var o;if(!this.isInitialized())return null;if(!a||!s)return null;if(this.isNewInit(a,s))n=a[0],i=s[n];else if(!n||!i)return t.push(e),null;for(;t.length>0;){var u=t.shift();this.parse(u,a,s)}return null!==(o=function(e,t,n){return t?{seiNals:Rt(e,t)[t],timescale:n}:null}(e,n,i))&&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=[],n=null,i=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 n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),xt=function(){function e(t,n){Ot(this,e),this.options=n||{},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 n=t.initSegment;t.initSegment={data:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength};var i=t.data;t.data=i.buffer,e.postMessage({action:"data",segment:t,byteOffset:i.byteOffset,byteLength:i.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))}}(n)}()}),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,n){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(n).toString(16)).slice(-2)})})},Cd=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n={codecCount:0};return n.codecCount=t.split(",").length,n.codecCount=n.codecCount||2,(e=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(t))&&(n.videoCodec=e[2],n.videoObjectTypeIndicator=e[3]),n.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(t),n.audioProfile=n.audioProfile&&n.audioProfile[2],n},wd=function(e,t,n){return e+"/"+t+'; codecs="'+n.filter(function(e){return!!e}).join(", ")+'"'},Pd=function(e,t){var n=function(e){return e.segments&&e.segments.length&&e.segments[0].map?"mp4":"mp2t"}(t),i=function(e){var t=e.attributes||{};return t.CODECS?Cd(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&&!i.audioProfile&&(a||(i.audioProfile=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var n=e.mediaGroups.AUDIO[t];if(!n)return null;for(var i in n){var r=n[i];if(r.default&&r.playlists)return Cd(r.playlists[0].attributes.CODECS).audioProfile}return null}(e,r.AUDIO)),i.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)"),i.audioProfile=kd.audioProfile));var l={};i.videoCodec&&(l.video=""+i.videoCodec+i.videoObjectTypeIndicator),i.audioProfile&&(l.audio="mp4a.40."+i.audioProfile);var c=wd("audio",n,[l.audio]),d=wd("video",n,[l.video]),h=wd("video",n,[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,n){var i=null,r=null,a=0,s=[],o=[];if(!e&&!t)return cs.createTimeRange();if(!e)return t.buffered;if(!t)return e.buffered;if(n)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&&(i=s[c].time):"end"===s[c].type&&1===--a&&(r=s[c].time),null!==i&&null!==r&&(o.push([i,r]),i=null,r=null);return cs.createTimeRanges(o)},Od=function(e){function t(e,n){fc(this,t);var i=gc(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,cs.EventTarget));i.timestampOffset_=0,i.pendingBuffers_=[],i.bufferUpdating_=!1,i.mediaSource_=e,i.codecs_=n,i.audioCodec_=null,i.videoCodec_=null,i.audioDisabled_=!1,i.appendAudioInitSegment_=!0,i.gopBuffer_=[],i.timeMapping_=0,i.safeAppend_=cs.browser.IE_VERSION>=11;var r={remux:!1,alignGopsAtEnd:i.safeAppend_};return i.codecs_.forEach(function(e){Ad(e)?i.audioCodec_=e:Rd(e)&&(i.videoCodec_=e)}),i.transmuxer_=new Sd,i.transmuxer_.postMessage({action:"init",options:r}),i.transmuxer_.onmessage=function(e){return"data"===e.data.action?i.data_(e):"done"===e.data.action?i.done_(e):"gopInfo"===e.data.action?i.appendGopInfo_(e):"videoSegmentTimingInfo"===e.data.action?i.videoSegmentTimingInfo_(e.data.videoSegmentTimingInfo):void 0},Object.defineProperty(i,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(e){"number"==typeof e&&e>=0&&(this.timestampOffset_=e,this.appendAudioInitSegment_=!0,this.gopBuffer_.length=0,this.timeMapping_=0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e}))}}),Object.defineProperty(i,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(e){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=e),this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=e)}}),Object.defineProperty(i,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(i,"buffered",{get:function(){return Ld(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}}),i}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,n){var i=t.player_;if(n.captions&&n.captions.length)for(var r in e.inbandTextTracks_||(e.inbandTextTracks_={}),n.captionStreams)if(!e.inbandTextTracks_[r]){i.tech_.trigger({type:"usage",name:"hls-608"});var a=i.textTracks().getTrackById(r);e.inbandTextTracks_[r]=a||i.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track}n.metadata&&n.metadata.length&&!e.metadataTrack_&&(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=n.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(n){if(e[n+"Codec_"]&&!e[n+"Buffer_"]){var i=null;if(e.mediaSource_[n+"Buffer_"])(i=e.mediaSource_[n+"Buffer_"]).updating=!1;else{var r=n+'/mp4;codecs="'+e[n+"Codec_"]+'"';i=function(e,t){var n=e.addSourceBuffer(t),i=Object.create(null);i.updating=!1,i.realBuffer_=n;var r=function(e){"function"==typeof n[e]?i[e]=function(){return n[e].apply(n,arguments)}:void 0===i[e]&&Object.defineProperty(i,e,{get:function(){return n[e]},set:function(t){return n[e]=t}})};for(var a in n)r(a);return i}(e.mediaSource_.nativeMediaSource_,r),e.mediaSource_[n+"Buffer_"]=i}e[n+"Buffer_"]=i,["update","updatestart","updateend"].forEach(function(r){i.addEventListener(r,function(){if("audio"!==n||!e.audioDisabled_)return"updateend"===r&&(e[n+"Buffer_"].updating=!1),t.every(function(t){return!("audio"!==t||!e.audioDisabled_)||(n===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,n){if(void 0===t||null===t||!e.length)return[];var i=Math.ceil(9e4*(t-n+3)),r=void 0;for(r=0;r<e.length&&!(e[r].pts>i);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,n){if(!t.length)return e;if(n)return t.slice();for(var i=t[0].pts,r=0;r<e.length&&!(e[r].pts>=i);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,n,i){for(var r=Math.ceil(9e4*(t-i)),a=Math.ceil(9e4*(n-i)),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 n in this.inbandTextTracks_)ud(e,t,this.inbandTextTracks_[n])}},{key:"processPendingSegments_",value:function(){var e={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]};e=this.pendingBuffers_.reduce(function(e,t){var n=t.type,i=t.data,r=t.initSegment;return e[n].segments.push(i),e[n].bytes+=i.byteLength,e[n].initSegment=r,t.captions&&(e.captions=e.captions.concat(t.captions)),t.info&&(e[n].info=t.info),t.metadata&&(e.metadata=e.metadata.concat(t.metadata)),e},e),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 t=!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_||(t=!0),cd(this,e.captions,e.metadata),!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(e.audio,this.audioBuffer_),this.pendingBuffers_.length=0,t&&this.trigger("updateend"),this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(e,t){var n=0,i=void 0;if(e.bytes){i=new Uint8Array(e.bytes),e.segments.forEach(function(e){i.set(e,n),n+=e.byteLength});try{t.updating=!0,t.appendBuffer(i)}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(n){function i(){fc(this,i);var n=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),r=void 0;for(r in n.nativeMediaSource_=new e.MediaSource,n.nativeMediaSource_)"handle"===r||r in i.prototype||"function"!=typeof n.nativeMediaSource_[r]||(n[r]=n.nativeMediaSource_[r].bind(n.nativeMediaSource_));return n.duration_=NaN,Object.defineProperty(n,"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(n,"seekable",{get:function(){return this.duration_===1/0?cs.createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}}),Object.defineProperty(n,"readyState",{get:function(){return this.nativeMediaSource_.readyState}}),Object.defineProperty(n,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}}),n.sourceBuffers=[],n.activeSourceBuffers_=[],n.updateActiveSourceBuffers_=function(){if(n.activeSourceBuffers_.length=0,1===n.sourceBuffers.length){var e=n.sourceBuffers[0];return e.appendAudioInitSegment_=!0,e.audioDisabled_=!e.audioCodec_,void n.activeSourceBuffers_.push(e)}for(var t=!1,i=!0,r=0;r<n.player_.audioTracks().length;r++){var a=n.player_.audioTracks()[r];if(a.enabled&&"main"!==a.kind){t=!0,i=!1;break}}n.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,i=!1;else if(!e.videoCodec_&&e.audioCodec_&&(e.audioDisabled_=r?i:!i,e.audioDisabled_))return;n.activeSourceBuffers_.push(e)})},n.onPlayerMediachange_=function(){n.sourceBuffers.forEach(function(e){e.appendAudioInitSegment_=!0})},n.onHlsReset_=function(){n.sourceBuffers.forEach(function(e){e.transmuxer_&&e.transmuxer_.postMessage({action:"resetCaptions"})})},n.onHlsSegmentTimeMapping_=function(e){n.sourceBuffers.forEach(function(t){return t.timeMapping_=e.mapping})},["sourceopen","sourceclose","sourceended"].forEach(function(e){this.nativeMediaSource_.addEventListener(e,this.trigger.bind(this))},n),n.on("sourceopen",function(e){var i=t.querySelector('[src="'+n.url_+'"]');i&&(n.player_=cs(i.parentNode),n.player_&&(n.player_.tech_.on("hls-reset",n.onHlsReset_),n.player_.tech_.on("hls-segment-time-mapping",n.onHlsSegmentTimeMapping_),n.player_.audioTracks&&n.player_.audioTracks()&&(n.player_.audioTracks().on("change",n.updateActiveSourceBuffers_),n.player_.audioTracks().on("addtrack",n.updateActiveSourceBuffers_),n.player_.audioTracks().on("removetrack",n.updateActiveSourceBuffers_)),n.player_.on("mediachange",n.onPlayerMediachange_)))}),n.on("sourceended",function(e){for(var t=ld(n.duration),i=0;i<n.sourceBuffers.length;i++){var r=n.sourceBuffers[i],a=r.metadataTrack_&&r.metadataTrack_.cues;a&&a.length&&(a[a.length-1].endTime=t)}}),n.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_)))}),n}return mc(i,n),pc(i,[{key:"addSeekableRange_",value:function(e,t){var n=void 0;if(this.duration!==1/0)throw(n=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity")).name="InvalidStateError",n.code=11,n;(t>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=t)}},{key:"addSourceBuffer",value:function(e){var t=void 0,n=function(e){var t={type:"",parameters:{}},n=e.trim().split(";");return t.type=n.shift().trim(),n.forEach(function(e){var n=e.trim().split("=");if(n.length>1){var i=n[0].replace(/"/g,"").trim(),r=n[1].replace(/"/g,"").trim();t.parameters[i]=r}}),t}(e);if(/^(video|audio)\/mp2t$/i.test(n.type)){var i=[];n.parameters&&n.parameters.codecs&&(i=n.parameters.codecs.split(","),i=(i=Ed(i)).filter(function(e){return Ad(e)||Rd(e)})),0===i.length&&(i=["avc1.4d400d","mp4a.40.2"]),t=new Od(this,i),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}}]),i}(cs.EventTarget),xd=0;cs.mediaSources={};var Dd=function(e,t){var n=cs.mediaSources[e];if(!n)throw new Error("Media Source not found (Video.js)");n.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 n=void 0;return t instanceof Id?(n=e.URL.createObjectURL(t.nativeMediaSource_),t.url_=n,n):t instanceof Id?(n="blob:vjs-media-source/"+xd,xd++,cs.mediaSources[n]=t,n):(n=e.URL.createObjectURL(t),t.url_=n,n)}};cs.MediaSource=Ud,cs.URL=jd;var Bd=cs.EventTarget,Nd=cs.mergeOptions,Fd=function(e,t){for(var n=void 0,i=Nd(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),r=0;r<t.playlists.length;r++){var a=Sc(i,t.playlists[r]);a?i=a:n=!0}return Tc(t,function(e,t,r,a){if(e.playlists&&e.playlists.length){var s=e.playlists[0].uri,o=Sc(i,e.playlists[0]);o&&((i=o).mediaGroups[t][r][a].playlists[0]=i.playlists[s],n=!1)}}),n?null:i},Vd=function(e){var t=e.byterange.offset+e.byterange.length-1;return e.uri+"-"+e.byterange.offset+"-"+t},Gd=function(e,t){var n,i,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;n=u,i=s,(Boolean(!n.map&&!i.map)||Boolean(n.map&&i.map&&n.map.byterange.offset===i.map.byterange.offset&&n.map.byterange.length===i.map.byterange.length))&&n.uri===i.uri&&n.byterange.offset===i.byterange.offset&&n.byterange.length===i.byterange.length&&(r[o]=t[o])}}return r},Hd=function(e,t,n,i,r){var a={uri:hc(i.handleManifestRedirects,e.resolvedUri),byterange:e.byterange,playlist:t};return n(cs.mergeOptions(a,{responseType:"arraybuffer",headers:Wc(a)}),r)},zd=function(t){function n(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments[3];fc(this,n);var a=gc(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),s=i.withCredentials,o=void 0!==s&&s,u=i.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(n,Bd),pc(n,[{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,n,i){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},n&&(r.state=n),r.trigger("error"),i(t,null);var o=new Uint8Array(s.response),u=uu.parseSidx(o.subarray(8));return i(t,u)}}}},{key:"media",value:function(t){var n=this;if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var i=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,i,function(e,r){if(!e||!r)throw new Error("failed to request sidx");s[o].sidx=r,n.haveMetadata({startingState:i,playlist:e.playlists[t.uri]})}))}else this.mediaRequest_=e.setTimeout(this.haveMetadata.bind(this,{startingState:i,playlist:t}),0)}},{key:"haveMetadata",value:function(e){var t=e.startingState,n=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[n.uri]=n,this.mediaRequest_=null,this.refreshMedia_(n.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 n=this;e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.minimumUpdatePeriodTimeout_);var i=this.media();if(t){var r=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=e.setTimeout(function(){return n.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 n="placeholder-uri-"+t;e.playlists[t].uri=n,e.playlists[n]=e.playlists[t]}return Tc(e,function(t,n,i,r){if(t.playlists&&t.playlists.length){var a="placeholder-uri-"+n+"-"+i+"-"+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,n){if(t.request){if(t.request=null,e)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,n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now(),t.srcUrl=hc(t.handleManifestRedirects,t.srcUrl,n),t.syncClientServerClock_(t.onClientServerClockSync_.bind(t))}})}},{key:"syncClientServerClock_",value:function(e){var t=this,n=tu(this.masterXml_);return null===n?(this.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===n.method?(this.clientOffset_=n.value-Date.now(),e()):void(this.request=this.hls_.xhr({uri:dc(this.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials},function(i,r){if(t.request){if(i)return t.clientOffset_=t.masterLoaded_-Date.now(),e();var a=void 0;a="HEAD"===n.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(n,i){if(t.request){if(t.request=null,n)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,t.sidxMapping_=function(e,t,n,i){var r=eu(e,{manifestUri:t,clientOffset:n}),a=Gd(r.playlists,i);return Tc(r,function(e,t,n,r){if(e.playlists&&e.playlists.length){var s=e.playlists;a=Nd(a,Gd(s,i))}}),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(n,i){if(!n||!i)throw new Error("failed to request sidx on minimumUpdatePeriod");t.sidxMapping_[s].sidx=i,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 n=this;if(!t)throw new Error("refreshMedia_ must take a media uri");var i=void 0,r=void 0;this.masterPlaylistLoader_?(i=this.masterPlaylistLoader_.master,r=this.masterPlaylistLoader_.parseMasterXml()):(i=this.master,r=this.parseMasterXml());var a=Fd(i,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(){n.trigger("mediaupdatetimeout")},Cc(this.media(),!!a))),this.trigger("loadedplaylist")}}]),n}(),qd=function(e){return cs.log.debug?cs.log.debug.bind(cs,"VHS:",e+" >"):function(){}};function Wd(){}var Kd=function(){function e(t,n,i,r){fc(this,e),this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=t,this.processedAppend_=!1,this.type_=i,this.mimeType_=n,this.logger_=qd("SourceUpdater["+i+"]["+n+"]"),"closed"===t.readyState?t.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,n,r)):this.createSourceBuffer_(n,r)}return pc(e,[{key:"createSourceBuffer_",value:function(e,t){var n=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(e),this.logger_("created SourceBuffer"),t&&(t.trigger("sourcebufferadded"),this.mediaSource.sourceBuffers.length<2)?t.on("sourcebufferadded",function(){n.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 n=this;this.processedAppend_=!0,this.queueCallback_(function(){e.videoSegmentTimingInfoCallback&&n.sourceBuffer_.addEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback),n.sourceBuffer_.appendBuffer(e.bytes)},function(){e.videoSegmentTimingInfoCallback&&n.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 n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Wd;this.processedAppend_&&this.queueCallback_(function(){n.logger_("remove ["+e+" => "+t+"]"),n.sourceBuffer_.removing=!0,n.sourceBuffer_.remove(e,t)},i)}},{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,n){var i=0,r=!1;return function(a,s){if(!r)return a?(r=!0,Qd(e),n(a,s)):(i+=1)===e.length?(s.endOfAllRequests=Date.now(),s.encryptedBytes?function(e,t,n){e.addEventListener("message",function i(r){if(r.data.source===t.requestId){e.removeEventListener("message",i);var a=r.data.decrypted;return t.bytes=new Uint8Array(a.bytes,a.byteOffset,a.byteLength),n(null,t)}});var i=void 0;i=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:i,iv:t.key.iv}),[t.encryptedBytes.buffer,i.buffer])}(t,s,n):n(null,s)):void 0}},th=function(e,t){return function(n){var i,r,a;return e.stats=cs.mergeOptions(e.stats,(r=(i=n).target,(a={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-r.requestTime||0}).bytesReceived=i.loaded,a.bandwidth=Math.floor(a.bytesReceived/a.roundTripTime*8*1e3),a)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(n,e)}},nh=function(e,t,n,i,r,a,s){var o=[],u=eh(o,n,s);if(r.key&&!r.key.bytes){var l=e(cs.mergeOptions(t,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),function(e,t){return function(n,i){var r=i.response,a=Zd(n,i);if(a)return t(a,e);if(16!==r.byteLength)return t({status:i.status,message:"Invalid HLS key at URL: "+i.uri,code:Xd,xhr:i},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,n){return function(i,r){var a=r.response,s=Zd(i,r);return s?n(s,e):0===a.byteLength?n({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=iu.timescale(e.map.bytes),e.map.videoTrackIds=iu.videoTrackIds(e.map.bytes),n(null,e))}}(r,i,u));o.push(c)}var d=e(cs.mergeOptions(t,{uri:r.resolvedUri,responseType:"arraybuffer",headers:Wc(r)}),function(e,t,n){return function(i,r){var a=r.response,s=Zd(i,r),o=void 0;return s?n(s,e):0===a.byteLength?n({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)),n(null,e))}}(r,i,u));return d.addEventListener("progress",th(r,a)),o.push(d),function(){return Qd(o)}},ih=function(t,n){var i;return t&&(i=e.getComputedStyle(t))?i[n]:""},rh=function(e,t){var n=e.slice();e.sort(function(e,i){var r=t(e,i);return 0===r?n.indexOf(e)-n.indexOf(i):r})},ah=function(t,n){var i=void 0,r=void 0;return t.attributes.BANDWIDTH&&(i=t.attributes.BANDWIDTH),i=i||e.Number.MAX_VALUE,n.attributes.BANDWIDTH&&(r=n.attributes.BANDWIDTH),i-(r=r||e.Number.MAX_VALUE)},sh=function(e){return"number"==typeof e&&isFinite(e)},oh=function(t){function n(e){fc(this,n);var t=gc(this,(n.__proto__||Object.getPrototypeOf(n)).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(n,t),pc(n,[{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 n=Jc(e),i=this.initSegments_[n];return t&&!i&&e.bytes&&(this.initSegments_[n]=i={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,timescales:e.timescales,videoTrackIds:e.videoTrackIds}),i||e}},{key:"segmentKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var n=Qc(e),i=this.keyCache_[n];this.cacheEncryptionKeys_&&t&&!i&&e.bytes&&(this.keyCache_[n]=i={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(i||e).resolvedUri};return i&&(r.bytes=i.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 n=this.playlist_,i=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.hasPlayed_()||(e.syncInfo={mediaSequence:e.mediaSequence,time:0});var r=null;if(n&&(n.id?r=n.id:n.uri&&(r=n.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(n&&n.uri===e.uri){var a=e.mediaSequence-n.mediaSequence;this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex&&(this.mediaIndex-=a),i&&(i.mediaIndex-=a,i.mediaIndex>=0&&(i.segment=e.segments[i.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(n,e)}else null!==this.mediaIndex&&this.resyncLoader()}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(e,t){this.mimeType_||(this.mimeType_=e,this.sourceBufferEmitter_=t,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(e){this.ended_=!1,this.resetLoader(),this.remove(0,this.duration_(),e),this.captionParser_&&this.captionParser_.clearAllCaptions(),this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1,this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null,this.syncPoint_=null,this.abort()}},{key:"remove",value:function(e,t,n){if(this.sourceUpdater_&&this.sourceUpdater_.remove(e,t,n),ud(e,t,this.segmentMetadataTrack_),this.inbandTextTracks_)for(var i in this.inbandTextTracks_)ud(e,t,this.inbandTextTracks_[i])}},{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,n){if(!e||!t)return!1;var i=n===e.segments.length;return e.endList&&"open"===t.readyState&&i}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.playlist_,this.mediaSource_,e)&&!this.sourceUpdater_.updating()}},{key:"checkBuffer_",value:function(e,t,n,i,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(!i&&u>=1)return null;if(null===a)return n=this.getSyncSegmentCandidate_(t),this.generateSegmentInfo_(t,n,null,!0);if(null!==n){var l=t.segments[n];return o=l&&l.end?l.end:s,this.generateSegmentInfo_(t,n+1,o,!1)}if(this.fetchAtBuffer_){var c=Gc.getMediaInfoForTime(t,s,a.segmentIndex,a.time);n=c.mediaIndex,o=c.startTime}else{var d=Gc.getMediaInfoForTime(t,r,a.segmentIndex,a.time);n=d.mediaIndex,o=d.startTime}return this.generateSegmentInfo_(t,n,o,!1)}},{key:"getSyncSegmentCandidate_",value:function(e){var t=this;if(-1===this.currentTimeline_)return 0;var n=e.segments.map(function(e,t){return{timeline:e.timeline,segmentIndex:t}}).filter(function(e){return e.timeline===t.currentTimeline_});return n.length?n[Math.min(n.length-1,1)].segmentIndex:Math.max(e.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(e,t,n,i){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:i,startOfSegment:n,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_(),n=e.bandwidth,i=this.pendingSegment_.duration,r=Gc.estimateSegmentRequestTime(i,n,this.playlist_,e.bytesReceived),a=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return((e.length?e.end(e.length-1):0)-t)/n}(this.buffered_(),t,this.hls_.tech_.playbackRate())-1;if(r<=a)return!1;var s=function(e){var t=e.master,n=e.currentTime,i=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,n)?1:2;return{playlist:e,rebufferingImpact:Gc.estimateSegmentRequestTime(a,i,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:n,duration:this.duration_(),segmentDuration:i,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=nh(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,n){var i=void 0;return i=e.length&&e.start(0)>0&&e.start(0)<t?e.start(0):t-30,Math.min(i,t-n)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}},{key:"createSimplifiedSegmentObj_",value:function(e){var t=e.segment,n={resolvedUri:t.resolvedUri,byterange:t.byterange,requestId:e.requestId};if(t.key){var i=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=i}return t.map&&(n.map=this.initSegment(t.map)),n}},{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,n){for(var i in n)if(!e[i]){t.trigger({type:"usage",name:"hls-608"});var r=t.textTracks().getTrackById(i);e[i]=r||t.addRemoteTextTrack({kind:"captions",id:i,label:i},!1).track}}(this.inbandTextTracks_,this.hls_.tech_,e.captionStreams),function(e){var t=e.inbandTextTracks,n=e.captionArray,i=e.timestampOffset;if(n){var r=window.WebKitDataCue||window.VTTCue;n.forEach(function(e){var n=e.stream,a=e.startTime,s=e.endTime;t[n]&&(a+=i,s+=i,t[n].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_,n=t.segment,i=this.syncController_.probeSegmentInfo(t);void 0===this.startingMedia_&&i&&(i.containsAudio||i.containsVideo)&&(this.startingMedia_={containsAudio:i.containsAudio,containsVideo:i.containsVideo});var r,a,s,o=(r=this.loaderType_,a=this.startingMedia_,s=i,"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",n.map){var l=Jc(n.map);if(!this.activeInitSegmentId_||this.activeInitSegmentId_!==l){var c=this.initSegment(n.map);this.sourceUpdater_.appendBuffer({bytes:c.bytes},function(){e.activeInitSegmentId_=l})}}t.byteLength=t.bytes.byteLength,"number"==typeof n.start&&"number"==typeof n.end?this.mediaSecondsLoaded+=n.end-n.start:this.mediaSecondsLoaded+=n.duration,this.logger_(function(e){var t=e.segment,n=t.start,i=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+"]","["+n+" => "+i+"] 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 n=this.pendingSegment_.segment;n.videoTimingInfo||(n.videoTimingInfo={}),n.videoTimingInfo.transmuxerPrependedSeconds=t.videoSegmentTimingInfo.prependedContentDuration||0,n.videoTimingInfo.transmuxedPresentationStart=t.videoSegmentTimingInfo.start.presentation,n.videoTimingInfo.transmuxedPresentationEnd=t.videoSegmentTimingInfo.end.presentation,n.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,n=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():(n&&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,n=Date.now()-e.endOfAllRequests+1,i=Math.floor(e.byteLength/n*8*1e3);this.throughput.rate+=(i-t)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(t){if(this.segmentMetadataTrack_){var n=t.segment,i=n.start,r=n.end;if(sh(i)&&sh(r)){ud(i,r,this.segmentMetadataTrack_);var a=e.WebKitDataCue||e.VTTCue,s={custom:n.custom,dateTimeObject:n.dateTimeObject,dateTimeString:n.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:i,end:r},o=new a(i,r,JSON.stringify(s));o.value=s,this.segmentMetadataTrack_.addCue(o)}}}}]),n}(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 n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};fc(this,n);var i=gc(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return i.mediaSource_=null,i.subtitlesTrack_=null,i}return mc(n,oh),pc(n,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return cs.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,n=e[e.length-1].startTime;return cs.createTimeRanges([[t,n]])}},{key:"initSegment",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var n=Jc(e),i=this.initSegments_[n];if(t&&!i&&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_[n]=i={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return i||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 n=this.pendingSegment_,i=n.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)}i.requested=!0;try{this.parseVTTCues_(n)}catch(e){return this.error({message:e.message}),this.state="READY",this.pause(),this.trigger("error")}if(this.updateTimeMapping_(n,this.syncController_.timelines[n.timeline],this.playlist_),n.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");n.byteLength=n.bytes.byteLength,this.mediaSecondsLoaded+=i.duration,n.cues.length&&this.remove(n.cues[0].endTime,n.cues[n.cues.length-1].endTime),n.cues.forEach(function(e){t.subtitlesTrack_.addCue(e)}),this.handleUpdateEnd_()}else this.state="READY"}},{key:"parseVTTCues_",value:function(t){var n=void 0,i=!1;"function"==typeof e.TextDecoder?n=new e.TextDecoder("utf8"):(n=e.WebVTT.StringDecoder(),i=!0);var r=new e.WebVTT.Parser(e,e.vttjs,n);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;i&&(a=uh(a)),r.parse(a)}var s=t.bytes;i&&(s=uh(s)),r.parse(s),r.flush()}},{key:"updateTimeMapping_",value:function(e,t,n){var i=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}),!n.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:Math.min(s,o-i.duration)}}}else i.empty=!0}}]),n}(),dh=function(e,t){for(var n=e.cues,i=0;i<n.length;i++){var r=n[i];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null},hh=Zl,fh=[{name:"VOD",run:function(e,t,n,i,r){if(n!==1/0){return{time:0,segmentIndex:0}}return null}},{name:"ProgramDateTime",run:function(e,t,n,i,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,n,i,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===i&&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,n,i,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,n,i,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,n,i){var r=this.runStrategies_(e,t,n,i);return r.length?this.selectSyncPoint_(r,{key:"time",value:i}):null}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments)return null;var n=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!n.length)return null;var i=this.selectSyncPoint_(n,{key:"segmentIndex",value:0});return i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+Lc(e,i.segmentIndex,0))}},{key:"runStrategies_",value:function(e,t,n,i){for(var r=[],a=0;a<fh.length;a++){var s=fh[a],o=s.run(this,e,t,n,i);o&&(o.strategy=s.name,r.push({strategy:s.name,syncPoint:o}))}return r}},{key:"selectSyncPoint_",value:function(e,t){for(var n=e[0].syncPoint,i=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<i&&(i=s,n=e[a].syncPoint,r=e[a].strategy)}return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+r+"]: [time:"+n.time+", segmentIndex:"+n.segmentIndex+"]"),n}},{key:"saveExpiredSegmentInfo",value:function(e,t){for(var n=t.mediaSequence-e.mediaSequence-1;n>=0;n--){var i=e.segments[n];if(i&&void 0!==i.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:i.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,n=e.playlist,i=void 0;return(i=t.map?this.probeMp4Segment_(e):this.probeTsSegment_(e))&&this.calculateSegmentTimeMapping_(e,i)&&(this.saveDiscontinuitySyncInfo_(e),n.syncInfo||(n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:t.start})),i}},{key:"probeMp4Segment_",value:function(e){var t=e.segment,n=iu.timescale(t.map.bytes),i=iu.startTime(n,e.bytes);return null!==e.timestampOffset&&(e.timestampOffset-=i),{start:i,end:i+t.duration}}},{key:"probeTsSegment_",value:function(e){var t=hh(e.bytes,this.inspectCache_),n=void 0,i=void 0;return t?(t.video&&2===t.video.length?(this.inspectCache_=t.video[1].dts,n=t.video[0].dtsTime,i=t.video[1].dtsTime):t.audio&&2===t.audio.length&&(this.inspectCache_=t.audio[1].dts,n=t.audio[0].dtsTime,i=t.audio[1].dtsTime),{start:n,end:i,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 n=e.segment,i=this.timelines[e.timeline];if(null!==e.timestampOffset)i={time:e.startOfSegment,mapping:e.startOfSegment-t.start},this.timelines[e.timeline]=i,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+i.time+"] [mapping: "+i.mapping+"]"),n.start=e.startOfSegment,n.end=t.end+i.mapping;else{if(!i)return!1;n.start=t.start+i.mapping,n.end=t.end+i.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(e){var t=e.playlist,n=e.segment;if(n.discontinuity)this.discontinuities[n.timeline]={time:n.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var i=0;i<t.discontinuityStarts.length;i++){var r=t.discontinuityStarts[i],a=t.discontinuitySequence+i+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?n.start-Lc(t,e.mediaIndex,r):n.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 n=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 n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},r=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],n=e[1],i=t[4],r=n[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;!i[s];s^=c||1,o=l[o]||1)for(h=(h=o^o<<1^o<<2^o<<3^o<<4)>>8^255&h^99,i[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,n[a][h]=p=p<<24^p>>>8;for(a=0;a<5;a++)t[a]=t[a].slice(0),n[a]=n[a].slice(0);return e},a=null,s=function(){function t(n){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 i=void 0,s=void 0,o=void 0,u=void 0,l=void 0,c=this._tables[0][4],d=this._tables[1],h=n.length,f=1;if(4!==h&&6!==h&&8!==h)throw new Error("Invalid aes key size");for(u=n.slice(0),l=[],this._key=[u,l],i=h;i<4*h+28;i++)o=u[i-1],(i%h==0||8===h&&i%h==4)&&(o=c[o>>>24]<<24^c[o>>16&255]<<16^c[o>>8&255]<<8^c[255&o],i%h==0&&(o=o<<8^o>>>24^f<<24,f=f<<1^283*(f>>7))),u[i]=u[i-h]^o;for(s=0;i;s++,i--)o=u[3&s?i:i-4],l[s]=i<=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,n,i,r,a){var s=this._key[1],o=e^s[0],u=i^s[1],l=n^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 n=this.listeners[e].indexOf(t);return this.listeners[e].splice(n,1),n>-1},t.prototype.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var n=t.length,i=0;i<n;++i)t[i].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 n(){e(this,n);var r=i(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)}(n,t),n.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},n.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},n}(o),l=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},c=function(){function n(t,i,r,a){e(this,n);var s=n.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),i,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),i,r,c));this.asyncStream_.push(function(){var e;a(null,(e=c).subarray(0,e.byteLength-e[e.byteLength-1]))})}return n.prototype.decryptChunk_=function(e,t,n,i){return function(){var r=function(e,t,n){var i=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=n[0],c=n[1],d=n[2],h=n[3],v=0;v<i.length;v+=4)f=l(i[v]),p=l(i[v+1]),m=l(i[v+2]),g=l(i[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,n);i.set(r,e.byteOffset)}},t(n,null,[{key:"STEP",get:function(){return 32e3}}]),n}();new function(e){e.onmessage=function(t){var n=t.data,i=new Uint8Array(n.encrypted.bytes,n.encrypted.byteOffset,n.encrypted.byteLength),r=new Uint32Array(n.key.bytes,n.key.byteOffset,n.key.byteLength/4),a=new Uint32Array(n.iv.bytes,n.iv.byteOffset,n.iv.byteLength/4);new c(i,r,a,function(t,i){var r,a;e.postMessage((r={source:n.source,decrypted:i},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),[i.buffer])})}}(n)}()}),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 n=t.segmentLoaders[e],i=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;vh(n,i);var a=i.activeTrack(),s=i.activeGroup(),o=(s.filter(function(e){return e.default})[0]||s[0]).id,u=i.tracks[o];if(a!==u){for(var l in cs.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),i.tracks)i.tracks[l].enabled=i.tracks[l]===u;i.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var n=t.segmentLoaders[e],i=t.mediaTypes[e];cs.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),vh(n,i);var r=i.activeTrack();r&&(r.mode="disabled"),i.onTrackChanged()}}},bh={AUDIO:function(e,t,n){if(t){var i=n.tech,r=n.requestOptions,a=n.segmentLoaders[e];t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,r),(!i.paused()||e.endList&&"none"!==i.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),r),i.paused()||a.load()}),t.on("error",_h[e](e,n))}},SUBTITLES:function(e,t,n){var i=n.tech,r=n.requestOptions,a=n.segmentLoaders[e],s=n.mediaTypes[e];t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!i.paused()||e.endList&&"none"!==i.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),r),i.paused()||a.load()}),t.on("error",_h[e](e,n))}},Th={AUDIO:function(e,t){var n=t.hls,i=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 wc(f.resolvedUri,n,a):f.playlists&&"dash"===i?new zd(f.playlists[0],n,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 n=t.tech,i=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 wc(p.resolvedUri,i,s):"dash"===r&&(m=new zd(p.playlists[0],i,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=n.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 n=t.tech,i=t.master.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in i[e])for(var u in a[o]||(a[o]=[]),i[e][o]){var l=i[e][o][u];if(l.instreamId.match(/CC\d/)&&(a[o].push(cs.mergeOptions({id:u},l)),void 0===s[u])){var c=n.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 n=t.mediaTypes[e].tracks;for(var i in n)if(n[i].enabled)return n[i];return null}},SUBTITLES:function(e,t){return function(){var n=t.mediaTypes[e].tracks;for(var i in n)if("showing"===n[i].mode)return n[i];return null}}},kh=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){Th[t](t,e)});var t=e.mediaTypes,n=e.masterPlaylistLoader,i=e.tech,r=e.hls;["AUDIO","SUBTITLES"].forEach(function(n){t[n].activeGroup=function(e,t){return function(n){var i=t.masterPlaylistLoader,r=t.mediaTypes[e].groups,a=i.media();if(!a)return null;var s=null;return a.attributes[e]&&(s=r[a.attributes[e]]),s=s||r.main,void 0===n?s:null===n?null:s.filter(function(e){return e.id===n.id})[0]||null}}(n,e),t[n].activeTrack=Sh[n](n,e),t[n].onGroupChanged=function(e,t){return function(){var n=t.segmentLoaders,i=n[e],r=n.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.activeGroup(s),u=a.activePlaylistLoader;vh(i,a),o&&(o.playlistLoader?(i.resyncLoader(),yh(o.playlistLoader,a)):u&&r.resetEverything())}}(n,e),t[n].onTrackChanged=function(e,t){return function(){var n=t.segmentLoaders,i=n[e],r=n.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.activeGroup(s),u=a.activePlaylistLoader;vh(i,a),o&&(o.playlistLoader?u!==o.playlistLoader?(i.track&&i.track(s),i.resetEverything(),yh(o.playlistLoader,a)):yh(o.playlistLoader,a):r.resetEverything())}}(n,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(),n.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(e){return t[e].onGroupChanged()})});var o=function(){t.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"hls-audio-change"})};for(var u in i.audioTracks().addEventListener("change",o),i.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",function(){i.audioTracks().removeEventListener("change",o),i.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),i.clearTracks("audio"),t.AUDIO.tracks)i.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},Ch=void 0,wh=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],Ph=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},Ah=function(t){function n(e){fc(this,n);var t=gc(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),i=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(!i)throw new Error("A non-empty playlist URL is required");Ch=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(i,t.hls_,t.requestOptions_):new wc(i,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_(),wh.forEach(function(e){t[e+"_"]=Ph.bind(t,e)}),t.logger_=qd("MPC"),t.masterPlaylistLoader_.load(),t}return mc(n,t),pc(n,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var t=e.masterPlaylistLoader_.media(),n=1.5*t.targetDuration*1e3;Vc(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=n,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 n=void 0;return e.enableLowInitialPlaylist&&(n=e.selectInitialPlaylist()),n||(n=e.selectPlaylist()),e.initialMedia_=n,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 i=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?i():e.tech_.one("durationchange",t)})}else i()}}),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(),n=1.5*t.targetDuration*1e3;Vc(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=n,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 n=e.mediaGroups||{},i=!0,r=Object.keys(n.AUDIO);for(var a in n.AUDIO)for(var s in n.AUDIO[a]){n.AUDIO[a][s].uri||(i=!1)}i&&this.tech_.trigger({type:"usage",name:"hls-demuxed"}),Object.keys(n.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"}),Ch.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"hls-aes"}),Ch.Playlist.isFmp4(t)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"}),r.length&&Object.keys(n.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(),n=e.masterPlaylistLoader_.media(),i=e.tech_.buffered(),r=i.length?i.end(i.length-1)-e.tech_.currentTime():0,a=e.bufferLowWaterLine();(!n.endList||e.duration()<$d.MAX_BUFFER_LOW_WATER_LINE||t.attributes.BANDWIDTH<n.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 n=this.seekable();if(!n.length)return!1;if(cs.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",function(){e.trigger("firstplay"),e.seekTo_(n.end(0)),e.hasPlayed_=function(){return!0}}),!1;this.trigger("firstplay"),this.seekTo_(n.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 n=Ch.Playlist.playlistEnd(e,t),i=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return n-i<=.1;var a=r.end(r.length-1);return a-i<=.1&&n-a<=.1}},{key:"blacklistCurrentPlaylist",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1],i=void 0;if(i=t.playlist||this.masterPlaylistLoader_.media(),n=n||t.blacklistDuration||this.blacklistDuration,!i){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")),i.excludeUntil=Date.now()+1e3*n,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:Ch.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 n=this.masterPlaylistLoader_.media();if(n){var i=this.syncController_.getExpiredTime(n,this.mediaSource.duration);if(null!==i&&0!==(e=Ch.Playlist.seekable(n,i)).length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(n=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(n,this.mediaSource.duration)))return;if(0===(t=Ch.Playlist.seekable(n,i)).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,n=Ch.Playlist.duration(this.masterPlaylistLoader_.media()),i=this.tech_.buffered(),r=function t(){e.logger_("Setting duration from "+e.mediaSource.duration+" => "+n);try{e.mediaSource.duration=n}catch(e){cs.log.warn("Failed to set media source duration",e)}e.tech_.trigger("durationchange"),e.mediaSource.removeEventListener("sourceopen",t)};i.length>0&&(n=Math.max(n,i.end(i.length-1))),t!==n&&("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 n=e.mediaTypes_[t].groups;for(var i in n)n[i].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 n;t.attributes.CODECS&&e.MediaSource&&e.MediaSource.isTypeSupported&&!e.MediaSource.isTypeSupported('video/mp4; codecs="'+(n=t.attributes.CODECS,n.replace(/avc1\.(\d+)\.(\d+)/i,function(e){return Ed([e])[0]}))+'"')&&(t.excludeUntil=1/0)})}},{key:"excludeIncompatibleVariants_",value:function(e){var t=2,n=null,i=void 0;e.attributes.CODECS&&(i=Cd(e.attributes.CODECS),n=i.videoCodec,t=i.codecCount),this.master().playlists.forEach(function(e){var i={codecCount:2,videoCodec:null};e.attributes.CODECS&&(i=Cd(e.attributes.CODECS)),i.codecCount!==t&&(e.excludeUntil=1/0),i.videoCodec!==n&&(e.excludeUntil=1/0)})}},{key:"updateAdCues_",value:function(t){var n=0,i=this.seekable();i.length&&(n=i.start(0)),function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t.segments)for(var r=i,a=void 0,s=0;s<t.segments.length;s++){var o=t.segments[s];if(a||(a=dh(n,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),n.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,n.addCue(a)}r+=o.duration}}(t,this.cueTagsTrack_,n)}},{key:"goalBufferLength",value:function(){var e=this.tech_.currentTime(),t=$d.GOAL_BUFFER_LENGTH,n=$d.GOAL_BUFFER_LENGTH_RATE,i=Math.max(t,$d.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*n,i)}},{key:"bufferLowWaterLine",value:function(){var e=this.tech_.currentTime(),t=$d.BUFFER_LOW_WATER_LINE,n=$d.BUFFER_LOW_WATER_LINE_RATE,i=Math.max(t,$d.MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*n,i)}}]),n}(cs.EventTarget),Rh=function e(t,n,i){fc(this,e);var r,a,s,o=t.masterPlaylistController_,u=o[(t.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(o);if(n.attributes.RESOLUTION){var l=n.attributes.RESOLUTION;this.width=l.width,this.height=l.height}this.bandwidth=n.attributes.BANDWIDTH,this.id=i,this.enabled=(r=t.playlists,a=n.uri,s=u,function(e){var t=r.master.playlists[a],n=Bc(t),i=Nc(t);return void 0===e?i:(e?delete t.disabled:t.disabled=!0,e===i||n||(s(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})},Lh=["seeking","seeked","pause","playing","error"],Oh=function(){function t(n){var i=this;fc(this,t),this.tech_=n.tech,this.seekable=n.seekable,this.seekTo=n.seekTo,this.allowSeeksWithinUnsafeLiveWindow=n.allowSeeksWithinUnsafeLiveWindow,this.media=n.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=qd("PlaybackWatcher"),this.logger_("initialize");var r=function(){return i.monitorCurrentTime_()},a=function(){return i.techWaiting_()},s=function(){return i.cancelTimer_()},o=function(){return i.fixesBadSeeks_()};this.tech_.on("seekablechanged",o),this.tech_.on("waiting",a),this.tech_.on(Lh,s),this.tech_.on("canplay",r),this.dispose=function(){i.logger_("dispose"),i.tech_.off("seekablechanged",o),i.tech_.off("waiting",a),i.tech_.off(Lh,s),i.tech_.off("canplay",r),i.checkCurrentTimeTimeout_&&e.clearTimeout(i.checkCurrentTimeTimeout_),i.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(),n=void 0;this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(n=e.end(e.length-1));this.beforeSeekableWindow_(e,t)&&(n=e.start(0)+.1);return void 0!==n&&(this.logger_("Trying to seek outside of seekable at time "+t+" with seekable range "+sd(e)+". Seeking to "+n+"."),this.seekTo(n),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),n=rd(t,e);return n.length&&e+3<=n.end(0)?(this.cancelTimer_(),this.seekTo(e),this.logger_("Stopped at "+e+" while inside a buffered region ["+n.start(0)+" -> "+n.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 n=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+n),this.cancelTimer_(),this.seekTo(n),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var i=this.tech_.buffered(),r=ad(i,t);if(this.videoUnderflow_(r,i,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,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!e.length)return!1;var r=e.end(e.length-1)+.1;return!n.endList&&i&&(r=e.end(e.length-1)+3*n.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,n){if(0===e.length){var i=this.gapFromVideoUnderflow_(t,n);if(i)return this.logger_("Encountered a gap in video from "+i.start+" to "+i.end+". Seeking to current time "+n),!0}return!1}},{key:"skipTheGap_",value:function(e){var t=this.tech_.buffered(),n=this.tech_.currentTime(),i=ad(t,n);this.cancelTimer_(),0!==i.length&&n===e&&(this.logger_("skipTheGap_:","currentTime:",n,"scheduled currentTime:",e,"nextRange start:",i.start(0)),this.seekTo(i.start(0)+1/30),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))}},{key:"gapFromVideoUnderflow_",value:function(e,t){for(var n=function(e){if(e.length<2)return cs.createTimeRanges();for(var t=[],n=1;n<e.length;n++){var i=e.end(n-1),r=e.start(n);t.push([i,r])}return cs.createTimeRanges(t)}(e),i=0;i<n.length;i++){var r=n.start(i),a=n.end(i);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,n){var i=0,r=0,a=cs.mergeOptions(Ih,n);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()-i<1e3*a.errorInterval)t.trigger({type:"usage",name:"hls-error-reload-canceled"});else{if(a.getSource&&"function"==typeof a.getSource)return i=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(n){l(),e(t,n)}}(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:wc,Playlist:Gc,Decrypter:cc,AsyncStream:oc,decrypt:lc,utils:ed,STANDARD_PLAYLIST_SELECTOR:function(){return function(t,n,i,r,a){var s=t.playlists.map(function(t){var n,i;return n=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width,i=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height,{bandwidth:t.attributes.BANDWIDTH||e.Number.MAX_VALUE,width:n,height:i,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<n}),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===i&&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>i||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(ih(this.tech_.el(),"width"),10),parseInt(ih(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 Cd(e.attributes.CODECS).videoCodec})[0]||null},comparePlaylistBandwidth:ah,comparePlaylistResolution:function(t,n){var i=void 0,r=void 0;return t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(i=t.attributes.RESOLUTION.width),i=i||e.Number.MAX_VALUE,n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width&&(r=n.attributes.RESOLUTION.width),i===(r=r||e.Number.MAX_VALUE)&&t.attributes.BANDWIDTH&&n.attributes.BANDWIDTH?t.attributes.BANDWIDTH-n.attributes.BANDWIDTH:i-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 n=t.media(),i=-1,r=0;r<e.length;r++)if(e[r].id===n.uri){i=r;break}e.selectedIndex_=i,e.trigger({selectedIndex:i,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 n=function(e,t,n){if(!e)return e;var i={};for(var r in e)i[r]={audioContentType:'audio/mp4; codecs="'+n.attributes.CODECS+'"',videoContentType:'video/mp4; codecs="'+t.attributes.CODECS+'"'},t.contentProtection&&t.contentProtection[r]&&t.contentProtection[r].pssh&&(i[r].pssh=t.contentProtection[r].pssh),"string"==typeof e[r]&&(i[r].url=e[r]);return cs.mergeOptions(e,i)}(e.source_.keySystems,e.playlists.media(),e.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader.media());n&&(t.currentSource().keySystems=n,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 n(e,i,r){fc(this,n);var a=gc(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,i,r.hls));if(i.options_&&i.options_.playerId){var s=cs(i.options_.playerId);s.hasOwnProperty("hls")||Object.defineProperty(s,"hls",{get:function(){return cs.log.warn("player.hls is deprecated. Use player.tech().hls instead."),i.trigger({type:"usage",name:"hls-player-access"}),a},configurable:!0}),s.vhs=a,s.dash=a,a.player_=s}if(a.tech_=i,a.source_=e,a.stats={},a.setOptions_(),a.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks)i.overrideNativeAudioTracks(!0),i.overrideNativeVideoTracks(!0);else if(a.options_.overrideNative&&(i.featuresNativeVideoTracks||i.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 n=t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement;n&&n.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(n,Nh),pc(n,[{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 n=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){n.tech_.setCurrentTime(e),n.setCurrentTime(e)},this.masterPlaylistController_=new Ah(this.options_),this.playbackWatcher_=new Oh(cs.mergeOptions(this.options_,{seekable:function(){return n.seekable()},media:function(){return n.masterPlaylistController_.media()}})),this.masterPlaylistController_.on("error",function(){cs.players[n.tech_.options_.playerId].error(n.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 n.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return n.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return n.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return n.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return n.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return n.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return n.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return n.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return od(n.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return n.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return n.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return n.tech_.name_},enumerable:!0},duration:{get:function(){return n.tech_.duration()},enumerable:!0},master:{get:function(){return n.playlists.master},enumerable:!0},playerDimensions:{get:function(){return n.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return od(n.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return n.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",function(){n.options_.useBandwidthFromLocalStorage&&function(e){if(!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:n.bandwidth,throughput:Math.round(n.throughput)})}),this.masterPlaylistController_.on("selectedinitialmedia",function(){var e,t;t=(e=n).playlists,e.representations=function(){return t.master.playlists.filter(function(e){return!Bc(e)}).map(function(t,n){return new Rh(e,t,t.uri)})},jh(n)}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.tech_.ready(function(){return n.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,n;t=e.qualityLevels_,(n=e).representations().forEach(function(e){t.addQualityLevel(e)}),Uh(t,n.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,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):void 0}(n.prototype.__proto__||Object.getPrototypeOf(n.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 n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return nd({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:i,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}]),n}(),Vh={name:"videojs-http-streaming",VERSION:"1.10.3",canHandleSource:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=cs.mergeOptions(cs.options,t);return Vh.canPlayType(e.type,n)},handleSource:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=cs.mergeOptions(cs.options,n);return t.hls=new Fh(e,t,i),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]:{},n=cs.mergeOptions(cs.options,t).hls.overrideNative,i=Mh(e);return i&&(!Dh.supportsTypeNatively(i)||n)?"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,n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};return function(t){var i,r;i=n,r=function(e){var t,n,i={},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,n){a.call(this,t,n),this.loadOptions(),this.resetState(),this.player().one("ready",this.setupUI.bind(this));var i=e.ImageCaptureEngine;try{this.engine=new i(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(n,i){try{return n(e.engine.imageCaptureByIdAndCanvasDom(e.player().id(),t))}catch(e){return i(e)}})}}),n=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(i,r),c=this;c.ready(function(){var t;t=u,e.mergeOptions(i,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 n(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,n){var i={className:"vjs-"+e+"-control vjs-control vjs-button",innerHTML:'<span aria-hidden="true" class="vjs-icon-'+n+'"></span><span class="vjs-control-text" aria-live="polite">'+t+"</span>"},r={title:t,type:"button","aria-disabled":"false"};return a.prototype.createEl("button",i,r)}("snapshot",c.localize("Snapshot"),"spinner"),name:"SnapButton"}),c.cameraButton.show()};return r("snapshot",o),o},t.exports?t.exports=r(e):i.returnExports=r(i.videojs),function(n,i){t.exports?t.exports=i(e):n.returnExports=i(n.videojs)}(n,function(e){var t=e.getComponent("Component");e.ImageCaptureEngine=e.extend(t,{constructor:function(e,n){t.call(this,e,n)},formatTag:function(e){if(e&&0!==(e=e.trim()).length)return e},getDomByIdAndTag:function(e,t){t=this.formatTag(t);var n=document.getElementById(e);if(t&&0!==t.trim().length)return n.tagName.toUpperCase()===t.toUpperCase()?n:n.getElementsByTagName(t)[0]},getScreenContainerDomByIdAndTag:function(e,t){if(t=this.formatTag(t))return this.getDomByIdAndTag(e,t);var n=this.getDomByIdAndTag(e,"object");return n||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 n;return e&&e.tagName.toUpperCase()==="object".toUpperCase()?n=e.vjs_snap():(this.drawCanvas(t,e),n=t.toDataURL("image/png")),n},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,n,i){function r(s,o){if(!n[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=n[s]={exports:{}};t[s][0].call(c.exports,function(e){return r(t[s][1][e]||e)},c,c.exports,e,t,n,i)}return n[s].exports}for(var a="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}}()({1:[function(e,t,n){(function(i,r){!function(e,i){"object"==typeof n&&void 0!==t?t.exports=i():e.ES6Promise=i()}(this,function(){"use strict";function t(e){return"function"==typeof e}var n=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!==i&&"[object process]"==={}.toString.call(i),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 n=this,i=new this.constructor(C);void 0===i[E]&&F(i);var r=n._state;if(r){var a=arguments[r-1];u(function(){return B(r,i,a,n._result)})}else U(n,i,e,t);return i}function k(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(C);return I(t,e),t}h?T=function(){return i.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 C(){}var w=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,n,i){n.constructor===e.constructor&&i===S&&n.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,n):i===R?(M(e,R.error),R.error=null):void 0===i?D(e,n):t(i)?function(e,t,n){u(function(e){var i=!1,r=function(e,t,n,i){try{e.call(t,n,i)}catch(e){return e}}(n,t,function(n){i||(i=!0,t!==n?I(e,n):D(e,n))},function(t){i||(i=!0,M(e,t))},e._label);!i&&r&&(i=!0,M(e,r))},e)}(e,n,i):D(e,n)}function I(e,t){var n,i;e===t?M(e,new TypeError("You cannot resolve a promise with itself")):(i=typeof(n=t),null===n||"object"!==i&&"function"!==i?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===w&&(e._result=t,e._state=P,0!==e._subscribers.length&&u(j,e))}function M(e,t){e._state===w&&(e._state=A,e._result=t,u(x,e))}function U(e,t,n,i){var r=e._subscribers,a=r.length;e._onerror=null,r[a]=t,r[a+P]=n,r[a+A]=i,0===a&&e._state&&u(j,e)}function j(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var i=void 0,r=void 0,a=e._result,s=0;s<t.length;s+=3)i=t[s],r=t[s+n],i?B(n,i,r,a):r(a);e._subscribers.length=0}}function B(e,n,i,r){var a=t(i),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}}(i,r))===R?(l=!0,o=s.error,s.error=null):u=!0,n===s)return void M(n,new TypeError("A promises callback cannot return that same promise."))}else s=r,u=!0;n._state!==w||(a&&u?I(n,s):l?M(n,o):e===P?D(n,s):e===A&&M(n,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(C),this.promise[E]||F(this.promise),n(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===w&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,i=n.resolve;if(i===k){var r=L(e);if(r===S&&e._state!==w)this._settledAt(e._state,t,e._result);else if("function"!=typeof r)this._remaining--,this._result[t]=e;else if(n===G){var a=new n(C);O(a,e,r),this._willSettleAt(a,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(i(e),t)},e.prototype._settledAt=function(e,t,n){var i=this.promise;i._state===w&&(this._remaining--,e===A?M(i,n):this._result[t]=n),0===this._remaining&&D(i,this._result)},e.prototype._willSettleAt=function(e,t){var n=this;U(e,void 0,function(e){return n._settledAt(P,t,e)},function(e){return n._settledAt(A,t,e)})},e}();var G=function(){function e(t){this[E]=N++,this._result=this._state=void 0,this._subscribers=[],C!==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 n=this.constructor;return t(e)?this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.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 n(e)?new t(function(n,i){for(var r=e.length,a=0;a<r;a++)t.resolve(e[a]).then(n,i)}):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(C);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 n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!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,n){function i(){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=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.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},i.prototype.emit=function(e){var t,n,i,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(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),i=(l=n.slice()).length,u=0;u<i;u++)l[u].apply(this,o);return!0},i.prototype.addListener=function(e,t){var n;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&&(n=s(this._maxListeners)?i.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[e].length>n&&(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},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var n,i,s,o;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(n=this._events[e]).length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(o=s;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){i=o;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,n;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(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},{}],3:[function(e,t,n){var i,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(i===setTimeout)return setTimeout(e,0);if((i===s||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:s}catch(e){i=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 n=1;n<arguments.length;n++)t[n-1]=arguments[n];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,n){var i=arguments[3],r=arguments[4],a=arguments[5],s=JSON.stringify;t.exports=function(e,t){for(var n,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){n=c;break}}if(!n){n=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[n]=["function(require,module,exports){"+e+"(self); }",h]}var f=Math.floor(Math.pow(16,8)*Math.random()).toString(16),p={};p[n]=n,r[f]=["function(require,module,exports){var f = require("+s(n)+");(f.default ? f.default : f)(self);}",p];var m={};!function e(t){m[t]=!0;for(var n in r[t][1]){var i=r[t][1][n];m[i]||e(i)}}(f);var g="("+i+")({"+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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.createDefaultConfig=function(){return Object.assign({},i)};var i=n.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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=e("../io/io-controller.js"),s=(i=a)&&i.__esModule?i:{default:i},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 n=e.videoElement.canPlayType(t);return"probably"===n||"maybe"==n}},{key:"getFeatureList",value:function(){var t={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!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.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t}}]),e}();n.default=u},{"../config.js":5,"../io/io-controller.js":23}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 i(e,[{key:"isComplete",value:function(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&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;return null!=this.mimeType&&null!=this.duration&&null!=this.metadata&&null!=this.hasKeyframesIndex&&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,n=this._search(t.times,e);return{index:n,milliseconds:t.times[n],fileposition:t.filepositions[n]}}},{key:"_search",value:function(e,t){var n=0,i=e.length-1,r=0,a=0,s=i;for(t<e[0]&&(n=0,a=s+1);a<=s;){if((r=a+Math.floor((s-a)/2))===i||t>=e[r]&&t<e[r+1]){n=r;break}e[r]<t?a=r+1:s=r-1}return n}}]),e}();n.default=r},{}],8:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.SampleInfo=function e(t,n,i,a,s){r(this,e),this.dts=t,this.pts=n,this.duration=i,this.originalDts=a,this.isSyncPoint=s,this.fileposition=null},n.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 i(e,[{key:"appendSyncPoint",value:function(e){e.isSyncPoint=!0,this.syncPoints.push(e)}}]),e}(),n.IDRSampleList=function(){function e(){r(this,e),this._list=[]}return i(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,n=0,i=t.length-1,r=0,a=0,s=i;for(e<t[0].dts&&(n=0,a=s+1);a<=s;){if((r=a+Math.floor((s-a)/2))===i||e>=t[r].dts&&e<t[r+1].dts){n=r;break}t[r].dts<e?a=r+1:s=r-1}return this._list[n]}}]),e}(),n.MediaSegmentInfoList=function(){function e(t){r(this,e),this._type=t,this._list=[],this._lastAppendLocation=-1}return i(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 n=t.length-1,i=0,r=0,a=n,s=0;if(e<t[0].originalBeginDts)return s=-1;for(;r<=a;){if((i=r+Math.floor((a-r)/2))===n||e>t[i].lastSample.originalDts&&e<t[i+1].originalBeginDts){s=i;break}t[i].originalBeginDts<e?r=i+1:a=i-1}return s}},{key:"_searchNearestSegmentAfter",value:function(e){return this._searchNearestSegmentBefore(e)+1}},{key:"append",value:function(e){var t=this._list,n=e,i=this._lastAppendLocation,r=0;-1!==i&&i<t.length&&n.originalBeginDts>=t[i].lastSample.originalDts&&(i===t.length-1||i<t.length-1&&n.originalBeginDts<t[i+1].originalBeginDts)?r=i+1:t.length>0&&(r=this._searchNearestSegmentBefore(n.originalBeginDts)+1),this._lastAppendLocation=r,this._list.splice(r,0,n)}},{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),n=this._list[t].syncPoints;0===n.length&&t>0;)t--,n=this._list[t].syncPoints;return n.length>0?n[n.length-1]:null}},{key:"type",get:function(){return this._type}},{key:"length",get:function(){return this._list.length}}]),e}()},{}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 i(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 n=this._pendingSegments[t];n.splice(0,n.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var i=this._sourceBuffers[t];if(i){if("closed"!==e.readyState){try{e.removeSourceBuffer(i)}catch(e){a.default.e(this.TAG,e.message)}i.removeEventListener("error",this.e.onSourceBufferError),i.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 n=e,i=""+n.container;n.codec&&n.codec.length>0&&(i+=";codecs="+n.codec);var r=!1;if(a.default.v(this.TAG,"Received Initialization Segment, mimeType: "+i),this._lastInitSegments[n.type]=n,i!==this._mimeTypes[n.type]){if(this._mimeTypes[n.type])a.default.v(this.TAG,"Notice: "+n.type+" mimeType changed, origin: "+this._mimeTypes[n.type]+", target: "+i);else{r=!0;try{var u=this._sourceBuffers[n.type]=this._mediaSource.addSourceBuffer(i);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[n.type]=i}t||this._pendingSegments[n.type].push(n),r||this._sourceBuffers[n.type]&&!this._sourceBuffers[n.type].updating&&this._doAppendSegments(),s.default.safari&&"audio/mpeg"===n.container&&n.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=n.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 n=this._sourceBuffers[t.type];!n||n.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()}},{key:"seek",value:function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var n=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{n.abort()}catch(e){a.default.e(this.TAG,e.message)}this._idrList.clear();var i=this._pendingSegments[t];if(i.splice(0,i.length),"closed"!==this._mediaSource.readyState){for(var r=0;r<n.buffered.length;r++){var o=n.buffered.start(r),u=n.buffered.end(r);this._pendingRemoveRanges[t].push({start:o,end:u})}if(n.updating||this._doRemoveRanges(),s.default.safari){var l=this._lastInitSegments[t];l&&(this._pendingSegments[t].push(l),n.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 n=this._sourceBuffers[t];if(n){var i=n.buffered;if(i.length>=1&&e-i.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 n=this._sourceBuffers[t];if(n){for(var i=n.buffered,r=!1,a=0;a<i.length;a++){var s=i.start(a),o=i.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&&!n.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,n=this._pendingMediaDuration;n>0&&(isNaN(t)||n>t)&&(a.default.v(this.TAG,"Update MediaSource duration from "+t+" to "+n),this._mediaSource.duration=n),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],n=this._pendingRemoveRanges[e];n.length&&!t.updating;){var i=n.shift();t.remove(i.start,i.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 n=e[t].shift();if(n.timestampOffset){var i=this._sourceBuffers[t].timestampOffset,r=n.timestampOffset/1e3;Math.abs(i-r)>.1&&(a.default.v(this.TAG,"Update MPEG audio timestampOffset from "+i+" to "+r),this._sourceBuffers[t].timestampOffset=r),delete n.timestampOffset}if(!n.data||0===n.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(n.data),this._isBufferFull=!1,"video"===t&&n.hasOwnProperty("info")&&this._idrList.appendArray(n.info.syncPoints)}catch(e){this._pendingSegments[t].unshift(n),22===e.code?(this._isBufferFull||this._emitter.emit(o.default.BUFFER_FULL),this._isBufferFull=!0):(a.default.e(this.TAG,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.length>0||e.audio.length>0}},{key:"_hasPendingRemoveRanges",value:function(){var e=this._pendingRemoveRanges;return e.video.length>0||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}();n.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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.default={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"}},{}],11:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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(n,i){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,i.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:[n,i]}),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(n,i)}else this._controller=new o.default(n,i);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 i(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 n=this;Promise.resolve().then(function(){n._emitter.emit(u.default.INIT_SEGMENT,e,t)}).catch(function(){})}},{key:"_onMediaSegment",value:function(e,t){var n=this;Promise.resolve().then(function(){n._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 n=this;Promise.resolve().then(function(){n._emitter.emit(u.default.IO_ERROR,e,t)}).catch(function(){})}},{key:"_onDemuxError",value:function(e,t){var n=this;Promise.resolve().then(function(){n._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,n=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,n.type,n.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(n,c.default.prototype),this._emitter.emit(t.msg,n);break;case u.default.METADATA_ARRIVED:case u.default.SCRIPTDATA_ARRIVED:case u.default.STATISTICS_INFO:this._emitter.emit(t.msg,n);break;case u.default.IO_ERROR:case u.default.DEMUX_ERROR:this._emitter.emit(t.msg,n.type,n.info);break;case u.default.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,n);break;case"logcat_callback":a.default.emitter.emit("log",n.type,n.logcat)}}}]),t}();n.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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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,n){!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=n,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 i=0;this._mediaDataSource.segments.forEach(function(e){e.timestampBase=i,i+=e.duration,e.cors=t.cors,e.withCredentials=t.withCredentials,n.referrerPolicy&&(e.referrerPolicy=n.referrerPolicy)}),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return i(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 n=this._mediaDataSource.segments[e],i=this._ioctl=new d.default(n,this._config,e);i.onError=this._onIOException.bind(this),i.onSeeked=this._onIOSeeked.bind(this),i.onComplete=this._onIOComplete.bind(this),i.onRedirect=this._onIORedirect.bind(this),i.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):i.onDataArrival=this._onInitChunkArrival.bind(this),i.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 n=this._mediaInfo.segments[t];if(void 0==n)this._pendingSeekTime=e;else{var i=n.getNearestKeyframe(e);this._remuxer.seek(i.milliseconds),this._ioctl.seek(i.fileposition),this._pendingResolveSeekPoint=i.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,n=t.length-1,i=0;i<t.length;i++)if(e<t[i].timestampBase){n=i-1;break}return n}},{key:"_onInitChunkArrival",value:function(e,t){var n=this,i=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((i=u.default.probe(e)).match){this._demuxer=new u.default(i,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 i=null,a.default.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(function(){n._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 n=Object.assign({},e);Object.setPrototypeOf(n,o.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=n,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 n=t.info.syncPoints,i=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,s.default.safari&&n.length>0&&n[0].originalDts===i&&(i=n[0].pts),this._emitter.emit(h.default.RECOMMEND_SEEKPOINT,i)}}},{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],n=Object.assign({},t);n.duration=this._mediaInfo.duration,n.segmentCount=this._mediaInfo.segmentCount,delete n.segments,delete n.keyframesIndex,this._emitter.emit(h.default.MEDIA_INFO,n)}},{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}();n.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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});o(e("../utils/logger.js"));var i=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}}n.default=function(e){var t=null,n=function(t,n){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:n}})}.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,n){e.postMessage({msg:s.default.IO_ERROR,data:{type:t,info:n}})}.bind(this)),t.on(s.default.DEMUX_ERROR,function(t,n){e.postMessage({msg:s.default.DEMUX_ERROR,data:{type:t,info:n}})}.bind(this)),t.on(s.default.INIT_SEGMENT,function(t,n){var i={msg:s.default.INIT_SEGMENT,data:{type:t,data:n}};e.postMessage(i,[n.data])}.bind(this)),t.on(s.default.MEDIA_SEGMENT,function(t,n){var i={msg:s.default.MEDIA_SEGMENT,data:{type:t,data:n}};e.postMessage(i,[n.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 n={msg:s.default.MEDIA_INFO,data:t};e.postMessage(n)}.bind(this)),t.on(s.default.METADATA_ARRIVED,function(t){var n={msg:s.default.METADATA_ARRIVED,data:t};e.postMessage(n)}.bind(this)),t.on(s.default.SCRIPTDATA_ARRIVED,function(t){var n={msg:s.default.SCRIPTDATA_ARRIVED,data:t};e.postMessage(n)}.bind(this)),t.on(s.default.STATISTICS_INFO,function(t){var n={msg:s.default.STATISTICS_INFO,data:t};e.postMessage(n)}.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;i.default.applyConfig(o),!0===o.enableCallback?i.default.addLogListener(n):i.default.removeLogListener(n)}})}},{"../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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 i(e,null,[{key:"parseScriptData",value:function(t,n,i){var r={};try{var a=e.parseValue(t,n,i),s=e.parseValue(t,n+a.size,i-a.size);r[a.data]=s.data}catch(e){}return r}},{key:"parseObject",value:function(t,n,i){if(i<3)throw new s.IllegalStateException("Data not enough when parse ScriptDataObject");var r=e.parseString(t,n,i),a=e.parseValue(t,n+r.size,i-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,n,i){return e.parseObject(t,n,i)}},{key:"parseString",value:function(e,t,n){if(n<2)throw new s.IllegalStateException("Data not enough when parse String");var i=new DataView(e,t,n).getUint16(0,!l);return{data:i>0?(0,a.default)(new Uint8Array(e,t+2,i)):"",size:2+i}}},{key:"parseLongString",value:function(e,t,n){if(n<4)throw new s.IllegalStateException("Data not enough when parse LongString");var i=new DataView(e,t,n).getUint32(0,!l);return{data:i>0?(0,a.default)(new Uint8Array(e,t+4,i)):"",size:4+i}}},{key:"parseDate",value:function(e,t,n){if(n<10)throw new s.IllegalStateException("Data size invalid when parse Date");var i=new DataView(e,t,n),r=i.getFloat64(0,!l),a=i.getInt16(8,!l);return{data:new Date(r+=60*a*1e3),size:10}}},{key:"parseValue",value:function(t,n,i){if(i<1)throw new s.IllegalStateException("Data not enough when parse Value");var a=new DataView(t,n,i),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,n+1,i-1);c=h.data,o+=h.size;break;case 3:c={};var f=0;for(9==(16777215&a.getUint32(i-4,!l))&&(f=3);o<i-4;){var p=e.parseObject(t,n+o,i-o-f);if(p.objectEnd)break;c[p.data.name]=p.data.value,o+=p.size}if(o<=i-3)9===(16777215&a.getUint32(o-1,!l))&&(o+=3);break;case 8:c={},o+=4;var m=0;for(9==(16777215&a.getUint32(i-4,!l))&&(m=3);o<i-8;){var g=e.parseVariable(t,n+o,i-o-m);if(g.objectEnd)break;c[g.data.name]=g.data.value,o+=g.size}if(o<=i-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,n+o,i-o);c.push(_.data),o+=_.size}break;case 11:var b=e.parseDate(t,n+1,i-1);c=b.data,o+=b.size;break;case 12:var T=e.parseString(t,n+1,i-1);c=T.data,o+=T.size;break;default:o=i,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}();n.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"../utils/utf8-conv.js":44}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.default={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},{}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 i(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),n=new Uint8Array(4);n.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(n.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 n=this._current_word_bits_left?this._current_word:0;n>>>=32-this._current_word_bits_left;var i=e-this._current_word_bits_left;this._fillCurrentWord();var a=Math.min(i,this._current_word_bits_left),s=this._current_word>>>32-a;return this._current_word<<=a,this._current_word_bits_left-=a,n=n<<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}();n.default=a},{"../utils/exception.js":40}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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 n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=d(e("../utils/logger.js")),s=d(e("./amf-parser.js")),o=d(e("./sps-parser.js")),u=d(e("./demux-errors.js")),l=d(e("../core/media-info.js")),c=e("../utils/exception.js");function d(e){return e&&e.__esModule?e:{default:e}}var h=function(){function e(t,n){var i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="FLVDemuxer",this._config=n,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 l.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=(i=new ArrayBuffer(2),new DataView(i).setInt16(0,256,!0),256===new Int16Array(i)[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 l.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,n){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new c.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var i=0,r=this._littleEndian;if(0===n){if(!(t.byteLength>13))return 0;i=e.probe(t).dataOffset}this._firstParse&&(this._firstParse=!1,n+i!==this._dataOffset&&a.default.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==new DataView(t,i).getUint32(0,!r)&&a.default.w(this.TAG,"PrevTagSize0 !== 0 !!!"),i+=4);for(;i<t.byteLength;){this._dispatch=!0;var s=new DataView(t,i);if(i+11+4>t.byteLength)break;var o=s.getUint8(0),u=16777215&s.getUint32(0,!r);if(i+11+u+4>t.byteLength)break;if(8===o||9===o||18===o){var l=s.getUint8(4),d=s.getUint8(5),h=s.getUint8(6)|d<<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=i+11;switch(o){case 8:this._parseAudioData(t,f,u,h);break;case 9:this._parseVideoData(t,f,u,h,n+i);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),i+=11+u+4}else a.default.w(this.TAG,"Unsupported tag type "+o+", skipped"),i+=11+u+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),i}},{key:"_parseScriptData",value:function(e,t,n){var r=s.default.parseScriptData(e,t,n);if(r.hasOwnProperty("onMetaData")){if(null==r.onMetaData||"object"!==i(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"===i(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=[],n=[],i=1;i<e.times.length;i++){var r=this._timestampBase+Math.floor(1e3*e.times[i]);t.push(r),n.push(e.filepositions[i])}return{times:t,filepositions:n}}},{key:"_parseAudioData",value:function(e,t,n,i){if(n<=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,n).getUint8(0),s=r>>>4;if(2===s||10===s){var o=0,l=(12&r)>>>2;if(l>=0&&l<=4){o=this._flvSoundRateTable[l];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,n-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+i,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,n-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,n-1,!1);if(void 0==b)return;var T=this._timestampBase+i,S={unit:b,length:b.byteLength,dts:T,pts:T};h.samples.push(S),h.length+=b.length}}else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+l)}else this._onError(u.default.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+s)}}},{key:"_parseAACAudioData",value:function(e,t,n){if(!(n<=1)){var i={},r=new Uint8Array(e,t,n);return i.packetType=r[0],0===r[0]?i.data=this._parseAACAudioSpecificConfig(e,t+1,n-1):i.data=r.subarray(1),i}a.default.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")}},{key:"_parseAACAudioSpecificConfig",value:function(e,t,n){var i,r,a=new Uint8Array(e,t,n),s=null,o=0,l=null;if(o=i=a[0]>>>3,(r=(7&a[0])<<1|a[1]>>>7)<0||r>=this._mpegSamplingRates.length)this._onError(u.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&&(l=(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),l=r-3):(o=2,s=new Array(2),l=r):-1!==h.indexOf("android")?(o=2,s=new Array(2),l=r):(o=5,l=r,s=new Array(4),r>=6?l=r-3:1===d&&(o=2,s=new Array(2),l=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&l)>>>1,s[2]=(1&l)<<7,s[2]|=8,s[3]=0),{config:s,samplingRate:c,channelCount:d,codec:"mp4a.40."+o,originalCodec:"mp4a.40."+i}}this._onError(u.default.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}}},{key:"_parseMP3AudioData",value:function(e,t,n,i){if(!(n<4)){this._littleEndian;var r=new Uint8Array(e,t,n),s=null;if(i){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,n,i,r){if(n<=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,n)[0],o=(240&s)>>>4,l=15&s;7===l?this._parseAVCVideoPacket(e,t+1,n-1,i,r,o):this._onError(u.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+l)}}},{key:"_parseAVCVideoPacket",value:function(e,t,n,i,r,s){if(n<4)a.default.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var o=this._littleEndian,l=new DataView(e,t,n),c=l.getUint8(0),d=(16777215&l.getUint32(0,!o))<<8>>8;if(0===c)this._parseAVCDecoderConfigurationRecord(e,t+4,n-4);else if(1===c)this._parseAVCVideoData(e,t+4,n-4,i,r,s,d);else if(2!==c)return void this._onError(u.default.FORMAT_ERROR,"Flv: Invalid video packet type "+c)}}},{key:"_parseAVCDecoderConfigurationRecord",value:function(e,t,n){if(n<7)a.default.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var i=this._videoMetadata,r=this._videoTrack,s=this._littleEndian,l=new DataView(e,t,n);if(i){if(void 0!==i.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),(i=this._videoMetadata={}).type="video",i.id=r.id,i.timescale=this._timescale,i.duration=this._duration;var c=l.getUint8(0),d=l.getUint8(1);l.getUint8(2),l.getUint8(3);if(1===c&&0!==d)if(this._naluLengthSize=1+(3&l.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var h=31&l.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=l.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){i.codecWidth=v.codec_size.width,i.codecHeight=v.codec_size.height,i.presentWidth=v.present_size.width,i.presentHeight=v.present_size.height,i.profile=v.profile_string,i.level=v.level_string,i.bitDepth=v.bit_depth,i.chromaFormat=v.chroma_format,i.sarRatio=v.sar_ratio,i.frameRate=v.frame_rate,!1!==v.frame_rate.fixed&&0!==v.frame_rate.fps_num&&0!==v.frame_rate.fps_den||(i.frameRate=this._referenceFrameRate);var y=i.frameRate.fps_den,_=i.frameRate.fps_num;i.refSampleDuration=i.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}i.codec=T;var E=this._mediaInfo;E.width=i.codecWidth,E.height=i.codecHeight,E.fps=i.frameRate.fps,E.profile=i.profile,E.level=i.level,E.refFrames=v.ref_frames,E.chromaFormat=v.chroma_format_string,E.sarNum=i.sarRatio.width,E.sarDen=i.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 C=l.getUint8(f);if(0!==C){C>1&&a.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+C),f++;for(var w=0;w<C;w++){var P=l.getUint16(f,!s);f+=2,0!==P&&(f+=P)}i.avcc=new Uint8Array(n),i.avcc.set(new Uint8Array(e,t,n),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",i)}else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(u.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}}},{key:"_parseAVCVideoData",value:function(e,t,n,i,r,s,o){for(var u=this._littleEndian,l=new DataView(e,t,n),c=[],d=0,h=0,f=this._naluLengthSize,p=this._timestampBase+i,m=1===s;h<n;){if(h+4>=n){a.default.w(this.TAG,"Malformed Nalu near timestamp "+p+", offset = "+h+", dataSize = "+n);break}var g=l.getUint32(h,!u);if(3===f&&(g>>>=8),g>n-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:"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),n={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return n;var i,r,a=(4&t[4])>>>2!=0,s=0!=(1&t[4]),o=(i=t)[r=5]<<24|i[r+1]<<16|i[r+2]<<8|i[r+3];return o<9?n:{match:!0,consumed:o,dataOffset:o,hasAudioTrack:a,hasVideoTrack:s}}}]),e}();n.default=h},{"../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}],19:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=e("./exp-golomb.js"),s=(i=a)&&i.__esModule?i:{default:i};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,n=t.byteLength,i=new Uint8Array(n),r=0,a=0;a<n;a++)a>=2&&3===t[a]&&0===t[a-1]&&0===t[a-2]||(i[r]=t[a],r++);return new Uint8Array(i.buffer,0,r)}},{key:"parseSPS",value:function(t){var n=e._ebsp2rbsp(t),i=new s.default(n);i.readByte();var r=i.readByte();i.readByte();var a=i.readByte();i.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=i.readUEG())&&i.readBits(1),l<=3&&(c=[0,420,422,444][l]),d=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool()))for(var h=3!==l?8:12,f=0;f<h;f++)i.readBool()&&(f<6?e._skipScalingList(i,16):e._skipScalingList(i,64));i.readUEG();var p=i.readUEG();if(0===p)i.readUEG();else if(1===p){i.readBits(1),i.readSEG(),i.readSEG();for(var m=i.readUEG(),g=0;g<m;g++)i.readSEG()}var v=i.readUEG();i.readBits(1);var y=i.readUEG(),_=i.readUEG(),b=i.readBits(1);0===b&&i.readBits(1),i.readBits(1);var T=0,S=0,k=0,E=0;i.readBool()&&(T=i.readUEG(),S=i.readUEG(),k=i.readUEG(),E=i.readUEG());var C=1,w=1,P=0,A=!0,R=0,L=0;if(i.readBool()){if(i.readBool()){var O=i.readByte();O>0&&O<16?(C=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][O-1],w=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][O-1]):255===O&&(C=i.readByte()<<8|i.readByte(),w=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){var I=i.readBits(32),x=i.readBits(32);A=i.readBool(),P=(R=x)/(L=2*I)}}var D=1;1===C&&1===w||(D=C/w);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 i.destroy(),i=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:C,height:w},codec_size:{width:j,height:B},present_size:{width:N,height:B}}}},{key:"_skipScalingList",value:function(e,t){for(var n=8,i=8,r=0;r<t;r++)0!==i&&(i=(n+e.readSEG()+256)%256),n=0===i?n:i}},{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}();n.default=o},{"./exp-golomb.js":17}],20:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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 n=e;if(null==n||"object"!==(void 0===n?"undefined":i(n)))throw new h.InvalidArgumentException("MediaDataSource must be an javascript object!");if(!n.hasOwnProperty("type"))throw new h.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");switch(n.type){case"flv":return new o.default(n,t);default:return new u.default(n,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"}}),n.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,n){"use strict";t.exports=e("./flv.js").default},{"./flv.js":20}],22:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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 n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"fetch-stream-loader"));return i.TAG="FetchStreamLoader",i._seekHandler=e,i._config=n,i._needStash=!0,i._requestAbort=!1,i._contentLength=null,i._receivedLength=0,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.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,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function(e,t){var n=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"===i(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"===i(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(n._requestAbort){try{var t=e.body.getReader();t&&t.cancel()}catch(e){}return n._requestAbort=!1,void(n._status=s.LoaderStatus.kIdle)}if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==a.url&&n._onURLRedirect){var i=n._seekHandler.removeURLParameters(e.url);n._onURLRedirect(i)}var r=e.headers.get("Content-Length");return null!=r&&(n._contentLength=parseInt(r),0!==n._contentLength&&n._onContentLengthKnown&&n._onContentLengthKnown(n._contentLength)),n._pump.call(n,e.body.getReader())}if(n._status=s.LoaderStatus.kError,!n._onError)throw new o.RuntimeException("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);n._onError(s.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})}).catch(function(e){if(n._status=s.LoaderStatus.kError,!n._onError)throw e;n._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(n){if(n.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=s.LoaderStatus.kError;var i=s.LoaderErrors.EARLY_EOF,r={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new o.RuntimeException(r.msg);t._onError(i,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=n.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 n=0,i=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(n=s.LoaderErrors.EXCEPTION,i={code:e.code,msg:e.message}):(n=s.LoaderErrors.EARLY_EOF,i={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new o.RuntimeException(i.msg);t._onError(n,i)}})}}]),t}();n.default=l},{"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],23:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="IOController",this._config=n,this._extraData=i,this._stashInitialSize=393216,void 0!=n.stashInitialSize&&n.stashInitialSize>0&&(this._stashInitialSize=n.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===n.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 i(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",n=e.seekParamEnd||"bend";this._seekHandler=new h.default(t,n)}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 n={from:e,to:-1};this._currentRange={from:n.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,n),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 n=new ArrayBuffer(t);if(this._stashUsed>0){var i=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(n,0,t).set(i,0)}this._stashBuffer=n,this._bufferSize=t}}},{key:"_normalizeSpeed",value:function(e){var t=this._speedNormalizeList,n=t.length-1,i=0,r=0,a=n;if(e<t[0])return t[0];for(;r<=a;){if((i=r+Math.floor((a-r)/2))===n||e>=t[i]&&e<t[i+1])return t[i];t[i]<e?r=i+1:a=i-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 n=1024*t+1048576;this._bufferSize<n&&this._expandBuffer(n),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,n){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 i=this._speedSampler.lastSecondKBps;if(0!==i){var r=this._normalizeSpeed(i);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),n=this._dispatchChunks(t,this._stashByteStart),i=t.byteLength-n;if(n<t.byteLength){if(!e){if(n>0){var a=new Uint8Array(this._stashBuffer,0,this._bufferSize),s=new Uint8Array(t,n);a.set(s,0),this._stashUsed=s.byteLength,this._stashByteStart+=n}return 0}r.default.w(this.TAG,i+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,i}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 n=this._currentRange.to+1;return void(n<this._totalLength&&(r.default.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(n,!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}();n.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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.BaseLoader=n.LoaderErrors=n.LoaderStatus=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=e("../utils/exception.js");var a=n.LoaderStatus={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4};n.LoaderErrors={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},n.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 i(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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._startName=t,this._endName=n}return i(e,[{key:"getConfig",value:function(e,t){var n=e;if(0!==t.from||-1!==t.to){var i=!0;-1===n.indexOf("?")&&(n+="?",i=!1),i&&(n+="&"),n+=this._startName+"="+t.from.toString(),-1!==t.to&&(n+="&"+this._endName+"="+t.to.toString())}return{url:n,headers:{}}}},{key:"removeURLParameters",value:function(e){var t=e.split("?")[0],n=void 0,i=e.indexOf("?");-1!==i&&(n=e.substring(i+1));var r="";if(void 0!=n&&n.length>0)for(var a=n.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}();n.default=r},{}],26:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 i(e,[{key:"getConfig",value:function(e,t){var n={};if(0!==t.from||-1!==t.to){var i=void 0;i=-1!==t.to?"bytes="+t.from.toString()+"-"+t.to.toString():"bytes="+t.from.toString()+"-",n.Range=i}else this._zeroStart&&(n.Range="bytes=0-");return{url:e,headers:n}}},{key:"removeURLParameters",value:function(e){return e}}]),e}();n.default=r},{}],27:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 i(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}();n.default=r},{}],28:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=e("../utils/logger.js"),s=((i=a)&&i.__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,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):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 n={code:e.code,msg:e.message};if(!this._onError)throw new o.RuntimeException(n.msg);this._onError(s.LoaderErrors.EXCEPTION,n)}}},{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 n=new FileReader;n.onload=function(){t._dispatchArrayBuffer(n.result)},n.readAsArrayBuffer(e.data)}else{this._status=s.LoaderStatus.kError;var i={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new o.RuntimeException(i.msg);this._onError(s.LoaderErrors.EXCEPTION,i)}}},{key:"_dispatchArrayBuffer",value:function(e){var t=e,n=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,n,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}();n.default=u},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],29:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,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 n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("../utils/logger.js"),o=(i=s)&&i.__esModule?i:{default:i},u=e("./loader.js"),l=e("../utils/exception.js");var c=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"xhr-moz-chunked-loader"));return i.TAG="MozChunkedLoader",i._seekHandler=e,i._config=n,i._needStash=!0,i._xhr=null,i._requestAbort=!1,i._contentLength=null,i._receivedLength=0,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,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,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):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 n=e.url;this._config.reuseRedirectedURL&&void 0!=e.redirectedURL&&(n=e.redirectedURL);var i=this._seekHandler.getConfig(n,t);this._requestURL=i.url;var a=this._xhr=new XMLHttpRequest;if(a.open("GET",i.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(i.headers)){var s=i.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 n=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(n)}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,n=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,n,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,n=null;if(this._contentLength&&e.loaded<this._contentLength?(t=u.LoaderErrors.EARLY_EOF,n={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=u.LoaderErrors.EXCEPTION,n={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new l.RuntimeException(n.msg);this._onError(t,n)}}]),t}();n.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],30:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,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 n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("../utils/logger.js"),o=(i=s)&&i.__esModule?i:{default:i},u=e("./loader.js"),l=e("../utils/exception.js");var c=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"xhr-msstream-loader"));return i.TAG="MSStreamLoader",i._seekHandler=e,i._config=n,i._needStash=!0,i._xhr=null,i._reader=null,i._totalRange=null,i._currentRange=null,i._currentRequestURL=null,i._currentRedirectedURL=null,i._contentLength=null,i._receivedLength=0,i._bufferLimit=16777216,i._lastTimeBufferSize=0,i._isReconnecting=!1,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,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,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):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,n){this._dataSource=e,n?this._currentRange=t:this._totalRange=t;var i=e.url;this._config.reuseRedirectedURL&&(void 0!=this._currentRedirectedURL?i=this._currentRedirectedURL:void 0!=e.redirectedURL&&(i=e.redirectedURL));var a=this._seekHandler.getConfig(i,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 n=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&n!==this._currentRedirectedURL&&(this._currentRedirectedURL=n,this._onURLRedirect&&this._onURLRedirect(n))}var i=t.getResponseHeader("Content-Length");if(null!=i&&null==this._contentLength){var r=parseInt(i);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,n={code:-1,msg:e.constructor.name+" "+e.type};if(!this._onError)throw new l.RuntimeException(n.msg);this._onError(t,n)}},{key:"_msrOnProgress",value:function(e){var t=e.target.result;if(null!=t){var n=t.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=t.byteLength;var i=this._totalRange.from+this._receivedLength;this._receivedLength+=n.byteLength,this._onDataArrival&&this._onDataArrival(n,i,this._receivedLength),t.byteLength>=this._bufferLimit&&(o.default.v(this.TAG,"MSStream buffer exceeded max size near "+(i+n.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,n=null;if(this._contentLength&&this._receivedLength<this._contentLength?(t=u.LoaderErrors.EARLY_EOF,n={code:-1,msg:"MSStream meet Early-Eof"}):(t=u.LoaderErrors.EARLY_EOF,n={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new l.RuntimeException(n.msg);this._onError(t,n)}}]),t}();n.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],31:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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 n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"xhr-range-loader"));return i.TAG="RangeLoader",i._seekHandler=e,i._config=n,i._needStash=!1,i._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],i._currentChunkSizeKB=384,i._currentSpeedNormalized=0,i._zeroSpeedChunkCount=0,i._xhr=null,i._speedSampler=new s.default,i._requestAbort=!1,i._waitForTotalLength=!1,i._totalLengthReceived=!1,i._currentRequestURL=null,i._currentRedirectedURL=null,i._currentRequestRange=null,i._totalLength=null,i._contentLength=null,i._receivedLength=0,i._lastTimeLoaded=0,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,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,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):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 n=!1;void 0!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(n=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||n?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,n=t+e;null!=this._contentLength&&n-this._range.from>=this._contentLength&&(n=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:n},this._internalOpen(this._dataSource,this._currentRequestRange)}},{key:"_internalOpen",value:function(e,t){this._lastTimeLoaded=0;var n=e.url;this._config.reuseRedirectedURL&&(void 0!=this._currentRedirectedURL?n=this._currentRedirectedURL:void 0!=e.redirectedURL&&(n=e.redirectedURL));var r=this._seekHandler.getConfig(n,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"===i(r.headers)){var s=r.headers;for(var o in s)s.hasOwnProperty(o)&&a.setRequestHeader(o,s[o])}if("object"===i(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 n=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&n!==this._currentRedirectedURL&&(this._currentRedirectedURL=n,this._onURLRedirect&&this._onURLRedirect(n))}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 n=e.total;this._internalAbort(),null!=n&0!==n&&(this._totalLength=n)}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 i=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(i)}}},{key:"_normalizeSpeed",value:function(e){var t=this._chunkSizeKBList,n=t.length-1,i=0,r=0,a=n;if(e<t[0])return t[0];for(;r<=a;){if((i=r+Math.floor((a-r)/2))===n||e>=t[i]&&e<t[i+1])return t[i];t[i]<e?r=i+1:a=i-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 n=this._normalizeSpeed(t);this._currentSpeedNormalized!==n&&(this._currentSpeedNormalized=n,this._currentChunkSizeKB=n)}var i=e.target.response,r=this._range.from+this._receivedLength;this._receivedLength+=i.byteLength;var a=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():a=!0,this._onDataArrival&&this._onDataArrival(i,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,n=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=o.LoaderErrors.EARLY_EOF,n={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=o.LoaderErrors.EXCEPTION,n={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new u.RuntimeException(n.msg);this._onError(t,n)}},{key:"currentSpeed",get:function(){return this._speedSampler.lastSecondKBps}}]),t}();n.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24,"./speed-sampler.js":27}],32:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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 n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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,n){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===n?"undefined":i(n))&&Object.assign(this._config,n),"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 n=this;e===u.default.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then(function(){n._emitter.emit(u.default.MEDIA_INFO,n.mediaInfo)}):e===u.default.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then(function(){n._emitter.emit(u.default.STATISTICS_INFO,n.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,n=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,n){e._msectl.appendInitSegment(n)}),this._transmuxer.on(c.default.MEDIA_SEGMENT,function(i,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(n&&n==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,n=a}else r.info.beginPts-1e3*a>=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,n){e._emitter.emit(u.default.ERROR,f.ErrorTypes.NETWORK_ERROR,t,n)}),this._transmuxer.on(c.default.DEMUX_ERROR,function(t,n){e._emitter.emit(u.default.ERROR,f.ErrorTypes.MEDIA_ERROR,t,{code:-1,msg:n})}),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,n=0,i=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();n=r.totalVideoFrames,i=r.droppedVideoFrames}else void 0!=this._mediaElement.webkitDecodedFrameCount?(n=this._mediaElement.webkitDecodedFrameCount,i=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=n,e.droppedFrames=i),e}},{key:"_onmseUpdateEnd",value:function(){if(this._config.lazyLoad&&!this._config.isLive){for(var e=this._mediaElement.buffered,t=this._mediaElement.currentTime,n=0,i=0;i<e.length;i++){var r=e.start(i),a=e.end(i);if(r<=t&&t<a){r,n=a;break}}n>=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,n=!1,i=0;i<t.length;i++){var r=t.start(i),a=t.end(i);if(e>=r&&e<a){e>=a-this._config.lazyLoadRecoverDuration&&(n=!0);break}}n&&(window.clearInterval(this._progressChecker),this._progressChecker=null,n&&(s.default.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))}},{key:"_isTimepointBuffered",value:function(e){for(var t=this._mediaElement.buffered,n=0;n<t.length;n++){var i=t.start(n),r=t.end(n);if(e>=i&&e<r)return!0}return!1}},{key:"_internalSeek",value:function(e){var t=this._isTimepointBuffered(e),n=!1,i=0;if(e<1&&this._mediaElement.buffered.length>0){var r=this._mediaElement.buffered.start(0);(r<1&&e<r||o.default.safari)&&(n=!0,i=o.default.safari?.1:r)}if(n)this._requestSetTime=!0,this._mediaElement.currentTime=i;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 n=t.buffered;if(n.length>0&&t.currentTime<n.end(0)){if(this._config.isLive&&n.end(0)-t.currentTime>3600)return s.default.w(this.TAG,"Playback seems stuck at "+t.currentTime+", try seek to "+n.end(0)+", cancle"),this._mediaElement.removeEventListener("progress",this.e.onvProgress),void this._emitter.emit(u.default.ERROR,f.ErrorTypes.MEDIA_ERROR,"got wrong timestamp ",n.end(0));s.default.w(this.TAG,"Playback seems stuck at "+t.currentTime+", seek to "+n.end(0)),this._requestSetTime=!0,this._mediaElement.currentTime=n.end(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress)}}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,n=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(t<1&&n.length>0){var i=n.start(0);if(i<1&&t<i||o.default.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=o.default.safari?.1:i)}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}();n.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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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 n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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,n){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===n?"undefined":i(n))&&Object.assign(this._config,n),"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 n=this;e===s.default.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){n._emitter.emit(s.default.MEDIA_INFO,n.mediaInfo)}):e===s.default.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){n._emitter.emit(s.default.STATISTICS_INFO,n.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,n=0,i=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();n=r.totalVideoFrames,i=r.droppedVideoFrames}else void 0!=this._mediaElement.webkitDecodedFrameCount?(n=this._mediaElement.webkitDecodedFrameCount,i=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=n,e.droppedFrames=i),e}}]),e}();n.default=c},{"../config.js":5,"../utils/exception.js":40,"./player-events.js":35,events:2}],34:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorDetails=n.ErrorTypes=void 0;var i,r=e("../io/loader.js"),a=e("../demux/demux-errors.js"),s=(i=a)&&i.__esModule?i:{default:i};n.ErrorTypes={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},n.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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 i(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}();n.default=r},{}],37:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 i(e,null,[{key:"init",value:function(){for(var t in e.types={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:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var n=e.constants={};n.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),n.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),n.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),n.STSC=n.STCO=n.STTS,n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),n.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]),n.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]),n.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function(e){for(var t=8,n=null,i=Array.prototype.slice.call(arguments,1),r=i.length,a=0;a<r;a++)t+=i[a].byteLength;(n=new Uint8Array(t))[0]=t>>>24&255,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n.set(e,4);for(var s=8,o=0;o<r;o++)n.set(i[o],s),s+=i[o].byteLength;return n}},{key:"generateInitSegment",value:function(t){var n=e.box(e.types.ftyp,e.constants.FTYP),i=e.moov(t),r=new Uint8Array(n.byteLength+i.byteLength);return r.set(n,0),r.set(i,n.byteLength),r}},{key:"moov",value:function(t){var n=e.mvhd(t.timescale,t.duration),i=e.trak(t),r=e.mvex(t);return e.box(e.types.moov,n,i,r)}},{key:"mvhd",value:function(t,n){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,n>>>24&255,n>>>16&255,n>>>8&255,255&n,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 n=t.id,i=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,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,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 n=t.timescale,i=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}},{key:"hdlr",value:function(t){var n=null;return n="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,n)}},{key:"minf",value:function(t){var n=null;return n="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,n,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 n=t.channelCount,i=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return e.box(e.types[".mp3"],r)}},{key:"mp4a",value:function(t){var n=t.channelCount,i=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return e.box(e.types.mp4a,r,e.esds(t))}},{key:"esds",value:function(t){var n=t.config||[],i=n.length,r=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(n).concat([6,1,2]));return e.box(e.types.esds,r)}},{key:"avc1",value:function(t){var n=t.avcc,i=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,i>>>8&255,255&i,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 e.box(e.types.avc1,a,e.box(e.types.avcC,n))}},{key:"mvex",value:function(t){return e.box(e.types.mvex,e.trex(t))}},{key:"trex",value:function(t){var n=t.id,i=new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,i)}},{key:"moof",value:function(t,n){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,n))}},{key:"mfhd",value:function(t){var n=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,n)}},{key:"traf",value:function(t,n){var i=t.id,r=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),a=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n])),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 n=t.samples||[],i=n.length,r=new Uint8Array(4+i),a=0;a<i;a++){var s=n[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,n){var i=t.samples||[],r=i.length,a=12+16*r,s=new Uint8Array(a);n+=8+a,s.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0);for(var o=0;o<r;o++){var u=i[o].duration,l=i[o].size,c=i[o].flags,d=i[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(),n.default=r},{}],38:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 i(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 n=null,i="mp4",r=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(i="mpeg",r="",n=new Uint8Array):n=a.default.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,n=a.default.generateInitSegment(t)}if(!this._onInitSegment)throw new l.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:n.buffer,codec:r,container:e+"/"+i,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,n={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(n.samples.push(e),n.length=e.length);var i={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(i.samples.push(t),i.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(n,!0),this._remuxAudio(i,!0)}},{key:"_remuxAudio",value:function(e,t){if(null!=this._audioMeta){var n,i=e,l=i.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=i.length):(g=8,y=8+i.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,C=this._videoSegmentInfoList.getLastSegmentBefore(T);if(null!=C&&C.beginDts<E){var w=s.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(w){var P=C.beginDts,A=E-C.beginDts;r.default.v(this.TAG,"InsertPrefixSilentAudio: dts: "+P+", duration: "+A),l.unshift({unit:w,dts:P,pts:P}),y+=w.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 i.samples=[],void(i.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];n=K.dts+K.duration;var $=new u.MediaSegmentInfo;$.beginDts=d,$.endDts=n,$.beginPts=d,$.endPts=n,$.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($),i.samples=R,i.sequenceNumber++;var X=null;X=f?new Uint8Array:a.default.moof(i,d),i.samples=[],i.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 n,i,r=e,s=r.samples,o=void 0,l=-1,c=-1;if(s&&0!==s.length&&(1!==s.length||t)){var d=8,h=null,f=8+e.length,p=null;if(s.length>1&&(f-=(p=s.pop()).length),null!=this._videoStashedLastSample){var m=this._videoStashedLastSample;this._videoStashedLastSample=null,s.unshift(m),f+=m.length}null!=p&&(this._videoStashedLastSample=p);var g=s[0].dts-this._dtsBase;if(this._videoNextDts)o=g-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())o=0;else{var v=this._videoSegmentInfoList.getLastSampleBefore(g);if(null!=v){var y=g-(v.originalDts+v.duration);y<=3&&(y=0),o=g-(v.dts+v.duration+y)}else o=0}for(var _=new u.MediaSegmentInfo,b=[],T=0;T<s.length;T++){var S=s[T],k=S.dts-this._dtsBase,E=S.isKeyframe,C=k-o,w=S.cts,P=C+w;-1===l&&(l=C,c=P);var A=0;if(T!==s.length-1)A=s[T+1].dts-this._dtsBase-o-C;else if(null!=p)A=p.dts-this._dtsBase-o-C;else A=b.length>=1?b[b.length-1].duration:Math.floor(this._videoMeta.refSampleDuration);if(E){var R=new u.SampleInfo(C,P,A,S.dts,!0);R.fileposition=S.fileposition,_.appendSyncPoint(R)}b.push({dts:C,pts:P,cts:w,units:S.units,size:S.length,isKeyframe:E,duration:A,originalDts:k,flags:{isLeading:0,dependsOn:E?2:1,isDependedOn:E?1:0,hasRedundancy:0,isNonSync:E?0:1}})}(h=new Uint8Array(f))[0]=f>>>24&255,h[1]=f>>>16&255,h[2]=f>>>8&255,h[3]=255&f,h.set(a.default.types.mdat,4);for(var L=0;L<b.length;L++)for(var O=b[L].units;O.length;){var I=O.shift().data;h.set(I,d),d+=I.byteLength}var x=b[b.length-1];if(n=x.dts+x.duration,i=x.pts+x.duration,this._videoNextDts=n,_.beginDts=l,_.endDts=n,_.beginPts=c,_.endPts=i,_.originalBeginDts=b[0].originalDts,_.originalEndDts=x.originalDts+x.duration,_.firstSample=new u.SampleInfo(b[0].dts,b[0].pts,b[0].duration,b[0].originalDts,b[0].isKeyframe),_.lastSample=new u.SampleInfo(x.dts,x.pts,x.duration,x.originalDts,x.isKeyframe),this._isLive||this._videoSegmentInfoList.append(_),r.samples=b,r.sequenceNumber++,this._forceFirstIDR){var D=b[0].flags;D.dependsOn=2,D.isNonSync=0}var M=a.default.moof(r,l);r.samples=[],r.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(M,h).buffer,sampleCount:b.length,info:_})}}}},{key:"_mergeBoxes",value:function(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n}},{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}();n.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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i={};!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)||[],n=/(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:n[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,i)i.hasOwnProperty(o)&&delete i[o];Object.assign(i,a)}(),n.default=i},{}],40:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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=n.RuntimeException=function(){function e(t){s(this,e),this._message=t}return i(e,[{key:"toString",value:function(){return this.name+": "+this.message}},{key:"name",get:function(){return"RuntimeException"}},{key:"message",get:function(){return this._message}}]),e}();n.IllegalStateException=function(e){function t(e){return s(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,o),i(t,[{key:"name",get:function(){return"IllegalStateException"}}]),t}(),n.InvalidArgumentException=function(e){function t(e){return s(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,o),i(t,[{key:"name",get:function(){return"InvalidArgumentException"}}]),t}(),n.NotImplementedException=function(e){function t(e){return s(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,o),i(t,[{key:"name",get:function(){return"NotImplementedException"}}]),t}()},{}],41:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=e("events"),s=(i=a)&&i.__esModule?i:{default:i};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,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+n;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",i),e.ENABLE_ERROR&&(console.error?console.error(i):console.warn?console.warn(i):console.log(i))}},{key:"i",value:function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+n;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",i),e.ENABLE_INFO&&(console.info?console.info(i):console.log(i))}},{key:"w",value:function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+n;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",i),e.ENABLE_WARN&&(console.warn?console.warn(i):console.log(i))}},{key:"d",value:function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+n;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",i),e.ENABLE_DEBUG&&(console.debug?console.debug(i):console.log(i))}},{key:"v",value:function(t,n){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+n;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",i),e.ENABLE_VERBOSE&&console.log(i)}}]),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,n.default=o},{events:2}],42:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 i(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 n=e.getConfig();t.emit("change",n)}}},{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,n.default=o},{"./logger.js":41,events:2}],43:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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 i(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),n=1;n<arguments.length;n++){var i=arguments[n];if(void 0!==i&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t},"function"!=typeof self.Promise&&e("es6-promise").polyfill()}}]),t}();r.install(),n.default=r},{"es6-promise":1}],44:[function(e,t,n){"use strict";function i(e,t,n){var i=e;if(t+n<i.length){for(;n--;)if(128!=(192&i[++t]))return!1;return!0}return!1}Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){for(var t=[],n=e,r=0,a=e.length;r<a;)if(n[r]<128)t.push(String.fromCharCode(n[r])),++r;else{if(n[r]<192);else if(n[r]<224){if(i(n,r,1)){var s=(31&n[r])<<6|63&n[r+1];if(s>=128){t.push(String.fromCharCode(65535&s)),r+=2;continue}}}else if(n[r]<240){if(i(n,r,2)){var o=(15&n[r])<<12|(63&n[r+1])<<6|63&n[r+2];if(o>=2048&&55296!=(63488&o)){t.push(String.fromCharCode(65535&o)),r+=3;continue}}}else if(n[r]<248&&i(n,r,3)){var u=(7&n[r])<<18|(63&n[r+1])<<12|(63&n[r+2])<<6|63&n[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:{},n="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},i=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=n&&n.navigator||{},d=function(e){function t(a,s){i(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),n.videojs=n.videojs||{},n.videojs.Flash=n.videojs.Flash||{},n.videojs.Flash.onReady=t.onReady,n.videojs.Flash.onEvent=t.onEvent,n.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 n=e.techId,i=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:n,name:n,class:"vjs-tech"},e.attributes);return this.el_=t.embed(e.swf,i,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 n=this.seekable();n.length&&(t=(t=t>n.start(0)?t:n.start(0))<n.end(n.length-1)?t:n.end(n.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 n.performance&&"function"==typeof n.performance.now?e.creationTime=n.performance.now():n.performance&&n.performance.timing&&"number"==typeof n.performance.timing.navigationStart&&(e.creationTime=n.Date.now()-n.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 n,i,r=void 0;return e.type?r=e.type.replace(/;.*/,"").toLowerCase():(n=e.src,r=(i=o.getFileExtension(n))?"video/"+i:""),d.nativeSourceHandler.canPlayType(r)},d.nativeSourceHandler.handleSource=function(e,t,n){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),n=t&&t.tech;n&&n.el()&&d.checkReady(n)},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 n=s.$("#"+e).tech,i=Array.prototype.slice.call(arguments,2);n.setTimeout(function(){n.trigger(t,i)},1)},d.onError=function(e,t){var n=s.$("#"+e).tech;if("srcnotfound"===t)return n.error(4);"string"==typeof t?n.error("FLASH: "+t):(t.origin="flash",n.error(t))},d.version=function(){var e="0,0,0";try{e=new n.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,n,i){var r=d.getEmbedCode(e,t,n,i);return s.createEl("div",{innerHTML:r}).childNodes[0]},d.getEmbedCode=function(e,t,n,i){var r="",a="",s="";return t&&Object.getOwnPropertyNames(t).forEach(function(e){r+=e+"="+t[e]+"&"}),n=l({movie:e,flashvars:r,allowScriptAccess:"always",allowNetworking:"all"},n),Object.getOwnPropertyNames(n).forEach(function(e){a+='<param name="'+e+'" value="'+n[e]+'" />'}),i=l({data:e,width:"100%",height:"100%"},i),Object.getOwnPropertyNames(i).forEach(function(e){s+=e+'="'+i[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 n=e.search(/&(?![\w-]+=)/),i=void 0;return-1!==n?i=n+1:0===(n=i=e.lastIndexOf("/")+1)&&(n=i=e.length),t.connection=e.substring(0,n),t.stream=e.substring(i,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,n){var i=e.rtmpSourceHandler.canPlayType(t.type);return i||(e.isStreamingSrc(t.src)?"maybe":"")},e.rtmpSourceHandler.handleSource=function(t,n,i){var r=e.streamToParts(t.src);n.setRtmpConnection(r.connection),n.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,n,i){function r(s,o){if(!n[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=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return r(n||e)},c,c.exports,e,t,n,i)}return n[s].exports}for(var a="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(e,t,n){(function(e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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,n){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,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),i(t,[{key:"setSrc",value:function(e){this.flvPlayer&&(this.flvPlayer.unload(),this.flvPlayer.detachMediaElement(),this.flvPlayer.destroy());var t=this.options_.mediaDataSource,n=this.options_.config;t.type=void 0===t.type?"flv":t.type,t.url=e,this.flvPlayer=window.flvjs.createPlayer(t,n),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,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):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),n.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,n,i){function r(s,o){if(!n[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=n[s]={exports:{}};t[s][0].call(c.exports,function(e){return r(t[s][1][e]||e)},c,c.exports,e,t,n,i)}return n[s].exports}for(var a="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}}()({1:[function(e,t,n){"use strict";var i=(0,e("./adapter_factory.js").adapterFactory)({window:"undefined"==typeof window?void 0:window});t.exports=i},{"./adapter_factory.js":2}],2:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.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},n=i.log,l=i.detectBrowser(e),c={browserDetails:l,commonShim:u,extractVersion:i.extractVersion,disableLog:i.disableLog,disableWarnings:i.disableWarnings};switch(l.browser){case"chrome":if(!r||!r.shimPeerConnection||!t.shimChrome)return n("Chrome shim is not included in this adapter release."),c;if(null===l.version)return n("Chrome shim can not determine version, not shimming."),c;n("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 n("Firefox shim is not included in this adapter release."),c;n("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 n("MS edge shim is not included in this adapter release."),c;n("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 n("Safari shim is not included in this adapter release."),c;n("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:n("Unsupported browser!")}return c};var i=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 n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.shimGetDisplayMedia=n.shimGetUserMedia=void 0;var i="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(n,"shimGetUserMedia",{enumerable:!0,get:function(){return r.shimGetUserMedia}});var a=e("./getdisplaymedia");Object.defineProperty(n,"shimGetDisplayMedia",{enumerable:!0,get:function(){return a.shimGetDisplayMedia}}),n.shimMediaStream=function(e){e.MediaStream=e.MediaStream||e.webkitMediaStream},n.shimOnTrack=function(e){if("object"!==(void 0===e?"undefined":i(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 n=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",function(i){var r=void 0;r=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find(function(e){return e.track&&e.track.id===i.track.id}):{track:i.track};var a=new Event("track");a.track=i.track,a.receiver=r,a.transceiver={receiver:r},a.streams=[t.stream],n.dispatchEvent(a)}),t.stream.getTracks().forEach(function(i){var r=void 0;r=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find(function(e){return e.track&&e.track.id===i.id}):{track:i};var a=new Event("track");a.track=i,a.receiver=r,a.transceiver={receiver:r},a.streams=[t.stream],n.dispatchEvent(a)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}},n.shimGetSendersWithDtmf=function(e){if("object"===(void 0===e?"undefined":i(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 n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){var r=n.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 n=this;this._senders=this._senders||[],a.apply(this,[e]),e.getTracks().forEach(function(e){n._senders.push(t(n,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 n=t._senders.find(function(t){return t.track===e});n&&t._senders.splice(t._senders.indexOf(n),1)})}}else if("object"===(void 0===e?"undefined":i(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}})}},n.shimGetStats=function(e){if(!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,n=Array.prototype.slice.call(arguments),i=n[0],r=n[1],a=n[2];if(arguments.length>0&&"function"==typeof i)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof i))return t.apply(this,[]);var s=function(e){var t={},n=e.result();return n.forEach(function(e){var n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(function(t){n[t]=e.stat(t)}),t[n.id]=n}),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)))},i])}return new Promise(function(n,i){t.apply(e,[function(e){n(o(s(e)))},i])}).then(r,a)}},n.shimSenderReceiverGetStats=function(e){if(!("object"===(void 0===e?"undefined":i(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,n=t.apply(this,[]);return n.forEach(function(t){return t._pc=e}),n});var n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.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],n=void 0,i=void 0,r=void 0;return this.getSenders().forEach(function(e){e.track===t&&(n?r=!0:n=e)}),this.getReceivers().forEach(function(e){return e.track===t&&(i?r=!0:i=e),e.track===t}),r||n&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):n?n.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return a.apply(this,arguments)}},n.shimAddTrackRemoveTrackWithNative=u,n.shimAddTrackRemoveTrack=function(e){if(!e.RTCPeerConnection)return;var t=s.detectBrowser(e);if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return u(e);var n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=n.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map(function(t){return e._reverseStreams[t.id]})};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var n=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(function(e){var t=n.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}i.apply(this,[t])};var r=e.RTCPeerConnection.prototype.removeStream;function a(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(function(t){var i=e._reverseStreams[t],r=e._streams[i.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}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,n){var i=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[n.id];if(s)s.addTrack(t),Promise.resolve().then(function(){i.dispatchEvent(new Event("negotiationneeded"))});else{var o=new e.MediaStream([t]);this._streams[n.id]=o,this._reverseStreams[o.id]=n,this.addStream(o)}return this.getSenders().find(function(e){return e.track===t})},["createOffer","createAnswer"].forEach(function(t){var n=e.RTCPeerConnection.prototype[t],i=o({},t,function(){var e=this,t=arguments,i=arguments.length&&"function"==typeof arguments[0];return i?n.apply(this,[function(n){var i=a(e,n);t[0].apply(null,[i])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):n.apply(this,arguments).then(function(t){return a(e,t)})});e.RTCPeerConnection.prototype[t]=i[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],n=t.sdp,Object.keys(e._reverseStreams||[]).forEach(function(t){var i=e._reverseStreams[t],r=e._streams[i.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})),l.apply(this,arguments)):l.apply(this,arguments);var e,t,n};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 n=e._pc===this;if(!n)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var i=void 0;Object.keys(this._streams).forEach(function(n){var r=t._streams[n].getTracks().find(function(t){return e.track===t});r&&(i=t._streams[n])}),i&&(1===i.getTracks().length?this.removeStream(this._reverseStreams[i.id]):i.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}},n.shimPeerConnection=function(e){var t=s.detectBrowser(e);!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection);if(!e.RTCPeerConnection)return;var n=0===e.RTCPeerConnection.prototype.addIceCandidate.length;t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var n=e.RTCPeerConnection.prototype[t],i=o({},t,function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)});e.RTCPeerConnection.prototype[t]=i[t]});var i=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return n||arguments[0]?t.version<78&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}},n.fixNegotiationNeeded=function(e){var t=s.detectBrowser(e);s.wrapPeerConnectionEvent(e,"negotiationneeded",function(e){var n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e})};var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(e("../utils.js"));function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,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,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(i)&&this._shimmedLocalStreams[n.id].push(i):this._shimmedLocalStreams[n.id]=[n,i],i};var n=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 i=this.getSenders();n.apply(this,arguments);var r=this.getSenders().filter(function(e){return-1===i.indexOf(e)});this._shimmedLocalStreams[e.id]=[e].concat(r)};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.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(n){var i=t._shimmedLocalStreams[n].indexOf(e);-1!==i&&t._shimmedLocalStreams[n].splice(i,1),1===t._shimmedLocalStreams[n].length&&delete t._shimmedLocalStreams[n]}),r.apply(this,arguments)}}},{"../utils.js":15,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.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(n){return t(n).then(function(t){var i=n.video&&n.video.width,r=n.video&&n.video.height,a=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:a||3}},i&&(n.video.mandatory.maxWidth=i),r&&(n.video.mandatory.maxHeight=r),e.navigator.mediaDevices.getUserMedia(n)})}}},{}],5:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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};n.shimGetUserMedia=function(e){var t=e&&e.navigator;if(!t.mediaDevices)return;var n=r.detectBrowser(e),s=function(e){if("object"!==(void 0===e?"undefined":i(e))||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"===i(e[n])?e[n]:{ideal:e[n]};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",n)]=r.ideal,t.optional.push(s),(s={})[a("max",n)]=r.ideal,t.optional.push(s)):(s[a("",n)]=r.ideal,t.optional.push(s))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[a("",n)]=r.exact):["min","max"].forEach(function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[a(e,n)]=r[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},o=function(e,r){if(n.version>=61)return r(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===i(e.audio)){var o=function(e,t,n){t in e&&!(n in e)&&(e[n]=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"===i(e.video)){var u=e.video.facingMode;u=u&&("object"===(void 0===u?"undefined":i(u))?u:{ideal:u});var l=n.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 n=(t=t.filter(function(e){return"videoinput"===e.kind})).find(function(e){return c.some(function(t){return e.label.toLowerCase().includes(t)})});return!n&&t.length&&c.includes("back")&&(n=t[t.length-1]),n&&(e.video.deviceId=u.exact?{exact:n.deviceId}:{ideal:n.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 n.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,n,i){o(e,function(e){t.webkitGetUserMedia(e,n,function(e){i&&i(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 n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(e("../utils.js"));var a=r.log},{"../utils.js":15}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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};n.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":i(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 n=new t(e),r=s.default.parseCandidate(e.candidate),a=Object.assign(n,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})},n.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 n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),i=e.sdpSemantics;"plan-b"===i&&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 n=parseInt(t[1],10);return n!=n?-1:n}(arguments[0]),a=function(e){var n=65536;"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637);return n}(r),o=function(e,n){var i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);var r=s.default.matchPrefix(e.sdp,"a=max-message-size:");r.length>0?i=parseInt(r[0].substr(19),10):"firefox"===t.browser&&-1!==n&&(i=2147483637);return i}(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 n.apply(this,arguments)}},n.shimSendThrowTypeError=function(e){if(!(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){var n=e.send;e.send=function(){var i=arguments[0],r=i.length||i.size||i.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 n.apply(e,arguments)}}var n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=n.apply(this,arguments);return t(e,this),e},o.wrapPeerConnectionEvent(e,"datachannel",function(e){return t(e.channel,e.target),e})},n.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 n=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 n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})},n.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 n=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")),n.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 n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(e("./utils"))},{"./utils":15,sdp:17}],7:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.shimGetDisplayMedia=n.shimGetUserMedia=void 0;var i=e("./getusermedia");Object.defineProperty(n,"shimGetUserMedia",{enumerable:!0,get:function(){return i.shimGetUserMedia}});var r=e("./getdisplaymedia");Object.defineProperty(n,"shimGetDisplayMedia",{enumerable:!0,get:function(){return r.shimGetDisplayMedia}}),n.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 n=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){n.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 i=(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 i(e)},e.RTCPeerConnection.prototype=i.prototype},n.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 n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.filterIceServers=function(e,t){var n=!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&&i.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&&!n?(n=!0,!0):t&&!n}),delete e.url,e.urls=r?t[0]:t,!!t.length}})};var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(e("../utils"))},{"../utils":15}],9:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.shimGetUserMedia=function(e){var t=e&&e.navigator,n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.shimGetDisplayMedia=n.shimGetUserMedia=void 0;var i="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(n,"shimGetUserMedia",{enumerable:!0,get:function(){return r.shimGetUserMedia}});var a=e("./getdisplaymedia");Object.defineProperty(n,"shimGetDisplayMedia",{enumerable:!0,get:function(){return a.shimGetDisplayMedia}}),n.shimOnTrack=function(e){"object"===(void 0===e?"undefined":i(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}}})},n.shimPeerConnection=function(e){var t=s.detectBrowser(e);if("object"!==(void 0===e?"undefined":i(e))||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection);t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var n=e.RTCPeerConnection.prototype[t],i=function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n;return e}({},t,function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)});e.RTCPeerConnection.prototype[t]=i[t]});if(t.version<68){var n=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.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),n=e[0],i=e[1],s=e[2];return a.apply(this,[n||null]).then(function(e){if(t.version<53&&!i)try{e.forEach(function(e){e.type=r[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach(function(t,n){e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))})}return e}).then(i,s)}},n.shimSenderGetStats=function(e){if("object"!==(void 0===e?"undefined":i(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,n=t.apply(this,[]);return n.forEach(function(t){return t._pc=e}),n});var n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.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)}},n.shimReceiverGetStats=function(e){if("object"!==(void 0===e?"undefined":i(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,n=t.apply(this,[]);return n.forEach(function(t){return t._pc=e}),n});s.wrapPeerConnectionEvent(e,"track",function(e){return e.receiver._pc=e.srcElement,e}),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}},n.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(n){n.track&&e.getTracks().includes(n.track)&&t.removeTrack(n)})}},n.shimRTCDataChannel=function(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)},n.shimAddTransceiver=function(e){if("object"!==(void 0===e?"undefined":i(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],n=e&&"sendEncodings"in e;n&&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 i=t.apply(this,arguments);if(n){var r=i.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 i})},n.shimGetParameters=function(e){if("object"!==(void 0===e?"undefined":i(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})},n.shimCreateOffer=function(e){if("object"!==(void 0===e?"undefined":i(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=this,n=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return t.apply(e,n)}).finally(function(){e.setParametersPromises=[]}):t.apply(this,arguments)}},n.shimCreateAnswer=function(e){if("object"!==(void 0===e?"undefined":i(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=this,n=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return t.apply(e,n)}).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 n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(e("../utils"))},{"../utils":15,"./getdisplaymedia":12,"./getusermedia":13}],12:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.shimGetDisplayMedia=function(e,t){if(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices)return;if(!e.navigator.mediaDevices)return;e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){var i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)}}},{}],13:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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};n.shimGetUserMedia=function(e){var t=r.detectBrowser(e),n=e&&e.navigator,a=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,i){r.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,i)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){var s=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},o=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(e){return"object"===(void 0===e?"undefined":i(e))&&"object"===i(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":i(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 n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(e("../utils"))},{"../utils":15}],14:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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};n.shimLocalStreamsAPI=function(e){if("object"!==(void 0===e?"undefined":i(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 n=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(function(i){return t.call(n,i,e)}),e.getVideoTracks().forEach(function(i){return t.call(n,i,e)})},e.RTCPeerConnection.prototype.addTrack=function(e){for(var n=this,i=arguments.length,r=Array(i>1?i-1:0),a=1;a<i;a++)r[a-1]=arguments[a];return r&&r.forEach(function(e){n._localStreams?n._localStreams.includes(e)||n._localStreams.push(e):n._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 n=this._localStreams.indexOf(e);if(-1!==n){this._localStreams.splice(n,1);var i=e.getTracks();this.getSenders().forEach(function(e){i.includes(e.track)&&t.removeTrack(e)})}})},n.shimRemoteStreamsAPI=function(e){if("object"!==(void 0===e?"undefined":i(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 n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}})})}});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 n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}})}),t.apply(e,arguments)}}},n.shimCallbacksAPI=function(e){if("object"!==(void 0===e?"undefined":i(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,a=t.setLocalDescription,s=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],r=n.apply(this,[i]);return t?(r.then(e,t),Promise.resolve()):r},t.createAnswer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};var u=function(e,t,n){var i=a.apply(this,[e]);return n?(i.then(t,n),Promise.resolve()):i};t.setLocalDescription=u,u=function(e,t,n){var i=s.apply(this,[e]);return n?(i.then(t,n),Promise.resolve()):i},t.setRemoteDescription=u,u=function(e,t,n){var i=o.apply(this,[e]);return n?(i.then(t,n),Promise.resolve()):i},t.addIceCandidate=u},n.shimGetUserMedia=function(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var n=t.mediaDevices,i=n.getUserMedia.bind(n);t.mediaDevices.getUserMedia=function(e){return i(a(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,i){t.mediaDevices.getUserMedia(e).then(n,i)}.bind(t))},n.shimConstraints=a,n.shimRTCIceServerUrls=function(e){if(!e.RTCPeerConnection)return;var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){for(var i=[],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,i.push(s)):i.push(e.iceServers[a])}e.iceServers=i}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})},n.shimTrackEventTransceiver=function(e){"object"===(void 0===e?"undefined":i(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}}})},n.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 n=this.getTransceivers().find(function(e){return"audio"===e.receiver.track.kind});!1===e.offerToReceiveAudio&&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.offerToReceiveAudio||n||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var i=this.getTransceivers().find(function(e){return"video"===e.receiver.track.kind});!1===e.offerToReceiveVideo&&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.offerToReceiveVideo||i||this.addTransceiver("video")}return t.apply(this,arguments)}},n.shimAudioContext=function(e){if("object"!==(void 0===e?"undefined":i(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 n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);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,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="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};n.extractVersion=s,n.wrapPeerConnectionEvent=function(e,t,n){if(!e.RTCPeerConnection)return;var i=e.RTCPeerConnection.prototype,r=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return r.apply(this,arguments);var a=function(e){var t=n(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,a),r.apply(this,[e,a])};var a=i.removeEventListener;i.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return a.apply(this,arguments);if(!this._eventMap[t].has(n))return a.apply(this,arguments);var i=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,a.apply(this,[e,i])},Object.defineProperty(i,"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})},n.disableLog=function(e){if("boolean"!=typeof e)return new Error("Argument type: "+(void 0===e?"undefined":i(e))+". Please use a boolean.");return r=e,e?"adapter.js logging disabled":"adapter.js logging enabled"},n.disableWarnings=function(e){if("boolean"!=typeof e)return new Error("Argument type: "+(void 0===e?"undefined":i(e))+". Please use a boolean.");return a=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled")},n.log=function(){if("object"===("undefined"==typeof window?"undefined":i(window))){if(r)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}},n.deprecated=function(e,t){if(!a)return;console.warn(e+" is deprecated, please use "+t+" instead.")},n.detectBrowser=function(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var n=e.navigator;if(n.mozGetUserMedia)t.browser="firefox",t.version=s(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=s(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.mediaDevices&&n.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=s(n.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=s(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t},n.compactObject=function e(t){if(!o(t))return t;return Object.keys(t).reduce(function(n,i){var r=o(t[i]),a=r?e(t[i]):t[i],s=r&&!Object.keys(a).length;return void 0===a||s?n:Object.assign(n,function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n;return e}({},i,a))},{})},n.walkStats=u,n.filterStats=function(e,t,n){var i=n?"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(n){n.type===i&&n.trackId===t.id&&u(e,n,r)})}),r};var r=!0,a=!0;function s(e,t,n){var i=e.match(t);return i&&i.length>=n&&parseInt(i[n],10)}function o(e){return"[object Object]"===Object.prototype.toString.call(e)}function u(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach(function(i){i.endsWith("Id")?u(e,e.get(t[i]),n):i.endsWith("Ids")&&t[i].forEach(function(t){u(e,e.get(t),n)})}))}},{}],16:[function(e,t,n){"use strict";var i=e("sdp");function r(e,t,n,r,a){var s=i.writeRtpDescription(e.kind,t);if(s+=i.writeIceParameters(e.iceGatherer.getLocalParameters()),s+=i.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"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:"+i.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+i.localCName+"\r\n"),s}function a(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},i=function(e,t){e=parseInt(e,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===e||t[n].preferredPayloadType===e)return t[n]},r=function(e,t,n,r){var a=i(e.parameters.apt,n),s=i(t.parameters.apt,r);return a&&s&&a.name.toLowerCase()===s.name.toLowerCase()};return e.codecs.forEach(function(i){for(var a=0;a<t.codecs.length;a++){var s=t.codecs[a];if(i.name.toLowerCase()===s.name.toLowerCase()&&i.clockRate===s.clockRate){if("rtx"===i.name.toLowerCase()&&i.parameters&&s.parameters.apt&&!r(i,s,e.codecs,t.codecs))continue;(s=JSON.parse(JSON.stringify(s))).numChannels=Math.min(i.numChannels,s.numChannels),n.codecs.push(s),s.rtcpFeedback=s.rtcpFeedback.filter(function(e){for(var t=0;t<i.rtcpFeedback.length;t++)if(i.rtcpFeedback[t].type===e.type&&i.rtcpFeedback[t].parameter===e.parameter)return!0;return!1});break}}}),e.headerExtensions.forEach(function(e){for(var i=0;i<t.headerExtensions.length;i++){var r=t.headerExtensions[i];if(e.uri===r.uri){n.headerExtensions.push(r);break}}}),n}function s(e,t,n){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(n)}function o(e,t){var n=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 n||e.addRemoteCandidate(t),!n}function u(e,t){var n=new Error(t);return n.name=e,n.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],n}t.exports=function(e,t){function n(t,n){n.addTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function l(t,n,i,r){var a=new Event("track");a.track=n,a.receiver=i,a.transceiver={receiver:i},a.streams=r,e.setTimeout(function(){t._dispatchEvent("track",a)})}var c=function(n){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",n=JSON.parse(JSON.stringify(n||{})),this.usingBundle="max-bundle"===n.bundlePolicy,"negotiate"===n.rtcpMuxPolicy)throw u("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(n.rtcpMuxPolicy||(n.rtcpMuxPolicy="require"),n.iceTransportPolicy){case"all":case"relay":break;default:n.iceTransportPolicy="all"}switch(n.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:n.bundlePolicy="balanced"}if(n.iceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var i=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var r="string"==typeof i;return r&&(i=[i]),i=i.filter(function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||n?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(n=!0,!0)}),delete e.url,e.urls=r?i[0]:i,!!i.length}})}(n.iceServers||[],t),this._iceGatherers=[],n.iceCandidatePoolSize)for(var s=n.iceCandidatePoolSize;s>0;s--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:n.iceServers,gatherPolicy:n.iceTransportPolicy}));else n.iceCandidatePoolSize=0;this._config=n,this.transceivers=[],this._sdpSessionId=i.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 n=this.transceivers.length>0,i={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&&n)i.iceTransport=this.transceivers[0].iceTransport,i.dtlsTransport=this.transceivers[0].dtlsTransport;else{var r=this._createIceAndDtlsTransports();i.iceTransport=r.iceTransport,i.dtlsTransport=r.dtlsTransport}return t||this.transceivers.push(i),i},c.prototype.addTrack=function(t,n){if(this._isClosed)throw u("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var i;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||(i=this.transceivers[r]);return i||(i=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(n)&&this.localStreams.push(n),i.track=t,i.stream=n,i.rtpSender=new e.RTCRtpSender(t,i.dtlsTransport),i.rtpSender},c.prototype.addStream=function(e){var n=this;if(t>=15025)e.getTracks().forEach(function(t){n.addTrack(t,e)});else{var i=e.clone();e.getTracks().forEach(function(e,t){var n=i.getTracks()[t];e.addEventListener("enabled",function(e){n.enabled=e.enabled})}),i.getTracks().forEach(function(e){n.addTrack(e,i)})}},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 n=this.transceivers.find(function(e){return e.rtpSender===t});if(!n)throw u("InvalidAccessError","Sender was not created by this connection.");var i=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,-1===this.transceivers.map(function(e){return e.stream}).indexOf(i)&&this.localStreams.indexOf(i)>-1&&this.localStreams.splice(this.localStreams.indexOf(i),1),this._maybeFireNegotiationNeeded()},c.prototype.removeStream=function(e){var t=this;e.getTracks().forEach(function(e){var n=t.getSenders().find(function(t){return t.track===e});n&&t.removeTrack(n)})},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,n){var i=this;if(n&&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 n=!e.candidate||0===Object.keys(e.candidate).length;r.state=n?"completed":"gathering",null!==i.transceivers[t].bufferedCandidateEvents&&i.transceivers[t].bufferedCandidateEvents.push(e)},r.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),r},c.prototype._gather=function(t,n){var r=this,a=this.transceivers[n].iceGatherer;if(!a.onlocalcandidate){var s=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,a.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),a.onlocalcandidate=function(e){if(!(r.usingBundle&&n>0)){var s=new Event("icecandidate");s.candidate={sdpMid:t,sdpMLineIndex:n};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=i.writeCandidate(o);s.candidate=Object.assign(s.candidate,i.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=i.getMediaSections(r._localDescription.sdp);c[s.candidate.sdpMLineIndex]+=u?"a=end-of-candidates\r\n":"a="+s.candidate.candidate+"\r\n",r._localDescription.sdp=i.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,n=new e.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var i=new e.RTCDtlsTransport(n);return i.ondtlsstatechange=function(){t._updateConnectionState()},i.onerror=function(){Object.defineProperty(i,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:i}},c.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var i=this.transceivers[e].dtlsTransport;i&&(delete i.ondtlsstatechange,delete i.onerror,delete this.transceivers[e].dtlsTransport)},c.prototype._transceive=function(e,n,r){var s=a(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(s.encodings=e.sendEncodingParameters,s.rtcp={cname:i.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,n,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=i.splitSections(e.sdp),n=t.shift(),t.forEach(function(e,t){var n=i.parseRtpParameters(e);r.transceivers[t].localCapabilities=n}),r.transceivers.forEach(function(e,t){r._gather(e.mid,t)});else if("answer"===e.type){t=i.splitSections(r._remoteDescription.sdp),n=t.shift();var o=i.matchPrefix(n,"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(!(i.isRejected(e)&&0===i.matchPrefix(e,"a=bundle-only").length)&&!s.rejected){var f=i.getIceParameters(e,n),p=i.getDtlsParameters(e,n);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=i.splitSections(r.sdp),p=f.shift(),m=i.matchPrefix(p,"a=ice-lite").length>0,g=i.matchPrefix(p,"a=group:BUNDLE ").length>0;c.usingBundle=g;var v=i.matchPrefix(p,"a=ice-options:")[0];return c.canTrickleIceCandidates=!!v&&v.substr(14).split(" ").indexOf("trickle")>=0,f.forEach(function(s,u){var l=i.splitLines(s),f=i.getKind(s),v=i.isRejected(s)&&0===i.matchPrefix(s,"a=bundle-only").length,y=l[0].substr(2).split(" ")[2],_=i.getDirection(s,p),b=i.parseMsid(s),T=i.getMid(s)||i.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,C,w,P,A,R,L;!v&&c.transceivers[u]&&c.transceivers[u].rejected&&(c.transceivers[u]=c._createTransceiver(f,!0));var O,I,x=i.parseRtpParameters(s);v||(O=i.getIceParameters(s,p),(I=i.getDtlsParameters(s,p)).role="client"),A=i.parseRtpEncodingParameters(s);var D=i.parseRtcpParameters(s),M=i.matchPrefix(s,"a=end-of-candidates",p).length>0,U=i.matchPrefix(s,"a=candidate:").map(function(e){return i.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,C=S.dtlsTransport,w=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"===C.state&&C.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"===_),!w||"sendrecv"!==_&&"sendonly"!==_?delete S.rtpReceiver:(L=w.track,b?(d[b.stream]||(d[b.stream]=new e.MediaStream),n(L,d[b.stream]),h.push([L,w,d[b.stream]])):(d.default||(d.default=new e.MediaStream),n(L,d.default),h.push([L,w,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,w=S.rtpReceiver||new e.RTCRtpReceiver(S.dtlsTransport,f),B)L=w.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&&(n(L,j),S.associatedRemoteMediaStreams.push(j)),h.push([L,w,j])}else S.rtpReceiver&&S.rtpReceiver.track&&(S.associatedRemoteMediaStreams.forEach(function(t){var n,i,r=t.getTracks().find(function(e){return e.id===S.rtpReceiver.track.id});r&&(n=r,(i=t).removeTrack(n),i.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:n})))}),S.associatedRemoteMediaStreams=[]);S.localCapabilities=R,S.remoteCapabilities=x,S.rtpReceiver=w,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 n=d[t];if(n.getTracks().length){if(-1===c.remoteStreams.indexOf(n)){c.remoteStreams.push(n);var i=new Event("addstream");i.stream=n,e.setTimeout(function(){c._dispatchEvent("addstream",i)})}h.forEach(function(e){var t=e[0],i=e[1];n.id===e[2].id&&l(c,t,i,[n])})}}),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 n=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",n)}},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 n=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",n)}},c.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(u("InvalidStateError","Can not call createOffer after close"));var a=n.transceivers.filter(function(e){return"audio"===e.kind}).length,s=n.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(n.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&&(n._createTransceiver("audio"),a--),s>0&&(n._createTransceiver("video"),s--);var l=i.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach(function(r,a){var s=r.track,o=r.kind,u=r.mid||i.generateIdentifier();r.mid=u,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(a,n.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"!==n._config.bundlePolicy&&(l+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),l+="a=ice-options:trickle\r\n",n.transceivers.forEach(function(e,t){l+=r(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),l+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1,l+="a="+i.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 n=this;if(n._isClosed)return Promise.reject(u("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(u("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var s=i.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(s+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),s+="a=ice-options:trickle\r\n";var o=i.getMediaSections(n._remoteDescription.sdp).length;n.transceivers.forEach(function(e,i){if(!(i+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,n._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,n=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(r,a){if(!n._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<n.transceivers.length;l++)if(n.transceivers[l].mid===e.sdpMid){s=l;break}var c=n.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?i.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!==n.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=i.getMediaSections(n._remoteDescription.sdp))[s]+="a="+(d.type?h:"end-of-candidates")+"\r\n",n._remoteDescription.sdp=i.getDescription(n._remoteDescription.sdp)+t.join("")}else for(var f=0;f<n.transceivers.length&&(n.transceivers[f].rejected||(n.transceivers[f].iceTransport.addRemoteCandidate({}),(t=i.getMediaSections(n._remoteDescription.sdp))[f]+="a=end-of-candidates\r\n",n._remoteDescription.sdp=i.getDescription(n._remoteDescription.sdp)+t.join(""),!n.usingBundle));f++);r()})},c.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var n=null;if(this.transceivers.forEach(function(e){e.rtpSender&&e.rtpSender.track===t?n=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(n=e.rtpReceiver)}),!n)throw u("InvalidAccessError","Invalid selector.");return n.getStats()}var i=[];return this.transceivers.forEach(function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(t){e[t]&&i.push(e[t].getStats())})}),Promise.all(i).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 n=e[t];if(n&&n.prototype&&n.prototype.getStats){var i=n.prototype.getStats;n.prototype.getStats=function(){return i.apply(this).then(function(e){var t=new Map;return Object.keys(e).forEach(function(n){var i;e[n].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(i=e[n]).type]||i.type,t.set(n,e[n])}),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,n){"use strict";var i={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};i.localCName=i.generateIdentifier(),i.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})},i.splitSections=function(e){return e.split("\nm=").map(function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"})},i.getDescription=function(e){var t=i.splitSections(e);return t&&t[0]},i.getMediaSections=function(e){var t=i.splitSections(e);return t.shift(),t},i.matchPrefix=function(e,t){return i.splitLines(e).filter(function(e){return 0===e.indexOf(t)})},i.parseCandidate=function(e){for(var t,n={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]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":n.relatedAddress=t[i+1];break;case"rport":n.relatedPort=parseInt(t[i+1],10);break;case"tcptype":n.tcpType=t[i+1];break;case"ufrag":n.ufrag=t[i+1],n.usernameFragment=t[i+1];break;default:n[t[i]]=t[i+1]}return n},i.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 n=e.type;return t.push("typ"),t.push(n),"host"!==n&&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(" ")},i.parseIceOptions=function(e){return e.substr(14).split(" ")},i.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},i.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},i.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]}},i.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},i.parseFmtp=function(e){for(var t,n={},i=e.substr(e.indexOf(" ")+1).split(";"),r=0;r<i.length;r++)n[(t=i[r].trim().split("="))[0].trim()]=t[1];return n},i.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var i=[];Object.keys(e.parameters).forEach(function(t){e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)}),t+="a=fmtp:"+n+" "+i.join(";")+"\r\n"}return t},i.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},i.writeRtcpFb=function(e){var t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},i.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(n.attribute=e.substr(t+1,i-t-1),n.value=e.substr(i+1)):n.attribute=e.substr(t+1),n},i.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(function(e){return parseInt(e,10)})}},i.getMid=function(e){var t=i.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},i.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},i.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:i.matchPrefix(e+t,"a=fingerprint:").map(i.parseFingerprint)}},i.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},i.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)}},i.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?i.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},i.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}},i.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},i.getCryptoParameters=function(e,t){return i.matchPrefix(e+t,"a=crypto:").map(i.parseCryptoLine)},i.getIceParameters=function(e,t){var n=i.matchPrefix(e+t,"a=ice-ufrag:")[0],r=i.matchPrefix(e+t,"a=ice-pwd:")[0];return n&&r?{usernameFragment:n.substr(12),password:r.substr(10)}:null},i.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},i.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=i.splitLines(e)[0].split(" "),r=3;r<n.length;r++){var a=n[r],s=i.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(s){var o=i.parseRtpMap(s),u=i.matchPrefix(e,"a=fmtp:"+a+" ");switch(o.parameters=u.length?i.parseFmtp(u[0]):{},o.rtcpFeedback=i.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(i.parseRtcpFb),t.codecs.push(o),o.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(o.name.toUpperCase())}}}return i.matchPrefix(e,"a=extmap:").forEach(function(e){t.headerExtensions.push(i.parseExtmap(e))}),t},i.writeRtpDescription=function(e,t){var n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=t.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(function(e){n+=i.writeRtpMap(e),n+=i.writeFmtp(e),n+=i.writeRtcpFb(e)});var r=0;return t.codecs.forEach(function(e){e.maxptime>r&&(r=e.maxptime)}),r>0&&(n+="a=maxptime:"+r+"\r\n"),n+="a=rtcp-mux\r\n",t.headerExtensions&&t.headerExtensions.forEach(function(e){n+=i.writeExtmap(e)}),n},i.parseRtpEncodingParameters=function(e){var t,n=[],r=i.parseRtpParameters(e),a=-1!==r.fecMechanisms.indexOf("RED"),s=-1!==r.fecMechanisms.indexOf("ULPFEC"),o=i.matchPrefix(e,"a=ssrc:").map(function(e){return i.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),u=o.length>0&&o[0].ssrc,l=i.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 i={ssrc:u,codecPayloadType:parseInt(e.parameters.apt,10)};u&&t&&(i.rtx={ssrc:t}),n.push(i),a&&((i=JSON.parse(JSON.stringify(i))).fec={ssrc:u,mechanism:s?"red+ulpfec":"red"},n.push(i))}}),0===n.length&&u&&n.push({ssrc:u});var c=i.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,n.forEach(function(e){e.maxBitrate=c})),n},i.parseRtcpParameters=function(e){var t={},n=i.matchPrefix(e,"a=ssrc:").map(function(e){return i.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);var r=i.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=r.length>0,t.compound=0===r.length;var a=i.matchPrefix(e,"a=rtcp-mux");return t.mux=a.length>0,t},i.parseMsid=function(e){var t,n=i.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(t=n[0].substr(7).split(" "))[0],track:t[1]};var r=i.matchPrefix(e,"a=ssrc:").map(function(e){return i.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},i.parseSctpDescription=function(e){var t,n=i.parseMLine(e),r=i.matchPrefix(e,"a=max-message-size:");r.length>0&&(t=parseInt(r[0].substr(19),10)),isNaN(t)&&(t=65536);var a=i.matchPrefix(e,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substr(12),10),protocol:n.fmt,maxMessageSize:t};if(i.matchPrefix(e,"a=sctpmap:").length>0){var s=i.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:t}}},i.writeSctpDescription=function(e,t){var n=[];return n="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&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,21)},i.writeSessionBoilerplate=function(e,t,n){var r,a=void 0!==t?t:2;return r=e||i.generateSessionId(),"v=0\r\no="+(n||"thisisadapterortc")+" "+r+" "+a+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},i.writeMediaSection=function(e,t,n,r){var a=i.writeRtpDescription(e.kind,t);if(a+=i.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=i.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"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:"+i.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+i.localCName+"\r\n"),a},i.getDirection=function(e,t){for(var n=i.splitLines(e),r=0;r<n.length;r++)switch(n[r]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[r].substr(2)}return t?i.getDirection(t):"sendrecv"},i.getKind=function(e){return i.splitLines(e)[0].split(" ")[0].substr(2)},i.isRejected=function(e){return"0"===e.split(" ",2)[1]},i.parseMLine=function(e){var t=i.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},i.parseOLine=function(e){var t=i.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]}},i.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=i.splitLines(e),n=0;n<t.length;n++)if(t[n].length<2||"="!==t[n].charAt(1))return!1;return!0},"object"==typeof t&&(t.exports=i)},{}]},{},[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,n,i){function r(s,o){if(!n[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=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return r(n||e)},c,c.exports,e,t,n,i)}return n[s].exports}for(var a="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(e,t,n){(function(e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),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,n){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,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),i(t,[{key:"setSrc",value:function(e){var t=this,n=!!this.options_.debug;this.options_.autoplay;this.debug=n;var i=this.options_.dataInterval;n&&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),n&&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),n&&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),n&&console.log("sendChannel has closed")},a.onopen=function(){n&&console.log("sendChannel has opened"),a.send("ping");var e=setInterval(function(){n&&console.log("sendChannel ping..."),a.send("ping")},i);t.sendChannelTicker=e},a.onmessage=function(e){n&&console.log("sendChannel message",e.data)},r.createOffer({offerToReceiveVideo:!0,offerToReceiveAudio:!0}).then(function(i){r.setLocalDescription(i).then(function(){var i=new XMLHttpRequest;i.open("POST",e.replace("webrtc","http"),!0),i.onreadystatechange=function(){if(4==i.readyState)if(i.status>=200&&i.status<300||304===i.status)try{r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:atob(i.responseText)})).catch(function(e){t.eventBusEl_&&t.trigger({type:"error",name:"set rtc remote sdp failed"}),n&&console.log("set rtc remote sdp error",e)})}catch(e){t.eventBusEl_&&t.trigger({type:"error",name:"set rtc remote sdp failed"}),n&&console.log("set rtc remote sdp error",e)}else t.eventBusEl_&&t.trigger({type:"error",name:"post rtc status "+i.status}),n&&console.log("post rtc status",i.status,i.statusText)},i.send(btoa(r.localDescription.sdp))}).catch(function(e){n&&console.log("pc setLocalDescription error",e)})}).catch(function(e){n&&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,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):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),n.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 n,i={},r={},a={};function s(e,t,n,i){return r={label:n,sources:t},"function"==typeof i?i(e,t,n):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,n,i){this.onClickListener=n,this.label=i,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(),n=this.player_.paused();this.showAsLabel(),this.addClass("vjs-selected"),n||this.player_.bigPlayButton.hide(),"function"!=typeof e&&"function"==typeof this.options_.customSourcePicker&&(e=this.options_.customSourcePicker);var i="loadeddata";"Youtube"!==this.player_.techName_&&"none"===this.player_.preload()&&"Flash"!==this.player_.techName_&&(i="timeupdate"),s(this.player_,this.src,this.options_.label,e),this.player_.one(i,function(){this.player_.currentTime(t),this.player_.handleTechSeeked_(),this.player_.trigger("resolutionchange")})}}),l=t.getComponent("MenuButton"),c=t.extend(l,{constructor:function(e,n,i,r){if(this.sources=n.sources,this.label=r,this.label.innerHTML=n.initialySelectedLabel,l.call(this,e,n,i),this.controlText("Quality"),i.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||{},n=function(t){e.map(function(e){e.selected(e===t),e.removeClass("vjs-selected")})};for(var i in t)t.hasOwnProperty(i)&&(e.push(new u(this.player_,{label:i,src:t[i],initialySelected:i===this.options_.initialySelectedLabel,customSourcePicker:this.options_.customSourcePicker},n,this.label)),a[i]=e[e.length-1]);return e}});n=function(e){var n=t.mergeOptions(i,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,n){null==e[t][n[t]]&&(e[t][n[t]]=[])}function p(e,t,n){e[t][n[t]].push(n)}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 i=function(e,t){var i=n.default,r="";"high"===i?(i=t[0].res,r=t[0].label):"low"!==i&&null!=i&&e.res[i]?e.res[i]&&(r=e.res[i][0].label):(i=t[t.length-1].res,r=t[t.length-1].label);return{res:i,label:r,sources:e.res[i]}}(l=h(e),e),r=new c(o,{sources:l,initialySelectedLabel:i.label,initialySelectedRes:i.res,customSourcePicker:n.customSourcePicker},n,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,i.sources,i.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"}},i=[];e.tech_.ytPlayer.getAvailableQualityLevels().map(function(n){i.push({src:e.src().src,type:e.src().type,label:t[n].label,res:t[n].res,_yt:t[n].yt})});var r="auto",a=0,s=((l=h(i)).label.auto,new c(e,{sources:l,initialySelectedLabel:r,initialySelectedRes:a,customSourcePicker:function(t,n,i){return e.tech_.ytPlayer.setPlaybackQuality(n[0]._yt),e}},n,u));s.el().classList.add("vjs-resolution-button"),e.controlBar.resolutionSwitcher=e.controlBar.addChild(s)})}(o)})},t.registerPlugin("videoJsResolutionSwitcher",n)}(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 n=this,i=n.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;i.hasAttribute("tabIndex")||i.setAttribute("tabIndex","-1"),i.style.outline="none",!p&&n.autoplay()||v||n.one("play",function(){i.focus({preventScroll:!0})}),g&&n.on("userinactive",function(){var e=function(){clearTimeout(t)},t=setTimeout(function(){n.off("useractive",e);var t=r.activeElement,a=i.querySelector(".vjs-control-bar");t&&t.parentElement==a&&i.focus()},10);n.one("useractive",e)}),n.on("play",function(){var e=i.querySelector(".iframeblocker");e&&""===e.style.display&&(e.style.display="block",e.style.bottom="39px")});var y=function(e){if(n.controls()){var t=r.activeElement;if((p||t==i||t==i.querySelector(".vjs-tech")||t==i.querySelector(".iframeblocker")||t==i.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?n.volume(n.volume()+o):-1==a&&n.volume(n.volume()-o)}}},_=function(e,n){return t.playPauseKey(e,n)?1:t.rewindKey(e,n)?2:t.forwardKey(e,n)?3:t.volumeUpKey(e,n)?4:t.volumeDownKey(e,n)?5:t.muteKey(e,n)?6:t.fullscreenKey(e,n)?7:void 0};function b(e){return"function"==typeof u?u(e):u}return n.on("keydown",function(e){var a,s,u=e.which,c=e.preventDefault,g=n.duration();if(n.controls()){var v=r.activeElement;if(p||v==i||v==i.querySelector(".vjs-tech")||v==i.querySelector(".vjs-control-bar")||v==i.querySelector(".iframeblocker"))switch(_(e,n)){case 1:c(),p&&e.stopPropagation(),n.paused()?n.play():n.pause();break;case 2:a=!n.paused(),c(),a&&n.pause(),(s=n.currentTime()-b(e))<=0&&(s=0),n.currentTime(s),a&&n.play();break;case 3:a=!n.paused(),c(),a&&n.pause(),(s=n.currentTime()+b(e))>=g&&(s=a?g-.001:g),n.currentTime(s),a&&n.play();break;case 5:c(),f?(s=n.currentTime()-1,n.currentTime()<=1&&(s=0),n.currentTime(s)):n.volume(n.volume()-o);break;case 4:c(),f?((s=n.currentTime()+1)>=g&&(s=g),n.currentTime(s)):n.volume(n.volume()+o);break;case 6:l&&n.muted(!n.muted());break;case 7:d&&(n.isFullscreen()?n.exitFullscreen():n.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(),n.currentTime(n.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(n,t,e))}}}}),n.on("mousewheel",y),n.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,n){(n=n||{}).sampleBits=n.sampleBits||8,n.sampleRate=n.sampleRate||8e3;var i=new(e.webkitAudioContext||e.AudioContext),r=i.createMediaStreamSource(t),a=(i.createScriptProcessor||i.createJavaScriptNode).apply(i,[4096,1,1]),s=!1,o={size:0,buffer:[],level:0,inputSampleRate:i.sampleRate,inputSampleBits:16,outputSampleRate:n.sampleRate,oututSampleBits:n.sampleBits,input:function(e){this.buffer.push(new Float32Array(e)),this.size+=e.length,n.pcmCallback&&(n.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,n=0;n<this.buffer.length;n++)e.set(this.buffer[n],t),t+=this.buffer[n].length;for(var i=parseInt(this.inputSampleRate/this.outputSampleRate),r=e.length/i,a=new Float32Array(r),s=0,o=0;s<r;)a[s]=e[o],o+=i,s++;return a},powerLevel:function(e,t){var n=e/t||0;return n<1251?Math.round(n/1250*10):Math.round(Math.min(100,Math.max(0,100*(1+Math.log(n/1e4)/Math.log(10)))))},encodePCM:function(){var e=Math.min(this.inputSampleBits,this.oututSampleBits),t=this.compress(),n=t.length*(e/8),i=new ArrayBuffer(n),r=new DataView(i),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),n=this.compress(),i=n.length*(t/8),r=new ArrayBuffer(44+i),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+i,!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,i,!0),s+=4,8===t)for(var l=0;l<n.length;l++,s++){var c=(d=Math.max(-1,Math.min(1,n[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<n.length;l++,s+=2){var d;c=(d=Math.max(-1,Math.min(1,n[l])))<0?32768*d:32767*d;o+=Math.abs(c),a.setInt16(s,c,!0)}return this.level=this.powerLevel(o,n.length),new Blob([a],{type:"audio/wav"})}};this.start=function(){s||(r.connect(a),a.connect(i.destination),s=!0)},this.stop=function(){s&&(a.disconnect(),s=!1)},this.destroy=function(){this.stop(),i&&(i.close(),i=null)},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 n=new FormData;n.append("audioData",this.getBlob()),n.append("pcmData",this.getPCMBlob());var i=new XMLHttpRequest;t&&(i.upload.addEventListener("progress",function(e){t("uploading",e)},!1),i.addEventListener("load",function(e){t("ok",e)},!1),i.addEventListener("error",function(e){t("error",e)},!1),i.addEventListener("abort",function(e){t("cancel",e)},!1)),i.open("POST",e),i.send(n)},a.onaudioprocess=function(e){o.input(e.inputBuffer.getChannelData(0))}};t.canRecording=null!=navigator.getUserMedia,t.get=function(e,n){if(e){if(!navigator.getUserMedia)return"https:"!=String(location.protocol).toLowerCase()?void e(null,"当前浏览器不支持录音功能, 请确认当前是否访问 HTTPS 服务!"):void e(null,"当前浏览器不支持录音功能。");navigator.getUserMedia({audio:!0},function(i){var r=new t(i,n);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":"点击切换到流畅播放"});
|