You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
1.2 MiB

This file contains invisible Unicode characters!

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("global/window"),require("global/document")):"function"==typeof define&&define.amd?define(["global/window","global/document"],t):(e=e||self).videojs=t(e.window,e.document)}(this,function(e,t){e=e&&e.hasOwnProperty("default")?e.default:e,t=t&&t.hasOwnProperty("default")?t.default:t;var i="7.6.3",r=[],n=function(t,i){return function(n,a,s){var o=i.levels[a],l=new RegExp("^("+o+")$");if("log"!==n&&s.unshift(n.toUpperCase()+":"),s.unshift(t+":"),r&&r.push([].concat(s)),e.console){var u=e.console[n];u||"debug"!==n||(u=e.console.info||e.console.log),u&&o&&l.test(n)&&u[Array.isArray(s)?"apply":"call"](e.console,s)}}};var a=function e(t){var i,a="info",s=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i("log",a,t)};return i=n(t,s),s.createLogger=function(i){return e(t+": "+i)},s.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:a},s.level=function(e){if("string"==typeof e){if(!s.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');a=e}return a},(s.history=function(){return r?[].concat(r):[]}).filter=function(e){return(r||[]).filter(function(t){return new RegExp(".*"+e+".*").test(t[0])})},s.history.clear=function(){r&&(r.length=0)},s.history.disable=function(){null!==r&&(r.length=0,r=null)},s.history.enable=function(){null===r&&(r=[])},s.error=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("error",a,t)},s.warn=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("warn",a,t)},s.debug=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("debug",a,t)},s}("VIDEOJS"),s=a.createLogger,o=Object.prototype.toString,l=function(e){return d(e)?Object.keys(e):[]};function u(e,t){l(e).forEach(function(i){return t(e[i],i)})}function c(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Object.assign?Object.assign.apply(Object,[e].concat(i)):(i.forEach(function(t){t&&u(t,function(t,i){e[i]=t})}),e)}function d(e){return!!e&&"object"==typeof e}function h(e){return d(e)&&"[object Object]"===o.call(e)&&e.constructor===Object}function f(t,i){if(!t||!i)return"";if("function"==typeof e.getComputedStyle){var r=e.getComputedStyle(t);return r?r.getPropertyValue(i)||r[i]:""}return""}function p(e){return"string"==typeof e&&/\S/.test(e)}function m(e){if(/\s/.test(e))throw new Error("class has illegal whitespace characters")}function g(){return t===e.document}function v(e){return d(e)&&1===e.nodeType}function y(){try{return e.parent!==e.self}catch(e){return!0}}function _(e){return function(i,r){if(!p(i))return t[e](null);p(r)&&(r=t.querySelector(r));var n=v(r)?r:t;return n[e]&&n[e](i)}}function b(e,i,r,n){void 0===e&&(e="div"),void 0===i&&(i={}),void 0===r&&(r={});var s=t.createElement(e);return Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(a.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+t+"."),s.setAttribute(e,t)):"textContent"===e?T(s,t):s[e]=t}),Object.getOwnPropertyNames(r).forEach(function(e){s.setAttribute(e,r[e])}),n&&j(s,n),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 E(e,t){return m(t),e.classList?e.classList.contains(t):(i=t,new RegExp("(^|\\s)"+i+"($|\\s)")).test(e.className);var i}function k(e,t){return e?(e.classList?e.classList.add(t):E(e,t)||(e.className=(e.className+" "+t).trim()),e):e}function w(e,t){return e?(e.classList?e.classList.remove(t):(m(t),e.className=e.className.split(/\s+/).filter(function(e){return e!==t}).join(" ")),e):e}function C(e,t,i){var r=E(e,t);return"function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=!r),i===r?e:(i?k(e,t):w(e,t),e)}function L(e,t){Object.getOwnPropertyNames(t).forEach(function(i){var r=t[i];null===r||void 0===r||!1===r?e.removeAttribute(i):e.setAttribute(i,!0===r?"":r)})}function A(e){var t={},i=",autoplay,stretch,fluent,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0)for(var r=e.attributes,n=r.length-1;n>=0;n--){var a=r[n].name,s=r[n].value;"boolean"!=typeof e[a]&&-1===i.indexOf(","+a+",")||(s=null!==s),t[a]=s}return t}function R(e,t){return e.getAttribute(t)}function P(e,t,i){e.setAttribute(t,i)}function D(e,t){e.removeAttribute(t)}function I(){t.body.focus(),t.onselectstart=function(){return!1}}function x(){t.onselectstart=function(){return!0}}function O(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach(function(e){void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(f(e,"height"))),i.width||(i.width=parseFloat(f(e,"width"))),i}}function M(i){var r;if(i.getBoundingClientRect&&i.parentNode&&(r=i.getBoundingClientRect()),!r)return{left:0,top:0};var n=t.documentElement,a=t.body,s=n.clientLeft||a.clientLeft||0,o=e.pageXOffset||a.scrollLeft,l=r.left+o-s,u=n.clientTop||a.clientTop||0,c=e.pageYOffset||a.scrollTop,d=r.top+c-u;return{left:Math.round(l),top:Math.round(d)}}function U(e,t){var i={},r=M(e),n=e.offsetWidth,a=e.offsetHeight,s=r.top,o=r.left,l=t.pageY,u=t.pageX;return t.changedTouches&&(u=t.changedTouches[0].pageX,l=t.changedTouches[0].pageY),i.y=Math.max(0,Math.min(1,(s-l+a)/a)),i.x=Math.max(0,Math.min(1,(u-o)/n)),i}function B(e){return d(e)&&3===e.nodeType}function N(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function F(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(function(e){return"function"==typeof e&&(e=e()),v(e)||B(e)?e:"string"==typeof e&&/\S/.test(e)?t.createTextNode(e):void 0}).filter(function(e){return e})}function j(e,t){return F(t).forEach(function(t){return e.appendChild(t)}),e}function G(e,t){return j(N(e),t)}function V(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"),K=_("querySelectorAll"),q=Object.freeze({isReal:g,isEl:v,isInFrame:y,createEl:b,textContent:T,prependTo:S,hasClass:E,addClass:k,removeClass:w,toggleClass:C,setAttributes:L,getAttributes:A,getAttribute:R,setAttribute:P,removeAttribute:D,blockTextSelection:I,unblockTextSelection:x,getBoundingClientRect:O,findPosition:M,getPointerPosition:U,isTextNode:B,emptyEl:N,normalizeContent:F,appendContent:j,insertContent:G,isSingleLeftClick:V,$:H,$$:K}),W=new WeakMap,z=1;function Y(){return z++}function X(e,t){if(W.has(e)){var i=W.get(e);0===i.handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&W.delete(e)}}function $(e,t,i,r){i.forEach(function(i){e(t,i,r)})}function Q(i){function r(){return!0}function n(){return!1}if(!i||!i.isPropagationStopped){var a=i||e.event;for(var s in i={},a)"layerX"!==s&&"layerY"!==s&&"keyLocation"!==s&&"webkitMovementX"!==s&&"webkitMovementY"!==s&&("returnValue"!==s&&"path"!==s||!a.preventDefault)&&(i[s]=a[s]);if(i.target||(i.target=i.srcElement||t),i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement),i.preventDefault=function(){a.preventDefault&&a.preventDefault(),i.returnValue=!1,a.returnValue=!1,i.defaultPrevented=!0},i.defaultPrevented=!1,i.stopPropagation=function(){a.stopPropagation&&a.stopPropagation(),i.cancelBubble=!0,a.cancelBubble=!0,i.isPropagationStopped=r},i.isPropagationStopped=n,i.stopImmediatePropagation=function(){a.stopImmediatePropagation&&a.stopImmediatePropagation(),i.isImmediatePropagationStopped=r,i.stopPropagation()},i.isImmediatePropagationStopped=n,null!==i.clientX&&void 0!==i.clientX){var o=t.documentElement,l=t.body;i.pageX=i.clientX+(o&&o.scrollLeft||l&&l.scrollLeft||0)-(o&&o.clientLeft||l&&l.clientLeft||0),i.pageY=i.clientY+(o&&o.scrollTop||l&&l.scrollTop||0)-(o&&o.clientTop||l&&l.clientTop||0)}i.which=i.charCode||i.keyCode,null!==i.button&&void 0!==i.button&&(i.button=1&i.button?0:4&i.button?1:2&i.button?2:0)}return i}var J=!1;!function(){try{var t=Object.defineProperty({},"passive",{get:function(){J=!0}});e.addEventListener("test",null,t),e.removeEventListener("test",null,t)}catch(e){}}();var Z=["touchstart","touchmove"];function ee(e,t,i){if(Array.isArray(t))return $(ee,e,t,i);W.has(e)||W.set(e,{});var r=W.get(e);if(r.handlers||(r.handlers={}),r.handlers[t]||(r.handlers[t]=[]),i.guid||(i.guid=Y()),r.handlers[t].push(i),r.dispatcher||(r.disabled=!1,r.dispatcher=function(t,i){if(!r.disabled){t=Q(t);var n=r.handlers[t.type];if(n)for(var s=n.slice(0),o=0,l=s.length;o<l&&!t.isImmediatePropagationStopped();o++)try{s[o].call(e,t,i)}catch(e){a.error(e)}}}),1===r.handlers[t].length)if(e.addEventListener){var n=!1;J&&Z.indexOf(t)>-1&&(n={passive:!0}),e.addEventListener(t,r.dispatcher,n)}else e.attachEvent&&e.attachEvent("on"+t,r.dispatcher)}function te(e,t,i){if(W.has(e)){var r=W.get(e);if(r.handlers){if(Array.isArray(t))return $(te,e,t,i);var n=function(e,t){r.handlers[t]=[],X(e,t)};if(void 0!==t){var a=r.handlers[t];if(a)if(i){if(i.guid)for(var s=0;s<a.length;s++)a[s].guid===i.guid&&a.splice(s--,1);X(e,t)}else n(e,t)}else for(var o in r.handlers)Object.prototype.hasOwnProperty.call(r.handlers||{},o)&&n(e,o)}}}function ie(e,t,i){var r=W.has(e)?W.get(e):{},n=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=Q(t),r.dispatcher&&r.dispatcher.call(e,t,i),n&&!t.isPropagationStopped()&&!0===t.bubbles)ie.call(null,n,t,i);else if(!n&&!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 re(e,t,i){if(Array.isArray(t))return $(re,e,t,i);var r=function r(){te(e,t,r),i.apply(this,arguments)};r.guid=i.guid=i.guid||Y(),ee(e,t,r)}function ne(e,t,i){var r=function r(){te(e,t,r),i.apply(this,arguments)};r.guid=i.guid=i.guid||Y(),ee(e,t,r)}var ae,se=Object.freeze({fixEvent:Q,on:ee,off:te,trigger:ie,one:re,any:ne}),oe=!1,le=function(){if(g()&&!1!==ae.options.autoSetup){var e=Array.prototype.slice.call(t.getElementsByTagName("video")),i=Array.prototype.slice.call(t.getElementsByTagName("audio")),r=Array.prototype.slice.call(t.getElementsByTagName("video-js")),n=e.concat(i,r);if(n&&n.length>0)for(var a=0,s=n.length;a<s;a++){var o=n[a];if(!o||!o.getAttribute){ue(1);break}void 0===o.player&&null!==o.getAttribute("data-setup")&&ae(o)}else oe||ue(1)}};function ue(t,i){i&&(ae=i),e.setTimeout(le,t)}g()&&"complete"===t.readyState?oe=!0:re(e,"load",function(){oe=!0});var ce,de=function(e){var i=t.createElement("style");return i.className=e,i},he=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t},fe=30,pe=function(e,t,i){t.guid||(t.guid=Y());var r=t.bind(e);return r.guid=i?i+"_"+t.guid:t.guid,r},me=function(t,i){var r=e.performance.now();return function(){var n=e.performance.now();n-r>=i&&(t.apply(void 0,arguments),r=n)}},ge=function(t,i,r,n){var a;void 0===n&&(n=e);var s=function(){var e=this,s=arguments,o=function(){a=null,o=null,r||t.apply(e,s)};!a&&r&&t.apply(e,s),n.clearTimeout(a),a=n.setTimeout(o,i)};return s.cancel=function(){n.clearTimeout(a),a=null},s},ve=function(){};ve.prototype.allowedEvents_={},ve.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},ee(this,e,t),this.addEventListener=i},ve.prototype.addEventListener=ve.prototype.on,ve.prototype.off=function(e,t){te(this,e,t)},ve.prototype.removeEventListener=ve.prototype.off,ve.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},re(this,e,t),this.addEventListener=i},ve.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},ne(this,e,t),this.addEventListener=i},ve.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=Q(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ie(this,e)},ve.prototype.dispatchEvent=ve.prototype.trigger,ve.prototype.queueTrigger=function(t){var i=this;ce||(ce=new Map);var r=t.type||t,n=ce.get(this);n||(n=new Map,ce.set(this,n));var a=n.get(r);n.delete(r),e.clearTimeout(a);var s=e.setTimeout(function(){0===n.size&&(n=null,ce.delete(i)),i.trigger(t)},0);n.set(r,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.")},Ee=function(e,t){var i,r,n,a=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return a?(i=e.eventBusEl_,t.length>=3&&t.shift(),r=t[0],n=t[1]):(i=t[0],r=t[1],n=t[2]),be(i),Te(r),Se(n),{isTargetingSelf:a,target:i,type:r,listener:n=pe(e,n)}},ke=function(e,t,i,r){be(e),e.nodeName?se[t](e,i,r):e[t](i,r)},we={on:function(){for(var e=this,t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];var n=Ee(this,i),a=n.isTargetingSelf,s=n.target,o=n.type,l=n.listener;if(ke(s,"on",o,l),!a){var u=function(){return e.off(s,o,l)};u.guid=l.guid;var c=function(){return e.off("dispose",u)};c.guid=l.guid,ke(this,"on","dispose",u),ke(s,"on","dispose",c)}},one:function(){for(var e=this,t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];var n=Ee(this,i),a=n.isTargetingSelf,s=n.target,o=n.type,l=n.listener;if(a)ke(s,"one",o,l);else{var u=function t(){e.off(s,o,t);for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];l.apply(null,r)};u.guid=l.guid,ke(s,"one",o,u)}},any:function(){for(var e=this,t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];var n=Ee(this,i),a=n.isTargetingSelf,s=n.target,o=n.type,l=n.listener;if(a)ke(s,"any",o,l);else{var u=function t(){e.off(s,o,t);for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];l.apply(null,r)};u.guid=l.guid,ke(s,"any",o,u)}},off:function(e,t,i){if(!e||_e(e))te(this.eventBusEl_,e,t);else{var r=e,n=t;be(r),Te(n),Se(i),i=pe(this,i),this.off("dispose",i),r.nodeName?(te(r,n,i),te(r,"dispose",i)):ye(r)&&(r.off(n,i),r.off("dispose",i))}},trigger:function(e,t){return ie(this.eventBusEl_,e,t)}};function Ce(t,i){void 0===i&&(i={});var r=i.eventBusKey;if(r){if(!t[r].nodeName)throw new Error('The eventBusKey "'+r+'" does not refer to an element.');t.eventBusEl_=t[r]}else t.eventBusEl_=b("span",{className:"vjs-event-bus"});return c(t,we),t.eventedCallbacks&&t.eventedCallbacks.forEach(function(e){e()}),t.on("dispose",function(){t.off(),e.setTimeout(function(){t.eventBusEl_=null},0)}),t}var Le={state:{},setState:function(e){var t,i=this;return"function"==typeof e&&(e=e()),u(e,function(e,r){i.state[r]!==e&&((t=t||{})[r]={from:i.state[r],to:e}),i.state[r]=e}),t&&ye(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function Ae(e,t){return c(e,Le),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()})},Pe=function(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toUpperCase()})};function De(){for(var e={},t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return i.forEach(function(t){t&&u(t,function(t,i){h(t)?(h(e[i])||(e[i]={}),e[i]=De(e[i],t)):e[i]=t})}),e}var Ie=function(){function t(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.parentComponent_=null,this.options_=De({},this.options_),t=this.options_=De(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){var r=e&&e.id&&e.id()||"no_player";this.id_=r+"_component_"+Y()}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),!1!==t.evented&&Ce(this,{eventBusKey:this.el_?"el_":null}),Ae(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.clearingTimersOnDispose_=!1,!1!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var i=t.prototype;return i.dispose=function(){if(this.trigger({type:"dispose",bubbles:!1}),this.children_)for(var e=this.children_.length-1;e>=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),W.has(this.el_)&&W.delete(this.el_),this.el_=null),this.player_=null},i.player=function(){return this.player_},i.options=function(e){return e?(this.options_=De(this.options_,e),this.options_):this.options_},i.el=function(){return this.el_},i.createEl=function(e,t,i){return b(e,t,i)},i.localize=function(e,t,i){void 0===i&&(i=e);var r=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),a=n&&n[r],s=r&&r.split("-")[0],o=n&&n[s],l=i;return a&&a[e]?l=a[e]:o&&o[e]&&(l=o[e]),t&&(l=l.replace(/\{(\d+)\}/g,function(e,i){var r=t[i-1],n=r;return void 0===r&&(n=e),n})),l},i.contentEl=function(){return this.contentEl_||this.el_},i.id=function(){return this.id_},i.name=function(){return this.name_},i.children=function(){return this.children_},i.getChildById=function(e){return this.childIndex_[e]},i.getChild=function(e){if(e)return this.childNameIndex_[e]},i.addChild=function(e,i,r){var n,a;if(void 0===i&&(i={}),void 0===r&&(r=this.children_.length),"string"==typeof e){a=Pe(e);var s=i.componentClass||a;i.name=a;var o=t.getComponent(s);if(!o)throw new Error("Component "+s+" does not exist");if("function"!=typeof o)return null;n=new o(this.player_||this,i)}else n=e;if(n.parentComponent_&&n.parentComponent_.removeChild(n),this.children_.splice(r,0,n),n.parentComponent_=this,"function"==typeof n.id&&(this.childIndex_[n.id()]=n),(a=a||n.name&&Pe(n.name()))&&(this.childNameIndex_[a]=n,this.childNameIndex_[Re(a)]=n),"function"==typeof n.el&&n.el()){var l=this.contentEl().children[r]||null;this.contentEl().insertBefore(n.el(),l)}return n},i.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,i=this.children_.length-1;i>=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Pe(e.name())]=null,this.childNameIndex_[Re(e.name())]=null;var r=e.el();r&&r.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},i.initChildren=function(){var e=this,i=this.options_.children;if(i){var r,n=this.options_,a=t.getComponent("Tech");(r=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter(function(e){return!r.some(function(t){return"string"==typeof t?e===t:e===t.name})})).map(function(t){var r,n;return"string"==typeof t?n=i[r=t]||e.options_[r]||{}:(r=t.name,n=t),{name:r,opts:n}}).filter(function(e){var i=t.getComponent(e.opts.componentClass||Pe(e.name));return i&&!a.isTech(i)}).forEach(function(t){var i=t.name,r=t.opts;if(void 0!==n[i]&&(r=n[i]),!1!==r){!0===r&&(r={}),r.playerOptions=e.options_.playerOptions;var a=e.addChild(i,r);a&&(e[i]=a)}})}},i.buildCSSClass=function(){return""},i.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},i.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)},i.$=function(e,t){return H(e,t||this.contentEl())},i.$$=function(e,t){return K(e,t||this.contentEl())},i.hasClass=function(e){return E(this.el_,e)},i.addClass=function(e){k(this.el_,e)},i.removeClass=function(e){w(this.el_,e)},i.toggleClass=function(e,t){C(this.el_,e,t)},i.show=function(){this.removeClass("vjs-hidden")},i.hide=function(){this.addClass("vjs-hidden")},i.lockShowing=function(){this.addClass("vjs-lock-showing")},i.unlockShowing=function(){this.removeClass("vjs-lock-showing")},i.getAttribute=function(e){return R(this.el_,e)},i.setAttribute=function(e,t){P(this.el_,e,t)},i.removeAttribute=function(e){D(this.el_,e)},i.width=function(e,t){return this.dimension("width",e,t)},i.height=function(e,t){return this.dimension("height",e,t)},i.dimensions=function(e,t){this.width(e,!0),this.height(t)},i.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var r=this.el_.style[e],n=r.indexOf("px");return-1!==n?parseInt(r.slice(0,n),10):parseInt(this.el_["offset"+Pe(e)],10)},i.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=f(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+Pe(e);t=this.el_[i]}return t},i.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},i.currentWidth=function(){return this.currentDimension("width")},i.currentHeight=function(){return this.currentDimension("height")},i.focus=function(){this.el_.focus()},i.blur=function(){this.el_.blur()},i.handleKeyDown=function(e){this.player_&&(e.stopPropagation(),this.player_.handleKeyDown(e))},i.handleKeyPress=function(e){this.handleKeyDown(e)},i.emitTapEvents=function(){var t,i=0,r=null;this.on("touchstart",function(n){1===n.touches.length&&(r={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},i=e.performance.now(),t=!0)}),this.on("touchmove",function(e){if(e.touches.length>1)t=!1;else if(r){var i=e.touches[0].pageX-r.pageX,n=e.touches[0].pageY-r.pageY;Math.sqrt(i*i+n*n)>10&&(t=!1)}});var n=function(){t=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",function(n){(r=null,!0===t)&&(e.performance.now()-i<200&&(n.preventDefault(),this.trigger("tap")))})},i.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=pe(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},i.setTimeout=function(t,i){var r,n=this;return t=pe(this,t),this.clearTimersOnDispose_(),r=e.setTimeout(function(){n.setTimeoutIds_.has(r)&&n.setTimeoutIds_.delete(r),t()},i),this.setTimeoutIds_.add(r),r},i.clearTimeout=function(t){return this.setTimeoutIds_.has(t)&&(this.setTimeoutIds_.delete(t),e.clearTimeout(t)),t},i.setInterval=function(t,i){t=pe(this,t),this.clearTimersOnDispose_();var r=e.setInterval(t,i);return this.setIntervalIds_.add(r),r},i.clearInterval=function(t){return this.setIntervalIds_.has(t)&&(this.setIntervalIds_.delete(t),e.clearInterval(t)),t},i.requestAnimationFrame=function(t){var i,r=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),t=pe(this,t),i=e.requestAnimationFrame(function(){r.rafIds_.has(i)&&r.rafIds_.delete(i),t()}),this.rafIds_.add(i),i):this.setTimeout(t,1e3/60)},i.cancelAnimationFrame=function(t){return this.supportsRaf_?(this.rafIds_.has(t)&&(this.rafIds_.delete(t),e.cancelAnimationFrame(t)),t):this.clearTimeout(t)},i.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",function(){[["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(t){var i=t[0],r=t[1];e[i].forEach(e[r],e)}),e.clearingTimersOnDispose_=!1}))},t.registerComponent=function(e,i){if("string"!=typeof e||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var r,n=t.getComponent("Tech"),a=n&&n.isTech(i),s=t===i||t.prototype.isPrototypeOf(i.prototype);if(a||!s)throw r=a?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+e+'"; '+r+".");e=Pe(e),t.components_||(t.components_={});var o=t.getComponent("Player");if("Player"===e&&o&&o.players){var l=o.players,u=Object.keys(l);if(l&&u.length>0&&u.map(function(e){return l[e]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return t.components_[e]=i,t.components_[Re(e)]=i,i},t.getComponent=function(e){if(e&&t.components_)return t.components_[e]},t}();function xe(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Oe(e,t){return(Oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Me(e,t,i){return(Me=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,i){var r=[null];r.push.apply(r,t);var n=new(Function.bind.apply(e,r));return i&&Oe(n,i.prototype),n}).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 Be,Ne=e.navigator&&e.navigator.userAgent||"",Fe=/AppleWebKit\/([\d.]+)/i.exec(Ne),je=Fe?parseFloat(Fe.pop()):null,Ge=/iPad/i.test(Ne),Ve=/iPhone/i.test(Ne)&&!Ge,He=/iPod/i.test(Ne),Ke=Ve||Ge||He,qe=(Be=Ne.match(/OS (\d+)_/i))&&Be[1]?Be[1]:null,We=/Android/i.test(Ne),ze=function(){var e=Ne.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),Ye=We&&ze<5&&je<537,Xe=/Firefox/i.test(Ne),$e=/Edge/i.test(Ne),Qe=!$e&&(/Chrome/i.test(Ne)||/CriOS/i.test(Ne)),Je=function(){var e=Ne.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Ze=function(){var e=/MSIE\s(\d+)\.\d/.exec(Ne),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(Ne)&&/rv:11.0/.test(Ne)&&(t=11),t}(),et=/Safari/i.test(Ne)&&!Qe&&!We&&!$e,tt=(et||Ke)&&!Qe,it=/Windows/i.test(Ne),rt=g()&&("ontouchstart"in e||e.navigator.maxTouchPoints||e.DocumentTouch&&e.document instanceof e.DocumentTouch),nt=Object.freeze({IS_IPAD:Ge,IS_IPHONE:Ve,IS_IPOD:He,IS_IOS:Ke,IOS_VERSION:qe,IS_ANDROID:We,ANDROID_VERSION:ze,IS_NATIVE_ANDROID:Ye,IS_FIREFOX:Xe,IS_EDGE:$e,IS_CHROME:Qe,CHROME_VERSION:Je,IE_VERSION:Ze,IS_SAFARI:et,IS_ANY_SAFARI:tt,IS_WINDOWS:it,TOUCH_ENABLED:rt});function at(e,t,i,r){return function(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,r,i.length-1),i[r][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 lt(e,t){var i,r,n=0;if(!t)return 0;e&&e.length||(e=ot(0,0));for(var a=0;a<e.length;a++)i=e.start(a),(r=e.end(a))>t&&(r=t),n+=r-i;return n/t}for(var ut,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){ut=dt[ft];break}if(ut){for(var pt=0;pt<ut.length;pt++)ct[ht[pt]]=ut[pt];ct.prefixed=ut[0]!==ht[0]}function mt(e){if(e instanceof mt)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:d(e)&&("number"==typeof e.code&&(this.code=e.code),c(this,e)),this.message||(this.message=mt.defaultMessages[this.code]||"")}mt.prototype.code=0,mt.prototype.message="",mt.prototype.status=null,mt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],mt.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var gt=0;gt<mt.errorTypes.length;gt++)mt[mt.errorTypes[gt]]=gt,mt.prototype[mt.errorTypes[gt]]=gt;var vt=function(e,t){var i,r=null;try{i=JSON.parse(e,t)}catch(e){r=e}return[r,i]};function yt(e){return void 0!==e&&null!==e&&"function"==typeof e.then}function _t(e){yt(e)&&e.then(null,function(e){})}var bt=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(t,i,r){return e[i]&&(t[i]=e[i]),t},{cues:e.cues&&Array.prototype.map.call(e.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})},Tt=function(e){var t=e.$$("track"),i=Array.prototype.map.call(t,function(e){return e.track});return Array.prototype.map.call(t,function(e){var t=bt(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===i.indexOf(e)}).map(bt))},St=function(e,t){return e.forEach(function(e){var i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(function(e){return i.addCue(e)})}),t.textTracks()};function Et(e,t){return e(t={exports:{}},t.exports),t.exports}var kt=Et(function(e,t){function i(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return s[e];var i,a=String(e);return(i=r[a.toLowerCase()])?i:(i=n[a.toLowerCase()])||(1===a.length?a.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null===i||void 0===i)return!1;if("string"==typeof t){var a;if(a=r[t.toLowerCase()])return a===i;if(a=n[t.toLowerCase()])return a===i}else if("number"==typeof t)return t===i;return!1}};var r=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},n=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++)r[String.fromCharCode(a)]=a-32;for(var a=48;a<58;a++)r[a-48]=a;for(a=1;a<13;a++)r["f"+a]=a+111;for(a=0;a<10;a++)r["numpad "+a]=a+96;var s=t.names=t.title={};for(a in r)s[r[a]]=a;for(var o in n)r[o]=n[o]}),wt=(kt.code,kt.codes,kt.aliases,kt.names,kt.title,"vjs-modal-dialog"),Ct=function(i){function r(e,t){var r;return(r=i.call(this,e,t)||this).opened_=r.hasBeenOpened_=r.hasBeenFilled_=!1,r.closeable(!r.options_.uncloseable),r.content(r.options_.content),r.contentEl_=b("div",{className:wt+"-content"},{role:"document"}),r.descEl_=b("p",{className:wt+"-description vjs-control-text",id:r.el().getAttribute("aria-describedby")}),T(r.descEl_,r.description()),r.el_.appendChild(r.descEl_),r.el_.appendChild(r.contentEl_),r}xe(r,i);var n=r.prototype;return n.createEl=function(){return i.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},n.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,i.prototype.dispose.call(this)},n.buildCSSClass=function(){return wt+" vjs-hidden "+i.prototype.buildCSSClass.call(this)},n.label=function(){return this.localize(this.options_.label||"Modal Window")},n.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},n.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}},n.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},n.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()}},n.closeable=function(e){if("boolean"==typeof e){var t=this.closeable_=!!e,i=this.getChild("closeButton");if(t&&!i){var r=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(i,"close",this.close)}!t&&i&&(this.off(i,"close",this.close),this.removeChild(i),i.dispose())}return this.closeable_},n.fill=function(){this.fillWith(this.content())},n.fillWith=function(e){var t=this.contentEl(),i=t.parentNode,r=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),G(t,e),this.trigger("modalfill"),r?i.insertBefore(t,r):i.appendChild(t);var n=this.getChild("closeButton");n&&i.appendChild(n.el_)},n.empty=function(){this.trigger("beforemodalempty"),N(this.contentEl()),this.trigger("modalempty")},n.content=function(e){return void 0!==e&&(this.content_=e),this.content_},n.conditionalFocus_=function(){var e=t.activeElement,i=this.player_.el_;this.previouslyActiveEl_=null,(i.contains(e)||i===e)&&(this.previouslyActiveEl_=e,this.focus())},n.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},n.handleKeyDown=function(e){if(e.stopPropagation(),kt.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(kt.isEventKey(e,"Tab")){for(var i,r=this.focusableEls_(),n=this.el_.querySelector(":focus"),a=0;a<r.length;a++)if(n===r[a]){i=a;break}t.activeElement===this.el_&&(i=0),e.shiftKey&&0===i?(r[r.length-1].focus(),e.preventDefault()):e.shiftKey||i!==r.length-1||(r[0].focus(),e.preventDefault())}},n.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")})},r}(Ie);Ct.prototype.options_={pauseOnOpen:!0,temporary:!0},Ie.registerComponent("ModalDialog",Ct);var Lt=function(e){function t(t){var i;void 0===t&&(t=[]),(i=e.call(this)||this).tracks_=[],Object.defineProperty(Ue(i),"length",{get:function(){return this.tracks_.length}});for(var r=0;r<t.length;r++)i.addTrack(t[r]);return i}xe(t,e);var i=t.prototype;return i.addTrack=function(e){var t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.tracks_[t]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this}))},i.removeTrack=function(e){for(var t,i=0,r=this.length;i<r;i++)if(this[i]===e){(t=this[i]).off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},i.getTrackById=function(e){for(var t=null,i=0,r=this.length;i<r;i++){var n=this[i];if(n.id===e){t=n;break}}return t},t}(ve);for(var At in Lt.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"},Lt.prototype.allowedEvents_)Lt.prototype["on"+At]=null;var Rt=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)},Pt=function(e){function t(t){var i;void 0===t&&(t=[]);for(var r=t.length-1;r>=0;r--)if(t[r].enabled){Rt(t,t[r]);break}return(i=e.call(this,t)||this).changing_=!1,i}xe(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&Rt(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,Rt(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(Lt),Dt=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)},It=function(e){function t(t){var i;void 0===t&&(t=[]);for(var r=t.length-1;r>=0;r--)if(t[r].selected){Dt(t,t[r]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(Ue(i),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),i}xe(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.selected&&Dt(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,Dt(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)},t}(Lt),xt=function(e){function t(){return e.apply(this,arguments)||this}xe(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;e.prototype.addTrack.call(this,t),this.queueChange_||(this.queueChange_=function(){return i.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return i.trigger("selectedlanguagechange")}),t.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&(this.queueChange_&&t.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&t.removeEventListener("modechange",this.triggerSelectedlanguagechange_))},t}(Lt),Ot=function(){function e(e){void 0===e&&(e=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}var t=e.prototype;return t.addTrackElement_=function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)},t.getTrackElementByTrack_=function(e){for(var t,i=0,r=this.trackElements_.length;i<r;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t},t.removeTrackElement_=function(e){for(var t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}},e}(),Mt=function(){function e(t){e.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var t=e.prototype;return t.setCues_=function(e){var t=this.length||0,i=0,r=e.length;this.cues_=e,this.length_=e.length;var n=function(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})};if(t<r)for(i=t;i<r;i++)n.call(this,i)},t.getCueById=function(e){for(var t=null,i=0,r=this.length;i<r;i++){var n=this[i];if(n.id===e){t=n;break}}return t},e}(),Ut={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Bt={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Nt={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Ft={disabled:"disabled",hidden:"hidden",showing:"showing"},jt=function(e){function t(t){var i;void 0===t&&(t={}),i=e.call(this)||this;var r={id:t.id||"vjs_track_"+Y(),kind:t.kind||"",label:t.label||"",language:t.language||""},n=function(e){Object.defineProperty(Ue(i),e,{get:function(){return r[e]},set:function(){}})};for(var a in r)n(a);return i}return xe(t,e),t}(ve),Gt=function(i){var r=["protocol","hostname","port","pathname","search","hash","host"],n=t.createElement("a");n.href=i;var a,s=""===n.host&&"file:"!==n.protocol;s&&((a=t.createElement("div")).innerHTML='<a href="'+i+'"></a>',n=a.firstChild,a.setAttribute("style","display:none; position:absolute;"),t.body.appendChild(a));for(var o={},l=0;l<r.length;l++)o[r[l]]=n[r[l]];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},Vt=function(e){if(!e.match(/^https?:\/\//)){var i=t.createElement("div");i.innerHTML='<a href="'+e+'">x</a>',e=i.firstChild.href}return e},Ht=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},Kt=function(t){var i=e.location,r=Gt(t);return(":"===r.protocol?i.protocol:r.protocol)+r.host!==i.protocol+i.host},qt=Object.freeze({parseUrl:Gt,getAbsoluteURL:Vt,getFileExtension:Ht,isCrossOrigin:Kt}),Wt=function(e){var t=zt.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)},zt=Object.prototype.toString;var Yt,Xt=Array.prototype.slice,$t=Object.prototype.toString,Qt=Function.prototype.bind||function(e){var t=this;if("function"!=typeof t||"[object Function]"!==$t.call(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var i,r=Xt.call(arguments,1),n=Math.max(0,t.length-r.length),a=[],s=0;s<n;s++)a.push("$"+s);if(i=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof i){var n=t.apply(this,r.concat(Xt.call(arguments)));return Object(n)===n?n:this}return t.apply(e,r.concat(Xt.call(arguments)))}),t.prototype){var o=function(){};o.prototype=t.prototype,i.prototype=new o,o.prototype=null}return i},Jt=Object.prototype.toString,Zt=function(e){var t=Jt.call(e),i="[object Arguments]"===t;return i||(i="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===Jt.call(e.callee)),i};if(!Object.keys){var ei=Object.prototype.hasOwnProperty,ti=Object.prototype.toString,ii=Zt,ri=Object.prototype.propertyIsEnumerable,ni=!ri.call({toString:null},"toString"),ai=ri.call(function(){},"prototype"),si=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],oi=function(e){var t=e.constructor;return t&&t.prototype===e},li={$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},ui=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!li["$"+e]&&ei.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{oi(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();Yt=function(e){var t=null!==e&&"object"==typeof e,i="[object Function]"===ti.call(e),r=ii(e),n=t&&"[object String]"===ti.call(e),a=[];if(!t&&!i&&!r)throw new TypeError("Object.keys called on a non-object");var s=ai&&i;if(n&&e.length>0&&!ei.call(e,0))for(var o=0;o<e.length;++o)a.push(String(o));if(r&&e.length>0)for(var l=0;l<e.length;++l)a.push(String(l));else for(var u in e)s&&"prototype"===u||!ei.call(e,u)||a.push(String(u));if(ni)for(var c=function(e){if("undefined"==typeof window||!ui)return oi(e);try{return oi(e)}catch(e){return!1}}(e),d=0;d<si.length;++d)c&&"constructor"===si[d]||!ei.call(e,si[d])||a.push(si[d]);return a}}var ci=Yt,di=Array.prototype.slice,hi=Object.keys,fi=hi?function(e){return hi(e)}:ci,pi=Object.keys;fi.shim=function(){Object.keys?function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2)||(Object.keys=function(e){return Zt(e)?pi(di.call(e)):pi(e)}):Object.keys=fi;return Object.keys||fi};var mi=fi,gi="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),vi=Object.prototype.toString,yi=Array.prototype.concat,_i=Object.defineProperty,bi=_i&&function(){var e={};try{for(var t in _i(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),Ti=function(e,t,i,r){var n;t in e&&("function"!=typeof(n=r)||"[object Function]"!==vi.call(n)||!r())||(bi?_i(e,t,{configurable:!0,enumerable:!1,value:i,writable:!0}):e[t]=i)},Si=function(e,t){var i=arguments.length>2?arguments[2]:{},r=mi(t);gi&&(r=yi.call(r,Object.getOwnPropertySymbols(t)));for(var n=0;n<r.length;n+=1)Ti(e,r[n],t[r[n]],i[r[n]])};Si.supportsDescriptors=!!bi;var Ei=Si,ki=Object.getOwnPropertyDescriptor?function(){return Object.getOwnPropertyDescriptor(arguments,"callee").get}():function(){throw new TypeError},wi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,Ci=Object.getPrototypeOf||function(e){return e.__proto__},Li="undefined"==typeof Uint8Array?void 0:Ci(Uint8Array),Ai={"$ %Array%":Array,"$ %ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"$ %ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer.prototype,"$ %ArrayIteratorPrototype%":wi?Ci([][Symbol.iterator]()):void 0,"$ %ArrayPrototype%":Array.prototype,"$ %ArrayProto_entries%":Array.prototype.entries,"$ %ArrayProto_forEach%":Array.prototype.forEach,"$ %ArrayProto_keys%":Array.prototype.keys,"$ %ArrayProto_values%":Array.prototype.values,"$ %AsyncFromSyncIteratorPrototype%":void 0,"$ %AsyncFunction%":void 0,"$ %AsyncFunctionPrototype%":void 0,"$ %AsyncGenerator%":void 0,"$ %AsyncGeneratorFunction%":void 0,"$ %AsyncGeneratorPrototype%":void 0,"$ %AsyncIteratorPrototype%":void 0,"$ %Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"$ %Boolean%":Boolean,"$ %BooleanPrototype%":Boolean.prototype,"$ %DataView%":"undefined"==typeof DataView?void 0:DataView,"$ %DataViewPrototype%":"undefined"==typeof DataView?void 0:DataView.prototype,"$ %Date%":Date,"$ %DatePrototype%":Date.prototype,"$ %decodeURI%":decodeURI,"$ %decodeURIComponent%":decodeURIComponent,"$ %encodeURI%":encodeURI,"$ %encodeURIComponent%":encodeURIComponent,"$ %Error%":Error,"$ %ErrorPrototype%":Error.prototype,"$ %eval%":eval,"$ %EvalError%":EvalError,"$ %EvalErrorPrototype%":EvalError.prototype,"$ %Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"$ %Float32ArrayPrototype%":"undefined"==typeof Float32Array?void 0:Float32Array.prototype,"$ %Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"$ %Float64ArrayPrototype%":"undefined"==typeof Float64Array?void 0:Float64Array.prototype,"$ %Function%":Function,"$ %FunctionPrototype%":Function.prototype,"$ %Generator%":void 0,"$ %GeneratorFunction%":void 0,"$ %GeneratorPrototype%":void 0,"$ %Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"$ %Int8ArrayPrototype%":"undefined"==typeof Int8Array?void 0:Int8Array.prototype,"$ %Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"$ %Int16ArrayPrototype%":"undefined"==typeof Int16Array?void 0:Int8Array.prototype,"$ %Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"$ %Int32ArrayPrototype%":"undefined"==typeof Int32Array?void 0:Int32Array.prototype,"$ %isFinite%":isFinite,"$ %isNaN%":isNaN,"$ %IteratorPrototype%":wi?Ci(Ci([][Symbol.iterator]())):void 0,"$ %JSON%":JSON,"$ %JSONParse%":JSON.parse,"$ %Map%":"undefined"==typeof Map?void 0:Map,"$ %MapIteratorPrototype%":"undefined"!=typeof Map&&wi?Ci((new Map)[Symbol.iterator]()):void 0,"$ %MapPrototype%":"undefined"==typeof Map?void 0:Map.prototype,"$ %Math%":Math,"$ %Number%":Number,"$ %NumberPrototype%":Number.prototype,"$ %Object%":Object,"$ %ObjectPrototype%":Object.prototype,"$ %ObjProto_toString%":Object.prototype.toString,"$ %ObjProto_valueOf%":Object.prototype.valueOf,"$ %parseFloat%":parseFloat,"$ %parseInt%":parseInt,"$ %Promise%":"undefined"==typeof Promise?void 0:Promise,"$ %PromisePrototype%":"undefined"==typeof Promise?void 0:Promise.prototype,"$ %PromiseProto_then%":"undefined"==typeof Promise?void 0:Promise.prototype.then,"$ %Promise_all%":"undefined"==typeof Promise?void 0:Promise.all,"$ %Promise_reject%":"undefined"==typeof Promise?void 0:Promise.reject,"$ %Promise_resolve%":"undefined"==typeof Promise?void 0:Promise.resolve,"$ %Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"$ %RangeError%":RangeError,"$ %RangeErrorPrototype%":RangeError.prototype,"$ %ReferenceError%":ReferenceError,"$ %ReferenceErrorPrototype%":ReferenceError.prototype,"$ %Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"$ %RegExp%":RegExp,"$ %RegExpPrototype%":RegExp.prototype,"$ %Set%":"undefined"==typeof Set?void 0:Set,"$ %SetIteratorPrototype%":"undefined"!=typeof Set&&wi?Ci((new Set)[Symbol.iterator]()):void 0,"$ %SetPrototype%":"undefined"==typeof Set?void 0:Set.prototype,"$ %SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"$ %SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer.prototype,"$ %String%":String,"$ %StringIteratorPrototype%":wi?Ci(""[Symbol.iterator]()):void 0,"$ %StringPrototype%":String.prototype,"$ %Symbol%":wi?Symbol:void 0,"$ %SymbolPrototype%":wi?Symbol.prototype:void 0,"$ %SyntaxError%":SyntaxError,"$ %SyntaxErrorPrototype%":SyntaxError.prototype,"$ %ThrowTypeError%":ki,"$ %TypedArray%":Li,"$ %TypedArrayPrototype%":Li?Li.prototype:void 0,"$ %TypeError%":TypeError,"$ %TypeErrorPrototype%":TypeError.prototype,"$ %Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"$ %Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?void 0:Uint8Array.prototype,"$ %Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"$ %Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray.prototype,"$ %Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"$ %Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?void 0:Uint16Array.prototype,"$ %Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"$ %Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?void 0:Uint32Array.prototype,"$ %URIError%":URIError,"$ %URIErrorPrototype%":URIError.prototype,"$ %WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"$ %WeakMapPrototype%":"undefined"==typeof WeakMap?void 0:WeakMap.prototype,"$ %WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet,"$ %WeakSetPrototype%":"undefined"==typeof WeakSet?void 0:WeakSet.prototype},Ri=function(e,t){if(arguments.length>1&&"boolean"!=typeof t)throw new TypeError('"allowMissing" argument must be a boolean');var i="$ "+e;if(!(i in Ai))throw new SyntaxError("intrinsic "+e+" does not exist!");if(void 0===Ai[i]&&!t)throw new TypeError("intrinsic "+e+" exists, but is not available. Please file an issue!");return Ai[i]},Pi=Qt.call(Function.call,Object.prototype.hasOwnProperty),Di=Ri("%TypeError%"),Ii=Ri("%SyntaxError%"),xi={"Property Descriptor":function(e,t){if("Object"!==e.Type(t))return!1;var i={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var r in t)if(Pi(t,r)&&!i[r])return!1;var n=Pi(t,"[[Value]]"),a=Pi(t,"[[Get]]")||Pi(t,"[[Set]]");if(n&&a)throw new Di("Property Descriptors may not be both accessor and data descriptors");return!0}},Oi=function(e,t,i,r){var n=xi[t];if("function"!=typeof n)throw new Ii("unknown record type: "+t);if(!n(e,r))throw new Di(i+" must be a "+t);console.log(n(e,r),r)},Mi=Number.isNaN||function(e){return e!=e},Ui=Number.isNaN||function(e){return e!=e},Bi=Number.isFinite||function(e){return"number"==typeof e&&!Ui(e)&&e!==1/0&&e!==-1/0},Ni=function(e){return e>=0?1:-1},Fi=Function.prototype.toString,ji=/^\s*class\b/,Gi=function(e){try{var t=Fi.call(e);return ji.test(t)}catch(e){return!1}},Vi=Object.prototype.toString,Hi="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,Ki=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if("function"==typeof e&&!e.prototype)return!0;if(Hi)return function(e){try{return!Gi(e)&&(Fi.call(e),!0)}catch(e){return!1}}(e);if(Gi(e))return!1;var t=Vi.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t},qi=function(e){return null===e||"function"!=typeof e&&"object"!=typeof e},Wi=Object.prototype.toString,zi=function(e){var t;if((t=arguments.length>1?arguments[1]:"[object Date]"===Wi.call(e)?String:Number)===String||t===Number){var i,r,n=t===String?["toString","valueOf"]:["valueOf","toString"];for(r=0;r<n.length;++r)if(Ki(e[n[r]])&&(i=e[n[r]](),qi(i)))return i;throw new TypeError("No default value")}throw new TypeError("invalid [[DefaultValue]] hint supplied")},Yi=Ri("%Object%"),Xi=Ri("%TypeError%"),$i=Ri("%String%"),Qi={ToPrimitive:function(e){return qi(e)?e:arguments.length>1?zi(e,arguments[1]):zi(e)},ToBoolean:function(e){return!!e},ToNumber:function(e){return+e},ToInteger:function(e){var t=this.ToNumber(e);return Mi(t)?0:0!==t&&Bi(t)?Ni(t)*Math.floor(Math.abs(t)):t},ToInt32:function(e){return this.ToNumber(e)>>0},ToUint32:function(e){return this.ToNumber(e)>>>0},ToUint16:function(e){var t=this.ToNumber(e);return Mi(t)||0===t||!Bi(t)?0:function(e,t){var i=e%t;return Math.floor(i>=0?i:i+t)}(Ni(t)*Math.floor(Math.abs(t)),65536)},ToString:function(e){return $i(e)},ToObject:function(e){return this.CheckObjectCoercible(e),Yi(e)},CheckObjectCoercible:function(e,t){if(null==e)throw new Xi(t||"Cannot call method on "+e);return e},IsCallable:Ki,SameValue:function(e,t){return e===t?0!==e||1/e==1/t:Mi(e)&&Mi(t)},Type:function(e){return null===e?"Null":void 0===e?"Undefined":"function"==typeof e||"object"==typeof e?"Object":"number"==typeof e?"Number":"boolean"==typeof e?"Boolean":"string"==typeof e?"String":void 0},IsPropertyDescriptor:function(e){if("Object"!==this.Type(e))return!1;var t={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var i in e)if(Pi(e,i)&&!t[i])return!1;var r=Pi(e,"[[Value]]"),n=Pi(e,"[[Get]]")||Pi(e,"[[Set]]");if(r&&n)throw new Xi("Property Descriptors may not be both accessor and data descriptors");return!0},IsAccessorDescriptor:function(e){return void 0!==e&&(Oi(this,"Property Descriptor","Desc",e),!(!Pi(e,"[[Get]]")&&!Pi(e,"[[Set]]")))},IsDataDescriptor:function(e){return void 0!==e&&(Oi(this,"Property Descriptor","Desc",e),!(!Pi(e,"[[Value]]")&&!Pi(e,"[[Writable]]")))},IsGenericDescriptor:function(e){return void 0!==e&&(Oi(this,"Property Descriptor","Desc",e),!this.IsAccessorDescriptor(e)&&!this.IsDataDescriptor(e))},FromPropertyDescriptor:function(e){if(void 0===e)return e;if(Oi(this,"Property Descriptor","Desc",e),this.IsDataDescriptor(e))return{value:e["[[Value]]"],writable:!!e["[[Writable]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};if(this.IsAccessorDescriptor(e))return{get:e["[[Get]]"],set:e["[[Set]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};throw new Xi("FromPropertyDescriptor must be called with a fully populated Property Descriptor")},ToPropertyDescriptor:function(e){if("Object"!==this.Type(e))throw new Xi("ToPropertyDescriptor requires an object");var t={};if(Pi(e,"enumerable")&&(t["[[Enumerable]]"]=this.ToBoolean(e.enumerable)),Pi(e,"configurable")&&(t["[[Configurable]]"]=this.ToBoolean(e.configurable)),Pi(e,"value")&&(t["[[Value]]"]=e.value),Pi(e,"writable")&&(t["[[Writable]]"]=this.ToBoolean(e.writable)),Pi(e,"get")){var i=e.get;if(void 0!==i&&!this.IsCallable(i))throw new TypeError("getter must be a function");t["[[Get]]"]=i}if(Pi(e,"set")){var r=e.set;if(void 0!==r&&!this.IsCallable(r))throw new Xi("setter must be a function");t["[[Set]]"]=r}if((Pi(t,"[[Get]]")||Pi(t,"[[Set]]"))&&(Pi(t,"[[Value]]")||Pi(t,"[[Writable]]")))throw new Xi("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t}},Ji=Qt.call(Function.call,String.prototype.replace),Zi=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,er=/[\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]+$/,tr=function(){var e=Qi.ToString(Qi.CheckObjectCoercible(this));return Ji(Ji(e,Zi,""),er,"")},ir=function(){return String.prototype.trim&&""==="".trim()?String.prototype.trim:tr},rr=Qt.call(Function.call,ir());Ei(rr,{getPolyfill:ir,implementation:tr,shim:function(){var e=ir();return Ei(String.prototype,{trim:e},{trim:function(){return String.prototype.trim!==e}}),e}});var nr=rr,ar=Object.prototype.toString,sr=Object.prototype.hasOwnProperty,or=function(e,t,i){if(!Ki(t))throw new TypeError("iterator must be a function");var r;arguments.length>=3&&(r=i),"[object Array]"===ar.call(e)?function(e,t,i){for(var r=0,n=e.length;r<n;r++)sr.call(e,r)&&(null==i?t(e[r],r,e):t.call(i,e[r],r,e))}(e,t,r):"string"==typeof e?function(e,t,i){for(var r=0,n=e.length;r<n;r++)null==i?t(e.charAt(r),r,e):t.call(i,e.charAt(r),r,e)}(e,t,r):function(e,t,i){for(var r in e)sr.call(e,r)&&(null==i?t(e[r],r,e):t.call(i,e[r],r,e))}(e,t,r)},lr=function(e){if(!e)return{};var t={};return or(nr(e).split("\n"),function(e){var i,r=e.indexOf(":"),n=nr(e.slice(0,r)).toLowerCase(),a=nr(e.slice(r+1));void 0===t[n]?t[n]=a:(i=t[n],"[object Array]"===Object.prototype.toString.call(i)?t[n].push(a):t[n]=[t[n],a])}),t},ur=function(){for(var e={},t=0;t<arguments.length;t++){var i=arguments[t];for(var r in i)cr.call(i,r)&&(e[r]=i[r])}return e},cr=Object.prototype.hasOwnProperty;var dr=fr;function hr(e,t,i){var r=e;return Wt(t)?(i=t,"string"==typeof e&&(r={uri:e})):r=ur(t,{uri:e}),r.callback=i,r}function fr(e,t,i){return pr(t=hr(e,t,i))}function pr(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,r,n){t||(t=!0,e.callback(i,r,n))};function r(e){return clearTimeout(l),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,m)}function n(){if(!s){var t;clearTimeout(l),t=e.useXDR&&void 0===o.status?200:1223===o.status?204:o.status;var r=m,n=null;return 0!==t?(r={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:u,rawRequest:o},o.getAllResponseHeaders&&(r.headers=lr(o.getAllResponseHeaders()))):n=new Error("Internal XMLHttpRequest Error"),i(n,r,r.body)}}var a,s,o=e.xhr||null;o||(o=e.cors||e.useXDR?new fr.XDomainRequest:new fr.XMLHttpRequest);var l,u=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:u,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(n,0)},o.onload=n,o.onerror=r,o.onprogress=function(){},o.onabort=function(){s=!0},o.ontimeout=r,o.open(c,u,!f,e.username,e.password),f||(o.withCredentials=!!e.withCredentials),!f&&e.timeout>0&&(l=setTimeout(function(){if(!s){s=!0,o.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(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}fr.XMLHttpRequest=e.XMLHttpRequest||function(){},fr.XDomainRequest="withCredentials"in new fr.XMLHttpRequest?fr.XMLHttpRequest:e.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],function(e){fr["delete"===e?"del":e]=function(t,i,r){return(i=hr(t,i,r)).method=e.toUpperCase(),pr(i)}});var mr=function(t,i){var r=new e.WebVTT.Parser(e,e.vttjs,e.WebVTT.StringDecoder()),n=[];r.oncue=function(e){i.addCue(e)},r.onparsingerror=function(e){n.push(e)},r.onflush=function(){i.trigger({type:"loadeddata",target:i})},r.parse(t),n.length>0&&(e.console&&e.console.groupCollapsed&&e.console.groupCollapsed("Text Track parsing errors for "+i.src),n.forEach(function(e){return a.error(e)}),e.console&&e.console.groupEnd&&e.console.groupEnd()),r.flush()},gr=function(t,i){var r={uri:t},n=Kt(t);n&&(r.cors=n),dr(r,pe(this,function(t,r,n){if(t)return a.error(t,r);i.loaded_=!0,"function"!=typeof e.WebVTT?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],function(e){if("vttjserror"!==e.type)return mr(n,i);a.error("vttjs failed to load, stopping trying to process "+i.src)}):mr(n,i)}))},vr=function(t){function i(e){var i;if(void 0===e&&(e={}),!e.tech)throw new Error("A tech was not provided.");var r=De(e,{kind:Nt[e.kind]||"subtitles",language:e.language||e.srclang||""}),n=Ft[r.mode]||"disabled",a=r.default;"metadata"!==r.kind&&"chapters"!==r.kind||(n="hidden"),(i=t.call(this,r)||this).tech_=r.tech,i.cues_=[],i.activeCues_=[];var s=new Mt(i.cues_),o=new Mt(i.activeCues_),l=!1,u=pe(Ue(i),function(){this.activeCues=this.activeCues,l&&(this.trigger("cuechange"),l=!1)});return"disabled"!==n&&i.tech_.ready(function(){i.tech_.on("timeupdate",u)},!0),Object.defineProperties(Ue(i),{default:{get:function(){return a},set:function(){}},mode:{get:function(){return n},set:function(e){var t=this;Ft[e]&&("disabled"!==(n=e)?this.tech_.ready(function(){t.tech_.on("timeupdate",u)},!0):this.tech_.off("timeupdate",u),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,r=this.cues.length;i<r;i++){var n=this.cues[i];n.startTime<=e&&n.endTime>=e?t.push(n):n.startTime===n.endTime&&n.startTime<=e&&n.startTime+.5>=e&&t.push(n)}if(l=!1,t.length!==this.activeCues_.length)l=!0;else for(var a=0;a<t.length;a++)-1===this.activeCues_.indexOf(t[a])&&(l=!0);return this.activeCues_=t,o.setCues_(this.activeCues_),o},set:function(){}}}),r.src?(i.src=r.src,gr(r.src,Ue(i))):i.loaded_=!0,i}xe(i,t);var r=i.prototype;return r.addCue=function(t){var i=t;if(e.vttjs&&!(t instanceof e.vttjs.VTTCue)){for(var r in i=new e.vttjs.VTTCue(t.startTime,t.endTime,t.text),t)r in i||(i[r]=t[r]);i.id=t.id,i.originalCue_=t}for(var n=this.tech_.textTracks(),a=0;a<n.length;a++)n[a]!==this&&n[a].removeCue(i);this.cues_.push(i),this.cues.setCues_(this.cues_)},r.removeCue=function(e){for(var t=this.cues_.length;t--;){var i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}},i}(jt);vr.prototype.allowedEvents_={cuechange:"cuechange"};var yr=function(e){function t(t){var i;void 0===t&&(t={});var r=De(t,{kind:Bt[t.kind]||""});i=e.call(this,r)||this;var n=!1;return Object.defineProperty(Ue(i),"enabled",{get:function(){return n},set:function(e){"boolean"==typeof e&&e!==n&&(n=e,this.trigger("enabledchange"))}}),r.enabled&&(i.enabled=r.enabled),i.loaded_=!0,i}return xe(t,e),t}(jt),_r=function(e){function t(t){var i;void 0===t&&(t={});var r=De(t,{kind:Ut[t.kind]||""});i=e.call(this,r)||this;var n=!1;return Object.defineProperty(Ue(i),"selected",{get:function(){return n},set:function(e){"boolean"==typeof e&&e!==n&&(n=e,this.trigger("selectedchange"))}}),r.selected&&(i.selected=r.selected),i}return xe(t,e),t}(jt),br=0,Tr=2,Sr=function(e){function t(t){var i,r;void 0===t&&(t={}),i=e.call(this)||this;var n=new vr(t);return i.kind=n.kind,i.src=n.src,i.srclang=n.language,i.label=n.label,i.default=n.default,Object.defineProperties(Ue(i),{readyState:{get:function(){return r}},track:{get:function(){return n}}}),r=br,n.addEventListener("loadeddata",function(){r=Tr,i.trigger({type:"load",target:Ue(i)})}),i}return xe(t,e),t}(ve);Sr.prototype.allowedEvents_={load:"load"},Sr.NONE=br,Sr.LOADING=1,Sr.LOADED=Tr,Sr.ERROR=3;var Er={audio:{ListClass:Pt,TrackClass:yr,capitalName:"Audio"},video:{ListClass:It,TrackClass:_r,capitalName:"Video"},text:{ListClass:xt,TrackClass:vr,capitalName:"Text"}};Object.keys(Er).forEach(function(e){Er[e].getterName=e+"Tracks",Er[e].privateName=e+"Tracks_"});var kr={remoteText:{ListClass:xt,TrackClass:vr,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Ot,TrackClass:Sr,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},wr=De(Er,kr);kr.names=Object.keys(kr),Er.names=Object.keys(Er),wr.names=[].concat(kr.names).concat(Er.names);var Cr=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 Lr(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function Ar(e){function t(e,t,i,r){return 3600*(0|e)+60*(0|t)+(0|i)+(0|r)/1e3}var i=e.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function Rr(){this.values=Cr(null)}function Pr(e,t,i,r){var n=r?e.split(r):[e];for(var a in n)if("string"==typeof n[a]){var s=n[a].split(i);if(2===s.length)t(s[0],s[1])}}function Dr(e,t,i){var r=e;function n(){var t=Ar(e);if(null===t)throw new Lr(Lr.Errors.BadTimeStamp,"Malformed timestamp: "+r);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=n(),a(),"--\x3e"!==e.substr(0,3))throw new Lr(Lr.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);e=e.substr(3),a(),t.endTime=n(),a(),function(e,t){var r=new Rr;Pr(e,function(e,t){switch(e){case"region":for(var n=i.length-1;n>=0;n--)if(i[n].id===t){r.set(e,i[n].region);break}break;case"vertical":r.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),s=a[0];r.integer(e,s),r.percent(e,s)&&r.set("snapToLines",!1),r.alt(e,s,["auto"]),2===a.length&&r.alt("lineAlign",a[1],["start","middle","end"]);break;case"position":a=t.split(","),r.percent(e,a[0]),2===a.length&&r.alt("positionAlign",a[1],["start","middle","end"]);break;case"size":r.percent(e,t);break;case"align":r.alt(e,t,["start","middle","end","left","right"])}},/:/,/\s/),t.region=r.get("region",null),t.vertical=r.get("vertical",""),t.line=r.get("line","auto"),t.lineAlign=r.get("lineAlign","start"),t.snapToLines=r.get("snapToLines",!0),t.size=r.get("size",100),t.align=r.get("align","middle"),t.position=r.get("position",{start:0,left:0,middle:50,end:100,right:100},t.align),t.positionAlign=r.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},t.align)}(e,t)}Lr.prototype=Cr(Error.prototype),Lr.prototype.constructor=Lr,Lr.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Rr.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var r=0;r<i.length;++r)if(t===i[r]){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 Ir={"&amp;":"&","&lt;":"<","&gt;":">","&lrm;":"","&rlm;":"","&nbsp;":" "},xr={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Or={v:"title",lang:"lang"},Mr={rt:"ruby"};function Ur(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function r(e){return Ir[e]}function n(e){for(;f=e.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)e=e.replace(f[0],r);return e}function a(e,t){return!Mr[t.localName]||Mr[t.localName]===e.localName}function s(t,i){var r=xr[t];if(!r)return null;var n=e.document.createElement(r);n.localName=r;var a=Or[t];return a&&i&&(n[a]=i.trim()),n}for(var o,l=e.document.createElement("div"),u=l,c=[];null!==(o=i());)if("<"!==o[0])u.appendChild(e.document.createTextNode(n(o)));else{if("/"===o[1]){c.length&&c[c.length-1]===o.substr(2).replace(">","")&&(c.pop(),u=u.parentNode);continue}var d,h=Ar(o.substr(1,o.length-2));if(h){d=e.document.createProcessingInstruction("timestamp",h),u.appendChild(d);continue}var f=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!f)continue;if(!(d=s(f[1],f[3])))continue;if(!a(u,d))continue;f[2]&&(d.className=f[2].substr(1).replace("."," ")),c.push(f[1]),u.appendChild(d),u=d}return l}var Br=[[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 Nr(e){for(var t=0;t<Br.length;t++){var i=Br[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function Fr(){}function jr(e,t,i){Fr.call(this),this.cue=t,this.cueDiv=Ur(e,t.text);var r={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(r,this.cueDiv),this.div=e.document.createElement("div"),r={direction:function(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function r(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function n(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var a=i.match(/^.*(\n|\r)/);return a?(e.length=0,a[0]):i}return"ruby"===t.tagName?n(e):t.childNodes?(r(e,t),n(e)):void 0}for(r(t,e);i=n(t);)for(var a=0;a<i.length;a++)if(Nr(i.charCodeAt(a)))return"rtl";return"ltr"}(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(r),this.div.appendChild(this.cueDiv);var n=0;switch(t.positionAlign){case"start":n=t.position;break;case"middle":n=t.position-t.size/2;break;case"end":n=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(n,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(n,"%"),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 Gr(e){var t,i,r,n;if(e.div){i=e.div.offsetHeight,r=e.div.offsetWidth,n=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||n,this.height=e.height||i,this.bottom=e.bottom||n+(e.height||i),this.width=e.width||r,this.lineHeight=void 0!==t?t:e.lineHeight}function Vr(e,t,i,r){var n=new Gr(t),a=t.cue,s=function(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,r=0,n=0;n<i.length&&i[n]!==t;n++)"showing"===i[n].mode&&r++;return-1*++r}(a),o=[];if(a.snapToLines){var l;switch(a.vertical){case"":o=["+y","-y"],l="height";break;case"rl":o=["+x","-x"],l="width";break;case"lr":o=["-x","+x"],l="width"}var u=n.lineHeight,c=u*Math.round(s),d=i[l]+u,h=o[0];Math.abs(c)>d&&(c=c<0?-1:1,c*=Math.ceil(d/u)*u),s<0&&(c+=""===a.vertical?i.height:i.width,o=o.reverse()),n.move(h,c)}else{var f=n.lineHeight/i.height*100;switch(a.lineAlign){case"middle":s-=f/2;break;case"end":s-=f}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(s,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}o=["+y","-x","+x","-y"],n=new Gr(t)}var p=function(e,t){for(var n,a=new Gr(e),s=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(i,t[o])||e.within(i)&&e.overlapsAny(r);)e.move(t[o]);if(e.within(i))return e;var l=e.intersectPercentage(i);s>l&&(n=new Gr(e),s=l),e=new Gr(a)}return n||a}(n,o);t.move(p.toCSSCompatValues(i))}function Hr(){}Fr.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},Fr.prototype.formatStyle=function(e,t){return 0===e?0:e+t},jr.prototype=Cr(Fr.prototype),jr.prototype.constructor=jr,Gr.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}},Gr.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},Gr.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},Gr.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},Gr.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}},Gr.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)},Gr.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}},Gr.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,r=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||r,height:e.height||t,bottom:e.bottom||r+(e.height||t),width:e.width||i}},Hr.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Hr.convertCueToDOMTree=function(e,t){return e&&t?Ur(e,t):null};Hr.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var r=e.document.createElement("div");if(r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.top="0",r.style.bottom="0",r.style.margin="1.5%",i.appendChild(r),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}(t)){var n=[],a=Gr.getSimpleBoxPosition(r),s={font:Math.round(.05*a.height*100)/100+"px sans-serif"};!function(){for(var i,o,l=0;l<t.length;l++)o=t[l],i=new jr(e,o,s),r.appendChild(i.div),Vr(0,i,a,n),o.displayState=i.div,n.push(Gr.getSimpleBoxPosition(i))}()}else for(var o=0;o<t.length;o++)r.appendChild(t[o].displayState)},Hr.Parser=function(e,t,i){i||(i=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]},Hr.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof Lr))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var r=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),r}function r(e){e.match(/X-TIMESTAMP-MAP/)?Pr(e,function(e,i){switch(e){case"X-TIMESTAMP-MAP":r=i,n=new Rr,Pr(r,function(e,t){switch(e){case"MPEGT":n.integer(e+"S",t);break;case"LOCA":n.set(e+"L",Ar(t))}},/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:n.get("MPEGTS"),LOCAL:n.get("LOCAL")})}var r,n},/=/):Pr(e,function(e,i){switch(e){case"Region":!function(e){var i=new Rr;if(Pr(e,function(e,t){switch(e){case"id":i.set(e,t);break;case"width":i.percent(e,t);break;case"lines":i.integer(e,t);break;case"regionanchor":case"viewportanchor":var r=t.split(",");if(2!==r.length)break;var n=new Rr;if(n.percent("x",r[0]),n.percent("y",r[1]),!n.has("x")||!n.has("y"))break;i.set(e+"X",n.get("x")),i.set(e+"Y",n.get("y"));break;case"scroll":i.alt(e,t,["up"])}},/=/,/\s/),i.has("id")){var r=new(t.vttjs.VTTRegion||t.window.VTTRegion);r.width=i.get("width",100),r.lines=i.get("lines",3),r.regionAnchorX=i.get("regionanchorX",0),r.regionAnchorY=i.get("regionanchorY",100),r.viewportAnchorX=i.get("viewportanchorX",0),r.viewportAnchorY=i.get("viewportanchorY",100),r.scroll=i.get("scroll",""),t.onregion&&t.onregion(r),t.regionList.push({id:i.get("id"),region:r})}}(i)}},/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var n;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var a=(n=i()).match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new Lr(Lr.Errors.BadSignature);t.state="HEADER"}for(var s=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:n=i(),t.state){case"HEADER":/:/.test(n)?r(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,""),t.state="CUE",-1===n.indexOf("--\x3e")){t.cue.id=n;continue}case"CUE":try{Dr(n,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!==n.indexOf("--\x3e");if(!n||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+=n;continue;case"BADCUE":n||(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 Lr(Lr.Errors.BadSignature)}catch(e){this.reportOrThrowError(e)}return this.onflush&&this.onflush(),this}};var Kr=Hr,qr="auto",Wr={"":1,lr:1,rl:1},zr={start:1,middle:1,end:1,left:1,right:1};function Yr(e){return"string"==typeof e&&(!!zr[e.toLowerCase()]&&e.toLowerCase())}function Xr(e,t,i){this.hasBeenReset=!1;var r="",n=!1,a=e,s=t,o=i,l=null,u="",c=!0,d="auto",h="start",f=50,p="middle",m=50,g="middle";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(e){r=""+e}},pauseOnExit:{enumerable:!0,get:function(){return n},set:function(e){n=!!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 l},set:function(e){l=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return u},set:function(e){var t=function(e){return"string"==typeof e&&!!Wr[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===t)throw new SyntaxError("An invalid or illegal string was specified.");u=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!==qr)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=Yr(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=Yr(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=Yr(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Xr.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var $r=Xr,Qr={"":!0,up:!0};function Jr(e){return"number"==typeof e&&e>=0&&e<=100}var Zr=function(){var e=100,t=3,i=0,r=100,n=0,a=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!Jr(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 r},set:function(e){if(!Jr(e))throw new Error("RegionAnchorX must be between 0 and 100.");r=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!Jr(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!Jr(e))throw new Error("ViewportAnchorY must be between 0 and 100.");a=e}},viewportAnchorX:{enumerable:!0,get:function(){return n},set:function(e){if(!Jr(e))throw new Error("ViewportAnchorX must be between 0 and 100.");n=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=function(e){return"string"==typeof e&&!!Qr[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===t)throw new SyntaxError("An invalid or illegal string was specified.");s=t}}})},en=Et(function(t){var i=t.exports={WebVTT:Kr,VTTCue:$r,VTTRegion:Zr};e.vttjs=i,e.WebVTT=i.WebVTT;var r=i.VTTCue,n=i.VTTRegion,a=e.VTTCue,s=e.VTTRegion;i.shim=function(){e.VTTCue=r,e.VTTRegion=n},i.restore=function(){e.VTTCue=a,e.VTTRegion=s},e.VTTCue||i.shim()});en.WebVTT,en.VTTCue,en.VTTRegion;var tn=function(i){function r(e,t){var r;return void 0===e&&(e={}),void 0===t&&(t=function(){}),e.reportTouchActivity=!1,(r=i.call(this,null,e,t)||this).hasStarted_=!1,r.on("playing",function(){this.hasStarted_=!0}),r.on("loadstart",function(){this.hasStarted_=!1}),wr.names.forEach(function(t){var i=wr[t];e&&e[i.getterName]&&(r[i.privateName]=e[i.getterName])}),r.featuresProgressEvents||r.manualProgressOn(),r.featuresTimeupdateEvents||r.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(t){!1===e["native"+t+"Tracks"]&&(r["featuresNative"+t+"Tracks"]=!1)}),!1===e.nativeCaptions||!1===e.nativeTextTracks?r.featuresNativeTextTracks=!1:!0!==e.nativeCaptions&&!0!==e.nativeTextTracks||(r.featuresNativeTextTracks=!0),r.featuresNativeTextTracks||r.emulateTextTracks(),r.autoRemoteTextTracks_=new wr.text.ListClass,r.initTrackListeners(),e.nativeControlsForTouch||r.emitTapEvents(),r.constructor&&(r.name_=r.constructor.name||"Unknown Tech"),r}xe(r,i);var n=r.prototype;return n.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"})},n.manualProgressOn=function(){this.on("durationchange",this.onDurationChange),this.manualProgress=!0,this.one("ready",this.trackProgress)},n.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange)},n.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)},n.onDurationChange=function(e){this.duration_=this.duration()},n.buffered=function(){return ot(0,0)},n.bufferedPercent=function(){return lt(this.buffered(),this.duration_)},n.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},n.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime),this.on("pause",this.stopTrackingCurrentTime)},n.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime),this.off("pause",this.stopTrackingCurrentTime)},n.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},n.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},n.dispose=function(){this.clearTracks(Er.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),i.prototype.dispose.call(this)},n.clearTracks=function(e){var t=this;(e=[].concat(e)).forEach(function(e){for(var i=t[e+"Tracks"]()||[],r=i.length;r--;){var n=i[r];"text"===e&&t.removeRemoteTextTrack(n),i.removeTrack(n)}})},n.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var i=e[t];this.removeRemoteTextTrack(i)}},n.reset=function(){},n.error=function(e){return void 0!==e&&(this.error_=new mt(e),this.trigger("error")),this.error_},n.played=function(){return this.hasStarted_?ot(0,0):ot()},n.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},n.initTrackListeners=function(){var e=this;Er.names.forEach(function(t){var i=Er[t],r=function(){e.trigger(t+"trackchange")},n=e[i.getterName]();n.addEventListener("removetrack",r),n.addEventListener("addtrack",r),e.on("dispose",function(){n.removeEventListener("removetrack",r),n.removeEventListener("addtrack",r)})})},n.addWebVttScript_=function(){var i=this;if(!e.WebVTT)if(t.body.contains(this.el())){if(!this.options_["vtt.js"]&&h(en)&&Object.keys(en).length>0)return void this.trigger("vttjsloaded");var r=t.createElement("script");r.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",r.onload=function(){i.trigger("vttjsloaded")},r.onerror=function(){i.trigger("vttjserror")},this.on("dispose",function(){r.onload=null,r.onerror=null}),e.WebVTT=!0,this.el().parentNode.appendChild(r)}else this.ready(this.addWebVttScript_)},n.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),r=function(e){return t.addTrack(e.track)},n=function(e){return t.removeTrack(e.track)};i.on("addtrack",r),i.on("removetrack",n),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e<t.length;e++){var i=t[e];i.removeEventListener("cuechange",a),"showing"===i.mode&&i.addEventListener("cuechange",a)}};s(),t.addEventListener("change",s),t.addEventListener("addtrack",s),t.addEventListener("removetrack",s),this.on("dispose",function(){i.off("addtrack",r),i.off("removetrack",n),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)}})},n.addTextTrack=function(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,i,r,n){void 0===n&&(n={});var a=e.textTracks();n.kind=t,i&&(n.label=i),r&&(n.language=r),n.tech=e;var s=new wr.text.TrackClass(n);return a.addTrack(s),s}(this,e,t,i)},n.createRemoteTextTrack=function(e){var t=De(e,{tech:this});return new kr.remoteTextEl.TrackClass(t)},n.addRemoteTextTrack=function(e,t){var i=this;void 0===e&&(e={});var r=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_(r),this.remoteTextTracks().addTrack(r.track),!0!==t&&this.ready(function(){return i.autoRemoteTextTracks_.addTrack(r.track)}),r},n.removeRemoteTextTrack=function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)},n.getVideoPlaybackQuality=function(){return{}},n.requestPictureInPicture=function(){var t=this.options_.Promise||e.Promise;if(t)return t.reject()},n.setPoster=function(){},n.playsinline=function(){},n.setPlaysinline=function(){},n.overrideNativeAudioTracks=function(){},n.overrideNativeVideoTracks=function(){},n.canPlayType=function(){return""},r.canPlayType=function(){return""},r.canPlaySource=function(e,t){return r.canPlayType(e.type)},r.isTech=function(e){return e.prototype instanceof r||e instanceof r||e===r},r.registerTech=function(e,t){if(r.techs_||(r.techs_={}),!r.isTech(t))throw new Error("Tech "+e+" must be a Tech");if(!r.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!r.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Pe(e),r.techs_[e]=t,r.techs_[Re(e)]=t,"Tech"!==e&&r.defaultTechOrder_.push(e),t},r.getTech=function(t){if(t)return r.techs_&&r.techs_[t]?r.techs_[t]:(t=Pe(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)},r}(Ie);wr.names.forEach(function(e){var t=wr[e];tn.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),tn.prototype.featuresVolumeControl=!0,tn.prototype.featuresMuteControl=!0,tn.prototype.featuresFullscreenResize=!1,tn.prototype.featuresPlaybackRate=!1,tn.prototype.featuresProgressEvents=!1,tn.prototype.featuresSourceset=!1,tn.prototype.featuresTimeupdateEvents=!1,tn.prototype.featuresNativeTextTracks=!1,tn.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){var r=e.sourceHandlers;r||(r=e.sourceHandlers=[]),void 0===i&&(i=r.length),r.splice(i,0,t)},e.canPlayType=function(t){for(var i,r=e.sourceHandlers||[],n=0;n<r.length;n++)if(i=r[n].canPlayType(t))return i;return""},e.selectSourceHandler=function(t,i){for(var r=e.sourceHandlers||[],n=0;n<r.length;n++)if(r[n].canHandleSource(t,i))return r[n];return null},e.canPlaySource=function(t,i){var r=e.selectSourceHandler(t,i);return r?r.canHandleSource(t,i):""};["seekable","seeking","duration"].forEach(function(e){var t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},e.prototype),e.prototype.setSource=function(t){var i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:a.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler),i!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},Ie.registerComponent("Tech",tn),tn.registerTech("Tech",tn),tn.defaultTechOrder_=[];var rn={},nn={},an={};function sn(e,t,i){e.setTimeout(function(){return function e(t,i,r,n,a,s){void 0===t&&(t={});void 0===i&&(i=[]);void 0===a&&(a=[]);void 0===s&&(s=!1);var o=i,l=o[0],u=o.slice(1);if("string"==typeof l)e(t,rn[l],r,n,a,s);else if(l){var d=function(e,t){var i=nn[e.id()],r=null;if(void 0===i||null===i)return r=t(e),nn[e.id()]=[[t,r]],r;for(var n=0;n<i.length;n++){var a=i[n],s=a[0],o=a[1];s===t&&(r=o)}null===r&&(r=t(e),i.push([t,r]));return r}(n,l);if(!d.setSource)return a.push(d),e(t,u,r,n,a,s);d.setSource(c({},t),function(i,o){if(i)return e(t,u,r,n,a,s);a.push(d),e(o,t.type===o.type?u:rn[o.type],r,n,a,s)})}else u.length?e(t,u,r,n,a,s):s?r(t,a):e(t,rn["*"],r,n,a,!0)}(t,rn[t.type],i,e)},1)}function on(e,t,i,r){void 0===r&&(r=null);var n="call"+Pe(i),a=e.reduce(dn(n),r),s=a===an,o=s?null:t[i](a);return function(e,t,i,r){for(var n=e.length-1;n>=0;n--){var a=e[n];a[t]&&a[t](r,i)}}(e,i,o,s),o}var ln={buffered:1,currentTime:1,duration:1,seekable:1,played:1,paused:1,volume:1},un={setCurrentTime:1,setVolume:1},cn={play:1,pause:1};function dn(e){return function(t,i){return t===an?an:i[e]?i[e](t):t}}var hn={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"},fn=function(e){void 0===e&&(e="");var t=Ht(e);return hn[t.toLowerCase()]||""};function pn(e){if(!e.type){var t=fn(e.src);t&&(e.type=t)}return e}var mn=function(e){function t(t,i,r){var n,a=De({createEl:!1},i);if(n=e.call(this,t,a,r)||this,i.playerOptions.sources&&0!==i.playerOptions.sources.length)t.src(i.playerOptions.sources);else for(var s=0,o=i.playerOptions.techOrder;s<o.length;s++){var l=Pe(o[s]),u=tn.getTech(l);if(l||(u=Ie.getComponent(l)),u&&u.isSupported()){t.loadTech_(l);break}}return n}return xe(t,e),t}(Ie);Ie.registerComponent("MediaLoader",mn);var gn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).emitTapEvents(),r.enable(),r}xe(t,e);var i=t.prototype;return i.createEl=function(t,i,r){void 0===t&&(t="div"),void 0===i&&(i={}),void 0===r&&(r={}),i=c({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass(),tabIndex:0},i),"button"===t&&a.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead."),r=c({role:"button"},r),this.tabIndex_=i.tabIndex;var n=e.prototype.createEl.call(this,t,i,r);return this.createControlTextEl(n),n},i.dispose=function(){this.controlTextEl_=null,e.prototype.dispose.call(this)},i.createControlTextEl=function(e){return this.controlTextEl_=b("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_},i.controlText=function(e,t){if(void 0===t&&(t=this.el()),void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,T(this.controlTextEl_,i),this.nonIconControl||t.setAttribute("title",i)},i.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)},i.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick),this.on("keydown",this.handleKeyDown))},i.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver),this.off("mouseout",this.handleMouseOut),this.off(["tap","click"],this.handleClick),this.off("keydown",this.handleKeyDown)},i.handleClick=function(e){},i.handleKeyDown=function(t){kt.isEventKey(t,"Space")||kt.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(Ie);Ie.registerComponent("ClickableComponent",gn);var vn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).update(),t.on("posterchange",pe(Ue(r),r.update)),r}xe(t,e);var i=t.prototype;return i.dispose=function(){this.player().off("posterchange",this.update),e.prototype.dispose.call(this)},i.createEl=function(){return b("div",{className:"vjs-poster",tabIndex:-1})},i.update=function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()},i.setSrc=function(e){var t="";e&&(t='url("'+e+'")'),this.el_.style.backgroundImage=t},i.handleClick=function(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?_t(this.player_.play()):this.player_.pause())},t}(gn);Ie.registerComponent("PosterImage",vn);var yn={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 _n(e,t){var i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function bn(e,t,i){try{e.style[t]=i}catch(e){return}}var Tn=function(t){function i(i,r,n){var a;a=t.call(this,i,r,n)||this;var s=pe(Ue(a),a.updateDisplay);return i.on("loadstart",pe(Ue(a),a.toggleDisplay)),i.on("texttrackchange",s),i.on("loadedmetadata",pe(Ue(a),a.preselectTrack)),i.ready(pe(Ue(a),function(){if(i.tech_&&i.tech_.featuresNativeTextTracks)this.hide();else{i.on("fullscreenchange",s),i.on("playerresize",s),e.addEventListener("orientationchange",s),i.on("dispose",function(){return e.removeEventListener("orientationchange",s)});for(var t=this.options_.playerOptions.tracks||[],r=0;r<t.length;r++)this.player_.addRemoteTextTrack(t[r],!0);this.preselectTrack()}})),a}xe(i,t);var r=i.prototype;return r.preselectTrack=function(){for(var e,t,i,r={captions:1,subtitles:1},n=this.player_.textTracks(),a=this.player_.cache_.selectedLanguage,s=0;s<n.length;s++){var o=n[s];a&&a.enabled&&a.language&&a.language===o.language&&o.kind in r?o.kind===a.kind?i=o:i||(i=o):a&&!a.enabled?(i=null,e=null,t=null):o.default&&("descriptions"!==o.kind||e?o.kind in r&&!t&&(t=o):e=o)}i?i.mode="showing":t?t.mode="showing":e&&(e.mode="showing")},r.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},r.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},r.clearDisplay=function(){"function"==typeof e.WebVTT&&e.WebVTT.processCues(e,[],this.el_)},r.updateDisplay=function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var i=[],r=0;r<e.length;++r){var n=e[r];"showing"===n.mode&&i.push(n)}this.updateForTrack(i)}else{for(var a=null,s=null,o=e.length;o--;){var l=e[o];"showing"===l.mode&&("descriptions"===l.kind?a=l:s=l)}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))}},r.updateDisplayState=function(t){for(var i=this.player_.textTrackSettings.getValues(),r=t.activeCues,n=r.length;n--;){var a=r[n];if(a){var s=a.displayState;if(i.color&&(s.firstChild.style.color=i.color),i.textOpacity&&bn(s.firstChild,"color",_n(i.color||"#fff",i.textOpacity)),i.backgroundColor&&(s.firstChild.style.backgroundColor=i.backgroundColor),i.backgroundOpacity&&bn(s.firstChild,"backgroundColor",_n(i.backgroundColor||"#000",i.backgroundOpacity)),i.windowColor&&(i.windowOpacity?bn(s,"backgroundColor",_n(i.windowColor,i.windowOpacity)):s.style.backgroundColor=i.windowColor),i.edgeStyle&&("dropshadow"===i.edgeStyle?s.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===i.edgeStyle?s.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===i.edgeStyle?s.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===i.edgeStyle&&(s.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),i.fontPercent&&1!==i.fontPercent){var o=e.parseFloat(s.style.fontSize);s.style.fontSize=o*i.fontPercent+"px",s.style.height="auto",s.style.top="auto",s.style.bottom="2px"}i.fontFamily&&"default"!==i.fontFamily&&("small-caps"===i.fontFamily?s.firstChild.style.fontVariant="small-caps":s.firstChild.style.fontFamily=yn[i.fontFamily])}}},r.updateForTrack=function(t){if(Array.isArray(t)||(t=[t]),"function"==typeof e.WebVTT&&!t.every(function(e){return!e.activeCues})){for(var i=[],r=0;r<t.length;++r)for(var n=t[r],a=0;a<n.activeCues.length;++a)i.push(n.activeCues[a]);e.WebVTT.processCues(e,i,this.el_);for(var s=0;s<t.length;++s){for(var o=t[s],l=0;l<o.activeCues.length;++l){var u=o.activeCues[l].displayState;k(u,"vjs-text-track-cue"),k(u,"vjs-text-track-cue-"+(o.language?o.language:s))}this.player_.textTrackSettings&&this.updateDisplayState(o)}}},i}(Ie);Ie.registerComponent("TextTrackDisplay",Tn);var Sn=function(e){function t(){return e.apply(this,arguments)||this}return xe(t,e),t.prototype.createEl=function(){var t=this.player_.isAudio(),i=this.localize(t?"Audio Player":"Video Player"),r=b("span",{className:"vjs-control-text",innerHTML:this.localize("{1} is loading.",[i])}),n=e.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return n.appendChild(r),n},t}(Ie);Ie.registerComponent("LoadingSpinner",Sn);var En=function(e){function t(){return e.apply(this,arguments)||this}xe(t,e);var i=t.prototype;return i.createEl=function(e,t,i){void 0===t&&(t={}),void 0===i&&(i={}),t=c({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass()},t),i=c({type:"button"},i);var r=Ie.prototype.createEl.call(this,"button",t,i);return this.createControlTextEl(r),r},i.addChild=function(e,t){void 0===t&&(t={});var i=this.constructor.name;return a.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),Ie.prototype.addChild.call(this,e,t)},i.enable=function(){e.prototype.enable.call(this),this.el_.removeAttribute("disabled")},i.disable=function(){e.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},i.handleKeyDown=function(t){kt.isEventKey(t,"Space")||kt.isEventKey(t,"Enter")?t.stopPropagation():e.prototype.handleKeyDown.call(this,t)},t}(gn);Ie.registerComponent("Button",En);var kn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).mouseused_=!1,r.on("mousedown",r.handleMouseDown),r}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-big-play-button"},i.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY)return _t(t),void(this.player_.tech(!0)&&this.player_.tech(!0).focus());var i=this.player_.getChild("controlBar"),r=i&&i.getChild("playToggle");if(r){var n=function(){return r.focus()};yt(t)?t.then(n,function(){}):this.setTimeout(n,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(En);kn.prototype.controlText_="Play Video",Ie.registerComponent("BigPlayButton",kn);var wn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).controlText(i&&i.controlText||r.localize("Close")),r}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){kt.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(En);Ie.registerComponent("CloseButton",wn);var Cn=function(e){function t(t,i){var r;return void 0===i&&(i={}),r=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,r.on(t,"play",r.handlePlay),r.on(t,"pause",r.handlePause),i.replay&&r.on(t,"ended",r.handleEnded),r}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",this.handleSeeked)},t}(En);Cn.prototype.controlText_="Play",Ie.registerComponent("PlayToggle",Cn);var Ln=function(e,t){e=e<0?0:e;var i=Math.floor(e%60),r=Math.floor(e/60%60),n=Math.floor(e/3600),a=Math.floor(t/60%60),s=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(n=r=i="-"),(n=n>0||s>0?n+":":"")+(r=((n||a>=10)&&r<10?"0"+r:r)+":")+(i=i<10?"0"+i:i)},An=Ln;function Rn(e,t){return void 0===t&&(t=e),An(e,t)}var Pn=function(e){function i(t,i){var r;return(r=e.call(this,t,i)||this).throttledUpdateContent=me(pe(Ue(r),r.updateContent),fe),r.on(t,"timeupdate",r.throttledUpdateContent),r}xe(i,e);var r=i.prototype;return r.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control",innerHTML:'<span class="vjs-control-text" role="presentation">'+this.localize(this.labelText_)+" </span>"});return this.contentEl_=b("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),this.updateTextNode_(),i.appendChild(this.contentEl_),i},r.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},r.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_)}},r.formatTime_=function(e){return Rn(e)},r.updateFormattedTime_=function(e){var t=this.formatTime_(e);t!==this.formattedTime_&&(this.formattedTime_=t,this.requestAnimationFrame(this.updateTextNode_))},r.updateContent=function(e){},i}(Ie);Pn.prototype.labelText_="Time",Pn.prototype.controlText_="Time",Ie.registerComponent("TimeDisplay",Pn);var Dn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).on(t,"ended",r.handleEnded),r}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(t)},i.handleEnded=function(e){this.player_.duration()&&this.updateFormattedTime_(this.player_.duration())},t}(Pn);Dn.prototype.labelText_="Current Time",Dn.prototype.controlText_="Current Time",Ie.registerComponent("CurrentTimeDisplay",Dn);var In=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).on(t,"durationchange",r.updateContent),r.on(t,"loadstart",r.updateContent),r.on(t,"loadedmetadata",r.throttledUpdateContent),r}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.duration_!==t&&(this.duration_=t,this.updateFormattedTime_(t))},t}(Pn);In.prototype.labelText_="Duration",In.prototype.controlText_="Duration",Ie.registerComponent("DurationDisplay",In);var xn=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",xn);var On=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).on(t,"durationchange",r.throttledUpdateContent),r.on(t,"ended",r.handleEnded),r}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return t.insertBefore(b("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){"number"==typeof this.player_.duration()&&(this.player_.remainingTimeDisplay?this.updateFormattedTime_(this.player_.remainingTimeDisplay()):this.updateFormattedTime_(this.player_.remainingTime()))},i.handleEnded=function(e){this.player_.duration()&&this.updateFormattedTime_(0)},t}(Pn);On.prototype.labelText_="Remaining Time",On.prototype.controlText_="Remaining Time",Ie.registerComponent("RemainingTimeDisplay",On);var Mn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).updateShowing(),r.on(r.player(),"durationchange",r.updateShowing),r}xe(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=b("div",{className:"vjs-live-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Stream Type")+" </span>"+this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(Ie);Ie.registerComponent("LiveDisplay",Mn);var Un=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).updateLiveEdgeStatus(),r.player_.liveTracker&&r.on(r.player_.liveTracker,"liveedgechange",r.updateLiveEdgeStatus),r}xe(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=b("span",{className:"vjs-seek-to-live-text",innerHTML:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(e){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatus),this.textEl_=null,e.prototype.dispose.call(this)},t}(En);Un.prototype.controlText_="Seek to live, currently playing live",Ie.registerComponent("SeekToLive",Un);var Bn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).bar=r.getChild(r.options_.barName),r.vertical(!!r.options_.vertical),r.enable(),r}xe(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown),this.on("touchstart",this.handleMouseDown),this.on("keydown",this.handleKeyDown),this.on("click",this.handleClick),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown),this.off("touchstart",this.handleMouseDown),this.off("keydown",this.handleKeyDown),this.off("click",this.handleClick),this.off(this.player_,"controlsvisible",this.update),this.off(e,"mousemove",this.handleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchmove",this.handleMouseMove),this.off(e,"touchend",this.handleMouseUp),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},i.createEl=function(t,i,r){return void 0===i&&(i={}),void 0===r&&(r={}),i.className=i.className+" vjs-slider",i=c({tabIndex:0},i),r=c({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},r),e.prototype.createEl.call(this,t,i,r)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Qe||e.preventDefault(),I(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchmove",this.handleMouseMove),this.on(t,"touchend",this.handleMouseUp),this.handleMouseMove(e)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;x(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove),this.off(e,"mouseup",this.handleMouseUp),this.off(e,"touchmove",this.handleMouseMove),this.off(e,"touchend",this.handleMouseUp),this.update()},i.update=function(){if(this.el_){var e=this.getPercent(),t=this.bar;if(t){("number"!=typeof e||e!=e||e<0||e===1/0)&&(e=0);var i=(100*e).toFixed(2)+"%",r=t.el().style,n=this.vertical()?"height":"width";return r[n]!==i&&(r[n]=i),e}}},i.calculateDistance=function(e){var t=U(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){kt.isEventKey(t,"Left")||kt.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):kt.isEventKey(t,"Right")||kt.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(Ie);Ie.registerComponent("Slider",Bn);var Nn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).partEls_=[],r.on(t,"progress",r.update),r}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Loaded")+'</span>: <span class="vjs-control-text-loaded-percentage">0%</span></span>'})},i.dispose=function(){this.partEls_=null,e.prototype.dispose.call(this)},i.update=function(e){var t=this.player_.liveTracker,i=this.player_.buffered(),r=t&&t.isLive()?t.seekableEnd():this.player_.duration(),n=this.player_.bufferedEnd(),a=this.partEls_,s=this.$(".vjs-control-text-loaded-percentage"),o=function(e,t,i){var r=e/t||0;return r=100*(r>=1?1:r),i&&(r=r.toFixed(2)),r+"%"};this.el_.style.width=o(n,r),T(s,o(n,r,!0));for(var l=0;l<i.length;l++){var u=i.start(l),c=i.end(l),d=a[l];d||(d=this.el_.appendChild(b()),a[l]=d),d.style.left=o(u,n),d.style.width=o(c-u,n)}for(var h=a.length;h>i.length;h--)this.el_.removeChild(a[h-1]);a.length=i.length},t}(Ie);Ie.registerComponent("LoadProgressBar",Nn);var Fn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).update=me(pe(Ue(r),r.update),fe),r}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var r=O(this.el_),n=O(this.player_.el()),a=e.width*t;if(n&&r){var s=e.left-n.left+a,o=e.width-a+(n.right-e.right),l=r.width/2;s<l?l+=l-s:o<l&&(l=o),l<0?l=0:l>r.width&&(l=r.width),this.el_.style.right="-"+l+"px",this.write(i)}},i.write=function(e){T(this.el_,e)},i.updateTime=function(e,t,i,r){var n=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var a,s=n.player_.duration();if(n.player_.liveTracker&&n.player_.liveTracker.isLive()){var o=n.player_.liveTracker.liveWindow(),l=o-t*o;a=(l<1?"":"-")+Rn(l,o)}else a=Rn(i,s);n.update(e,t,a),r&&r()})},t}(Ie);Ie.registerComponent("TimeTooltip",Fn);var jn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).update=me(pe(Ue(r),r.update),fe),r}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var r=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,r)}},t}(Ie);jn.prototype.options_={children:[]},Ke||We||jn.prototype.options_.children.push("timeTooltip"),Ie.registerComponent("PlayProgressBar",jn);var Gn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).update=me(pe(Ue(r),r.update),fe),r}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,r=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,r,function(){i.el_.style.left=e.width*t+"px"})},t}(Ie);Gn.prototype.options_={children:["timeTooltip"]},Ie.registerComponent("MouseTimeDisplay",Gn);var Vn=function(e){function i(t,i){var r;return(r=e.call(this,t,i)||this).setEventHandlers_(),r}xe(i,e);var r=i.prototype;return r.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_)},r.toggleVisibility_=function(e){t.hidden?this.disableInterval_(e):(this.enableInterval_(),this.requestAnimationFrame(this.update))},r.enableInterval_=function(){var e=this;this.clearInterval(this.updateInterval),this.updateInterval=this.setInterval(function(){e.requestAnimationFrame(e.update)},30)},r.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&"ended"!==e.type||this.clearInterval(this.updateInterval)},r.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},r.update_=function(e,t){var i=this.player_.liveTracker,r=this.player_.duration();i&&i.isLive()&&(r=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}",[Rn(e,r),Rn(r,r)],"{1} of {2}")),this.bar&&this.bar.update(O(this.el_),t)},r.update=function(t){if(null!==this.el().offsetParent){var i=e.prototype.update.call(this);return this.update_(this.getCurrentTime_(),i),i}},r.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},r.handleEnded=function(e){this.update_(this.player_.duration(),1)},r.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e>=1?1:e||0},r.handleMouseDown=function(t){V(t)&&(t.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},r.handleMouseMove=function(e){if(V(e)){var t,i=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){var n=r.seekableStart(),a=r.liveCurrentTime();if((t=n+i*r.liveWindow())>=a&&(t=a),t<=n&&(t=n+.1),t===1/0)return}else(t=i*this.player_.duration())===this.player_.duration()&&(t-=.1);this.player_.currentTime(t)}},r.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},r.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},r.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())},r.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},r.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},r.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},r.handleKeyDown=function(t){if(kt.isEventKey(t,"Space")||kt.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(kt.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(0);else if(kt.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.duration());else if(/^[0-9]$/.test(kt(t))){t.preventDefault(),t.stopPropagation();var i=10*(kt.codes[kt(t)]-kt.codes[0])/100;this.player_.currentTime(this.player_.duration()*i)}else kt.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()-60)):kt.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i}(Bn);Vn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},Ke||We||Vn.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Ie.registerComponent("SeekBar",Vn);var Hn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).handleMouseMove=me(pe(Ue(r),r.handleMouseMove),fe),r.throttledHandleMouseSeek=me(pe(Ue(r),r.handleMouseSeek),fe),r.enable(),r}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("mouseTimeDisplay"),r=t.el(),n=O(r),a=U(r,e).x;a>1?a=1:a<0&&(a=0),i&&i.update(n,a)}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){this.children().forEach(function(e){return e.disable&&e.disable()}),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDown),this.off(this.el_,"mousemove",this.handleMouseMove),this.handleMouseUp(),this.addClass("disabled"),this.enabled_=!1)},i.enable=function(){this.children().forEach(function(e){return e.enable&&e.enable()}),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDown),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseUp(e),this.off(t,"mousemove",this.throttledHandleMouseSeek),this.off(t,"touchmove",this.throttledHandleMouseSeek),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchend",this.handleMouseUp)},t}(Ie);Hn.prototype.options_={children:["seekBar"]},Ie.registerComponent("ProgressControl",Hn);var Kn=function(e){function i(i,r){var n;return(n=e.call(this,i,r)||this).on(i,["enterpictureinpicture","leavepictureinpicture"],n.handlePictureInPictureChange),t.pictureInPictureEnabled||n.disable(),n}xe(i,e);var r=i.prototype;return r.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},r.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture")},r.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},i}(En);Kn.prototype.controlText_="Picture-in-Picture",Ie.registerComponent("PictureInPictureToggle",Kn);var qn=function(e){function i(i,r){var n;return(n=e.call(this,i,r)||this).on(i,"fullscreenchange",n.handleFullscreenChange),!1===t[i.fsApi_.fullscreenEnabled]&&n.disable(),n}xe(i,e);var r=i.prototype;return r.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},r.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},r.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},i}(En);qn.prototype.controlText_="Fullscreen",Ie.registerComponent("FullscreenToggle",qn);var Wn=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")})},zn=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",zn);var Yn=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).on("slideractive",r.updateLastVolume_),r.on(t,"volumechange",r.updateARIAAttributes),t.ready(function(){return r.updateARIAAttributes()}),r}xe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(t){V(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){V(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",function(){0===e.player_.volume()&&e.player_.lastVolume_(t)})},t}(Bn);Yn.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},Yn.prototype.playerEvent="volumechange",Ie.registerComponent("VolumeBar",Yn);var Xn=function(e){function t(t,i){var r;return void 0===i&&(i={}),i.vertical=i.vertical||!1,(void 0===i.volumeBar||h(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),r=e.call(this,t,i)||this,Wn(Ue(r),t),r.throttledHandleMouseMove=me(pe(Ue(r),r.handleMouseMove),fe),r.on("mousedown",r.handleMouseDown),r.on("touchstart",r.handleMouseDown),r.on(r.volumeBar,["focus","slideractive"],function(){r.volumeBar.addClass("vjs-slider-active"),r.addClass("vjs-slider-active"),r.trigger("slideractive")}),r.on(r.volumeBar,["blur","sliderinactive"],function(){r.volumeBar.removeClass("vjs-slider-active"),r.removeClass("vjs-slider-active"),r.trigger("sliderinactive")}),r}xe(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUp),this.on(t,"touchend",this.handleMouseUp)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchend",this.handleMouseUp)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(Ie);Xn.prototype.options_={children:["volumeBar"]},Ie.registerComponent("VolumeControl",Xn);var $n=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")})},Qn=function(e){function t(t,i){var r;return r=e.call(this,t,i)||this,$n(Ue(r),t),r.on(t,["loadstart","volumechange"],r.update),r}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var r=i<.1?.1:i;this.player_.volume(r),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;Ke&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)w(this.el_,"vjs-vol-"+i);k(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}(En);Qn.prototype.controlText_="Mute",Ie.registerComponent("MuteToggle",Qn);var Jn=function(e){function i(t,i){var r;return void 0===i&&(i={}),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||h(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(r=e.call(this,t,i)||this).on(t,["loadstart"],r.volumePanelState_),r.on(r.muteToggle,"keyup",r.handleKeyPress),r.on(r.volumeControl,"keyup",r.handleVolumeControlKeyUp),r.on("keydown",r.handleKeyPress),r.on("mouseover",r.handleMouseOver),r.on("mouseout",r.handleMouseOut),r.on(r.volumeControl,["slideractive"],r.sliderActive_),r.on(r.volumeControl,["sliderinactive"],r.sliderInactive_),r}xe(i,e);var r=i.prototype;return r.sliderActive_=function(){this.addClass("vjs-slider-active")},r.sliderInactive_=function(){this.removeClass("vjs-slider-active")},r.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")},r.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})},r.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},r.handleVolumeControlKeyUp=function(e){kt.isEventKey(e,"Esc")&&this.muteToggle.focus()},r.handleMouseOver=function(e){this.addClass("vjs-hover"),ee(t,"keyup",pe(this,this.handleKeyPress))},r.handleMouseOut=function(e){this.removeClass("vjs-hover"),te(t,"keyup",pe(this,this.handleKeyPress))},r.handleKeyPress=function(e){kt.isEventKey(e,"Esc")&&this.handleMouseOut()},i}(Ie);Jn.prototype.options_={children:["muteToggle","volumeControl"]},Ie.registerComponent("VolumePanel",Jn);var Zn=function(e){function i(t,i){var r;return r=e.call(this,t,i)||this,i&&(r.menuButton_=i.menuButton),r.focusedChild_=-1,r.on("keydown",r.handleKeyDown),r.boundHandleBlur_=pe(Ue(r),r.handleBlur),r.boundHandleTapClick_=pe(Ue(r),r.handleTapClick),r}xe(i,e);var r=i.prototype;return r.addEventListenerForItem=function(e){e instanceof Ie&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},r.removeEventListenerForItem=function(e){e instanceof Ie&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},r.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},r.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},r.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=b(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),ee(i,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),i},r.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},r.handleBlur=function(e){var i=e.relatedTarget||t.activeElement;if(!this.children().some(function(e){return e.el()===i})){var r=this.menuButton_;r&&r.buttonPressed_&&i!==r.el().firstChild&&r.unpressButton()}},r.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var i=t.filter(function(t){return t.el()===e.target})[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},r.handleKeyDown=function(e){kt.isEventKey(e,"Left")||kt.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(kt.isEventKey(e,"Right")||kt.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},r.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},r.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},r.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].className&&/vjs-menu-title/.test(t[0].className)&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())},i}(Ie);Ie.registerComponent("Menu",Zn);var ea=function(e){function i(i,r){var n;void 0===r&&(r={}),(n=e.call(this,i,r)||this).menuButton_=new En(i,r),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var a=En.prototype.buildCSSClass();return n.menuButton_.el_.className=n.buildCSSClass()+" "+a,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0,n.on(n.menuButton_,"tap",n.handleClick),n.on(n.menuButton_,"click",n.handleClick),n.on(n.menuButton_,"keydown",n.handleKeyDown),n.on(n.menuButton_,"mouseenter",function(){n.addClass("vjs-hover"),n.menu.show(),ee(t,"keyup",pe(Ue(n),n.handleMenuKeyUp))}),n.on("mouseleave",n.handleMouseLeave),n.on("keydown",n.handleSubmenuKeyDown),n}xe(i,e);var r=i.prototype;return r.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()},r.createMenu=function(){var e=new Zn(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=b("li",{className:"vjs-menu-title",innerHTML:Pe(this.options_.title),tabIndex:-1});this.hideThreshold_+=1;var i=new Ie(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var r=0;r<this.items.length;r++)e.addItem(this.items[r]);return e},r.createItems=function(){},r.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},r.buildWrapperCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+En.prototype.buildCSSClass()+" "+e.prototype.buildCSSClass.call(this)},r.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)},r.controlText=function(e,t){return void 0===t&&(t=this.menuButton_.el()),this.menuButton_.controlText(e,t)},r.dispose=function(){this.handleMouseLeave(),e.prototype.dispose.call(this)},r.handleClick=function(e){this.buttonPressed_?this.unpressButton():this.pressButton()},r.handleMouseLeave=function(e){this.removeClass("vjs-hover"),te(t,"keyup",pe(this,this.handleMenuKeyUp))},r.focus=function(){this.menuButton_.focus()},r.blur=function(){this.menuButton_.blur()},r.handleKeyDown=function(e){kt.isEventKey(e,"Esc")||kt.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),kt.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(kt.isEventKey(e,"Up")||kt.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))},r.handleMenuKeyUp=function(e){(kt.isEventKey(e,"Esc")||kt.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},r.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},r.handleSubmenuKeyDown=function(e){(kt.isEventKey(e,"Esc")||kt.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),kt.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))},r.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),Ke&&y())return;this.menu.focus()}},r.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},r.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},r.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},i}(Ie);Ie.registerComponent("MenuButton",ea);var ta=function(e){function t(t,i){var r,n=i.tracks;if((r=e.call(this,t,i)||this).items.length<=1&&r.hide(),!n)return Ue(r);var a=pe(Ue(r),r.update);return n.addEventListener("removetrack",a),n.addEventListener("addtrack",a),r.player_.on("ready",a),r.player_.on("dispose",function(){n.removeEventListener("removetrack",a),n.removeEventListener("addtrack",a)}),r}return xe(t,e),t}(ea);Ie.registerComponent("TrackButton",ta);var ia=["Tab","Esc","Up","Down","Right","Left"],ra=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).selectable=i.selectable,r.isSelected_=i.selected||!1,r.multiSelectable=i.multiSelectable,r.selected(r.isSelected_),r.selectable?r.multiSelectable?r.el_.setAttribute("role","menuitemcheckbox"):r.el_.setAttribute("role","menuitemradio"):r.el_.setAttribute("role","menuitem"),r}xe(t,e);var i=t.prototype;return i.createEl=function(t,i,r){return this.nonIconControl=!0,e.prototype.createEl.call(this,"li",c({className:"vjs-menu-item",innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+"</span>",tabIndex:-1},i),r)},i.handleKeyDown=function(t){ia.some(function(e){return kt.isEventKey(t,e)})||e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){this.selected(!0)},i.selected=function(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))},t}(gn);Ie.registerComponent("MenuItem",ra);var na=function(i){function r(r,n){var a,s=n.track,o=r.textTracks();n.label=s.label||s.language||"Unknown",n.selected="showing"===s.mode,(a=i.call(this,r,n)||this).track=s,a.kinds=(n.kinds||[n.kind||a.track.kind]).filter(Boolean);var l,u=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];a.handleTracksChange.apply(Ue(a),t)},c=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];a.handleSelectedLanguageChange.apply(Ue(a),t)};(r.on(["loadstart","texttrackchange"],u),o.addEventListener("change",u),o.addEventListener("selectedlanguagechange",c),a.on("dispose",function(){r.off(["loadstart","texttrackchange"],u),o.removeEventListener("change",u),o.removeEventListener("selectedlanguagechange",c)}),void 0===o.onchange)&&a.on(["tap","click"],function(){if("object"!=typeof e.Event)try{l=new e.Event("change")}catch(e){}l||(l=t.createEvent("Event")).initEvent("change",!0,!0),o.dispatchEvent(l)});return a.handleTracksChange(),a}xe(r,i);var n=r.prototype;return n.handleClick=function(e){var t=this.track,r=this.player_.textTracks();if(i.prototype.handleClick.call(this,e),r)for(var n=0;n<r.length;n++){var a=r[n];-1!==this.kinds.indexOf(a.kind)&&(a===t?"showing"!==a.mode&&(a.mode="showing"):"disabled"!==a.mode&&(a.mode="disabled"))}},n.handleTracksChange=function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)},n.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}}},n.dispose=function(){this.track=null,i.prototype.dispose.call(this)},r}(ra);Ie.registerComponent("TextTrackMenuItem",na);var aa=function(e){function t(t,i){return i.track={player:t,kind:i.kind,kinds:i.kinds,default:!1,mode:"disabled"},i.kinds||(i.kinds=[i.kind]),i.label?i.track.label=i.label:i.track.label=i.kinds.join(" and ")+" off",i.selectable=!0,i.multiSelectable=!1,e.call(this,t,i)||this}xe(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!0,r=0,n=t.length;r<n;r++){var a=t[r];if(this.options_.kinds.indexOf(a.kind)>-1&&"showing"===a.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,r=0,n=t.length;r<n;r++){var a=t[r];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&"showing"===a.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(na);Ie.registerComponent("OffTextTrackMenuItem",aa);var sa=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return xe(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=na),this.label_&&(i=this.label_+" off"),e.push(new aa(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var n=0;n<r.length;n++){var a=r[n];if(this.kinds_.indexOf(a.kind)>-1){var s=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+a.kind+"-menu-item"),e.push(s)}}return e},t}(ta);Ie.registerComponent("TextTrackButton",sa);var oa=function(e){function t(t,i){var r,n=i.track,a=i.cue,s=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=a.text,i.selected=a.startTime<=s&&s<a.endTime,(r=e.call(this,t,i)||this).track=n,r.cue=a,n.addEventListener("cuechange",pe(Ue(r),r.update)),r}xe(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},i.update=function(e){var t=this.cue,i=this.player_.currentTime();this.selected(t.startTime<=i&&i<t.endTime)},t}(ra);Ie.registerComponent("ChaptersTrackMenuItem",oa);var la=function(e){function t(t,i,r){return e.call(this,t,i,r)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildWrapperCSSClass.call(this)},i.update=function(t){this.track_&&(!t||"addtrack"!==t.type&&"removetrack"!==t.type)||this.setTrack(this.findChaptersTrack()),e.prototype.update.call(this)},i.setTrack=function(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";var i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.addEventListener("load",this.updateHandler_)}}},i.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1;t>=0;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Pe(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,r=t.length;i<r;i++){var n=t[i],a=new oa(this.player_,{track:this.track_,cue:n});e.push(a)}return e},t}(sa);la.prototype.kind_="chapters",la.prototype.controlText_="Chapters",Ie.registerComponent("ChaptersButton",la);var ua=function(e){function t(t,i,r){var n;n=e.call(this,t,i,r)||this;var a=t.textTracks(),s=pe(Ue(n),n.handleTracksChange);return a.addEventListener("change",s),n.on("dispose",function(){a.removeEventListener("change",s)}),n}xe(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!1,r=0,n=t.length;r<n;r++){var a=t[r];if(a.kind!==this.kind_&&"showing"===a.mode){i=!0;break}}i?this.disable():this.enable()},i.buildCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(sa);ua.prototype.kind_="descriptions",ua.prototype.controlText_="Descriptions",Ie.registerComponent("DescriptionsButton",ua);var ca=function(e){function t(t,i,r){return e.call(this,t,i,r)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(sa);ca.prototype.kind_="subtitles",ca.prototype.controlText_="Subtitles",Ie.registerComponent("SubtitlesButton",ca);var da=function(e){function t(t,i){var r;return i.track={player:t,kind:i.kind,label:i.kind+" settings",selectable:!1,default:!1,mode:"disabled"},i.selectable=!1,i.name="CaptionSettingsMenuItem",(r=e.call(this,t,i)||this).addClass("vjs-texttrack-settings"),r.controlText(", opens "+i.kind+" settings dialog"),r}return xe(t,e),t.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},t}(na);Ie.registerComponent("CaptionSettingsMenuItem",da);var ha=function(e){function t(t,i,r){return e.call(this,t,i,r)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-captions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-captions-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new da(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t)},t}(sa);ha.prototype.kind_="captions",ha.prototype.controlText_="Captions",Ie.registerComponent("CaptionsButton",ha);var fa=function(e){function t(){return e.apply(this,arguments)||this}return xe(t,e),t.prototype.createEl=function(t,i,r){var n='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"captions"===this.options_.track.kind&&(n+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Captions")+"</span>\n "),n+="</span>",e.prototype.createEl.call(this,t,c({innerHTML:n},i),r)},t}(na);Ie.registerComponent("SubsCapsMenuItem",fa);var pa=function(e){function t(t,i){var r;return void 0===i&&(i={}),(r=e.call(this,t,i)||this).label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(r.player_.language_)>-1&&(r.label_="captions"),r.menuButton_.controlText(Pe(r.label_)),r}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new da(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=e.prototype.createItems.call(this,t,fa)},t}(sa);pa.prototype.kinds_=["captions","subtitles"],pa.prototype.controlText_="Subtitles",Ie.registerComponent("SubsCapsButton",pa);var ma=function(e){function t(t,i){var r,n=i.track,a=t.audioTracks();i.label=n.label||n.language||"Unknown",i.selected=n.enabled,(r=e.call(this,t,i)||this).track=n,r.addClass("vjs-"+n.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r.handleTracksChange.apply(Ue(r),t)};return a.addEventListener("change",s),r.on("dispose",function(){a.removeEventListener("change",s)}),r}xe(t,e);var i=t.prototype;return i.createEl=function(t,i,r){var n='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return"main-desc"===this.options_.track.kind&&(n+='\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> '+this.localize("Descriptions")+"</span>\n "),n+="</span>",e.prototype.createEl.call(this,t,c({innerHTML:n},i),r)},i.handleClick=function(t){var i=this.player_.audioTracks();e.prototype.handleClick.call(this,t);for(var r=0;r<i.length;r++){var n=i[r];n.enabled=n===this.track}},i.handleTracksChange=function(e){this.selected(this.track.enabled)},t}(ra);Ie.registerComponent("AudioTrackMenuItem",ma);var ga=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.audioTracks(),e.call(this,t,i)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-audio-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-audio-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(e){void 0===e&&(e=[]),this.hideThreshold_=1;for(var t=this.player_.audioTracks(),i=0;i<t.length;i++){var r=t[i];e.push(new ma(this.player_,{track:r,selectable:!0,multiSelectable:!1}))}return e},t}(ta);ga.prototype.controlText_="Audio Track",Ie.registerComponent("AudioTrackButton",ga);var va=function(e){function t(t,i){var r,n=i.rate,a=parseFloat(n,10);return i.label=n,i.selected=1===a,i.selectable=!0,i.multiSelectable=!1,(r=e.call(this,t,i)||this).label=n,r.rate=a,r.on(t,"ratechange",r.update),r}xe(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},i.update=function(e){this.selected(this.player().playbackRate()===this.rate)},t}(ra);va.prototype.contentElType="button",Ie.registerComponent("PlaybackRateMenuItem",va);var ya=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).updateVisibility(),r.updateLabel(),r.on(t,"loadstart",r.updateVisibility),r.on(t,"ratechange",r.updateLabel),r}xe(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this);return this.labelEl_=b("div",{className:"vjs-playback-rate-value",innerHTML:"1x"}),t.appendChild(this.labelEl_),t},i.dispose=function(){this.labelEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildWrapperCSSClass.call(this)},i.createMenu=function(){var e=new Zn(this.player()),t=this.playbackRates();if(t)for(var i=t.length-1;i>=0;i--)e.addChild(new va(this.player(),{rate:t[i]+"x"}));return e},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){for(var t=this.player().playbackRate(),i=this.playbackRates(),r=i[0],n=0;n<i.length;n++)if(i[n]>t){r=i[n];break}this.player().playbackRate(r)},i.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},t}(ea);ya.prototype.controlText_="Playback Rate",Ie.registerComponent("PlaybackRateMenuButton",ya);var _a=function(e){function t(){return e.apply(this,arguments)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},t}(Ie);Ie.registerComponent("Spacer",_a);var ba=function(e){function t(){return e.apply(this,arguments)||this}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){var t=e.prototype.createEl.call(this,{className:this.buildCSSClass()});return t.innerHTML=" ",t},t}(_a);Ie.registerComponent("CustomControlSpacer",ba);var Ta=function(e){function t(){return e.apply(this,arguments)||this}return xe(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(Ie);Ta.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in t&&Ta.prototype.options_.children.splice(Ta.prototype.options_.children.length-1,0,"pictureInPictureToggle"),Ie.registerComponent("ControlBar",Ta);var Sa=function(e){function t(t,i){var r;return(r=e.call(this,t,i)||this).on(t,"error",r.open),r}xe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(Ct);Sa.prototype.options_=De(Ct.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Ie.registerComponent("ErrorDisplay",Sa);var Ea=["#000","Black"],ka=["#00F","Blue"],wa=["#0FF","Cyan"],Ca=["#0F0","Green"],La=["#F0F","Magenta"],Aa=["#F00","Red"],Ra=["#FFF","White"],Pa=["#FF0","Yellow"],Da=["1","Opaque"],Ia=["0.5","Semi-Transparent"],xa=["0","Transparent"],Oa={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Ea,Ra,Aa,Ca,ka,Pa,La,wa]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Da,Ia,xa]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Ra,Ea,Aa,Ca,ka,Pa,La,wa]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Da,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,Da]}};function Ma(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}Oa.windowColor.options=Oa.backgroundColor.options;var Ua=function(t){function i(e,i){var r;return i.temporary=!1,(r=t.call(this,e,i)||this).updateDisplay=pe(Ue(r),r.updateDisplay),r.fill(),r.hasBeenOpened_=r.hasBeenFilled_=!0,r.endDialog=b("p",{className:"vjs-control-text",textContent:r.localize("End of dialog window.")}),r.el().appendChild(r.endDialog),r.setDefaults(),void 0===i.persistTextTrackSettings&&(r.options_.persistTextTrackSettings=r.options_.playerOptions.persistTextTrackSettings),r.on(r.$(".vjs-done-button"),"click",function(){r.saveSettings(),r.close()}),r.on(r.$(".vjs-default-button"),"click",function(){r.setDefaults(),r.updateDisplay()}),u(Oa,function(e){r.on(r.$(e.selector),"change",r.updateDisplay)}),r.options_.persistTextTrackSettings&&r.restoreSettings(),r}xe(i,t);var r=i.prototype;return r.dispose=function(){this.endDialog=null,t.prototype.dispose.call(this)},r.createElSelect_=function(e,t,i){var r=this;void 0===t&&(t=""),void 0===i&&(i="label");var n=Oa[e],a=n.id.replace("%s",this.id_),s=[t,a].join(" ").trim();return["<"+i+' id="'+a+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(n.label),"</"+i+">",'<select aria-labelledby="'+s+'">'].concat(n.options.map(function(e){var t=a+"-"+e[1].replace(/\W+/g,"");return['<option id="'+t+'" value="'+e[0]+'" ','aria-labelledby="'+s+" "+t+'">',r.localize(e[1]),"</option>"].join("")})).concat("</select>").join("")},r.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("")},r.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("")},r.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("")},r.createElColors_=function(){return b("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},r.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("")})},r.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("")})},r.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},r.label=function(){return this.localize("Caption Settings Dialog")},r.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},r.buildCSSClass=function(){return t.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},r.getValues=function(){var e,t,i,r=this;return e=Oa,t=function(e,t,i){var n,a,s=(n=r.$(t.selector),a=t.parser,Ma(n.options[n.options.selectedIndex].value,a));return void 0!==s&&(e[i]=s),e},void 0===(i={})&&(i=0),l(e).reduce(function(i,r){return t(i,e[r],r)},i)},r.setValues=function(e){var t=this;u(Oa,function(i,r){!function(e,t,i){if(t)for(var r=0;r<e.options.length;r++)if(Ma(e.options[r].value,i)===t){e.selectedIndex=r;break}}(t.$(i.selector),e[r],i.parser)})},r.setDefaults=function(){var e=this;u(Oa,function(t){var i=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=i})},r.restoreSettings=function(){var t;try{t=JSON.parse(e.localStorage.getItem("vjs-text-track-settings"))}catch(e){a.warn(e)}t&&this.setValues(t)},r.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)}}},r.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},r.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,i=e&&e.captionsButton;t?t.focus():i&&i.focus()},i}(Ct);Ie.registerComponent("TextTrackSettings",Ua);var Ba=function(t){function i(i,r){var n,a=r.ResizeObserver||e.ResizeObserver;null===r.ResizeObserver&&(a=!1);var s=De({createEl:!a,reportTouchActivity:!1},r);return(n=t.call(this,i,s)||this).ResizeObserver=r.ResizeObserver||e.ResizeObserver,n.loadListener_=null,n.resizeObserver_=null,n.debouncedHandler_=ge(function(){n.resizeHandler()},100,!1,Ue(n)),a?(n.resizeObserver_=new n.ResizeObserver(n.debouncedHandler_),n.resizeObserver_.observe(i.el())):(n.loadListener_=function(){if(n.el_&&n.el_.contentWindow){var e=n.debouncedHandler_,t=n.unloadListener_=function(){te(this,"resize",e),te(this,"unload",t),t=null};ee(n.el_.contentWindow,"unload",t),ee(n.el_.contentWindow,"resize",e)}},n.one("load",n.loadListener_)),n}xe(i,t);var r=i.prototype;return r.createEl=function(){return t.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1},{"aria-hidden":"true"})},r.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},r.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,t.prototype.dispose.call(this)},i}(Ie);Ie.registerComponent("ResizeManager",Ba);var Na=function(e){function i(i,r){var n,a=De({createEl:!1},r);return(n=e.call(this,i,a)||this).reset_(),n.on(n.player_,"durationchange",n.handleDurationchange),Ze&&"hidden"in t&&"visibilityState"in t&&n.on(t,"visibilitychange",n.handleVisibilityChange),n}xe(i,e);var r=i.prototype;return r.handleVisibilityChange=function(){this.player_.duration()===1/0&&(t.hidden?this.stopTracking():this.startTracking())},r.isBehind_=function(){if(!this.timeupdateSeen_)return!1;var e=this.liveCurrentTime(),t=this.player_.currentTime(),i=this.seekableIncrement_;return e!==1/0&&e-(2*i+.07)>=t},r.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"))}},r.handleDurationchange=function(){this.player_.duration()===1/0?this.startTracking():this.stopTracking()},r.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)))},r.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge)},r.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)},r.stopTracking=function(){this.isTracking()&&this.reset_()},r.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},r.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},r.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?1/0:e-this.seekableStart()},r.isLive=function(){return this.isTracking()},r.atLiveEdge=function(){return!this.behindLiveEdge()},r.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},r.pastSeekEnd=function(){return this.pastSeekEnd_},r.behindLiveEdge=function(){return this.behindLiveEdge_},r.isTracking=function(){return"number"==typeof this.trackingInterval_},r.seekToLiveEdge=function(){this.atLiveEdge()||(this.player_.currentTime(this.liveCurrentTime()),this.player_.paused()&&this.player_.play())},r.dispose=function(){this.stopTracking(),e.prototype.dispose.call(this)},i}(Ie);Ie.registerComponent("LiveTracker",Na);var Fa=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),r=[],n="";if(!i.length)return!1;for(var a=0;a<i.length;a++){var s=i[a].src;s&&-1===r.indexOf(s)&&r.push(s)}return!!r.length&&(1===r.length&&(n=r[0]),e.triggerSourceset(n),!0)},ja=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(i){var r=t.createElement(this.nodeName.toLowerCase());r.innerHTML=i;for(var n=t.createDocumentFragment();r.childNodes.length;)n.appendChild(r.childNodes[0]);return this.innerText="",e.Element.prototype.appendChild.call(this,n),this.innerHTML}}),Ga=function(e,t){for(var i={},r=0;r<e.length&&!((i=Object.getOwnPropertyDescriptor(e[r],t))&&i.set&&i.get);r++);return i.enumerable=!0,i.configurable=!0,i},Va=function(t){var i=t.el();if(!i.resetSourceWatch_){var r={},n=function(t){return Ga([t.el(),e.HTMLMediaElement.prototype,e.Element.prototype,ja],"innerHTML")}(t),a=function(e){return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];var s=e.apply(i,n);return Fa(t),s}};["append","appendChild","insertAdjacentHTML"].forEach(function(e){i[e]&&(r[e]=i[e],i[e]=a(r[e]))}),Object.defineProperty(i,"innerHTML",De(n,{set:a(n.set)})),i.resetSourceWatch_=function(){i.resetSourceWatch_=null,Object.keys(r).forEach(function(e){i[e]=r[e]}),Object.defineProperty(i,"innerHTML",n)},t.one("sourceset",i.resetSourceWatch_)}},Ha=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?Vt(e.Element.prototype.getAttribute.call(this,"src")):""},set:function(t){return e.Element.prototype.setAttribute.call(this,"src",t),t}}),Ka=function(t){if(t.featuresSourceset){var i=t.el();if(!i.resetSourceset_){var r=function(t){return Ga([t.el(),e.HTMLMediaElement.prototype,Ha],"src")}(t),n=i.setAttribute,a=i.load;Object.defineProperty(i,"src",De(r,{set:function(e){var n=r.set.call(i,e);return t.triggerSourceset(i.src),n}})),i.setAttribute=function(e,r){var a=n.call(i,e,r);return/src/i.test(e)&&t.triggerSourceset(i.src),a},i.load=function(){var e=a.call(i);return Fa(t)||(t.triggerSourceset(""),Va(t)),e},i.currentSrc?t.triggerSourceset(i.currentSrc):Fa(t)||Va(t),i.resetSourceset_=function(){i.resetSourceset_=null,i.load=a,i.setAttribute=n,Object.defineProperty(i,"src",r),i.resetSourceWatch_&&i.resetSourceWatch_()}}}},qa=function(i){function r(e,t){var r;r=i.call(this,e,t)||this;var n=e.source,s=!1;if(n&&(r.el_.currentSrc!==n.src||e.tag&&3===e.tag.initNetworkState_)?r.setSource(n):r.handleLateInit_(r.el_),e.enableSourceset&&r.setupSourcesetHandling_(),r.el_.hasChildNodes()){for(var o=r.el_.childNodes,l=o.length,u=[];l--;){var c=o[l];"track"===c.nodeName.toLowerCase()&&(r.featuresNativeTextTracks?(r.remoteTextTrackEls().addTrackElement_(c),r.remoteTextTracks().addTrack(c.track),r.textTracks().addTrack(c.track),s||r.el_.hasAttribute("crossorigin")||!Kt(c.src)||(s=!0)):u.push(c))}for(var d=0;d<u.length;d++)r.el_.removeChild(u[d])}return r.proxyNativeTracks_(),r.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."),r.restoreMetadataTracksInIOSNativePlayer_(),(rt||Ve||Ye)&&!0===e.nativeControlsForTouch&&r.setControls(!0),r.proxyWebkitFullscreen_(),r.triggerReady(),r}xe(r,i);var n=r.prototype;return n.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),r.disposeMediaElement(this.el_),this.options_=null,i.prototype.dispose.call(this)},n.setupSourcesetHandling_=function(){Ka(this)},n.restoreMetadataTracksInIOSNativePlayer_=function(){var e,t=this.textTracks(),i=function(){e=[];for(var i=0;i<t.length;i++){var r=t[i];"metadata"===r.kind&&e.push({track:r,storedMode:r.mode})}};i(),t.addEventListener("change",i),this.on("dispose",function(){return t.removeEventListener("change",i)});var r=function i(){for(var r=0;r<e.length;r++){var n=e[r];"disabled"===n.track.mode&&n.track.mode!==n.storedMode&&(n.track.mode=n.storedMode)}t.removeEventListener("change",i)};this.on("webkitbeginfullscreen",function(){t.removeEventListener("change",i),t.removeEventListener("change",r),t.addEventListener("change",r)}),this.on("webkitendfullscreen",function(){t.removeEventListener("change",i),t.addEventListener("change",i),t.removeEventListener("change",r)})},n.overrideNative_=function(e,t){var i=this;if(t===this["featuresNative"+e+"Tracks"]){var r=e.toLowerCase();this[r+"TracksListeners_"]&&Object.keys(this[r+"TracksListeners_"]).forEach(function(e){i.el()[r+"Tracks"].removeEventListener(e,i[r+"TracksListeners_"][e])}),this["featuresNative"+e+"Tracks"]=!t,this[r+"TracksListeners_"]=null,this.proxyNativeTracksForType_(r)}},n.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)},n.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)},n.proxyNativeTracksForType_=function(e){var t=this,i=Er[e],r=this.el()[i.getterName],n=this[i.getterName]();if(this["featuresNative"+i.capitalName+"Tracks"]&&r&&r.addEventListener){var a={change:function(e){n.trigger({type:"change",target:n,currentTarget:n,srcElement:n})},addtrack:function(e){n.addTrack(e.track)},removetrack:function(e){n.removeTrack(e.track)}},s=function(){for(var e=[],t=0;t<n.length;t++){for(var i=!1,a=0;a<r.length;a++)if(r[a]===n[t]){i=!0;break}i||e.push(n[t])}for(;e.length;)n.removeTrack(e.shift())};this[i.getterName+"Listeners_"]=a,Object.keys(a).forEach(function(e){var i=a[e];r.addEventListener(e,i),t.on("dispose",function(t){return r.removeEventListener(e,i)})}),this.on("loadstart",s),this.on("dispose",function(e){return t.off("loadstart",s)})}},n.proxyNativeTracks_=function(){var e=this;Er.names.forEach(function(t){e.proxyNativeTracksForType_(t)})},n.createEl=function(){var e=this.options_.tag;if(!e||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(e){var i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),r.disposeMediaElement(e),e=i}else{e=t.createElement("video");var n=De({},this.options_.tag&&A(this.options_.tag));rt&&!0===this.options_.nativeControlsForTouch||delete n.controls,L(e,c(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&P(e,"preload",this.options_.preload);for(var a=["loop","muted","playsinline","autoplay","stretch","fluent"],s=0;s<a.length;s++){var o=a[s],l=this.options_[o];void 0!==l&&(l?P(e,o,o):D(e,o),e[o]=l)}return e},n.handleLateInit_=function(e){if(0!==e.networkState&&3!==e.networkState){if(0===e.readyState){var t=!1,i=function(){t=!0};this.on("loadstart",i);var r=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",r),void this.ready(function(){this.off("loadstart",i),this.off("loadedmetadata",r),t||this.trigger("loadstart")})}var n=["loadstart"];n.push("loadedmetadata"),e.readyState>=2&&n.push("loadeddata"),e.readyState>=3&&n.push("canplay"),e.readyState>=4&&n.push("canplaythrough"),this.ready(function(){n.forEach(function(e){this.trigger(e)},this)})}},n.setCurrentTime=function(e){try{this.el_.currentTime=e}catch(e){a(e,"Video is not ready. (Video.js)")}},n.duration=function(){var e=this;if(this.el_.duration===1/0&&We&&Qe&&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},n.width=function(){return this.el_.offsetWidth},n.height=function(){return this.el_.offsetHeight},n.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)})}},n.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},n.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()},n.exitFullScreen=function(){this.el_.webkitExitFullScreen()},n.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},n.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},n.reset=function(){r.resetMediaElement(this.el_)},n.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},n.setControls=function(e){this.el_.controls=!!e},n.addTextTrack=function(e,t,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,r):i.prototype.addTextTrack.call(this,e,t,r)},n.createRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return i.prototype.createRemoteTextTrack.call(this,e);var r=t.createElement("track");return e.kind&&(r.kind=e.kind),e.label&&(r.label=e.label),(e.language||e.srclang)&&(r.srclang=e.language||e.srclang),e.default&&(r.default=e.default),e.id&&(r.id=e.id),e.src&&(r.src=e.src),r},n.addRemoteTextTrack=function(e,t){var r=i.prototype.addRemoteTextTrack.call(this,e,t);return this.featuresNativeTextTracks&&this.el().appendChild(r),r},n.removeRemoteTextTrack=function(e){if(i.prototype.removeRemoteTextTrack.call(this,e),this.featuresNativeTextTracks)for(var t=this.$$("track"),r=t.length;r--;)e!==t[r]&&e!==t[r].track||this.el().removeChild(t[r])},n.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},r}(tn);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?P(qa.TEST_VID,"muted","muted"):D(qa.TEST_VID,"muted"),e!==qa.TEST_VID.muted}catch(e){return!1}},qa.canControlPlaybackRate=function(){if(We&&Qe&&Je<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||Ke&&Qe},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=!Ke,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 za=qa.TEST_VID&&qa.TEST_VID.constructor.prototype.canPlayType,Ya=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;qa.patchCanPlayType=function(){ze>=4&&!Xe&&!Qe&&(qa.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&Ya.test(e)?"maybe":za.call(this,e)})},qa.unpatchCanPlayType=function(){var e=qa.TEST_VID.constructor.prototype.canPlayType;return qa.TEST_VID.constructor.prototype.canPlayType=za,e},qa.patchCanPlayType(),qa.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},qa.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","stretch","fluent","controls","loop","playsinline"].forEach(function(e){qa.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){qa.prototype["set"+Pe(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"+Pe(e)]=function(t){this.el_[e]=t}}),["pause","load","play"].forEach(function(e){qa.prototype[e]=function(){return this.el_[e]()}}),tn.withSourceHandlers(qa),qa.nativeSourceHandler={},qa.nativeSourceHandler.canPlayType=function(e){try{return qa.TEST_VID.canPlayType(e)}catch(e){return""}},qa.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return qa.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=Ht(e.src);return qa.nativeSourceHandler.canPlayType("video/"+i)}return""},qa.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},qa.nativeSourceHandler.dispose=function(){},qa.registerSourceHandler(qa.nativeSourceHandler),tn.registerTech("Html5",qa);var Xa=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],$a={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Qa=["tiny","xsmall","small","medium","large","xlarge","huge"],Ja={};Qa.forEach(function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Ja[e]="vjs-layout-"+t});var Za={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},es=function(r){function n(e,t,a){var o;if(e.id=e.id||t.id||"vjs_video_"+Y(),(t=c(n.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language)if("function"==typeof e.closest){var l=e.closest("[lang]");l&&l.getAttribute&&(t.language=l.getAttribute("lang"))}else for(var u=e;u&&1===u.nodeType;){if(A(u).hasOwnProperty("lang")){t.language=u.getAttribute("lang");break}u=u.parentNode}if((o=r.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_=n.prototype.options_.languages;o.resetCache_(),o.poster_=t.poster||"",o.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),o.changingSrc_=!1,o.playCallbacks_=[],o.playTerminatedQueue_=[],e.hasAttribute("autoplay")?o.autoplay(!0):o.autoplay(o.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(function(e){if("function"!=typeof o[e])throw new Error('plugin "'+e+'" does not exist')}),o.scrubbing_=!1,o.el_=o.createEl(),Ce(Ue(o),{eventBusKey:"el_"}),o.fluid_&&o.on("playerreset",o.updateStyleEl_);var h=De(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"),rt&&o.addClass("vjs-touch-enabled"),Ke||o.addClass("vjs-workinghover"),n.players[o.id_]=Ue(o);var f=i.split(".")[0];return o.addClass("vjs-v"+f),o.userActive(!0),o.reportUserActivity(),o.one("play",o.listenForUserActivity_),o.on("stageclick",o.handleStageClick_),o.on("keydown",o.handleKeyDown),o.breakpoints(o.options_.breakpoints),o.responsive(o.options_.responsive),o}xe(n,r);var o=n.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),n.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),nn[this.id()]=null,wr.names.forEach(function(t){var i=wr[t],r=e[i.getterName]();r&&r.off&&r.off()}),r.prototype.dispose.call(this)},o.createEl=function(){var i,n=this.tag,a=this.playerElIngest_=n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player"),s="video-js"===this.tag.tagName.toLowerCase();a?i=this.el_=n.parentNode:s||(i=this.el_=r.prototype.createEl.call(this,"div"));var o=A(n);if(s){for(i=this.el_=n,n=this.tag=t.createElement("video");i.children.length;)n.appendChild(i.firstChild);E(i,"video-js")||k(i,"video-js"),i.appendChild(n),a=this.playerElIngest_=i,Object.keys(i).forEach(function(e){n[e]=i[e]})}if(n.setAttribute("tabindex","-1"),o.tabindex="-1",(Ze||Qe&&it)&&(n.setAttribute("role","application"),o.role="application"),n.removeAttribute("width"),n.removeAttribute("height"),"width"in o&&delete o.width,"height"in o&&delete o.height,Object.getOwnPropertyNames(o).forEach(function(e){s&&"class"===e||i.setAttribute(e,o[e]),s&&n.setAttribute(e,o[e])}),n.playerId=n.id,n.id+="_html5_api",n.className="vjs-tech",n.player=i.player=this,this.addClass("vjs-paused"),!0!==e.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=de("vjs-styles-dimensions");var l=H(".vjs-styles-defaults"),u=H("head");u.insertBefore(this.styleEl_,l?l.nextSibling:u.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=n.getElementsByTagName("a"),d=0;d<c.length;d++){var h=c.item(d);k(h,"vjs-hidden"),h.setAttribute("hidden","hidden")}return n.initNetworkState_=n.networkState,n.parentNode&&!a&&n.parentNode.insertBefore(i,n),S(n,i),this.children_.unshift(n),this.el_.setAttribute("lang",this.language_),this.el_=i,i},o.width=function(e){return this.dimension("width",e)},o.height=function(e){return this.dimension("height",e)},o.dimension=function(e,t){var i=e+"_";if(void 0===t)return this[i]||0;if(""===t)return this[i]=void 0,void this.updateStyleEl_();var r=parseFloat(t);isNaN(r)?a.error('Improper value "'+t+'" supplied for for '+e):(this[i]=r,this.updateStyleEl_())},o.fluid=function(e){if(void 0===e)return!!this.fluid_;var t,i;this.fluid_=!!e,ye(this)&&this.off("playerreset",this.updateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),ye(t=function(){this.on("playerreset",this.updateStyleEl_)})?i():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(i))):this.removeClass("vjs-fluid"),this.updateStyleEl_()},o.fill=function(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},o.aspectRatio=function(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()},o.updateStyleEl_=function(){if(!0!==e.VIDEOJS_NO_DYNAMIC_STYLE){var t,i,r,n=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),a=n[1]/n[0];t=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/a:this.videoWidth()||300,i=void 0!==this.height_?this.height_:t*a,r=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(r),he(this.styleEl_,"\n ."+r+" {\n width: "+t+"px;\n height: "+i+"px;\n }\n\n ."+r+".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,l=this.tech_&&this.tech_.el();l&&(s>=0&&(l.width=s),o>=0&&(l.height=o))}},o.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var r=Pe(e),n=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==r&&this.tag&&(tn.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=r,this.isReady_=!1;var a={source:t,autoplay:"string"!=typeof this.autoplay()&&this.autoplay(),nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+n+"_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};wr.names.forEach(function(e){var t=wr[e];a[t.getterName]=i[t.privateName]}),c(a,this.options_[r]),c(a,this.options_[n]),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=tn.getTech(e);if(!s)throw new Error("No Tech named '"+r+"' exists! '"+r+"' should be registered using videojs.registerTech()'");this.tech_=new s(a),this.tech_.ready(pe(this,this.handleTechReady_),!0),St(this.textTracksJson_||[],this.tech_),Xa.forEach(function(e){i.on(i.tech_,e,i["handleTech"+Pe(e)+"_"])}),Object.keys($a).forEach(function(e){i.on(i.tech_,e,function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+$a[e]+"_"].bind(i),event:t}):i["handleTech"+$a[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"===r&&this.tag||S(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},o.unloadTech_=function(){var e=this;wr.names.forEach(function(t){var i=wr[t];e[i.privateName]=e[i.getterName]()}),this.textTracksJson_=Tt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},o.tech=function(e){return void 0===e&&a.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_},o.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"mouseup",this.handleTechClick_),this.on(this.tech_,"dblclick",this.handleTechDoubleClick_),this.on(this.tech_,"touchstart",this.handleTechTouchStart_),this.on(this.tech_,"touchmove",this.handleTechTouchMove_),this.on(this.tech_,"touchend",this.handleTechTouchEnd_),this.on(this.tech_,"tap",this.handleTechTap_)},o.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.handleTechTap_),this.off(this.tech_,"touchstart",this.handleTechTouchStart_),this.off(this.tech_,"touchmove",this.handleTechTouchMove_),this.off(this.tech_,"touchend",this.handleTechTouchEnd_),this.off(this.tech_,"mouseup",this.handleTechClick_),this.off(this.tech_,"dblclick",this.handleTechDoubleClick_)},o.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},o.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.seekingTimer&&(clearTimeout(this.seekingTimer),this.seekingTimer=0),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(this.autoplay())},o.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"==typeof e){var i,r=function(){var e=t.muted();t.muted(!0);var i=function(){t.muted(e)};t.playTerminatedQueue_.push(i);var r=t.play();if(yt(r))return r.catch(i)};if("any"===e&&!0!==this.muted()?yt(i=this.play())&&(i=i.catch(r)):i="muted"===e&&!0!==this.muted()?r():this.play(),yt(i))return i.then(function(){t.trigger({type:"autoplay-success",autoplay:e})}).catch(function(i){t.trigger({type:"autoplay-failure",autoplay:e})})}},o.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter(function(e){return e.src===t});if(i.length)return i[0].type;for(var r=e.$$("source"),n=0;n<r.length;n++){var a=r[n];if(a.type&&a.src&&a.src===t)return a.type}return fn(t)}(this,t)),this.cache_.source=De({},e,{src:t,type:i});for(var r=this.cache_.sources.filter(function(e){return e.src&&e.src===t}),n=[],a=this.$$("source"),s=[],o=0;o<a.length;o++){var l=A(a[o]);n.push(l),l.src&&l.src===t&&s.push(l.src)}s.length&&!r.length?this.cache_.sources=n:r.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t},o.handleTechSourceset_=function(e){var t=this;if(!this.changingSrc_){var i=function(e){return t.updateSourceCaches_(e)},r=this.currentSource().src,n=e.src;r&&!/^blob:/.test(r)&&/^blob:/.test(n)&&(!this.lastSource_||this.lastSource_.tech!==n&&this.lastSource_.player!==r)&&(i=function(){}),i(n),e.src||this.tech_.any(["sourceset","loadstart"],function(e){if("sourceset"!==e.type){var i=t.techGet("currentSrc");t.lastSource_.tech=i,t.updateSourceCaches_(i)}})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})},o.hasStarted=function(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},o.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},o.handleTechRateChange_=function(){this.tech_.playbackRate()>0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach(function(e){return e.callback(e.event)}),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},o.waitingTimer=0,o.seekingTimer=0,o.handleTechWaiting_=function(){var e=this;this.waitingTimer&&clearTimeout(this.waitingTimer),this.waitingTimer=setTimeout(function(){e.addClass("vjs-waiting")},1e3),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",function i(){e.waitingTimer&&(clearTimeout(e.waitingTimer),e.waitingTimer=0),t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))})},o.handleTechCanPlay_=function(){this.waitingTimer&&(clearTimeout(this.waitingTimer),this.waitingTimer=0),this.removeClass("vjs-waiting"),this.trigger("canplay")},o.handleTechCanPlayThrough_=function(){this.waitingTimer&&(clearTimeout(this.waitingTimer),this.waitingTimer=0),this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},o.handleTechPlaying_=function(){this.waitingTimer&&(clearTimeout(this.waitingTimer),this.waitingTimer=0),this.removeClass("vjs-waiting"),this.trigger("playing")},o.handleTechSeeking_=function(){var e=this;this.seekingTimer&&clearTimeout(this.seekingTimer),this.seekingTimer=setTimeout(function(){e.addClass("vjs-seeking")},1e3),this.trigger("seeking")},o.handleTechSeeked_=function(){this.seekingTimer&&(clearTimeout(this.seekingTimer),this.seekingTimer=0),this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},o.handleTechFirstPlay_=function(){this.options_.starttime&&(a.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},o.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},o.handleTechEnded_=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},o.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},o.handleTechClick_=function(e){V(e)&&this.controls_&&this.paused()},o.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(t){return t.contains(e.target)})||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},o.handleTechTap_=function(){this.userActive(!this.userActive())},o.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},o.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},o.handleTechTouchEnd_=function(e){e.preventDefault()},o.handleStageClick_=function(){this.reportUserActivity()},o.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},o.documentFullscreenChange_=function(e){var i=this.el(),r=t[this.fsApi_.fullscreenElement]===i;!r&&i.matches?r=i.matches(":"+this.fsApi_.fullscreen):!r&&i.msMatchesSelector&&(r=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(r),!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 un)return function(e,t,i,r){return t[i](e.reduce(dn(i),r))}(this.middleware_,this.tech_,e,t);if(e in cn)return on(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 ln)return function(e,t,i){return e.reduceRight(dn(i),t[i]())}(this.middleware_,this.tech_,e);if(e in cn)return on(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw a("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw a("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw a(t),t}}},o.play=function(){var t=this,i=this.options_.Promise||e.Promise;return i?new i(function(e){t.play_(e)}):this.play_()},o.play_=function(e){var t=this;void 0===e&&(e=_t),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!tt&&!Ke||this.load());var r=this.techGet_("play");null===r?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(r)},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 lt(this.buffered(),this.duration())},o.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i},o.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},o.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},o.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},o.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},o.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},o.isFullscreen=function(e){return void 0!==e?(this.isFullscreen_=!!e,void this.toggleFullscreenClass_()):!!this.isFullscreen_},o.requestFullscreen=function(e){var i;this.isFullscreen(!0),this.fsApi_.requestFullscreen?(ee(t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.fsApi_.prefixed||(i=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(i=e)),_t(this.el_[this.fsApi_.requestFullscreen](i))):this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):(this.enterFullWindow(),this.trigger("fullscreenchange"))},o.exitFullscreen=function(){this.isFullscreen(!1),this.fsApi_.requestFullscreen?(t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement)&&_t(t[this.fsApi_.exitFullscreen]()):this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):(this.exitFullWindow(),this.trigger("fullscreenchange"))},o.enterFullWindow=function(){this.isFullWindow=!0,this.docOrigOverflow=t.documentElement.style.overflow,ee(t,"keydown",this.boundFullWindowOnEscKey_),t.documentElement.style.overflow="hidden",k(t.body,"vjs-full-window"),this.trigger("enterFullWindow")},o.fullWindowOnEscKey=function(e){kt.isEventKey(e,"Esc")&&(!0===this.isFullscreen()?this.exitFullscreen():this.exitFullWindow())},o.exitFullWindow=function(){this.isFullWindow=!1,te(t,"keydown",this.boundFullWindowOnEscKey_),t.documentElement.style.overflow=this.docOrigOverflow,w(t.body,"vjs-full-window"),this.trigger("exitFullWindow")},o.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},o.requestPictureInPicture=function(){if("pictureInPictureEnabled"in t)return this.techGet_("requestPictureInPicture")},o.exitPictureInPicture=function(){if("pictureInPictureEnabled"in t)return t.exitPictureInPicture()},o.handleKeyDown=function(e){var t=this.options_.userActions;if(t&&t.hotkeys){(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}},o.handleHotkeys=function(e){var i=this.options_.userActions?this.options_.userActions.hotkeys:{},r=i.fullscreenKey,n=void 0===r?function(e){return kt.isEventKey(e,"f")}:r,a=i.muteKey,s=void 0===a?function(e){return kt.isEventKey(e,"m")}:a,o=i.playPauseKey,l=void 0===o?function(e){return kt.isEventKey(e,"k")||kt.isEventKey(e,"Space")}:o;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();var u=Ie.getComponent("FullscreenToggle");!1!==t[this.fsApi_.fullscreenEnabled]&&u.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(l.call(this,e)){e.preventDefault(),e.stopPropagation(),Ie.getComponent("PlayToggle").prototype.handleClick.call(this,e)}},o.canPlayType=function(e){for(var t,i=0,r=this.options_.techOrder;i<r.length;i++){var n=r[i],s=tn.getTech(n);if(s||(s=Ie.getComponent(n)),s){if(s.isSupported()&&(t=s.canPlayType(e)))return t}else a.error('The "'+n+'" tech is undefined. Skipped browser support check for that tech.')}return""},o.selectSource=function(e){var t,i=this,r=this.options_.techOrder.map(function(e){return[e,tn.getTech(e)]}).filter(function(e){var t=e[0],i=e[1];return i?i.isSupported():(a.error('The "'+t+'" tech is undefined. Skipped browser support check for that tech.'),!1)}),n=function(e,t,i){var r;return e.some(function(e){return t.some(function(t){if(r=i(e,t))return!0})}),r},s=function(e,t){var r=e[0];if(e[1].canPlaySource(t,i.options_[r.toLowerCase()]))return{source:t,tech:r}};return(this.options_.sourceOrder?n(e,r,(t=s,function(e,i){return t(i,e)})):n(r,e,s))||!1},o.src=function(e){var t=this;if(void 0===e)return this.cache_.src||"";var i=function e(t){if(Array.isArray(t)){var i=[];t.forEach(function(t){t=e(t),Array.isArray(t)?i=i.concat(t):d(t)&&i.push(t)}),t=i}else t="string"==typeof t&&t.trim()?[pn({src:t})]:d(t)&&"string"==typeof t.src&&t.src&&t.src.trim()?[pn(t)]:[];return t}(e);i.length?(this.changingSrc_=!0,this.cache_.sources=i,this.updateSourceCaches_(i[0]),sn(this,i[0],function(e,r){var n,a;if(t.middleware_=r,t.cache_.sources=i,t.updateSourceCaches_(e),t.src_(e))return i.length>1?t.src(i.slice(1)):(t.changingSrc_=!1,t.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0),void t.triggerReady());n=r,a=t.tech_,n.forEach(function(e){return e.setTech&&e.setTech(a)})})):this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0)},o.src_=function(e){var t,i,r=this,n=this.selectSource([e]);return!n||(t=n.tech,i=this.techName_,Pe(t)!==Pe(i)?(this.changingSrc_=!0,this.loadTech_(n.tech,n.source),this.tech_.ready(function(){r.changingSrc_=!1}),!1):(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1))},o.load=function(){this.techCall_("load")},o.reset=function(){var t=this,i=this.options_.Promise||e.Promise;this.paused()||!i?this.doReset_():_t(this.play().then(function(){return t.doReset_()}))},o.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),ye(this)&&this.trigger("playerreset")},o.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},o.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar,t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},o.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},o.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},o.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},o.currentSource=function(){return this.cache_.source||{}},o.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},o.currentType=function(){return this.currentSource()&&this.currentSource().type||""},o.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},o.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)?(this.options_.autoplay=e,this.manualAutoplay_(e),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},o.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},o.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},o.stretch=function(e){return void 0!==e?(this.techCall_("setStretch",e),void(this.options_.stretch=e)):this.techGet_("stretch")},o.fluent=function(e){return void 0!=e?(this.techCall_("setFluent",e),this.options_.fluent=e,this):this.techGet_("fluent")},o.poster=function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},o.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},o.controls=function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},o.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},o.error=function(e){if(void 0===e)return this.error_||null;if(this.options_.suppressNotSupportedError&&e&&e.message&&e.message===this.localize(this.options_.notSupportedMessage)){var t=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),void this.one("loadstart",function(){this.off(["click","touchstart"],t)})}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new mt(e),this.addClass("vjs-error"),a.error("(CODE:"+this.error_.code+" "+mt.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error")},o.reportUserActivity=function(e){this.userActivity_=!0},o.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},o.listenForUserActivity_=function(){var e,t,i,r=pe(this,this.reportUserActivity);this.on("mousedown",function(){r(),this.clearInterval(e),e=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,r())}),this.on("mouseup",function(t){r(),this.clearInterval(e)});var n,a=this.getChild("controlBar");!a||Ke||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",r),this.on("keyup",r),this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(n);var e=this.options_.inactivityTimeout;e<=0||(n=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e))}},250)},o.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},o.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},o.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},o.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},o.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},o.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)},o.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},o.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},o.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},o.language=function(e){if(void 0===e)return this.language_;this.language_=String(e).toLowerCase()},o.languages=function(){return De(n.prototype.options_.languages,this.languages_)},o.toJSON=function(){var e=De(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i<t.length;i++){var r=t[i];(r=De(r)).player=void 0,e.tracks[i]=r}return e},o.createModal=function(e,t){var i=this;(t=t||{}).content=e||"";var r=new Ct(this,t);return this.addChild(r),r.on("dispose",function(){i.removeChild(r)}),r.open(),r},o.updateCurrentBreakpoint_=function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),i=0;i<Qa.length;i++){var r=Qa[i];if(t<=this.breakpoints_[r]){if(e===r)return;e&&this.removeClass(Ja[e]),this.addClass(Ja[r]),this.breakpoint_=r;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 Ja[this.breakpoint_]||""},o.loadMedia=function(e,t){var i=this;if(e&&"object"==typeof e){this.reset(),this.cache_.media=De(e);var r=this.cache_.media,n=r.artwork,a=r.poster,s=r.src,o=r.textTracks;!n&&a&&(this.cache_.media.artwork=[{src:a,type:fn(a)}]),s&&this.src(s),a&&this.poster(a),Array.isArray(o)&&o.forEach(function(e){return i.addRemoteTextTrack(e,!1)}),this.ready(t)}},o.getMedia=function(){if(!this.cache_.media){var e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}})};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:fn(t.poster)}]),t}return De(this.cache_.media)},n.getTagSettings=function(e){var t={sources:[],tracks:[]},i=A(e),r=i["data-setup"];if(E(e,"vjs-fill")&&(i.fill=!0),E(e,"vjs-fluid")&&(i.fluid=!0),null!==r){var n=vt(r||"{}"),s=n[0],o=n[1];s&&a.error(s),c(i,o)}if(c(t,i),e.hasChildNodes())for(var l=e.childNodes,u=0,d=l.length;u<d;u++){var h=l[u],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)},n}(Ie);wr.names.forEach(function(e){var t=wr[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:tn.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"+Pe(e)+"_"]=function(){return this.trigger(e)}}),Ie.registerComponent("Player",es);var is={},rs=function(e){return is.hasOwnProperty(e)},ns=function(e){return rs(e)?is[e]:void 0},as=function(e,t){e.activePlugins_=e.activePlugins_||{},e.activePlugins_[t]=!0},ss=function(e,t,i){var r=(i?"before":"")+"pluginsetup";e.trigger(r,t),e.trigger(r+":"+t.name,t)},os=function(e,t){return t.prototype.name=e,function(){ss(this,{name:e,plugin:t,instance:null},!0);for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];var a=Me(t,[this].concat(r));return this[e]=function(){return a},ss(this,a.getEventHash()),a}},ls=function(){function e(t){if(this.constructor===e)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t,Ce(this),delete this.trigger,Ae(this,this.constructor.defaultState),as(t,this.name),this.dispose=pe(this,this.dispose),t.on("dispose",this.dispose)}var t=e.prototype;return t.version=function(){return this.constructor.VERSION},t.getEventHash=function(e){return void 0===e&&(e={}),e.name=this.name,e.plugin=this.constructor,e.instance=this,e},t.trigger=function(e,t){return void 0===t&&(t={}),ie(this.eventBusEl_,e,this.getEventHash(t))},t.handleStateChanged=function(e){},t.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t.activePlugins_[e]=!1,this.player=this.state=null,t[e]=os(e,is[e])},e.isBasic=function(t){var i="string"==typeof t?ns(t):t;return"function"==typeof i&&!e.prototype.isPrototypeOf(i.prototype)},e.registerPlugin=function(t,i){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+typeof t+".");if(rs(t))a.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(es.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'+t+'", cannot share a name with an existing player method!');if("function"!=typeof i)throw new Error('Illegal plugin for "'+t+'", must be a function, was '+typeof i+".");return is[t]=i,"plugin"!==t&&(e.isBasic(i)?es.prototype[t]=function(e,t){var i=function(){ss(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return as(this,e),ss(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach(function(e){i[e]=t[e]}),i}(t,i):es.prototype[t]=os(t,i)),i},e.deregisterPlugin=function(e){if("plugin"===e)throw new Error("Cannot de-register base plugin.");rs(e)&&(delete is[e],delete es.prototype[e])},e.getPlugins=function(e){var t;return void 0===e&&(e=Object.keys(is)),e.forEach(function(e){var i=ns(e);i&&((t=t||{})[e]=i)}),t},e.getPluginVersion=function(e){var t=ns(e);return t&&t.VERSION||""},e}();ls.getPlugin=ns,ls.BASE_PLUGIN_NAME="plugin",ls.registerPlugin("plugin",ls),es.prototype.usingPlugin=function(e){return!!this.activePlugins_&&!0===this.activePlugins_[e]},es.prototype.hasPlugin=function(e){return!!rs(e)};var us=function(e){return 0===e.indexOf("#")?e.slice(1):e};function cs(e,t,i){var r=cs.getPlayer(e);if(r)return t&&a.warn('Player "'+e+'" is already initialised. Options will not be applied.'),i&&r.ready(i),r;var n="string"==typeof e?H("#"+us(e)):e;if(!v(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");n.ownerDocument.defaultView&&n.ownerDocument.body.contains(n)||a.warn("The element supplied is not included in the DOM"),t=t||{},cs.hooks("beforesetup").forEach(function(e){var i=e(n,De(t));d(i)&&!Array.isArray(i)?t=De(t,i):a.error("please return an object in beforesetup hooks")});var s=Ie.getComponent("Player");return r=new s(n,t,i),cs.hooks("setup").forEach(function(e){return e(r)}),r}if(cs.hooks_={},cs.hooks=function(e,t){return cs.hooks_[e]=cs.hooks_[e]||[],t&&(cs.hooks_[e]=cs.hooks_[e].concat(t)),cs.hooks_[e]},cs.hook=function(e,t){cs.hooks(e,t)},cs.hookOnce=function(e,t){cs.hooks(e,[].concat(t).map(function(t){return function i(){return cs.removeHook(e,i),t.apply(void 0,arguments)}}))},cs.removeHook=function(e,t){var i=cs.hooks(e).indexOf(t);return!(i<=-1)&&(cs.hooks_[e]=cs.hooks_[e].slice(),cs.hooks_[e].splice(i,1),!0)},!0!==e.VIDEOJS_NO_DYNAMIC_STYLE&&g()){var ds=H(".vjs-styles-defaults");if(!ds){ds=de("vjs-styles-defaults");var hs=H("head");hs&&hs.insertBefore(ds,hs.firstChild),he(ds,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}ue(1,cs),cs.VERSION=i,cs.options=es.prototype.options_,cs.getPlayers=function(){return es.players},cs.getPlayer=function(e){var t,i=es.players;if("string"==typeof e){var r=us(e),n=i[r];if(n)return n;t=H("#"+r)}else t=e;if(v(t)){var a=t,s=a.player,o=a.playerId;if(s||i[o])return s||i[o]}},cs.getAllPlayers=function(){return Object.keys(es.players).map(function(e){return es.players[e]}).filter(Boolean)},cs.players=es.players,cs.getComponent=Ie.getComponent,cs.registerComponent=function(e,t){tn.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=tn.getTech,cs.registerTech=tn.registerTech,cs.use=function(e,t){rn[e]=rn[e]||[],rn[e].push(t)},Object.defineProperty(cs,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(cs.middleware,"TERMINATOR",{value:an,writeable:!1,enumerable:!0}),cs.browser=nt,cs.TOUCH_ENABLED=rt,cs.extend=function(e,t){void 0===t&&(t={});var i=function(){e.apply(this,arguments)},r={};for(var n in"object"==typeof t?(t.constructor!==Object.prototype.constructor&&(i=t.constructor),r=t):"function"==typeof t&&(i=t),function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.super_=t)}(i,e),r)r.hasOwnProperty(n)&&(i.prototype[n]=r[n]);return i},cs.mergeOptions=De,cs.bind=pe,cs.registerPlugin=ls.registerPlugin,cs.deregisterPlugin=ls.deregisterPlugin,cs.plugin=function(e,t){return a.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),ls.registerPlugin(e,t)},cs.getPlugins=ls.getPlugins,cs.getPlugin=ls.getPlugin,cs.getPluginVersion=ls.getPluginVersion,cs.addLanguage=function(e,t){var i;return e=(""+e).toLowerCase(),cs.options.languages=De(cs.options.languages,((i={})[e]=t,i)),cs.options.languages[e]},cs.log=a,cs.createLogger=s,cs.createTimeRange=cs.createTimeRanges=ot,cs.formatTime=Rn,cs.setFormatTime=function(e){An=e},cs.resetFormatTime=function(){An=Ln},cs.parseUrl=Gt,cs.isCrossOrigin=Kt,cs.EventTarget=ve,cs.on=ee,cs.one=re,cs.off=te,cs.trigger=ie,cs.xhr=dr,cs.TextTrack=vr,cs.AudioTrack=yr,cs.VideoTrack=_r,["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=Et(function(e,t){var i,r,n,a,s;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,r=/^([^\/?#]*)(.*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var n=s.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=s.normalizePath(n.path),s.buildURLFromParts(n)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return i.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=r.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(u.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var c=o.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;u.path=s.normalizePath(d)}else u.path=o.path,a.params||(u.params=o.params,a.query||(u.query=o.query));return null===u.path&&(u.path=i.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(u)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(n,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s});function ps(){return(ps=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(this,arguments)}function ms(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function gs(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var vs=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t,i,r,n=this.listeners[e];if(n)if(2===arguments.length)for(i=n.length,t=0;t<i;++t)n[t].call(this,arguments[1]);else for(r=Array.prototype.slice.call(arguments,1),i=n.length,t=0;t<i;++t)n[t].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",function(t){e.push(t)})},e}(),ys=function(e){function t(){var t;return(t=e.call(this)||this).buffer="",t}return ms(t,e),t.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(vs),_s=function(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),r={},n=i.length;n--;)""!==i[n]&&((t=/([^=]*)=(.*)/.exec(i[n]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),r[t[0]]=t[1]);return r},bs=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}ms(t,e);var i=t.prototype;return i.push=function(e){var t,i,r=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce(function(t,i){var r=i(e);return r===e?t:t.concat([r])},[e]).forEach(function(e){for(var n=0;n<r.customParsers.length;n++)if(r.customParsers[n].call(r,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))r.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void r.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void r.trigger("data",i);if(t=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"totalduration"},t[1]&&(i.duration=parseInt(t[1],10)),void r.trigger("data",i);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void r.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void r.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void r.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void r.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"byterange"},t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),void r.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void r.trigger("data",i);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"map"},t[1]){var a=_s(t[1]);if(a.URI&&(i.uri=a.URI),a.BYTERANGE){var s=a.BYTERANGE.split("@"),o=s[0],l=s[1];i.byterange={},o&&(i.byterange.length=parseInt(o,10)),l&&(i.byterange.offset=parseInt(l,10))}}r.trigger("data",i)}else if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=_s(t[1]),i.attributes.RESOLUTION){var u=i.attributes.RESOLUTION.split("x"),c={};u[0]&&(c.width=parseInt(u[0],10)),u[1]&&(c.height=parseInt(u[1],10)),i.attributes.RESOLUTION=c}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}r.trigger("data",i)}else{if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=_s(t[1])),void r.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e))r.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))r.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void r.trigger("data",i);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return i={type:"tag",tagType:"key"},t[1]&&(i.attributes=_s(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void r.trigger("data",i);if(t=/^#EXT-X-START:?(.*)$/.exec(e))return i={type:"tag",tagType:"start"},t[1]&&(i.attributes=_s(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void r.trigger("data",i);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void r.trigger("data",i);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void r.trigger("data",i);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void r.trigger("data",i);r.trigger("data",{type:"tag",data:e.slice(4)})}}}else r.trigger("data",{type:"comment",text:e.slice(1)})}):this.trigger("data",{type:"uri",uri:e}))},i.addParser=function(e){var t=this,i=e.expression,r=e.customType,n=e.dataParser,a=e.segment;"function"!=typeof n&&(n=function(e){return e}),this.customParsers.push(function(e){if(i.exec(e))return t.trigger("data",{type:"custom",data:n(e),customType:r,segment:a}),!0})},i.addTagMapper=function(e){var t=e.expression,i=e.map;this.tagMappers.push(function(e){return t.test(e)?i(e):e})},t}(vs),Ts=function(e){function t(){var t;(t=e.call(this)||this).lineStream=new ys,t.parseStream=new bs,t.lineStream.pipe(t.parseStream);var i,r,n=gs(gs(t)),a=[],s={},o={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},l=0;return t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},t.parseStream.on("data",function(e){var t,u;({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"}),r={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(r.iv=e.attributes.IV)):this.trigger("warn",{message:"ignoring key declaration without URI"}):r=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,l=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||o,e.attributes?(s.attributes||(s.attributes={}),ps(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||o,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(u={default:/yes/i.test(e.attributes.DEFAULT)}).default?u.autoselect=!0:u.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(u.language=e.attributes.LANGUAGE),e.attributes.URI&&(u.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(u.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(u.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(u.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=u}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){l+=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(n)},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),r&&(s.key=r),s.timeline=l,i&&(s.map=i),s={}},comment:function(){},custom:function(){e.segment?(s.custom=s.custom||{},s.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(n)}),t}ms(t,e);var i=t.prototype;return i.push=function(e){this.lineStream.push(e)},i.end=function(){this.lineStream.push("\n")},i.addParser=function(e){this.parseStream.addParser(e)},i.addTagMapper=function(e){this.parseStream.addTagMapper(e)},t}(vs),Ss=function(e){return!!e&&"object"==typeof e},Es=function e(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return i.reduce(function(t,i){return Object.keys(i).forEach(function(r){Array.isArray(t[r])&&Array.isArray(i[r])?t[r]=t[r].concat(i[r]):Ss(t[r])&&Ss(i[r])?t[r]=e(t[r],i[r]):t[r]=i[r]}),t},{})},ks=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},ws=function(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t},Cs="INVALID_NUMBER_OF_PERIOD",Ls="DASH_EMPTY_MANIFEST",As="DASH_INVALID_XML",Rs="NO_BASE_URL",Ps="SEGMENT_TIME_UNSPECIFIED",Ds="UNSUPPORTED_UTC_TIMING_SCHEME";var Is,xs=(function(e,t){var i,r,n,a,s;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,r=/^([^\/?#]*)(.*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,s={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var n=s.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=s.normalizePath(n.path),s.buildURLFromParts(n)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return i.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=r.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(u.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var c=o.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;u.path=s.normalizePath(d)}else u.path=o.path,a.params||(u.params=o.params,a.query||(u.query=o.query));return null===u.path&&(u.path=i.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(u)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(n,"");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),Os=function(t,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(t)||(t=xs.buildAbsoluteURL(e.location.href,t)),xs.buildAbsoluteURL(t,i))},Ms=function(e){var t=e.baseUrl,i=void 0===t?"":t,r=e.source,n=void 0===r?"":r,a=e.range,s=void 0===a?"":a,o=e.indexRange,l=void 0===o?"":o,u={uri:n,resolvedUri:Os(i||"",n)};if(s||l){var c=(s||l).split("-"),d=parseInt(c[0],10),h=parseInt(c[1],10);u.byterange={length:h-d+1,offset:d}}return u},Us={static:function(e){var t=e.duration,i=e.timescale,r=void 0===i?1:i,n=e.sourceDuration;return{start:0,end:Math.ceil(n/(t/r))}},dynamic:function(e){var t=e.NOW,i=e.clientOffset,r=e.availabilityStartTime,n=e.timescale,a=void 0===n?1:n,s=e.duration,o=e.start,l=void 0===o?0:o,u=e.minimumUpdatePeriod,c=void 0===u?0:u,d=e.timeShiftBufferDepth,h=void 0===d?1/0:d,f=(t+i)/1e3,p=r+l,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)}}},Bs=function(e){var t=e.type,i=void 0===t?"static":t,r=e.duration,n=e.timescale,a=void 0===n?1:n,s=e.sourceDuration,o=Us[i](e),l=function(e,t){for(var i=[],r=e;r<t;r++)i.push(r);return i}(o.start,o.end).map(function(e){return function(t,i){var r=e.duration,n=e.timescale,a=void 0===n?1:n,s=e.periodIndex,o=e.startNumber;return{number:(void 0===o?1:o)+t,duration:r/a,timeline:s,time:i*r}}}(e));if("static"===i){var u=l.length-1;l[u].duration=s-r/a*u}return l},Ns=function(e){var t=e.baseUrl,i=e.initialization,r=void 0===i?{}:i,n=e.sourceDuration,a=e.timescale,s=void 0===a?1:a,o=e.indexRange,l=void 0===o?"":o,u=e.duration;if(!t)throw new Error(Rs);var c=Ms({baseUrl:t,source:r.sourceURL,range:r.range}),d=Ms({baseUrl:t,source:t,indexRange:l});if(d.map=c,u){var h=Bs(e);h.length&&(d.duration=h[0].duration,d.timeline=h[0].timeline)}else n&&(d.duration=n/s,d.timeline=0);return d.number=0,[d]},Fs=function(e,t,i){for(var r=e.sidx.map?e.sidx.map:null,n=e.sidx.duration,a=e.timeline||0,s=e.sidx.byterange,o=s.offset+s.length,l=t.timescale,u=t.references.filter(function(e){return 1!==e.referenceType}),c=[],d=o+t.firstOffset,h=0;h<u.length;h++){var f=t.references[h],p=f.referencedSize,m=f.subsegmentDuration,g=Ns({baseUrl:i,timescale:l,timeline:a,periodIndex:a,duration:m,sourceDuration:n,indexRange:d+"-"+(d+p-1)})[0];r&&(g.map=r),c.push(g),d+=p}return e.segments=c,e},js=function(e){var t;return(t=e.reduce(function(e,t){var i,r=t.attributes.id+(t.attributes.lang||"");e[r]?(t.segments[0]&&(t.segments[0].discontinuity=!0),(i=e[r].segments).push.apply(i,t.segments),t.attributes.contentProtection&&(e[r].attributes.contentProtection=t.attributes.contentProtection)):e[r]=t;return e},{}),Object.keys(t).map(function(e){return t[e]})).map(function(e){var t,i;return e.discontinuityStarts=(t=e.segments,i="discontinuity",t.reduce(function(e,t,r){return t[i]&&e.push(r),e},[])),e})},Gs=function(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e){var r=e[i];if(r.sidx){var n=r.sidx.uri+"-"+(s=r.sidx.byterange,void 0,o=s.offset+s.length-1,s.offset+"-"+o),a=t[n]&&t[n].sidx;r.sidx&&a&&Fs(r,a,r.sidx.resolvedUri)}}var s,o;return e},Vs=function(e){var t,i=e.attributes,r=e.segments,n=e.sidx,a={attributes:(t={NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:r,mediaSequence:r.length?r[0].number:1};return i.contentProtection&&(a.contentProtection=i.contentProtection),n&&(a.sidx=n),a},Hs=function(e,t){var i;if(void 0===t&&(t={}),!e.length)return{};var r=e[0].attributes,n=r.sourceDuration,a=r.minimumUpdatePeriod,s=void 0===a?0:a,o=js(e.filter(function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType})).map(Vs),l=js(e.filter(function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio"===t.contentType})),u=e.filter(function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType}),c={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(i={AUDIO:{},VIDEO:{}},i["CLOSED-CAPTIONS"]={},i.SUBTITLES={},i),uri:"",duration:n,playlists:Gs(o,t),minimumUpdatePeriod:1e3*s};return l.length&&(c.mediaGroups.AUDIO.audio=function(e,t){var i;void 0===t&&(t={});var r=e.reduce(function(e,r){var n=r.attributes.role&&r.attributes.role.value||"",a=r.attributes.lang||"",s="main";if(a){var o=n?" ("+n+")":"";s=""+r.attributes.lang+o}return e[s]&&e[s].playlists[0].attributes.BANDWIDTH>r.attributes.bandwidth?e:(e[s]={language:a,autoselect:!0,default:"main"===n,playlists:Gs([function(e){var t,i=e.attributes,r=e.segments,n=e.sidx,a={attributes:(t={NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:r,mediaSequence:r.length?r[0].number:1};return i.contentProtection&&(a.contentProtection=i.contentProtection),n&&(a.sidx=n),a}(r)],t),uri:""},void 0===i&&"main"===n&&((i=r).default=!0),e)},{});i||(r[Object.keys(r)[0]].default=!0);return r}(l,t)),u.length&&(c.mediaGroups.SUBTITLES.subs=function(e,t){return void 0===t&&(t={}),e.reduce(function(e,i){var r,n,a,s,o=i.attributes.lang||"text";return e[o]?e:(e[o]={language:o,default:!1,autoselect:!1,playlists:Gs([(r=i,a=r.attributes,s=r.segments,void 0===s&&(s=[{uri:a.baseUrl,timeline:a.periodIndex,resolvedUri:a.baseUrl||"",duration:a.sourceDuration,number:0}],a.duration=a.sourceDuration),{attributes:(n={NAME:a.id,BANDWIDTH:a.bandwidth},n["PROGRAM-ID"]=1,n),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)},{})}(u,t)),c},Ks=function(e,t,i){var r=e.NOW,n=e.clientOffset,a=e.availabilityStartTime,s=e.timescale,o=void 0===s?1:s,l=e.start,u=void 0===l?0:l,c=e.minimumUpdatePeriod,d=(r+n)/1e3+(void 0===c?0:c)-(a+u);return Math.ceil((d*o-t)/i)},qs=function(e,t){for(var i=e.type,r=void 0===i?"static":i,n=e.minimumUpdatePeriod,a=void 0===n?0:n,s=e.media,o=void 0===s?"":s,l=e.sourceDuration,u=e.timescale,c=void 0===u?1:u,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"===r&&a>0&&o.indexOf("$Number$")>0?Ks(e,m,y):(l*c-m)/y:(t[S].t-m)/y}else T=_+1;for(var E=h+p.length+T,k=h+p.length;k<E;)p.push({number:k,duration:y/c,time:m,timeline:f}),m+=y,k++}return p},Ws=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,zs=function(e,t){return e.replace(Ws,function(e){return function(t,i,r,n){if("$$"===t)return"$";if(void 0===e[i])return t;var a=""+e[i];return"RepresentationID"===i?a:(n=r?parseInt(n,10):1,a.length>=n?a:""+new Array(n-a.length+1).join("0")+a)}}(t))},Ys=function(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},r=e.initialization,n=void 0===r?{sourceURL:"",range:""}:r,a=Ms({baseUrl:e.baseUrl,source:zs(n.sourceURL,i),range:n.range});return function(e,t){return e.duration||t?e.duration?Bs(e):qs(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}(e,t).map(function(t){i.Number=t.number,i.Time=t.time;var r=zs(e.media||"",i);return{uri:r,timeline:t.timeline,duration:t.duration,resolvedUri:Os(e.baseUrl||"",r),map:a,number:t.number}})},Xs=function(e,t){var i=e.duration,r=e.segmentUrls,n=void 0===r?[]:r;if(!i&&!t||i&&t)throw new Error(Ps);var a,s=n.map(function(t){return function(e,t){var i=e.baseUrl,r=e.initialization,n=void 0===r?{}:r,a=Ms({baseUrl:i,source:n.sourceURL,range:n.range}),s=Ms({baseUrl:i,source:t.media,range:t.mediaRange});return s.map=a,s}(e,t)});return i&&(a=Bs(e)),t&&(a=qs(e,t)),a.map(function(e,t){if(s[t]){var i=s[t];return i.timeline=e.timeline,i.duration=e.duration,i.number=e.number,i}}).filter(function(e){return e})},$s=function(e){var t,i,r=e.attributes,n=e.segmentInfo;n.template?(i=Ys,t=Es(r,n.template)):n.base?(i=Ns,t=Es(r,n.base)):n.list&&(i=Xs,t=Es(r,n.list));var a={attributes:r};if(!i)return a;var s=i(t,n.timeline);if(t.duration){var o=t,l=o.duration,u=o.timescale,c=void 0===u?1:u;t.duration=l/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,n.base&&t.indexRange&&(a.sidx=s[0],a.segments=[]),a},Qs=function(e,t){return ws(e.childNodes).filter(function(e){return e.tagName===t})},Js=function(e){return e.textContent.trim()},Zs=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var i=t.slice(1),r=i[0],n=i[1],a=i[2],s=i[3],o=i[4],l=i[5];return 31536e3*parseFloat(r||0)+2592e3*parseFloat(n||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(l||0)},eo={mediaPresentationDuration:function(e){return Zs(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return Zs(e)},timeShiftBufferDepth:function(e){return Zs(e)},start:function(e){return Zs(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?Zs(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},to=function(e){return e&&e.attributes?ws(e.attributes).reduce(function(e,t){var i=eo[t.name]||eo.DEFAULT;return e[t.name]=i(t.value),e},{}):{}};var io,ro,no,ao,so,oo,lo,uo,co,ho,fo,po,mo,go,vo,yo,_o,bo,To,So,Eo,ko,wo,Co,Lo,Ao,Ro,Po,Do,Io,xo,Oo,Mo,Uo,Bo,No,Fo,jo,Go,Vo,Ho,Ko,qo,Wo,zo={"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"},Yo=function(e,t){return t.length?ks(e.map(function(e){return t.map(function(t){return Os(e,Js(t))})})):e},Xo=function(e){var t=Qs(e,"SegmentTemplate")[0],i=Qs(e,"SegmentList")[0],r=i&&Qs(i,"SegmentURL").map(function(e){return Es({tag:"SegmentURL"},to(e))}),n=Qs(e,"SegmentBase")[0],a=i||t,s=a&&Qs(a,"SegmentTimeline")[0],o=i||n||t,l=o&&Qs(o,"Initialization")[0],u=t&&to(t);u&&l?u.initialization=l&&to(l):u&&u.initialization&&(u.initialization={sourceURL:u.initialization});var c={template:u,timeline:s&&Qs(s,"S").map(function(e){return to(e)}),list:i&&Es(to(i),{segmentUrls:r,initialization:to(l)}),base:n&&Es(to(n),{initialization:to(l)})};return Object.keys(c).forEach(function(e){c[e]||delete c[e]}),c},$o=function(t){return t.reduce(function(t,i){var r=to(i),n=zo[r.schemeIdUri];if(n){t[n]={attributes:r};var a=Qs(i,"cenc:pssh")[0];if(a){var s=Js(a),o=s&&function(t){for(var i=e.atob(t),r=new Uint8Array(i.length),n=0;n<i.length;n++)r[n]=i.charCodeAt(n);return r}(s);t[n].pssh=o}}return t},{})},Qo=function(e,t,i){return function(r){var n=to(r),a=Yo(t,Qs(r,"BaseURL")),s=Qs(r,"Role")[0],o={role:to(s)},l=Es(e,n,o),u=$o(Qs(r,"ContentProtection"));Object.keys(u).length&&(l=Es(l,{contentProtection:u}));var c=Xo(r),d=Qs(r,"Representation"),h=Es(i,c);return ks(d.map(function(e,t,i){return function(r){var n=Qs(r,"BaseURL"),a=Yo(t,n),s=Es(e,to(r)),o=Xo(r);return a.map(function(e){return{segmentInfo:Es(i,o),attributes:Es(s,{baseUrl:e})}})}}(l,a,h)))}},Jo=function(t,i){void 0===i&&(i={});var r=i,n=r.manifestUri,a=void 0===n?"":n,s=r.NOW,o=void 0===s?Date.now():s,l=r.clientOffset,u=void 0===l?0:l,c=Qs(t,"Period");if(!c.length)throw new Error(Cs);var d=to(t),h=Yo([a],Qs(t,"BaseURL"));return d.sourceDuration=d.mediaPresentationDuration||0,d.NOW=o,d.clientOffset=u,ks(c.map(function(t,i){return function(r,n){var a=Yo(i,Qs(r,"BaseURL")),s=to(r),o=parseInt(s.id,10),l=e.isNaN(o)?n:o,u=Es(t,{periodIndex:l}),c=Qs(r,"AdaptationSet"),d=Xo(r);return ks(c.map(Qo(u,a,d)))}}(d,h)))},Zo=function(t){if(""===t)throw new Error(Ls);var i=(new e.DOMParser).parseFromString(t,"application/xml"),r=i&&"MPD"===i.documentElement.tagName?i.documentElement:null;if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error(As);return r},el=function(e,t){return void 0===t&&(t={}),Hs(Jo(Zo(e),t).map($s),t.sidxMapping)},tl=function(e){return function(e){var t=Qs(e,"UTCTiming")[0];if(!t)return null;var i=to(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Ds)}return i}(Zo(e))},il=function(e){return e>>>0},rl={findBox:io=function(e,t){var i,r,n,a,s,o=[];if(!t.length)return null;for(i=0;i<e.byteLength;)r=il(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]),n=ro(e.subarray(i+4,i+8)),a=r>1?i+r:e.byteLength,n===t[0]&&(1===t.length?o.push(e.subarray(i+8,a)):(s=io(e.subarray(i+8,a),t.slice(1))).length&&(o=o.concat(s))),i=a;return o},parseType:ro=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},timescale:function(e){return io(e,["moov","trak"]).reduce(function(e,t){var i,r,n,a,s;return(i=io(t,["tkhd"])[0])?(r=i[0],a=il(i[n=0===r?12:20]<<24|i[n+1]<<16|i[n+2]<<8|i[n+3]),(s=io(t,["mdia","mdhd"])[0])?(n=0===(r=s[0])?12:20,e[a]=il(s[n]<<24|s[n+1]<<16|s[n+2]<<8|s[n+3]),e):null):null},{})},startTime:function(e,t){var i,r,n;return i=io(t,["moof","traf"]),r=[].concat.apply([],i.map(function(t){return io(t,["tfhd"]).map(function(i){var r,n;return r=il(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),n=e[r]||9e4,(io(t,["tfdt"]).map(function(e){var t,i;return t=e[0],i=il(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(i*=Math.pow(2,32),i+=il(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),i})[0]||1/0)/n})})),n=Math.min.apply(null,r),isFinite(n)?n:0},videoTrackIds:function(e){var t=[];return io(e,["moov","trak"]).forEach(function(e){var i=io(e,["mdia","hdlr"]),r=io(e,["tkhd"]);i.forEach(function(e,i){var n,a,s=ro(e.subarray(8,12)),o=r[i];"vide"===s&&(a=0===(n=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?n.getUint32(12):n.getUint32(20),t.push(a))})}),t}},nl=rl.parseType,al=function(e){return new Date(1e3*e-20828448e5)},sl=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]}},ol={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:no(e.subarray(78,e.byteLength))}},avcC:function(e){var t,i,r,n,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(r=6,n=0;n<o;n++)i=a.getUint16(r),r+=2,s.sps.push(new Uint8Array(e.subarray(r,r+i))),r+=i;for(t=e[r],r++,n=0;n<t;n++)i=a.getUint16(r),r+=2,s.pps.push(new Uint8Array(e.subarray(r,r+i))),r+=i;return s},btrt:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},esds:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),esId:e[6]<<8|e[7],streamPriority:31&e[8],decoderConfig:{objectProfileIndication:e[11],streamType:e[12]>>>2&63,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:e[26]>>>3&31,samplingFrequencyIndex:(7&e[26])<<1|e[27]>>>7&1,channelConfiguration:e[27]>>>3&15}}}},ftyp:function(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={majorBrand:nl(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},r=8;r<e.byteLength;)i.compatibleBrands.push(nl(e.subarray(r,r+4))),r+=4;return i},dinf:function(e){return{boxes:no(e)}},dref:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),dataReferences:no(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:nl(e.subarray(8,12)),name:""},i=8;for(i=24;i<e.byteLength;i++){if(0===e[i]){i++;break}t.name+=String.fromCharCode(e[i])}return t.name=decodeURIComponent(escape(t.name)),t},mdat:function(e){return{byteLength:e.byteLength,nals:function(e){var t,i,r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=[];for(t=0;t+4<e.length;t+=i)if(i=r.getUint32(t),t+=4,i<=0)n.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&e[t]){case 1:n.push("slice_layer_without_partitioning_rbsp");break;case 5:n.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:n.push("sei_rbsp");break;case 7:n.push("seq_parameter_set_rbsp");break;case 8:n.push("pic_parameter_set_rbsp");break;case 9:n.push("access_unit_delimiter_rbsp");break;default:n.push("UNKNOWN NAL - "+e[t]&31)}return n}(e)}},mdhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=4,n={version:i.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};return 1===n.version?(r+=4,n.creationTime=al(i.getUint32(r)),r+=8,n.modificationTime=al(i.getUint32(r)),r+=4,n.timescale=i.getUint32(r),r+=8,n.duration=i.getUint32(r)):(n.creationTime=al(i.getUint32(r)),r+=4,n.modificationTime=al(i.getUint32(r)),r+=4,n.timescale=i.getUint32(r),r+=4,n.duration=i.getUint32(r)),r+=4,t=i.getUint16(r),n.language+=String.fromCharCode(96+(t>>10)),n.language+=String.fromCharCode(96+((992&t)>>5)),n.language+=String.fromCharCode(96+(31&t)),n},mdia:function(e){return{boxes:no(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:no(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(i.streamDescriptor=no(e.subarray(28))[0]),i},moof:function(e){return{boxes:no(e)}},moov:function(e){return{boxes:no(e)}},mvex:function(e){return{boxes:no(e)}},mvhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,r={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===r.version?(i+=4,r.creationTime=al(t.getUint32(i)),i+=8,r.modificationTime=al(t.getUint32(i)),i+=4,r.timescale=t.getUint32(i),i+=8,r.duration=t.getUint32(i)):(r.creationTime=al(t.getUint32(i)),i+=4,r.modificationTime=al(t.getUint32(i)),i+=4,r.timescale=t.getUint32(i),i+=4,r.duration=t.getUint32(i)),i+=4,r.rate=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,r.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,i+=8,r.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,i+=24,r.nextTrackId=t.getUint32(i),r},pdin:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t<e.byteLength;t++)i.samples.push({dependsOn:(48&e[t])>>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return i},sidx:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},n=i.getUint16(22);for(t=24;n;t+=12,n--)r.references.push({referenceType:(128&e[t])>>>7,referencedSize:2147483647&i.getUint32(t),subsegmentDuration:i.getUint32(t+4),startsWithSap:!!(128&e[t+8]),sapType:(112&e[t+8])>>>4,sapDeltaTime:268435455&i.getUint32(t+8)});return r},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:no(e)}},stco:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},n=i.getUint32(4);for(t=8;n;t+=4,n--)r.chunkOffsets.push(i.getUint32(t));return r},stsc:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=i.getUint32(4),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;r;t+=12,r--)n.sampleToChunks.push({firstChunk:i.getUint32(t),samplesPerChunk:i.getUint32(t+4),sampleDescriptionIndex:i.getUint32(t+8)});return n},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:no(e.subarray(8))}},stsz:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(t=12;t<e.byteLength;t+=4)r.entries.push(i.getUint32(t));return r},stts:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},n=i.getUint32(4);for(t=8;n;t+=8,n--)r.timeToSamples.push({sampleCount:i.getUint32(t),sampleDelta:i.getUint32(t+4)});return r},styp:function(e){return ol.ftyp(e)},tfdt:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:e[4]<<24|e[5]<<16|e[6]<<8|e[7]};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=e[8]<<24|e[9]<<16|e[10]<<8|e[11]),t},tfhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},n=1&r.flags[2],a=2&r.flags[2],s=8&r.flags[2],o=16&r.flags[2],l=32&r.flags[2],u=65536&r.flags[0],c=131072&r.flags[0];return t=8,n&&(t+=4,r.baseDataOffset=i.getUint32(12),t+=4),a&&(r.sampleDescriptionIndex=i.getUint32(t),t+=4),s&&(r.defaultSampleDuration=i.getUint32(t),t+=4),o&&(r.defaultSampleSize=i.getUint32(t),t+=4),l&&(r.defaultSampleFlags=i.getUint32(t)),u&&(r.durationIsEmpty=!0),!n&&c&&(r.baseDataOffsetIsMoof=!0),r},tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,r={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===r.version?(i+=4,r.creationTime=al(t.getUint32(i)),i+=8,r.modificationTime=al(t.getUint32(i)),i+=4,r.trackId=t.getUint32(i),i+=4,i+=8,r.duration=t.getUint32(i)):(r.creationTime=al(t.getUint32(i)),i+=4,r.modificationTime=al(t.getUint32(i)),i+=4,r.trackId=t.getUint32(i),i+=4,i+=4,r.duration=t.getUint32(i)),i+=4,i+=8,r.layer=t.getUint16(i),i+=2,r.alternateGroup=t.getUint16(i),i+=2,r.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,r.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,r.width=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,r.height=t.getUint16(i)+t.getUint16(i+2)/16,r},traf:function(e){return{boxes:no(e)}},trak:function(e){return{boxes:no(e)}},trex:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:3&e[20],sampleIsDependedOn:(192&e[21])>>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],l=4&i.flags[1],u=8&i.flags[1],c=r.getUint32(4),d=8;for(n&&(i.dataOffset=r.getInt32(d),d+=4),a&&c&&(t={flags:sl(e.subarray(d,d+4))},d+=4,s&&(t.duration=r.getUint32(d),d+=4),o&&(t.size=r.getUint32(d),d+=4),u&&(t.compositionTimeOffset=r.getUint32(d),d+=4),i.samples.push(t),c--);c--;)t={},s&&(t.duration=r.getUint32(d),d+=4),o&&(t.size=r.getUint32(d),d+=4),l&&(t.flags=sl(e.subarray(d,d+4)),d+=4),u&&(t.compositionTimeOffset=r.getUint32(d),d+=4),i.samples.push(t);return i},"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}},ll={inspect:no=function(e){for(var t,i,r,n,a,s=0,o=[],l=new ArrayBuffer(e.length),u=new Uint8Array(l),c=0;c<e.length;++c)u[c]=e[c];for(t=new DataView(l);s<e.byteLength;)i=t.getUint32(s),r=nl(e.subarray(s+4,s+8)),n=i>1?s+i:e.byteLength,(a=(ol[r]||function(e){return{data:e}})(e.subarray(s+8,n))).size=i,a.type=r,o.push(a),s=n;return o},textify:ao=function(e,t){var i;return t=t||0,i=new Array(2*t+1).join(" "),e.map(function(e,r){return i+e.type+"\n"+Object.keys(e).filter(function(e){return"type"!==e&&"boxes"!==e}).map(function(t){var r=i+" "+t+": ",n=e[t];if(n instanceof Uint8Array||n instanceof Uint32Array){var a=Array.prototype.slice.call(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)).map(function(e){return" "+("00"+e.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return a?1===a.length?r+"<"+a.join("").slice(1)+">":r+"<\n"+a.map(function(e){return i+" "+e}).join("\n")+"\n"+i+" >":r+"<>"}return r+JSON.stringify(n,null,2).split("\n").map(function(e,t){return 0===t?e:i+" "+e}).join("\n")}).join("\n")+(e.boxes?"\n"+ao(e.boxes,t+1):"")}).join("\n")},parseTfdt:ol.tfdt,parseHdlr:ol.hdlr,parseTfhd:ol.tfhd,parseTrun:ol.trun,parseSidx:ol.sidx},ul=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)]),Do=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),Po=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]),Oo={video:Io,audio:xo},Bo=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]),No=new Uint8Array([0,0,0,0,0,0,0,0]),Fo=No,jo=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Go=No,Mo=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),so=function(e){var t,i,r=[],n=0;for(t=1;t<arguments.length;t++)r.push(arguments[t]);for(t=r.length;t--;)n+=r[t].byteLength;for(i=new Uint8Array(n+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,n=8;t<r.length;t++)i.set(r[t],n),n+=r[t].byteLength;return i},oo=function(){return so(Ao.dinf,so(Ao.dref,Bo))},lo=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,Oo[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(),Eo(e))},fo=function(e,t){for(var i=[],r=t.length;r--;)i[r]=wo(t[r]);return so.apply(null,[Ao.moof,co(e)].concat(i))},po=function(e){for(var t=e.length,i=[];t--;)i[t]=vo(e[t]);return so.apply(null,[Ao.moov,go(4294967295)].concat(i).concat(mo(e)))},mo=function(e){for(var t=e.length,i=[];t--;)i[t]=Co(e[t]);return so.apply(null,[Ao.mvex].concat(i))},go=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return so(Ao.mvhd,t)},So=function(e){var t,i,r=e.samples||[],n=new Uint8Array(4+r.length);for(i=0;i<r.length;i++)t=r[i].flags,n[i+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return so(Ao.sdtp,n)},Eo=function(e){return so(Ao.stbl,ko(e),so(Ao.stts,Go),so(Ao.stsc,Fo),so(Ao.stsz,jo),so(Ao.stco,No))},ko=function(e){return so(Ao.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?Vo(e):Ho(e))},Vo=function(e){var t,i=e.sps||[],r=e.pps||[],n=[],a=[];for(t=0;t<i.length;t++)n.push((65280&i[t].byteLength)>>>8),n.push(255&i[t].byteLength),n=n.concat(Array.prototype.slice.call(i[t]));for(t=0;t<r.length;t++)a.push((65280&r[t].byteLength)>>>8),a.push(255&r[t].byteLength),a=a.concat(Array.prototype.slice.call(r[t]));return so(Ao.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),so(Ao.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([i.length]).concat(n).concat([r.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]),lo(e))},yo=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return so(Ao.tkhd,t)},wo=function(e){var t,i,r,n,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/(ul+1)),s=Math.floor(e.baseMediaDecodeTime%(ul+1)),i=so(Ao.tfdt,new Uint8Array([1,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s])),92,"audio"===e.type?(r=Lo(e,92),so(Ao.traf,t,i,r)):(n=So(e),r=Lo(e,n.length+92),so(Ao.traf,t,i,r,n))},vo=function(e){return e.duration=e.duration||4294967295,so(Ao.trak,yo(e),_o(e))},Co=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),so(Ao.trex,t)},Wo=function(e,t){var i=0,r=0,n=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(r=2),void 0!==e[0].flags&&(n=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|r|n|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},qo=function(e,t){var i,r,n,a;for(t+=20+16*(r=e.samples||[]).length,i=Wo(r,t),a=0;a<r.length;a++)n=r[a],i=i.concat([(4278190080&n.duration)>>>24,(16711680&n.duration)>>>16,(65280&n.duration)>>>8,255&n.duration,(4278190080&n.size)>>>24,(16711680&n.size)>>>16,(65280&n.size)>>>8,255&n.size,n.flags.isLeading<<2|n.flags.dependsOn,n.flags.isDependedOn<<6|n.flags.hasRedundancy<<4|n.flags.paddingValue<<1|n.flags.isNonSyncSample,61440&n.flags.degradationPriority,15&n.flags.degradationPriority,(4278190080&n.compositionTimeOffset)>>>24,(16711680&n.compositionTimeOffset)>>>16,(65280&n.compositionTimeOffset)>>>8,255&n.compositionTimeOffset]);return so(Ao.trun,new Uint8Array(i))},Ko=function(e,t){var i,r,n,a;for(t+=20+8*(r=e.samples||[]).length,i=Wo(r,t),a=0;a<r.length;a++)n=r[a],i=i.concat([(4278190080&n.duration)>>>24,(16711680&n.duration)>>>16,(65280&n.duration)>>>8,255&n.duration,(4278190080&n.size)>>>24,(16711680&n.size)>>>16,(65280&n.size)>>>8,255&n.size]);return so(Ao.trun,new Uint8Array(i))},Lo=function(e,t){return"audio"===e.type?Ko(e,t):qo(e,t)};var cl={ftyp:uo=function(){return so(Ao.ftyp,Ro,Po,Ro,Do)},mdat:function(e){return so(Ao.mdat,e)},moof:fo,moov:po,initSegment:function(e){var t,i=uo(),r=po(e);return(t=new Uint8Array(i.byteLength+r.byteLength)).set(i),t.set(r,i.byteLength),t}},dl=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var r;return!!e[t]&&(r=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(r,1),r>-1)},this.trigger=function(t){var i,r,n,a;if(i=e[t])if(2===arguments.length)for(n=i.length,r=0;r<n;++r)i[r].call(this,arguments[1]);else{for(a=[],r=arguments.length,r=1;r<arguments.length;++r)a.push(arguments[r]);for(n=i.length,r=0;r<n;++r)i[r].apply(this,a)}},this.dispose=function(){e={}}}};dl.prototype.pipe=function(e){return this.on("data",function(t){e.push(t)}),this.on("done",function(t){e.flush(t)}),e},dl.prototype.push=function(e){this.trigger("data",e)},dl.prototype.flush=function(e){this.trigger("done",e)};var hl,fl,pl,ml,gl,vl=dl,yl=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},_l=function(e){var t,i,r=[],n=[];for(r.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(r.length&&(r.duration=i.dts-r.dts,n.push(r)),(r=[i]).byteLength=i.data.byteLength,r.pts=i.pts,r.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(r.keyFrame=!0),r.duration=i.dts-r.dts,r.byteLength+=i.data.byteLength,r.push(i));return n.length&&(!r.duration||r.duration<=0)&&(r.duration=n[n.length-1].duration),n.push(r),n},bl=function(e){var t,i,r=[],n=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(r.length&&(n.push(r),n.byteLength+=r.byteLength,n.nalCount+=r.nalCount,n.duration+=r.duration),(r=[i]).nalCount=i.length,r.byteLength=i.byteLength,r.pts=i.pts,r.dts=i.dts,r.duration=i.duration):(r.duration+=i.duration,r.nalCount+=i.length,r.byteLength+=i.byteLength,r.push(i));return n.length&&r.duration<=0&&(r.duration=n[n.length-1].duration),n.byteLength+=r.byteLength,n.nalCount+=r.nalCount,n.duration+=r.duration,n.push(r),n},Tl=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},Sl=function(e,t){var i,r,n,a,s,o=t||0,l=[];for(i=0;i<e.length;i++)for(a=e[i],r=0;r<a.length;r++)s=a[r],o+=(n=yl(s,o)).size,l.push(n);return l},El=function(e){var t,i,r,n,a,s,o=0,l=e.byteLength,u=e.nalCount,c=new Uint8Array(l+4*u),d=new DataView(c.buffer);for(t=0;t<e.length;t++)for(n=e[t],i=0;i<n.length;i++)for(a=n[i],r=0;r<a.length;r++)s=a[r],d.setUint32(o,s.data.byteLength),o+=4,c.set(s.data,o),o+=s.data.byteLength;return c},kl=[33,16,5,32,164,27],wl=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Cl=function(e){for(var t=[];e--;)t.push(0);return t},Ll={96000:[kl,[227,64],Cl(154),[56]],88200:[kl,[231],Cl(170),[56]],64000:[kl,[248,192],Cl(240),[56]],48000:[kl,[255,192],Cl(268),[55,148,128],Cl(54),[112]],44100:[kl,[255,192],Cl(268),[55,163,128],Cl(84),[112]],32000:[kl,[255,192],Cl(268),[55,234],Cl(226),[112]],24000:[kl,[255,192],Cl(268),[55,255,128],Cl(268),[111,112],Cl(126),[224]],16000:[kl,[255,192],Cl(268),[55,255,128],Cl(268),[111,255],Cl(269),[223,108],Cl(195),[1,192]],12000:[wl,Cl(268),[3,127,248],Cl(268),[6,255,240],Cl(268),[13,255,224],Cl(268),[27,253,128],Cl(259),[56]],11025:[wl,Cl(268),[3,127,248],Cl(268),[6,255,240],Cl(268),[13,255,224],Cl(268),[27,255,192],Cl(268),[55,175,128],Cl(108),[112]],8000:[wl,Cl(268),[3,121,16],Cl(47),[7]]},Al=(hl=Ll,Object.keys(hl).reduce(function(e,t){return e[t]=new Uint8Array(hl[t].reduce(function(e,t){return e.concat(t)},[])),e},{})),Rl=(fl=function(e){return 9e4*e},pl=function(e,t){return e*t},ml=function(e){return e/9e4},gl=function(e,t){return e/t},function(e,t){return fl(gl(e,t))}),Pl=function(e,t){return pl(ml(e),t)},Dl=function(e,t,i,r){var n,a,s,o,l=0,u=0,c=0;if(t.length&&(n=Rl(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(9e4/(e.samplerate/1024)),i&&r&&(l=n-Math.max(i,r),c=(u=Math.floor(l/a))*a),!(u<1||c>45e3))){for((s=Al[e.samplerate])||(s=t[0].data),o=0;o<u;o++)t.splice(o,0,{data:s});e.baseMediaDecodeTime-=Math.floor(Pl(c,e.samplerate))}},Il=function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},xl=function(e){var t,i,r=[];for(t=0;t<e.length;t++)i=e[t],r.push({size:i.data.byteLength,duration:1024});return r},Ol=function(e){var t,i,r=0,n=new Uint8Array(function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i}(e));for(t=0;t<e.length;t++)i=e[t],n.set(i.data,r),r+=i.data.byteLength;return n},Ml=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},Ul=function(e,t){var i,r=e.minSegmentDts;return t||(r-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=r,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/9e4,i=Math.floor(i)),i},Bl=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))},Nl=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},r=0,n=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)r+=255,t++;for(r+=e[t++];255===e[t];)n+=255,t++;if(n+=e[t++],!i.payload&&4===r){i.payloadType=r,i.payloadSize=n,i.payload=e.subarray(t,t+n);break}t+=n,r=0,n=0}return i},Fl=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)},jl=function(e,t){var i,r,n,a,s=[];if(!(64&t[0]))return s;for(r=31&t[0],i=0;i<r;i++)a={type:3&t[2+(n=3*i)],pts:e},4&t[n+2]&&(a.ccData=t[n+3]<<8|t[n+4],s.push(a));return s},Gl=function(e){for(var t,i,r=e.byteLength,n=[],a=1;a<r-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(n.push(a+2),a+=2):a++;if(0===n.length)return e;t=r-n.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===n[0]&&(s++,n.shift()),i[a]=e[s];return i},Vl=4,Hl=function e(){e.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new Yl(0,0),new Yl(0,1),new Yl(1,0),new Yl(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)};(Hl.prototype=new vl).push=function(e){var t,i,r;if("sei_rbsp"===e.nalUnitType&&(t=Nl(e.escapedRBSP)).payloadType===Vl&&(i=Fl(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));r=jl(e.pts,i),this.captionPackets_=this.captionPackets_.concat(r),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Hl.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)},Hl.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(e){e.reset()})},Hl.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)},Hl.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Hl.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Hl.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var Kl={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},ql=function(e){return null===e?"":(e=Kl[e]||e,String.fromCharCode(e))},Wl=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],zl=function(){for(var e=[],t=15;t--;)e.push("");return e},Yl=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,r,n,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),r=t>>>8,n=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=zl();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=zl();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=zl()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(r,n))a=ql((r=(3&r)<<8)|n),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(r,n))"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=ql((r=(3&r)<<8)|n),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(r,n))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&n)&&this.addFormatting(e.pts,["i"]),1==(1&n)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(r,n))this.column_+=3&n;else if(this.isPAC(r,n)){var s=Wl.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&n&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(n)&&14==(14&n)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(r)&&(0===n&&(n=null),a=ql(r),a+=ql(n),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Yl.prototype=new vl,Yl.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_})},Yl.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=zl(),this.nonDisplayed_=zl(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Yl.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_},Yl.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Yl.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Yl.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Yl.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Yl.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},Yl.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Yl.prototype.isNormalChar=function(e){return e>=32&&e<=127},Yl.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=zl(),this.displayed_=zl()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},Yl.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce(function(e,t){return e+"<"+t+">"},"");this[this.mode_](e,i)},Yl.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)}},Yl.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Yl.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Yl.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_]=""},Yl.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var Xl={CaptionStream:Hl,Cea608Stream:Yl},$l={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ql=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},Jl=function e(t){var i,r;e.prototype.init.call(this),this.type_=t,this.push=function(e){e.type===this.type_&&(void 0===r&&(r=e.dts),e.dts=Ql(e.dts,r),e.pts=Ql(e.pts,r),i=e.dts,this.trigger("data",e))},this.flush=function(){r=i,this.trigger("done")},this.discontinuity=function(){r=void 0,i=void 0}};Jl.prototype=new vl;var Zl,eu=Jl,tu=Ql,iu=function(e,t,i){var r,n="";for(r=t;r<i;r++)n+="%"+("00"+e[r].toString(16)).slice(-2);return n},ru=function(e,t,i){return decodeURIComponent(iu(e,t,i))},nu=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},au={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=ru(e.data,1,t),e.value=ru(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=ru(e.data,1,t),e.url=ru(e.data,t+1,e.data.length);break}},PRIV:function(e){var t,i;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(i=e.data,unescape(iu(i,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Zl=function(e){var t,i={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},r=0,n=[],a=0;if(Zl.prototype.init.call(this),this.dispatchType=$l.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,s,o,l,u;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(a=0,n.length=0),0===n.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))i.debug&&console.log("Skipping unrecognized metadata packet");else if(n.push(e),a+=e.data.byteLength,1===n.length&&(r=nu(e.data.subarray(6,10)),r+=10),!(a<r)){for(t={data:new Uint8Array(r),frames:[],pts:n[0].pts,dts:n[0].dts},u=0;u<r;)t.data.set(n[0].data.subarray(0,r-u),u),u+=n[0].data.byteLength,a-=n[0].data.byteLength,n.shift();s=10,64&t.data[5]&&(s+=4,s+=nu(t.data.subarray(10,14)),r-=nu(t.data.subarray(16,20)));do{if((o=nu(t.data.subarray(s+4,s+8)))<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");if((l={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=l.id,au[l.id]&&(au[l.id](l),"com.apple.streaming.transportStreamTimestamp"===l.owner)){var c=l.data,d=(1&c[3])<<30|c[4]<<22|c[5]<<14|c[6]<<6|c[7]>>>2;d*=4,d+=3&c[7],l.timeStamp=d,void 0===t.pts&&void 0===t.dts&&(t.pts=l.timeStamp,t.dts=l.timeStamp),this.trigger("timestamp",l)}t.frames.push(l),s+=10,s+=o}while(s<r);this.trigger("data",t)}}}).prototype=new vl;var su,ou,lu,uu=Zl,cu=eu;(su=function(){var e=new Uint8Array(188),t=0;su.prototype.init.call(this),this.push=function(i){var r,n=0,a=188;for(t?((r=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),r.set(i,t),t=0):r=i;a<r.byteLength;)71!==r[n]||71!==r[a]?(n++,a++):(this.trigger("data",r.subarray(n,a)),n+=188,a+=188);n<r.byteLength&&(e.set(r.subarray(n),0),t=r.byteLength-n)},this.flush=function(){188===t&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")}}).prototype=new vl,(ou=function(){var e,t,i,r;ou.prototype.init.call(this),r=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,r){var n=0;r.payloadUnitStartIndicator&&(n+=e[n]+1),"pat"===r.type?t(e.subarray(n),r):i(e.subarray(n),r)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],r.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=r.pmtPid},i=function(e,t){var i,n;if(1&e[5]){for(r.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,n=12+((15&e[10])<<8|e[11]);n<i;){var a=e[n],s=(31&e[n+1])<<8|e[n+2];a===$l.H264_STREAM_TYPE&&null===r.programMapTable.video?r.programMapTable.video=s:a===$l.ADTS_STREAM_TYPE&&null===r.programMapTable.audio?r.programMapTable.audio=s:a===$l.METADATA_STREAM_TYPE&&(r.programMapTable["timed-metadata"][s]=a),n+=5+((15&e[n+3])<<8|e[n+4])}t.programMapTable=r.programMapTable}},this.push=function(t){var i={},r=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(r+=t[r]+1),0===i.pid)i.type="pat",e(t.subarray(r),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(r),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,r,i]):this.processPes_(t,r,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=$l.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=$l.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new vl,ou.STREAM_TYPES={h264:27,adts:15},(lu=function(){var e=this,t={data:[],size:0},i={data:[],size:0},r={data:[],size:0},n=function(t,i,r){var n,a,s=new Uint8Array(t.size),o={type:i},l=0,u=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,l=0;l<t.data.length;l++)a=t.data[l],s.set(a.data,u),u+=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]),n="video"===i||o.packetLength<=t.size,(r||n)&&(t.size=0,t.data.length=0),n&&e.trigger("data",o)}};lu.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var e,s;switch(a.streamType){case $l.H264_STREAM_TYPE:case $l.H264_STREAM_TYPE:e=t,s="video";break;case $l.ADTS_STREAM_TYPE:e=i,s="audio";break;case $l.METADATA_STREAM_TYPE:e=r,s="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&n(e,s,!0),e.data.push(a),e.size+=a.data.byteLength},pmt:function(){var t={type:"metadata",tracks:[]},i=a.programMapTable;null!==i.video&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+i.video,codec:"avc",type:"video"}),null!==i.audio&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+i.audio,codec:"adts",type:"audio"}),e.trigger("data",t)}})[a.type]()},this.flush=function(){n(t,"video"),n(i,"audio"),n(r,"timed-metadata"),this.trigger("done")}}).prototype=new vl;var du={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:su,TransportParseStream:ou,ElementaryStream:lu,TimestampRolloverStream:cu,CaptionStream:Xl.CaptionStream,Cea608Stream:Xl.Cea608Stream,MetadataStream:uu};for(var hu in $l)$l.hasOwnProperty(hu)&&(du[hu]=$l[hu]);var fu,pu=du,mu=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(fu=function(){var e;fu.prototype.init.call(this),this.push=function(t){var i,r,n,a,s,o,l=0,u=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;l+5<e.length;)if(255===e[l]&&240==(246&e[l+1])){if(r=2*(1&~e[l+1]),i=(3&e[l+3])<<11|e[l+4]<<3|(224&e[l+5])>>5,o=9e4*(s=1024*(1+(3&e[l+6])))/mu[(60&e[l+2])>>>2],n=l+i,e.byteLength<n)return;if(this.trigger("data",{pts:t.pts+u*o,dts:t.dts+u*o,sampleCount:s,audioobjecttype:1+(e[l+2]>>>6&3),channelcount:(1&e[l+2])<<2|(192&e[l+3])>>>6,samplerate:mu[(60&e[l+2])>>>2],samplingfrequencyindex:(60&e[l+2])>>>2,samplesize:16,data:e.subarray(l+7+r,n)}),e.byteLength===n)return void(e=void 0);u++,e=e.subarray(n)}else l++},this.flush=function(){this.trigger("done")}}).prototype=new vl;var gu,vu,yu,_u=fu,bu=function(e){var t=e.byteLength,i=0,r=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+r},this.loadWord=function(){var n=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(n,n+s)),i=new DataView(a.buffer).getUint32(0),r=8*s,t-=s},this.skipBits=function(e){var n;r>e?(i<<=e,r-=e):(e-=r,e-=8*(n=Math.floor(e/8)),t-=n,this.loadWord(),i<<=e,r-=e)},this.readBits=function(e){var n=Math.min(r,e),a=i>>>32-n;return(r-=n)>0?i<<=n:t>0&&this.loadWord(),(n=e-n)>0?a<<n|this.readBits(n):a},this.skipLeadingZeros=function(){var e;for(e=0;e<r;++e)if(0!=(i&2147483648>>>e))return i<<=e,r-=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()};(vu=function(){var e,t,i=0;vu.prototype.init.call(this),this.push=function(r){var n;for(t?((n=new Uint8Array(t.byteLength+r.data.byteLength)).set(t),n.set(r.data,t.byteLength),t=n):t=r.data;i<t.byteLength-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<t.byteLength;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<t.length);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")}}).prototype=new vl,yu={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(gu=function(){var e,t,i,r,n,a,s,o=new vu;gu.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,r=e.dts,o.push(e))},o.on("data",function(s){var o={trackId:t,pts:i,dts:r,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=n(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=n(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)}),o.on("done",function(){e.trigger("done")}),this.flush=function(){o.flush()},s=function(e,t){var i,r=8,n=8;for(i=0;i<e;i++)0!==n&&(n=(r+t.readExpGolomb()+256)%256),r=0===n?r:n},n=function(e){for(var t,i,r=e.byteLength,n=[],a=1;a<r-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(n.push(a+2),a+=2):a++;if(0===n.length)return e;t=r-n.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===n[0]&&(s++,n.shift()),i[a]=e[s];return i},a=function(e){var t,i,r,n,a,o,l,u,c,d,h,f,p,m=0,g=0,v=0,y=0,_=1;if(i=(t=new bu(e)).readUnsignedByte(),n=t.readUnsignedByte(),r=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),yu[i]&&(3===(a=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(h=3!==a?8:12,p=0;p<h;p++)t.readBoolean()&&s(p<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),l=t.readUnsignedExpGolomb(),p=0;p<l;p++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),u=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),0===(d=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb(),y=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:f=[1,1];break;case 2:f=[12,11];break;case 3:f=[10,11];break;case 4:f=[16,11];break;case 5:f=[40,33];break;case 6:f=[24,11];break;case 7:f=[20,11];break;case 8:f=[32,11];break;case 9:f=[80,33];break;case 10:f=[18,11];break;case 11:f=[15,11];break;case 12:f=[64,33];break;case 13:f=[160,99];break;case 14:f=[4,3];break;case 15:f=[3,2];break;case 16:f=[2,1];break;case 255:f=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}f&&(_=f[0]/f[1])}return{profileIdc:i,levelIdc:r,profileCompatibility:n,width:Math.ceil((16*(u+1)-2*m-2*g)*_),height:(2-d)*(c+1)*16-2*v-2*y}}}).prototype=new vl;var Tu,Su={H264Stream:gu,NalByteStream:vu},Eu=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ku=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},wu={isLikelyAacData:function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},parseId3TagSize:function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?i+20:i+10},parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,r=e[t+4]<<3;return 6144&e[t+3]|r|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return Eu[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i,r;t=10,64&e[5]&&(t+=4,t+=ku(e.subarray(10,14)));do{if((i=ku(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){r=e.subarray(t+10,t+i+10);for(var n=0;n<r.byteLength;n++)if(0===r[n]){if("com.apple.streaming.transportStreamTimestamp"===unescape(function(e,t,i){var r,n="";for(r=t;r<i;r++)n+="%"+("00"+e[r].toString(16)).slice(-2);return n}(r,0,n))){var a=r.subarray(n+1),s=(1&a[3])<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2;return s*=4,s+=3&a[7]}break}}t+=10,t+=i}while(t<e.byteLength);return null}};(Tu=function(){var e=new Uint8Array,t=0;Tu.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var r,n,a,s,o=0,l=0;for(e.length?(s=e.length,(e=new Uint8Array(i.byteLength+s)).set(e.subarray(0,s)),e.set(i,s)):e=i;e.length-l>=3;)if(e[l]!=="I".charCodeAt(0)||e[l+1]!=="D".charCodeAt(0)||e[l+2]!=="3".charCodeAt(0))if(255!=(255&e[l])||240!=(240&e[l+1]))l++;else{if(e.length-l<7)break;if(l+(o=wu.parseAdtsSize(e,l))>e.length)break;a={type:"audio",data:e.subarray(l,l+o),pts:t,dts:t},this.trigger("data",a),l+=o}else{if(e.length-l<10)break;if(l+(o=wu.parseId3TagSize(e,l))>e.length)break;n={type:"timed-metadata",data:e.subarray(l,l+o)},this.trigger("data",n),l+=o}r=e.length-l,e=r>0?e.subarray(l):new Uint8Array}}).prototype=new vl;var Cu,Lu,Au,Ru,Pu=Tu,Du=Su.H264Stream,Iu=wu.isLikelyAacData,xu=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Ou=["width","height","profileIdc","levelIdc","profileCompatibility"],Mu=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},Uu=function(e,t,i,r,n,a){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(r-t),pts:e+(n-i)},prependedContentDuration:a,baseMediaDecodeTime:e}};(Lu=function(e,t){var i=[],r=0,n=0,a=0,s=1/0;t=t||{},Lu.prototype.init.call(this),this.push=function(t){Bl(e,t),e&&xu.forEach(function(i){e[i]=t[i]}),i.push(t)},this.setEarliestDts=function(t){n=t-e.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){a=e},this.flush=function(){var o,l,u,c;0!==i.length?(o=Il(i,e,n),e.baseMediaDecodeTime=Ul(e,t.keepOriginalTimestamps),Dl(e,o,a,s),e.samples=xl(o),u=cl.mdat(Ol(o)),i=[],l=cl.moof(r,[e]),c=new Uint8Array(l.byteLength+u.byteLength),r++,c.set(l),c.set(u,l.byteLength),Ml(e),this.trigger("data",{track:e,boxes:c}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")}}).prototype=new vl,(Cu=function(e,t){var i,r,n=0,a=[],s=[];t=t||{},Cu.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){Bl(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],Ou.forEach(function(t){e[t]=i[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),a.push(t)},this.flush=function(){for(var i,r,o,l,u,c,d,h,f=0;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0===a.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(i=_l(a),(o=bl(i))[0][0].keyFrame||((r=this.getGopForFusion_(a[0],e))?(f=r.duration,o.unshift(r),o.byteLength+=r.byteLength,o.nalCount+=r.nalCount,o.pts=r.pts,o.dts=r.dts,o.duration+=r.duration):o=Tl(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");Ml(e),o=p}Bl(e,o),e.samples=Sl(o),u=cl.mdat(El(o)),e.baseMediaDecodeTime=Ul(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",Uu(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),l=cl.moof(n,[e]),c=new Uint8Array(l.byteLength+u.byteLength),n++,c.set(l),c.set(u,l.byteLength),this.trigger("data",{track:e,boxes:c}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){Ml(e),i=void 0,r=void 0},this.getGopForFusion_=function(t){var i,r,n,a,s,o=1/0;for(s=0;s<this.gopCache_.length;s++)n=(a=this.gopCache_[s]).gop,e.pps&&Mu(e.pps[0],a.pps[0])&&e.sps&&Mu(e.sps[0],a.sps[0])&&(n.dts<e.timelineStartInfo.dts||(i=t.dts-n.dts-n.duration)>=-1e4&&i<=45e3&&(!r||o>i)&&(r=a,o=i));return r?r.gop:null},this.alignGopsAtStart_=function(e){var t,i,r,n,a,o,l,u;for(a=e.byteLength,o=e.nalCount,l=e.duration,t=i=0;t<s.length&&i<e.length&&(r=s[t],n=e[i],r.pts!==n.pts);)n.pts>r.pts?t++:(i++,a-=n.byteLength,o-=n.nalCount,l-=n.duration);return 0===i?e:i===e.length?null:((u=e.slice(i)).byteLength=a,u.duration=l,u.nalCount=o,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(e){var t,i,r,n,a,o,l;for(t=s.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(r=s[t],n=e[i],r.pts===n.pts){o=!0;break}r.pts>n.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(l=o?i:a))return e;var u=e.slice(l),c=u.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 u.byteLength=c.byteLength,u.duration=c.duration,u.nalCount=c.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(e){s=e}}).prototype=new vl,(Ru=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,Ru.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 vl,Ru.prototype.flush=function(e){var t,i,r,n,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,Ou.forEach(function(e){s.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,xu.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,r=cl.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(r.byteLength),s.initSegment.set(r),s.data=new Uint8Array(this.pendingBytes),n=0;n<this.pendingBoxes.length;n++)s.data.set(this.pendingBoxes[n],a),a+=this.pendingBoxes[n].byteLength;for(n=0;n<this.pendingCaptions.length;n++)(t=this.pendingCaptions[n]).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(n=0;n<this.pendingMetadata.length;n++)(i=this.pendingMetadata[n]).cueTime=i.pts,this.keepOriginalTimestamps||(i.cueTime-=o),i.cueTime/=9e4,s.metadata.push(i);s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},(Au=function(e){var t,i,r=this,n=!0;Au.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 pu.MetadataStream,t.aacStream=new Pu,t.audioTimestampRolloverStream=new pu.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new pu.TimestampRolloverStream("timed-metadata"),t.adtsStream=new _u,t.coalesceStream=new Ru(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(n){"timed-metadata"!==n.type||t.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:r.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new Lu(i,e),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var n={};this.transmuxPipeline_=n,n.type="ts",n.metadataStream=new pu.MetadataStream,n.packetStream=new pu.TransportPacketStream,n.parseStream=new pu.TransportParseStream,n.elementaryStream=new pu.ElementaryStream,n.videoTimestampRolloverStream=new pu.TimestampRolloverStream("video"),n.audioTimestampRolloverStream=new pu.TimestampRolloverStream("audio"),n.timedMetadataTimestampRolloverStream=new pu.TimestampRolloverStream("timed-metadata"),n.adtsStream=new _u,n.h264Stream=new Du,n.captionStream=new pu.CaptionStream,n.coalesceStream=new Ru(e,n.metadataStream),n.headOfPipeline=n.packetStream,n.packetStream.pipe(n.parseStream).pipe(n.elementaryStream),n.elementaryStream.pipe(n.videoTimestampRolloverStream).pipe(n.h264Stream),n.elementaryStream.pipe(n.audioTimestampRolloverStream).pipe(n.adtsStream),n.elementaryStream.pipe(n.timedMetadataTimestampRolloverStream).pipe(n.metadataStream).pipe(n.coalesceStream),n.h264Stream.pipe(n.captionStream).pipe(n.coalesceStream),n.elementaryStream.on("data",function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime;t&&!n.videoSegmentStream&&(n.coalesceStream.numberOfTracks++,n.videoSegmentStream=new Cu(t,e),n.videoSegmentStream.on("timelineStartInfo",function(e){i&&(i.timelineStartInfo=e,n.audioSegmentStream.setEarliestDts(e.dts))}),n.videoSegmentStream.on("processedGopsInfo",r.trigger.bind(r,"gopInfo")),n.videoSegmentStream.on("segmentTimingInfo",r.trigger.bind(r,"videoSegmentTimingInfo")),n.videoSegmentStream.on("baseMediaDecodeTime",function(e){i&&n.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),n.h264Stream.pipe(n.videoSegmentStream).pipe(n.coalesceStream)),i&&!n.audioSegmentStream&&(n.coalesceStream.numberOfTracks++,n.audioSegmentStream=new Lu(i,e),n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream))}}),n.coalesceStream.on("data",this.trigger.bind(this,"data")),n.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(r){var n=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=r),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,Ml(i),e.keepOriginalTimestamps||(i.timelineStartInfo.baseMediaDecodeTime=r),n.audioTimestampRolloverStream&&n.audioTimestampRolloverStream.discontinuity()),t&&(n.videoSegmentStream&&(n.videoSegmentStream.gopCache_=[],n.videoTimestampRolloverStream.discontinuity()),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,Ml(t),n.captionStream.reset(),e.keepOriginalTimestamps||(t.timelineStartInfo.baseMediaDecodeTime=r)),n.timedMetadataTimestampRolloverStream&&n.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.push=function(e){if(n){var t=Iu(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),n=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){n=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new vl;var Bu={Transmuxer:Au,VideoSegmentStream:Cu,AudioSegmentStream:Lu,AUDIO_PROPERTIES:xu,VIDEO_PROPERTIES:Ou,generateVideoSegmentTimingInfo:Uu},Nu=Gl,Fu=Xl.CaptionStream,ju=function(e,t){for(var i=e,r=0;r<t.length;r++){var n=t[r];if(i<n.size)return n;i-=n.size}return null},Gu=function(e,t){var i=rl.findBox(e,["moof","traf"]),r={},n=[];return rl.findBox(e,["mdat"]).forEach(function(e,t){var r=i[t];n.push({mdat:e,traf:r})}),n.forEach(function(e){var i,n=e.mdat,a=e.traf,s=rl.findBox(a,["tfhd"]),o=ll.parseTfhd(s[0]),l=o.trackId,u=rl.findBox(a,["tfdt"]),c=u.length>0?ll.parseTfdt(u[0]).baseMediaDecodeTime:0,d=rl.findBox(a,["trun"]);t===l&&d.length>0&&(i=function(e,t,i){var r,n,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),l=[];for(n=0;n+4<e.length;n+=a)if(a=o.getUint32(n),n+=4,!(a<=0))switch(31&e[n]){case 6:var u=e.subarray(n+1,n+1+a),c=ju(n,t);r={nalUnitType:"sei_rbsp",size:a,data:u,escapedRBSP:Nu(u),trackId:i},c?(r.pts=c.pts,r.dts=c.dts,s=c):(r.pts=s.pts,r.dts=s.dts),l.push(r)}return l}(n,function(e,t,i){var r=t,n=i.defaultSampleDuration||0,a=i.defaultSampleSize||0,s=i.trackId,o=[];return e.forEach(function(e){var t=ll.parseTrun(e).samples;t.forEach(function(e){void 0===e.duration&&(e.duration=n),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=r,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),e.pts=r+e.compositionTimeOffset,r+=e.duration}),o=o.concat(t)}),o}(d,c,o),l),r[l]||(r[l]=[]),r[l]=r[l].concat(i))}),r},Vu={generator:cl,probe:rl,Transmuxer:Bu.Transmuxer,AudioSegmentStream:Bu.AudioSegmentStream,VideoSegmentStream:Bu.VideoSegmentStream,CaptionParser:function(){var e,t,i,r,n,a=!1;this.isInitialized=function(){return a},this.init=function(){e=new Fu,a=!0,e.on("data",function(e){e.startTime=e.startPts/r,e.endTime=e.endPts/r,n.captions.push(e),n.captionStreams[e.stream]=!0})},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length||i===e[0]&&r===t[i])},this.parse=function(e,a,s){var o;if(!this.isInitialized())return null;if(!a||!s)return null;if(this.isNewInit(a,s))i=a[0],r=s[i];else if(!i||!r)return t.push(e),null;for(;t.length>0;){var l=t.shift();this.parse(l,a,s)}return null!==(o=function(e,t,i){return t?{seiNals:Gu(e,t)[t],timescale:i}:null}(e,i,r))&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),n):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(){n.captions=[],n.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,r=null,n?this.clearParsedCaptions():n={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()}}.CaptionParser,Hu=function(e){var t=31&e[1];return t<<=8,t|=e[2]},Ku=function(e){return!!(64&e[1])},qu=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},Wu=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}},zu={parseType:function(e,t){var i=Hu(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=Ku(e),i=4+qu(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=Ku(e),r=4+qu(e);if(i&&(r+=e[r]+1),1&e[r+5]){var n;n=3+((15&e[r+1])<<8|e[r+2])-4;for(var a=12+((15&e[r+10])<<8|e[r+11]);a<n;){var s=r+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:Ku,parsePesType:function(e,t){switch(t[Hu(e)]){case $l.H264_STREAM_TYPE:return"video";case $l.ADTS_STREAM_TYPE:return"audio";case $l.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!Ku(e))return null;var t=4+qu(e);if(t>=e.byteLength)return null;var i,r=null;return 192&(i=e[t+7])&&((r={}).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,r.pts*=4,r.pts+=(6&e[t+13])>>>1,r.dts=r.pts,64&i&&(r.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,r.dts*=4,r.dts+=(6&e[t+18])>>>1)),r},videoPacketContainsKeyFrame:function(e){for(var t=4+qu(e),i=e.subarray(t),r=0,n=0,a=!1;n<i.byteLength-3;n++)if(1===i[n+2]){r=n+5;break}for(;r<i.byteLength;)switch(i[r]){case 0:if(0!==i[r-1]){r+=2;break}if(0!==i[r-2]){r++;break}n+3!==r-2&&"slice_layer_without_partitioning_rbsp_idr"===Wu(31&i[n+3])&&(a=!0);do{r++}while(1!==i[r]&&r<i.length);n=r-2,r+=3;break;case 1:if(0!==i[r-1]||0!==i[r-2]){r+=3;break}"slice_layer_without_partitioning_rbsp_idr"===Wu(31&i[n+3])&&(a=!0),n=r-2,r+=3;break;default:r+=3}return i=i.subarray(n),r-=n,n=0,i&&i.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===Wu(31&i[n+3])&&(a=!0),a}},Yu=tu,Xu={};Xu.ts=zu,Xu.aac=wu;var $u=function(e,t,i){for(var r,n,a,s,o=0,l=188,u=!1;l<=e.byteLength;)if(71!==e[o]||71!==e[l]&&l!==e.byteLength)o++,l++;else{switch(r=e.subarray(o,l),Xu.ts.parseType(r,t.pid)){case"pes":n=Xu.ts.parsePesType(r,t.table),a=Xu.ts.parsePayloadUnitStartIndicator(r),"audio"===n&&a&&(s=Xu.ts.parsePesTime(r))&&(s.type="audio",i.audio.push(s),u=!0)}if(u)break;o+=188,l+=188}for(o=(l=e.byteLength)-188,u=!1;o>=0;)if(71!==e[o]||71!==e[l]&&l!==e.byteLength)o--,l--;else{switch(r=e.subarray(o,l),Xu.ts.parseType(r,t.pid)){case"pes":n=Xu.ts.parsePesType(r,t.table),a=Xu.ts.parsePayloadUnitStartIndicator(r),"audio"===n&&a&&(s=Xu.ts.parsePesTime(r))&&(s.type="audio",i.audio.push(s),u=!0)}if(u)break;o-=188,l-=188}},Qu=function(e,t,i){for(var r,n,a,s,o,l,u,c=0,d=188,h=!1,f={data:[],size:0};d<e.byteLength;)if(71!==e[c]||71!==e[d])c++,d++;else{switch(r=e.subarray(c,d),Xu.ts.parseType(r,t.pid)){case"pes":if(n=Xu.ts.parsePesType(r,t.table),a=Xu.ts.parsePayloadUnitStartIndicator(r),"video"===n&&(a&&!h&&(s=Xu.ts.parsePesTime(r))&&(s.type="video",i.video.push(s),h=!0),!i.firstKeyFrame)){if(a&&0!==f.size){for(o=new Uint8Array(f.size),l=0;f.data.length;)u=f.data.shift(),o.set(u,l),l+=u.byteLength;if(Xu.ts.videoPacketContainsKeyFrame(o)){var p=Xu.ts.parsePesTime(o);p?(i.firstKeyFrame=p,i.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}f.size=0}f.data.push(r),f.size+=r.byteLength}}if(h&&i.firstKeyFrame)break;c+=188,d+=188}for(c=(d=e.byteLength)-188,h=!1;c>=0;)if(71!==e[c]||71!==e[d])c--,d--;else{switch(r=e.subarray(c,d),Xu.ts.parseType(r,t.pid)){case"pes":n=Xu.ts.parsePesType(r,t.table),a=Xu.ts.parsePayloadUnitStartIndicator(r),"video"===n&&a&&(s=Xu.ts.parsePesTime(r))&&(s.type="video",i.video.push(s),h=!0)}if(h)break;c-=188,d-=188}},Ju=function(e){var t={pid:null,table:null},i={};for(var r in function(e,t){for(var i,r=0,n=188;n<e.byteLength;)if(71!==e[r]||71!==e[n])r++,n++;else{switch(i=e.subarray(r,n),Xu.ts.parseType(i,t.pid)){case"pat":t.pid||(t.pid=Xu.ts.parsePat(i));break;case"pmt":t.table||(t.table=Xu.ts.parsePmt(i))}if(t.pid&&t.table)return;r+=188,n+=188}}(e,t),t.table){if(t.table.hasOwnProperty(r))switch(t.table[r]){case $l.H264_STREAM_TYPE:i.video=[],Qu(e,t,i),0===i.video.length&&delete i.video;break;case $l.ADTS_STREAM_TYPE:i.audio=[],$u(e,t,i),0===i.audio.length&&delete i.audio}}return i},Zu=function(e,t){var i;return(i=Xu.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,r=0,n=null,a=null,s=0,o=0;e.length-o>=3;){switch(Xu.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=Xu.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=Xu.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=Xu.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===n&&(t=e.subarray(o,o+s),n=Xu.aac.parseSampleRate(t)),r++,o+=s;break;default:o++}if(i)return null}if(null===n||null===a)return null;var l=9e4/n;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*r*l,pts:a+1024*r*l}]}}(e):Ju(e))&&(i.audio||i.video)?(function(e,t){if(e.audio&&e.audio.length){var i=t;void 0===i&&(i=e.audio[0].dts),e.audio.forEach(function(e){e.dts=Yu(e.dts,i),e.pts=Yu(e.pts,i),e.dtsTime=e.dts/9e4,e.ptsTime=e.pts/9e4})}if(e.video&&e.video.length){var r=t;if(void 0===r&&(r=e.video[0].dts),e.video.forEach(function(e){e.dts=Yu(e.dts,r),e.pts=Yu(e.pts,r),e.dtsTime=e.dts/9e4,e.ptsTime=e.pts/9e4}),e.firstKeyFrame){var n=e.firstKeyFrame;n.dts=Yu(n.dts,r),n.pts=Yu(n.pts,r),n.dtsTime=n.dts/9e4,n.ptsTime=n.dts/9e4}}}(i,t),i):null};var ec=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},tc=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),ic=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},rc=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],r=t[4],n=i[4],a=void 0,s=void 0,o=void 0,l=[],u=[],c=void 0,d=void 0,h=void 0,f=void 0,p=void 0;for(a=0;a<256;a++)u[(l[a]=a<<1^283*(a>>7))^a]=a;for(s=o=0;!r[s];s^=c||1,o=u[o]||1)for(h=(h=o^o<<1^o<<2^o<<3^o<<4)>>8^255&h^99,r[s]=h,n[h]=s,p=16843009*l[d=l[c=l[s]]]^65537*d^257*c^16843008*s,f=257*l[h]^16843008*h,a=0;a<4;a++)t[a][s]=f=f<<24^f>>>8,i[a][h]=p=p<<24^p>>>8;for(a=0;a<5;a++)t[a]=t[a].slice(0),i[a]=i[a].slice(0);return e},nc=null,ac=function(){function e(t){ec(this,e),nc||(nc=rc()),this._tables=[[nc[0][0].slice(),nc[0][1].slice(),nc[0][2].slice(),nc[0][3].slice(),nc[0][4].slice()],[nc[1][0].slice(),nc[1][1].slice(),nc[1][2].slice(),nc[1][3].slice(),nc[1][4].slice()]];var i=void 0,r=void 0,n=void 0,a=void 0,s=void 0,o=this._tables[0][4],l=this._tables[1],u=t.length,c=1;if(4!==u&&6!==u&&8!==u)throw new Error("Invalid aes key size");for(a=t.slice(0),s=[],this._key=[a,s],i=u;i<4*u+28;i++)n=a[i-1],(i%u==0||8===u&&i%u==4)&&(n=o[n>>>24]<<24^o[n>>16&255]<<16^o[n>>8&255]<<8^o[255&n],i%u==0&&(n=n<<8^n>>>24^c<<24,c=c<<1^283*(c>>7))),a[i]=a[i-u]^n;for(r=0;i;r++,i--)n=a[3&r?i:i-4],s[r]=i<=4||r<4?n:l[0][o[n>>>24]]^l[1][o[n>>16&255]]^l[2][o[n>>8&255]]^l[3][o[255&n]]}return e.prototype.decrypt=function(e,t,i,r,n,a){var s=this._key[1],o=e^s[0],l=r^s[1],u=i^s[2],c=t^s[3],d=void 0,h=void 0,f=void 0,p=s.length/4-2,m=void 0,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],S=v[4];for(m=0;m<p;m++)d=y[o>>>24]^_[l>>16&255]^b[u>>8&255]^T[255&c]^s[g],h=y[l>>>24]^_[u>>16&255]^b[c>>8&255]^T[255&o]^s[g+1],f=y[u>>>24]^_[c>>16&255]^b[o>>8&255]^T[255&l]^s[g+2],c=y[c>>>24]^_[o>>16&255]^b[l>>8&255]^T[255&u]^s[g+3],g+=4,o=d,l=h,u=f;for(m=0;m<4;m++)n[(3&-m)+a]=S[o>>>24]<<24^S[l>>16&255]<<16^S[u>>8&255]<<8^S[255&c]^s[g++],d=o,o=l,l=u,u=c,c=d},e}(),sc=function(){function e(){ec(this,e),this.listeners={}}return e.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},e.prototype.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},e.prototype.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,r=0;r<i;++r)t[r].call(this,arguments[1]);else for(var n=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,n)},e.prototype.dispose=function(){this.listeners={}},e.prototype.pipe=function(e){this.on("data",function(t){e.push(t)})},e}(),oc=function(e){function t(){ec(this,t);var i=ic(this,e.call(this,sc));return i.jobs=[],i.delay=1,i.timeout_=null,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},t.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(sc),lc=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},uc=function(e,t,i){var r=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),n=new ac(Array.prototype.slice.call(t)),a=new Uint8Array(e.byteLength),s=new Int32Array(a.buffer),o=void 0,l=void 0,u=void 0,c=void 0,d=void 0,h=void 0,f=void 0,p=void 0,m=void 0;for(o=i[0],l=i[1],u=i[2],c=i[3],m=0;m<r.length;m+=4)d=lc(r[m]),h=lc(r[m+1]),f=lc(r[m+2]),p=lc(r[m+3]),n.decrypt(d,h,f,p,s,m),s[m]=lc(s[m]^o),s[m+1]=lc(s[m+1]^l),s[m+2]=lc(s[m+2]^u),s[m+3]=lc(s[m+3]^c),o=d,l=h,u=f,c=p;return a},cc=function(){function e(t,i,r,n){ec(this,e);var a=e.STEP,s=new Int32Array(t.buffer),o=new Uint8Array(t.byteLength),l=0;for(this.asyncStream_=new oc,this.asyncStream_.push(this.decryptChunk_(s.subarray(l,l+a),i,r,o)),l=a;l<s.length;l+=a)r=new Uint32Array([lc(s[l-4]),lc(s[l-3]),lc(s[l-2]),lc(s[l-1])]),this.asyncStream_.push(this.decryptChunk_(s.subarray(l,l+a),i,r,o));this.asyncStream_.push(function(){var e;n(null,(e=o).subarray(0,e.byteLength-e[e.byteLength-1]))})}return e.prototype.decryptChunk_=function(e,t,i,r){return function(){var n=uc(e,t,i);r.set(n,e.byteOffset)}},tc(e,null,[{key:"STEP",get:function(){return 32e3}}]),e}(),dc=function(t,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(t)||(t=fs.buildAbsoluteURL(e.location.href,t)),fs.buildAbsoluteURL(t,i))},hc=function(e,t,i){return e&&i.responseURL&&t!==i.responseURL?i.responseURL:t},fc=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},pc=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),mc=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},gc=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},vc=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var i=[],r=!0,n=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(r=(s=o.next()).done)&&(i.push(s.value),!t||i.length!==t);r=!0);}catch(e){n=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(n)throw a}}return i}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),yc=cs.mergeOptions,_c=cs.EventTarget,bc=cs.log,Tc=function(e,t){["AUDIO","SUBTITLES"].forEach(function(i){for(var r in e.mediaGroups[i])for(var n in e.mediaGroups[i][r]){var a=e.mediaGroups[i][r][n];t(a,i,r,n)}})},Sc=function(e,t){var i=yc(e,{}),r=i.playlists[t.uri];if(!r)return null;if(r.segments&&t.segments&&r.segments.length===t.segments.length&&r.endList===t.endList&&r.mediaSequence===t.mediaSequence)return null;var n=yc(r,t);r.segments&&(n.segments=function(e,t,i){var r=t.slice();i=i||0;for(var n=Math.min(e.length,t.length+i),a=i;a<n;a++)r[a-i]=yc(e[a],r[a-i]);return r}(r.segments,t.segments,t.mediaSequence-r.mediaSequence)),n.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,n.resolvedUri)});for(var a=0;a<i.playlists.length;a++)i.playlists[a].uri===t.uri&&(i.playlists[a]=n);return i.playlists[t.uri]=n,i},Ec=function(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];e.playlists[i.uri]=i,i.resolvedUri=dc(e.uri,i.uri),i.id=t,i.attributes||(i.attributes={},bc.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))}},kc=function(e){Tc(e,function(t){t.uri&&(t.resolvedUri=dc(e.uri,t.uri))})},wc=function(e,t){var i=e.segments[e.segments.length-1];return t&&i&&i.duration?1e3*i.duration:500*(e.targetDuration||10)},Cc=function(t){function i(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};fc(this,i);var n=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),a=r.withCredentials,s=void 0!==a&&a,o=r.handleManifestRedirects,l=void 0!==o&&o;n.srcUrl=e,n.hls_=t,n.withCredentials=s,n.handleManifestRedirects=l;var u=t.options_;if(n.customTagParsers=u&&u.customTagParsers||[],n.customTagMappers=u&&u.customTagMappers||[],!n.srcUrl)throw new Error("A non-empty playlist URL is required");return n.state="HAVE_NOTHING",n.on("mediaupdatetimeout",function(){"HAVE_METADATA"===n.state&&(n.state="HAVE_CURRENT_METADATA",n.request=n.hls_.xhr({uri:dc(n.master.uri,n.media().uri),withCredentials:n.withCredentials},function(e,t){if(n.request)return e?n.playlistRequestError(n.request,n.media().uri,"HAVE_METADATA"):void n.haveMetadata(n.request,n.media().uri)}))}),n}return mc(i,_c),pc(i,[{key:"playlistRequestError",value:function(e,t,i){this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[t],status:e.status,message:"HLS playlist request error at URL: "+t+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")}},{key:"haveMetadata",value:function(t,i){var r=this;this.request=null,this.state="HAVE_METADATA";var n=new Ts;this.customTagParsers.forEach(function(e){return n.addParser(e)}),this.customTagMappers.forEach(function(e){return n.addTagMapper(e)}),n.push(t.responseText),n.end(),n.manifest.uri=i,n.manifest.attributes=n.manifest.attributes||{};var a=Sc(this.master,n.manifest);this.targetDuration=n.manifest.targetDuration,a?(this.master=a,this.media_=this.master.playlists[n.manifest.uri]):this.trigger("playlistunchanged"),this.media().endList||(e.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=e.setTimeout(function(){r.trigger("mediaupdatetimeout")},wc(this.media(),!!a))),this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.finalRenditionTimeout)}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"media",value:function(t,i){var r=this;if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof t){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}if(e.clearTimeout(this.finalRenditionTimeout),i){var n=t.targetDuration/2*1e3||5e3;this.finalRenditionTimeout=e.setTimeout(this.media.bind(this,t,!1),n)}else{var a=this.state,s=!this.media_||t.uri!==this.media_.uri;if(this.master.playlists[t.uri].endList)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=t,void(s&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(s){if(this.state="SWITCHING_MEDIA",this.request){if(t.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.request=this.hls_.xhr({uri:t.resolvedUri,withCredentials:this.withCredentials},function(e,i){if(r.request){if(t.resolvedUri=hc(r.handleManifestRedirects,t.resolvedUri,i),e)return r.playlistRequestError(r.request,t.uri,a);r.haveMetadata(i,t.uri),"HAVE_MASTER"===a?r.trigger("loadedmetadata"):r.trigger("mediachange")}})}}}},{key:"pause",value:function(){this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}},{key:"load",value:function(t){var i=this;e.clearTimeout(this.mediaUpdateTimeout);var r=this.media();if(t){var n=r?r.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=e.setTimeout(function(){return i.load()},n)}else this.started?r&&!r.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}},{key:"start",value:function(){var t=this;this.started=!0,this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(i,r){if(t.request){if(t.request=null,i)return t.error={status:r.status,message:"HLS playlist request error at URL: "+t.srcUrl+".",responseText:r.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");var n=new Ts;return t.customTagParsers.forEach(function(e){return n.addParser(e)}),t.customTagMappers.forEach(function(e){return n.addTagMapper(e)}),n.push(r.responseText),n.end(),t.state="HAVE_MASTER",t.srcUrl=hc(t.handleManifestRedirects,t.srcUrl,r),n.manifest.uri=t.srcUrl,n.manifest.playlists?(t.master=n.manifest,Ec(t.master),kc(t.master),t.trigger("loadedplaylist"),void(t.request||t.media(n.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(r,t.srcUrl),t.trigger("loadedmetadata"))}})}}]),i}(),Lc=cs.createTimeRange,Ac=function(e,t,i){var r,n;return void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence?0:(r=function(e,t){var i=0,r=t-e.mediaSequence,n=e.segments[r];if(n){if(void 0!==n.start)return{result:n.start,precise:!0};if(void 0!==n.end)return{result:n.end-n.duration,precise:!0}}for(;r--;){if(void 0!==(n=e.segments[r]).end)return{result:i+n.end,precise:!0};if(i+=n.duration,void 0!==n.start)return{result:i+n.start,precise:!0}}return{result:i,precise:!1}}(e,t)).precise?r.result:(n=function(e,t){for(var i=0,r=void 0,n=t-e.mediaSequence;n<e.segments.length;n++){if(void 0!==(r=e.segments[n]).start)return{result:r.start-i,precise:!0};if(i+=r.duration,void 0!==r.end)return{result:r.end-i,precise:!0}}return{result:-1,precise:!1}}(e,t)).precise?n.result:r.result+i},Rc=function(t,i,r){if(!t)return 0;if("number"!=typeof r&&(r=0),void 0===i){if(t.totalDuration)return t.totalDuration;if(!t.endList)return e.Infinity}return Ac(t,i,r)},Pc=function(e,t,i){var r=0;if(t>i){var n=[i,t];t=n[0],i=n[1]}if(t<0){for(var a=t;a<Math.min(0,i);a++)r+=e.targetDuration;t=0}for(var s=t;s<i;s++)r+=e.segments[s].duration;return r},Dc=function(e){if(!e.segments.length)return 0;for(var t=e.segments.length-1,i=e.segments[t].duration||e.targetDuration,r=i+2*e.targetDuration;t--&&!((i+=e.segments[t].duration)>=r););return Math.max(0,t)},Ic=function(e,t,i){if(!e||!e.segments)return null;if(e.endList)return Rc(e);if(null===t)return null;t=t||0;var r=i?Dc(e):e.segments.length;return Ac(e,e.mediaSequence+r,t)},xc=function(e){return e-Math.floor(e)==0},Oc=function(e,t){if(xc(t))return t+.1*e;for(var i=t.toString().split(".")[1].length,r=1;r<=i;r++){var n=Math.pow(10,r),a=t*n;if(xc(a)||r===i)return(a+e)/n}},Mc=Oc.bind(null,1),Uc=Oc.bind(null,-1),Bc=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},Nc=function(e){return e.excludeUntil&&e.excludeUntil===1/0},Fc=function(e){var t=Bc(e);return!e.disabled&&!t},jc=function(e,t){return t.attributes&&t.attributes[e]},Gc=function(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(function(e){return!!Fc(e)&&(e.attributes.BANDWIDTH||0)<i}).length},Vc={duration:Rc,seekable:function(e,t){var i=t||0,r=Ic(e,t,!0);return null===r?Lc():Lc(i,r)},safeLiveIndex:Dc,getMediaInfoForTime:function(e,t,i,r){var n=void 0,a=void 0,s=e.segments.length,o=t-r;if(o<0){if(i>0)for(n=i-1;n>=0;n--)if(a=e.segments[n],(o+=Uc(a.duration))>0)return{mediaIndex:n,startTime:r-Pc(e,i,n)};return{mediaIndex:0,startTime:t}}if(i<0){for(n=i;n<0;n++)if((o-=e.targetDuration)<0)return{mediaIndex:0,startTime:t};i=0}for(n=i;n<s;n++)if(a=e.segments[n],(o-=Mc(a.duration))<0)return{mediaIndex:n,startTime:r+Pc(e,i,n)};return{mediaIndex:s-1,startTime:t}},isEnabled:Fc,isDisabled:function(e){return e.disabled},isBlacklisted:Bc,isIncompatible:Nc,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:jc,estimateSegmentRequestTime:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return jc("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*r)/t:NaN},isLowestEnabledRendition:Gc},Hc=cs.xhr,Kc=cs.mergeOptions,qc=function(){return function e(t,i){t=Kc({timeout:45e3},t);var r=e.beforeRequest||cs.Hls.xhr.beforeRequest;if(r&&"function"==typeof r){var n=r(t);n&&(t=n)}var a=Hc(t,function(e,t){var r=a.response;!e&&r&&(a.responseTime=Date.now(),a.roundTripTime=a.responseTime-a.requestTime,a.bytesReceived=r.byteLength||r.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&&(r||a.responseText)))),i(e,a)}),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=t.uri,a.requestTime=Date.now(),a}},Wc=function(e){var t,i,r={};return e.byterange&&(r.Range=(t=e.byterange,i=t.offset+t.length-1,"bytes="+t.offset+"-"+i)),r},zc=function(e,t){return e.start(t)+"-"+e.end(t)},Yc=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Xc=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},$c=function(e){var t={};return Object.keys(e).forEach(function(i){var r=e[i];ArrayBuffer.isView(r)?t[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[i]=r}),t},Qc=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Jc=function(e){return e.resolvedUri},Zc=function(e){for(var t=Array.prototype.slice.call(e),i="",r=0;r<t.length/16;r++)i+=t.slice(16*r,16*r+16).map(Yc).join("")+" "+t.slice(16*r,16*r+16).map(Xc).join("")+"\n";return i},ed=Object.freeze({createTransferableMessage:$c,initSegmentId:Qc,segmentKeyId:Jc,hexDump:Zc,tagDump:function(e){var t=e.bytes;return Zc(t)},textRanges:function(e){var t="",i=void 0;for(i=0;i<e.length;i++)t+=zc(e,i)+" ";return t}}),td=function(e){var t=e.playlist,i=e.time,r=void 0===i?void 0:i,n=e.callback;if(!n)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===r)return n({message:"getProgramTime: playlist and time must be provided"});var a=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i=0,r=void 0,n=0;n<t.segments.length&&!(e<=(i=(r=t.segments[n]).videoTimingInfo?r.videoTimingInfo.transmuxedPresentationEnd:i+r.duration));n++);var a=t.segments[t.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>i){if(e>i+.25*a.duration)return null;r=a}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:i-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}}(r,t);if(!a)return n({message:"valid programTime was not found"});if("estimate"===a.type)return n({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:r},o=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,r=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*r)}(r,a.segment);return o&&(s.programDateTime=o.toISOString()),n(null,s)},id=function e(t){var i=t.programTime,r=t.playlist,n=t.retryCount,a=void 0===n?2:n,s=t.seekTo,o=t.pauseAfterSeek,l=void 0===o||o,u=t.tech,c=t.callback;if(!c)throw new Error("seekToProgramTime: callback must be provided");if(void 0===i||!r||!s)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!r.endList&&!u.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}(r))return c({message:"programDateTime tags must be provided in the manifest "+r.resolvedUri});var d=function(e,t){var i=void 0;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;var r=t.segments[0];if(i<r.dateTimeObject)return null;for(var n=0;n<t.segments.length-1&&(r=t.segments[n],!(i<t.segments[n+1].dateTimeObject));n++);var a,s=t.segments[t.segments.length-1],o=s.dateTimeObject,l=s.videoTimingInfo?(a=s.videoTimingInfo).transmuxedPresentationEnd-a.transmuxedPresentationStart-a.transmuxerPrependedSeconds:s.duration+.25*s.duration;return i>new Date(o.getTime()+1e3*l)?null:(i>o&&(r=s),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:Vc.duration(t,t.mediaSequence+t.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})}(i,r);if(!d)return c({message:i+" was not found in the stream"});var h=d.segment,f=function(e,t){var i=void 0,r=void 0;try{i=new Date(e),r=new Date(t)}catch(e){}var n=i.getTime();return(r.getTime()-n)/1e3}(h.dateTimeObject,i);if("estimate"===d.type)return 0===a?c({message:i+" is not buffered yet. Try again"}):(s(d.estimatedStart+f),void u.one("seeked",function(){e({programTime:i,playlist:r,retryCount:a-1,seekTo:s,pauseAfterSeek:l,tech:u,callback:c})}));var p=h.start+f;u.one("seeked",function(){return c(null,u.currentTime())}),l&&u.pause(),s(p)},rd=function(e,t){var i=[],r=void 0;if(e&&e.length)for(r=0;r<e.length;r++)t(e.start(r),e.end(r))&&i.push([e.start(r),e.end(r)]);return cs.createTimeRanges(i)},nd=function(e,t){return rd(e,function(e,i){return e-1/30<=t&&i+1/30>=t})},ad=function(e,t){return rd(e,function(e){return e-1/30>=t})},sd=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},od=function(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t},ld=function(e,t,i){var r=void 0,n=void 0;if(i&&i.cues)for(r=i.cues.length;r--;)(n=i.cues[r]).startTime<=t&&n.endTime>=e&&i.removeCue(n)},ud=function(e){return isNaN(e)||Math.abs(e)===1/0?Number.MAX_VALUE:e},cd=function(t,i,r){var n=e.WebKitDataCue||e.VTTCue;if(i&&i.forEach(function(e){var t=e.stream;this.inbandTextTracks_[t].addCue(new n(e.startTime+this.timestampOffset,e.endTime+this.timestampOffset,e.text))},t),r){var a=ud(t.mediaSource_.duration);if(r.forEach(function(t){var i=t.cueTime+this.timestampOffset;!("number"!=typeof i||e.isNaN(i)||i<0)&&i<1/0&&t.frames.forEach(function(e){var t=new n(i,i,e.value||e.url||e.data||"");t.frame=e,t.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return cs.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return cs.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return cs.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(t),this.metadataTrack_.addCue(t)},this)},t),t.metadataTrack_&&t.metadataTrack_.cues&&t.metadataTrack_.cues.length){for(var s=t.metadataTrack_.cues,o=[],l=0;l<s.length;l++)s[l]&&o.push(s[l]);var u=o.reduce(function(e,t){var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),c=Object.keys(u).sort(function(e,t){return Number(e)-Number(t)});c.forEach(function(e,t){var i=u[e],r=Number(c[t+1])||a;i.forEach(function(e){e.endTime=r})})}}},dd="undefined"!=typeof window?window:{},hd="undefined"==typeof Symbol?"__target":Symbol(),fd="application/javascript",pd=dd.BlobBuilder||dd.WebKitBlobBuilder||dd.MozBlobBuilder||dd.MSBlobBuilder,md=dd.URL||dd.webkitURL||md&&md.msURL,gd=dd.Worker;function vd(e,t){return function(i){var r=this;if(!t)return new gd(e);if(gd&&!i){var n=Td(t.toString().replace(/^function.+?{/,"").slice(0,-1));return this[hd]=new gd(n),function(e,t){if(!e||!t)return;var i=e.terminate;e.objURL=t,e.terminate=function(){e.objURL&&md.revokeObjectURL(e.objURL),i.call(e)}}(this[hd],n),this[hd]}var a={postMessage:function(e){r.onmessage&&setTimeout(function(){r.onmessage({data:e,target:a})})}};t.call(a),this.postMessage=function(e){setTimeout(function(){a.onmessage({data:e,target:r})})},this.isThisThread=!0}}if(gd){var yd,_d=Td("self.onmessage = function () {}"),bd=new Uint8Array(1);try{(yd=new gd(_d)).postMessage(bd,[bd.buffer])}catch(e){gd=null}finally{md.revokeObjectURL(_d),yd&&yd.terminate()}}function Td(e){try{return md.createObjectURL(new Blob([e],{type:fd}))}catch(i){var t=new pd;return t.append(e),md.createObjectURL(t.getBlob(type))}}var Sd=new vd("./transmuxer-worker.worker.js",function(e,t){var i=this;!function(){var e,t,r,n,a,s,o,l,u,c,d,h,f,p,m,g,v,y,_,b,T,S,E,k,w,C,L,A,R,P,D,I,x,O,M,U,B,N,F,j,G=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)]);E=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),w=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),k=new Uint8Array([0,0,0,1]),C=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),L=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),A={video:C,audio:L},D=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),P=new Uint8Array([0,0,0,0,0,0,0,0]),I=new Uint8Array([0,0,0,0,0,0,0,0]),x=I,O=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M=I,R=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),e=function(e){var t,i,r=[],n=0;for(t=1;t<arguments.length;t++)r.push(arguments[t]);for(t=r.length;t--;)n+=r[t].byteLength;for(i=new Uint8Array(n+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,n=8;t<r.length;t++)i.set(r[t],n),n+=r[t].byteLength;return i},t=function(){return e(S.dinf,e(S.dref,D))},r=function(t){return e(S.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,t.audioobjecttype<<3|t.samplingfrequencyindex>>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},m=function(t){return e(S.hdlr,A[t])},p=function(t){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(i[12]=t.samplerate>>>24&255,i[13]=t.samplerate>>>16&255,i[14]=t.samplerate>>>8&255,i[15]=255&t.samplerate),e(S.mdhd,i)},f=function(t){return e(S.mdia,p(t),m(t.type),s(t))},a=function(t){return e(S.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},s=function(i){return e(S.minf,"video"===i.type?e(S.vmhd,R):e(S.smhd,P),t(),v(i))},o=function(t,i){for(var r=[],n=i.length;n--;)r[n]=_(i[n]);return e.apply(null,[S.moof,a(t)].concat(r))},l=function(t){for(var i=t.length,r=[];i--;)r[i]=d(t[i]);return e.apply(null,[S.moov,c(4294967295)].concat(r).concat(u(t)))},u=function(t){for(var i=t.length,r=[];i--;)r[i]=b(t[i]);return e.apply(null,[S.mvex].concat(r))},c=function(t){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e(S.mvhd,i)},g=function(t){var i,r,n=t.samples||[],a=new Uint8Array(4+n.length);for(r=0;r<n.length;r++)i=n[r].flags,a[r+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return e(S.sdtp,a)},v=function(t){return e(S.stbl,y(t),e(S.stts,M),e(S.stsc,x),e(S.stsz,O),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):B(t))},U=function(t){var i,r=t.sps||[],n=t.pps||[],a=[],s=[];for(i=0;i<r.length;i++)a.push((65280&r[i].byteLength)>>>8),a.push(255&r[i].byteLength),a=a.concat(Array.prototype.slice.call(r[i]));for(i=0;i<n.length;i++)s.push((65280&n[i].byteLength)>>>8),s.push(255&n[i].byteLength),s=s.concat(Array.prototype.slice.call(n[i]));return e(S.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),e(S.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([r.length]).concat(a).concat([n.length]).concat(s))),e(S.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},B=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]),r(t))},h=function(t){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return e(S.tkhd,i)},_=function(t){var i,r,n,a,s,o;return i=e(S.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(t.baseMediaDecodeTime/(G+1)),o=Math.floor(t.baseMediaDecodeTime%(G+1)),r=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?(n=T(t,92),e(S.traf,i,r,n)):(a=g(t),n=T(t,a.length+92),e(S.traf,i,r,n,a))},d=function(t){return t.duration=t.duration||4294967295,e(S.trak,h(t),f(t))},b=function(t){var i=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(i[i.length-1]=0),e(S.trex,i)},j=function(e,t){var i=0,r=0,n=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(r=2),void 0!==e[0].flags&&(n=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|r|n|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]},F=function(t,i){var r,n,a,s;for(i+=20+16*(n=t.samples||[]).length,r=j(n,i),s=0;s<n.length;s++)a=n[s],r=r.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(r))},N=function(t,i){var r,n,a,s;for(i+=20+8*(n=t.samples||[]).length,r=j(n,i),s=0;s<n.length;s++)a=n[s],r=r.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(r))},T=function(e,t){return"audio"===e.type?N(e,t):F(e,t)};var V,H,K={ftyp:n=function(){return e(S.ftyp,E,k,E,w)},mdat:function(t){return e(S.mdat,t)},moof:o,moov:l,initSegment:function(e){var t,i=n(),r=l(e);return(t=new Uint8Array(i.byteLength+r.byteLength)).set(i),t.set(r,i.byteLength),t}},q=function(e){return e>>>0},W={findBox:V=function(e,t){var i,r,n,a,s,o=[];if(!t.length)return null;for(i=0;i<e.byteLength;)r=q(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]),n=H(e.subarray(i+4,i+8)),a=r>1?i+r:e.byteLength,n===t[0]&&(1===t.length?o.push(e.subarray(i+8,a)):(s=V(e.subarray(i+8,a),t.slice(1))).length&&(o=o.concat(s))),i=a;return o},parseType:H=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},timescale:function(e){return V(e,["moov","trak"]).reduce(function(e,t){var i,r,n,a,s;return(i=V(t,["tkhd"])[0])?(r=i[0],a=q(i[n=0===r?12:20]<<24|i[n+1]<<16|i[n+2]<<8|i[n+3]),(s=V(t,["mdia","mdhd"])[0])?(n=0===(r=s[0])?12:20,e[a]=q(s[n]<<24|s[n+1]<<16|s[n+2]<<8|s[n+3]),e):null):null},{})},startTime:function(e,t){var i,r,n;return i=V(t,["moof","traf"]),r=[].concat.apply([],i.map(function(t){return V(t,["tfhd"]).map(function(i){var r,n;return r=q(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),n=e[r]||9e4,(V(t,["tfdt"]).map(function(e){var t,i;return t=e[0],i=q(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(i*=Math.pow(2,32),i+=q(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),i})[0]||1/0)/n})})),n=Math.min.apply(null,r),isFinite(n)?n:0},videoTrackIds:function(e){var t=[];return V(e,["moov","trak"]).forEach(function(e){var i=V(e,["mdia","hdlr"]),r=V(e,["tkhd"]);i.forEach(function(e,i){var n,a,s=H(e.subarray(8,12)),o=r[i];"vide"===s&&(a=0===(n=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?n.getUint32(12):n.getUint32(20),t.push(a))})}),t}},z=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var r;return!!e[t]&&(r=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(r,1),r>-1)},this.trigger=function(t){var i,r,n,a;if(i=e[t])if(2===arguments.length)for(n=i.length,r=0;r<n;++r)i[r].call(this,arguments[1]);else{for(a=[],r=arguments.length,r=1;r<arguments.length;++r)a.push(arguments[r]);for(n=i.length,r=0;r<n;++r)i[r].apply(this,a)}},this.dispose=function(){e={}}}};z.prototype.pipe=function(e){return this.on("data",function(t){e.push(t)}),this.on("done",function(t){e.flush(t)}),e},z.prototype.push=function(e){this.trigger("data",e)},z.prototype.flush=function(e){this.trigger("done",e)};var Y,X,$,Q,J,Z=z,ee=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},te=function(e){var t,i,r=[],n=[];for(r.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(r.length&&(r.duration=i.dts-r.dts,n.push(r)),(r=[i]).byteLength=i.data.byteLength,r.pts=i.pts,r.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(r.keyFrame=!0),r.duration=i.dts-r.dts,r.byteLength+=i.data.byteLength,r.push(i));return n.length&&(!r.duration||r.duration<=0)&&(r.duration=n[n.length-1].duration),n.push(r),n},ie=function(e){var t,i,r=[],n=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(r.length&&(n.push(r),n.byteLength+=r.byteLength,n.nalCount+=r.nalCount,n.duration+=r.duration),(r=[i]).nalCount=i.length,r.byteLength=i.byteLength,r.pts=i.pts,r.dts=i.dts,r.duration=i.duration):(r.duration+=i.duration,r.nalCount+=i.length,r.byteLength+=i.byteLength,r.push(i));return n.length&&r.duration<=0&&(r.duration=n[n.length-1].duration),n.byteLength+=r.byteLength,n.nalCount+=r.nalCount,n.duration+=r.duration,n.push(r),n},re=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},ne=function(e,t){var i,r,n,a,s,o=t||0,l=[];for(i=0;i<e.length;i++)for(a=e[i],r=0;r<a.length;r++)s=a[r],o+=(n=ee(s,o)).size,l.push(n);return l},ae=function(e){var t,i,r,n,a,s,o=0,l=e.byteLength,u=e.nalCount,c=new Uint8Array(l+4*u),d=new DataView(c.buffer);for(t=0;t<e.length;t++)for(n=e[t],i=0;i<n.length;i++)for(a=n[i],r=0;r<a.length;r++)s=a[r],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],le=function(e){for(var t=[];e--;)t.push(0);return t},ue={96000:[se,[227,64],le(154),[56]],88200:[se,[231],le(170),[56]],64000:[se,[248,192],le(240),[56]],48000:[se,[255,192],le(268),[55,148,128],le(54),[112]],44100:[se,[255,192],le(268),[55,163,128],le(84),[112]],32000:[se,[255,192],le(268),[55,234],le(226),[112]],24000:[se,[255,192],le(268),[55,255,128],le(268),[111,112],le(126),[224]],16000:[se,[255,192],le(268),[55,255,128],le(268),[111,255],le(269),[223,108],le(195),[1,192]],12000:[oe,le(268),[3,127,248],le(268),[6,255,240],le(268),[13,255,224],le(268),[27,253,128],le(259),[56]],11025:[oe,le(268),[3,127,248],le(268),[6,255,240],le(268),[13,255,224],le(268),[27,255,192],le(268),[55,175,128],le(108),[112]],8000:[oe,le(268),[3,121,16],le(47),[7]]},ce=(Y=ue,Object.keys(Y).reduce(function(e,t){return e[t]=new Uint8Array(Y[t].reduce(function(e,t){return e.concat(t)},[])),e},{})),de=(X=function(e){return 9e4*e},$=function(e,t){return e*t},Q=function(e){return e/9e4},J=function(e,t){return e/t},function(e,t){return X(J(e,t))}),he=function(e,t){return $(Q(e),t)},fe=function(e,t,i,r){var n,a,s,o,l=0,u=0,c=0;if(t.length&&(n=de(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(9e4/(e.samplerate/1024)),i&&r&&(l=n-Math.max(i,r),c=(u=Math.floor(l/a))*a),!(u<1||c>45e3))){for((s=ce[e.samplerate])||(s=t[0].data),o=0;o<u;o++)t.splice(o,0,{data:s});e.baseMediaDecodeTime-=Math.floor(he(c,e.samplerate))}},pe=function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},me=function(e){var t,i,r=[];for(t=0;t<e.length;t++)i=e[t],r.push({size:i.data.byteLength,duration:1024});return r},ge=function(e){var t,i,r=0,n=new Uint8Array(function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i}(e));for(t=0;t<e.length;t++)i=e[t],n.set(i.data,r),r+=i.data.byteLength;return n},ve=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},ye=function(e,t){var i,r=e.minSegmentDts;return t||(r-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=r,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/9e4,i=Math.floor(i)),i},_e=function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},be=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},r=0,n=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)r+=255,t++;for(r+=e[t++];255===e[t];)n+=255,t++;if(n+=e[t++],!i.payload&&4===r){i.payloadType=r,i.payloadSize=n,i.payload=e.subarray(t,t+n);break}t+=n,r=0,n=0}return i},Te=function(e){return 181!==e.payload[0]?null:49!=(e.payload[1]<<8|e.payload[2])?null:"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])?null:3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},Se=function(e,t){var i,r,n,a,s=[];if(!(64&t[0]))return s;for(r=31&t[0],i=0;i<r;i++)a={type:3&t[2+(n=3*i)],pts:e},4&t[n+2]&&(a.ccData=t[n+3]<<8|t[n+4],s.push(a));return s},Ee=function(e){for(var t,i,r=e.byteLength,n=[],a=1;a<r-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(n.push(a+2),a+=2):a++;if(0===n.length)return e;t=r-n.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===n[0]&&(s++,n.shift()),i[a]=e[s];return i},ke=4,we=function e(){e.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new Pe(0,0),new Pe(0,1),new Pe(1,0),new Pe(1,1)],this.reset(),this.ccStreams_.forEach(function(e){e.on("data",this.trigger.bind(this,"data")),e.on("done",this.trigger.bind(this,"done"))},this)};(we.prototype=new Z).push=function(e){var t,i,r;if("sei_rbsp"===e.nalUnitType&&(t=be(e.escapedRBSP)).payloadType===ke&&(i=Te(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));r=Se(e.pts,i),this.captionPackets_=this.captionPackets_.concat(r),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},we.prototype.flush=function(){this.captionPackets_.length?(this.captionPackets_.forEach(function(e,t){e.presortIndex=t}),this.captionPackets_.sort(function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts}),this.captionPackets_.forEach(function(e){e.type<2&&this.dispatchCea608Packet(e)},this),this.captionPackets_.length=0,this.ccStreams_.forEach(function(e){e.flush()},this)):this.ccStreams_.forEach(function(e){e.flush()},this)},we.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(e){e.reset()})},we.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},we.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},we.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},we.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)};var Ce={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Le=function(e){return null===e?"":(e=Ce[e]||e,String.fromCharCode(e))},Ae=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Re=function(){for(var e=[],t=15;t--;)e.push("");return e},Pe=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,r,n,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),r=t>>>8,n=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Re();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Re();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Re()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(r,n))a=Le((r=(3&r)<<8)|n),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(r,n))"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=Le((r=(3&r)<<8)|n),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(r,n))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&n)&&this.addFormatting(e.pts,["i"]),1==(1&n)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(r,n))this.column_+=3&n;else if(this.isPAC(r,n)){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&n&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(n)&&14==(14&n)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(r)&&(0===n&&(n=null),a=Le(r),a+=Le(n),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Pe.prototype=new Z,Pe.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_})},Pe.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_=[]},Pe.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_},Pe.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Pe.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Pe.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Pe.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Pe.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},Pe.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Pe.prototype.isNormalChar=function(e){return e>=32&&e<=127},Pe.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Re(),this.displayed_=Re()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},Pe.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce(function(e,t){return e+"<"+t+">"},"");this[this.mode_](e,i)},Pe.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)}},Pe.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Pe.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Pe.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_]=""},Pe.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var De={CaptionStream:we,Cea608Stream:Pe},Ie={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},xe=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},Oe=function e(t){var i,r;e.prototype.init.call(this),this.type_=t,this.push=function(e){e.type===this.type_&&(void 0===r&&(r=e.dts),e.dts=xe(e.dts,r),e.pts=xe(e.pts,r),i=e.dts,this.trigger("data",e))},this.flush=function(){r=i,this.trigger("done")},this.discontinuity=function(){r=void 0,i=void 0}};Oe.prototype=new Z;var Me,Ue=Oe,Be=function(e,t,i){var r,n="";for(r=t;r<i;r++)n+="%"+("00"+e[r].toString(16)).slice(-2);return n},Ne=function(e,t,i){return decodeURIComponent(Be(e,t,i))},Fe=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},je={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=Ne(e.data,1,t),e.value=Ne(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=Ne(e.data,1,t),e.url=Ne(e.data,t+1,e.data.length);break}},PRIV:function(e){var t,i;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(i=e.data,unescape(Be(i,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Me=function(e){var t,i={debug:!(!e||!e.debug),descriptor:e&&e.descriptor},r=0,n=[],a=0;if(Me.prototype.init.call(this),this.dispatchType=Ie.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,s,o,l,u;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(a=0,n.length=0),0===n.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))i.debug&&console.log("Skipping unrecognized metadata packet");else if(n.push(e),a+=e.data.byteLength,1===n.length&&(r=Fe(e.data.subarray(6,10)),r+=10),!(a<r)){for(t={data:new Uint8Array(r),frames:[],pts:n[0].pts,dts:n[0].dts},u=0;u<r;)t.data.set(n[0].data.subarray(0,r-u),u),u+=n[0].data.byteLength,a-=n[0].data.byteLength,n.shift();s=10,64&t.data[5]&&(s+=4,s+=Fe(t.data.subarray(10,14)),r-=Fe(t.data.subarray(16,20)));do{if((o=Fe(t.data.subarray(s+4,s+8)))<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");if((l={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=l.id,je[l.id]&&(je[l.id](l),"com.apple.streaming.transportStreamTimestamp"===l.owner)){var c=l.data,d=(1&c[3])<<30|c[4]<<22|c[5]<<14|c[6]<<6|c[7]>>>2;d*=4,d+=3&c[7],l.timeStamp=d,void 0===t.pts&&void 0===t.dts&&(t.pts=l.timeStamp,t.dts=l.timeStamp),this.trigger("timestamp",l)}t.frames.push(l),s+=10,s+=o}while(s<r);this.trigger("data",t)}}}).prototype=new Z;var Ge,Ve,He,Ke=Me,qe=Ue;(Ge=function(){var e=new Uint8Array(188),t=0;Ge.prototype.init.call(this),this.push=function(i){var r,n=0,a=188;for(t?((r=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),r.set(i,t),t=0):r=i;a<r.byteLength;)71!==r[n]||71!==r[a]?(n++,a++):(this.trigger("data",r.subarray(n,a)),n+=188,a+=188);n<r.byteLength&&(e.set(r.subarray(n),0),t=r.byteLength-n)},this.flush=function(){188===t&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")}}).prototype=new Z,(Ve=function(){var e,t,i,r;Ve.prototype.init.call(this),r=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,r){var n=0;r.payloadUnitStartIndicator&&(n+=e[n]+1),"pat"===r.type?t(e.subarray(n),r):i(e.subarray(n),r)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],r.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=r.pmtPid},i=function(e,t){var i,n;if(1&e[5]){for(r.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,n=12+((15&e[10])<<8|e[11]);n<i;){var a=e[n],s=(31&e[n+1])<<8|e[n+2];a===Ie.H264_STREAM_TYPE&&null===r.programMapTable.video?r.programMapTable.video=s:a===Ie.ADTS_STREAM_TYPE&&null===r.programMapTable.audio?r.programMapTable.audio=s:a===Ie.METADATA_STREAM_TYPE&&(r.programMapTable["timed-metadata"][s]=a),n+=5+((15&e[n+3])<<8|e[n+4])}t.programMapTable=r.programMapTable}},this.push=function(t){var i={},r=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(r+=t[r]+1),0===i.pid)i.type="pat",e(t.subarray(r),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(r),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,r,i]):this.processPes_(t,r,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Ie.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ie.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new Z,Ve.STREAM_TYPES={h264:27,adts:15},(He=function(){var e=this,t={data:[],size:0},i={data:[],size:0},r={data:[],size:0},n=function(t,i,r){var n,a,s=new Uint8Array(t.size),o={type:i},l=0,u=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,l=0;l<t.data.length;l++)a=t.data[l],s.set(a.data,u),u+=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]),n="video"===i||o.packetLength<=t.size,(r||n)&&(t.size=0,t.data.length=0),n&&e.trigger("data",o)}};He.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var e,s;switch(a.streamType){case Ie.H264_STREAM_TYPE:case Ie.H264_STREAM_TYPE:e=t,s="video";break;case Ie.ADTS_STREAM_TYPE:e=i,s="audio";break;case Ie.METADATA_STREAM_TYPE:e=r,s="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&n(e,s,!0),e.data.push(a),e.size+=a.data.byteLength},pmt:function(){var t={type:"metadata",tracks:[]},i=a.programMapTable;null!==i.video&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+i.video,codec:"avc",type:"video"}),null!==i.audio&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+i.audio,codec:"adts",type:"audio"}),e.trigger("data",t)}})[a.type]()},this.flush=function(){n(t,"video"),n(i,"audio"),n(r,"timed-metadata"),this.trigger("done")}}).prototype=new Z;var We={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:Ge,TransportParseStream:Ve,ElementaryStream:He,TimestampRolloverStream:qe,CaptionStream:De.CaptionStream,Cea608Stream:De.Cea608Stream,MetadataStream:Ke};for(var ze in Ie)Ie.hasOwnProperty(ze)&&(We[ze]=Ie[ze]);var Ye,Xe=We,$e=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(Ye=function(){var e;Ye.prototype.init.call(this),this.push=function(t){var i,r,n,a,s,o,l=0,u=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;l+5<e.length;)if(255===e[l]&&240==(246&e[l+1])){if(r=2*(1&~e[l+1]),i=(3&e[l+3])<<11|e[l+4]<<3|(224&e[l+5])>>5,o=9e4*(s=1024*(1+(3&e[l+6])))/$e[(60&e[l+2])>>>2],n=l+i,e.byteLength<n)return;if(this.trigger("data",{pts:t.pts+u*o,dts:t.dts+u*o,sampleCount:s,audioobjecttype:1+(e[l+2]>>>6&3),channelcount:(1&e[l+2])<<2|(192&e[l+3])>>>6,samplerate:$e[(60&e[l+2])>>>2],samplingfrequencyindex:(60&e[l+2])>>>2,samplesize:16,data:e.subarray(l+7+r,n)}),e.byteLength===n)return void(e=void 0);u++,e=e.subarray(n)}else l++},this.flush=function(){this.trigger("done")}}).prototype=new Z;var Qe,Je,Ze,et=Ye,tt=function(e){var t=e.byteLength,i=0,r=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+r},this.loadWord=function(){var n=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(n,n+s)),i=new DataView(a.buffer).getUint32(0),r=8*s,t-=s},this.skipBits=function(e){var n;r>e?(i<<=e,r-=e):(e-=r,e-=8*(n=Math.floor(e/8)),t-=n,this.loadWord(),i<<=e,r-=e)},this.readBits=function(e){var n=Math.min(r,e),a=i>>>32-n;return(r-=n)>0?i<<=n:t>0&&this.loadWord(),(n=e-n)>0?a<<n|this.readBits(n):a},this.skipLeadingZeros=function(){var e;for(e=0;e<r;++e)if(0!=(i&2147483648>>>e))return i<<=e,r-=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()};(Je=function(){var e,t,i=0;Je.prototype.init.call(this),this.push=function(r){var n;for(t?((n=new Uint8Array(t.byteLength+r.data.byteLength)).set(t),n.set(r.data,t.byteLength),t=n):t=r.data;i<t.byteLength-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<t.byteLength;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<t.length);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")}}).prototype=new Z,Ze={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Qe=function(){var e,t,i,r,n,a,s,o=new Je;Qe.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,r=e.dts,o.push(e))},o.on("data",function(s){var o={trackId:t,pts:i,dts:r,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=n(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=n(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)}),o.on("done",function(){e.trigger("done")}),this.flush=function(){o.flush()},s=function(e,t){var i,r=8,n=8;for(i=0;i<e;i++)0!==n&&(n=(r+t.readExpGolomb()+256)%256),r=0===n?r:n},n=function(e){for(var t,i,r=e.byteLength,n=[],a=1;a<r-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(n.push(a+2),a+=2):a++;if(0===n.length)return e;t=r-n.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===n[0]&&(s++,n.shift()),i[a]=e[s];return i},a=function(e){var t,i,r,n,a,o,l,u,c,d,h,f,p,m=0,g=0,v=0,y=0,_=1;if(i=(t=new tt(e)).readUnsignedByte(),n=t.readUnsignedByte(),r=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),Ze[i]&&(3===(a=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(h=3!==a?8:12,p=0;p<h;p++)t.readBoolean()&&s(p<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),l=t.readUnsignedExpGolomb(),p=0;p<l;p++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),u=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),0===(d=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb(),y=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:f=[1,1];break;case 2:f=[12,11];break;case 3:f=[10,11];break;case 4:f=[16,11];break;case 5:f=[40,33];break;case 6:f=[24,11];break;case 7:f=[20,11];break;case 8:f=[32,11];break;case 9:f=[80,33];break;case 10:f=[18,11];break;case 11:f=[15,11];break;case 12:f=[64,33];break;case 13:f=[160,99];break;case 14:f=[4,3];break;case 15:f=[3,2];break;case 16:f=[2,1];break;case 255:f=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}f&&(_=f[0]/f[1])}return{profileIdc:i,levelIdc:r,profileCompatibility:n,width:Math.ceil((16*(u+1)-2*m-2*g)*_),height:(2-d)*(c+1)*16-2*v-2*y}}}).prototype=new Z;var it,rt={H264Stream:Qe,NalByteStream:Je},nt=function(e){return e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)},at=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&e[t+5])>>4?i+20:i+10},st=function(e,t){var i=(224&e[t+5])>>5,r=e[t+4]<<3;return 6144&e[t+3]|r|i};(it=function(){var e=new Uint8Array,t=0;it.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var r,n,a,s,o=0,l=0;for(e.length?(s=e.length,(e=new Uint8Array(i.byteLength+s)).set(e.subarray(0,s)),e.set(i,s)):e=i;e.length-l>=3;)if(e[l]!=="I".charCodeAt(0)||e[l+1]!=="D".charCodeAt(0)||e[l+2]!=="3".charCodeAt(0))if(255!=(255&e[l])||240!=(240&e[l+1]))l++;else{if(e.length-l<7)break;if(l+(o=st(e,l))>e.length)break;a={type:"audio",data:e.subarray(l,l+o),pts:t,dts:t},this.trigger("data",a),l+=o}else{if(e.length-l<10)break;if(l+(o=at(e,l))>e.length)break;n={type:"timed-metadata",data:e.subarray(l,l+o)},this.trigger("data",n),l+=o}r=e.length-l,e=r>0?e.subarray(l):new Uint8Array}}).prototype=new Z;var ot,lt,ut,ct,dt=it,ht=rt.H264Stream,ft=nt,pt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],mt=["width","height","profileIdc","levelIdc","profileCompatibility"],gt=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},vt=function(e,t,i,r,n,a){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(r-t),pts:e+(n-i)},prependedContentDuration:a,baseMediaDecodeTime:e}};(lt=function(e,t){var i=[],r=0,n=0,a=0,s=1/0;t=t||{},lt.prototype.init.call(this),this.push=function(t){_e(e,t),e&&pt.forEach(function(i){e[i]=t[i]}),i.push(t)},this.setEarliestDts=function(t){n=t-e.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){a=e},this.flush=function(){var o,l,u,c;0!==i.length?(o=pe(i,e,n),e.baseMediaDecodeTime=ye(e,t.keepOriginalTimestamps),fe(e,o,a,s),e.samples=me(o),u=K.mdat(ge(o)),i=[],l=K.moof(r,[e]),c=new Uint8Array(l.byteLength+u.byteLength),r++,c.set(l),c.set(u,l.byteLength),ve(e),this.trigger("data",{track:e,boxes:c}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")}}).prototype=new Z,(ot=function(e,t){var i,r,n=0,a=[],s=[];t=t||{},ot.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){_e(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],mt.forEach(function(t){e[t]=i[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),a.push(t)},this.flush=function(){for(var i,r,o,l,u,c,d,h,f=0;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0===a.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(i=te(a),(o=ie(i))[0][0].keyFrame||((r=this.getGopForFusion_(a[0],e))?(f=r.duration,o.unshift(r),o.byteLength+=r.byteLength,o.nalCount+=r.nalCount,o.pts=r.pts,o.dts=r.dts,o.duration+=r.duration):o=re(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=ne(o),u=K.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),l=K.moof(n,[e]),c=new Uint8Array(l.byteLength+u.byteLength),n++,c.set(l),c.set(u,l.byteLength),this.trigger("data",{track:e,boxes:c}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){ve(e),i=void 0,r=void 0},this.getGopForFusion_=function(t){var i,r,n,a,s,o=1/0;for(s=0;s<this.gopCache_.length;s++)n=(a=this.gopCache_[s]).gop,e.pps&&gt(e.pps[0],a.pps[0])&&e.sps&&gt(e.sps[0],a.sps[0])&&(n.dts<e.timelineStartInfo.dts||(i=t.dts-n.dts-n.duration)>=-1e4&&i<=45e3&&(!r||o>i)&&(r=a,o=i));return r?r.gop:null},this.alignGopsAtStart_=function(e){var t,i,r,n,a,o,l,u;for(a=e.byteLength,o=e.nalCount,l=e.duration,t=i=0;t<s.length&&i<e.length&&(r=s[t],n=e[i],r.pts!==n.pts);)n.pts>r.pts?t++:(i++,a-=n.byteLength,o-=n.nalCount,l-=n.duration);return 0===i?e:i===e.length?null:((u=e.slice(i)).byteLength=a,u.duration=l,u.nalCount=o,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(e){var t,i,r,n,a,o,l;for(t=s.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(r=s[t],n=e[i],r.pts===n.pts){o=!0;break}r.pts>n.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(l=o?i:a))return e;var u=e.slice(l),c=u.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 u.byteLength=c.byteLength,u.duration=c.duration,u.nalCount=c.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(e){s=e}}).prototype=new Z,(ct=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps&&(this.keepOriginalTimestamps=e.keepOriginalTimestamps),this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ct.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBoxes.push(e.boxes),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track),void("audio"===e.track.type&&(this.audioTrack=e.track)))}}).prototype=new Z,ct.prototype.flush=function(e){var t,i,r,n,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,r=K.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(r.byteLength),s.initSegment.set(r),s.data=new Uint8Array(this.pendingBytes),n=0;n<this.pendingBoxes.length;n++)s.data.set(this.pendingBoxes[n],a),a+=this.pendingBoxes[n].byteLength;for(n=0;n<this.pendingCaptions.length;n++)(t=this.pendingCaptions[n]).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(n=0;n<this.pendingMetadata.length;n++)(i=this.pendingMetadata[n]).cueTime=i.pts,this.keepOriginalTimestamps||(i.cueTime-=o),i.cueTime/=9e4,s.metadata.push(i);s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},(ut=function(e){var t,i,r=this,n=!0;ut.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(n){"timed-metadata"!==n.type||t.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:r.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new lt(i,e),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var n={};this.transmuxPipeline_=n,n.type="ts",n.metadataStream=new Xe.MetadataStream,n.packetStream=new Xe.TransportPacketStream,n.parseStream=new Xe.TransportParseStream,n.elementaryStream=new Xe.ElementaryStream,n.videoTimestampRolloverStream=new Xe.TimestampRolloverStream("video"),n.audioTimestampRolloverStream=new Xe.TimestampRolloverStream("audio"),n.timedMetadataTimestampRolloverStream=new Xe.TimestampRolloverStream("timed-metadata"),n.adtsStream=new et,n.h264Stream=new ht,n.captionStream=new Xe.CaptionStream,n.coalesceStream=new ct(e,n.metadataStream),n.headOfPipeline=n.packetStream,n.packetStream.pipe(n.parseStream).pipe(n.elementaryStream),n.elementaryStream.pipe(n.videoTimestampRolloverStream).pipe(n.h264Stream),n.elementaryStream.pipe(n.audioTimestampRolloverStream).pipe(n.adtsStream),n.elementaryStream.pipe(n.timedMetadataTimestampRolloverStream).pipe(n.metadataStream).pipe(n.coalesceStream),n.h264Stream.pipe(n.captionStream).pipe(n.coalesceStream),n.elementaryStream.on("data",function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime;t&&!n.videoSegmentStream&&(n.coalesceStream.numberOfTracks++,n.videoSegmentStream=new ot(t,e),n.videoSegmentStream.on("timelineStartInfo",function(e){i&&(i.timelineStartInfo=e,n.audioSegmentStream.setEarliestDts(e.dts))}),n.videoSegmentStream.on("processedGopsInfo",r.trigger.bind(r,"gopInfo")),n.videoSegmentStream.on("segmentTimingInfo",r.trigger.bind(r,"videoSegmentTimingInfo")),n.videoSegmentStream.on("baseMediaDecodeTime",function(e){i&&n.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),n.h264Stream.pipe(n.videoSegmentStream).pipe(n.coalesceStream)),i&&!n.audioSegmentStream&&(n.coalesceStream.numberOfTracks++,n.audioSegmentStream=new lt(i,e),n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream))}}),n.coalesceStream.on("data",this.trigger.bind(this,"data")),n.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(r){var n=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=r),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,ve(i),e.keepOriginalTimestamps||(i.timelineStartInfo.baseMediaDecodeTime=r),n.audioTimestampRolloverStream&&n.audioTimestampRolloverStream.discontinuity()),t&&(n.videoSegmentStream&&(n.videoSegmentStream.gopCache_=[],n.videoTimestampRolloverStream.discontinuity()),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,ve(t),n.captionStream.reset(),e.keepOriginalTimestamps||(t.timelineStartInfo.baseMediaDecodeTime=r)),n.timedMetadataTimestampRolloverStream&&n.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.push=function(e){if(n){var t=ft(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),n=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){n=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new Z;var yt,_t,bt={Transmuxer:ut,VideoSegmentStream:ot,AudioSegmentStream:lt,AUDIO_PROPERTIES:pt,VIDEO_PROPERTIES:mt,generateVideoSegmentTimingInfo:vt},Tt=W.parseType,St=function(e){return new Date(1e3*e-20828448e5)},Et=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]}},kt={avc1:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:yt(e.subarray(78,e.byteLength))}},avcC:function(e){var t,i,r,n,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(r=6,n=0;n<o;n++)i=a.getUint16(r),r+=2,s.sps.push(new Uint8Array(e.subarray(r,r+i))),r+=i;for(t=e[r],r++,n=0;n<t;n++)i=a.getUint16(r),r+=2,s.pps.push(new Uint8Array(e.subarray(r,r+i))),r+=i;return s},btrt:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},esds:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),esId:e[6]<<8|e[7],streamPriority:31&e[8],decoderConfig:{objectProfileIndication:e[11],streamType:e[12]>>>2&63,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:e[26]>>>3&31,samplingFrequencyIndex:(7&e[26])<<1|e[27]>>>7&1,channelConfiguration:e[27]>>>3&15}}}},ftyp:function(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={majorBrand:Tt(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},r=8;r<e.byteLength;)i.compatibleBrands.push(Tt(e.subarray(r,r+4))),r+=4;return i},dinf:function(e){return{boxes:yt(e)}},dref:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),dataReferences:yt(e.subarray(8))}},hdlr:function(e){var t={version:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0),flags:new Uint8Array(e.subarray(1,4)),handlerType:Tt(e.subarray(8,12)),name:""},i=8;for(i=24;i<e.byteLength;i++){if(0===e[i]){i++;break}t.name+=String.fromCharCode(e[i])}return t.name=decodeURIComponent(escape(t.name)),t},mdat:function(e){return{byteLength:e.byteLength,nals:function(e){var t,i,r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=[];for(t=0;t+4<e.length;t+=i)if(i=r.getUint32(t),t+=4,i<=0)n.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&e[t]){case 1:n.push("slice_layer_without_partitioning_rbsp");break;case 5:n.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:n.push("sei_rbsp");break;case 7:n.push("seq_parameter_set_rbsp");break;case 8:n.push("pic_parameter_set_rbsp");break;case 9:n.push("access_unit_delimiter_rbsp");break;default:n.push("UNKNOWN NAL - "+e[t]&31)}return n}(e)}},mdhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=4,n={version:i.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};return 1===n.version?(r+=4,n.creationTime=St(i.getUint32(r)),r+=8,n.modificationTime=St(i.getUint32(r)),r+=4,n.timescale=i.getUint32(r),r+=8,n.duration=i.getUint32(r)):(n.creationTime=St(i.getUint32(r)),r+=4,n.modificationTime=St(i.getUint32(r)),r+=4,n.timescale=i.getUint32(r),r+=4,n.duration=i.getUint32(r)),r+=4,t=i.getUint16(r),n.language+=String.fromCharCode(96+(t>>10)),n.language+=String.fromCharCode(96+((992&t)>>5)),n.language+=String.fromCharCode(96+(31&t)),n},mdia:function(e){return{boxes:yt(e)}},mfhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sequenceNumber:e[4]<<24|e[5]<<16|e[6]<<8|e[7]}},minf:function(e){return{boxes:yt(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(i.streamDescriptor=yt(e.subarray(28))[0]),i},moof:function(e){return{boxes:yt(e)}},moov:function(e){return{boxes:yt(e)}},mvex:function(e){return{boxes:yt(e)}},mvhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,r={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===r.version?(i+=4,r.creationTime=St(t.getUint32(i)),i+=8,r.modificationTime=St(t.getUint32(i)),i+=4,r.timescale=t.getUint32(i),i+=8,r.duration=t.getUint32(i)):(r.creationTime=St(t.getUint32(i)),i+=4,r.modificationTime=St(t.getUint32(i)),i+=4,r.timescale=t.getUint32(i),i+=4,r.duration=t.getUint32(i)),i+=4,r.rate=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,r.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,i+=8,r.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,i+=24,r.nextTrackId=t.getUint32(i),r},pdin:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t<e.byteLength;t++)i.samples.push({dependsOn:(48&e[t])>>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return i},sidx:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8),earliestPresentationTime:i.getUint32(12),firstOffset:i.getUint32(16)},n=i.getUint16(22);for(t=24;n;t+=12,n--)r.references.push({referenceType:(128&e[t])>>>7,referencedSize:2147483647&i.getUint32(t),subsegmentDuration:i.getUint32(t+4),startsWithSap:!!(128&e[t+8]),sapType:(112&e[t+8])>>>4,sapDeltaTime:268435455&i.getUint32(t+8)});return r},smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:yt(e)}},stco:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},n=i.getUint32(4);for(t=8;n;t+=4,n--)r.chunkOffsets.push(i.getUint32(t));return r},stsc:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=i.getUint32(4),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;r;t+=12,r--)n.sampleToChunks.push({firstChunk:i.getUint32(t),samplesPerChunk:i.getUint32(t+4),sampleDescriptionIndex:i.getUint32(t+8)});return n},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:yt(e.subarray(8))}},stsz:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(t=12;t<e.byteLength;t+=4)r.entries.push(i.getUint32(t));return r},stts:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},n=i.getUint32(4);for(t=8;n;t+=8,n--)r.timeToSamples.push({sampleCount:i.getUint32(t),sampleDelta:i.getUint32(t+4)});return r},styp:function(e){return kt.ftyp(e)},tfdt:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:e[4]<<24|e[5]<<16|e[6]<<8|e[7]};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=e[8]<<24|e[9]<<16|e[10]<<8|e[11]),t},tfhd:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},n=1&r.flags[2],a=2&r.flags[2],s=8&r.flags[2],o=16&r.flags[2],l=32&r.flags[2],u=65536&r.flags[0],c=131072&r.flags[0];return t=8,n&&(t+=4,r.baseDataOffset=i.getUint32(12),t+=4),a&&(r.sampleDescriptionIndex=i.getUint32(t),t+=4),s&&(r.defaultSampleDuration=i.getUint32(t),t+=4),o&&(r.defaultSampleSize=i.getUint32(t),t+=4),l&&(r.defaultSampleFlags=i.getUint32(t)),u&&(r.durationIsEmpty=!0),!n&&c&&(r.baseDataOffsetIsMoof=!0),r},tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,r={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===r.version?(i+=4,r.creationTime=St(t.getUint32(i)),i+=8,r.modificationTime=St(t.getUint32(i)),i+=4,r.trackId=t.getUint32(i),i+=4,i+=8,r.duration=t.getUint32(i)):(r.creationTime=St(t.getUint32(i)),i+=4,r.modificationTime=St(t.getUint32(i)),i+=4,r.trackId=t.getUint32(i),i+=4,i+=4,r.duration=t.getUint32(i)),i+=4,i+=8,r.layer=t.getUint16(i),i+=2,r.alternateGroup=t.getUint16(i),i+=2,r.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=2,i+=2,r.matrix=new Uint32Array(e.subarray(i,i+36)),i+=36,r.width=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,r.height=t.getUint16(i)+t.getUint16(i+2)/16,r},traf:function(e){return{boxes:yt(e)}},trak:function(e){return{boxes:yt(e)}},trex:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:3&e[20],sampleIsDependedOn:(192&e[21])>>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],l=4&i.flags[1],u=8&i.flags[1],c=r.getUint32(4),d=8;for(n&&(i.dataOffset=r.getInt32(d),d+=4),a&&c&&(t={flags:Et(e.subarray(d,d+4))},d+=4,s&&(t.duration=r.getUint32(d),d+=4),o&&(t.size=r.getUint32(d),d+=4),u&&(t.compositionTimeOffset=r.getUint32(d),d+=4),i.samples.push(t),c--);c--;)t={},s&&(t.duration=r.getUint32(d),d+=4),o&&(t.size=r.getUint32(d),d+=4),l&&(t.flags=Et(e.subarray(d,d+4)),d+=4),u&&(t.compositionTimeOffset=r.getUint32(d),d+=4),i.samples.push(t);return i},"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}},wt={inspect:yt=function(e){for(var t,i,r,n,a,s=0,o=[],l=new ArrayBuffer(e.length),u=new Uint8Array(l),c=0;c<e.length;++c)u[c]=e[c];for(t=new DataView(l);s<e.byteLength;)i=t.getUint32(s),r=Tt(e.subarray(s+4,s+8)),n=i>1?s+i:e.byteLength,(a=(kt[r]||function(e){return{data:e}})(e.subarray(s+8,n))).size=i,a.type=r,o.push(a),s=n;return o},textify:_t=function(e,t){var i;return t=t||0,i=new Array(2*t+1).join(" "),e.map(function(e,r){return i+e.type+"\n"+Object.keys(e).filter(function(e){return"type"!==e&&"boxes"!==e}).map(function(t){var r=i+" "+t+": ",n=e[t];if(n instanceof Uint8Array||n instanceof Uint32Array){var a=Array.prototype.slice.call(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)).map(function(e){return" "+("00"+e.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return a?1===a.length?r+"<"+a.join("").slice(1)+">":r+"<\n"+a.map(function(e){return i+" "+e}).join("\n")+"\n"+i+" >":r+"<>"}return r+JSON.stringify(n,null,2).split("\n").map(function(e,t){return 0===t?e:i+" "+e}).join("\n")}).join("\n")+(e.boxes?"\n"+_t(e.boxes,t+1):"")}).join("\n")},parseTfdt:kt.tfdt,parseHdlr:kt.hdlr,parseTfhd:kt.tfhd,parseTrun:kt.trun,parseSidx:kt.sidx},Ct=Ee,Lt=De.CaptionStream,At=function(e,t){for(var i=e,r=0;r<t.length;r++){var n=t[r];if(i<n.size)return n;i-=n.size}return null},Rt=function(e,t){var i=W.findBox(e,["moof","traf"]),r={},n=[];return W.findBox(e,["mdat"]).forEach(function(e,t){var r=i[t];n.push({mdat:e,traf:r})}),n.forEach(function(e){var i,n=e.mdat,a=e.traf,s=W.findBox(a,["tfhd"]),o=wt.parseTfhd(s[0]),l=o.trackId,u=W.findBox(a,["tfdt"]),c=u.length>0?wt.parseTfdt(u[0]).baseMediaDecodeTime:0,d=W.findBox(a,["trun"]);t===l&&d.length>0&&(i=function(e,t,i){var r,n,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),l=[];for(n=0;n+4<e.length;n+=a)if(a=o.getUint32(n),n+=4,!(a<=0))switch(31&e[n]){case 6:var u=e.subarray(n+1,n+1+a),c=At(n,t);r={nalUnitType:"sei_rbsp",size:a,data:u,escapedRBSP:Ct(u),trackId:i},c?(r.pts=c.pts,r.dts=c.dts,s=c):(r.pts=s.pts,r.dts=s.dts),l.push(r)}return l}(n,function(e,t,i){var r=t,n=i.defaultSampleDuration||0,a=i.defaultSampleSize||0,s=i.trackId,o=[];return e.forEach(function(e){var t=wt.parseTrun(e).samples;t.forEach(function(e){void 0===e.duration&&(e.duration=n),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=r,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),e.pts=r+e.compositionTimeOffset,r+=e.duration}),o=o.concat(t)}),o}(d,c,o),l),r[l]||(r[l]=[]),r[l]=r[l].concat(i))}),r},Pt={generator:K,probe:W,Transmuxer:bt.Transmuxer,AudioSegmentStream:bt.AudioSegmentStream,VideoSegmentStream:bt.VideoSegmentStream,CaptionParser:function(){var e,t,i,r,n,a=!1;this.isInitialized=function(){return a},this.init=function(){e=new Lt,a=!0,e.on("data",function(e){e.startTime=e.startPts/r,e.endTime=e.endPts/r,n.captions.push(e),n.captionStreams[e.stream]=!0})},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length||i===e[0]&&r===t[i])},this.parse=function(e,a,s){var o;if(!this.isInitialized())return null;if(!a||!s)return null;if(this.isNewInit(a,s))i=a[0],r=s[i];else if(!i||!r)return t.push(e),null;for(;t.length>0;){var l=t.shift();this.parse(l,a,s)}return null!==(o=function(e,t,i){return t?{seiNals:Rt(e,t)[t],timescale:i}:null}(e,i,r))&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),n):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(){n.captions=[],n.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,r=null,n?this.clearParsedCaptions():n={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()}},Dt=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},It=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),xt=function(){function e(t,i){Dt(this,e),this.options=i||{},this.self=t,this.init()}return It(e,[{key:"init",value:function(){var e,t;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Pt.Transmuxer(this.options),e=this.self,(t=this.transmuxer).on("data",function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};var r=t.data;t.data=r.buffer,e.postMessage({action:"data",segment:t,byteOffset:r.byteOffset,byteLength:r.byteLength},[t.data])}),t.captionStream&&t.captionStream.on("data",function(t){e.postMessage({action:"caption",data:t})}),t.on("done",function(t){e.postMessage({action:"done"})}),t.on("gopInfo",function(t){e.postMessage({action:"gopInfo",gopInfo:t})}),t.on("videoSegmentTimingInfo",function(t){e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})})}},{key:"push",value:function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}},{key:"reset",value:function(){this.init()}},{key:"setTimestampOffset",value:function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4*t))}},{key:"setAudioAppendStart",value:function(e){this.transmuxer.setAudioAppendStart(Math.ceil(9e4*e.appendStart))}},{key:"flush",value:function(e){this.transmuxer.flush()}},{key:"resetCaptions",value:function(){this.transmuxer.resetCaptions()}},{key:"alignGopsWith",value:function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}]),e}();new function(e){e.onmessage=function(t){"init"===t.data.action&&t.data.options?this.messageHandlers=new xt(e,t.data.options):(this.messageHandlers||(this.messageHandlers=new xt(e)),t.data&&t.data.action&&"init"!==t.data.action&&this.messageHandlers[t.data.action]&&this.messageHandlers[t.data.action](t.data))}}(i)}()}),Ed={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},kd=function(e){return e.map(function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})})},wd=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i={codecCount:0};return i.codecCount=t.split(",").length,i.codecCount=i.codecCount||2,(e=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(t))&&(i.videoCodec=e[2],i.videoObjectTypeIndicator=e[3]),i.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(t),i.audioProfile=i.audioProfile&&i.audioProfile[2],i},Cd=function(e,t,i){return e+"/"+t+'; codecs="'+i.filter(function(e){return!!e}).join(", ")+'"'},Ld=function(e,t){var i=function(e){return e.segments&&e.segments.length&&e.segments[0].map?"mp4":"mp2t"}(t),r=function(e){var t=e.attributes||{};return t.CODECS?wd(t.CODECS):Ed}(t),n=t.attributes||{},a=!0,s=!1;if(!t)return[];if(e.mediaGroups.AUDIO&&n.AUDIO){var o=e.mediaGroups.AUDIO[n.AUDIO];if(o)for(var l in s=!0,a=!1,o)if(!o[l].uri&&!o[l].playlists){a=!0;break}}s&&!r.audioProfile&&(a||(r.audioProfile=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var r in i){var n=i[r];if(n.default&&n.playlists)return wd(n.playlists[0].attributes.CODECS).audioProfile}return null}(e,n.AUDIO)),r.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)"),r.audioProfile=Ed.audioProfile));var u={};r.videoCodec&&(u.video=""+r.videoCodec+r.videoObjectTypeIndicator),r.audioProfile&&(u.audio="mp4a.40."+r.audioProfile);var c=Cd("audio",i,[u.audio]),d=Cd("video",i,[u.video]),h=Cd("video",i,[u.video,u.audio]);return s?!a&&u.video?[d,c]:a||u.video?[h,c]:[c,c]:u.video?[h]:[c]},Ad=function(e){return/mp4a\.\d+.\d+/i.test(e)},Rd=function(e){return/avc1\.[\da-f]+/i.test(e)},Pd=function(e,t,i){var r=null,n=null,a=0,s=[],o=[];if(!e&&!t)return cs.createTimeRange();if(!e)return t.buffered;if(!t)return e.buffered;if(i)return e.buffered;if(0===e.buffered.length&&0===t.buffered.length)return cs.createTimeRange();for(var l=e.buffered,u=t.buffered,c=l.length;c--;)s.push({time:l.start(c),type:"start"}),s.push({time:l.end(c),type:"end"});for(c=u.length;c--;)s.push({time:u.start(c),type:"start"}),s.push({time:u.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&&(r=s[c].time):"end"===s[c].type&&1===--a&&(n=s[c].time),null!==r&&null!==n&&(o.push([r,n]),r=null,n=null);return cs.createTimeRanges(o)},Dd=function(e){function t(e,i){fc(this,t);var r=gc(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,cs.EventTarget));r.timestampOffset_=0,r.pendingBuffers_=[],r.bufferUpdating_=!1,r.mediaSource_=e,r.codecs_=i,r.audioCodec_=null,r.videoCodec_=null,r.audioDisabled_=!1,r.appendAudioInitSegment_=!0,r.gopBuffer_=[],r.timeMapping_=0,r.safeAppend_=cs.browser.IE_VERSION>=11;var n={remux:!1,alignGopsAtEnd:r.safeAppend_};return r.codecs_.forEach(function(e){Ad(e)?r.audioCodec_=e:Rd(e)&&(r.videoCodec_=e)}),r.transmuxer_=new Sd,r.transmuxer_.postMessage({action:"init",options:n}),r.transmuxer_.onmessage=function(e){return"data"===e.data.action?r.data_(e):"done"===e.data.action?r.done_(e):"gopInfo"===e.data.action?r.appendGopInfo_(e):"videoSegmentTimingInfo"===e.data.action?r.videoSegmentTimingInfo_(e.data.videoSegmentTimingInfo):void 0},Object.defineProperty(r,"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(r,"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(r,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(r,"buffered",{get:function(){return Pd(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}}),r}return mc(t,e),pc(t,[{key:"data_",value:function(e){var t=e.data.segment;t.data=new Uint8Array(t.data,e.data.byteOffset,e.data.byteLength),t.initSegment=new Uint8Array(t.initSegment.data,t.initSegment.byteOffset,t.initSegment.byteLength),function(e,t,i){var r=t.player_;if(i.captions&&i.captions.length)for(var n in e.inbandTextTracks_||(e.inbandTextTracks_={}),i.captionStreams)if(!e.inbandTextTracks_[n]){r.tech_.trigger({type:"usage",name:"hls-608"});var a=r.textTracks().getTrackById(n);e.inbandTextTracks_[n]=a||r.addRemoteTextTrack({kind:"captions",id:n,label:n},!1).track}i.metadata&&i.metadata.length&&!e.metadataTrack_&&(e.metadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=i.metadata.dispatchType)}(this,this.mediaSource_,t),this.pendingBuffers_.push(t)}},{key:"done_",value:function(e){"closed"!==this.mediaSource_.readyState?this.processPendingSegments_():this.pendingBuffers_.length=0}},{key:"videoSegmentTimingInfo_",value:function(e){var t={start:{decode:e.start.dts/9e4,presentation:e.start.pts/9e4},end:{decode:e.end.dts/9e4,presentation:e.end.pts/9e4},baseMediaDecodeTime:e.baseMediaDecodeTime/9e4};e.prependedContentDuration&&(t.prependedContentDuration=e.prependedContentDuration/9e4),this.trigger({type:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}},{key:"createRealSourceBuffers_",value:function(){var e=this,t=["audio","video"];t.forEach(function(i){if(e[i+"Codec_"]&&!e[i+"Buffer_"]){var r=null;if(e.mediaSource_[i+"Buffer_"])(r=e.mediaSource_[i+"Buffer_"]).updating=!1;else{var n=i+'/mp4;codecs="'+e[i+"Codec_"]+'"';r=function(e,t){var i=e.addSourceBuffer(t),r=Object.create(null);r.updating=!1,r.realBuffer_=i;var n=function(e){"function"==typeof i[e]?r[e]=function(){return i[e].apply(i,arguments)}:void 0===r[e]&&Object.defineProperty(r,e,{get:function(){return i[e]},set:function(t){return i[e]=t}})};for(var a in i)n(a);return r}(e.mediaSource_.nativeMediaSource_,n),e.mediaSource_[i+"Buffer_"]=r}e[i+"Buffer_"]=r,["update","updatestart","updateend"].forEach(function(n){r.addEventListener(n,function(){if("audio"!==i||!e.audioDisabled_)return"updateend"===n&&(e[i+"Buffer_"].updating=!1),t.every(function(t){return!("audio"!==t||!e.audioDisabled_)||(i===t||!e[t+"Buffer_"]||!e[t+"Buffer_"].updating)})?e.trigger(n):void 0})})}})}},{key:"appendBuffer",value:function(e){if(this.bufferUpdating_=!0,this.audioBuffer_&&this.audioBuffer_.buffered.length){var t=this.audioBuffer_.buffered;this.transmuxer_.postMessage({action:"setAudioAppendStart",appendStart:t.end(t.length-1)})}this.videoBuffer_&&this.transmuxer_.postMessage({action:"alignGopsWith",gopsToAlignWith:function(e,t,i){if(void 0===t||null===t||!e.length)return[];var r=Math.ceil(9e4*(t-i+3)),n=void 0;for(n=0;n<e.length&&!(e[n].pts>r);n++);return e.slice(n)}(this.gopBuffer_,this.mediaSource_.player_?this.mediaSource_.player_.currentTime():null,this.timeMapping_)}),this.transmuxer_.postMessage({action:"push",data:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength},[e.buffer]),this.transmuxer_.postMessage({action:"flush"})}},{key:"appendGopInfo_",value:function(e){this.gopBuffer_=function(e,t,i){if(!t.length)return e;if(i)return t.slice();for(var r=t[0].pts,n=0;n<e.length&&!(e[n].pts>=r);n++);return e.slice(0,n).concat(t)}(this.gopBuffer_,e.data.gopInfo,this.safeAppend_)}},{key:"remove",value:function(e,t){if(this.videoBuffer_&&(this.videoBuffer_.updating=!0,this.videoBuffer_.remove(e,t),this.gopBuffer_=function(e,t,i,r){for(var n=Math.ceil(9e4*(t-r)),a=Math.ceil(9e4*(i-r)),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var l=o+1;l--&&!(e[l].pts<=n););return l=Math.max(l,0),s.splice(l,o-l+1),s}(this.gopBuffer_,e,t,this.timeMapping_)),!this.audioDisabled_&&this.audioBuffer_&&(this.audioBuffer_.updating=!0,this.audioBuffer_.remove(e,t)),ld(e,t,this.metadataTrack_),this.inbandTextTracks_)for(var i in this.inbandTextTracks_)ld(e,t,this.inbandTextTracks_[i])}},{key:"processPendingSegments_",value:function(){var e={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]},t="";e=this.pendingBuffers_.reduce(function(e,i){var r=i.type,n=i.data,a=i.initSegment;return e[r]?(e[r].segments.push(n),e[r].bytes+=n.byteLength,e[r].initSegment=a,i.captions&&(e.captions=e.captions.concat(i.captions)),i.info&&(e[r].info=i.info),i.metadata&&(e.metadata=e.metadata.concat(i.metadata)),e):(t=r,e)},e),t&&this.mediaSource_&&this.mediaSource_.player_&&this.mediaSource_.player_.trigger({type:"unknow-segment-type",name:t}),this.videoBuffer_||this.audioBuffer_||(0===e.video.bytes&&(this.videoCodec_=null),0===e.audio.bytes&&(this.audioCodec_=null),this.createRealSourceBuffers_()),e.audio.info&&this.mediaSource_.trigger({type:"audioinfo",info:e.audio.info}),e.video.info&&this.mediaSource_.trigger({type:"videoinfo",info:e.video.info}),this.appendAudioInitSegment_&&(!this.audioDisabled_&&this.audioBuffer_&&(e.audio.segments.unshift(e.audio.initSegment),e.audio.bytes+=e.audio.initSegment.byteLength),this.appendAudioInitSegment_=!1);var i=!1;this.videoBuffer_&&e.video.bytes?(e.video.segments.unshift(e.video.initSegment),e.video.bytes+=e.video.initSegment.byteLength,this.concatAndAppendSegments_(e.video,this.videoBuffer_)):!this.videoBuffer_||!this.audioDisabled_&&this.audioBuffer_||(i=!0),cd(this,e.captions,e.metadata),!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(e.audio,this.audioBuffer_),this.pendingBuffers_.length=0,i&&this.trigger("updateend"),this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(e,t){var i=0,r=void 0;if(e.bytes){r=new Uint8Array(e.bytes),e.segments.forEach(function(e){r.set(e,i),i+=e.byteLength});try{t.updating=!0,t.appendBuffer(r)}catch(e){this.mediaSource_.player_&&this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:e.message,originalError:e})}}}},{key:"abort",value:function(){this.videoBuffer_&&this.videoBuffer_.abort(),!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"reset"}),this.pendingBuffers_.length=0,this.bufferUpdating_=!1}}]),t}(cs.EventTarget),Id=function(i){function r(){fc(this,r);var i=gc(this,(r.__proto__||Object.getPrototypeOf(r)).call(this)),n=void 0;for(n in i.nativeMediaSource_=new e.MediaSource,i.nativeMediaSource_)"handle"===n||n in r.prototype||"function"!=typeof i.nativeMediaSource_[n]||(i[n]=i.nativeMediaSource_[n].bind(i.nativeMediaSource_));return i.duration_=NaN,Object.defineProperty(i,"duration",{get:function(){return this.duration_===1/0?this.duration_:this.nativeMediaSource_.duration},set:function(e){this.duration_=e,e===1/0||(this.nativeMediaSource_.duration=e)}}),Object.defineProperty(i,"seekable",{get:function(){return this.duration_===1/0?cs.createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}}),Object.defineProperty(i,"readyState",{get:function(){return this.nativeMediaSource_.readyState}}),Object.defineProperty(i,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}}),i.sourceBuffers=[],i.activeSourceBuffers_=[],i.updateActiveSourceBuffers_=function(){if(i.activeSourceBuffers_.length=0,1===i.sourceBuffers.length){var e=i.sourceBuffers[0];return e.appendAudioInitSegment_=!0,e.audioDisabled_=!e.audioCodec_,void i.activeSourceBuffers_.push(e)}for(var t=!1,r=!0,n=0;n<i.player_.audioTracks().length;n++){var a=i.player_.audioTracks()[n];if(a.enabled&&"main"!==a.kind){t=!0,r=!1;break}}i.sourceBuffers.forEach(function(e,n){if(e.appendAudioInitSegment_=!0,e.videoCodec_&&e.audioCodec_)e.audioDisabled_=t;else if(e.videoCodec_&&!e.audioCodec_)e.audioDisabled_=!0,r=!1;else if(!e.videoCodec_&&e.audioCodec_&&(e.audioDisabled_=n?r:!r,e.audioDisabled_))return;i.activeSourceBuffers_.push(e)})},i.onPlayerMediachange_=function(){i.sourceBuffers.forEach(function(e){e.appendAudioInitSegment_=!0})},i.onHlsReset_=function(){i.sourceBuffers.forEach(function(e){e.transmuxer_&&e.transmuxer_.postMessage({action:"resetCaptions"})})},i.onHlsSegmentTimeMapping_=function(e){i.sourceBuffers.forEach(function(t){return t.timeMapping_=e.mapping})},["sourceopen","sourceclose","sourceended"].forEach(function(e){this.nativeMediaSource_.addEventListener(e,this.trigger.bind(this))},i),i.on("sourceopen",function(e){var r=t.querySelector('[src="'+i.url_+'"]');r&&(i.player_=cs(r.parentNode),i.player_&&(i.player_.tech_.on("hls-reset",i.onHlsReset_),i.player_.tech_.on("hls-segment-time-mapping",i.onHlsSegmentTimeMapping_),i.player_.audioTracks&&i.player_.audioTracks()&&(i.player_.audioTracks().on("change",i.updateActiveSourceBuffers_),i.player_.audioTracks().on("addtrack",i.updateActiveSourceBuffers_),i.player_.audioTracks().on("removetrack",i.updateActiveSourceBuffers_)),i.player_.on("mediachange",i.onPlayerMediachange_)))}),i.on("sourceended",function(e){for(var t=ud(i.duration),r=0;r<i.sourceBuffers.length;r++){var n=i.sourceBuffers[r],a=n.metadataTrack_&&n.metadataTrack_.cues;a&&a.length&&(a[a.length-1].endTime=t)}}),i.on("sourceclose",function(e){this.sourceBuffers.forEach(function(e){e.transmuxer_&&e.transmuxer_.terminate()}),this.sourceBuffers.length=0,this.player_&&(this.player_.audioTracks&&this.player_.audioTracks()&&(this.player_.audioTracks().off("change",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("addtrack",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("removetrack",this.updateActiveSourceBuffers_)),this.player_.el_&&this.player_.off("mediachange",this.onPlayerMediachange_),this.player_.tech_&&this.player_.tech_.el_&&(this.player_.tech_.off("hls-reset",this.onHlsReset_),this.player_.tech_.off("hls-segment-time-mapping",this.onHlsSegmentTimeMapping_)))}),i}return mc(r,i),pc(r,[{key:"addSeekableRange_",value:function(e,t){var i=void 0;if(this.duration!==1/0)throw(i=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity")).name="InvalidStateError",i.code=11,i;(t>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=t)}},{key:"addSourceBuffer",value:function(e){var t=void 0,i=function(e){var t={type:"",parameters:{}},i=e.trim().split(";");return t.type=i.shift().trim(),i.forEach(function(e){var i=e.trim().split("=");if(i.length>1){var r=i[0].replace(/"/g,"").trim(),n=i[1].replace(/"/g,"").trim();t.parameters[r]=n}}),t}(e);if(/^(video|audio)\/mp2t$/i.test(i.type)){var r=[];i.parameters&&i.parameters.codecs&&(r=i.parameters.codecs.split(","),r=(r=kd(r)).filter(function(e){return Ad(e)||Rd(e)})),0===r.length&&(r=["avc1.4d400d","mp4a.40.2"]),t=new Dd(this,r),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}}]),r}(cs.EventTarget),xd=0;cs.mediaSources={};var Od=function(e,t){var i=cs.mediaSources[e];if(!i)throw new Error("Media Source not found (Video.js)");i.trigger({type:"sourceopen",swfId:t})},Md=function(){return!!e.MediaSource&&!!e.MediaSource.isTypeSupported&&e.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},Ud=function(){if(this.MediaSource={open:Od,supportsNativeMediaSources:Md},Md())return new Id;throw new Error("Cannot use create a virtual MediaSource for this video")};Ud.open=Od,Ud.supportsNativeMediaSources=Md;var Bd={createObjectURL:function(t){var i=void 0;return t instanceof Id?(i=e.URL.createObjectURL(t.nativeMediaSource_),t.url_=i,i):t instanceof Id?(i="blob:vjs-media-source/"+xd,xd++,cs.mediaSources[i]=t,i):(i=e.URL.createObjectURL(t),t.url_=i,i)}};cs.MediaSource=Ud,cs.URL=Bd;var Nd=cs.EventTarget,Fd=cs.mergeOptions,jd=function(e,t){for(var i=void 0,r=Fd(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),n=0;n<t.playlists.length;n++){var a=Sc(r,t.playlists[n]);a?r=a:i=!0}return Tc(t,function(e,t,n,a){if(e.playlists&&e.playlists.length){var s=e.playlists[0].uri,o=Sc(r,e.playlists[0]);o&&((r=o).mediaGroups[t][n][a].playlists[0]=r.playlists[s],i=!1)}}),i?null:r},Gd=function(e){var t=e.byterange.offset+e.byterange.length-1;return e.uri+"-"+e.byterange.offset+"-"+t},Vd=function(e,t){var i,r,n={};for(var a in e){var s=e[a].sidx;if(s){var o=Gd(s);if(!t[o])break;var l=t[o].sidxInfo;i=l,r=s,(Boolean(!i.map&&!r.map)||Boolean(i.map&&r.map&&i.map.byterange.offset===r.map.byterange.offset&&i.map.byterange.length===r.map.byterange.length))&&i.uri===r.uri&&i.byterange.offset===r.byterange.offset&&i.byterange.length===r.byterange.length&&(n[o]=t[o])}}return n},Hd=function(e,t,i,r,n){var a={uri:hc(r.handleManifestRedirects,e.resolvedUri),byterange:e.byterange,playlist:t};return i(cs.mergeOptions(a,{responseType:"arraybuffer",headers:Wc(a)}),n)},Kd=function(t){function i(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments[3];fc(this,i);var a=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),s=r.withCredentials,o=void 0!==s&&s,l=r.handleManifestRedirects,u=void 0!==l&&l;if(a.hls_=t,a.withCredentials=o,a.handleManifestRedirects=u,!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(n,e),a)}return mc(i,Nd),pc(i,[{key:"setupChildLoader",value:function(e,t){this.masterPlaylistLoader_=e,this.childPlaylist_=t}},{key:"dispose",value:function(){this.stopRequest(),this.loadedPlaylists_={},e.clearTimeout(this.minimumUpdatePeriodTimeout_),e.clearTimeout(this.mediaRequest_),e.clearTimeout(this.mediaUpdateTimeout)}},{key:"hasPendingRequest",value:function(){return this.request||this.mediaRequest_}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"sidxRequestFinished_",value:function(e,t,i,r){var n=this;return function(a,s){if(n.request){if(n.request=null,a)return n.error={status:s.status,message:"DASH playlist request error at URL: "+e.uri,response:s.response,code:2},i&&(n.state=i),n.trigger("error"),r(t,null);var o=new Uint8Array(s.response),l=ll.parseSidx(o.subarray(8));return r(t,l)}}}},{key:"media",value:function(t){var i=this;if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var r=this.state;if("string"==typeof t){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}var n=!this.media_||t.uri!==this.media_.uri;if(n&&this.loadedPlaylists_[t.uri]&&this.loadedPlaylists_[t.uri].endList)return this.state="HAVE_METADATA",this.media_=t,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(n)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=Gd(t.sidx);s[o]={sidxInfo:t.sidx},this.request=Hd(t.sidx,t,this.hls_.xhr,{handleManifestRedirects:this.handleManifestRedirects},this.sidxRequestFinished_(t,a,r,function(e,n){if(!e||!n)throw new Error("failed to request sidx");s[o].sidx=n,i.haveMetadata({startingState:r,playlist:e.playlists[t.uri]})}))}else this.mediaRequest_=e.setTimeout(this.haveMetadata.bind(this,{startingState:r,playlist:t}),0)}},{key:"haveMetadata",value:function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.uri]=i,this.mediaRequest_=null,this.refreshMedia_(i.uri),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")}},{key:"pause",value:function(){this.stopRequest(),e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.minimumUpdatePeriodTimeout_),"HAVE_NOTHING"===this.state&&(this.started=!1)}},{key:"load",value:function(t){var i=this;e.clearTimeout(this.mediaUpdateTimeout),e.clearTimeout(this.minimumUpdatePeriodTimeout_);var r=this.media();if(t){var n=r?r.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=e.setTimeout(function(){return i.load()},n)}else this.started?this.trigger("loadedplaylist"):this.start()}},{key:"parseMasterXml",value:function(){var e=el(this.masterXml_,{manifestUri:this.srcUrl,clientOffset:this.clientOffset_,sidxMapping:this.sidxMapping_});e.uri=this.srcUrl;for(var t=0;t<e.playlists.length;t++){var i="placeholder-uri-"+t;e.playlists[t].uri=i,e.playlists[i]=e.playlists[t]}return Tc(e,function(t,i,r,n){if(t.playlists&&t.playlists.length){var a="placeholder-uri-"+i+"-"+r+"-"+n;t.playlists[0].uri=a,e.playlists[a]=t.playlists[0]}}),Ec(e),kc(e),e}},{key:"start",value:function(){var t=this;this.started=!0,this.masterPlaylistLoader_?this.mediaRequest_=e.setTimeout(this.haveMaster_.bind(this),0):this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(e,i){if(t.request){if(t.request=null,e)return t.error={status:i.status,message:"DASH playlist request error at URL: "+t.srcUrl,responseText:i.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");t.masterXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date?t.masterLoaded_=Date.parse(i.responseHeaders.date):t.masterLoaded_=Date.now(),t.srcUrl=hc(t.handleManifestRedirects,t.srcUrl,i),t.syncClientServerClock_(t.onClientServerClockSync_.bind(t))}})}},{key:"syncClientServerClock_",value:function(e){var t=this,i=tl(this.masterXml_);return null===i?(this.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.clientOffset_=i.value-Date.now(),e()):void(this.request=this.hls_.xhr({uri:dc(this.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},function(r,n){if(t.request){if(r)return t.clientOffset_=t.masterLoaded_-Date.now(),e();var a=void 0;a="HEAD"===i.method?n.responseHeaders&&n.responseHeaders.date?Date.parse(n.responseHeaders.date):t.masterLoaded_:Date.parse(n.responseText),t.clientOffset_=a-Date.now(),e()}}))}},{key:"haveMaster_",value:function(){this.state="HAVE_MASTER",this.mediaRequest_=null,this.masterPlaylistLoader_?this.media_||this.media(this.childPlaylist_):(this.master=this.parseMasterXml(),this.trigger("loadedplaylist"))}},{key:"onClientServerClockSync_",value:function(){var t=this;this.haveMaster_(),this.hasPendingRequest()||this.media_||this.media(this.master.playlists[0]),this.master&&this.master.minimumUpdatePeriod&&(this.minimumUpdatePeriodTimeout_=e.setTimeout(function(){t.trigger("minimumUpdatePeriod")},this.master.minimumUpdatePeriod))}},{key:"refreshXml_",value:function(){var t=this;this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(i,r){if(t.request){if(t.request=null,i)return t.error={status:r.status,message:"DASH playlist request error at URL: "+t.srcUrl,responseText:r.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");t.masterXml_=r.responseText,t.sidxMapping_=function(e,t,i,r){var n=el(e,{manifestUri:t,clientOffset:i}),a=Vd(n.playlists,r);return Tc(n,function(e,t,i,n){if(e.playlists&&e.playlists.length){var s=e.playlists;a=Fd(a,Vd(s,r))}}),a}(t.masterXml_,t.srcUrl,t.clientOffset_,t.sidxMapping_);var n=t.parseMasterXml(),a=jd(t.master,n);if(a){var s=Gd(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,n,t.state,function(i,r){if(!i||!r)throw new Error("failed to request sidx on minimumUpdatePeriod");t.sidxMapping_[s].sidx=r,t.minimumUpdatePeriodTimeout_=e.setTimeout(function(){t.trigger("minimumUpdatePeriod")},t.master.minimumUpdatePeriod),t.refreshMedia_(t.media().uri)}))}}t.minimumUpdatePeriodTimeout_=e.setTimeout(function(){t.trigger("minimumUpdatePeriod")},t.master.minimumUpdatePeriod)}})}},{key:"refreshMedia_",value:function(t){var i=this;if(!t)throw new Error("refreshMedia_ must take a media uri");var r=void 0,n=void 0;this.masterPlaylistLoader_?(r=this.masterPlaylistLoader_.master,n=this.masterPlaylistLoader_.parseMasterXml()):(r=this.master,n=this.parseMasterXml());var a=jd(r,n);a?(this.masterPlaylistLoader_?this.masterPlaylistLoader_.master=a:this.master=a,this.media_=a.playlists[t]):(this.media_=n.playlists[t],this.trigger("playlistunchanged")),this.media().endList||(this.mediaUpdateTimeout=e.setTimeout(function(){i.trigger("mediaupdatetimeout")},wc(this.media(),!!a))),this.trigger("loadedplaylist")}}]),i}(),qd=function(e){return cs.log.debug?cs.log.debug.bind(cs,"VHS:",e+" >"):function(){}};function Wd(){}var zd=function(){function e(t,i,r,n){fc(this,e),this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=t,this.processedAppend_=!1,this.type_=r,this.mimeType_=i,this.logger_=qd("SourceUpdater["+r+"]["+i+"]"),"closed"===t.readyState?t.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,i,n)):this.createSourceBuffer_(i,n)}return pc(e,[{key:"createSourceBuffer_",value:function(e,t){var i=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(e),this.logger_("created SourceBuffer"),t&&(t.trigger("sourcebufferadded"),this.mediaSource.sourceBuffers.length<2)?t.on("sourcebufferadded",function(){i.start_()}):this.start_()}},{key:"start_",value:function(){var e=this;this.started_=!0,this.onUpdateendCallback_=function(){var t=e.pendingCallback_;e.pendingCallback_=null,e.sourceBuffer_.removing=!1,e.logger_("buffered ["+sd(e.buffered())+"]"),t&&t(),e.runCallback_()},this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_),this.runCallback_()}},{key:"abort",value:function(e){var t=this;this.processedAppend_&&this.queueCallback_(function(){t.sourceBuffer_.abort()},e)}},{key:"appendBuffer",value:function(e,t){var i=this;this.processedAppend_=!0,this.queueCallback_(function(){e.videoSegmentTimingInfoCallback&&i.sourceBuffer_.addEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback),i.sourceBuffer_.appendBuffer(e.bytes)},function(){e.videoSegmentTimingInfoCallback&&i.sourceBuffer_.removeEventListener("videoSegmentTimingInfo",e.videoSegmentTimingInfoCallback),t()})}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:cs.createTimeRanges()}},{key:"remove",value:function(e,t){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Wd;this.processedAppend_&&this.queueCallback_(function(){i.logger_("remove ["+e+" => "+t+"]"),i.sourceBuffer_.removing=!0,i.sourceBuffer_.remove(e,t)},r)}},{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}(),Yd={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,$d=-101,Qd=-102,Jd=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:$d,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Qd,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Xd,xhr:t}:null},eh=function(e,t,i){var r=0,n=!1;return function(a,s){if(!n)return a?(n=!0,Jd(e),i(a,s)):(r+=1)===e.length?(s.endOfAllRequests=Date.now(),s.encryptedBytes?function(e,t,i){e.addEventListener("message",function r(n){if(n.data.source===t.requestId){e.removeEventListener("message",r);var a=n.data.decrypted;return t.bytes=new Uint8Array(a.bytes,a.byteOffset,a.byteLength),i(null,t)}});var r=void 0;r=t.key.bytes.slice?t.key.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.key.bytes)),e.postMessage($c({source:t.requestId,encrypted:t.encryptedBytes,key:r,iv:t.key.iv}),[t.encryptedBytes.buffer,r.buffer])}(t,s,i):i(null,s)):void 0}},th=function(e,t){return function(i){var r,n,a;return e.stats=cs.mergeOptions(e.stats,(n=(r=i).target,(a={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-n.requestTime||0}).bytesReceived=r.loaded,a.bandwidth=Math.floor(a.bytesReceived/a.roundTripTime*8*1e3),a)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)}},ih=function(e,t,i,r,n,a,s){var o=[],l=eh(o,i,s);if(n.key&&!n.key.bytes){var u=e(cs.mergeOptions(t,{uri:n.key.resolvedUri,responseType:"arraybuffer"}),function(e,t){return function(i,r){var n=r.response,a=Zd(i,r);if(a)return t(a,e);if(16!==n.byteLength)return t({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Xd,xhr:r},e);var s=new DataView(n);return e.key.bytes=new Uint32Array([s.getUint32(0),s.getUint32(4),s.getUint32(8),s.getUint32(12)]),t(null,e)}}(n,l));o.push(u)}if(n.map&&!n.map.bytes){var c=e(cs.mergeOptions(t,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:Wc(n.map)}),function(e,t,i){return function(r,n){var a=n.response,s=Zd(r,n);return s?i(s,e):0===a.byteLength?i({status:n.status,message:"Empty HLS segment content at URL: "+n.uri,code:Xd,xhr:n},e):(e.map.bytes=new Uint8Array(n.response),t&&!t.isInitialized()&&t.init(),e.map.timescales=rl.timescale(e.map.bytes),e.map.videoTrackIds=rl.videoTrackIds(e.map.bytes),i(null,e))}}(n,r,l));o.push(c)}var d=e(cs.mergeOptions(t,{uri:n.resolvedUri,responseType:"arraybuffer",headers:Wc(n)}),function(e,t,i){return function(r,n){var a=n.response,s=Zd(r,n),o=void 0;return s?i(s,e):0===a.byteLength?i({status:n.status,message:"Empty HLS segment content at URL: "+n.uri,code:Xd,xhr:n},e):(e.stats=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}}(n),e.key?e.encryptedBytes=new Uint8Array(n.response):e.bytes=new Uint8Array(n.response),t&&e.map&&e.map.bytes&&(t.isInitialized()||t.init(),(o=t.parse(e.bytes,e.map.videoTrackIds,e.map.timescales))&&o.captions&&(e.captionStreams=o.captionStreams,e.fmp4Captions=o.captions)),i(null,e))}}(n,r,l));return d.addEventListener("progress",th(n,a)),o.push(d),function(){return Jd(o)}},rh=function(t,i){var r;return t&&(r=e.getComputedStyle(t))?r[i]:""},nh=function(e,t){var i=e.slice();e.sort(function(e,r){var n=t(e,r);return 0===n?i.indexOf(e)-i.indexOf(r):n})},ah=function(t,i){var r=void 0,n=void 0;return t.attributes.BANDWIDTH&&(r=t.attributes.BANDWIDTH),r=r||e.Number.MAX_VALUE,i.attributes.BANDWIDTH&&(n=i.attributes.BANDWIDTH),r-(n=n||e.Number.MAX_VALUE)},sh=function(e){return"number"==typeof e&&isFinite(e)},oh=function(t){function i(e){fc(this,i);var t=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));if(!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");return t.bandwidth=e.bandwidth,t.throughput={rate:0,count:0},t.roundTrip=NaN,t.resetStats_(),t.mediaIndex=null,t.hasPlayed_=e.hasPlayed,t.currentTime_=e.currentTime,t.seekable_=e.seekable,t.seeking_=e.seeking,t.duration_=e.duration,t.mediaSource_=e.mediaSource,t.hls_=e.hls,t.loaderType_=e.loaderType,t.startingMedia_=void 0,t.segmentMetadataTrack_=e.segmentMetadataTrack,t.goalBufferLength_=e.goalBufferLength,t.sourceType_=e.sourceType,t.inbandTextTracks_=e.inbandTextTracks,t.state_="INIT",t.checkBufferTimeout_=null,t.error_=void 0,t.currentTimeline_=-1,t.pendingSegment_=null,t.mimeType_=null,t.sourceUpdater_=null,t.xhrOptions_=null,t.activeInitSegmentId_=null,t.initSegments_={},t.cacheEncryptionKeys_=e.cacheEncryptionKeys,t.keyCache_={},"main"===t.loaderType_?t.captionParser_=new Vu:t.captionParser_=null,t.decrypter_=e.decrypter,t.syncController_=e.syncController,t.syncPoint_={segmentIndex:0,time:0},t.syncController_.on("syncinfoupdate",function(){return t.trigger("syncinfoupdate")}),t.mediaSource_.addEventListener("sourceopen",function(){return t.ended_=!1}),t.fetchAtBuffer_=!1,t.logger_=qd("SegmentLoader["+t.loaderType_+"]"),Object.defineProperty(t,"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e)}}),t}return mc(i,t),pc(i,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED",this.pause(),this.abort_(),this.sourceUpdater_&&this.sourceUpdater_.dispose(),this.resetStats_(),this.captionParser_&&this.captionParser_.reset()}},{key:"abort",value:function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}},{key:"abort_",value:function(){this.pendingSegment_&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null}},{key:"error",value:function(e){return void 0!==e&&(this.error_=e),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0,this.pause(),this.trigger("ended")}},{key:"buffered_",value:function(){return this.sourceUpdater_?this.sourceUpdater_.buffered():cs.createTimeRanges()}},{key:"initSegment",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=Qc(e),r=this.initSegments_[i];return t&&!r&&e.bytes&&(this.initSegments_[i]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,timescales:e.timescales,videoTrackIds:e.videoTrackIds}),r||e}},{key:"segmentKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=Jc(e),r=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!r&&e.bytes&&(this.keyCache_[i]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});var n={resolvedUri:(r||e).resolvedUri};return r&&(n.bytes=r.bytes),n}},{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 zd(this.mediaSource_,this.mimeType_,this.loaderType_,this.sourceBufferEmitter_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var i=this.playlist_,r=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.hasPlayed_()||(e.syncInfo={mediaSequence:e.mediaSequence,time:0});var n=null;if(i&&(i.id?n=i.id:i.uri&&(n=i.uri)),this.logger_("playlist update ["+n+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(i&&i.uri===e.uri){var a=e.mediaSequence-i.mediaSequence;this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex&&(this.mediaIndex-=a),r&&(r.mediaIndex-=a,r.mediaIndex>=0&&(r.segment=e.segments[r.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(i,e)}else null!==this.mediaIndex&&this.resyncLoader()}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(e,t){this.mimeType_||(this.mimeType_=e,this.sourceBufferEmitter_=t,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(e){this.ended_=!1,this.resetLoader(),this.remove(0,this.duration_(),e),this.captionParser_&&this.captionParser_.clearAllCaptions(),this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1,this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null,this.syncPoint_=null,this.abort()}},{key:"remove",value:function(e,t,i){if(this.sourceUpdater_&&this.sourceUpdater_.remove(e,t,i),ld(e,t,this.segmentMetadataTrack_),this.inbandTextTracks_)for(var r in this.inbandTextTracks_)ld(e,t,this.inbandTextTracks_[r])}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&e.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=e.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var e=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);e&&(this.isEndOfStream_(e.mediaIndex)?this.endOfStream():(e.mediaIndex!==this.playlist_.segments.length-1||"ended"!==this.mediaSource_.readyState||this.seeking_())&&(e.timeline!==this.currentTimeline_&&(this.syncController_.reset(),e.timestampOffset=e.startOfSegment,this.captionParser_&&this.captionParser_.clearAllCaptions()),this.loadSegment_(e)))}}},{key:"isEndOfStream_",value:function(e){return function(e,t,i){if(!e||!t)return!1;var r=i===e.segments.length;return e.endList&&"open"===t.readyState&&r}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.playlist_,this.mediaSource_,e)&&!this.sourceUpdater_.updating()}},{key:"checkBuffer_",value:function(e,t,i,r,n,a){var s=0,o=void 0;e.length&&(s=e.end(e.length-1));var l=Math.max(0,s-n);if(!t.segments.length)return null;if(l>=this.goalBufferLength_())return null;if(!r&&l>=1)return null;if(null===a)return i=this.getSyncSegmentCandidate_(t),this.generateSegmentInfo_(t,i,null,!0);if(null!==i){var u=t.segments[i];return o=u&&u.end?u.end:s,this.generateSegmentInfo_(t,i+1,o,!1)}if(this.fetchAtBuffer_){var c=Vc.getMediaInfoForTime(t,s,a.segmentIndex,a.time);i=c.mediaIndex,o=c.startTime}else{var d=Vc.getMediaInfoForTime(t,n,a.segmentIndex,a.time);i=d.mediaIndex,o=d.startTime}return this.generateSegmentInfo_(t,i,o,!1)}},{key:"getSyncSegmentCandidate_",value:function(e){var t=this;if(-1===this.currentTimeline_)return 0;var i=e.segments.map(function(e,t){return{timeline:e.timeline,segmentIndex:t}}).filter(function(e){return e.timeline===t.currentTimeline_});return i.length?i[Math.min(i.length-1,1)].segmentIndex:Math.max(e.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(e,t,i,r){if(t<0||t>=e.segments.length)return null;var n=e.segments[t];return{requestId:"segment-loader-"+Math.random(),uri:n.resolvedUri,mediaIndex:t,isSyncRequest:r,startOfSegment:i,playlist:e,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:n.timeline,duration:n.duration,segment:n}}},{key:"abortRequestEarly_",value:function(e){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return!1;if(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return!1;var t=this.currentTime_(),i=e.bandwidth,r=this.pendingSegment_.duration,n=Vc.estimateSegmentRequestTime(r,i,this.playlist_,e.bytesReceived),a=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return((e.length?e.end(e.length-1):0)-t)/i}(this.buffered_(),t,this.hls_.tech_.playbackRate())-1;if(n<=a)return!1;var s=function(e){var t=e.master,i=e.currentTime,r=e.bandwidth,n=e.duration,a=e.segmentDuration,s=e.timeUntilRebuffer,o=e.currentTimeline,l=e.syncController,u=t.playlists.filter(function(e){return!Vc.isIncompatible(e)}),c=u.filter(Vc.isEnabled);c.length||(c=u.filter(function(e){return!Vc.isDisabled(e)}));var d=c.filter(Vc.hasAttribute.bind(null,"BANDWIDTH")).map(function(e){var t=l.getSyncPoint(e,n,o,i)?1:2;return{playlist:e,rebufferingImpact:Vc.estimateSegmentRequestTime(a,r,e)*t-s}}),h=d.filter(function(e){return e.rebufferingImpact<=0});return nh(h,function(e,t){return ah(t.playlist,e.playlist)}),h.length?h[0]:(nh(d,function(e,t){return e.rebufferingImpact-t.rebufferingImpact}),d[0]||null)}({master:this.hls_.playlists.master,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var o=n-a-s.rebufferingImpact,l=.5;return a<=1/30&&(l=1),!s.playlist||s.playlist.uri===this.playlist_.uri||o<l?!1:(this.bandwidth=s.playlist.attributes.BANDWIDTH*Yd.BANDWIDTH_VARIANCE+1,this.abort(),this.trigger("earlyabort"),!0)}}},{key:"handleProgress_",value:function(e,t){this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId&&!this.abortRequestEarly_(t.stats)&&this.trigger("progress")}},{key:"loadSegment_",value:function(e){this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),e.abortRequests=ih(this.hls_.xhr,this.xhrOptions_,this.decrypter_,this.captionParser_,this.createSimplifiedSegmentObj_(e),this.handleProgress_.bind(this),this.segmentRequestFinished_.bind(this))}},{key:"trimBackBuffer_",value:function(e){var t=function(e,t,i){var r=void 0;return r=e.length&&e.start(0)>0&&e.start(0)<t?e.start(0):t-30,Math.min(r,t-i)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}},{key:"createSimplifiedSegmentObj_",value:function(e){var t=e.segment,i={resolvedUri:t.resolvedUri,byterange:t.byterange,requestId:e.requestId};if(t.key){var r=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);i.key=this.segmentKey(t.key),i.key.iv=r}return t.map&&(i.map=this.initSegment(t.map)),i}},{key:"segmentRequestFinished_",value:function(e,t){if(this.mediaRequests+=1,t.stats&&(this.mediaBytesTransferred+=t.stats.bytesReceived,this.mediaTransferDuration+=t.stats.roundTripTime),this.pendingSegment_){if(t.requestId===this.pendingSegment_.requestId){if(e)return this.pendingSegment_=null,this.state="READY",e.code===Qd?void(this.mediaRequestsAborted+=1):(this.pause(),e.code===$d?(this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,void this.trigger("bandwidthupdate")):(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error")));this.bandwidth=t.stats.bandwidth,this.roundTrip=t.stats.roundTripTime,t.map&&(t.map=this.initSegment(t.map,!0)),t.key&&this.segmentKey(t.key,!0),this.processSegmentResponse_(t)}}else this.mediaRequestsAborted+=1}},{key:"processSegmentResponse_",value:function(e){var t=this.pendingSegment_;t.bytes=e.bytes,e.map&&(t.segment.map.bytes=e.map.bytes),t.endOfAllRequests=e.endOfAllRequests,e.fmp4Captions&&(!function(e,t,i){for(var r in i)if(!e[r]){t.trigger({type:"usage",name:"hls-608"});var n=t.textTracks().getTrackById(r);e[r]=n||t.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track}}(this.inbandTextTracks_,this.hls_.tech_,e.captionStreams),function(e){var t=e.inbandTextTracks,i=e.captionArray,r=e.timestampOffset;if(i){var n=window.WebKitDataCue||window.VTTCue;i.forEach(function(e){var i=e.stream,a=e.startTime,s=e.endTime;t[i]&&(a+=r,s+=r,t[i].addCue(new n(a,s,e.text)))})}}({inbandTextTracks:this.inbandTextTracks_,captionArray:e.fmp4Captions,timestampOffset:0}),this.captionParser_&&this.captionParser_.clearParsedCaptions()),this.handleSegment_()}},{key:"handleSegment_",value:function(){var e=this;if(this.pendingSegment_){var t=this.pendingSegment_,i=t.segment,r=this.syncController_.probeSegmentInfo(t);void 0===this.startingMedia_&&r&&(r.containsAudio||r.containsVideo)&&(this.startingMedia_={containsAudio:r.containsAudio,containsVideo:r.containsVideo});var n,a,s,o=(n=this.loaderType_,a=this.startingMedia_,s=r,"main"===n&&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 l=this.syncController_.mappingForTimeline(t.timeline);if(null!==l&&this.trigger({type:"segmenttimemapping",mapping:l}),this.state="APPENDING",i.map){var u=Qc(i.map);if(!this.activeInitSegmentId_||this.activeInitSegmentId_!==u){var c=this.initSegment(i.map);this.sourceUpdater_.appendBuffer({bytes:c.bytes},function(){e.activeInitSegmentId_=u})}}t.byteLength=t.bytes.byteLength,"number"==typeof i.start&&"number"==typeof i.end?this.mediaSecondsLoaded+=i.end-i.start:this.mediaSecondsLoaded+=i.duration,this.logger_(function(e){var t=e.segment,i=t.start,r=t.end,n=e.playlist,a=n.mediaSequence,s=n.id,o=n.segments,l=void 0===o?[]:o,u=e.mediaIndex,c=e.timeline;return["appending ["+u+"] of ["+a+", "+(a+l.length)+"] from playlist ["+s+"]","["+i+" => "+r+"] in timeline ["+c+"]"].join(" ")}(t)),this.sourceUpdater_.appendBuffer({bytes:t.bytes,videoSegmentTimingInfoCallback:this.handleVideoSegmentTimingInfo_.bind(this,t.requestId)},this.handleUpdateEnd_.bind(this))}else this.state="READY"}},{key:"handleVideoSegmentTimingInfo_",value:function(e,t){if(this.pendingSegment_&&e===this.pendingSegment_.requestId){var i=this.pendingSegment_.segment;i.videoTimingInfo||(i.videoTimingInfo={}),i.videoTimingInfo.transmuxerPrependedSeconds=t.videoSegmentTimingInfo.prependedContentDuration||0,i.videoTimingInfo.transmuxedPresentationStart=t.videoSegmentTimingInfo.start.presentation,i.videoTimingInfo.transmuxedPresentationEnd=t.videoSegmentTimingInfo.end.presentation,i.videoTimingInfo.baseMediaDecodeTime=t.videoSegmentTimingInfo.baseMediaDecodeTime}}},{key:"handleUpdateEnd_",value:function(){if(!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_,t=e.segment,i=null!==this.mediaIndex;this.pendingSegment_=null,this.recordThroughput_(e),this.addSegmentMetadataCue_(e),this.state="READY",this.mediaIndex=e.mediaIndex,this.fetchAtBuffer_=!0,this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate"),t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration?this.resetEverything():(i&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.isEndOfStream_(e.mediaIndex+1,e.playlist)&&this.endOfStream(),this.paused()||this.monitorBuffer_())}},{key:"recordThroughput_",value:function(e){var t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,r=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(r-t)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(t){if(this.segmentMetadataTrack_){var i=t.segment,r=i.start,n=i.end;if(sh(r)&&sh(n)){ld(r,n,this.segmentMetadataTrack_);var a=e.WebKitDataCue||e.VTTCue,s={custom:i.custom,dateTimeObject:i.dateTimeObject,dateTimeString:i.dateTimeString,bandwidth:t.playlist.attributes.BANDWIDTH,resolution:t.playlist.attributes.RESOLUTION,codecs:t.playlist.attributes.CODECS,byteLength:t.byteLength,uri:t.uri,timeline:t.timeline,playlist:t.playlist.uri,start:r,end:n},o=new a(r,n,JSON.stringify(s));o.value=s,this.segmentMetadataTrack_.addCue(o)}}}}]),i}(cs.EventTarget),lh=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},uh=new Uint8Array("\n\n".split("").map(function(e){return e.charCodeAt(0)})),ch=function(t){function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};fc(this,i);var r=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t));return r.mediaSource_=null,r.subtitlesTrack_=null,r}return mc(i,oh),pc(i,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return cs.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return cs.createTimeRanges([[t,i]])}},{key:"initSegment",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var i=Qc(e),r=this.initSegments_[i];if(t&&!r&&e.bytes){var n=uh.byteLength+e.bytes.byteLength,a=new Uint8Array(n);a.set(e.bytes),a.set(uh,e.bytes.byteLength),this.initSegments_[i]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return r||e}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"track",value:function(e){return void 0===e?this.subtitlesTrack_:(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}},{key:"remove",value:function(e,t){ld(e,t,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var e=this;this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var t=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(t=this.skipEmptySegments_(t)){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline)){return this.syncController_.one("timestampoffset",function(){e.state="READY",e.paused()||e.monitorBuffer_()}),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(t)}}},{key:"skipEmptySegments_",value:function(e){for(;e&&e.segment.empty;)e=this.generateSegmentInfo_(e.playlist,e.mediaIndex+1,e.startOfSegment+e.duration,e.isSyncRequest);return e}},{key:"handleSegment_",value:function(){var t=this;if(this.pendingSegment_&&this.subtitlesTrack_){this.state="APPENDING";var i=this.pendingSegment_,r=i.segment;if("function"!=typeof e.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var n=void 0,a=function(){t.subtitlesTrack_.tech_.off("vttjsloaded",n),t.error({message:"Error loading vtt.js"}),t.state="READY",t.pause(),t.trigger("error")};return n=function(){t.subtitlesTrack_.tech_.off("vttjserror",a),t.handleSegment_()},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",n),void this.subtitlesTrack_.tech_.one("vttjserror",a)}r.requested=!0;try{this.parseVTTCues_(i)}catch(e){return this.error({message:e.message}),this.state="READY",this.pause(),this.trigger("error")}if(this.updateTimeMapping_(i,this.syncController_.timelines[i.timeline],this.playlist_),i.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");i.byteLength=i.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,i.cues.length&&this.remove(i.cues[0].endTime,i.cues[i.cues.length-1].endTime),i.cues.forEach(function(e){t.subtitlesTrack_.addCue(e)}),this.handleUpdateEnd_()}else this.state="READY"}},{key:"parseVTTCues_",value:function(t){var i=void 0,r=!1;"function"==typeof e.TextDecoder?i=new e.TextDecoder("utf8"):(i=e.WebVTT.StringDecoder(),r=!0);var n=new e.WebVTT.Parser(e,e.vttjs,i);if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=t.cues.push.bind(t.cues),n.ontimestampmap=function(e){return t.timestampmap=e},n.onparsingerror=function(e){cs.log.warn("Error encountered when parsing cues: "+e.message)},t.segment.map){var a=t.segment.map.bytes;r&&(a=lh(a)),n.parse(a)}var s=t.bytes;r&&(s=lh(s)),n.parse(s),n.flush()}},{key:"updateTimeMapping_",value:function(e,t,i){var r=e.segment;if(t)if(e.cues.length){var n=e.timestampmap,a=n.MPEGTS/9e4-n.LOCAL+t.mapping;if(e.cues.forEach(function(e){e.startTime+=a,e.endTime+=a}),!i.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,o-r.duration)}}}else r.empty=!0}}]),i}(),dh=function(e,t){for(var i=e.cues,r=0;r<i.length;r++){var n=i[r];if(t>=n.adStartTime&&t<=n.adEndTime)return n}return null},hh=Zu,fh=[{name:"VOD",run:function(e,t,i,r,n){if(i!==1/0){return{time:0,segmentIndex:0}}return null}},{name:"ProgramDateTime",run:function(e,t,i,r,n){if(!e.datetimeToDisplayTime)return null;var a=t.segments||[],s=null,o=null;n=n||0;for(var l=0;l<a.length;l++){var u=a[l];if(u.dateTimeObject){var c=u.dateTimeObject.getTime()/1e3+e.datetimeToDisplayTime,d=Math.abs(n-c);if(null!==o&&(0===d||o<d))break;o=d,s={time:c,segmentIndex:l}}}return s}},{name:"Segment",run:function(e,t,i,r,n){var a=t.segments||[],s=null,o=null;n=n||0;for(var l=0;l<a.length;l++){var u=a[l];if(u.timeline===r&&void 0!==u.start){var c=Math.abs(n-u.start);if(null!==o&&o<c)break;(!s||null===o||o>=c)&&(o=c,s={time:u.start,segmentIndex:l})}}return s}},{name:"Discontinuity",run:function(e,t,i,r,n){var a=null;if(n=n||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o<t.discontinuityStarts.length;o++){var l=t.discontinuityStarts[o],u=t.discontinuitySequence+o+1,c=e.discontinuities[u];if(c){var d=Math.abs(n-c.time);if(null!==s&&s<d)break;(!a||null===s||s>=d)&&(s=d,a={time:c.time,segmentIndex:l})}}return a}},{name:"Playlist",run:function(e,t,i,r,n){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence}:null}}],ph=function(e){function t(){fc(this,t);var e=gc(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.inspectCache_=void 0,e.timelines=[],e.discontinuities=[],e.datetimeToDisplayTime=null,e.logger_=qd("SyncController"),e}return mc(t,e),pc(t,[{key:"getSyncPoint",value:function(e,t,i,r){var n=this.runStrategies_(e,t,i,r);return n.length?this.selectSyncPoint_(n,{key:"time",value:r}):null}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var r=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return r.segmentIndex>0&&(r.time*=-1),Math.abs(r.time+Pc(e,r.segmentIndex,0))}},{key:"runStrategies_",value:function(e,t,i,r){for(var n=[],a=0;a<fh.length;a++){var s=fh[a],o=s.run(this,e,t,i,r);o&&(o.strategy=s.name,n.push({strategy:s.name,syncPoint:o}))}return n}},{key:"selectSyncPoint_",value:function(e,t){for(var i=e[0].syncPoint,r=Math.abs(e[0].syncPoint[t.key]-t.value),n=e[0].strategy,a=1;a<e.length;a++){var s=Math.abs(e[a].syncPoint[t.key]-t.value);s<r&&(r=s,i=e[a].syncPoint,n=e[a].strategy)}return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+n+"]: [time:"+i.time+", segmentIndex:"+i.segmentIndex+"]"),i}},{key:"saveExpiredSegmentInfo",value:function(e,t){for(var i=t.mediaSequence-e.mediaSequence-1;i>=0;i--){var r=e.segments[i];if(r&&void 0!==r.start){t.syncInfo={mediaSequence:e.mediaSequence+i,time:r.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMapping",value:function(e){if(!this.datetimeToDisplayTime&&e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0].dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-t}}},{key:"reset",value:function(){this.inspectCache_=void 0}},{key:"probeSegmentInfo",value:function(e){var t=e.segment,i=e.playlist,r=void 0;return(r=t.map?this.probeMp4Segment_(e):this.probeTsSegment_(e))&&this.calculateSegmentTimeMapping_(e,r)&&(this.saveDiscontinuitySyncInfo_(e),i.syncInfo||(i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:t.start})),r}},{key:"probeMp4Segment_",value:function(e){var t=e.segment,i=rl.timescale(t.map.bytes),r=rl.startTime(i,e.bytes);return null!==e.timestampOffset&&(e.timestampOffset-=r),{start:r,end:r+t.duration}}},{key:"probeTsSegment_",value:function(e){var t=hh(e.bytes,this.inspectCache_),i=void 0,r=void 0;return t?(t.video&&2===t.video.length?(this.inspectCache_=t.video[1].dts,i=t.video[0].dtsTime,r=t.video[1].dtsTime):t.audio&&2===t.audio.length&&(this.inspectCache_=t.audio[1].dts,i=t.audio[0].dtsTime,r=t.audio[1].dtsTime),{start:i,end:r,containsVideo:t.video&&2===t.video.length,containsAudio:t.audio&&2===t.audio.length}):null}},{key:"timestampOffsetForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].time}},{key:"mappingForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}},{key:"calculateSegmentTimeMapping_",value:function(e,t){var i=e.segment,r=this.timelines[e.timeline];if(null!==e.timestampOffset)r={time:e.startOfSegment,mapping:e.startOfSegment-t.start},this.timelines[e.timeline]=r,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+r.time+"] [mapping: "+r.mapping+"]"),i.start=e.startOfSegment,i.end=t.end+r.mapping;else{if(!r)return!1;i.start=t.start+r.mapping,i.end=t.end+r.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(e){var t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var r=0;r<t.discontinuityStarts.length;r++){var n=t.discontinuityStarts[r],a=t.discontinuitySequence+r+1,s=n-e.mediaIndex,o=Math.abs(s);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>o){var l=void 0;l=s<0?i.start-Pc(t,e.mediaIndex,n):i.end+Pc(t,e.mediaIndex+1,n),this.discontinuities[a]={time:l,accuracy:o}}}}}]),t}(cs.EventTarget),mh=new vd("./decrypter-worker.worker.js",function(e,t){var i=this;!function(){var e=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},t=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),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},n=function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],r=t[4],n=i[4],a=void 0,s=void 0,o=void 0,l=[],u=[],c=void 0,d=void 0,h=void 0,f=void 0,p=void 0;for(a=0;a<256;a++)u[(l[a]=a<<1^283*(a>>7))^a]=a;for(s=o=0;!r[s];s^=c||1,o=u[o]||1)for(h=(h=o^o<<1^o<<2^o<<3^o<<4)>>8^255&h^99,r[s]=h,n[h]=s,p=16843009*l[d=l[c=l[s]]]^65537*d^257*c^16843008*s,f=257*l[h]^16843008*h,a=0;a<4;a++)t[a][s]=f=f<<24^f>>>8,i[a][h]=p=p<<24^p>>>8;for(a=0;a<5;a++)t[a]=t[a].slice(0),i[a]=i[a].slice(0);return e},a=null,s=function(){function t(i){e(this,t),a||(a=n()),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 r=void 0,s=void 0,o=void 0,l=void 0,u=void 0,c=this._tables[0][4],d=this._tables[1],h=i.length,f=1;if(4!==h&&6!==h&&8!==h)throw new Error("Invalid aes key size");for(l=i.slice(0),u=[],this._key=[l,u],r=h;r<4*h+28;r++)o=l[r-1],(r%h==0||8===h&&r%h==4)&&(o=c[o>>>24]<<24^c[o>>16&255]<<16^c[o>>8&255]<<8^c[255&o],r%h==0&&(o=o<<8^o>>>24^f<<24,f=f<<1^283*(f>>7))),l[r]=l[r-h]^o;for(s=0;r;s++,r--)o=l[3&s?r:r-4],u[s]=r<=4||s<4?o:d[0][c[o>>>24]]^d[1][c[o>>16&255]]^d[2][c[o>>8&255]]^d[3][c[255&o]]}return t.prototype.decrypt=function(e,t,i,r,n,a){var s=this._key[1],o=e^s[0],l=r^s[1],u=i^s[2],c=t^s[3],d=void 0,h=void 0,f=void 0,p=s.length/4-2,m=void 0,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],S=v[4];for(m=0;m<p;m++)d=y[o>>>24]^_[l>>16&255]^b[u>>8&255]^T[255&c]^s[g],h=y[l>>>24]^_[u>>16&255]^b[c>>8&255]^T[255&o]^s[g+1],f=y[u>>>24]^_[c>>16&255]^b[o>>8&255]^T[255&l]^s[g+2],c=y[c>>>24]^_[o>>16&255]^b[l>>8&255]^T[255&u]^s[g+3],g+=4,o=d,l=h,u=f;for(m=0;m<4;m++)n[(3&-m)+a]=S[o>>>24]<<24^S[l>>16&255]<<16^S[u>>8&255]<<8^S[255&c]^s[g++],d=o,o=l,l=u,u=c,c=d},t}(),o=function(){function t(){e(this,t),this.listeners={}}return t.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.prototype.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),i>-1},t.prototype.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,r=0;r<i;++r)t[r].call(this,arguments[1]);else for(var n=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,n)},t.prototype.dispose=function(){this.listeners={}},t.prototype.pipe=function(e){this.on("data",function(t){e.push(t)})},t}(),l=function(t){function i(){e(this,i);var n=r(this,t.call(this,o));return n.jobs=[],n.delay=1,n.timeout_=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(i,t),i.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.prototype.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},i}(o),u=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},c=function(){function i(t,r,n,a){e(this,i);var s=i.STEP,o=new Int32Array(t.buffer),c=new Uint8Array(t.byteLength),d=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(o.subarray(d,d+s),r,n,c)),d=s;d<o.length;d+=s)n=new Uint32Array([u(o[d-4]),u(o[d-3]),u(o[d-2]),u(o[d-1])]),this.asyncStream_.push(this.decryptChunk_(o.subarray(d,d+s),r,n,c));this.asyncStream_.push(function(){var e;a(null,(e=c).subarray(0,e.byteLength-e[e.byteLength-1]))})}return i.prototype.decryptChunk_=function(e,t,i,r){return function(){var n=function(e,t,i){var r=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),n=new s(Array.prototype.slice.call(t)),a=new Uint8Array(e.byteLength),o=new Int32Array(a.buffer),l=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(l=i[0],c=i[1],d=i[2],h=i[3],v=0;v<r.length;v+=4)f=u(r[v]),p=u(r[v+1]),m=u(r[v+2]),g=u(r[v+3]),n.decrypt(f,p,m,g,o,v),o[v]=u(o[v]^l),o[v+1]=u(o[v+1]^c),o[v+2]=u(o[v+2]^d),o[v+3]=u(o[v+3]^h),l=f,c=p,d=m,h=g;return a}(e,t,i);r.set(n,e.byteOffset)}},t(i,null,[{key:"STEP",get:function(){return 32e3}}]),i}();new function(e){e.onmessage=function(t){var i=t.data,r=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),n=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),a=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new c(r,n,a,function(t,r){var n,a;e.postMessage((n={source:i.source,decrypted:r},a={},Object.keys(n).forEach(function(e){var t=n[e];ArrayBuffer.isView(t)?a[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:a[e]=t}),a),[r.buffer])})}}(i)}()}),gh=function(e){var t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},vh=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},yh=function(e,t){t.activePlaylistLoader=e,e.load()},_h={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],r=t.mediaTypes[e],n=t.blacklistCurrentPlaylist;vh(i,r);var a=r.activeTrack(),s=r.activeGroup(),o=(s.filter(function(e){return e.default})[0]||s[0]).id,l=r.tracks[o];if(a!==l){for(var u in cs.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),r.tracks)r.tracks[u].enabled=r.tracks[u]===l;r.onTrackChanged()}else n({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],r=t.mediaTypes[e];cs.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),vh(i,r);var n=r.activeTrack();n&&(n.mode="disabled"),r.onTrackChanged()}}},bh={AUDIO:function(e,t,i){if(t){var r=i.tech,n=i.requestOptions,a=i.segmentLoaders[e];t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,n),(!r.paused()||e.endList&&"none"!==r.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),n),r.paused()||a.load()}),t.on("error",_h[e](e,i))}},SUBTITLES:function(e,t,i){var r=i.tech,n=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,n),a.track(s.activeTrack()),(!r.paused()||e.endList&&"none"!==r.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),n),r.paused()||a.load()}),t.on("error",_h[e](e,i))}},Th={AUDIO:function(e,t){var i=t.hls,r=t.sourceType,n=t.segmentLoaders[e],a=t.requestOptions,s=t.master.mediaGroups,o=t.mediaTypes[e],l=o.groups,u=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 l[d]||(l[d]=[]),s[e][d]){var f=s[e][d][h],p=void 0;if(p=f.resolvedUri?new Cc(f.resolvedUri,i,a):f.playlists&&"dash"===r?new Kd(f.playlists[0],i,a,c):null,f=cs.mergeOptions({id:h,playlistLoader:p},f),bh[e](e,f.playlistLoader,t),l[d].push(f),void 0===u[h]){var m=new cs.AudioTrack({id:h,kind:gh(f),enabled:!1,language:f.language,default:f.default,label:h});u[h]=m}}n.on("error",_h[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,r=t.hls,n=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,l=t.mediaTypes[e],u=l.groups,c=l.tracks,d=t.masterPlaylistLoader;for(var h in o[e])for(var f in u[h]||(u[h]=[]),o[e][h])if(!o[e][h][f].forced){var p=o[e][h][f],m=void 0;if("hls"===n?m=new Cc(p.resolvedUri,r,s):"dash"===n&&(m=new Kd(p.playlists[0],r,s,d)),p=cs.mergeOptions({id:f,playlistLoader:m},p),bh[e](e,p.playlistLoader,t),u[h].push(p),void 0===c[f]){var g=i.addRemoteTextTrack({id:f,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:f},!1).track;c[f]=g}}a.on("error",_h[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,r=t.master.mediaGroups,n=t.mediaTypes[e],a=n.groups,s=n.tracks;for(var o in r[e])for(var l in a[o]||(a[o]=[]),r[e][o]){var u=r[e][o][l];if(u.instreamId.match(/CC\d/)&&(a[o].push(cs.mergeOptions({id:l},u)),void 0===s[l])){var c=i.addRemoteTextTrack({id:u.instreamId,kind:"captions",default:u.default&&u.autoselect,language:u.language,label:l},!1).track;s[l]=c}}}},Sh={AUDIO:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var r in i)if(i[r].enabled)return i[r];return null}},SUBTITLES:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var r in i)if("showing"===i[r].mode)return i[r];return null}}},Eh=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){Th[t](t,e)});var t=e.mediaTypes,i=e.masterPlaylistLoader,r=e.tech,n=e.hls;["AUDIO","SUBTITLES"].forEach(function(i){t[i].activeGroup=function(e,t){return function(i){var r=t.masterPlaylistLoader,n=t.mediaTypes[e].groups,a=r.media();if(!a)return null;var s=null;return a.attributes[e]&&(s=n[a.attributes[e]]),s=s||n.main,void 0===i?s:null===i?null:s.filter(function(e){return e.id===i.id})[0]||null}}(i,e),t[i].activeTrack=Sh[i](i,e),t[i].onGroupChanged=function(e,t){return function(){var i=t.segmentLoaders,r=i[e],n=i.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.activeGroup(s),l=a.activePlaylistLoader;vh(r,a),o&&(o.playlistLoader?(r.resyncLoader(),yh(o.playlistLoader,a)):l&&n.resetEverything())}}(i,e),t[i].onTrackChanged=function(e,t){return function(){var i=t.segmentLoaders,r=i[e],n=i.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.activeGroup(s),l=a.activePlaylistLoader;vh(r,a),o&&(o.playlistLoader?l!==o.playlistLoader?(r.track&&r.track(s),r.resetEverything(),yh(o.playlistLoader,a)):yh(o.playlistLoader,a):n.resetEverything())}}(i,e)});var a=t.AUDIO.activeGroup(),s=(a.filter(function(e){return e.default})[0]||a[0]).id;t.AUDIO.tracks[s].enabled=!0,t.AUDIO.onTrackChanged(),i.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(e){return t[e].onGroupChanged()})});var o=function(){t.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"hls-audio-change"})};for(var l in r.audioTracks().addEventListener("change",o),r.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),n.on("dispose",function(){r.audioTracks().removeEventListener("change",o),r.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),r.clearTracks("audio"),t.AUDIO.tracks)r.audioTracks().addTrack(t.AUDIO.tracks[l])},kh=function(){var e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Wd,activeTrack:Wd,onGroupChanged:Wd,onTrackChanged:Wd}}),e},wh=void 0,Ch=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],Lh=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},Ah=function(t){function i(e){fc(this,i);var t=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),r=e.url,n=e.handleManifestRedirects,a=e.withCredentials,s=e.tech,o=e.bandwidth,l=e.externHls,u=e.useCueTags,c=e.blacklistDuration,d=e.enableLowInitialPlaylist,h=e.sourceType,f=e.seekTo,p=e.cacheEncryptionKeys;if(!r)throw new Error("A non-empty playlist URL is required");wh=l,t.withCredentials=a,t.tech_=s,t.hls_=s.hls,t.seekTo_=f,t.sourceType_=h,t.useCueTags_=u,t.blacklistDuration=c,t.enableLowInitialPlaylist=d,t.useCueTags_&&(t.cueTagsTrack_=t.tech_.addTextTrack("metadata","ad-cues"),t.cueTagsTrack_.inBandMetadataTrackDispatchType=""),t.requestOptions_={withCredentials:a,handleManifestRedirects:n,timeout:null},t.mediaTypes_=kh(),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 Kd(r,t.hls_,t.requestOptions_):new Cc(r,t.hls_,t.requestOptions_),t.setupMasterPlaylistLoaderListeners_(),t.mainSegmentLoader_=new oh(cs.mergeOptions(m,{segmentMetadataTrack:t.segmentMetadataTrack_,loaderType:"main"}),e),t.audioSegmentLoader_=new oh(cs.mergeOptions(m,{loaderType:"audio"}),e),t.subtitleSegmentLoader_=new ch(cs.mergeOptions(m,{loaderType:"vtt"}),e),t.setupSegmentLoaderListeners_(),Ch.forEach(function(e){t[e+"_"]=Lh.bind(t,e)}),t.logger_=qd("MPC"),t.masterPlaylistLoader_.load(),t}return mc(i,t),pc(i,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;Gc(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),Eh({sourceType:e.sourceType_,segmentLoaders:{AUDIO:e.audioSegmentLoader_,SUBTITLES:e.subtitleSegmentLoader_,main:e.mainSegmentLoader_},tech:e.tech_,requestOptions:e.requestOptions_,masterPlaylistLoader:e.masterPlaylistLoader_,hls:e.hls_,master:e.master(),mediaTypes:e.mediaTypes_,blacklistCurrentPlaylist:e.blacklistCurrentPlaylist.bind(e)}),e.triggerPresenceUsage_(e.master(),t);try{e.setupSourceBuffers_()}catch(t){return cs.log.warn("Failed to create SourceBuffers",t),e.mediaSource.endOfStream("decode")}e.setupFirstPlay(),!e.mediaTypes_.AUDIO.activePlaylistLoader||e.mediaTypes_.AUDIO.activePlaylistLoader.media()?e.trigger("selectedinitialmedia"):e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",function(){e.trigger("selectedinitialmedia")})}),this.masterPlaylistLoader_.on("loadedplaylist",function(){var t=e.masterPlaylistLoader_.media();if(!t){e.excludeUnsupportedVariants_();var i=void 0;return e.enableLowInitialPlaylist&&(i=e.selectInitialPlaylist()),i||(i=e.selectPlaylist()),e.initialMedia_=i,void e.masterPlaylistLoader_.media(e.initialMedia_)}if(e.useCueTags_&&e.updateAdCues_(t),e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.updateDuration(),e.tech_.paused()||(e.mainSegmentLoader_.load(),e.audioSegmentLoader_&&e.audioSegmentLoader_.load()),!t.endList){var r=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?r():e.tech_.one("durationchange",t)})}else r()}}),this.masterPlaylistLoader_.on("error",function(){e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)}),this.masterPlaylistLoader_.on("mediachanging",function(){e.mainSegmentLoader_.abort(),e.mainSegmentLoader_.pause()}),this.masterPlaylistLoader_.on("mediachange",function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;Gc(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load(),e.tech_.trigger({type:"mediachange",bubbles:!0})}),this.masterPlaylistLoader_.on("playlistunchanged",function(){var t=e.masterPlaylistLoader_.media();e.stuckAtPlaylistEnd_(t)&&(e.blacklistCurrentPlaylist({message:"Playlist no longer updating."}),e.tech_.trigger("playliststuck"))}),this.masterPlaylistLoader_.on("renditiondisabled",function(){e.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})}),this.masterPlaylistLoader_.on("renditionenabled",function(){e.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})})}},{key:"triggerPresenceUsage_",value:function(e,t){var i=e.mediaGroups||{},r=!0,n=Object.keys(i.AUDIO);for(var a in i.AUDIO)for(var s in i.AUDIO[a]){i.AUDIO[a][s].uri||(r=!1)}r&&this.tech_.trigger({type:"usage",name:"hls-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"}),wh.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"hls-aes"}),wh.Playlist.isFmp4(t)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"}),n.length&&Object.keys(i.AUDIO[n[0]]).length>1&&this.tech_.trigger({type:"usage",name:"hls-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}},{key:"setupSegmentLoaderListeners_",value:function(){var e=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){var t=e.selectPlaylist(),i=e.masterPlaylistLoader_.media(),r=e.tech_.buffered(),n=r.length?r.end(r.length-1)-e.tech_.currentTime():0,a=e.bufferLowWaterLine();(!i.endList||e.duration()<Yd.MAX_BUFFER_LOW_WATER_LINE||t.attributes.BANDWIDTH<i.attributes.BANDWIDTH||n>=a)&&e.masterPlaylistLoader_.media(t),e.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("progress",function(){e.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())}),this.mainSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",function(){e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("ended",function(){e.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",function(){e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)}),this.mainSegmentLoader_.on("reseteverything",function(){e.tech_.trigger("hls-reset")}),this.mainSegmentLoader_.on("segmenttimemapping",function(t){e.tech_.trigger({type:"hls-segment-time-mapping",mapping:t.mapping})}),this.audioSegmentLoader_.on("ended",function(){e.onEndOfStream()})}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}},{key:"smoothQualityChange_",value:function(){var e=this.selectPlaylist();e!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(e),this.mainSegmentLoader_.resetLoader())}},{key:"fastQualityChange_",value:function(){var e=this,t=this.selectPlaylist();t!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(t),this.mainSegmentLoader_.resetEverything(function(){cs.browser.IE_VERSION||cs.browser.IS_EDGE?e.tech_.setCurrentTime(e.tech_.currentTime()+.04):e.tech_.setCurrentTime(e.tech_.currentTime())}))}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.seekTo_(0),this.hasPlayed_()&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.seekTo_(e.end(e.length-1)):void 0}}},{key:"setupFirstPlay",value:function(){var e=this,t=this.masterPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_())return!1;if(!t.endList){var i=this.seekable();if(!i.length)return!1;if(cs.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",function(){e.trigger("firstplay"),e.seekTo_(i.end(0)),e.hasPlayed_=function(){return!0}}),!1;this.trigger("firstplay"),this.seekTo_(i.end(0))}return this.hasPlayed_=function(){return!0},this.load(),!0}},{key:"handleSourceOpen_",value:function(){try{this.setupSourceBuffers_()}catch(e){return cs.log.warn("Failed to create Source Buffers",e),this.mediaSource.endOfStream("decode")}if(this.tech_.autoplay()){var e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,function(e){})}this.trigger("sourceopen")}},{key:"onEndOfStream",value:function(){var e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(e=!this.mainSegmentLoader_.startingMedia_||this.mainSegmentLoader_.startingMedia_.containsVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_),e){this.logger_("calling mediaSource.endOfStream()");try{this.mediaSource.endOfStream()}catch(e){cs.log.warn("Failed to call media source endOfStream",e)}}}},{key:"stuckAtPlaylistEnd_",value:function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.mediaSource.duration);if(null===t)return!1;var i=wh.Playlist.playlistEnd(e,t),r=this.tech_.currentTime(),n=this.tech_.buffered();if(!n.length)return i-r<=.1;var a=n.end(n.length-1);return a-r<=.1&&i-a<=.1}},{key:"blacklistCurrentPlaylist",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments[1],r=void 0;if(r=t.playlist||this.masterPlaylistLoader_.media(),i=i||t.blacklistDuration||this.blacklistDuration,!r){this.error=t;try{return this.mediaSource.endOfStream("network")}catch(e){return this.trigger("error")}}var n=1===this.masterPlaylistLoader_.master.playlists.filter(Fc).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(n)):(n&&(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")),r.excludeUntil=Date.now()+1e3*i,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),e=this.selectPlaylist(),cs.log.warn("Problem encountered with the current HLS playlist."+(t.message?" "+t.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(e,n))}},{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=nd(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0}},{key:"duration",value:function(){return this.masterPlaylistLoader_?this.mediaSource?this.mediaSource.duration:wh.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var e=void 0,t=void 0;if(this.masterPlaylistLoader_){var i=this.masterPlaylistLoader_.media();if(i){var r=this.syncController_.getExpiredTime(i,this.mediaSource.duration);if(null!==r&&0!==(e=wh.Playlist.seekable(i,r)).length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(i=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(r=this.syncController_.getExpiredTime(i,this.mediaSource.duration)))return;if(0===(t=wh.Playlist.seekable(i,r)).length)return}var n=void 0,a=void 0;this.seekable_&&this.seekable_.length&&(n=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)===n&&this.seekable_.start(0)===a||(this.logger_("seekable updated ["+sd(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}}}},{key:"updateDuration",value:function(){var e=this,t=this.mediaSource.duration,i=wh.Playlist.duration(this.masterPlaylistLoader_.media()),r=this.tech_.buffered(),n=function t(){e.logger_("Setting duration from "+e.mediaSource.duration+" => "+i);try{e.mediaSource.duration=i}catch(e){cs.log.warn("Failed to set media source duration",e)}e.tech_.trigger("durationchange"),e.mediaSource.removeEventListener("sourceopen",t)};r.length>0&&(i=Math.max(i,r.end(r.length-1))),t!==i&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",n):n())}},{key:"dispose",value:function(){var e=this;this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),["AUDIO","SUBTITLES"].forEach(function(t){var i=e.mediaTypes_[t].groups;for(var r in i)i[r].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=Ld(this.masterPlaylistLoader_.master,t)).length<1)return this.error="No compatible SourceBuffer configuration for the variant stream:"+t.resolvedUri,this.mediaSource.endOfStream("decode");this.configureLoaderMimeTypes_(e),this.excludeIncompatibleVariants_(t)}}},{key:"configureLoaderMimeTypes_",value:function(e){var t=e.length>1&&-1===e[0].indexOf(",")&&e[0]!==e[1]?new cs.EventTarget:null;this.mainSegmentLoader_.mimeType(e[0],t),e[1]&&this.audioSegmentLoader_.mimeType(e[1],t)}},{key:"excludeUnsupportedVariants_",value:function(){this.master().playlists.forEach(function(t){var i;t.attributes.CODECS&&e.MediaSource&&e.MediaSource.isTypeSupported&&!e.MediaSource.isTypeSupported('video/mp4; codecs="'+(i=t.attributes.CODECS,i.replace(/avc1\.(\d+)\.(\d+)/i,function(e){return kd([e])[0]}))+'"')&&(t.excludeUntil=1/0)})}},{key:"excludeIncompatibleVariants_",value:function(e){var t=2,i=null,r=void 0;e.attributes.CODECS&&(r=wd(e.attributes.CODECS),i=r.videoCodec,t=r.codecCount),this.master().playlists.forEach(function(e){var r={codecCount:2,videoCodec:null};e.attributes.CODECS&&(r=wd(e.attributes.CODECS)),r.codecCount!==t&&(e.excludeUntil=1/0),r.videoCodec!==i&&(e.excludeUntil=1/0)})}},{key:"updateAdCues_",value:function(t){var i=0,r=this.seekable();r.length&&(i=r.start(0)),function(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t.segments)for(var n=r,a=void 0,s=0;s<t.segments.length;s++){var o=t.segments[s];if(a||(a=dh(i,n+o.duration/2)),a){if("cueIn"in o){a.endTime=n,a.adEndTime=n,n+=o.duration,a=null;continue}if(n<a.endTime){n+=o.duration;continue}a.endTime+=o.duration}else if("cueOut"in o&&((a=new e.VTTCue(n,n+o.duration,o.cueOut)).adStartTime=n,a.adEndTime=n+parseFloat(o.cueOut),i.addCue(a)),"cueOutCont"in o){var l,u,c=o.cueOutCont.split("/").map(parseFloat),d=vc(c,2);l=d[0],u=d[1],(a=new e.VTTCue(n,n+o.duration,"")).adStartTime=n-l,a.adEndTime=a.adStartTime+u,i.addCue(a)}n+=o.duration}}(t,this.cueTagsTrack_,i)}},{key:"goalBufferLength",value:function(){var e=this.tech_.currentTime(),t=Yd.GOAL_BUFFER_LENGTH,i=Yd.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,Yd.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,r)}},{key:"bufferLowWaterLine",value:function(){var e=this.tech_.currentTime(),t=Yd.BUFFER_LOW_WATER_LINE,i=Yd.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,Yd.MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,r)}}]),i}(cs.EventTarget),Rh=function e(t,i,r){fc(this,e);var n,a,s,o=t.masterPlaylistController_,l=o[(t.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(o);if(i.attributes.RESOLUTION){var u=i.attributes.RESOLUTION;this.width=u.width,this.height=u.height}this.bandwidth=i.attributes.BANDWIDTH,this.id=r,this.enabled=(n=t.playlists,a=i.uri,s=l,function(e){var t=n.master.playlists[a],i=Nc(t),r=Fc(t);return void 0===e?r:(e?delete t.disabled:t.disabled=!0,e===r||i||(s(),e?n.trigger("renditionenabled"):n.trigger("renditiondisabled")),e)})},Ph=["seeking","seeked","pause","playing","error"],Dh=function(){function t(i){var r=this;fc(this,t),this.tech_=i.tech,this.seekable=i.seekable,this.seekTo=i.seekTo,this.allowSeeksWithinUnsafeLiveWindow=i.allowSeeksWithinUnsafeLiveWindow,this.media=i.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=qd("PlaybackWatcher"),this.logger_("initialize");var n=function(){return r.monitorCurrentTime_()},a=function(){return r.techWaiting_()},s=function(){return r.cancelTimer_()},o=function(){return r.fixesBadSeeks_()};this.tech_.on("seekablechanged",o),this.tech_.on("waiting",a),this.tech_.on(Ph,s),this.tech_.on("canplay",n),this.dispose=function(){r.logger_("dispose"),r.tech_.off("seekablechanged",o),r.tech_.off("waiting",a),r.tech_.off(Ph,s),r.tech_.off("canplay",n),r.checkCurrentTimeTimeout_&&e.clearTimeout(r.checkCurrentTimeTimeout_),r.cancelTimer_()}}return pc(t,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&e.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=e.setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"checkCurrentTime_",value:function(){if(this.tech_.seeking()&&this.fixesBadSeeks_())return this.consecutiveUpdates=0,void(this.lastRecordedTime=this.tech_.currentTime());if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+.1>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null}},{key:"fixesBadSeeks_",value:function(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime(),i=void 0;this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(i=e.end(e.length-1));this.beforeSeekableWindow_(e,t)&&(i=e.start(0)+.1);return void 0!==i&&(this.logger_("Trying to seek outside of seekable at time "+t+" with seekable range "+sd(e)+". Seeking to "+i+"."),this.seekTo(i),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),i=nd(t,e);return i.length&&e+3<=i.end(0)?(this.cancelTimer_(),this.seekTo(e),this.logger_("Stopped at "+e+" while inside a buffered region ["+i.start(0)+" -> "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.seekTo(i),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var r=this.tech_.buffered(),n=ad(r,t);if(this.videoUnderflow_(n,r,t))return this.cancelTimer_(),this.seekTo(t),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;if(n.length>0){var a=n.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+a+", seeking to "+n.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*a,t),!0}return!1}},{key:"afterSeekableWindow_",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!e.length)return!1;var n=e.end(e.length-1)+.1;return!i.endList&&r&&(n=e.end(e.length-1)+3*i.targetDuration),t>n}},{key:"beforeSeekableWindow_",value:function(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-.1)}},{key:"videoUnderflow_",value:function(e,t,i){if(0===e.length){var r=this.gapFromVideoUnderflow_(t,i);if(r)return this.logger_("Encountered a gap in video from "+r.start+" to "+r.end+". Seeking to current time "+i),!0}return!1}},{key:"skipTheGap_",value:function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),r=ad(t,i);this.cancelTimer_(),0!==r.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",r.start(0)),this.seekTo(r.start(0)+1/30),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))}},{key:"gapFromVideoUnderflow_",value:function(e,t){for(var i=function(e){if(e.length<2)return cs.createTimeRanges();for(var t=[],i=1;i<e.length;i++){var r=e.end(i-1),n=e.start(i);t.push([r,n])}return cs.createTimeRanges(t)}(e),r=0;r<i.length;r++){var n=i.start(r),a=i.end(r);if(t-n<4&&t-n>2)return{start:n,end:a}}return null}}]),t}(),Ih={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}},xh=function(e){!function e(t,i){var r=0,n=0,a=cs.mergeOptions(Ih,i);t.ready(function(){t.trigger({type:"usage",name:"hls-error-reload-initialized"})});var s=function(){n&&t.currentTime(n)},o=function(e){null!==e&&void 0!==e&&(n=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(e),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},l=function(){if(Date.now()-r<1e3*a.errorInterval)t.trigger({type:"usage",name:"hls-error-reload-canceled"});else{if(a.getSource&&"function"==typeof a.getSource)return r=Date.now(),a.getSource.call(t,o);cs.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},u=function e(){t.off("loadedmetadata",s),t.off("error",l),t.off("dispose",e)};t.on("error",l),t.on("dispose",u),t.reloadSourceOnError=function(i){u(),e(t,i)}}(this,e)};cs.use("*",function(e){return{setSource:function(e,t){t(null,e)},setCurrentTime:function(t){return e.vhs&&e.currentSource().src===e.vhs.source_.src&&e.vhs.setCurrentTime(t),t},play:function(){e.vhs&&e.currentSource().src===e.vhs.source_.src&&e.vhs.setCurrentTime(e.tech_.currentTime())}}});var Oh={PlaylistLoader:Cc,Playlist:Vc,Decrypter:cc,AsyncStream:oc,decrypt:uc,utils:ed,STANDARD_PLAYLIST_SELECTOR:function(){return function(t,i,r,n,a){var s=t.playlists.map(function(t){var i,r;return i=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width,r=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height,{bandwidth:t.attributes.BANDWIDTH||e.Number.MAX_VALUE,width:i,height:r,playlist:t}});nh(s,function(e,t){return e.bandwidth-t.bandwidth});var o=(s=s.filter(function(e){return!Vc.isIncompatible(e.playlist)})).filter(function(e){return Vc.isEnabled(e.playlist)});o.length||(o=s.filter(function(e){return!Vc.isDisabled(e.playlist)}));var l=o.filter(function(e){return e.bandwidth*Yd.BANDWIDTH_VARIANCE<i}),u=l[l.length-1],c=l.filter(function(e){return e.bandwidth===u.bandwidth})[0];if(!1===a){var d=c||o[0]||s[0];return d?d.playlist:null}var h=l.filter(function(e){return e.width&&e.height});nh(h,function(e,t){return e.width-t.width});var f=h.filter(function(e){return e.width===r&&e.height===n});u=f[f.length-1];var p=f.filter(function(e){return e.bandwidth===u.bandwidth})[0],m=void 0,g=void 0,v=void 0;p||(g=(m=h.filter(function(e){return e.width>r||e.height>n})).filter(function(e){return e.width===m[0].width&&e.height===m[0].height}),u=g[g.length-1],v=g.filter(function(e){return e.bandwidth===u.bandwidth})[0]);var y=v||p||c||o[0]||s[0];return y?y.playlist:null}(this.playlists.master,this.systemBandwidth,parseInt(rh(this.tech_.el(),"width"),10),parseInt(rh(this.tech_.el(),"height"),10),this.limitRenditionByPlayerDimensions)},INITIAL_PLAYLIST_SELECTOR:function(){var e=this.playlists.master.playlists.filter(Vc.isEnabled);return nh(e,function(e,t){return ah(e,t)}),e.filter(function(e){return wd(e.attributes.CODECS).videoCodec})[0]||null},comparePlaylistBandwidth:ah,comparePlaylistResolution:function(t,i){var r=void 0,n=void 0;return t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(r=t.attributes.RESOLUTION.width),r=r||e.Number.MAX_VALUE,i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(n=i.attributes.RESOLUTION.width),r===(n=n||e.Number.MAX_VALUE)&&t.attributes.BANDWIDTH&&i.attributes.BANDWIDTH?t.attributes.BANDWIDTH-i.attributes.BANDWIDTH:r-n},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(Oh,e,{get:function(){return cs.log.warn("using Hls."+e+" is UNSAFE be sure you know what you are doing"),Yd[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"):Yd[e]=t}})});var Mh=function(e){if(/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e))return"hls";return/^application\/dash\+xml/i.test(e)?"dash":null},Uh=function(e,t){for(var i=t.media(),r=-1,n=0;n<e.length;n++)if(e[n].id===i.uri){r=n;break}e.selectedIndex_=r,e.trigger({selectedIndex:r,type:"change"})};Oh.canPlaySource=function(){return cs.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var Bh=function(e){if("dash"===e.options_.sourceType){var t=cs.players[e.tech_.options_.playerId];if(t.eme){var i=function(e,t,i){if(!e)return e;var r={};for(var n in e)r[n]={audioContentType:'audio/mp4; codecs="'+i.attributes.CODECS+'"',videoContentType:'video/mp4; codecs="'+t.attributes.CODECS+'"'},t.contentProtection&&t.contentProtection[n]&&t.contentProtection[n].pssh&&(r[n].pssh=t.contentProtection[n].pssh),"string"==typeof e[n]&&(r[n].url=e[n]);return cs.mergeOptions(e,r)}(e.source_.keySystems,e.playlists.media(),e.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader.media());i&&(t.currentSource().keySystems=i,t.eme.initializeMediaKeys&&t.eme.initializeMediaKeys())}}},Nh=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}};Oh.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))})}(),Oh.supportsNativeDash=!!cs.getTech("Html5").isSupported()&&/maybe|probably/i.test(t.createElement("video").canPlayType("application/dash+xml")),Oh.supportsTypeNatively=function(e){return"hls"===e?Oh.supportsNativeHls:"dash"===e&&Oh.supportsNativeDash},Oh.isSupported=function(){return cs.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var Fh=cs.getComponent("Component"),jh=function(e){function i(e,r,n){fc(this,i);var a=gc(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,r,n.hls));if(r.options_&&r.options_.playerId){var s=cs(r.options_.playerId);s.hasOwnProperty("hls")||Object.defineProperty(s,"hls",{get:function(){return cs.log.warn("player.hls is deprecated. Use player.tech().hls instead."),r.trigger({type:"usage",name:"hls-player-access"}),a},configurable:!0}),s.vhs=a,s.dash=a,a.player_=s}if(a.tech_=r,a.source_=e,a.stats={},a.setOptions_(),a.options_.overrideNative&&r.overrideNativeAudioTracks&&r.overrideNativeVideoTracks)r.overrideNativeAudioTracks(!0),r.overrideNativeVideoTracks(!0);else if(a.options_.overrideNative&&(r.featuresNativeVideoTracks||r.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return a.on(t,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(e){var i=t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement;i&&i.contains(a.tech_.el())&&a.masterPlaylistController_.smoothQualityChange_()}),a.on(a.tech_,"seeking",function(){0===this.tech_.currentTime()&&this.tech_.player_.loop()&&this.setCurrentTime(0)}),a.on(a.tech_,"error",function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()}),a.on(a.tech_,"play",a.play),a}return mc(i,Fh),pc(i,[{key:"setOptions_",value:function(){var e=this;if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.handleManifestRedirects=this.options_.handleManifestRedirects||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){var t=Nh();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=Yd.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Yd.INITIAL_BANDWIDTH,["withCredentials","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys"].forEach(function(t){void 0!==e.source_[t]&&(e.options_[t]=e.source_[t])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions}},{key:"src",value:function(e,t){var i=this;e&&(this.setOptions_(),this.options_.url=this.source_.src,this.options_.tech=this.tech_,this.options_.externHls=Oh,this.options_.sourceType=Mh(t),this.options_.seekTo=function(e){i.tech_.setCurrentTime(e),i.setCurrentTime(e)},this.masterPlaylistController_=new Ah(this.options_),this.playbackWatcher_=new Dh(cs.mergeOptions(this.options_,{seekable:function(){return i.seekable()},media:function(){return i.masterPlaylistController_.media()}})),this.masterPlaylistController_.on("error",function(){cs.players[i.tech_.options_.playerId].error(i.masterPlaylistController_.error)}),this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):Oh.STANDARD_PLAYLIST_SELECTOR.bind(this),this.masterPlaylistController_.selectInitialPlaylist=Oh.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(e){this.masterPlaylistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=e,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e=1/(this.bandwidth||1),t=void 0;return t=this.throughput>0?1/this.throughput:0,Math.floor(1/(e+t))},set:function(){cs.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return od(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return od(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(!window.localStorage)return!1;var t=Nh();t=t?cs.mergeOptions(t,e):e;try{window.localStorage.setItem("videojs-vhs",JSON.stringify(t))}catch(e){return!1}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})}),this.masterPlaylistController_.on("selectedinitialmedia",function(){var e,t;t=(e=i).playlists,e.representations=function(){return t.master.playlists.filter(function(e){return!Nc(e)}).map(function(t,i){return new Rh(e,t,t.uri)})},Bh(i)}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.tech_.ready(function(){return i.setupQualityLevels_()}),this.tech_.el()&&this.tech_.src(cs.URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"setupQualityLevels_",value:function(){var e=this,t=cs.players[this.tech_.options_.playerId];t&&t.qualityLevels&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",function(){var t,i;t=e.qualityLevels_,(i=e).representations().forEach(function(e){t.addQualityLevel(e)}),Uh(t,i.playlists)}),this.playlists.on("mediachange",function(){Uh(e.qualityLevels_,e.playlists)}))}},{key:"play",value:function(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function(e){this.masterPlaylistController_.setCurrentTime(e)}},{key:"duration",value:function(){return this.masterPlaylistController_.duration()}},{key:"seekable",value:function(){return this.masterPlaylistController_.seekable()}},{key:"dispose",value:function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.hls&&delete this.tech_.hls,function e(t,i,r){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,i);if(void 0===n){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,r)}if("value"in n)return n.value;var s=n.get;return void 0!==s?s.call(r):void 0}(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"dispose",this).call(this)}},{key:"convertToProgramTime",value:function(e,t){return td({playlist:this.masterPlaylistController_.media(),time:e,callback:t})}},{key:"seekToProgramTime",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return id({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:r,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}]),i}(),Gh={name:"videojs-http-streaming",VERSION:"1.10.3",canHandleSource:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=cs.mergeOptions(cs.options,t);return Gh.canPlayType(e.type,i)},handleSource:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=cs.mergeOptions(cs.options,i);return t.hls=new jh(e,t,r),t.hls.xhr=qc(),t.hls.src(e.src,e.type),t.hls},canPlayType:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=cs.mergeOptions(cs.options,t).hls.overrideNative,r=Mh(e);return r&&(!Oh.supportsTypeNatively(r)||i)?"maybe":""}};return void 0!==cs.MediaSource&&void 0!==cs.URL||(cs.MediaSource=Ud,cs.URL=Bd),Ud.supportsNativeMediaSources()&&cs.getTech("Html5").registerSourceHandler(Gh,0),cs.HlsHandler=jh,cs.HlsSourceHandler=Gh,cs.Hls=Oh,cs.use||cs.registerComponent("Hls",Oh),cs.options.hls=cs.options.hls||{},cs.registerPlugin?cs.registerPlugin("reloadSourceOnError",xh):cs.plugin("reloadSourceOnError",xh),cs}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):e.videojsSnapshot=t(e.videojs)}(this,function(e){"use strict";e="default"in e?e.default:e;var t,i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};return function(t){var r,n;r=i,n=function(e){var t,i,r={},n=e.registerPlugin||e.plugin,a=e.getComponent("Component"),s=e.getComponent("Button");e.SnapshoterBaseComponent=e.extend(a,{constructor:function(e,t){a.call(this,e,t)},dispose:function(){}}),e.SnapshoterComponent=e.extend(e.SnapshoterBaseComponent,{constructor:function(t,i){a.call(this,t,i),this.loadOptions(),this.resetState(),this.player().one("ready",this.setupUI.bind(this));var r=e.ImageCaptureEngine;try{this.engine=new r(this.player())}catch(t){throw new Error("Could not load "+e.ImageCaptureEngine+" plugin")}},loadOptions:function(){},setupUI:function(){for(var e=this.player().controlBar.children().length,t=e-1;t>=0;t--)if("FullscreenToggle"==this.player().controlBar.children()[t].name_){e=t;break}this.player().controlBar.addChild(this.player().cameraButton,{},e),this.player().options_.controls&&(this.player().controlBar.show(),this.player().controlBar.el().style.display="flex")},isSnapshoting:function(){return this._snapshoting},isProcessing:function(){return this._processing},isDestroyed:function(){return this.player()&&null===this.player().children()},start:function(){this.isProcessing()||(this._snapshoting=!0,this._processing=!0,this.player().controlBar.playToggle.hide(),this.createSnapshot())},stop:function(){this.isProcessing()&&(this._snapshoting=!1,this._processing=!1),this.player().controlBar.playToggle.show()},destroy:function(){this.stop(),this.player().dispose(),this.resetState()},reset:function(){this.stop(),this.loadOptions(),this.resetState(),this.player().reset(),this.player().snapshotCanvas.hide(),this.player().cameraButton.hide()},resetState:function(){this._snapshoting=!1,this._processing=!1},createSnapshot:function(){var e=this;this.captureFrame().then(function(t){e.player().trigger("snap",t),e.stop()}).catch(function(t){console.log(t),e.player().trigger("snap",""),e.stop()})},retrySnapshot:function(){this._processing=!1,this.player().snapshotCanvas.hide()},captureFrame:function(){var e=this,t=this.player().snapshotCanvas.el().firstChild;return t.width=this.player().videoWidth(),t.height=this.player().videoHeight(),new Promise(function(i,r){try{return i(e.engine.imageCaptureByIdAndCanvasDom(e.player().id(),t))}catch(e){return r(e)}})}}),i=e.extend(a),(t=e.extend(s,{constructor:function(e,t){s.call(this,e,t),this.on("click",this.onClick),this.on("tap",this.onClick)}})).prototype.onClick=function(e){e.stopImmediatePropagation();var t=this.player().snapshoter;t.isProcessing()?(t.retrySnapshot(),this.onStop()):t.start()},t.prototype.onStart=function(){this.removeClass("vjs-icon-photo-camera"),this.addClass("vjs-icon-photo-retry"),this.el().firstChild.firstChild.innerHTML=this.localize("Retry")},t.prototype.onStop=function(){this.removeClass("vjs-icon-photo-retry"),this.addClass("vjs-icon-photo-camera"),this.el().firstChild.firstChild.innerHTML=this.localize("Image")};var o=function(n){var s,o,l=this,u=e.mergeOptions(r,n),c=this;c.ready(function(){var t;t=l,e.mergeOptions(r,n),t.addClass("vjs-snapshot")}),c.on("play",function(){try{c.tech_.el_.setAttribute("crossorigin","anonymous")}catch(e){}}),c.snapshoter=new e.SnapshoterComponent(this,{options:u}),c.addChild(c.snapshoter),c.snapshotCanvas=new i(c,{el:(s="snapshot",o={className:"vjs-"+s+"-canvas",innerHTML:"<canvas></canvas>"},a.prototype.createEl("div",o))}),c.snapshotCanvas.hide(),c.snapshoter.addChild(c.snapshotCanvas),c.cameraButton=new t(c,{el:function(e,t,i){var r={className:"vjs-"+e+"-control vjs-control vjs-button",innerHTML:'<span aria-hidden="true" class="vjs-icon-'+i+'"></span><span class="vjs-control-text" aria-live="polite">'+t+"</span>"},n={title:t,type:"button","aria-disabled":"false"};return a.prototype.createEl("button",r,n)}("snapshot",c.localize("Snapshot"),"spinner"),name:"SnapButton"}),c.cameraButton.show()};return n("snapshot",o),o},t.exports?t.exports=n(e):r.returnExports=n(r.videojs),function(i,r){t.exports?t.exports=r(e):i.returnExports=r(i.videojs)}(i,function(e){var t=e.getComponent("Component");e.ImageCaptureEngine=e.extend(t,{constructor:function(e,i){t.call(this,e,i)},formatTag:function(e){if(e&&0!==(e=e.trim()).length)return e},getDomByIdAndTag:function(e,t){t=this.formatTag(t);var i=document.getElementById(e);if(t&&0!==t.trim().length)return i.tagName.toUpperCase()===t.toUpperCase()?i:i.getElementsByTagName(t)[0]},getScreenContainerDomByIdAndTag:function(e,t){if(t=this.formatTag(t))return this.getDomByIdAndTag(e,t);var i=this.getDomByIdAndTag(e,"object");return i||this.getDomByIdAndTag(e,"video")},drawCanvas:function(e,t){e.width=t.videoWidth,e.height=t.videoHeight,e.getContext("2d").drawImage(t,0,0,e.width,e.height)},imageCaptureByDom:function(e,t){var i;return e&&e.tagName.toUpperCase()==="object".toUpperCase()?i=e.vjs_snap():(this.drawCanvas(t,e),i=t.toDataURL("image/png")),i},imageCaptureById:function(e,t){return this.imageCaptureByDom(this.getScreenContainerDomByIdAndTag(e),this.getDomByIdAndTag(t,"canvas"))},imageCaptureByIdAndCanvasDom:function(e,t){return this.imageCaptureByDom(this.getScreenContainerDomByIdAndTag(e),t)}})})}(t={exports:{}},t.exports),t.exports}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).flvjs=e()}}(function(){return function(){return function e(t,i,r){function n(s,o){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=i[s]={exports:{}};t[s][0].call(c.exports,function(e){return n(t[s][1][e]||e)},c,c.exports,e,t,i,r)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}}()({1:[function(e,t,i){(function(r,n){!function(e,r){"object"==typeof i&&void 0!==t?t.exports=r():e.ES6Promise=r()}(this,function(){"use strict";function t(e){return"function"==typeof e}var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=0,s=void 0,o=void 0,l=function(e,t){m[a]=e,m[a+1]=t,2===(a+=2)&&(o?o(g):T())};var u="undefined"!=typeof window?window:void 0,c=u||{},d=c.MutationObserver||c.WebKitMutationObserver,h="undefined"==typeof self&&void 0!==r&&"[object process]"==={}.toString.call(r),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(g,1)}}var m=new Array(1e3);function g(){for(var e=0;e<a;e+=2){(0,m[e])(m[e+1]),m[e]=void 0,m[e+1]=void 0}a=0}var v,y,_,b,T=void 0;function S(e,t){var i=this,r=new this.constructor(w);void 0===r[k]&&j(r);var n=i._state;if(n){var a=arguments[n-1];l(function(){return N(n,r,a,i._result)})}else U(i,r,e,t);return r}function E(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(w);return I(t,e),t}h?T=function(){return r.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===u&&"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 k=Math.random().toString(36).substring(2);function w(){}var C=void 0,L=1,A=2,R={error:null};function P(e){try{return e.then}catch(e){return R.error=e,R}}function D(e,i,r){i.constructor===e.constructor&&r===S&&i.constructor.resolve===E?function(e,t){t._state===L?O(e,t._result):t._state===A?M(e,t._result):U(t,void 0,function(t){return I(e,t)},function(t){return M(e,t)})}(e,i):r===R?(M(e,R.error),R.error=null):void 0===r?O(e,i):t(r)?function(e,t,i){l(function(e){var r=!1,n=function(e,t,i,r){try{e.call(t,i,r)}catch(e){return e}}(i,t,function(i){r||(r=!0,t!==i?I(e,i):O(e,i))},function(t){r||(r=!0,M(e,t))},e._label);!r&&n&&(r=!0,M(e,n))},e)}(e,i,r):O(e,i)}function I(e,t){var i,r;e===t?M(e,new TypeError("You cannot resolve a promise with itself")):(r=typeof(i=t),null===i||"object"!==r&&"function"!==r?O(e,t):D(e,t,P(t)))}function x(e){e._onerror&&e._onerror(e._result),B(e)}function O(e,t){e._state===C&&(e._result=t,e._state=L,0!==e._subscribers.length&&l(B,e))}function M(e,t){e._state===C&&(e._state=A,e._result=t,l(x,e))}function U(e,t,i,r){var n=e._subscribers,a=n.length;e._onerror=null,n[a]=t,n[a+L]=i,n[a+A]=r,0===a&&e._state&&l(B,e)}function B(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var r=void 0,n=void 0,a=e._result,s=0;s<t.length;s+=3)r=t[s],n=t[s+i],r?N(i,r,n,a):n(a);e._subscribers.length=0}}function N(e,i,r,n){var a=t(r),s=void 0,o=void 0,l=void 0,u=void 0;if(a){if((s=function(e,t){try{return e(t)}catch(e){return R.error=e,R}}(r,n))===R?(u=!0,o=s.error,s.error=null):l=!0,i===s)return void M(i,new TypeError("A promises callback cannot return that same promise."))}else s=n,l=!0;i._state!==C||(a&&l?I(i,s):u?M(i,o):e===L?O(i,s):e===A&&M(i,s))}var F=0;function j(e){e[k]=F++,e._state=void 0,e._result=void 0,e._subscribers=[]}var G=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(w),this.promise[k]||j(this.promise),i(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?O(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&O(this.promise,this._result))):M(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===C&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,r=i.resolve;if(r===E){var n=P(e);if(n===S&&e._state!==C)this._settledAt(e._state,t,e._result);else if("function"!=typeof n)this._remaining--,this._result[t]=e;else if(i===V){var a=new i(w);D(a,e,n),this._willSettleAt(a,t)}else this._willSettleAt(new i(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},e.prototype._settledAt=function(e,t,i){var r=this.promise;r._state===C&&(this._remaining--,e===A?M(r,i):this._result[t]=i),0===this._remaining&&O(r,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;U(e,void 0,function(e){return i._settledAt(L,t,e)},function(e){return i._settledAt(A,t,e)})},e}();var V=function(){function e(t){this[k]=F++,this._result=this._state=void 0,this._subscribers=[],w!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){I(e,t)},function(t){M(e,t)})}catch(t){M(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var i=this.constructor;return t(e)?this.then(function(t){return i.resolve(e()).then(function(){return t})},function(t){return i.resolve(e()).then(function(){throw t})}):this.then(e,e)},e}();return V.prototype.then=S,V.all=function(e){return new G(this,e).promise},V.race=function(e){var t=this;return i(e)?new t(function(i,r){for(var n=e.length,a=0;a<n;a++)t.resolve(e[a]).then(i,r)}):new t(function(e,t){return t(new TypeError("You must pass an array to race."))})},V.resolve=E,V.reject=function(e){var t=new this(w);return M(t,e),t},V._setScheduler=function(e){o=e},V._setAsap=function(e){l=e},V._asap=l,V.polyfill=function(){var e=void 0;if(void 0!==n)e=n;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var i=null;try{i=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===i&&!t.cast)return}e.Promise=V},V.Promise=V,V})}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],2:[function(e,t,i){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.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},r.prototype.emit=function(e){var t,i,r,o,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(s(i=this._events[e]))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),i.apply(this,o)}else if(a(i))for(o=Array.prototype.slice.call(arguments,1),r=(u=i.slice()).length,l=0;l<r;l++)u[l].apply(this,o);return!0},r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(i=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){if(!n(t))throw TypeError("listener must be a function");var i=!1;function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var i,r,s,o;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(i=this._events[e]).length,r=-1,i===t||n(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(i)){for(o=s;o-- >0;)if(i[o]===t||i[o].listener&&i[o].listener===t){r=o;break}if(r<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n(i=this._events[e]))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],3:[function(e,t,i){var r,n,a=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function l(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var u,c=[],d=!1,h=-1;function f(){d&&u&&(d=!1,u.length?c=u.concat(c):h=-1,c.length&&p())}function p(){if(!d){var e=l(f);d=!0;for(var t=c.length;t;){for(u=c,c=[];++h<t;)u&&u[h].run();h=-1,t=c.length}u=null,d=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function g(){}a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];c.push(new m(e,t)),1!==c.length||d||l(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=g,a.addListener=g,a.once=g,a.off=g,a.removeListener=g,a.removeAllListeners=g,a.emit=g,a.prependListener=g,a.prependOnceListener=g,a.listeners=function(e){return[]},a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],4:[function(e,t,i){var r=arguments[3],n=arguments[4],a=arguments[5],s=JSON.stringify;t.exports=function(e,t){for(var i,o=Object.keys(a),l=0,u=o.length;l<u;l++){var c=o[l],d=a[c].exports;if(d===e||d&&d.default===e){i=c;break}}if(!i){i=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var h={};for(l=0,u=o.length;l<u;l++){h[c=o[l]]=c}n[i]=["function(require,module,exports){"+e+"(self); }",h]}var f=Math.floor(Math.pow(16,8)*Math.random()).toString(16),p={};p[i]=i,n[f]=["function(require,module,exports){var f = require("+s(i)+");(f.default ? f.default : f)(self);}",p];var m={};!function e(t){m[t]=!0;for(var i in n[t][1]){var r=n[t][1][i];m[r]||e(r)}}(f);var g="("+r+")({"+Object.keys(m).map(function(e){return s(e)+":["+n[e][0]+","+s(n[e][1])+"]"}).join(",")+"},{},["+s(f)+"])",v=window.URL||window.webkitURL||window.mozURL||window.msURL,y=new Blob([g],{type:"text/javascript"});if(t&&t.bare)return y;var _=v.createObjectURL(y),b=new Worker(_);return b.objectURL=_,b}},{}],5:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.createDefaultConfig=function(){return Object.assign({},r)};var r=i.defaultConfig={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0}},{}],6:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r,n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=e("../io/io-controller.js"),s=(r=a)&&r.__esModule?r:{default:r},o=e("../config.js");var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return n(e,null,[{key:"supportMSEH264Playback",value:function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"supportNetworkStreamIO",value:function(){var e=new s.default({},(0,o.createDefaultConfig)()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t}},{key:"getNetworkLoaderTypeName",value:function(){var e=new s.default({},(0,o.createDefaultConfig)()),t=e.loaderType;return e.destroy(),t}},{key:"supportNativeMediaPlayback",value:function(t){void 0==e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"==i}},{key:"getFeatureList",value:function(){var t={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.mseFlvPlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLiveFlvPlayback=t.mseFlvPlayback&&t.networkStreamIO,t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeMP4H265Playback=e.supportNativeMediaPlayback('video/mp4; codecs="hvc1.1.6.L93.B0, mp4a.40.2"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t}}]),e}();i.default=l},{"../config.js":5,"../io/io-controller.js":23}],7:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}();var n=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 r(e,[{key:"isComplete",value:function(){var e=!1===this.hasAudio||!0===this.hasAudio&&this.audioCodec,t=!1===this.hasVideo||!0===this.hasVideo&&this.videoCodec;return e&&t}},{key:"isSeekable",value:function(){return!0===this.hasKeyframesIndex}},{key:"getNearestKeyframe",value:function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}}},{key:"_search",value:function(e,t){var i=0,r=e.length-1,n=0,a=0,s=r;for(t<e[0]&&(i=0,a=s+1);a<=s;){if((n=a+Math.floor((s-a)/2))===r||t>=e[n]&&t<e[n+1]){i=n;break}e[n]<t?a=n+1:s=n-1}return i}}]),e}();i.default=n},{}],8:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}i.SampleInfo=function e(t,i,r,a,s){n(this,e),this.dts=t,this.pts=i,this.duration=r,this.originalDts=a,this.isSyncPoint=s,this.fileposition=null},i.MediaSegmentInfo=function(){function e(){n(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 r(e,[{key:"appendSyncPoint",value:function(e){e.isSyncPoint=!0,this.syncPoints.push(e)}}]),e}(),i.IDRSampleList=function(){function e(){n(this,e),this._list=[]}return r(e,[{key:"clear",value:function(){this._list=[]}},{key:"appendArray",value:function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))}},{key:"getLastSyncPointBeforeDts",value:function(e){if(0==this._list.length)return null;var t=this._list,i=0,r=t.length-1,n=0,a=0,s=r;for(e<t[0].dts&&(i=0,a=s+1);a<=s;){if((n=a+Math.floor((s-a)/2))===r||e>=t[n].dts&&e<t[n+1].dts){i=n;break}t[n].dts<e?a=n+1:s=n-1}return this._list[i]}}]),e}(),i.MediaSegmentInfoList=function(){function e(t){n(this,e),this._type=t,this._list=[],this._lastAppendLocation=-1}return r(e,[{key:"isEmpty",value:function(){return 0===this._list.length}},{key:"clear",value:function(){this._list=[],this._lastAppendLocation=-1}},{key:"_searchNearestSegmentBefore",value:function(e){var t=this._list;if(0===t.length)return-2;var i=t.length-1,r=0,n=0,a=i,s=0;if(e<t[0].originalBeginDts)return s=-1;for(;n<=a;){if((r=n+Math.floor((a-n)/2))===i||e>t[r].lastSample.originalDts&&e<t[r+1].originalBeginDts){s=r;break}t[r].originalBeginDts<e?n=r+1:a=r-1}return s}},{key:"_searchNearestSegmentAfter",value:function(e){return this._searchNearestSegmentBefore(e)+1}},{key:"append",value:function(e){var t=this._list,i=e,r=this._lastAppendLocation,n=0;-1!==r&&r<t.length&&i.originalBeginDts>=t[r].lastSample.originalDts&&(r===t.length-1||r<t.length-1&&i.originalBeginDts<t[r+1].originalBeginDts)?n=r+1:t.length>0&&(n=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=n,this._list.splice(n,0,i)}},{key:"getLastSegmentBefore",value:function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null}},{key:"getLastSampleBefore",value:function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null}},{key:"getLastSyncPointBefore",value:function(e){for(var t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null}},{key:"type",get:function(){return this._type}},{key:"length",get:function(){return this._list.length}}]),e}()},{}],9:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n=c(e("events")),a=c(e("../utils/logger.js")),s=c(e("../utils/browser.js")),o=c(e("./mse-events.js")),l=e("./media-segment-info.js"),u=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 n.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 l.IDRSampleList}return r(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 u.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");var t=this._mediaSource=new window.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL}},{key:"detachMediaElement",value:function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var r=this._sourceBuffers[t];if(r){if("closed"!==e.readyState){try{e.removeSourceBuffer(r)}catch(e){a.default.e(this.TAG,e.message)}r.removeEventListener("error",this.e.onSourceBufferError),r.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){a.default.e(this.TAG,e.message)}e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)}},{key:"appendInitSegment",value:function(e,t){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var i=e,r=""+i.container;i.codec&&i.codec.length>0&&(r+=";codecs="+i.codec);var n=!1;if(a.default.v(this.TAG,"Received Initialization Segment, mimeType: "+r),this._lastInitSegments[i.type]=i,r!==this._mimeTypes[i.type]){if(this._mimeTypes[i.type])a.default.v(this.TAG,"Notice: "+i.type+" mimeType changed, origin: "+this._mimeTypes[i.type]+", target: "+r);else{n=!0;try{var l=this._sourceBuffers[i.type]=this._mediaSource.addSourceBuffer(r);l.addEventListener("error",this.e.onSourceBufferError),l.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return a.default.e(this.TAG,e.message),void this._emitter.emit(o.default.ERROR,{code:e.code,msg:e.message})}}this._mimeTypes[i.type]=r}t||this._pendingSegments[i.type].push(i),n||this._sourceBuffers[i.type]&&!this._sourceBuffers[i.type].updating&&this._doAppendSegments(),s.default.safari&&"audio/mpeg"===i.container&&i.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=i.mediaDuration/1e3,this._updateMediaSourceDuration())}},{key:"appendMediaSegment",value:function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()}},{key:"seek",value:function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var i=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{i.abort()}catch(e){a.default.e(this.TAG,e.message)}this._idrList.clear();var r=this._pendingSegments[t];if(r.splice(0,r.length),"closed"!==this._mediaSource.readyState){for(var n=0;n<i.buffered.length;n++){var o=i.buffered.start(n),l=i.buffered.end(n);this._pendingRemoveRanges[t].push({start:o,end:l})}if(i.updating||this._doRemoveRanges(),s.default.safari){var u=this._lastInitSegments[t];u&&(this._pendingSegments[t].push(u),i.updating||this._doAppendSegments())}}}}},{key:"endOfStream",value:function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)}},{key:"getNearestKeyframe",value:function(e){return this._idrList.getLastSyncPointBeforeDts(e)}},{key:"_needCleanupSourceBuffer",value:function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){var r=i.buffered;if(r.length>=1&&e-r.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1}},{key:"_doCleanupSourceBuffer",value:function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){for(var r=i.buffered,n=!1,a=0;a<r.length;a++){var s=r.start(a),o=r.end(a);if(s<=e&&e<o+3){if(e-s>=this._config.autoCleanupMaxBackwardDuration){n=!0;var l=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:s,end:l})}}else o<e&&(n=!0,this._pendingRemoveRanges[t].push({start:s,end:o}))}n&&!i.updating&&this._doRemoveRanges()}}}},{key:"_updateMediaSourceDuration",value:function(){var e=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,i=this._pendingMediaDuration;i>0&&(isNaN(t)||i>t)&&(a.default.v(this.TAG,"Update MediaSource duration from "+t+" to "+i),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}}},{key:"_doRemoveRanges",value:function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];i.length&&!t.updating;){var r=i.shift();t.remove(r.start,r.end)}}},{key:"_doAppendSegments",value:function(){var e=this._pendingSegments;for(var t in e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&e[t].length>0){var i=e[t].shift();if(i.timestampOffset){var r=this._sourceBuffers[t].timestampOffset,n=i.timestampOffset/1e3;Math.abs(r-n)>.1&&(a.default.v(this.TAG,"Update MPEG audio timestampOffset from "+r+" to "+n),this._sourceBuffers[t].timestampOffset=n),delete i.timestampOffset}if(!i.data||0===i.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(i.data),this._isBufferFull=!1,"video"===t&&i.hasOwnProperty("info")&&this._idrList.appendArray(i.info.syncPoints)}catch(e){this._pendingSegments[t].unshift(i),22===e.code?(this._isBufferFull||this._emitter.emit(o.default.BUFFER_FULL),this._isBufferFull=!0):(a.default.e(this.TAG,t,e.message),this._emitter.emit(o.default.ERROR,{code:e.code,msg:e.message}))}}}},{key:"_onSourceOpen",value:function(){if(a.default.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(o.default.SOURCE_OPEN)}},{key:"_onSourceEnded",value:function(){a.default.v(this.TAG,"MediaSource onSourceEnded")}},{key:"_onSourceClose",value:function(){a.default.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))}},{key:"_hasPendingSegments",value:function(){var e=this._pendingSegments;return e.video&&e.video.length>0||e.audio&&e.audio.length>0}},{key:"_hasPendingRemoveRanges",value:function(){var e=this._pendingRemoveRanges;return e.video&&e.video.length>0||e.audio&&e.audio.length>0}},{key:"_onSourceBufferUpdateEnd",value:function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(o.default.UPDATE_END)}},{key:"_onSourceBufferError",value:function(e){a.default.e(this.TAG,"SourceBuffer Error: "+e)}}]),e}();i.default=d},{"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./media-segment-info.js":8,"./mse-events.js":10,events:2}],10:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.default={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"}},{}],11:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n=d(e("events")),a=d(e("../utils/logger.js")),s=d(e("../utils/logging-control.js")),o=d(e("./transmuxing-controller.js")),l=d(e("./transmuxing-events.js")),u=d(e("./transmuxing-worker.js")),c=d(e("./media-info.js"));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(){function t(i,r){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 n.default,r.enableWorker&&"undefined"!=typeof Worker)try{var c=e("webworkify");this._worker=c(u.default),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[i,r]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},s.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:s.default.getConfig()})}catch(e){a.default.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new o.default(i,r)}else this._controller=new o.default(i,r);if(this._controller){var d=this._controller;d.on(l.default.IO_ERROR,this._onIOError.bind(this)),d.on(l.default.DEMUX_ERROR,this._onDemuxError.bind(this)),d.on(l.default.INIT_SEGMENT,this._onInitSegment.bind(this)),d.on(l.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),d.on(l.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),d.on(l.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),d.on(l.default.MEDIA_INFO,this._onMediaInfo.bind(this)),d.on(l.default.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),d.on(l.default.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),d.on(l.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),d.on(l.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return r(t,[{key:"destroy",value:function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),s.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter&&this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"hasWorker",value:function(){return null!=this._worker}},{key:"open",value:function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()}},{key:"close",value:function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()}},{key:"seek",value:function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)}},{key:"pause",value:function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()}},{key:"resume",value:function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()}},{key:"_onInitSegment",value:function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(l.default.INIT_SEGMENT,e,t)}).catch(function(){})}},{key:"_onMediaSegment",value:function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(l.default.MEDIA_SEGMENT,e,t)}).catch(function(){})}},{key:"_onLoadingComplete",value:function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(l.default.LOADING_COMPLETE)}).catch(function(){})}},{key:"_onRecoveredEarlyEof",value:function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(l.default.RECOVERED_EARLY_EOF)}).catch(function(){})}},{key:"_onMediaInfo",value:function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(l.default.MEDIA_INFO,e)}).catch(function(){})}},{key:"_onMetaDataArrived",value:function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(l.default.METADATA_ARRIVED,e)}).catch(function(){})}},{key:"_onScriptDataArrived",value:function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(l.default.SCRIPTDATA_ARRIVED,e)}).catch(function(){})}},{key:"_onStatisticsInfo",value:function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(l.default.STATISTICS_INFO,e)}).catch(function(){})}},{key:"_onIOError",value:function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(l.default.IO_ERROR,e,t)}).catch(function(){})}},{key:"_onDemuxError",value:function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(l.default.DEMUX_ERROR,e,t)}).catch(function(){})}},{key:"_onRecommendSeekpoint",value:function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(l.default.RECOMMEND_SEEKPOINT,e)}).catch(function(){})}},{key:"_onLoggingConfigChanged",value:function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})}},{key:"_onWorkerMessage",value:function(e){var t=e.data,i=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case l.default.INIT_SEGMENT:case l.default.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case l.default.LOADING_COMPLETE:case l.default.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case l.default.MEDIA_INFO:Object.setPrototypeOf(i,c.default.prototype),this._emitter.emit(t.msg,i);break;case l.default.METADATA_ARRIVED:case l.default.SCRIPTDATA_ARRIVED:case l.default.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case l.default.IO_ERROR:case l.default.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case l.default.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":a.default.emitter.emit("log",i.type,i.logcat)}}}]),t}();i.default=h},{"../utils/logger.js":41,"../utils/logging-control.js":42,"./media-info.js":7,"./transmuxing-controller.js":12,"./transmuxing-events.js":13,"./transmuxing-worker.js":14,events:2,webworkify:4}],12:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n=f(e("events")),a=f(e("../utils/logger.js")),s=f(e("../utils/browser.js")),o=f(e("./media-info.js")),l=f(e("../demux/flv-demuxer.js")),u=f(e("../remux/mp4-remuxer.js")),c=f(e("../demux/demux-errors.js")),d=f(e("../io/io-controller.js")),h=f(e("./transmuxing-events.js"));e("../io/loader.js");function f(e){return e&&e.__esModule?e:{default:e}}var p=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="TransmuxingController",this._emitter=new n.default,this._config=i,t.segments||(t.segments=[{duration:t.duration,filesize:t.filesize,url:t.url}]),"boolean"!=typeof t.cors&&(t.cors=!0),"boolean"!=typeof t.withCredentials&&(t.withCredentials=!1),this._mediaDataSource=t,this._currentSegmentIndex=0;var r=0;this._mediaDataSource.segments.forEach(function(e){e.timestampBase=r,r+=e.duration,e.cors=t.cors,e.withCredentials=t.withCredentials,i.referrerPolicy&&(e.referrerPolicy=i.referrerPolicy)}),isNaN(r)||this._mediaDataSource.duration===r||(this._mediaDataSource.duration=r),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return r(e,[{key:"destroy",value:function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter&&this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"start",value:function(){this._loadSegment(0),this._enableStatisticsReporter()}},{key:"_loadSegment",value:function(e,t){this._currentSegmentIndex=e;var i=this._mediaDataSource.segments[e],r=this._ioctl=new d.default(i,this._config,e);r.onError=this._onIOException.bind(this),r.onSeeked=this._onIOSeeked.bind(this),r.onComplete=this._onIOComplete.bind(this),r.onRedirect=this._onIORedirect.bind(this),r.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):r.onDataArrival=this._onInitChunkArrival.bind(this),r.open(t)}},{key:"stop",value:function(){this._internalAbort(),this._disableStatisticsReporter()}},{key:"_internalAbort",value:function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)}},{key:"pause",value:function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())}},{key:"resume",value:function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())}},{key:"seek",value:function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var i=this._mediaInfo.segments[t];if(void 0==i)this._pendingSeekTime=e;else{var r=i.getNearestKeyframe(e);this._remuxer.seek(r.milliseconds),this._ioctl.seek(r.fileposition),this._pendingResolveSeekPoint=r.milliseconds}}else{var n=this._mediaInfo.segments[t];if(void 0==n)this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t);else{var a=n.getNearestKeyframe(e);this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,a.fileposition),this._pendingResolveSeekPoint=a.milliseconds,this._reportSegmentMediaInfo(t)}}this._enableStatisticsReporter()}}},{key:"_searchSegmentIndexContains",value:function(e){for(var t=this._mediaDataSource.segments,i=t.length-1,r=0;r<t.length;r++)if(e<t[r].timestampBase){i=r-1;break}return i}},{key:"_onInitChunkArrival",value:function(e,t){var i=this,r=null,n=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,n=this._demuxer.parseChunks(e,t);else if((r=l.default.probe(e)).match){this._demuxer=new l.default(r,this._config),this._remuxer||(this._remuxer=new u.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),n=this._demuxer.parseChunks(e,t)}else r=null,a.default.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(function(){i._internalAbort()}),this._emitter.emit(h.default.DEMUX_ERROR,c.default.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),n=0;return n}},{key:"_onMediaInfo",value:function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,o.default.prototype));var i=Object.assign({},e);Object.setPrototypeOf(i,o.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then(function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)})}},{key:"_onMetaDataArrived",value:function(e){this._emitter.emit(h.default.METADATA_ARRIVED,e)}},{key:"_onScriptDataArrived",value:function(e){this._emitter.emit(h.default.SCRIPTDATA_ARRIVED,e)}},{key:"_onIOSeeked",value:function(){this._remuxer.insertDiscontinuity()}},{key:"_onIOComplete",value:function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer&&this._remuxer.flushStashedSamples(),this._emitter.emit(h.default.LOADING_COMPLETE),this._disableStatisticsReporter())}},{key:"_onIORedirect",value:function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e}},{key:"_onIORecoveredEarlyEof",value:function(){this._emitter.emit(h.default.RECOVERED_EARLY_EOF)}},{key:"_onIOException",value:function(e,t){a.default.e(this.TAG,"IOException: type = "+e+", code = "+t.code+", msg = "+t.msg),this._emitter.emit(h.default.IO_ERROR,e,t),this._disableStatisticsReporter()}},{key:"_onDemuxException",value:function(e,t){a.default.e(this.TAG,"DemuxException: type = "+e+", info = "+t),this._emitter.emit(h.default.DEMUX_ERROR,e,t)}},{key:"_onRemuxerInitSegmentArrival",value:function(e,t){this._emitter.emit(h.default.INIT_SEGMENT,e,t)}},{key:"_onRemuxerMediaSegmentArrival",value:function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(h.default.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var i=t.info.syncPoints,r=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,s.default.safari&&i.length>0&&i[0].originalDts===r&&(r=i[0].pts),this._emitter.emit(h.default.RECOMMEND_SEEKPOINT,r)}}},{key:"_enableStatisticsReporter",value:function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))}},{key:"_disableStatisticsReporter",value:function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"_reportSegmentMediaInfo",value:function(e){var t=this._mediaInfo.segments[e],i=Object.assign({},t);i.duration=this._mediaInfo.duration,i.segmentCount=this._mediaInfo.segmentCount,delete i.segments,delete i.keyframesIndex,this._emitter.emit(h.default.MEDIA_INFO,i)}},{key:"_reportStatisticsInfo",value:function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(h.default.STATISTICS_INFO,e)}}]),e}();i.default=p},{"../demux/demux-errors.js":16,"../demux/flv-demuxer.js":18,"../io/io-controller.js":23,"../io/loader.js":24,"../remux/mp4-remuxer.js":38,"../utils/browser.js":39,"../utils/logger.js":41,"./media-info.js":7,"./transmuxing-events.js":13,events:2}],13:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.default={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},{}],14:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});o(e("../utils/logger.js"));var r=o(e("../utils/logging-control.js")),n=o(e("../utils/polyfill.js")),a=o(e("./transmuxing-controller.js")),s=o(e("./transmuxing-events.js"));function o(e){return e&&e.__esModule?e:{default:e}}i.default=function(e){var t=null,i=function(t,i){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:i}})}.bind(this);n.default.install(),e.addEventListener("message",function(n){switch(n.data.cmd){case"init":(t=new a.default(n.data.param[0],n.data.param[1])).on(s.default.IO_ERROR,function(t,i){e.postMessage({msg:s.default.IO_ERROR,data:{type:t,info:i}})}.bind(this)),t.on(s.default.DEMUX_ERROR,function(t,i){e.postMessage({msg:s.default.DEMUX_ERROR,data:{type:t,info:i}})}.bind(this)),t.on(s.default.INIT_SEGMENT,function(t,i){var r={msg:s.default.INIT_SEGMENT,data:{type:t,data:i}};e.postMessage(r,[i.data])}.bind(this)),t.on(s.default.MEDIA_SEGMENT,function(t,i){var r={msg:s.default.MEDIA_SEGMENT,data:{type:t,data:i}};e.postMessage(r,[i.data])}.bind(this)),t.on(s.default.LOADING_COMPLETE,function(){var t={msg:s.default.LOADING_COMPLETE};e.postMessage(t)}.bind(this)),t.on(s.default.RECOVERED_EARLY_EOF,function(){var t={msg:s.default.RECOVERED_EARLY_EOF};e.postMessage(t)}.bind(this)),t.on(s.default.MEDIA_INFO,function(t){var i={msg:s.default.MEDIA_INFO,data:t};e.postMessage(i)}.bind(this)),t.on(s.default.METADATA_ARRIVED,function(t){var i={msg:s.default.METADATA_ARRIVED,data:t};e.postMessage(i)}.bind(this)),t.on(s.default.SCRIPTDATA_ARRIVED,function(t){var i={msg:s.default.SCRIPTDATA_ARRIVED,data:t};e.postMessage(i)}.bind(this)),t.on(s.default.STATISTICS_INFO,function(t){var i={msg:s.default.STATISTICS_INFO,data:t};e.postMessage(i)}.bind(this)),t.on(s.default.RECOMMEND_SEEKPOINT,function(t){e.postMessage({msg:s.default.RECOMMEND_SEEKPOINT,data:t})}.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(n.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var o=n.data.param;r.default.applyConfig(o),!0===o.enableCallback?r.default.addLogListener(i):r.default.removeLogListener(i)}})}},{"../utils/logger.js":41,"../utils/logging-control.js":42,"../utils/polyfill.js":43,"./transmuxing-controller.js":12,"./transmuxing-events.js":13}],15:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n=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 l,u=(l=new ArrayBuffer(2),new DataView(l).setInt16(0,256,!0),256===new Int16Array(l)[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 r(e,null,[{key:"parseScriptData",value:function(t,i,r){var n={};try{var a=e.parseValue(t,i,r),s=e.parseValue(t,i+a.size,r-a.size);n[a.data]=s.data}catch(e){}return n}},{key:"parseObject",value:function(t,i,r){if(r<3)throw new s.IllegalStateException("Data not enough when parse ScriptDataObject");var n=e.parseString(t,i,r),a=e.parseValue(t,i+n.size,r-n.size),o=a.objectEnd;return{data:{name:n.data,value:a.data},size:n.size+a.size,objectEnd:o}}},{key:"parseVariable",value:function(t,i,r){return e.parseObject(t,i,r)}},{key:"parseString",value:function(e,t,i){if(i<2)throw new s.IllegalStateException("Data not enough when parse String");var r=new DataView(e,t,i).getUint16(0,!u);return{data:r>0?(0,a.default)(new Uint8Array(e,t+2,r)):"",size:2+r}}},{key:"parseLongString",value:function(e,t,i){if(i<4)throw new s.IllegalStateException("Data not enough when parse LongString");var r=new DataView(e,t,i).getUint32(0,!u);return{data:r>0?(0,a.default)(new Uint8Array(e,t+4,r)):"",size:4+r}}},{key:"parseDate",value:function(e,t,i){if(i<10)throw new s.IllegalStateException("Data size invalid when parse Date");var r=new DataView(e,t,i),n=r.getFloat64(0,!u),a=r.getInt16(8,!u);return{data:new Date(n+=60*a*1e3),size:10}}},{key:"parseValue",value:function(t,i,r){if(r<1)throw new s.IllegalStateException("Data not enough when parse Value");var a=new DataView(t,i,r),o=1,l=a.getUint8(0),c=void 0,d=!1;try{switch(l){case 0:c=a.getFloat64(1,!u),o+=8;break;case 1:c=!!a.getUint8(1),o+=1;break;case 2:var h=e.parseString(t,i+1,r-1);c=h.data,o+=h.size;break;case 3:c={};var f=0;for(9==(16777215&a.getUint32(r-4,!u))&&(f=3);o<r-4;){var p=e.parseObject(t,i+o,r-o-f);if(p.objectEnd)break;c[p.data.name]=p.data.value,o+=p.size}if(o<=r-3)9===(16777215&a.getUint32(o-1,!u))&&(o+=3);break;case 8:c={},o+=4;var m=0;for(9==(16777215&a.getUint32(r-4,!u))&&(m=3);o<r-8;){var g=e.parseVariable(t,i+o,r-o-m);if(g.objectEnd)break;c[g.data.name]=g.data.value,o+=g.size}if(o<=r-3)9===(16777215&a.getUint32(o-1,!u))&&(o+=3);break;case 9:c=void 0,o=1,d=!0;break;case 10:c=[];var v=a.getUint32(1,!u);o+=4;for(var y=0;y<v;y++){var _=e.parseValue(t,i+o,r-o);c.push(_.data),o+=_.size}break;case 11:var b=e.parseDate(t,i+1,r-1);c=b.data,o+=b.size;break;case 12:var T=e.parseString(t,i+1,r-1);c=T.data,o+=T.size;break;default:o=r,n.default.w("AMF","Unsupported AMF value type "+l)}}catch(e){n.default.e("AMF",e.toString())}return{data:c,size:o,objectEnd:d}}}]),e}();i.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"../utils/utf8-conv.js":44}],16:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.default={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},{}],17:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n=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 r(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 n.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t}},{key:"readBits",value:function(e){if(e>32)throw new n.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var i=this._current_word_bits_left?this._current_word:0;i>>>=32-this._current_word_bits_left;var r=e-this._current_word_bits_left;this._fillCurrentWord();var a=Math.min(r,this._current_word_bits_left),s=this._current_word>>>32-a;return this._current_word<<=a,this._current_word_bits_left-=a,i=i<<a|s}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readByte",value:function(){return this.readBits(8)}},{key:"_skipLeadingZero",value:function(){var e=void 0;for(e=0;e<this._current_word_bits_left;e++)if(0!=(this._current_word&2147483648>>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}},{key:"readUEG",value:function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1}},{key:"readSEG",value:function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}]),e}();i.default=a},{"../utils/exception.js":40}],18:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var 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},n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=h(e("../utils/logger.js")),s=h(e("./amf-parser.js")),o=h(e("./sps-parser.js")),l=h(e("./hevc-sps-parser.js")),u=h(e("./demux-errors.js")),c=h(e("../core/media-info.js")),d=e("../utils/exception.js");function h(e){return e&&e.__esModule?e:{default:e}}var f=function(){function e(t,i){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="FLVDemuxer",this._config=i,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=t.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=t.hasAudioTrack,this._hasVideo=t.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new c.default,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=(r=new ArrayBuffer(2),new DataView(r).setInt16(0,256,!0),256===new Int16Array(r)[0])}return n(e,[{key:"destroy",value:function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null}},{key:"bindDataSource",value:function(e){return e.onDataArrival=this.parseChunks.bind(this),this}},{key:"resetMediaInfo",value:function(){this._mediaInfo=new c.default}},{key:"_isInitialMetadataDispatched",value:function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched}},{key:"parseChunks",value:function(t,i){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new d.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var r=0,n=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;r=e.probe(t).dataOffset}this._firstParse&&(this._firstParse=!1,i+r!==this._dataOffset&&a.default.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==new DataView(t,r).getUint32(0,!n)&&a.default.w(this.TAG,"PrevTagSize0 !== 0 !!!"),r+=4);for(;r<t.byteLength;){this._dispatch=!0;var s=new DataView(t,r);if(r+11+4>t.byteLength)break;var o=s.getUint8(0),l=16777215&s.getUint32(0,!n);if(r+11+l+4>t.byteLength)break;if(8===o||9===o||18===o){var u=s.getUint8(4),c=s.getUint8(5),h=s.getUint8(6)|c<<8|u<<16|s.getUint8(7)<<24;0!==(16777215&s.getUint32(7,!n))&&a.default.w(this.TAG,"Meet tag which has StreamID != 0!");var f=r+11;switch(o){case 8:this._parseAudioData(t,f,l,h);break;case 9:this._parseVideoData(t,f,l,h,i+r);break;case 18:this._parseScriptData(t,f,l)}var p=s.getUint32(11+l,!n);p!==11+l&&a.default.w(this.TAG,"Invalid PrevTagSize "+p),r+=11+l+4}else a.default.w(this.TAG,"Unsupported tag type "+o+", skipped"),r+=11+l+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),r}},{key:"_parseScriptData",value:function(e,t,i){var n=s.default.parseScriptData(e,t,i);if(n.hasOwnProperty("onMetaData")){if(null==n.onMetaData||"object"!==r(n.onMetaData))return void a.default.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&a.default.w(this.TAG,"Found another onMetaData tag!"),this._metadata=n;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 l=Math.floor(o.duration*this._timescale);this._duration=l,this._mediaInfo.duration=l}}else this._mediaInfo.duration=0;if("number"==typeof o.framerate){var u=Math.floor(1e3*o.framerate);if(u>0){var c=u/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=c,this._referenceFrameRate.fps_num=u,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=c}}if("object"===r(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(n).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},n))}},{key:"_parseKeyframesIndex",value:function(e){for(var t=[],i=[],r=1;r<e.times.length;r++){var n=this._timestampBase+Math.floor(1e3*e.times[r]);t.push(n),i.push(e.filepositions[r])}return{times:t,filepositions:i}}},{key:"_parseAudioData",value:function(e,t,i,r){if(i<=1)a.default.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var n=new DataView(e,t,i).getUint8(0),s=n>>>4;if(2===s||10===s){var o=0,l=(12&n)>>>2;if(l>=0&&l<=4){o=this._flvSoundRateTable[l];var c=1&n,d=this._audioMetadata,h=this._audioTrack;if(d||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(d=this._audioMetadata={}).type="audio",d.id=h.id,d.timescale=this._timescale,d.duration=this._duration,d.audioSampleRate=o,d.channelCount=0===c?1:2),10===s){var f=this._parseAACAudioData(e,t+1,i-1);if(void 0==f)return;if(0===f.packetType){if(d.config)return void a.default.w(this.TAG,"Found another AudioSpecificConfig!");var p=f.data;d.audioSampleRate=p.samplingRate,d.channelCount=p.channelCount,d.codec=p.codec,d.originalCodec=p.originalCodec,d.config=p.config,d.refSampleDuration=1024/d.audioSampleRate*d.timescale,a.default.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",d);var m=this._mediaInfo;m.audioCodec=d.originalCodec,m.audioSampleRate=d.audioSampleRate,m.audioChannelCount=d.channelCount,m.hasVideo?null!=m.videoCodec&&(m.mimeType='video/x-flv; codecs="'+m.videoCodec+","+m.audioCodec+'"'):m.mimeType='video/x-flv; codecs="'+m.audioCodec+'"',m.isComplete()&&this._onMediaInfo(m)}else if(1===f.packetType){var g=this._timestampBase+r,v={unit:f.data,length:f.data.byteLength,dts:g,pts:g};h.samples.push(v),h.length+=f.data.length}else a.default.e(this.TAG,"Flv: Unsupported AAC data type "+f.packetType)}else if(2===s){if(!d.codec){var y=this._parseMP3AudioData(e,t+1,i-1,!0);if(void 0==y)return;d.audioSampleRate=y.samplingRate,d.channelCount=y.channelCount,d.codec=y.codec,d.originalCodec=y.originalCodec,d.refSampleDuration=1152/d.audioSampleRate*d.timescale,a.default.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",d);var _=this._mediaInfo;_.audioCodec=d.codec,_.audioSampleRate=d.audioSampleRate,_.audioChannelCount=d.channelCount,_.audioDataRate=y.bitRate,_.hasVideo?null!=_.videoCodec&&(_.mimeType='video/x-flv; codecs="'+_.videoCodec+","+_.audioCodec+'"'):_.mimeType='video/x-flv; codecs="'+_.audioCodec+'"',_.isComplete()&&this._onMediaInfo(_)}var b=this._parseMP3AudioData(e,t+1,i-1,!1);if(void 0==b)return;var T=this._timestampBase+r,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,i){if(!(i<=1)){var r={},n=new Uint8Array(e,t,i);return r.packetType=n[0],0===n[0]?r.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):r.data=n.subarray(1),r}a.default.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")}},{key:"_parseAACAudioSpecificConfig",value:function(e,t,i){var r,n,a=new Uint8Array(e,t,i),s=null,o=0,l=null;if(o=r=a[0]>>>3,(n=(7&a[0])<<1|a[1]>>>7)<0||n>=this._mpegSamplingRates.length)this._onError(u.default.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var c=this._mpegSamplingRates[n],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")?n>=6?(o=5,s=new Array(4),l=n-3):(o=2,s=new Array(2),l=n):-1!==h.indexOf("android")?(o=2,s=new Array(2),l=n):(o=5,l=n,s=new Array(4),n>=6?l=n-3:1===d&&(o=2,s=new Array(2),l=n)),s[0]=o<<3,s[0]|=(15&n)>>>1,s[1]=(15&n)<<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."+r}}this._onError(u.default.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}}},{key:"_parseMP3AudioData",value:function(e,t,i,r){if(!(i<4)){this._littleEndian;var n=new Uint8Array(e,t,i),s=null;if(r){if(255!==n[0])return;var o=n[1]>>>3&3,l=(6&n[1])>>1,u=(240&n[2])>>>4,c=(12&n[2])>>>2,d=3!==(n[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(l){case 1:34,u<this._mpegAudioL3BitRateTable.length&&(f=this._mpegAudioL3BitRateTable[u]);break;case 2:33,u<this._mpegAudioL2BitRateTable.length&&(f=this._mpegAudioL2BitRateTable[u]);break;case 3:32,u<this._mpegAudioL1BitRateTable.length&&(f=this._mpegAudioL1BitRateTable[u])}s={bitRate:f,samplingRate:h,channelCount:d,codec:"mp3",originalCodec:"mp3"}}else s=n;return s}a.default.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")}},{key:"_parseVideoData",value:function(e,t,i,r,n){if(i<=1)a.default.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var s=new Uint8Array(e,t,i)[0],o=(240&s)>>>4,l=15&s;7===l||12===l?7===l?this._parseAVCVideoPacket(e,t+1,i-1,r,n,o):12===l&&this._parseHVCVideoPacket(e,t+1,i-1,r,n,o):this._onError(u.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+l)}}},{key:"_parseAVCVideoPacket",value:function(e,t,i,r,n,s){if(i<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,i),c=l.getUint8(0),d=(16777215&l.getUint32(0,!o))<<8>>8;if(0===c)this._parseAVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===c)this._parseAVCVideoData(e,t+4,i-4,r,n,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,i){if(i<7)a.default.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var r=this._videoMetadata,n=this._videoTrack,s=this._littleEndian,l=new DataView(e,t,i);if(r){if(void 0!==r.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),(r=this._videoMetadata={}).type="video",r.id=n.id,r.timescale=this._timescale,r.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){r.codecWidth=v.codec_size.width,r.codecHeight=v.codec_size.height,r.presentWidth=v.present_size.width,r.presentHeight=v.present_size.height,r.profile=v.profile_string,r.level=v.level_string,r.bitDepth=v.bit_depth,r.chromaFormat=v.chroma_format,r.sarRatio=v.sar_ratio,r.frameRate=v.frame_rate,!1!==v.frame_rate.fixed&&0!==v.frame_rate.fps_num&&0!==v.frame_rate.fps_den||(r.frameRate=this._referenceFrameRate);var y=r.frameRate.fps_den,_=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(y/_);for(var b=g.subarray(1,4),T="avc1.",S=0;S<3;S++){var E=b[S].toString(16);E.length<2&&(E="0"+E),T+=E}r.codec=T;var k=this._mediaInfo;k.width=r.codecWidth,k.height=r.codecHeight,k.fps=r.frameRate.fps,k.profile=r.profile,k.level=r.level,k.refFrames=v.ref_frames,k.chromaFormat=v.chroma_format_string,k.sarNum=r.sarRatio.width,k.sarDen=r.sarRatio.height,k.videoCodec=T,k.hasAudio?null!=k.audioCodec&&(k.mimeType='video/x-flv; codecs="'+k.videoCodec+","+k.audioCodec+'"'):k.mimeType='video/x-flv; codecs="'+k.videoCodec+'"',k.isComplete()&&this._onMediaInfo(k)}}}var w=l.getUint8(f);if(0!==w){w>1&&a.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+w),f++;for(var C=0;C<w;C++){var L=l.getUint16(f,!s);f+=2,0!==L&&(f+=L)}r.avcc=new Uint8Array(i),r.avcc.set(new Uint8Array(e,t,i),0),a.default.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",r)}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,i,r,n,s,o){for(var l=this._littleEndian,u=new DataView(e,t,i),c=[],d=0,h=0,f=this._naluLengthSize,p=this._timestampBase+r,m=1===s;h<i;){if(h+4>=i){a.default.w(this.TAG,"Malformed Nalu near timestamp "+p+", offset = "+h+", dataSize = "+i);break}var g=u.getUint32(h,!l);if(3===f&&(g>>>=8),g>i-f)return void a.default.w(this.TAG,"Malformed Nalus near timestamp "+p+", NaluSize > DataSize!");var v=31&u.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=n),b.samples.push(T),b.length+=d}}},{key:"_parseHVCVideoPacket",value:function(e,t,i,r,n,s){if(i<4)a.default.w(this.TAG,"Flv: Invalid HVC packet, missing HVCPacketType or/and CompositionTime");else{var o=this._littleEndian,l=new DataView(e,t,i),c=l.getUint8(0),d=(16777215&l.getUint32(0,!o))<<8>>8;if(0===c)this._parseHVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===c)this._parseHVCVideoData(e,t+4,i-4,r,n,s,d);else if(2!==c)return void this._onError(u.default.FORMAT_ERROR,"Flv: Invalid video packet type "+c)}}},{key:"_parseHVCDecoderConfigurationRecord",value:function(e,t,i){if(i<23)a.default.w(this.TAG,"Flv: Invalid HVCDecoderConfigurationRecord, lack of data!");else{var r=this._videoMetadata,n=this._videoTrack,s=this._littleEndian,o=new DataView(e,t,i);if(r){if(void 0!==r.avcc)return void a.default.w(this.TAG,"Found another HVCDecoderConfigurationRecord!")}else!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(r=this._videoMetadata={}).type="video",r.id=n.id,r.timescale=this._timescale,r.duration=this._duration;if(1===o.getUint8(0))if(this._naluLengthSize=1+(3&o.getUint8(21)),3===this._naluLengthSize||4===this._naluLengthSize){for(var c,d,h,f=o.getUint8(22),p=23,m=[],g=0;g<f;g++){var v=63&o.getUint8(p++),y=o.getUint16(p,!s);if(p+=2,0!==y){switch(v){case 32:c+=y;break;case 33:d+=y;break;case 34:h+=y}for(var _=0;_<y;_++){var b=o.getUint16(p,!s);if(p+=2,0!==b){if(33===v){var T=new Uint8Array(e,t+p,b);m.push(T)}p+=b}}}}if(0!==c)if(c>1&&a.default.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: VPS Count = "+c),0!==d)if(d>1&&a.default.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: SPS Count = "+d),0!==h){h>1&&a.default.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: PPS Count = "+d);T=m[0];var S=l.default.parseSPS(T);r.codecWidth=S.codec_size.width,r.codecHeight=S.codec_size.height,r.presentWidth=S.present_size.width,r.presentHeight=S.present_size.height,r.profile=S.profile_string,r.level=S.level_string,r.profile_idc=S.profile_idc,r.level_idc=S.level_idc,r.bitDepth=S.bit_depth,r.chromaFormat=S.chroma_format,r.sarRatio=S.sar_ratio,r.frameRate=S.frame_rate,!1!==S.frame_rate.fixed&&0!==S.frame_rate.fps_num&&0!==S.frame_rate.fps_den||(r.frameRate=this._referenceFrameRate);var E=r.frameRate.fps_den,k=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(E/k);var w="hvc1."+r.profile_idc+".1.L"+r.level_idc+".B0";r.codec=w;var C=this._mediaInfo;C.width=r.codecWidth,C.height=r.codecHeight,C.fps=r.frameRate.fps,C.profile=r.profile,C.level=r.level,C.refFrames=S.ref_frames,C.chromaFormat=S.chroma_format_string,C.sarNum=r.sarRatio.width,C.sarDen=r.sarRatio.height,C.videoCodec=w,C.hasAudio?null!=C.audioCodec&&(C.mimeType='video/x-flv; codecs="'+C.videoCodec+","+C.audioCodec+'"'):C.mimeType='video/x-flv; codecs="'+C.videoCodec+'"',C.isComplete()&&this._onMediaInfo(C),r.avcc=new Uint8Array(i),r.avcc.set(new Uint8Array(e,t,i),0),a.default.v(this.TAG,"Parsed HVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",r)}else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No PPS");else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No SPS");else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No VPS")}else this._onError(u.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord")}}},{key:"_parseHVCVideoData",value:function(e,t,i,r,n,s,o){for(var l=this._littleEndian,u=new DataView(e,t,i),c=[],d=0,h=0,f=this._naluLengthSize,p=this._timestampBase+r,m=1===s;h<i;){if(h+4>=i){a.default.w(this.TAG,"Malformed Nalu near timestamp "+p+", offset = "+h+", dataSize = "+i);break}var g=u.getUint32(h,!l);if(3===f&&(g>>>=8),g>i-f)return void a.default.w(this.TAG,"Malformed Nalus near timestamp "+p+", NaluSize > DataSize!");var v=u.getUint8(h+f)>>1&63;v>=16&&v<=23&&(m=!0);var y=new Uint8Array(e,t+h,f+g),_={type:v,data:y};c.push(_),d+=y.byteLength,h+=f+g}if(c.length){var b=this._videoTrack,T={units:c,length:d,isKeyframe:m,dts:p,cts:o,pts:p+o};m&&(T.fileposition=n),b.samples.push(T),b.length+=d}}},{key:"onTrackMetadata",get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e}},{key:"onMediaInfo",get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e}},{key:"onMetaDataArrived",get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e}},{key:"onScriptDataArrived",get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onDataAvailable",get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e}},{key:"timestampBase",get:function(){return this._timestampBase},set:function(e){this._timestampBase=e}},{key:"overridedDuration",get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e}},{key:"overridedHasAudio",set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e}},{key:"overridedHasVideo",set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e}}],[{key:"probe",value:function(e){var t=new Uint8Array(e),i={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;var r,n,a=(4&t[4])>>>2!=0,s=0!=(1&t[4]),o=(r=t)[n=5]<<24|r[n+1]<<16|r[n+2]<<8|r[n+3];return o<9?i:{match:!0,consumed:o,dataOffset:o,hasAudioTrack:a,hasVideoTrack:s}}}]),e}();i.default=f},{"../core/media-info.js":7,"../utils/exception.js":40,"../utils/logger.js":41,"./amf-parser.js":15,"./demux-errors.js":16,"./sps-parser.js":19,"./hevc-sps-parser.js":45}],19:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r,n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=e("./exp-golomb.js"),s=(r=a)&&r.__esModule?r:{default:r};var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return n(e,null,[{key:"_ebsp2rbsp",value:function(e){for(var t=e,i=t.byteLength,r=new Uint8Array(i),n=0,a=0;a<i;a++)a>=2&&3===t[a]&&0===t[a-1]&&0===t[a-2]||(r[n]=t[a],n++);return new Uint8Array(r.buffer,0,n)}},{key:"parseSPS",value:function(t){var i=e._ebsp2rbsp(t),r=new s.default(i);r.readByte();var n=r.readByte();r.readByte();var a=r.readByte();r.readUEG();var o=e.getProfileString(n),l=e.getLevelString(a),u=1,c=420,d=8;if((100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n||138===n||144===n)&&(3===(u=r.readUEG())&&r.readBits(1),u<=3&&(c=[0,420,422,444][u]),d=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool()))for(var h=3!==u?8:12,f=0;f<h;f++)r.readBool()&&(f<6?e._skipScalingList(r,16):e._skipScalingList(r,64));r.readUEG();var p=r.readUEG();if(0===p)r.readUEG();else if(1===p){r.readBits(1),r.readSEG(),r.readSEG();for(var m=r.readUEG(),g=0;g<m;g++)r.readSEG()}var v=r.readUEG();r.readBits(1);var y=r.readUEG(),_=r.readUEG(),b=r.readBits(1);0===b&&r.readBits(1),r.readBits(1);var T=0,S=0,E=0,k=0;r.readBool()&&(T=r.readUEG(),S=r.readUEG(),E=r.readUEG(),k=r.readUEG());var w=1,C=1,L=0,A=!0,R=0,P=0;if(r.readBool()){if(r.readBool()){var D=r.readByte();D>0&&D<16?(w=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][D-1],C=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][D-1]):255===D&&(w=r.readByte()<<8|r.readByte(),C=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){var I=r.readBits(32),x=r.readBits(32);A=r.readBool(),L=(R=x)/(P=2*I)}}var O=1;1===w&&1===C||(O=w/C);var M=0,U=0;0===u?(M=1,U=2-b):(M=3===u?1:2,U=(1===u?2:1)*(2-b));var B=16*(y+1),N=16*(_+1)*(2-b);B-=(T+S)*M,N-=(E+k)*U;var F=Math.ceil(B*O);return r.destroy(),r=null,{profile_string:o,level_string:l,bit_depth:d,ref_frames:v,chroma_format:c,chroma_format_string:e.getChromaFormatString(c),frame_rate:{fixed:A,fps:L,fps_den:P,fps_num:R},sar_ratio:{width:w,height:C},codec_size:{width:B,height:N},present_size:{width:F,height:N}}}},{key:"_skipScalingList",value:function(e,t){for(var i=8,r=8,n=0;n<t;n++)0!==r&&(r=(i+e.readSEG()+256)%256),i=0===r?i:r}},{key:"getProfileString",value:function(e){switch(e){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}}},{key:"getLevelString",value:function(e){return(e/10).toFixed(1)}},{key:"getChromaFormatString",value:function(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}}}]),e}();i.default=o},{"./exp-golomb.js":17}],45:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n=s(e("./exp-golomb.js")),a=s(e("./sps-parser.js"));function s(e){return e&&e.__esModule?e:{default:e}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"parseSPS",value:function(t){var i=a.default._ebsp2rbsp(t),r=new n.default(i),s={};r.readBits(16),r.readBits(4);var o=r.readBits(3);r.readBits(1),e._hvcc_parse_ptl(r,s,o),r.readUEG();var l=0,u=r.readUEG();3==u&&(l=r.readBits(1)),s.sar_width=s.sar_height=1,s.conf_win_left_offset=s.conf_win_right_offset=s.conf_win_top_offset=s.conf_win_bottom_offset=0,s.def_disp_win_left_offset=s.def_disp_win_right_offset=s.def_disp_win_top_offset=s.def_disp_win_bottom_offset=0;var c=r.readUEG(),d=r.readUEG();r.readBits(1)&&(s.conf_win_left_offset=r.readUEG(),s.conf_win_right_offset=r.readUEG(),s.conf_win_top_offset=r.readUEG(),s.conf_win_bottom_offset=r.readUEG(),1===s.default_display_window_flag&&(s.conf_win_left_offset+s.def_disp_win_left_offset,s.conf_win_right_offset+s.def_disp_win_right_offset,s.conf_win_top_offset+s.def_disp_win_top_offset,s.conf_win_bottom_offset,s.def_disp_win_bottom_offset));var h=r.readUEG()+8;r.readUEG();for(var f=r.readUEG(),p=r.readBits(1)?0:o;p<=o;p++)e._skip_sub_layer_ordering_info(r);r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG(),r.readBits(1)&&r.readBits(1)&&e._skip_scaling_list_data(r),r.readBits(1),r.readBits(1),r.readBits(1)&&(r.readBits(4),r.readBits(4),r.readUEG(),r.readUEG(),r.readBits(1));var m=[],g=r.readUEG();for(p=0;p<g;p++){var v=e._parse_rps(r,p,g,m);if(v<0)return v}if(r.readBits(1)){var y=r.readUEG();for(p=0;p<y;p++){var _=Math.min(f+4,16);if(_>32){for(var b=_/32,T=_%32,S=0;S<b;S++)r.readBits(32);r.readBits(T)}else r.readBits(_);r.readBits(1)}}r.readBits(1),r.readBits(1),r.readBits(1)&&e._hvcc_parse_vui(r,s,o);var E=e.getProfileString(s.profile_idc),k=e.getLevelString(s.level_idc),w=1;1===s.sar_width&&1===s.sar_height||(w=s.sar_width/s.sar_height);var C=c,L=d,A=1===u&&0===l?2:1;C-=(1!==u&&2!=u||0!==l?1:2)*(s.conf_win_left_offset+s.conf_win_right_offset),L-=A*(s.conf_win_top_offset+s.conf_win_bottom_offset);var R=Math.ceil(C*w);return r.destroy(),r=null,{profile_string:E,level_string:k,profile_idc:s.profile_idc,level_idc:s.level_idc,bit_depth:h,ref_frames:1,chroma_format:u,chroma_format_string:e.getChromaFormatString(u),frame_rate:{fixed:s.fps_fixed,fps:s.fps,fps_den:s.fps_den,fps_num:s.fps_num},sar_ratio:{width:s.sar_width,height:s.sar_height},codec_size:{width:C,height:L},present_size:{width:R,height:L}}}},{key:"_hvcc_parse_ptl",value:function(e,t,i){e.readBits(2);var r=e.readBits(1),n=e.readBits(5);e.readBits(32),e.readBits(32),e.readBits(16);var a=e.readByte();void 0===t.tier_flag||void 0===t.level_idc||t.tier_flag<r?t.level_idc=a:t.level_idc=Math.max(t.level_idc,a),t.profile_idc=Math.max(void 0===t.profile_idc?0:t.profile_idc,n);for(var s=[],o=[],l=0;l<i;l++)s.push(e.readBits(1)),o.push(e.readBits(1));if(i>0)for(l=i;l<8;l++)e.readBits(2);for(l=0;l<i;l++)s[l]&&(e.readBits(32),e.readBits(32),e.readBits(24)),o[l]&&e.readByte()}},{key:"_parse_rps",value:function(e,t,i,r){if(t&&e.readBits(1)){if(t>=i)return-1;e.readBits(1),e.readUEG(),r[t]=0;for(var n=0;n<=r[t-1];n++){var a=0,s=e.readBits(1);s||(a=e.readBits(1)),(s||a)&&r[t]++}}else{var o=e.readUEG(),l=e.readUEG();r[t]=o+l;for(n=0;n<o;n++)e.readUEG(),e.readBits(1);for(n=0;n<l;n++)e.readUEG(),e.readBits(1)}return 0}},{key:"_hvcc_parse_vui",value:function(t,i,r){t.readBits(1)&&255==t.readByte()&&(i.sar_width=t.readBits(16),i.sar_height=t.readBits(16)),t.readBits(1)&&t.readBits(1),t.readBits(1)&&(t.readBits(4),t.readBits(1)&&t.readBits(24)),t.readBits(1)&&(t.readUEG(),t.readUEG()),t.readBits(3),i.default_display_window_flag=t.readBits(1),i.default_display_window_flag&&(i.def_disp_win_left_offset=t.readUEG(),i.def_disp_win_right_offset=t.readUEG(),i.def_disp_win_top_offset=t.readUEG(),i.def_disp_win_bottom_offset=t.readUEG()),t.readBits(1)&&(e._skip_timing_info(t,i),t.readBits(1)&&e._skip_hrd_parameters(t,i,1,r)),t.readBits(1)&&(t.readBits(3),t.readUEG(),t.readUEG(),t.readUEG(),t.readUEG(),t.readUEG())}},{key:"_skip_sub_layer_ordering_info",value:function(e,t){e.readUEG(),e.readUEG(),e.readUEG()}},{key:"_skip_scaling_list_data",value:function(e){for(var t=0;t<4;t++)for(var i=0;i<(3==t?2:6);i++)if(e.readBits(1)){var r=Math.min(64,1<<4+(t<<1));t>1&&e.readSEG();for(var n=0;n<r;n++)e.readSEG()}else e.readUEG()}},{key:"_skip_sub_layer_hrd_parameters",value:function(e,t,i){for(var r=0;r<=t;r++)e.readUEG(),e.readUEG(),i&&(e.readUEG(),e.readUEG()),e.readBits(1)}},{key:"_skip_timing_info",value:function(e,t){t.fps_den=e.readBits(32),t.fps_num=e.readBits(32),t.fps_den>0&&(t.fps=t.fps_num/t.fps_den);var i=0;e.readBits(1)&&(i=e.readUEG())>=0&&(t.fps/=i+1)}},{key:"_skip_hrd_parameters",value:function(t,i,r){var n=0,a=0;if(i&&(n=t.readBits(1),a=t.readBits(1),n||a)){var s=t.readBits(1);s&&t.readBits(19),t.readByte(),s&&t.readBits(4),t.readBits(15)}for(var o=0;o<=r;o++){var l=0,u=0,c=0,d=t.readBits(1);hvcc.fps_fixed=d,d||(c=t.readBits(1)),c?t.readUEG():u=t.readBits(1),u||(l=t.readUEG(t)),n&&e._skip_sub_layer_hrd_parameters(t,l,0),a&&e._skip_sub_layer_hrd_parameters(t,l,0)}}},{key:"getProfileString",value:function(e){switch(e){case 1:return"Main";case 2:return"Main10";case 3:return"MainSP";case 4:return"Rext";case 9:return"SCC";default:return"Unknown"}}},{key:"getLevelString",value:function(e){return(e/10).toFixed(1)}},{key:"getChromaFormatString",value:function(e){switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}}}]),e}();i.default=o},{"./exp-golomb.js":17,"./sps-parser.js":19}],20:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var 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},n=f(e("./utils/polyfill.js")),a=f(e("./core/features.js")),s=e("./io/loader.js"),o=f(e("./player/flv-player.js")),l=f(e("./player/native-player.js")),u=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}}n.default.install();var p={createPlayer:function(e,t){var i=e;if(null==i||"object"!==(void 0===i?"undefined":r(i)))throw new h.InvalidArgumentException("MediaDataSource must be an javascript object!");if(!i.hasOwnProperty("type"))throw new h.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");switch(i.type){case"flv":return new o.default(i,t);default:return new l.default(i,t)}},isSupported:function(){return a.default.supportMSEH264Playback()},getFeatureList:function(){return a.default.getFeatureList()}};p.BaseLoader=s.BaseLoader,p.LoaderStatus=s.LoaderStatus,p.LoaderErrors=s.LoaderErrors,p.Events=u.default,p.ErrorTypes=c.ErrorTypes,p.ErrorDetails=c.ErrorDetails,p.FlvPlayer=o.default,p.NativePlayer=l.default,p.LoggingControl=d.default,p.reconnect=!1,Object.defineProperty(p,"version",{enumerable:!0,get:function(){return"1.4.2"}}),i.default=p},{"./core/features.js":6,"./io/loader.js":24,"./player/flv-player.js":32,"./player/native-player.js":33,"./player/player-errors.js":34,"./player/player-events.js":35,"./utils/exception.js":40,"./utils/logging-control.js":42,"./utils/polyfill.js":43}],21:[function(e,t,i){"use strict";t.exports=e("./flv.js").default},{"./flv.js":20}],22:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var 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},n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=(l(e("../utils/logger.js")),l(e("../utils/browser.js"))),s=e("./loader.js"),o=e("../utils/exception.js");function l(e){return e&&e.__esModule?e:{default:e}}var u=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var 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}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"fetch-stream-loader"));return r.TAG="FetchStreamLoader",r._seekHandler=e,r._config=i,r._needStash=!0,r._requestAbort=!1,r._contentLength=null,r._receivedLength=0,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)}(t,s.BaseLoader),n(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}}}]),n(t,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),function e(t,i,r){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,i);if(void 0===n){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,r)}if("value"in n)return n.value;var s=n.get;return void 0!==s?s.call(r):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function(e,t){var i=this;this._dataSource=e,this._range=t;var n=e.url;this._config.reuseRedirectedURL&&void 0!=e.redirectedURL&&(n=e.redirectedURL);var a=this._seekHandler.getConfig(n,t),l=new self.Headers;if("object"===r(a.headers)){var u=a.headers;for(var c in u)u.hasOwnProperty(c)&&l.append(c,u[c])}var d={method:"GET",headers:l,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"===r(this._config.headers))for(var h in this._config.headers)l.append(h,this._config.headers[h]);!1===e.cors&&(d.mode="same-origin"),e.withCredentials&&(d.credentials="include"),e.referrerPolicy&&(d.referrerPolicy=e.referrerPolicy),this._status=s.LoaderStatus.kConnecting,self.fetch(a.url,d).then(function(e){if(i._requestAbort){try{var t=e.body.getReader();t&&t.cancel()}catch(e){}return i._requestAbort=!1,void(i._status=s.LoaderStatus.kIdle)}if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==a.url&&i._onURLRedirect){var r=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(r)}var n=e.headers.get("Content-Length");return null!=n&&(i._contentLength=parseInt(n),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,e.body.getReader())}if(i._status=s.LoaderStatus.kError,!i._onError)throw new o.RuntimeException("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(s.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})}).catch(function(e){if(i._status=s.LoaderStatus.kError,!i._onError)throw e;i._onError(s.LoaderErrors.EXCEPTION,{code:-1,msg:e.message})})}},{key:"abort",value:function(){this._requestAbort=!0}},{key:"_pump",value:function(e){var t=this;return e.read().then(function(i){if(i.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=s.LoaderStatus.kError;var r=s.LoaderErrors.EARLY_EOF,n={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new o.RuntimeException(n.msg);t._onError(r,n)}else t._status=s.LoaderStatus.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(!0===t._requestAbort)return t._requestAbort=!1,t._status=s.LoaderStatus.kComplete,e.cancel();t._status=s.LoaderStatus.kBuffering;var a=i.value.buffer,l=t._range.from+t._receivedLength;t._receivedLength+=a.byteLength,t._onDataArrival&&t._onDataArrival(a,l,t._receivedLength),t._pump(e)}}).catch(function(e){if(11!==e.code||!a.default.msedge){t._status=s.LoaderStatus.kError;var i=0,r=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(i=s.LoaderErrors.EXCEPTION,r={code:e.code,msg:e.message}):(i=s.LoaderErrors.EARLY_EOF,r={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new o.RuntimeException(r.msg);t._onError(i,r)}})}}]),t}();i.default=u},{"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],23:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n=p(e("../utils/logger.js")),a=p(e("./speed-sampler.js")),s=e("./loader.js"),o=p(e("./fetch-stream-loader.js")),l=p(e("./xhr-moz-chunked-loader.js")),u=(p(e("./xhr-msstream-loader.js")),p(e("./xhr-range-loader.js"))),c=p(e("./websocket-loader.js")),d=p(e("./range-seek-handler.js")),h=p(e("./param-seek-handler.js")),f=e("../utils/exception.js");function p(e){return e&&e.__esModule?e:{default:e}}var m=function(){function e(t,i,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="IOController",this._config=i,this._extraData=r,this._stashInitialSize=393216,void 0!=i.stashInitialSize&&i.stashInitialSize>0&&(this._stashInitialSize=i.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===i.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=t,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(t.url),this._refTotalLength=t.filesize?t.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new a.default,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return r(e,[{key:"destroy",value:function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null}},{key:"isWorking",value:function(){return this._loader&&this._loader.isWorking()&&!this._paused}},{key:"isPaused",value:function(){return this._paused}},{key:"_selectSeekHandler",value:function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new d.default(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new h.default(t,i)}else{if("custom"!==e.seekType)throw new f.InvalidArgumentException("Invalid seekType in config: "+e.seekType);if("function"!=typeof e.customSeekHandler)throw new f.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}}},{key:"_selectLoader",value:function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=c.default;else if(o.default.isSupported())this._loaderClass=o.default;else if(l.default.isSupported())this._loaderClass=l.default;else{if(!u.default.isSupported())throw new f.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=u.default}}},{key:"_createLoader",value:function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)}},{key:"open",value:function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))}},{key:"abort",value:function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)}},{key:"pause",value:function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}},{key:"resume",value:function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}}},{key:"seek",value:function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)}},{key:"_internalSeek",value:function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var i={from:e,to:-1};this._currentRange={from:i.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,i),this._onSeeked&&this._onSeeked()}},{key:"updateUrl",value:function(e){if(!e||"string"!=typeof e||0===e.length)throw new f.InvalidArgumentException("Url must be a non-empty string!");this._dataSource.url=e}},{key:"_expandBuffer",value:function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var i=new ArrayBuffer(t);if(this._stashUsed>0){var r=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(i,0,t).set(r,0)}this._stashBuffer=i,this._bufferSize=t}}},{key:"_normalizeSpeed",value:function(e){var t=this._speedNormalizeList,i=t.length-1,r=0,n=0,a=i;if(e<t[0])return t[0];for(;n<=a;){if((r=n+Math.floor((a-n)/2))===i||e>=t[r]&&e<t[r+1])return t[r];t[r]<e?n=r+1:a=r-1}}},{key:"_adjustStashSize",value:function(e){var t=0;(t=this._config.isLive?e:e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var i=1024*t+1048576;this._bufferSize<i&&this._expandBuffer(i),this._stashSize=1024*t}},{key:"_dispatchChunks",value:function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)}},{key:"_onURLRedirect",value:function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)}},{key:"_onContentLengthKnown",value:function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)}},{key:"_onLoaderChunkArrival",value:function(e,t,i){if(!this._onDataArrival)throw new f.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var r=this._speedSampler.lastSecondKBps;if(0!==r){var n=this._normalizeSpeed(r);this._speedNormalized!==n&&(this._speedNormalized=n,this._adjustStashSize(n))}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 l=new Uint8Array(s,o);a.set(l,0),this._stashUsed=l.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 u=this._dispatchChunks(e,t);if(u<e.byteLength){var c=e.byteLength-u;c>this._bufferSize&&(this._expandBuffer(c),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e,u),0),this._stashUsed+=c,this._stashByteStart=t+u}}}else if(0===this._stashUsed){var d=this._dispatchChunks(e,t);if(d<e.byteLength){var h=e.byteLength-d;h>this._bufferSize&&this._expandBuffer(h),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(e,d),0),this._stashUsed+=h,this._stashByteStart=t+d}}else{this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength);var p=new Uint8Array(this._stashBuffer,0,this._bufferSize);p.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;var m=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(m<this._stashUsed&&m>0){var g=new Uint8Array(this._stashBuffer,m);p.set(g,0)}this._stashUsed-=m,this._stashByteStart+=m}}}},{key:"_flushStashBuffer",value:function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),r=t.byteLength-i;if(i<t.byteLength){if(!e){if(i>0){var a=new Uint8Array(this._stashBuffer,0,this._bufferSize),s=new Uint8Array(t,i);a.set(s,0),this._stashUsed=s.byteLength,this._stashByteStart+=i}return 0}n.default.w(this.TAG,r+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,r}return 0}},{key:"_onLoaderComplete",value:function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}},{key:"_onLoaderError",value:function(e,t){switch(n.default.e(this.TAG,"Loader error, code = "+t.code+", msg = "+t.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=s.LoaderErrors.UNRECOVERABLE_EARLY_EOF),e){case s.LoaderErrors.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var i=this._currentRange.to+1;return void(i<this._totalLength&&(n.default.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(i,!1)))}e=s.LoaderErrors.UNRECOVERABLE_EARLY_EOF;break;case s.LoaderErrors.UNRECOVERABLE_EARLY_EOF:case s.LoaderErrors.CONNECTING_TIMEOUT:case s.LoaderErrors.HTTP_STATUS_CODE_INVALID:case s.LoaderErrors.EXCEPTION:}if(!this._onError)throw new f.RuntimeException("IOException: "+t.msg);this._onError(e,t)}},{key:"status",get:function(){return this._loader.status}},{key:"extraData",get:function(){return this._extraData},set:function(e){this._extraData=e}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e}},{key:"onSeeked",get:function(){return this._onSeeked},set:function(e){this._onSeeked=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onComplete",get:function(){return this._onComplete},set:function(e){this._onComplete=e}},{key:"onRedirect",get:function(){return this._onRedirect},set:function(e){this._onRedirect=e}},{key:"onRecoveredEarlyEof",get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e}},{key:"currentURL",get:function(){return this._dataSource.url}},{key:"hasRedirect",get:function(){return null!=this._redirectedURL||void 0!=this._dataSource.redirectedURL}},{key:"currentRedirectedURL",get:function(){return this._redirectedURL||this._dataSource.redirectedURL}},{key:"currentSpeed",get:function(){return this._loaderClass===u.default?this._loader.currentSpeed:this._speedSampler.lastSecondKBps}},{key:"loaderType",get:function(){return this._loader.type}}]),e}();i.default=m},{"../utils/exception.js":40,"../utils/logger.js":41,"./fetch-stream-loader.js":22,"./loader.js":24,"./param-seek-handler.js":25,"./range-seek-handler.js":26,"./speed-sampler.js":27,"./websocket-loader.js":28,"./xhr-moz-chunked-loader.js":29,"./xhr-msstream-loader.js":30,"./xhr-range-loader.js":31}],24:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.BaseLoader=i.LoaderErrors=i.LoaderStatus=void 0;var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n=e("../utils/exception.js");var a=i.LoaderStatus={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4};i.LoaderErrors={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},i.BaseLoader=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._type=t||"undefined",this._status=a.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return r(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 n.NotImplementedException("Unimplemented abstract function!")}},{key:"abort",value:function(){throw new n.NotImplementedException("Unimplemented abstract function!")}},{key:"type",get:function(){return this._type}},{key:"status",get:function(){return this._status}},{key:"needStashBuffer",get:function(){return this._needStash}},{key:"onContentLengthKnown",get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e}},{key:"onURLRedirect",get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onComplete",get:function(){return this._onComplete},set:function(e){this._onComplete=e}}]),e}()},{"../utils/exception.js":40}],25:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}();var n=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._startName=t,this._endName=i}return r(e,[{key:"getConfig",value:function(e,t){var i=e;if(0!==t.from||-1!==t.to){var r=!0;-1===i.indexOf("?")&&(i+="?",r=!1),r&&(i+="&"),i+=this._startName+"="+t.from.toString(),-1!==t.to&&(i+="&"+this._endName+"="+t.to.toString())}return{url:i,headers:{}}}},{key:"removeURLParameters",value:function(e){var t=e.split("?")[0],i=void 0,r=e.indexOf("?");-1!==r&&(i=e.substring(r+1));var n="";if(void 0!=i&&i.length>0)for(var a=i.split("&"),s=0;s<a.length;s++){var o=a[s].split("="),l=s>0;o[0]!==this._startName&&o[0]!==this._endName&&(l&&(n+="&"),n+=a[s])}return 0===n.length?t:t+"?"+n}}]),e}();i.default=n},{}],26:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}();var n=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 r(e,[{key:"getConfig",value:function(e,t){var i={};if(0!==t.from||-1!==t.to){var r=void 0;r=-1!==t.to?"bytes="+t.from.toString()+"-"+t.to.toString():"bytes="+t.from.toString()+"-",i.Range=r}else this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}}},{key:"removeURLParameters",value:function(e){return e}}]),e}();i.default=n},{}],27:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}();var n=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 r(e,[{key:"reset",value:function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}},{key:"addBytes",value:function(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())}},{key:"currentKBps",get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024}},{key:"lastSecondKBps",get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}},{key:"averageKBps",get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024}}]),e}();i.default=n},{}],28:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r,n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=e("../utils/logger.js"),s=((r=a)&&r.__esModule,e("./loader.js")),o=e("../utils/exception.js");var l=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),n(t,null,[{key:"isSupported",value:function(){try{return void 0!==self.WebSocket}catch(e){return!1}}}]),n(t,[{key:"destroy",value:function(){this._ws&&this.abort(),function e(t,i,r){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,i);if(void 0===n){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,r)}if("value"in n)return n.value;var s=n.get;return void 0!==s?s.call(r):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType="arraybuffer",t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=s.LoaderStatus.kConnecting}catch(e){this._status=s.LoaderStatus.kError;var i={code:e.code,msg:e.message};if(!this._onError)throw new o.RuntimeException(i.msg);this._onError(s.LoaderErrors.EXCEPTION,i)}}},{key:"abort",value:function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=s.LoaderStatus.kComplete}},{key:"_onWebSocketOpen",value:function(e){this._status=s.LoaderStatus.kBuffering}},{key:"_onWebSocketClose",value:function(e){!0!==this._requestAbort?(this._status=s.LoaderStatus.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1}},{key:"_onWebSocketMessage",value:function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var i=new FileReader;i.onload=function(){t._dispatchArrayBuffer(i.result)},i.readAsArrayBuffer(e.data)}else{this._status=s.LoaderStatus.kError;var r={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new o.RuntimeException(r.msg);this._onError(s.LoaderErrors.EXCEPTION,r)}}},{key:"_dispatchArrayBuffer",value:function(e){var t=e,i=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}},{key:"_onWebSocketError",value:function(e){this._status=s.LoaderStatus.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new o.RuntimeException(t.msg);this._onError(s.LoaderErrors.EXCEPTION,t)}}]),t}();i.default=l},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],29:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),s=e("../utils/logger.js"),o=(r=s)&&r.__esModule?r:{default:r},l=e("./loader.js"),u=e("../utils/exception.js");var c=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var 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}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"xhr-moz-chunked-loader"));return r.TAG="MozChunkedLoader",r._seekHandler=e,r._config=i,r._needStash=!0,r._xhr=null,r._requestAbort=!1,r._contentLength=null,r._receivedLength=0,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)}(t,l.BaseLoader),a(t,null,[{key:"isSupported",value:function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return o.default.w("MozChunkedLoader",e.message),!1}}}]),a(t,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),function e(t,i,r){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,i);if(void 0===n){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,r)}if("value"in n)return n.value;var s=n.get;return void 0!==s?s.call(r):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function(e,t){this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&void 0!=e.redirectedURL&&(i=e.redirectedURL);var r=this._seekHandler.getConfig(i,t);this._requestURL=r.url;var a=this._xhr=new XMLHttpRequest;if(a.open("GET",r.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"===n(r.headers)){var s=r.headers;for(var o in s)s.hasOwnProperty(o)&&a.setRequestHeader(o,s[o])}if("object"===n(this._config.headers)){var u=this._config.headers;for(var c in u)u.hasOwnProperty(c)&&a.setRequestHeader(c,u[c])}this._status=l.LoaderStatus.kConnecting,a.send()}},{key:"abort",value:function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=l.LoaderStatus.kComplete}},{key:"_onReadyStateChange",value:function(e){var t=e.target;if(2===t.readyState){if(void 0!=t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var i=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(i)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=l.LoaderStatus.kError,!this._onError)throw new u.RuntimeException("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(l.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=l.LoaderStatus.kBuffering}}},{key:"_onProgress",value:function(e){if(this._status!==l.LoaderStatus.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}}},{key:"_onLoadEnd",value:function(e){!0!==this._requestAbort?this._status!==l.LoaderStatus.kError&&(this._status=l.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=l.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&e.loaded<this._contentLength?(t=l.LoaderErrors.EARLY_EOF,i={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=l.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new u.RuntimeException(i.msg);this._onError(t,i)}}]),t}();i.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],30:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),s=e("../utils/logger.js"),o=(r=s)&&r.__esModule?r:{default:r},l=e("./loader.js"),u=e("../utils/exception.js");var c=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var 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}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"xhr-msstream-loader"));return r.TAG="MSStreamLoader",r._seekHandler=e,r._config=i,r._needStash=!0,r._xhr=null,r._reader=null,r._totalRange=null,r._currentRange=null,r._currentRequestURL=null,r._currentRedirectedURL=null,r._contentLength=null,r._receivedLength=0,r._bufferLimit=16777216,r._lastTimeBufferSize=0,r._isReconnecting=!1,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)}(t,l.BaseLoader),a(t,null,[{key:"isSupported",value:function(){try{if(void 0===self.MSStream||void 0===self.MSStreamReader)return!1;var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="ms-stream","ms-stream"===e.responseType}catch(e){return o.default.w("MSStreamLoader",e.message),!1}}}]),a(t,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),this._reader&&(this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr=null),function e(t,i,r){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,i);if(void 0===n){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,r)}if("value"in n)return n.value;var s=n.get;return void 0!==s?s.call(r):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function(e,t){this._internalOpen(e,t,!1)}},{key:"_internalOpen",value:function(e,t,i){this._dataSource=e,i?this._currentRange=t:this._totalRange=t;var r=e.url;this._config.reuseRedirectedURL&&(void 0!=this._currentRedirectedURL?r=this._currentRedirectedURL:void 0!=e.redirectedURL&&(r=e.redirectedURL));var a=this._seekHandler.getConfig(r,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"===n(a.headers)){var u=a.headers;for(var c in u)u.hasOwnProperty(c)&&o.setRequestHeader(c,u[c])}if("object"===n(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=l.LoaderStatus.kConnecting,o.send()}},{key:"abort",value:function(){this._internalAbort(),this._status=l.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=l.LoaderStatus.kBuffering,void 0!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}var r=t.getResponseHeader("Content-Length");if(null!=r&&null==this._contentLength){var n=parseInt(r);n>0&&(this._contentLength=n,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength))}}else{if(this._status=l.LoaderStatus.kError,!this._onError)throw new u.RuntimeException("MSStreamLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(l.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else if(3===t.readyState&&t.status>=200&&t.status<=299){this._status=l.LoaderStatus.kBuffering;var a=t.response;this._reader.readAsArrayBuffer(a)}}},{key:"_xhrOnError",value:function(e){this._status=l.LoaderStatus.kError;var t=l.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type};if(!this._onError)throw new u.RuntimeException(i.msg);this._onError(t,i)}},{key:"_msrOnProgress",value:function(e){var t=e.target.result;if(null!=t){var i=t.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=t.byteLength;var r=this._totalRange.from+this._receivedLength;this._receivedLength+=i.byteLength,this._onDataArrival&&this._onDataArrival(i,r,this._receivedLength),t.byteLength>=this._bufferLimit&&(o.default.v(this.TAG,"MSStream buffer exceeded max size near "+(r+i.byteLength)+", reconnecting..."),this._doReconnectIfNeeded())}else this._doReconnectIfNeeded()}},{key:"_doReconnectIfNeeded",value:function(){if(null==this._contentLength||this._receivedLength<this._contentLength){this._isReconnecting=!0,this._lastTimeBufferSize=0,this._internalAbort();var e={from:this._totalRange.from+this._receivedLength,to:-1};this._internalOpen(this._dataSource,e,!0)}}},{key:"_msrOnLoad",value:function(e){this._status=l.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._totalRange.from,this._totalRange.from+this._receivedLength-1)}},{key:"_msrOnError",value:function(e){this._status=l.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength<this._contentLength?(t=l.LoaderErrors.EARLY_EOF,i={code:-1,msg:"MSStream meet Early-Eof"}):(t=l.LoaderErrors.EARLY_EOF,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new u.RuntimeException(i.msg);this._onError(t,i)}}]),t}();i.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24}],31:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var 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},n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=u(e("../utils/logger.js")),s=u(e("./speed-sampler.js")),o=e("./loader.js"),l=e("../utils/exception.js");function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var 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}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"xhr-range-loader"));return r.TAG="RangeLoader",r._seekHandler=e,r._config=i,r._needStash=!1,r._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],r._currentChunkSizeKB=384,r._currentSpeedNormalized=0,r._zeroSpeedChunkCount=0,r._xhr=null,r._speedSampler=new s.default,r._requestAbort=!1,r._waitForTotalLength=!1,r._totalLengthReceived=!1,r._currentRequestURL=null,r._currentRedirectedURL=null,r._currentRequestRange=null,r._totalLength=null,r._contentLength=null,r._receivedLength=0,r._lastTimeLoaded=0,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)}(t,o.BaseLoader),n(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}}}]),n(t,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),function e(t,i,r){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,i);if(void 0===n){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,r)}if("value"in n)return n.value;var s=n.get;return void 0!==s?s.call(r):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"open",value:function(e,t){this._dataSource=e,this._range=t,this._status=o.LoaderStatus.kConnecting;var i=!1;void 0!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(i=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||i?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))}},{key:"_openSubRange",value:function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,i=t+e;null!=this._contentLength&&i-this._range.from>=this._contentLength&&(i=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:i},this._internalOpen(this._dataSource,this._currentRequestRange)}},{key:"_internalOpen",value:function(e,t){this._lastTimeLoaded=0;var i=e.url;this._config.reuseRedirectedURL&&(void 0!=this._currentRedirectedURL?i=this._currentRedirectedURL:void 0!=e.redirectedURL&&(i=e.redirectedURL));var n=this._seekHandler.getConfig(i,t);this._currentRequestURL=n.url;var a=this._xhr=new XMLHttpRequest;if(a.open("GET",n.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"===r(n.headers)){var s=n.headers;for(var o in s)s.hasOwnProperty(o)&&a.setRequestHeader(o,s[o])}if("object"===r(this._config.headers)){var l=this._config.headers;for(var u in l)l.hasOwnProperty(u)&&a.setRequestHeader(u,l[u])}a.send()}},{key:"abort",value:function(){this._requestAbort=!0,this._internalAbort(),this._status=o.LoaderStatus.kComplete}},{key:"_internalAbort",value:function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}},{key:"_onReadyStateChange",value:function(e){var t=e.target;if(2===t.readyState){if(void 0!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=o.LoaderStatus.kBuffering}else{if(this._status=o.LoaderStatus.kError,!this._onError)throw new l.RuntimeException("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}}},{key:"_onProgress",value:function(e){if(this._status!==o.LoaderStatus.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var i=e.total;this._internalAbort(),null!=i&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var r=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(r)}}},{key:"_normalizeSpeed",value:function(e){var t=this._chunkSizeKBList,i=t.length-1,r=0,n=0,a=i;if(e<t[0])return t[0];for(;n<=a;){if((r=n+Math.floor((a-n)/2))===i||e>=t[r]&&e<t[r+1])return t[r];t[r]<e?n=r+1:a=r-1}}},{key:"_onLoad",value:function(e){if(this._status!==o.LoaderStatus.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(0===t&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),0!==t){var i=this._normalizeSpeed(t);this._currentSpeedNormalized!==i&&(this._currentSpeedNormalized=i,this._currentChunkSizeKB=i)}var r=e.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=r.byteLength;var a=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():a=!0,this._onDataArrival&&this._onDataArrival(r,n,this._receivedLength),a&&(this._status=o.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}}},{key:"_onXhrError",value:function(e){this._status=o.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=o.LoaderErrors.EARLY_EOF,i={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=o.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new l.RuntimeException(i.msg);this._onError(t,i)}},{key:"currentSpeed",get:function(){return this._speedSampler.lastSecondKBps}}]),t}();i.default=c},{"../utils/exception.js":40,"../utils/logger.js":41,"./loader.js":24,"./speed-sampler.js":27}],32:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var 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},n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=g(e("events")),s=g(e("../utils/logger.js")),o=g(e("../utils/browser.js")),l=g(e("./player-events.js")),u=g(e("../core/transmuxer.js")),c=g(e("../core/transmuxing-events.js")),d=g(e("../core/mse-controller.js")),h=g(e("../core/mse-events.js")),f=e("./player-errors.js"),p=e("../config.js"),m=e("../utils/exception.js");function g(e){return e&&e.__esModule?e:{default:e}}var v=function(){function e(t,i){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new a.default,this._config=(0,p.createDefaultConfig)(),"object"===(void 0===i?"undefined":r(i))&&Object.assign(this._config,i),"flv"!==t.type.toLowerCase())throw new m.InvalidArgumentException("FlvPlayer requires an flv MediaDataSource input!");!0===t.isLive&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=t,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var n=o.default.chrome&&(o.default.version.major<50||50===o.default.version.major&&o.default.version.build<2661);this._alwaysSeekKeyframe=!!(n||o.default.msedge||o.default.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return n(e,[{key:"destroy",value:function(){null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter&&this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){var i=this;e===l.default.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then(function(){i._emitter.emit(l.default.MEDIA_INFO,i.mediaInfo)}):e===l.default.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then(function(){i._emitter.emit(l.default.STATISTICS_INFO,i.statisticsInfo)}),this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"attachMediaElement",value:function(e){var t=this;if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),e.addEventListener("seeking",this.e.onvSeeking),e.addEventListener("canplay",this.e.onvCanPlay),e.addEventListener("stalled",this.e.onvStalled),e.addEventListener("progress",this.e.onvProgress),this._msectl=new d.default(this._config),this._msectl.on(h.default.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(h.default.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(h.default.SOURCE_OPEN,function(){t._mseSourceOpened=!0,t._hasPendingLoad&&(t._hasPendingLoad=!1,t.load())}),this._msectl.on(h.default.ERROR,function(e){t._emitter.emit(l.default.ERROR,f.ErrorTypes.MEDIA_ERROR,f.ErrorDetails.MEDIA_MSE_ERROR,e)}),this._msectl.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}}},{key:"detachMediaElement",value:function(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)}},{key:"load",value:function(){var e=this,t=!1,i=0;if(!this._mediaElement)throw new m.IllegalStateException("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new m.IllegalStateException("FlvPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened?this._hasPendingLoad=!0:(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new u.default(this._mediaDataSource,this._config),this._transmuxer.on(c.default.INIT_SEGMENT,function(t,i){e._msectl.appendInitSegment(i)}),this._transmuxer.on(c.default.MEDIA_SEGMENT,function(r,n){if(e._msectl.appendMediaSegment(n),e._config.isLive&&"video"==n.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,u=n.info.beginPts-1e3*a;if(u>=3e3&&!t&&!o&&a){if(i&&i==a)return void(u>=5e3&&e._emitter.emit(l.default.ERROR,f.ErrorTypes.OTHER_ERROR,"got wrong timestamp ",n.info.beginPts));var c=n.info.beginPts/1e3-1;s.default.w(e.TAG,"Live seems stuck at "+a+", try seek to "+c),t=!0,e._requestSetTime=!0,e.currentTime=c,i=a}else u>=2e3&&t&&(t=!1)}if(e._config.lazyLoad&&!e._config.isLive){a=e._mediaElement.currentTime;n.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(l.default.LOADING_COMPLETE)}),this._transmuxer.on(c.default.RECOVERED_EARLY_EOF,function(){e._emitter.emit(l.default.RECOVERED_EARLY_EOF)}),this._transmuxer.on(c.default.IO_ERROR,function(t,i){e._emitter.emit(l.default.ERROR,f.ErrorTypes.NETWORK_ERROR,t,i)}),this._transmuxer.on(c.default.DEMUX_ERROR,function(t,i){e._emitter.emit(l.default.ERROR,f.ErrorTypes.MEDIA_ERROR,t,{code:-1,msg:i})}),this._transmuxer.on(c.default.MEDIA_INFO,function(t){e._mediaInfo=t,e._emitter.emit(l.default.MEDIA_INFO,Object.assign({},t))}),this._transmuxer.on(c.default.METADATA_ARRIVED,function(t){e._emitter.emit(l.default.METADATA_ARRIVED,t)}),this._transmuxer.on(c.default.SCRIPTDATA_ARRIVED,function(t){e._emitter.emit(l.default.SCRIPTDATA_ARRIVED,t)}),this._transmuxer.on(c.default.STATISTICS_INFO,function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(l.default.STATISTICS_INFO,Object.assign({},e._statisticsInfo))}),this._transmuxer.on(c.default.RECOMMEND_SEEKPOINT,function(t){e._mediaElement&&!e._config.accurateSeek&&(console.log("recommend seekpoint",t/1e3),e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)}),this._transmuxer.open()))}},{key:"unload",value:function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)}},{key:"play",value:function(){return this._mediaElement.play()}},{key:"pause",value:function(){this._mediaElement.pause()}},{key:"_fillStatisticsInfo",value:function(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,r=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();i=n.totalVideoFrames,r=n.droppedVideoFrames}else void 0!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,r=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=r),e}},{key:"_onmseUpdateEnd",value:function(){if(this._config.lazyLoad&&!this._config.isLive){for(var e=this._mediaElement.buffered,t=this._mediaElement.currentTime,i=0,r=0;r<e.length;r++){var n=e.start(r),a=e.end(r);if(n<=t&&t<a){n,i=a;break}}i>=t+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(s.default.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}}},{key:"_onmseBufferFull",value:function(){s.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()}},{key:"_suspendTransmuxer",value:function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))}},{key:"_checkProgressAndResume",value:function(){for(var e=this._mediaElement.currentTime,t=this._mediaElement.buffered,i=!1,r=0;r<t.length;r++){var n=t.start(r),a=t.end(r);if(e>=n&&e<a){e>=a-this._config.lazyLoadRecoverDuration&&(i=!0);break}}i&&(window.clearInterval(this._progressChecker),this._progressChecker=null,i&&(s.default.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))}},{key:"_isTimepointBuffered",value:function(e){for(var t=this._mediaElement.buffered,i=0;i<t.length;i++){var r=t.start(i),n=t.end(i);if(e>=r&&e<n)return!0}return!1}},{key:"_internalSeek",value:function(e){var t=this._isTimepointBuffered(e),i=!1,r=0;if(e<1&&this._mediaElement.buffered.length>0){var n=this._mediaElement.buffered.start(0);(n<1&&e<n||o.default.safari)&&(i=!0,r=o.default.safari?.1:n)}if(i)this._requestSetTime=!0,this._mediaElement.currentTime=r;else if(t){if(this._alwaysSeekKeyframe){var a=this._msectl.getNearestKeyframe(Math.floor(1e3*e));this._requestSetTime=!0,this._mediaElement.currentTime=null!=a?a.dts/1e3:e}else this._requestSetTime=!0,this._mediaElement.currentTime=e;null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e)}},{key:"_checkAndApplyUnbufferedSeekpoint",value:function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var e=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(e)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},{key:"_checkAndResumeStuckPlayback",value:function(e){var t=this._mediaElement;if(e||!this._receivedCanPlay||t.readyState<2){var i=t.buffered;if(i.length>0&&t.currentTime<i.end(0)){if(this._config.isLive&&i.end(0)-t.currentTime>3600)return s.default.w(this.TAG,"Playback seems stuck at "+t.currentTime+", try seek to "+i.end(0)+", cancle"),this._mediaElement.removeEventListener("progress",this.e.onvProgress),void this._emitter.emit(l.default.ERROR,f.ErrorTypes.MEDIA_ERROR,"got wrong timestamp ",i.end(0));i.end(0)-t.currentTime>1||t.currentTime>0?(s.default.w(this.TAG,"Playback seems stuck at "+t.currentTime+", seek to "+i.end(0)),this._requestSetTime=!0,this._mediaElement.currentTime=i.end(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress)):s.default.w(this.TAG,"Playback seems stuck at "+t.currentTime+", skip seek to "+i.end(0))}}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)}},{key:"_onvLoadedMetadata",value:function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)}},{key:"_onvSeeking",value:function(e){var t=this._mediaElement.currentTime,i=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(t<1&&i.length>0){var r=i.start(0);if(r<1&&t<r||o.default.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=o.default.safari?.1:r)}if(this._isTimepointBuffered(t)){if(this._alwaysSeekKeyframe){var n=this._msectl.getNearestKeyframe(Math.floor(1e3*t));null!=n&&(this._requestSetTime=!0,this._mediaElement.currentTime=n.dts/1e3)}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:t,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}}},{key:"_onvCanPlay",value:function(e){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)}},{key:"_onvStalled",value:function(e){this._checkAndResumeStuckPlayback(!0)}},{key:"_onvProgress",value:function(e){this._checkAndResumeStuckPlayback()}},{key:"type",get:function(){return this._type}},{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e}},{key:"mediaInfo",get:function(){return Object.assign({},this._mediaInfo)}},{key:"statisticsInfo",get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}}]),e}();i.default=v},{"../config.js":5,"../core/mse-controller.js":9,"../core/mse-events.js":10,"../core/transmuxer.js":11,"../core/transmuxing-events.js":13,"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./player-errors.js":34,"./player-events.js":35,events:2}],33:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var 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},n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=u(e("events")),s=u(e("./player-events.js")),o=e("../config.js"),l=e("../utils/exception.js");function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(t,i){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new a.default,this._config=(0,o.createDefaultConfig)(),"object"===(void 0===i?"undefined":r(i))&&Object.assign(this._config,i),"flv"===t.type.toLowerCase())throw new l.InvalidArgumentException("NativePlayer does't support flv MediaDataSource input!");if(t.hasOwnProperty("segments"))throw new l.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 n(e,[{key:"destroy",value:function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter&&this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(e,t){var i=this;e===s.default.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){i._emitter.emit(s.default.MEDIA_INFO,i.mediaInfo)}):e===s.default.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then(function(){i._emitter.emit(s.default.STATISTICS_INFO,i.statisticsInfo)}),this._emitter.addListener(e,t)}},{key:"off",value:function(e,t){this._emitter.removeListener(e,t)}},{key:"attachMediaElement",value:function(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}}},{key:"detachMediaElement",value:function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"load",value:function(){if(!this._mediaElement)throw new l.IllegalStateException("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)}},{key:"unload",value:function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"play",value:function(){return this._mediaElement.play()}},{key:"pause",value:function(){this._mediaElement.pause()}},{key:"_onvLoadedMetadata",value:function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(s.default.MEDIA_INFO,this.mediaInfo)}},{key:"_reportStatisticsInfo",value:function(){this._emitter.emit(s.default.STATISTICS_INFO,this.statisticsInfo)}},{key:"type",get:function(){return this._type}},{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e}},{key:"mediaInfo",get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e}},{key:"statisticsInfo",get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,r=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();i=n.totalVideoFrames,r=n.droppedVideoFrames}else void 0!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,r=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=r),e}}]),e}();i.default=c},{"../config.js":5,"../utils/exception.js":40,"./player-events.js":35,events:2}],34:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.ErrorDetails=i.ErrorTypes=void 0;var r,n=e("../io/loader.js"),a=e("../demux/demux-errors.js"),s=(r=a)&&r.__esModule?r:{default:r};i.ErrorTypes={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},i.ErrorDetails={NETWORK_EXCEPTION:n.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:n.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:n.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:n.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:s.default.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:s.default.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:s.default.CODEC_UNSUPPORTED}},{"../demux/demux-errors.js":16,"../io/loader.js":24}],35:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.default={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info"}},{}],36:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}();var n=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:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null}}]),e}();i.default=n},{}],37:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}();var n=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:"init",value:function(){for(var t in e.types={hvc1:[],hvcC:[],avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],pasp:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function(e){for(var t=8,i=null,r=Array.prototype.slice.call(arguments,1),n=r.length,a=0;a<n;a++)t+=r[a].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);for(var s=8,o=0;o<n;o++)i.set(r[o],s),s+=r[o].byteLength;return i}},{key:"generateInitSegment",value:function(t){var i=e.box(e.types.ftyp,e.constants.FTYP),r=e.moov(t),n=new Uint8Array(i.byteLength+r.byteLength);return n.set(i,0),n.set(r,i.byteLength),n}},{key:"moov",value:function(t){var i=e.mvhd(t.timescale,t.duration),r=e.trak(t),n=e.mvex(t);return e.box(e.types.moov,i,r,n)}},{key:"mvhd",value:function(t,i){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"tkhd",value:function(t){var i=t.id,r=t.duration,n=t.presentWidth,a=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,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,n>>>8&255,255&n,0,0,a>>>8&255,255&a,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))}},{key:"mdhd",value:function(t){var i=t.timescale,r=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}},{key:"hdlr",value:function(t){var i=null;return i="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,i)}},{key:"minf",value:function(t){var i=null;return i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,i,e.dinf(),e.stbl(t))}},{key:"dinf",value:function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))}},{key:"stsd",value:function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))}},{key:"mp3",value:function(t){var i=t.channelCount,r=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types[".mp3"],n)}},{key:"mp4a",value:function(t){var i=t.channelCount,r=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.mp4a,n,e.esds(t))}},{key:"esds",value:function(t){var i=t.config||[],r=i.length,n=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(i).concat([6,1,2]));return e.box(e.types.esds,n)}},{key:"avc1",value:function(t){var i=t.avcc,r=t.codecWidth,n=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,r>>>8&255,255&r,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return t.codec.indexOf("hvc1")>=0?e.box(e.types.hvc1,a,e.box(e.types.hvcC,i)):e.box(e.types.avc1,a,e.box(e.types.avcC,i))}},{key:"mvex",value:function(t){return e.box(e.types.mvex,e.trex(t))}},{key:"trex",value:function(t){var i=t.id,r=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,r)}},{key:"moof",value:function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))}},{key:"mfhd",value:function(t){var i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,i)}},{key:"traf",value:function(t,i){var r=t.id,n=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),a=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),s=e.sdtp(t),o=e.trun(t,s.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,n,a,o,s)}},{key:"sdtp",value:function(t){for(var i=t.samples||[],r=i.length,n=new Uint8Array(4+r),a=0;a<r;a++){var s=i[a].flags;n[a+4]=s.isLeading<<6|s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy}return e.box(e.types.sdtp,n)}},{key:"trun",value:function(t,i){var r=t.samples||[],n=r.length,a=12+16*n,s=new Uint8Array(a);i+=8+a,s.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var o=0;o<n;o++){var l=r[o].duration,u=r[o].size,c=r[o].flags,d=r[o].cts;s.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,u>>>24&255,u>>>16&255,u>>>8&255,255&u,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}();n.init(),i.default=n},{}],38:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n=c(e("../utils/logger.js")),a=c(e("./mp4-generator.js")),s=c(e("./aac-silent.js")),o=c(e("../utils/browser.js")),l=e("../core/media-segment-info.js"),u=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 l.MediaSegmentInfoList("audio"),this._videoSegmentInfoList=new l.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 r(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 u.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),this._remuxVideo(t),this._remuxAudio(e)}},{key:"_onTrackMetadataReceived",value:function(e,t){var i=null,r="mp4",n=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(r="mpeg",n="",i=new Uint8Array):i=a.default.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=a.default.generateInitSegment(t)}if(!this._onInitSegment)throw new u.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:i.buffer,codec:n,container:e+"/"+r,mediaDuration:t.duration})}},{key:"_calculateDtsBase",value:function(e,t){this._dtsBaseInited||(e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)}},{key:"flushStashedSamples",value:function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=e.length);var r={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(r.samples.push(t),r.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(r,!0)}},{key:"_remuxAudio",value:function(e,t){if(null!=this._audioMeta){var i,r=e,u=r.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(u&&0!==u.length&&(1!==u.length||t)){var g=0,v=null,y=0;f?(g=0,y=r.length):(g=8,y=8+r.length);var _=null;if(u.length>1&&(y-=(_=u.pop()).length),null!=this._audioStashedLastSample){var b=this._audioStashedLastSample;this._audioStashedLastSample=null,u.unshift(b),y+=b.length}null!=_&&(this._audioStashedLastSample=_);var T=u[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 E=T-(S.originalDts+S.duration);E<=3&&(E=0),c=T-(S.dts+S.duration+E)}else c=0}if(m){var k=T-c,w=this._videoSegmentInfoList.getLastSegmentBefore(T);if(null!=w&&w.beginDts<k){var C=s.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(C){var L=w.beginDts,A=k-w.beginDts;n.default.v(this.TAG,"InsertPrefixSilentAudio: dts: "+L+", duration: "+A),u.unshift({unit:C,dts:L,pts:L}),y+=C.byteLength}}else m=!1}for(var R=[],P=0;P<u.length;P++){var D=u[P],I=D.unit,x=D.dts-this._dtsBase,O=x,M=!1,U=null,B=0;if(!(x<-.001)){if("mp3"!==this._audioMeta.codec){var N=x;if(this._audioNextDts&&(N=this._audioNextDts),(c=x-N)<=-3*h){n.default.w(this.TAG,"Dropping 1 audio frame (originalDts: "+x+" ms ,curRefDts: "+N+" ms) due to dtsCorrection: "+c+" ms overlap.");continue}if(c>=3*h&&this._fillAudioTimestampGap&&!o.default.safari){M=!0;var F=Math.floor(c/h);n.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: "+N+" ms, dtsCorrection: "+Math.round(c)+" ms, generate: "+F+" frames"),O=Math.floor(N),B=Math.floor(N+h)-O;var j=s.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);null==j&&(n.default.w(this.TAG,"Unable to generate silent frame for "+this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame"),j=I),U=[];for(var G=0;G<F;G++){N+=h;var V=Math.floor(N),H=Math.floor(N+h)-V,K={dts:V,pts:V,cts:0,unit:j,size:j.byteLength,duration:H,originalDts:x,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};U.push(K),y+=K.size}this._audioNextDts=N+h}else O=Math.floor(N),B=Math.floor(N+h)-O,this._audioNextDts=N+h}else{if(O=x-c,P!==u.length-1)B=u[P+1].dts-this._dtsBase-c-O;else if(null!=_)B=_.dts-this._dtsBase-c-O;else B=R.length>=1?R[R.length-1].duration:Math.floor(h);this._audioNextDts=O+B}-1===d&&(d=O),R.push({dts:O,pts:O,cts:0,unit:D.unit,size:D.unit.byteLength,duration:B,originalDts:x,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),M&&R.push.apply(R,U)}}if(0===R.length)return r.samples=[],void(r.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 z=R[R.length-1];i=z.dts+z.duration;var Y=new l.MediaSegmentInfo;Y.beginDts=d,Y.endDts=i,Y.beginPts=d,Y.endPts=i,Y.originalBeginDts=R[0].originalDts,Y.originalEndDts=z.originalDts+z.duration,Y.firstSample=new l.SampleInfo(R[0].dts,R[0].pts,R[0].duration,R[0].originalDts,!1),Y.lastSample=new l.SampleInfo(z.dts,z.pts,z.duration,z.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(Y),r.samples=R,r.sequenceNumber++;var X=null;X=f?new Uint8Array:a.default.moof(r,d),r.samples=[],r.length=0;var $={type:"audio",data:this._mergeBoxes(X,v).buffer,sampleCount:R.length,info:Y};f&&p&&($.timestampOffset=d),this._onMediaSegment("audio",$)}}}},{key:"_remuxVideo",value:function(e,t){if(null!=this._videoMeta){var i,r,s=e,o=s.samples,u=void 0,c=-1,d=-1;if(o&&0!==o.length&&(1!==o.length||t)){var h=8,f=null,p=8+e.length,m=null;if(o.length>1&&(p-=(m=o.pop()).length),null!=this._videoStashedLastSample){var g=this._videoStashedLastSample;this._videoStashedLastSample=null,o.unshift(g),p+=g.length}null!=m&&(this._videoStashedLastSample=m);var v=o[0].dts-this._dtsBase;if(this._videoNextDts)u=v-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())u=0;else{var y=this._videoSegmentInfoList.getLastSampleBefore(v);if(null!=y){var _=v-(y.originalDts+y.duration);_<=3&&(_=0),u=v-(y.dts+y.duration+_)}else u=0}for(var b=new l.MediaSegmentInfo,T=[],S=0;S<o.length;S++){var E=o[S],k=E.dts-this._dtsBase,w=E.isKeyframe,C=k-u,L=E.cts,A=C+L;-1===c&&(c=C,d=A);var R=0;if(S!==o.length-1)R=o[S+1].dts-this._dtsBase-u-C;else if(null!=m)R=m.dts-this._dtsBase-u-C;else R=T.length>=1?T[T.length-1].duration:Math.floor(this._videoMeta.refSampleDuration);if(R<=0&&(n.default.w(this.TAG,"remux video got invalid sample duration "+R+", force to 1"),R=1),w){var P=new l.SampleInfo(C,A,R,E.dts,!0);P.fileposition=E.fileposition,b.appendSyncPoint(P)}T.push({dts:C,pts:A,cts:L,units:E.units,size:E.length,isKeyframe:w,duration:R,originalDts:k,flags:{isLeading:0,dependsOn:w?2:1,isDependedOn:w?1:0,hasRedundancy:0,isNonSync:w?0:1}})}(f=new Uint8Array(p))[0]=p>>>24&255,f[1]=p>>>16&255,f[2]=p>>>8&255,f[3]=255&p,f.set(a.default.types.mdat,4);for(var D=0;D<T.length;D++)for(var I=T[D].units;I.length;){var x=I.shift().data;f.set(x,h),h+=x.byteLength}var O=T[T.length-1];if(i=O.dts+O.duration,r=O.pts+O.duration,this._videoNextDts=i,b.beginDts=c,b.endDts=i,b.beginPts=d,b.endPts=r,b.originalBeginDts=T[0].originalDts,b.originalEndDts=O.originalDts+O.duration,b.firstSample=new l.SampleInfo(T[0].dts,T[0].pts,T[0].duration,T[0].originalDts,T[0].isKeyframe),b.lastSample=new l.SampleInfo(O.dts,O.pts,O.duration,O.originalDts,O.isKeyframe),this._isLive||this._videoSegmentInfoList.append(b),s.samples=T,s.sequenceNumber++,this._forceFirstIDR){var M=T[0].flags;M.dependsOn=2,M.isNonSync=0}var U=a.default.moof(s,c);s.samples=[],s.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(U,f).buffer,sampleCount:T.length,info:b})}}}},{key:"_mergeBoxes",value:function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i}},{key:"onInitSegment",get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e}},{key:"onMediaSegment",get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e}}]),e}();i.default=d},{"../core/media-segment-info.js":8,"../utils/browser.js":39,"../utils/exception.js":40,"../utils/logger.js":41,"./aac-silent.js":36,"./mp4-generator.js":37}],39:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],i=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],n={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},a={};if(n.browser){a[n.browser]=!0;var s=n.majorVersion.split(".");a.version={major:parseInt(n.majorVersion,10),string:n.version},s.length>1&&(a.version.minor=parseInt(s[1],10)),s.length>2&&(a.version.build=parseInt(s[2],10))}n.platform&&(a[n.platform]=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),(a.rv||a.iemobile)&&(a.rv&&delete a.rv,n.browser="msie",a.msie=!0);a.edge&&(delete a.edge,n.browser="msedge",a.msedge=!0);a.opr&&(n.browser="opera",a.opera=!0);a.safari&&a.android&&(n.browser="android",a.android=!0);for(var o in a.name=n.browser,a.platform=n.platform,r)r.hasOwnProperty(o)&&delete r[o];Object.assign(r,a)}(),i.default=r},{}],40:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}();function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=i.RuntimeException=function(){function e(t){s(this,e),this._message=t}return r(e,[{key:"toString",value:function(){return this.name+": "+this.message}},{key:"name",get:function(){return"RuntimeException"}},{key:"message",get:function(){return this._message}}]),e}();i.IllegalStateException=function(e){function t(e){return s(this,t),n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,o),r(t,[{key:"name",get:function(){return"IllegalStateException"}}]),t}(),i.InvalidArgumentException=function(e){function t(e){return s(this,t),n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,o),r(t,[{key:"name",get:function(){return"InvalidArgumentException"}}]),t}(),i.NotImplementedException=function(e){function t(e){return s(this,t),n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,o),r(t,[{key:"name",get:function(){return"NotImplementedException"}}]),t}()},{}],41:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r,n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=e("events"),s=(r=a)&&r.__esModule?r:{default:r};var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return n(e,null,[{key:"e",value:function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",r),e.ENABLE_ERROR&&(console.error?console.error(r):console.warn?console.warn(r):console.log(r))}},{key:"i",value:function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",r),e.ENABLE_INFO&&(console.info?console.info(r):console.log(r))}},{key:"w",value:function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",r),e.ENABLE_WARN&&(console.warn?console.warn(r):console.log(r))}},{key:"d",value:function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",r),e.ENABLE_DEBUG&&(console.debug?console.debug(r):console.log(r))}},{key:"v",value:function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",r),e.ENABLE_VERBOSE&&console.log(r)}}]),e}();o.GLOBAL_TAG="flv.js",o.FORCE_GLOBAL_TAG=!1,o.ENABLE_ERROR=!0,o.ENABLE_INFO=!0,o.ENABLE_WARN=!0,o.ENABLE_DEBUG=!0,o.ENABLE_VERBOSE=!0,o.ENABLE_CALLBACK=!1,o.emitter=new s.default,i.default=o},{events:2}],42:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n=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 r(e,null,[{key:"getConfig",value:function(){return{globalTag:a.default.GLOBAL_TAG,forceGlobalTag:a.default.FORCE_GLOBAL_TAG,enableVerbose:a.default.ENABLE_VERBOSE,enableDebug:a.default.ENABLE_DEBUG,enableInfo:a.default.ENABLE_INFO,enableWarn:a.default.ENABLE_WARN,enableError:a.default.ENABLE_ERROR,enableCallback:a.default.ENABLE_CALLBACK}}},{key:"applyConfig",value:function(e){a.default.GLOBAL_TAG=e.globalTag,a.default.FORCE_GLOBAL_TAG=e.forceGlobalTag,a.default.ENABLE_VERBOSE=e.enableVerbose,a.default.ENABLE_DEBUG=e.enableDebug,a.default.ENABLE_INFO=e.enableInfo,a.default.ENABLE_WARN=e.enableWarn,a.default.ENABLE_ERROR=e.enableError,a.default.ENABLE_CALLBACK=e.enableCallback}},{key:"_notifyChange",value:function(){var t=e.emitter;if(t.listenerCount("change")>0){var i=e.getConfig();t.emit("change",i)}}},{key:"registerListener",value:function(t){e.emitter.addListener("change",t)}},{key:"removeListener",value:function(t){e.emitter.removeListener("change",t)}},{key:"addLogListener",value:function(t){a.default.emitter.addListener("log",t),a.default.emitter.listenerCount("log")>0&&(a.default.ENABLE_CALLBACK=!0,e._notifyChange())}},{key:"removeLogListener",value:function(t){a.default.emitter.removeListener("log",t),0===a.default.emitter.listenerCount("log")&&(a.default.ENABLE_CALLBACK=!1,e._notifyChange())}},{key:"forceGlobalTag",get:function(){return a.default.FORCE_GLOBAL_TAG},set:function(t){a.default.FORCE_GLOBAL_TAG=t,e._notifyChange()}},{key:"globalTag",get:function(){return a.default.GLOBAL_TAG},set:function(t){a.default.GLOBAL_TAG=t,e._notifyChange()}},{key:"enableAll",get:function(){return a.default.ENABLE_VERBOSE&&a.default.ENABLE_DEBUG&&a.default.ENABLE_INFO&&a.default.ENABLE_WARN&&a.default.ENABLE_ERROR},set:function(t){a.default.ENABLE_VERBOSE=t,a.default.ENABLE_DEBUG=t,a.default.ENABLE_INFO=t,a.default.ENABLE_WARN=t,a.default.ENABLE_ERROR=t,e._notifyChange()}},{key:"enableDebug",get:function(){return a.default.ENABLE_DEBUG},set:function(t){a.default.ENABLE_DEBUG=t,e._notifyChange()}},{key:"enableVerbose",get:function(){return a.default.ENABLE_VERBOSE},set:function(t){a.default.ENABLE_VERBOSE=t,e._notifyChange()}},{key:"enableInfo",get:function(){return a.default.ENABLE_INFO},set:function(t){a.default.ENABLE_INFO=t,e._notifyChange()}},{key:"enableWarn",get:function(){return a.default.ENABLE_WARN},set:function(t){a.default.ENABLE_WARN=t,e._notifyChange()}},{key:"enableError",get:function(){return a.default.ENABLE_ERROR},set:function(t){a.default.ENABLE_ERROR=t,e._notifyChange()}}]),e}();o.emitter=new n.default,i.default=o},{"./logger.js":41,events:2}],43:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}();var n=function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}return r(t,null,[{key:"install",value:function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var r=arguments[i];if(void 0!==r&&null!==r)for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])}return t},"function"!=typeof self.Promise&&e("es6-promise").polyfill()}}]),t}();n.install(),i.default=n},{"es6-promise":1}],44:[function(e,t,i){"use strict";function r(e,t,i){var r=e;if(t+i<r.length){for(;i--;)if(128!=(192&r[++t]))return!1;return!0}return!1}Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(e){for(var t=[],i=e,n=0,a=e.length;n<a;)if(i[n]<128)t.push(String.fromCharCode(i[n])),++n;else{if(i[n]<192);else if(i[n]<224){if(r(i,n,1)){var s=(31&i[n])<<6|63&i[n+1];if(s>=128){t.push(String.fromCharCode(65535&s)),n+=2;continue}}}else if(i[n]<240){if(r(i,n,2)){var o=(15&i[n])<<12|(63&i[n+1])<<6|63&i[n+2];if(o>=2048&&55296!=(63488&o)){t.push(String.fromCharCode(65535&o)),n+=3;continue}}}else if(i[n]<248&&r(i,n,3)){var l=(7&i[n])<<18|(63&i[n+1])<<12|(63&i[n+2])<<6|63&i[n+3];if(l>65536&&l<1114112){l-=65536,t.push(String.fromCharCode(l>>>10|55296)),t.push(String.fromCharCode(1023&l|56320)),n+=4;continue}}t.push(String.fromCharCode(65533)),++n}return t.join("")}},{}]},{},[21])(21)}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):e.videojsFlash=t(e.videojs)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},a=e.getComponent("Tech"),s=e.dom,o=e.url,l=e.createTimeRange,u=e.mergeOptions,c=i&&i.navigator||{},d=function(e){function t(a,s){r(this,t);var o=n(this,e.call(this,a,s));return a.source&&o.ready(function(){this.setSource(a.source)},!0),a.startTime&&o.ready(function(){this.load(),this.play(),this.currentTime(a.startTime)},!0),i.videojs=i.videojs||{},i.videojs.Flash=i.videojs.Flash||{},i.videojs.Flash.onReady=t.onReady,i.videojs.Flash.onEvent=t.onEvent,i.videojs.Flash.onError=t.onError,o.on("seeked",function(){this.lastSeekTarget_=void 0}),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.createEl=function(){var e=this.options_;e.swf||(e.swf="https://vjs.zencdn.net/swf/5.4.2/video-js.swf");var i=e.techId,r=u({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),n=u({wmode:"opaque",bgcolor:"#000000"},e.params),a=u({id:i,name:i,class:"vjs-tech"},e.attributes);return this.el_=t.embed(e.swf,r,n,a),this.el_.tech=this,this.el_},t.prototype.play=function(){this.ended()&&this.setCurrentTime(0),this.el_.vjs_play()},t.prototype.pause=function(){this.el_.vjs_pause()},t.prototype.src=function(e){return void 0===e?this.currentSrc():this.setSrc(e)},t.prototype.setSrc=function(e){var t=this;e=o.getAbsoluteURL(e),this.el_.vjs_src(e),this.autoplay()&&this.setTimeout(function(){return t.play()},0)},t.prototype.seeking=function(){return void 0!==this.lastSeekTarget_},t.prototype.setCurrentTime=function(t){var i=this.seekable();i.length&&(t=(t=t>i.start(0)?t:i.start(0))<i.end(i.length-1)?t:i.end(i.length-1),this.lastSeekTarget_=t,this.trigger("seeking"),this.el_.vjs_setProperty("currentTime",t),e.prototype.setCurrentTime.call(this))},t.prototype.currentTime=function(){return this.seeking()?this.lastSeekTarget_||0:this.el_.vjs_getProperty("currentTime")},t.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.vjs_getProperty("currentSrc")},t.prototype.duration=function(){if(0===this.readyState())return NaN;var e=this.el_.vjs_getProperty("duration");return e>=0?e:1/0},t.prototype.load=function(){this.el_.vjs_load()},t.prototype.poster=function(){this.el_.vjs_getProperty("poster")},t.prototype.setPoster=function(){},t.prototype.seekable=function(){var e=this.duration();return 0===e?l():l(0,e)},t.prototype.buffered=function(){var e=this.el_.vjs_getProperty("buffered");return 0===e.length?l():l(e[0][0],e[0][1])},t.prototype.supportsFullScreen=function(){return!1},t.prototype.enterFullScreen=function(){return!1},t.prototype.getVideoPlaybackQuality=function(){var e=this.el_.vjs_getProperty("getVideoPlaybackQuality");return i.performance&&"function"==typeof i.performance.now?e.creationTime=i.performance.now():i.performance&&i.performance.timing&&"number"==typeof i.performance.timing.navigationStart&&(e.creationTime=i.Date.now()-i.performance.timing.navigationStart),e},t}(a),h=["rtmpConnection","rtmpStream","preload","defaultPlaybackRate","playbackRate","autoplay","stretch","fluent","loop","controls","volume","muted","defaultMuted"],f=["networkState","readyState","initialTime","startOffsetTime","paused","ended","videoWidth","videoHeight"],p=d.prototype;function m(e){var t=e.charAt(0).toUpperCase()+e.slice(1);p["set"+t]=function(t){return this.el_.vjs_setProperty(e,t)}}function g(e){p[e]=function(){return this.el_.vjs_getProperty(e)}}for(var v=0;v<h.length;v++)g(h[v]),m(h[v]);for(var y=0;y<f.length;y++)g(f[y]);return d.isSupported=function(){return!!(e.browser.IS_CHROME&&!e.browser.IS_ANDROID||e.browser.IS_SAFARI&&!e.browser.IS_IOS)||d.version()[0]>=10},a.withSourceHandlers(d),d.nativeSourceHandler={},d.nativeSourceHandler.canPlayType=function(e){return e in d.formats?"maybe":""},d.nativeSourceHandler.canHandleSource=function(e,t){var i,r,n=void 0;return e.type?n=e.type.replace(/;.*/,"").toLowerCase():(i=e.src,n=(r=o.getFileExtension(i))?"video/"+r:""),d.nativeSourceHandler.canPlayType(n)},d.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},d.nativeSourceHandler.dispose=function(){},d.registerSourceHandler(d.nativeSourceHandler),d.formats={"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"},d.onReady=function(e){var t=s.$("#"+e),i=t&&t.tech;i&&i.el()&&d.checkReady(i)},d.checkReady=function(e){e.el()&&(e.el().vjs_getProperty?e.triggerReady():this.setTimeout(function(){d.checkReady(e)},50))},d.onEvent=function(e,t){var i=s.$("#"+e).tech,r=Array.prototype.slice.call(arguments,2);i.setTimeout(function(){i.trigger(t,r)},1)},d.onError=function(e,t){var i=s.$("#"+e).tech;if("srcnotfound"===t)return i.error(4);"string"==typeof t?i.error("FLASH: "+t):(t.origin="flash",i.error(t))},d.version=function(){var e="0,0,0";try{e=new i.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(t){try{c.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(e=(c.plugins["Shockwave Flash 2.0"]||c.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(e){}}return e.split(",")},d.embed=function(e,t,i,r){var n=d.getEmbedCode(e,t,i,r);return s.createEl("div",{innerHTML:n}).childNodes[0]},d.getEmbedCode=function(e,t,i,r){var n="",a="",s="";return t&&Object.getOwnPropertyNames(t).forEach(function(e){n+=e+"="+t[e]+"&amp;"}),i=u({movie:e,flashvars:n,allowScriptAccess:"always",allowNetworking:"all"},i),Object.getOwnPropertyNames(i).forEach(function(e){a+='<param name="'+e+'" value="'+i[e]+'" />'}),r=u({data:e,width:"100%",height:"100%"},r),Object.getOwnPropertyNames(r).forEach(function(e){s+=e+'="'+r[e]+'" '}),'<object type="application/x-shockwave-flash" '+s+">"+a+"</object>"},function(e){e.streamingFormats={"rtmp/mp4":"MP4","rtmp/flv":"FLV"},e.streamFromParts=function(e,t){return e+"&"+t},e.streamToParts=function(e){var t={connection:"",stream:""};if(!e)return t;var i=e.search(/&(?![\w-]+=)/),r=void 0;return-1!==i?r=i+1:0===(i=r=e.lastIndexOf("/")+1)&&(i=r=e.length),t.connection=e.substring(0,i),t.stream=e.substring(r,e.length),t},e.isStreamingType=function(t){return t in e.streamingFormats},e.RTMP_RE=/^rtmp[set]?:\/\//i,e.isStreamingSrc=function(t){return e.RTMP_RE.test(t)},e.rtmpSourceHandler={},e.rtmpSourceHandler.canPlayType=function(t){return e.isStreamingType(t)?"maybe":""},e.rtmpSourceHandler.canHandleSource=function(t,i){var r=e.rtmpSourceHandler.canPlayType(t.type);return r||(e.isStreamingSrc(t.src)?"maybe":"")},e.rtmpSourceHandler.handleSource=function(t,i,r){var n=e.streamToParts(t.src);i.setRtmpConnection(n.connection),i.setRtmpStream(n.stream)},e.registerSourceHandler(e.rtmpSourceHandler)}(d),a.getTech("Flash")?(e.log.warn("Not using videojs-flash as it appears to already be registered"),e.log.warn("videojs-flash should only be used with video.js@6 and above")):e.registerTech("Flash",d),d.VERSION="2.1.2",d}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).videojsFlvjs=e()}}(function(){return function e(t,i,r){function n(s,o){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=i[s]={exports:{}};t[s][0].call(c.exports,function(e){var i=t[s][1][e];return n(i||e)},c,c.exports,e,t,i,r)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t,r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n="undefined"!=typeof window?window.videojs:void 0!==e?e.videojs:null,a=(t=n)&&t.__esModule?t:{default:t};var s=a.default.getTech("Html5"),o=a.default.mergeOptions||a.default.util.mergeOptions,l={mediaDataSource:{},config:{}},u=function(e){function t(e,i){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=o(l,e),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,i))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s),r(t,[{key:"setSrc",value:function(e){this.flvPlayer&&(this.flvPlayer.unload(),this.flvPlayer.detachMediaElement(),this.flvPlayer.destroy());var t=this.options_.mediaDataSource,i=this.options_.config;t.type=void 0===t.type?"flv":t.type,t.url=e,this.flvPlayer=window.flvjs.createPlayer(t,i),this.flvPlayer.attachMediaElement(this.el_),this.flvPlayer.load()}},{key:"dispose",value:function(){this.flvPlayer&&(this.flvPlayer.detachMediaElement(),this.flvPlayer.unload(),this.flvPlayer.destroy(),this.flvPlayer=null),function e(t,i,r){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,i);if(void 0===n){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,r)}if("value"in n)return n.value;var s=n.get;return void 0!==s?s.call(r):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"dispose",this).call(this)}}]),t}();u.isSupported=function(){return window.flvjs&&window.flvjs.isSupported()},u.formats={"video/flv":"FLV","video/x-flv":"FLV"},u.canPlayType=function(e){return u.isSupported()&&e in u.formats?"maybe":""},u.canPlaySource=function(e,t){return u.canPlayType(e.type)},u.VERSION="0.2.0",a.default.registerTech("Flvjs",u),i.default=u}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}),function(e){var t={};function i(r){var n;return(t[r]||(n=t[r]={i:r,l:!1,exports:{}},e[r].call(n.exports,n,n.exports,i),n.l=!0,n)).exports}i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t,i){"use strict";i=i(1),window.videojs&&(i.registerConfigPlugin(window.videojs),i.registerSourceHandler(window.videojs)),i={register:i.registerSourceHandler};var r="hlsSourceHandler";window[r]||(window[r]=i)},function(e,t,i){"use strict";var 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},n=i(2);function a(e){var t=this;e&&(t.srOptions_||(t.srOptions_={}),t.srOptions_.hlsjsConfig||(t.srOptions_.hlsjsConfig=e.hlsjsConfig),t.srOptions_.captionConfig||(t.srOptions_.captionConfig=e.captionConfig))}e.exports={registerSourceHandler:function(e){var t,i={};function a(t,a){a.name_="livehls";var s,o=a.el(),l={},u=null,c=null,d=null,h=null,f=null,p=null,m=e(a.options_.playerId),g=m.qualityLevels&&m.qualityLevels(),v=(g&&m.hlsQualitySelector&&(a.hls={}),!1);function y(e){1===l[n.ErrorTypes.MEDIA_ERROR]?s.recoverMediaError():2===l[n.ErrorTypes.MEDIA_ERROR]?(s.swapAudioCodec(),s.recoverMediaError()):2<l[n.ErrorTypes.MEDIA_ERROR]&&(a.error=function(){return e},a.trigger("error"))}function _(e){s.nextLevel=e}function b(e,t){if(g){if("boolean"==typeof t){g[e]._enabled=t;for(var i=!0,r=0;r<g.length;r++)if(!g[r]._enabled){i=!1;break}if(i)s.currentLevel=-1;else{for(var n=g.length-1;0<=n&&!g[n]._enabled;n--);s.currentLevel=n}}return g[e]._enabled}return!1}function T(e,t){g&&(g.selectedIndex_=t.level,g.trigger({selectedIndex:t.level,type:"change"}))}function S(){var e,t;c&&(e=[],1<c.levels.length&&(t={id:-1,label:"auto",selected:-1===s.manualLevel},e.push(t)),c.levels.forEach(function(t,i){var r={};r.id=i,r.selected=i===s.manualLevel,r.label=(i=t).height?i.height+"p":i.width?Math.round(9*i.width/16)+"p":i.bitrate?i.bitrate/1e3+"kbps":0,e.push(r)}),t={qualityData:{video:e},qualitySwitchCallback:_},a.trigger("loadedqualitydata",t),o.removeEventListener("playing",S))}function E(){for(var e=a.audioTracks(),t=0;t<e.length;t++)if(e[t].enabled){s.audioTrack=t;break}}function k(){var t=s.audioTracks,i=a.audioTracks();if(1<t.length&&0===i.length){for(var r=0;r<t.length;r++)i.addTrack(new e.AudioTrack({id:r,kind:"alternative",label:t[r].name||t[r].lang,language:t[r].lang,enabled:r===s.audioTrack}));i.addEventListener("change",E)}}function w(e){return e.label||e.language}function C(e,t){return w(e)===w(t)&&e.kind===t.kind}function L(){for(var e=m.textTracks(),t=null,i=0;i<e.length;i++)if("showing"===e[i].mode){t=e[i];break}for(var r=o.textTracks,n=0;n<r.length;n++)"subtitles"!==r[n].kind&&"captions"!==r[n].kind||(r[n].mode=t&&C(r[n],t)?"showing":"disabled")}function A(){s.startLoad(-1),o.removeEventListener("play",A)}function R(){for(var e=function(e){for(var t=[],i=0;i<e.length;i++)"subtitles"!==e[i].kind&&"captions"!==e[i].kind||t.push(e[i]);return t}(o.textTracks),t=m.textTracks(),i=0;i<e.length;i++){for(var r,n=!1,a=0;a<t.length;a++)if(C(e[i],t[a])){n=!0;break}n||(r=e[i],m.addRemoteTextTrack({kind:r.kind,label:w(r),language:r.language,srclang:r.language},!1))}L(),v||(t.addEventListener("change",L),v=!0)}function P(e,t){c=t,function(){if(c&&(g=m.qualityLevels&&m.qualityLevels())){a.hls={};for(var e=0;e<c.levels.length;e++){var t,i=c.levels[e];(t={id:t="hlsjs-"+e,label:t,width:i.width,height:i.height,bandwidth:i.bitrate,bitrate:i.bitrate,_enabled:!1}).enabled=b.bind(this,e),g.addQualityLevel(t)}}}()}this.duration=function(){return u||o.duration||0},this.seekable=function(){var t,i;return s.media?d?(t=Math.round(s.media.duration-h),i=Math.round(s.media.duration-f),e.createTimeRanges(t,i)):e.createTimeRanges(0,s.media.duration):e.createTimeRanges()},this.dispose=function(){o.removeEventListener("play",A),o.textTracks.removeEventListener("addtrack",R),o.removeEventListener("playing",S),m.textTracks().removeEventListener("change",L),v=!1,m.audioTracks().removeEventListener("change",E),s.destroy()},o.addEventListener("error",function(e){var t=e.currentTarget.error;switch(t.code){case t.MEDIA_ERR_ABORTED:break;case t.MEDIA_ERR_DECODE:y(t);break;case t.MEDIA_ERR_NETWORK:case t.MEDIA_ERR_SRC_NOT_SUPPORTED:break;default:t.message}}),function(){var e,c=m.srOptions_&&m.srOptions_.hlsjsConfig||a.options_.hlsjsConfig,g=(p=c?function(e){for(var t={},i=Object.keys(e),r=0;r<i.length;r++)t[i[r]]=e[i[r]];return t}(c):{},-1!==["","auto"].indexOf(o.preload)||o.autoplay||void 0!==p.autoStartLoad||(p.autoStartLoad=!1),(c=m.srOptions_&&m.srOptions_.captionConfig||a.options_.captionConfig)&&(p.cueHandler=(e=c,{newCue:function(t,i,n,a){for(var s,o,l,u=window.VTTCue||window.TextTrackCue,c=0;c<a.rows.length;c++)if(l="",!(s=a.rows[c]).isEmpty()){for(var d=0;d<s.chars.length;d++)l+=s.chars[d].uchar;if(o=new u(i,n,l.trim()),null!=e&&"object"===(void 0===e?"undefined":r(e)))for(var h=Object.keys(e),f=0;f<h.length;f++)o[h[f]]=e[h[f]];t.addCue(o),n===i&&t.addCue(new u(n+5,""))}}})),!1===p.autoStartLoad&&o.addEventListener("play",A),o.addEventListener("playing",S),s=new n(p),"beforeinitialize");if(void 0!==i[g])for(var v=0;v<i[g].length;v++)i[g][v](m,s);s.on(n.Events.ERROR,function(e,t){var i={message:"livehls error: "+t.type+" - fatal: "+t.fatal+" - "+t.details};if(l[t.type]?l[t.type]+=1:l[t.type]=1,t.fatal)switch(t.type){case n.ErrorTypes.NETWORK_ERROR:i.code=2,a.error=function(){return i},a.trigger("error");break;case n.ErrorTypes.MEDIA_ERROR:i.code=3,y(i);break;default:s.destroy(),a.error=function(){return i},a.trigger("error")}}),s.on(n.Events.AUDIO_TRACKS_UPDATED,k),s.on(n.Events.MANIFEST_PARSED,P),s.on(n.Events.LEVEL_LOADED,function(e,t){p.liveSyncDuration?f=p.liveSyncDuration:p.liveSyncDurationCount&&(f=p.liveSyncDurationCount*t.details.targetduration),d=t.details.live,h=t.details.totalduration,u=d?1/0:t.details.totalduration}),s.once(n.Events.FRAG_LOADED,function(){a.trigger("loadedmetadata")}),s.on(n.Events.LEVEL_SWITCHED,T),s.attachMedia(o),o.textTracks.addEventListener("addtrack",R),s.loadSource(t.src)}()}if(a.addHook=function(e,t){i[e]=i[e]||[],i[e].push(t)},a.removeHook=function(e,t){return void 0!==i[e]&&-1!==(t=i[e].indexOf(t))&&(i[e].splice(t,1),!0)},n.isSupported()){if("function"==typeof e.getTech)t=e.getTech("Html5");else{if("function"!=typeof e.getComponent)return;t=e.getComponent("Html5")}t&&(t.registerSourceHandler({canHandleSource:function(e){return e=/^application\/x-mpegURL|application\/vnd\.apple\.mpegurl$/i.test(e.type)?"probably":/\.m3u8/i.test(e.src)?"maybe":""},handleSource:function(e,t){return t.hlsProvider&&t.hlsProvider.dispose(),t.hlsProvider=new a(e,t),t.hlsProvider}},0),e.Html5Hlsjs=a)}},registerConfigPlugin:function(e){(e.registerPlugin||e.plugin)("livehls",a)}}},function(e,t,i){"use strict";var r,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function a(s){var o;o=function(){function e(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(e=function(){return!!t})()}function t(e,t){var i,r=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)),r}function i(e){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?t(Object(n),!0).forEach(function(t){var i,a;i=e,a=n[t=t],(t=r(t))in i?Object.defineProperty(i,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[t]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function r(e){return"symbol"==(void 0===(e=function(e,t){if("object"!=(void 0===e?"undefined":n(e))||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return String(e);if("object"!=(void 0===(i=i.call(e,t))?"undefined":n(i)))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string"))?"undefined":n(e))?e:e+""}function o(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,r(n.key),n)}}function l(e,t,i){return t&&o(e.prototype,t),i&&o(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(){return(u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}function c(e,t){e.prototype=Object.create(t.prototype),h(e.prototype.constructor=e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function f(t){var i="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(t))return i.get(t);i.set(t,r)}function r(){return function(t,i,r){var n;return e()?Reflect.construct.apply(null,arguments):((n=[null]).push.apply(n,i),i=new(t.bind.apply(t,n)),r&&h(i,r.prototype),i)}(t,arguments,d(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),h(r,t)})(t)}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function m(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0,e="["+e+"]:",this.trace=g,this.debug=t.debug.bind(null,e),this.log=t.log.bind(null,e),this.warn=t.warn.bind(null,e),this.info=t.info.bind(null,e),this.error=t.error.bind(null,e)}function g(){}v=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,y=/^(?=([^\/?#]*))\1([^]*)$/,_=/(?:\/|^)\.(?=\/)/g,b=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g;var v,y,_,b,T,S=T={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=T.parseURL(e);if(r)return r.path=T.normalizePath(r.path),T.buildURLFromParts(r);throw new Error("Error trying to parse base URL.")}if(!(r=T.parseURL(t)))throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=T.normalizePath(r.path),T.buildURLFromParts(r)):t;if(!(t=T.parseURL(e)))throw new Error("Error trying to parse base URL.");!t.netLoc&&t.path&&"/"!==t.path[0]&&(e=y.exec(t.path),t.netLoc=e[1],t.path=e[2]),t.netLoc&&!t.path&&(t.path="/");var n;e={scheme:t.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};return r.netLoc||(e.netLoc=t.netLoc,"/"!==r.path[0]&&(r.path?(n=(n=t.path).substring(0,n.lastIndexOf("/")+1)+r.path,e.path=T.normalizePath(n)):(e.path=t.path,r.params||(e.params=t.params,r.query)||(e.query=t.query)))),null===e.path&&(e.path=i.alwaysNormalize?T.normalizePath(r.path):r.path),T.buildURLFromParts(e)},parseURL:function(e){return(e=v.exec(e))?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(_,"");e.length!==(e=e.replace(b,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},E=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},k=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=w},w=Number.MAX_SAFE_INTEGER||9007199254740991,C=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.MEDIA_ENDED="hlsMediaEnded",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e}({}),L=function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e}({}),A=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.UNKNOWN="unknown",e}({}),R=/^(\d+)x(\d+)$/,P=/(.+?)=(".*?"|.*?)(?:,|$)/g,D=function(){function e(t){u(this,t="string"==typeof t?e.parseAttrList(t):t)}var t=e.prototype;return t.decimalInteger=function(e){return(e=parseInt(this[e],10))>Number.MAX_SAFE_INTEGER?1/0:e},t.hexadecimalInteger=function(e){if(this[e]){for(var t=(1&(t=(this[e]||"0x").slice(2)).length?"0":"")+t,i=new Uint8Array(t.length/2),r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(2*r,2*r+2),16);return i}return null},t.hexadecimalIntegerAsNumber=function(e){return(e=parseInt(this[e],16))>Number.MAX_SAFE_INTEGER?1/0:e},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){return(e=this[e])?parseFloat(e):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){if(null!==(e=R.exec(this[e])))return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},e.parseAttrList=function(e){var t,i={};for(P.lastIndex=0;null!==(t=P.exec(e));){var r=t[2];0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),i[t[1].trim()]=r}return i},l(e,[{key:"clientAttrs",get:function(){return Object.keys(this).filter(function(e){return"X-"===e.substring(0,2)})}}])}(),I={trace:g,debug:g,log:g,warn:g,info:g,error:g};function x(){return u({},I)}function O(e,t,i){return t[e]?t[e].bind(t):(t=e,e=i,(i=self.console[t])?i.bind(self.console,(e?"["+e+"] ":"")+"["+t+"] >"):g)}var M=x();function U(e,t,i){var r=x();if("object"===("undefined"==typeof console?"undefined":n(console))&&!0===e||"object"===(void 0===e?"undefined":n(e))){var a=["debug","log","info","warn","error"];a.forEach(function(t){r[t]=O(t,e,i)});try{r.log('Debug logs enabled for "'+t+'" in hls.js version '+void 0)}catch(t){return x()}a.forEach(function(t){M[t]=O(t,e)})}else u(M,r);return r}var B=M;function N(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}var F=l(function(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){var i,r=t.attr;for(i in r)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==r[i]){B.warn('DATERANGE tag attribute: "'+i+'" does not match for tags with ID: "'+e.ID+'"'),this._badValueForSameId=i;break}e=u(new D({}),r,e)}this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr&&(t=new Date(this.attr["END-DATE"]),E(t.getTime()))&&(this._endDate=t)},[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){var e;return this._endDate||(null!==(e=this.duration)?new Date(this._startDate.getTime()+1e3*e):null)}},{key:"duration",get:function(){if("DURATION"in this.attr){var e=this.attr.decimalFloatingPoint("DURATION");if(E(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&E(this.startDate.getTime())&&(null===this.duration||0<=this.duration)&&(!this.endOnNext||!!this.class)}}]),j="audio",G="video",V="audiovideo",H=function(e){function t(t,i){return(i=e.call(this,i)||this)._decryptdata=null,i.rawProgramDateTime=null,i.programDateTime=null,i.tagList=[],i.duration=0,i.sn=0,i.levelkeys=void 0,i.type=void 0,i.loader=null,i.keyLoader=null,i.level=-1,i.cc=0,i.startPTS=void 0,i.endPTS=void 0,i.startDTS=void 0,i.endDTS=void 0,i.start=0,i.deltaPTS=void 0,i.maxStartPTS=void 0,i.minEndPTS=void 0,i.stats=new N,i.data=void 0,i.bitrateTest=!1,i.title=null,i.initSegment=null,i.endList=void 0,i.gap=void 0,i.urlId=0,i.type=t,i}c(t,e);var i=t.prototype;return i.setKeyFormat=function(e){this.levelkeys&&(e=this.levelkeys[e])&&!this._decryptdata&&(this._decryptdata=e.getDecryptData(this.sn))},i.abortRequests=function(){var e;null!=(e=this.loader)&&e.abort(),null!=(e=this.keyLoader)&&e.abort()},i.setElementaryStreamInfo=function(e,t,i,r,n,a){void 0===a&&(a=!1);var s=this.elementaryStreams,o=s[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,n)):s[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:a}},i.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[j]=null,e[G]=null,e[V]=null},l(t,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else if(1===(e=Object.keys(this.levelkeys)).length)return this._decryptdata=this.levelkeys[e[0]].getDecryptData(this.sn)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){var e;return null!==this.programDateTime&&E(this.programDateTime)?(e=E(this.duration)?this.duration:0,this.programDateTime+1e3*e):null}},{key:"encrypted",get:function(){if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var e=Object.keys(this.levelkeys),t=e.length;if(1<t||1===t&&this.levelkeys[e[0]].encrypted)return!0}return!1}}])}(wa=function(){function e(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[j]=null,t[G]=null,t[V]=null,t),this.baseurl=e}return e.prototype.setByteRange=function(e,t){t=1===(e=e.split("@",2)).length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(e[1]),this._byteRange=[t,parseInt(e[0])+t]},l(e,[{key:"byteRange",get:function(){return this._byteRange||[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=S.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}])}()),K=function(e){function t(t,i,r,n,a){return(r=e.call(this,r)||this).fragOffset=0,r.duration=0,r.gap=!1,r.independent=!1,r.relurl=void 0,r.fragment=void 0,r.index=void 0,r.stats=new N,r.duration=t.decimalFloatingPoint("DURATION"),r.gap=t.bool("GAP"),r.independent=t.bool("INDEPENDENT"),r.relurl=t.enumeratedString("URI"),r.fragment=i,r.index=n,(i=t.enumeratedString("BYTERANGE"))&&r.setByteRange(i,a),a&&(r.fragOffset=a.fragOffset+a.duration),r}return c(t,e),l(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}])}(wa),q=function(){function e(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}return e.prototype.reloaded=function(e){var t,i;e?(t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex,this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||0<t||0==t&&0<i,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay):(this.advanced=!0,this.updated=!0)},l(e,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&E(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return 0<e?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])}();function W(e){return Uint8Array.from(atob(e),function(e){return e.charCodeAt(0)})}function z(e){return Uint8Array.from(unescape(encodeURIComponent(e)),function(e){return e.charCodeAt(0)})}var Y=0,X=1;function $(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function Q(e){switch(e){case"AES-128":case"AES-256":return Y;case"AES-256-CTR":return X;default:throw new Error("invalid full segment method "+e)}}var J={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Z={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function ee(e){switch(e){case Z.FAIRPLAY:return J.FAIRPLAY;case Z.PLAYREADY:return J.PLAYREADY;case Z.WIDEVINE:return J.WIDEVINE;case Z.CLEARKEY:return J.CLEARKEY}}var te={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function ie(e){switch(e){case J.FAIRPLAY:return Z.FAIRPLAY;case J.PLAYREADY:return Z.PLAYREADY;case J.WIDEVINE:return Z.WIDEVINE;case J.CLEARKEY:return Z.CLEARKEY}}function re(e){var t=e.drmSystems,i=(e=e.widevineLicenseUrl,t?[J.FAIRPLAY,J.WIDEVINE,J.PLAYREADY,J.CLEARKEY].filter(function(e){return!!t[e]}):[]);return!i[J.WIDEVINE]&&e&&i.push(J.WIDEVINE),i}var ne=null!=(wa="undefined"!=typeof self?self:void 0)&&null!=(ai=wa.navigator)&&ai.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function ae(e,t,i){return Uint8Array.prototype.slice?e.slice(t,i):new Uint8Array(Array.prototype.slice.call(e,t,i))}function se(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function oe(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function le(e,t){for(var i=t,r=0;se(e,t);)r=(r+=10)+me(e,t+6),oe(e,t+10)&&(r+=10),t+=r;if(0<r)return e.subarray(i,i+r)}function ue(e){for(var t=de(e),i=0;i<t.length;i++){var r=t[i];if(ce(r))return fe(r)}}function ce(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}function de(e){for(var t,i=0,r=[];se(e,i);){for(var n=me(e,i+6),a=(i+=10)+n;i+8<a;){o=e.subarray(i),t=s=void 0;var s={type:s=String.fromCharCode(o[0],o[1],o[2],o[3]),size:t=me(o,4),data:o.subarray(10,10+t)},o=he(s);o&&r.push(o),i+=s.size+10}oe(e,i)&&(i+=10)}return r}function he(e){return("PRIV"===e.type?ge:"W"===e.type[0]?ye:ve)(e)}function fe(e){var t;if(8===e.data.byteLength)return t=1&(e=new Uint8Array(e.data))[3],e=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7],e/=45,t&&(e+=47721858.84),Math.round(e)}var pe,me=function(e,t){var i=(127&e[t])<<21;return(i|=(127&e[t+1])<<14)|(127&e[t+2])<<7|127&e[t+3]},ge=function(e){var t,i;if(!(e.size<2))return t=_e(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1)),{key:e.type,info:t,data:i.buffer}},ve=function(e){var t,i;if(!(e.size<2))return"TXXX"===e.type?(t=1,t+=(i=_e(e.data.subarray(1),!0)).length+1,t=_e(e.data.subarray(t)),{key:e.type,info:i,data:t}):(i=_e(e.data.subarray(1)),{key:e.type,data:i})},ye=function(e){var t,i;return"WXXX"===e.type?e.size<2?void 0:(t=1,t+=(i=_e(e.data.subarray(1),!0)).length+1,t=_e(e.data.subarray(t)),{key:e.type,info:i,data:t}):(i=_e(e.data),{key:e.type,data:i})},_e=function(e,t){void 0===t&&(t=!1);var i,r=function(){if(!navigator.userAgent.includes("PlayStation 4"))return pe=pe||void 0===self.TextDecoder?pe:new self.TextDecoder("utf-8")}();if(r)return r=r.decode(e),t?-1!==(i=r.indexOf("\0"))?r.substring(0,i):r:r.replace(/\0/g,"");for(var n,a,s,o=e.length,l="",u=0;u<o;){if(0===(n=e[u++])&&t)return l;if(0!==n&&3!==n)switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(n);break;case 12:case 13:a=e[u++],l+=String.fromCharCode((31&n)<<6|63&a);break;case 14:a=e[u++],s=e[u++],l+=String.fromCharCode((15&n)<<12|(63&a)<<6|(63&s)<<0)}}return l},be={hexDump:function(e){for(var t="",i=0;i<e.length;i++){var r=e[i].toString(16);t+=r=r.length<2?"0"+r:r}return t}},Te=Math.pow(2,32)-1,Se=[].push,Ee={video:1,audio:2,id3:3,text:4};function ke(e){return String.fromCharCode.apply(null,e)}function we(e,t){return(e=e[t]<<8|e[t+1])<0?65536+e:e}function Ce(e,t){return(e=Ae(e,t))<0?4294967296+e:e}function Le(e,t){var i=Ce(e,t);return(i*=Math.pow(2,32))+Ce(e,t+4)}function Ae(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Re(e,t,i){e[t]=i>>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function Pe(e,t){var i=[];if(t.length)for(var r=e.byteLength,n=0;n<r;){var a,s=1<(s=Ce(e,n))?n+s:r;ke(e.subarray(n+4,n+8))===t[0]&&(1===t.length?i.push(e.subarray(n+8,s)):(a=Pe(e.subarray(n+8,s),t.slice(1))).length&&Se.apply(i,a)),n=s}return i}function De(e){for(var t=[],r=Pe(e,["moov","trak"]),n=0;n<r.length;n++){var a,s,o=r[n],l=Pe(o,["tkhd"])[0];l&&(l=Ce(l,0===l[0]?12:20),a=Pe(o,["mdia","mdhd"])[0])&&(a=Ce(a,0===a[0]?12:20),s=Pe(o,["mdia","hdlr"])[0])&&(s=ke(s.subarray(8,12)),s={soun:j,vide:G}[s])&&(o=function(e){var t=e.subarray(8),i=t.subarray(86),r=ke(t.subarray(4,8)),n=r;switch((e="enca"===r||"encv"===r)&&Pe(Pe(t,[r])[0].subarray("enca"===r?28:78),["sinf"]).forEach(function(e){var t=Pe(e,["schm"])[0];!t||"cbcs"!==(t=ke(t.subarray(4,8)))&&"cenc"!==t||(t=Pe(e,["frma"])[0])&&(n=ke(t))}),n){case"avc1":case"avc2":case"avc3":case"avc4":var a=Pe(i,["avcC"])[0];n+="."+xe(a[1])+xe(a[2])+xe(a[3]);break;case"mp4a":if((a=Pe((a=Pe(t,[r])[0]).subarray(28),["esds"])[0])&&7<a.length){var s=4;if(3!==a[s++])break;if(s=Ie(a,s),s+=2,128&(p=a[s++])&&(s+=2),64&p&&(s+=a[s++]),4!==a[s++])break;if(s=Ie(a,s),64!==(p=a[s++]))break;if(n+="."+xe(p),s+=12,5!==a[s++])break;s=Ie(a,s),31===(o=(248&(p=a[s++]))>>3)&&(o+=1+((7&p)<<3)+((224&a[s])>>5)),n+="."+o}break;case"hvc1":case"hev1":s=["","A","B","C"][(a=(p=Pe(i,["hvcC"])[0])[1])>>6];for(var o=31&a,l=Ce(p,2),u=(a=(32&a)>>5?"H":"L",p[12]),c=p.subarray(6,12),d=(n=(n=(n+="."+s+o)+"."+l.toString(16).toUpperCase())+"."+a+u,""),h=c.length;h--;){var f=c[h];(f||d)&&(d="."+(f=f.toString(16).toUpperCase())+d)}n+=d;break;case"dvh1":case"dvhe":s=(p=Pe(i,["dvcC"])[0])[2]>>1&127,o=p[2]<<5&32|p[3]>>3&31,n+="."+Oe(s)+"."+Oe(o);break;case"vp09":a=(l=Pe(i,["vpcC"])[0])[4],u=l[5],p=l[6]>>4&15,n+="."+Oe(a)+"."+Oe(u)+"."+Oe(p);break;case"av01":o=(s=Pe(i,["av1C"])[0])[1]>>>5,l=31&s[1],a=s[2]>>>7?"H":"M",u=(64&s[2])>>6;var p=(32&s[2])>>5,m=(p=2==o&&u?p?12:10:u?10:8,u=(16&s[2])>>4,(8&s[2])>>3),g=(4&s[2])>>2;s=3&s[2];n+="."+o+"."+Oe(l)+a+"."+Oe(p)+"."+u+"."+m+g+s+".01.01.01.0"}return{codec:n,encrypted:e}}(Pe(o,["mdia","minf","stbl","stsd"])[0]),t[l]={timescale:a,type:s},t[s]=i({timescale:a,id:l},o))}return Pe(e,["moov","mvex","trex"]).forEach(function(e){var i=Ce(e,4);(i=t[i])&&(i.default={duration:Ce(e,12),flags:Ce(e,20)})}),t}function Ie(e,t){for(var i=t+5;128&e[t++]&&t<i;);return t}function xe(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function Oe(e){return(e<10?"0":"")+e}function Me(e){var t=Pe(e,["schm"])[0];return!t||"cbcs"!==(t=ke(t.subarray(4,8)))&&"cenc"!==t?(B.error("[eme] missing 'schm' box"),null):Pe(e,["schi","tenc"])[0]}function Ue(e,t){var i=new Uint8Array(e.length+t.length);return i.set(e),i.set(t,e.length),i}function Be(e,t){var i=[],r=t.samples,n=t.timescale,a=t.id,s=!1;return Pe(r,["moof"]).map(function(o){var l=o.byteOffset-8;Pe(o,["traf"]).map(function(o){var u=Pe(o,["tfdt"]).map(function(e){var t=e[0],i=Ce(e,4);return(i=1===t?(i*=Math.pow(2,32))+Ce(e,8):i)/n})[0];return void 0!==u&&(e=u),Pe(o,["tfhd"]).map(function(u){var c=Ce(u,4),d=16777215&Ce(u,0),h=0,f=0,p=8;c===a&&(0!=(1&d)&&(p+=8),0!=(2&d)&&(p+=4),0!=(8&d)&&(h=Ce(u,p),p+=4),0!=(16&d)&&(f=Ce(u,p),p+=4),0!=(32&d)&&(p+=4),"video"===t.type&&(c=t.codec,s=!!c&&("hvc1"===(c=(u=c.indexOf("."))<0?c:c.substring(0,u))||"hev1"===c||"dvh1"===c||"dvhe"===c)),Pe(o,["trun"]).map(function(a){for(var o,u,c=a[0],d=16777215&Ce(a,0),p=0,m=0!=(256&d),g=0,v=0!=(512&d),y=0,_=0!=(1024&d),b=0!=(2048&d),T=0,S=Ce(a,4),E=8,k=(0!=(1&d)&&(p=Ce(a,E),E+=4),0!=(4&d)&&(E+=4),p+l),w=0;w<S;w++){if(m?(g=Ce(a,E),E+=4):g=h,v?(y=Ce(a,E),E+=4):y=f,_&&(E+=4),b&&(T=(0===c?Ce:Ae)(a,E),E+=4),t.type===G)for(var C=0;C<y;){var L=Ce(r,k);o=s,u=r[k+=4],(o?39==(o=u>>1&63)||40==o:6==(31&u))&&Ne(r.subarray(k,k+L),s?2:1,e+T/n,i),k+=L,C+=L+4}e+=g/n}}))})})}),i}function Ne(e,t,i,r){for(var n=Fe(e),a=0,s=(a+=t,0),o=0,l=0;a<n.length;){for(s=0;!(a>=n.length)&&(s+=l=n[a++],255===l););for(o=0;!(a>=n.length)&&(o+=l=n[a++],255===l););var u=n.length-a,c=a;if(o<u)a+=o;else if(u<o){B.error("Malformed SEI payload. "+o+" is too small, only "+u+" bytes left to parse.");break}if(4===s){if(181===n[c++]&&(u=we(n,c),c+=2,49===u&&(u=Ce(n,c),c+=4,1195456820===u&&3===(u=n[c++])))){var d=n[c++],h=64&d,f=h?2+3*(31&d):0,p=new Uint8Array(f);if(h){p[0]=d;for(var m=1;m<f;m++)p[m]=n[c++]}r.push({type:u,payloadType:s,pts:i,bytes:p})}}else if(5===s&&16<o){for(var g=[],v=0;v<16;v++){var y=n[c++].toString(16);g.push(1==y.length?"0"+y:y),3!==v&&5!==v&&7!==v&&9!==v||g.push("-")}for(var _=o-16,b=new Uint8Array(_),T=0;T<_;T++)b[T]=n[c++];r.push({payloadType:s,pts:i,uuid:g.join(""),userData:_e(b),userDataBytes:b})}}}function Fe(e){for(var t=e.byteLength,i=[],r=1;r<t-2;)0===e[r]&&0===e[r+1]&&3===e[r+2]?(i.push(r+2),r+=2):r++;if(0===i.length)return e;var n=t-i.length,a=new Uint8Array(n),s=0;for(r=0;r<n;s++,r++)s===i[0]&&(s++,i.shift()),a[r]=e[s];return a}var je={},Ge=function(){function e(e,t,i,r,n){void 0===r&&(r=[1]),void 0===n&&(n=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=n,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&!$(e)}e.clearKeyUriToKeyIdMap=function(){je={}};var t=e.prototype;return t.isSupported=function(){if(this.method){if($(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case Z.FAIRPLAY:case Z.WIDEVINE:case Z.PLAYREADY:case Z.CLEARKEY:return-1!==["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1},t.getDecryptData=function(t){if(!this.encrypted||!this.uri)return null;if($(this.method)&&this.uri&&!this.iv)return"number"!=typeof t&&(B.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),t=0),t=function(e){for(var t=new Uint8Array(16),i=12;i<16;i++)t[i]=e>>8*(15-i)&255;return t}(t),new e(this.method,this.uri,"identity",this.keyFormatVersions,t);var i,r=function(e){var t,i,r=null;return"data"===(e=e.split(":"))[0]&&2===e.length&&2===(t=(e=e[1].split(";"))[e.length-1].split(",")).length&&(i="base64"===t[0],t=t[1],r=i?(e.splice(-1,1),W(t)):(i=z(i=t).subarray(0,16),(e=new Uint8Array(16)).set(i,16-i.length),e)),r}(this.uri);if(r)switch(this.keyFormat){case Z.WIDEVINE:22<=(this.pssh=r).length&&(this.keyId=r.subarray(r.length-22,r.length-6));break;case Z.PLAYREADY:var n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);n=(this.pssh=function(e,t,i){if(16!==e.byteLength)throw new RangeError("Invalid system id");var r;if(t)for(var n=1,a=new Uint8Array(16*t.length),s=0;s<t.length;s++){var o=t[s];if(16!==o.byteLength)throw new RangeError("Invalid key");a.set(o,16*s)}else n=0,a=new Uint8Array;0<n?(r=new Uint8Array(4),0<t.length&&new DataView(r.buffer).setUint32(0,t.length,!1)):r=new Uint8Array;var l=new Uint8Array(4);return i&&0<i.byteLength&&new DataView(l.buffer).setUint32(0,i.byteLength,!1),function(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var n=i.length,a=8,s=n;s--;)a+=i[s].byteLength;var o=new Uint8Array(a);for(o[0]=a>>24&255,o[1]=a>>16&255,o[2]=a>>8&255,o[3]=255&a,o.set(e,4),s=0,a=8;s<n;s++)o.set(i[s],a),a+=i[s].byteLength;return o}([112,115,115,104],new Uint8Array([n,0,0,0]),e,r,a,l,i||new Uint8Array)}(n,null,r),new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2)),n=(n=String.fromCharCode.apply(null,Array.from(n))).substring(n.indexOf("<"),n.length);(n=(new DOMParser).parseFromString(n,"text/xml").getElementsByTagName("KID")[0])&&(n=n.childNodes[0]?n.childNodes[0].nodeValue:n.getAttribute("VALUE"))&&(function(e){function t(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}(n=W(n).subarray(0,16)),this.keyId=n);break;default:var a;16!==(n=r.subarray(0,16)).length&&((a=new Uint8Array(16)).set(n,16-n.length),n=a),this.keyId=n}return this.keyId&&16===this.keyId.byteLength||((t=je[this.uri])||(i=Object.keys(je).length%Number.MAX_SAFE_INTEGER,t=new Uint8Array(16),new DataView(t.buffer,12,4).setUint32(0,i),je[this.uri]=t),this.keyId=t),this},e}(),Ve=/\{\$([a-zA-Z0-9-_]+)\}/g;function He(e){return Ve.test(e)}function Ke(e,t,i){if(null!==e.variableList||e.hasVariableRefs)for(var r=i.length;r--;){var n=i[r],a=t[n];a&&(t[n]=qe(e,a))}}function qe(e,t){var i;return null!==e.variableList||e.hasVariableRefs?(i=e.variableList,t.replace(Ve,function(t){var r=t.substring(2,t.length-1),n=null==i?void 0:i[r];return void 0===n?(e.playlistParsingError||(e.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+r+'"')),t):n})):t}function We(e,t,i){var r,n,a=e.variableList;if(a||(e.variableList=a={}),"QUERYPARAM"in t){r=t.QUERYPARAM;try{var s=new self.URL(i).searchParams;if(!s.has(r))throw new Error('"'+r+'" does not match any query parameter in URI: "'+i+'"');n=s.get(r)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+t.message))}}else r=t.NAME,n=t.VALUE;r in a?e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+r+'"')):a[r]=n||""}function ze(e){if(void 0===e&&(e=!0),"undefined"!=typeof self)return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}var Ye={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Xe(e,t,i){return void 0===i&&(i=!0),!e.split(",").some(function(e){return!$e(e,t,i)})}function $e(e,t,i){return null!=(i=null==(i=ze(i=void 0===i||i))?void 0:i.isTypeSupported(Qe(e,t)))&&i}function Qe(e,t){return t+'/mp4;codecs="'+e+'"'}function Je(e){return e?(e=e.substring(0,4),Ye.video[e]):2}function Ze(e){return e.split(",").reduce(function(e,t){var i=Ye.video[t];return i?(2*i+e)/(e?3:2):(Ye.audio[t]+e)/(e?2:1)},0)}var et={},tt=/flac|opus|mp4a\.40\.34/i;function it(e,t){return void 0===t&&(t=!0),e.replace(tt,function(e){var i=e.toLowerCase(),r=t;if(void 0===r&&(r=!0),et[i])return et[i];for(var n,a={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[i],s=0;s<a.length;s++){if($e(a[s],"audio",r))return et[i]=a[s],a[s];if("mp3"===a[s]&&null!=(n=ze(r))&&n.isTypeSupported("audio/mpeg"))return""}return i})}function rt(e,t){return e&&"mp4a"!==e?e:t}var nt=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,at=/#EXT-X-MEDIA:(.*)/g,st=/^#EXT(?:INF|-X-TARGETDURATION):/m,ot=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),lt=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),ut=function(){function e(){}return e.findGroup=function(e,t){for(var i=0;i<e.length;i++){var r=e[i];if(r.id===t)return r}},e.resolve=function(e,t){return S.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.isMediaPlaylist=function(e){return st.test(e)},e.parseMasterPlaylist=function(t,i){var r,n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:He(t)},a=[];for(nt.lastIndex=0;null!=(r=nt.exec(t));)if(r[1]){var s=(Ke(n,l=new D(r[1]),["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]),qe(n,r[2])),o=(s={attrs:l,bitrate:l.decimalInteger("BANDWIDTH")||l.decimalInteger("AVERAGE-BANDWIDTH"),name:l.NAME,url:e.resolve(s,i)},l.decimalResolution("RESOLUTION"));o&&(s.width=o.width,s.height=o.height),function(e,t){var i=(e||"").split(/[ ,]+/).filter(function(e){return e});["video","audio","text"].forEach(function(e){var r=i.filter(function(t){return t=t,!!(i=Ye[i=e])&&!!i[t.slice(0,4)];var i});r.length&&(t[e+"Codec"]=r.join(","),i=i.filter(function(e){return-1===r.indexOf(e)}))}),t.unknownCodecs=i}(l.CODECS,s),null!=(o=s.unknownCodecs)&&o.length||a.push(s),n.levels.push(s)}else if(r[3]){var l=r[3],u=r[4];switch(l){case"SESSION-DATA":var c=new D(u),d=(Ke(n,c,["DATA-ID","LANGUAGE","VALUE","URI"]),c["DATA-ID"]);d&&(null===n.sessionData&&(n.sessionData={}),n.sessionData[d]=c);break;case"SESSION-KEY":(d=ct(u,i,n)).encrypted&&d.isSupported()?(null===n.sessionKeys&&(n.sessionKeys=[]),n.sessionKeys.push(d)):B.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+u+'"');break;case"DEFINE":Ke(n,c=new D(u),["NAME","VALUE","QUERYPARAM"]),We(n,c,i);break;case"CONTENT-STEERING":var h=new D(u);Ke(n,h,["SERVER-URI","PATHWAY-ID"]),n.contentSteering={uri:e.resolve(h["SERVER-URI"],i),pathwayId:h["PATHWAY-ID"]||"."};break;case"START":n.startTimeOffset=dt(u)}}var f=0<a.length&&a.length<n.levels.length;return n.levels=f?a:n.levels,0===n.levels.length&&(n.playlistParsingError=new Error("no levels found in manifest")),n},e.parseMasterPlaylistMedia=function(t,i,r){var n={},a=r.levels,s={AUDIO:a.map(function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}}),SUBTITLES:a.map(function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}}),"CLOSED-CAPTIONS":[]},o=0;for(at.lastIndex=0;null!==(m=at.exec(t));){var l,u,c,d,h,f,p,m=new D(m[1]),g=m.TYPE;g&&(l=s[g],u=n[g]||[],n[g]=u,Ke(r,m,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]),p=m.LANGUAGE,c=m["ASSOC-LANGUAGE"],d=m.CHANNELS,h=m.CHARACTERISTICS,f=m["INSTREAM-ID"],g={attrs:m,bitrate:0,id:o++,groupId:m["GROUP-ID"]||"",name:m.NAME||p||"",type:g,default:m.bool("DEFAULT"),autoselect:m.bool("AUTOSELECT"),forced:m.bool("FORCED"),lang:p,url:m.URI?e.resolve(m.URI,i):""},c&&(g.assocLang=c),d&&(g.channels=d),h&&(g.characteristics=h),f&&(g.instreamId=f),null!=l&&l.length&&(ht(g,p=e.findGroup(l,g.groupId)||l[0],"audioCodec"),ht(g,p,"textCodec")),u.push(g))}return n},e.parseLevelPlaylist=function(e,t,i,r,n,a){var s,o,l,c=new q(t),d=c.fragments,h=null,f=0,p=0,m=0,g=0,v=null,y=new H(r,t),_=-1,b=!1,T=null;for(ot.lastIndex=0,c.m3u8=e,c.hasVariableRefs=He(e);null!==(s=ot.exec(e));){b&&(b=!1,(y=new H(r,t)).start=m,y.sn=f,y.cc=g,y.level=i,h)&&(y.initSegment=h,y.rawProgramDateTime=h.rawProgramDateTime,h.rawProgramDateTime=null,T)&&(y.setByteRange(T),T=null);var S=s[1];if(S){y.duration=parseFloat(S);var k=(" "+s[2]).slice(1);y.title=k||null,y.tagList.push(k?["INF",S,k]:["INF",S])}else if(s[3])E(y.duration)&&(y.start=m,l&&mt(y,l,c),y.sn=f,y.level=i,y.cc=g,d.push(y),k=(" "+s[3]).slice(1),y.relurl=qe(c,k),ft(y,v),m+=(v=y).duration,f++,b=!(p=0));else if(s[4])S=(" "+s[4]).slice(1),v?y.setByteRange(S,v):y.setByteRange(S);else if(s[5])y.rawProgramDateTime=(" "+s[5]).slice(1),y.tagList.push(["PROGRAM-DATE-TIME",y.rawProgramDateTime]),-1===_&&(_=d.length);else if(s=s[0].match(lt)){for(o=1;o<s.length&&void 0===s[o];o++);var w=(" "+s[o]).slice(1),C=(" "+s[o+1]).slice(1),L=s[o+2]?(" "+s[o+2]).slice(1):"";switch(w){case"PLAYLIST-TYPE":c.type=C.toUpperCase();break;case"MEDIA-SEQUENCE":f=c.startSN=parseInt(C);break;case"SKIP":var A=new D(C),R=(Ke(c,A,["RECENTLY-REMOVED-DATERANGES"]),A.decimalInteger("SKIPPED-SEGMENTS"));if(E(R)){for(var P=c.skippedSegments=R;P--;)d.unshift(null);f+=R}(R=A.enumeratedString("RECENTLY-REMOVED-DATERANGES"))&&(c.recentlyRemovedDateranges=R.split("\t"));break;case"TARGETDURATION":c.targetduration=Math.max(parseInt(C),1);break;case"VERSION":c.version=parseInt(C);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":c.live=!1;break;case"#":(C||L)&&y.tagList.push(L?[C,L]:[C]);break;case"DISCONTINUITY":g++,y.tagList.push(["DIS"]);break;case"GAP":y.gap=!0,y.tagList.push([w]);break;case"BITRATE":y.tagList.push([w,C]);break;case"DATERANGE":Ke(c,A=new D(C),["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Ke(c,A,A.clientAttrs),(R=new F(A,c.dateRanges[A.ID])).isValid||c.skippedSegments?c.dateRanges[R.id]=R:B.warn('Ignoring invalid DATERANGE tag: "'+C+'"'),y.tagList.push(["EXT-X-DATERANGE",C]);break;case"DEFINE":var I=new D(C);Ke(c,I,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in I?(O=c,U=a,x=void 0,M=(M=I).IMPORT,U&&M in U?((x=O.variableList)||(O.variableList=x={}),x[M]=U[M]):O.playlistParsingError||(O.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+M+'"'))):We(c,I,t);break;case"DISCONTINUITY-SEQUENCE":g=parseInt(C);break;case"KEY":var x=ct(C,t,c);if(x.isSupported()){if("NONE"===x.method){l=void 0;break}(l=(l=l||{})[x.keyFormat]?u({},l):l)[x.keyFormat]=x}else B.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+C+'"');break;case"START":c.startTimeOffset=dt(C);break;case"MAP":var O,M,U=new D(C);Ke(c,U,["BYTERANGE","URI"]),y.duration?(pt(O=new H(r,t),U,i,l),(y.initSegment=h=O).rawProgramDateTime&&!y.rawProgramDateTime&&(y.rawProgramDateTime=h.rawProgramDateTime)):(T=(M=y.byteRangeEndOffset)?M-(I=y.byteRangeStartOffset)+"@"+I:null,pt(y,U,i,l),h=y,b=!0);break;case"SERVER-CONTROL":var N=new D(C);c.canBlockReload=N.bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=N.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=0<c.canSkipUntil&&N.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=N.optionalFloat("PART-HOLD-BACK",0),c.holdBack=N.optionalFloat("HOLD-BACK",0);break;case"PART-INF":N=new D(C),c.partTarget=N.decimalFloatingPoint("PART-TARGET");break;case"PART":var j=(j=c.partList)||(c.partList=[]),G=0<p?j[j.length-1]:void 0,V=p++,W=(Ke(c,W=new D(C),["BYTERANGE","URI"]),new K(W,y,t,V,G));j.push(W),y.duration+=W.duration;break;case"PRELOAD-HINT":Ke(c,V=new D(C),["URI"]),c.preloadHint=V;break;case"RENDITION-REPORT":Ke(c,G=new D(C),["URI"]),c.renditionReports=c.renditionReports||[],c.renditionReports.push(G);break;default:B.warn("line parsed but not handled: "+s)}}else B.warn("No matches on slow regex match for level playlist!")}v&&!v.relurl?(d.pop(),m-=v.duration,c.partList&&(c.fragmentHint=v)):c.partList&&(ft(y,v),y.cc=g,c.fragmentHint=y,l)&&mt(y,l,c);var z=d.length,Y=d[0],X=d[z-1];return 0<(m+=c.skippedSegments*c.targetduration)&&z&&X?(c.averagetargetduration=m/z,z=X.sn,c.endSN="initSegment"!==z?z:0,c.live||(X.endList=!0),Y&&(c.startCC=Y.cc)):(c.endSN=0,c.startCC=0),c.fragmentHint&&(m+=c.fragmentHint.duration),c.totalduration=m,c.endCC=g,0<_&&function(e,t){for(var i=e[t],r=t;r--;){var n=e[r];if(!n)return;n.programDateTime=i.programDateTime-1e3*n.duration,i=n}}(d,_),c},e}();function ct(e,t,i){Ke(i,e=new D(e),["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]),i=null!=(i=e.METHOD)?i:"";var r=e.URI,n=e.hexadecimalInteger("IV"),a=e.KEYFORMATVERSIONS,s=null!=(s=e.KEYFORMAT)?s:"identity";r&&e.IV&&!n&&B.error("Invalid IV: "+e.IV),e=r?ut.resolve(r,t):"",r=(a||"1").split("/").map(Number).filter(Number.isFinite);return new Ge(i,e,s,r,n)}function dt(e){return e=new D(e).decimalFloatingPoint("TIME-OFFSET"),E(e)?e:null}function ht(e,t,i){(t=t[i])&&(e[i]=t)}function ft(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),E(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function pt(e,t,i,r){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",r&&(e.levelkeys=r),e.initSegment=null}function mt(e,t,i){e.levelkeys=t,(i=i.encryptedFragments).length&&i[i.length-1].levelkeys===t||!Object.keys(t).some(function(e){return t[e].isCommonEncryption})||i.push(e)}var gt="manifest",vt="level",yt="audioTrack",_t="subtitleTrack",bt="main",Tt="audio",St="subtitle";function Et(e){switch(e.type){case yt:return Tt;case _t:return St;default:return bt}}function kt(e,t){return void 0!==(e=e.url)&&0!==e.indexOf("data:")?e:t.url}var wt=function(){function e(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}var t=e.prototype;return t.startLoad=function(e){},t.stopLoad=function(){this.destroyInternalLoaders()},t.registerListeners=function(){var e=this.hls;e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(C.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.unregisterListeners=function(){var e=this.hls;e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.LEVEL_LOADING,this.onLevelLoading,this),e.off(C.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(C.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,r=t.loader;i=new(i||r)(t);return this.loaders[e.type]=i},t.getInternalLoader=function(e){return this.loaders[e.type]},t.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},t.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},t.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},t.onManifestLoading=function(e,t){t=t.url,this.variableList=null,this.load({id:null,level:0,responseType:"text",type:gt,url:t,deliveryDirectives:null})},t.onLevelLoading=function(e,t){var i=t.id,r=t.level,n=t.pathwayId,a=t.url;t=t.deliveryDirectives;this.load({id:i,level:r,pathwayId:n,responseType:"text",type:vt,url:a,deliveryDirectives:t})},t.onAudioTrackLoading=function(e,t){var i=t.id,r=t.groupId,n=t.url;t=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:yt,url:n,deliveryDirectives:t})},t.onSubtitleTrackLoading=function(e,t){var i=t.id,r=t.groupId,n=t.url;t=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:_t,url:n,deliveryDirectives:t})},t.load=function(e){var t=this,i=this.hls.config,r=this.getInternalLoader(e);if(r){var n=r.context;if(n&&n.url===e.url&&n.level===e.level)return void this.hls.logger.trace("[playlist-loader]: playlist request ongoing");this.hls.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),r.abort()}n=e.type===gt?i.manifestLoadPolicy.default:u({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),E(null==(i=e.deliveryDirectives)?void 0:i.part)&&(e.type===vt&&null!==e.level?a=this.hls.levels[e.level].details:e.type===yt&&null!==e.id?a=this.hls.audioTracks[e.id].details:e.type===_t&&null!==e.id&&(a=this.hls.subtitleTracks[e.id].details),a)&&(i=a.partTarget,a=a.targetduration,i)&&a&&(i=1e3*Math.max(3*i,.8*a),n=u({},n,{maxTimeToFirstByteMs:Math.min(i,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(i,n.maxTimeToFirstByteMs)}));var a=n.errorRetry||n.timeoutRetry||{};i={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0};r.load(e,i,{onSuccess:function(e,i,r,n){var a=t.getInternalLoader(r),s=(t.resetInternalLoader(r.type),e.data);0!==s.indexOf("#EXTM3U")?t.handleManifestParsingError(e,r,new Error("no EXTM3U delimiter"),n||null,i):(i.parsing.start=performance.now(),ut.isMediaPlaylist(s)?t.handleTrackOrLevelPlaylist(e,i,r,n||null,a):t.handleMasterPlaylist(e,i,r,n))},onError:function(e,i,r,n){t.handleNetworkError(i,r,!1,e,n)},onTimeout:function(e,i,r){t.handleNetworkError(i,r,!0,void 0,e)}})},t.handleMasterPlaylist=function(e,t,i,r){var n,a,s,o,l,u=this.hls,c=e.data,d=kt(e,i),h=ut.parseMasterPlaylist(c,d);h.playlistParsingError?this.handleManifestParsingError(e,i,h.playlistParsingError,r,t):(e=h.contentSteering,i=h.levels,n=h.sessionData,a=h.sessionKeys,s=h.startTimeOffset,o=h.variableList,this.variableList=o,h=(c=ut.parseMasterPlaylistMedia(c,d,h)).AUDIO,l=c.SUBTITLES,c=c["CLOSED-CAPTIONS"],(h=void 0===h?[]:h).length&&!h.some(function(e){return!e.url})&&i[0].audioCodec&&!i[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),h.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new D({}),bitrate:0,url:""})),u.trigger(C.MANIFEST_LOADED,{levels:i,audioTracks:h,subtitles:l,captions:c,contentSteering:e,url:d,stats:t,networkDetails:r,sessionData:n,sessionKeys:a,startTimeOffset:s,variableList:o}))},t.handleTrackOrLevelPlaylist=function(e,t,i,r,n){var a=this.hls,s=i.id,o=i.level,l=i.type,u=kt(e,i);o=E(o)?o:E(s)?s:0,s=Et(i),o=ut.parseLevelPlaylist(e.data,u,o,s,0,this.variableList);l===gt&&(s={attrs:new D({}),bitrate:0,details:o,name:"",url:u},a.trigger(C.MANIFEST_LOADED,{levels:[s],audioTracks:[],url:u,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})),t.parsing.end=performance.now(),i.levelDetails=o,this.handlePlaylistLoaded(o,e,t,i,r,n)},t.handleManifestParsingError=function(e,t,i,r,n){this.hls.trigger(C.ERROR,{type:L.NETWORK_ERROR,details:A.MANIFEST_PARSING_ERROR,fatal:t.type===gt,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})},t.handleNetworkError=function(e,t,r,n,a){var s="A network "+((r=void 0!==r&&r)?"timeout":"error"+(n?" (status "+n.code+")":""))+" occurred while loading "+e.type,o=(e.type===vt?s+=": "+e.level+" id: "+e.id:e.type!==yt&&e.type!==_t||(s+=" id: "+e.id+' group-id: "'+e.groupId+'"'),new Error(s)),l=(this.hls.logger.warn("[playlist-loader]: "+s),A.UNKNOWN),u=!1;s=this.getInternalLoader(e);switch(e.type){case gt:l=r?A.MANIFEST_LOAD_TIMEOUT:A.MANIFEST_LOAD_ERROR,u=!0;break;case vt:l=r?A.LEVEL_LOAD_TIMEOUT:A.LEVEL_LOAD_ERROR,u=!1;break;case yt:l=r?A.AUDIO_TRACK_LOAD_TIMEOUT:A.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case _t:l=r?A.SUBTITLE_TRACK_LOAD_TIMEOUT:A.SUBTITLE_LOAD_ERROR,u=!1}s&&this.resetInternalLoader(e.type),s={type:L.NETWORK_ERROR,details:l,fatal:u,url:e.url,loader:s,context:e,error:o,networkDetails:t,stats:a},n&&(o=(null==t?void 0:t.url)||e.url,s.response=i({url:o,data:void 0},n)),this.hls.trigger(C.ERROR,s)},t.handlePlaylistLoaded=function(e,t,i,r,n,a){var s=this.hls,o=r.type,l=r.level,u=r.id,c=r.groupId,d=r.deliveryDirectives,h=kt(t,r),f=Et(r),p="number"==typeof r.level&&f===bt?l:void 0;if(e.fragments.length)if(e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration")),l=e.playlistParsingError)s.trigger(C.ERROR,{type:L.NETWORK_ERROR,details:A.LEVEL_PARSING_ERROR,fatal:!1,url:h,error:l,reason:l.message,response:t,context:r,level:p,parent:f,networkDetails:n,stats:i});else switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),a.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),o){case gt:case vt:s.trigger(C.LEVEL_LOADED,{details:e,level:p||0,id:u||0,stats:i,networkDetails:n,deliveryDirectives:d});break;case yt:s.trigger(C.AUDIO_TRACK_LOADED,{details:e,id:u||0,groupId:c||"",stats:i,networkDetails:n,deliveryDirectives:d});break;case _t:s.trigger(C.SUBTITLE_TRACK_LOADED,{details:e,id:u||0,groupId:c||"",stats:i,networkDetails:n,deliveryDirectives:d})}else l=new Error("No Segments found in Playlist"),s.trigger(C.ERROR,{type:L.NETWORK_ERROR,details:A.LEVEL_EMPTY_ERROR,fatal:!1,url:h,error:l,reason:l.message,response:t,context:r,level:p,parent:f,networkDetails:n,stats:i})},e}();function Ct(e,t){var i;try{i=new Event("addtrack")}catch(e){(i=document.createEvent("Event")).initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function Lt(e,t){var i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(i){B.debug("[texttrack-utils]: "+i);try{var r=new self.TextTrackCue(t.startTime,t.endTime,t.text);r.id=t.id,e.addCue(r)}catch(i){B.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: "+i)}}"disabled"===i&&(e.mode=i)}function At(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var i=e.cues.length;i--;)e.removeCue(e.cues[i]);"disabled"===t&&(e.mode=t)}function Rt(e,t,i,r){var n=e.mode;if("disabled"===n&&(e.mode="hidden"),e.cues&&0<e.cues.length)for(var a=function(e,t,i){var r=[],n=function(e,t){if(t<e[0].startTime)return 0;var i=e.length-1;if(t>e[i].endTime)return-1;for(var r=0,n=i;r<=n;){var a=Math.floor((n+r)/2);if(t<e[a].startTime)n=a-1;else{if(!(t>e[a].startTime&&r<i))return a;r=a+1}}return e[r].startTime-t<t-e[n].startTime?r:n}(e,t);if(-1<n)for(var a=n,s=e.length;a<s;a++){var o=e[a];if(o.startTime>=t&&o.endTime<=i)r.push(o);else if(o.startTime>i)return r}return r}(e.cues,t,i),s=0;s<a.length;s++)r&&!r(a[s])||e.removeCue(a[s]);"disabled"===n&&(e.mode=n)}function Pt(e){for(var t=[],i=0;i<e.length;i++){var r=e[i];"subtitles"!==r.kind&&"captions"!==r.kind||!r.label||t.push(e[i])}return t}var Dt="org.id3",It="https://aomedia.org/emsg/ID3";function xt(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function Ot(e,t,r,n,a){var s=new e(t,r,"");try{s.value=n,a&&(s.type=a)}catch(o){s=new e(t,r,JSON.stringify(a?i({type:a},n):n))}return s}var Mt=function(){var e=xt();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function Ut(e,t){return e.getTime()/1e3-t}var Bt=function(){function e(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}var t=e.prototype;return t.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},t._registerListeners=function(){var e=this.hls;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(C.LEVEL_UPDATED,this.onLevelUpdated,this)},t._unregisterListeners=function(){var e=this.hls;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(C.LEVEL_UPDATED,this.onLevelUpdated,this)},t.onMediaAttached=function(e,t){this.media=t.media},t.onMediaDetaching=function(){this.id3Track&&(At(this.id3Track),this.id3Track=null),this.media=null,this.dateRangeCuesAppended={}},t.onManifestLoading=function(){this.dateRangeCuesAppended={}},t.createTrack=function(e){return(e=this.getID3Track(e.textTracks)).mode="hidden",e},t.getID3Track=function(e){if(this.media){for(var t=0;t<e.length;t++){var i=e[t];if("metadata"===i.kind&&"id3"===i.label)return Ct(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},t.onFragParsingMetadata=function(e,t){if(this.media){var i=this.hls.config,r=i.enableEmsgMetadataCues,n=i.enableID3MetadataCues;if(r||n){var a=t.samples,s=(this.id3Track||(this.id3Track=this.createTrack(this.media)),xt());if(s)for(var o=0;o<a.length;o++){var l=a[o].type;if((l!==It||r)&&n){var u=de(a[o].data);if(u){var c=a[o].pts,d=c+a[o].duration;(d=Mt<d?Mt:d)-c<=0&&(d=c+.25);for(var h=0;h<u.length;h++){var f=u[h];!ce(f)&&(this.updateId3CueEnds(c,l),f=Ot(s,c,d,f,l))&&this.id3Track.addCue(f)}}}}}}},t.updateId3CueEnds=function(e,t){var i,r=null==(i=this.id3Track)?void 0:i.cues;if(r)for(var n=r.length;n--;){var a=r[n];a.type===t&&a.startTime<e&&a.endTime===Mt&&(a.endTime=e)}},t.onBufferFlushing=function(e,t){var i,r,n=t.startOffset,a=t.endOffset,s=(t=t.type,this.id3Track),o=this.hls;o&&(o=o.config,i=o.enableEmsgMetadataCues,r=o.enableID3MetadataCues,s)&&(i||r)&&Rt(s,n,a,"audio"===t?function(e){return e.type===Dt&&r}:"video"===t?function(e){return e.type===It&&i}:function(e){return e.type===Dt&&r||e.type===It&&i})},t.onLevelUpdated=function(e,t){var i=this;t=t.details;if(this.media&&t.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var r=this.dateRangeCuesAppended,n=this.id3Track,a=t.dateRanges,s=Object.keys(a);if(n)for(var o=Object.keys(r).filter(function(e){return!s.includes(e)}),l=o.length;l--;)!function(){var e=o[l];Object.keys(r[e].cues).forEach(function(t){n.removeCue(r[e].cues[t])}),delete r[e]}();if(t=t.fragments[t.fragments.length-1],0!==s.length&&E(null==t?void 0:t.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var u=t.programDateTime/1e3-t.start,c=xt(),d=function(){for(var e=s[h],t=a[e],n=Ut(t.startDate,u),o=r[e],l=(null==o?void 0:o.cues)||{},d=(null==o?void 0:o.durationKnown)||!1,f=Mt,p=t.endDate,m=(p?(f=Ut(p,u),d=!0):t.endOnNext&&!d&&(p=s.reduce(function(e,i){return i!==t.id&&(i=a[i]).class===t.class&&i.startDate>t.startDate&&(!e||t.startDate<e.startDate)?i:e},null))&&(f=Ut(p.startDate,u),d=!0),Object.keys(t.attr)),g=0;g<m.length;g++){var v,y,_=m[g];"ID"!==(v=_)&&"CLASS"!==v&&"START-DATE"!==v&&"DURATION"!==v&&"END-DATE"!==v&&"END-ON-NEXT"!==v&&((v=l[_])?d&&!o.durationKnown&&(v.endTime=f):c&&(v=t.attr[_],"SCTE35-OUT"!==(y=_)&&"SCTE35-IN"!==y||(y=v,v=Uint8Array.from(y.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),y=Ot(c,n,f,{key:_,data:v},"com.apple.quicktime.HLS"))&&(y.id=e,i.id3Track.addCue(y),l[_]=y))}r[e]={cues:l,dateRange:t,durationKnown:d}},h=0;h<s.length;h++)d()}}},e}(),Nt=function(){function e(e){var t=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.onTimeupdate=function(){var e,i,r,n=t.media,a=t.levelDetails;n&&a&&(t.currentTime=n.currentTime,null!==(i=t.computeLatency()))&&(t._latency=i,r=(e=t.config).lowLatencyMode,e=e.maxLiveSyncPlaybackRate,r)&&1!==e&&a.live&&null!==(r=t.targetLatency)&&((i-=r)<Math.min(t.maxLatency,r+a.targetduration)&&.05<i&&1<t.forwardBufferLength?(r=Math.min(2,Math.max(1,e)),a=Math.round(2/(1+Math.exp(-.75*i-t.edgeStalled))*20)/20,n.playbackRate=Math.min(r,Math.max(1,a))):1!==n.playbackRate&&0!==n.playbackRate&&(n.playbackRate=1))},this.hls=e,this.config=e.config,this.registerListeners()}var t=e.prototype;return t.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=null},t.registerListeners=function(){this.hls.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(C.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(C.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(C.ERROR,this.onError,this)},t.unregisterListeners=function(){this.hls.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(C.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(C.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(C.ERROR,this.onError,this)},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)},t.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)},t.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},t.onLevelUpdated=function(e,t){t=t.details,(this.levelDetails=t).advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)},t.onError=function(e,t){t.details===A.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(t=this.levelDetails))&&t.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency")},t.estimateLiveEdge=function(){var e=this.levelDetails;return null===e?null:e.edge+e.age},t.computeLatency=function(){var e=this.estimateLiveEdge();return null===e?null:e-this.currentTime},l(e,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e,t,i,r,n,a=this.levelDetails;return null===a?null:(e=a.holdBack,r=a.partHoldBack,a=a.targetduration,t=(n=this.config).liveSyncDuration,i=n.liveSyncDurationCount,n=n.lowLatencyMode&&r||e,(n=(r=this.hls.userConfig).liveSyncDuration||r.liveSyncDurationCount||0===n?void 0!==t?t:i*a:n)+Math.min(+this.stallCount,a))}},{key:"liveSyncPosition",get:function(){var e,t=this.estimateLiveEdge(),i=this.targetLatency,r=this.levelDetails;return null===t||null===i||null===r?null:(e=r.edge,t=t-i-this.edgeStalled,i=e-r.totalduration,e-=this.config.lowLatencyMode&&r.partTarget||r.targetduration,Math.min(Math.max(i,t),e))}},{key:"drift",get:function(){var e=this.levelDetails;return null===e?1:e.drift}},{key:"edgeStalled",get:function(){var e,t=this.levelDetails;return null===t?0:(e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration),Math.max(t.age-e,0))}},{key:"forwardBufferLength",get:function(){var e,t=this.media,i=this.levelDetails;return t&&i?((e=t.buffered.length)?t.buffered.end(e-1):i.edge)-this.currentTime:0}}])}(),Ft=["NONE","TYPE-0","TYPE-1",null],jt=["SDR","PQ","HLG"],Gt=function(){function e(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}return e.prototype.addDirectives=function(e){return e=new self.URL(e),void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.href},e}(),Vt=function(){function e(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(function(e){return!!e}).map(function(e){return e.substring(0,4)}).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}var t=e.prototype;return t.hasAudioGroup=function(e){return Ht(this._audioGroups,e)},t.hasSubtitleGroup=function(e){return Ht(this._subtitleGroups,e)},t.addGroupId=function(e,t){var i;t&&("audio"===e?-1===(i=(i=this._audioGroups)||(this._audioGroups=[])).indexOf(t)&&i.push(t):"text"===e&&-1===(i=(i=this._subtitleGroups)||(this._subtitleGroups=[])).indexOf(t)&&i.push(t))},t.addFallback=function(){},l(e,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"averageBitrate",get:function(){return this._avgBitrate||this.realBitrate||this.bitrate}},{key:"attrs",get:function(){return this._attrs[0]}},{key:"codecs",get:function(){return this.attrs.CODECS||""}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"videoRange",get:function(){return this.attrs["VIDEO-RANGE"]||"SDR"}},{key:"score",get:function(){return this.attrs.optionalFloat("SCORE",0)}},{key:"uri",get:function(){return this.url[0]||""}},{key:"audioGroups",get:function(){return this._audioGroups}},{key:"subtitleGroups",get:function(){return this._subtitleGroups}},{key:"urlId",get:function(){return 0},set:function(e){}},{key:"audioGroupIds",get:function(){return this.audioGroups?[this.audioGroupId]:void 0}},{key:"textGroupIds",get:function(){return this.subtitleGroups?[this.textGroupId]:void 0}},{key:"audioGroupId",get:function(){var e;return null==(e=this.audioGroups)?void 0:e[0]}},{key:"textGroupId",get:function(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}}])}();function Ht(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function Kt(e,t){var i,r=t.startPTS;E(r)?(i=0,(r=t.sn>e.sn?(i=r-e.start,e):(i=e.start-r,t)).duration!==i&&(r.duration=i)):t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function qt(e,t,i,r,n,a){r-i<=0&&(B.warn("Fragment should have a positive duration",t),r=i+t.duration,a=n+t.duration);var s,o=i,l=r,u=t.startPTS,c=t.endPTS,d=(E(u)&&(d=Math.abs(u-i),E(t.deltaPTS)?t.deltaPTS=Math.max(d,t.deltaPTS):t.deltaPTS=d,o=Math.max(i,u),i=Math.min(i,u),n=Math.min(n,t.startDTS),l=Math.min(r,c),r=Math.max(r,c),a=Math.max(a,t.endDTS)),i-t.start);0!==t.start&&(t.start=i),t.duration=r-t.start,t.startPTS=i,t.maxStartPTS=o,t.startDTS=n,t.endPTS=r,t.minEndPTS=l,t.endDTS=a,u=t.sn;if(!e||u<e.startSN||u>e.endSN)return 0;c=u-e.startSN;var h=e.fragments;for(h[c]=t,s=c;0<s;s--)Kt(h[s],h[s-1]);for(s=c;s<h.length-1;s++)Kt(h[s],h[s+1]);return e.fragmentHint&&Kt(h[h.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,d}function Wt(e,t){var i=t.startSN+t.skippedSegments-e.startSN;e=e.fragments;i<0||i>=e.length||zt(t,e[i].start)}function zt(e,t){if(t){for(var i=e.fragments,r=e.skippedSegments;r<i.length;r++)i[r].start+=t;e.fragmentHint&&(e.fragmentHint.start+=t)}}function Yt(e,t,i){return null!=e&&e.details?Xt(null==(e=e.details)?void 0:e.partList,t,i):null}function Xt(e,t,i){if(e)for(var r=e.length;r--;){var n=e[r];if(n.index===i&&n.fragment.sn===t)return n}return null}function $t(e){e.forEach(function(e,t){null!=(e=e.details)&&e.fragments&&e.fragments.forEach(function(e){e.level=t})})}function Qt(e){switch(e.details){case A.FRAG_LOAD_TIMEOUT:case A.KEY_LOAD_TIMEOUT:case A.LEVEL_LOAD_TIMEOUT:case A.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Jt(e,t){return t=Qt(t),e.default[(t?"timeout":"error")+"Retry"]}function Zt(e,t){return t="linear"===e.backoff?1:Math.pow(2,t),Math.min(t*e.retryDelayMs,e.maxRetryDelayMs)}function ei(e){return i(i({},e),{errorRetry:null,timeoutRetry:null})}function ti(e,t,i,r){var n;return!!e&&(n=null==r?void 0:r.code,n=t<e.maxNumRetry&&(0===(n=n)&&!1===navigator.onLine||!!n&&(n<400||499<n)||!!i),e.shouldRetry?e.shouldRetry(e,t,i,r,n):n)}var ii={search:function(e,t){for(var i=0,r=e.length-1;i<=r;){var n,a,s=t(a=e[n=(i+r)/2|0]);if(0<s)i=1+n;else{if(!(s<0))return a;r=n-1}}return null}};function ri(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var n,a=null;return e?(a=t[e.sn-t[0].sn+1]||null,0<(n=e.endDTS-i)&&n<15e-7&&(i+=15e-7)):0===i&&0===t[0].start&&(a=t[0]),a&&(!e||e.level===a.level)&&0===ni(i,r,a)||!(n=ii.search(t,ni.bind(null,i,r)))||n===e&&a?a:n}function ni(e,t,i){return void 0===t&&(t=0),i.start<=(e=void 0===e?0:e)&&i.start+i.duration>e?0:(t=Math.min(t,i.duration+(i.deltaPTS||0)),i.start+i.duration-t<=e?1:i.start-t>e&&i.start?-1:0)}var ai=function(e){function t(t){var i=e.call(this,"error-controller",t.logger)||this;return i.hls=void 0,i.playlistError=0,i.penalizedRenditions={},i.hls=t,i.registerListeners(),i}c(t,e);var i=t.prototype;return i.registerListeners=function(){var e=this.hls;e.on(C.ERROR,this.onError,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.LEVEL_UPDATED,this.onLevelUpdated,this)},i.unregisterListeners=function(){var e=this.hls;e&&(e.off(C.ERROR,this.onError,this),e.off(C.ERROR,this.onErrorOut,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.LEVEL_UPDATED,this.onLevelUpdated,this))},i.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},i.startLoad=function(e){},i.stopLoad=function(){this.playlistError=0},i.getVariantLevelIndex=function(e){return(null==e?void 0:e.type)===bt?e.level:this.hls.loadLevel},i.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},i.onLevelUpdated=function(){this.playlistError=0},i.onError=function(e,t){if(!t.fatal){var i=this.hls,r=t.context;switch(t.details){case A.FRAG_LOAD_ERROR:case A.FRAG_LOAD_TIMEOUT:case A.KEY_LOAD_ERROR:case A.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case A.FRAG_PARSING_ERROR:if(null!=(n=t.frag)&&n.gap)return void(t.errorAction={action:0,flags:0});case A.FRAG_GAP:case A.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=2);case A.LEVEL_EMPTY_ERROR:case A.LEVEL_PARSING_ERROR:var n=t.parent===bt?t.level:i.loadLevel;return void(t.details===A.LEVEL_EMPTY_ERROR&&null!=(a=t.context)&&null!=(a=a.levelDetails)&&a.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,n)));case A.LEVEL_LOAD_ERROR:case A.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==r?void 0:r.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level)));case A.AUDIO_TRACK_LOAD_ERROR:case A.AUDIO_TRACK_LOAD_TIMEOUT:case A.SUBTITLE_LOAD_ERROR:case A.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r)if((a=i.levels[i.loadLevel])&&(r.type===yt&&a.hasAudioGroup(r.groupId)||r.type===_t&&a.hasSubtitleGroup(r.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=2,void(t.errorAction.flags=1);return;case A.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var a;return void((a=null==(n=i.levels[i.loadLevel])?void 0:n.attrs["HDCP-LEVEL"])?t.errorAction={action:2,flags:2,hdcpLevel:a}:this.keySystemError(t));case A.BUFFER_ADD_CODEC_ERROR:case A.REMUX_ALLOC_ERROR:case A.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(n=t.level)?n:i.loadLevel));case A.INTERNAL_EXCEPTION:case A.BUFFER_APPENDING_ERROR:case A.BUFFER_FULL_ERROR:case A.LEVEL_SWITCH_ERROR:case A.BUFFER_STALLED_ERROR:case A.BUFFER_SEEK_OVER_HOLE:case A.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:0,flags:0})}t.type===L.KEY_SYSTEM_ERROR&&this.keySystemError(t)}},i.keySystemError=function(e){var t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)},i.getPlaylistRetryOrSwitchAction=function(e,t){var i=Jt(this.hls.config.playlistLoadPolicy,e),r=this.playlistError++;return ti(i,r,Qt(e),e.response)?{action:5,flags:0,retryConfig:i,retryCount:r}:(e=this.getLevelSwitchAction(e,t),i&&(e.retryConfig=i,e.retryCount=r),e)},i.getFragRetryOrSwitchAction=function(e){var t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],n=(a=t.config).fragLoadPolicy,a=a.keyLoadPolicy;a=Jt(e.details.startsWith("key")?a:n,e),n=t.levels.reduce(function(e,t){return e+t.fragmentError},0);return r&&(e.details!==A.FRAG_GAP&&r.fragmentError++,ti(a,n,Qt(e),e.response))?{action:5,flags:0,retryConfig:a,retryCount:n}:(t=this.getLevelSwitchAction(e,i),a&&(t.retryConfig=a,t.retryCount=n),t)},i.getLevelSwitchAction=function(e,t){var i=this.hls,r=(null==t&&(t=i.loadLevel),this.hls.levels[t]);if(r){for(var n,a=e.details,s=(r.loadError++,a===A.BUFFER_APPEND_ERROR&&r.fragmentError++,-1),o=i.levels,l=i.loadLevel,u=i.minAutoLevel,c=i.maxAutoLevel,d=(i.autoLevelEnabled||(i.loadLevel=-1),null==(t=e.frag)?void 0:t.type),h=(d===Tt&&a===A.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(a===A.BUFFER_ADD_CODEC_ERROR||a===A.BUFFER_APPEND_ERROR))&&o.some(function(e){return e=e.audioCodec,r.audioCodec!==e}),f="video"===e.sourceBufferName&&(a===A.BUFFER_ADD_CODEC_ERROR||a===A.BUFFER_APPEND_ERROR)&&o.some(function(e){var t=e.codecSet;e=e.audioCodec;return r.codecSet!==t&&r.audioCodec===e}),p=(t=null!=(t=e.context)?t:{}).type,m=t.groupId,g=o.length;g--&&(0===(n=function(){var t=(g+l)%o.length;if(t!==l&&u<=t&&t<=c&&0===o[t].loadError){var i=o[t];if(a===A.FRAG_GAP&&e.frag){var n;if(n=o[t].details)if(null!=(n=ri(e.frag,n.fragments,e.frag.start))&&n.gap)return 0}else{if(p===yt&&i.hasAudioGroup(m)||p===_t&&i.hasSubtitleGroup(m))return 0;if(d===Tt&&null!=(n=r.audioGroups)&&n.some(function(e){return i.hasAudioGroup(e)})||d===St&&null!=(n=r.subtitleGroups)&&n.some(function(e){return i.hasSubtitleGroup(e)})||h&&r.audioCodec===i.audioCodec||!h&&r.audioCodec!==i.audioCodec||f&&r.codecSet===i.codecSet)return 0}return s=t,1}}())||1!==n););if(-1<s&&i.loadLevel!==s)return e.levelRetry=!0,this.playlistError=0,{action:2,flags:0,nextAutoLevel:s}}return{action:2,flags:1}},i.onErrorOut=function(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case 0:break;case 2:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===A.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn('MediaSource ended after "'+t.sourceBufferName+'" sourceBuffer append error. Attempting to recover from media error.'),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()},i.sendAlternateToPenaltyBox=function(e){var t=this.hls,i=e.errorAction;if(i){var r=i.flags,n=i.hdcpLevel,a=i.nextAutoLevel;switch(r){case 0:this.switchLevel(e,a);break;case 2:n&&(t.maxHdcpLevel=Ft[Ft.indexOf(n)-1],i.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')}i.resolved||this.switchLevel(e,a)}},i.switchLevel=function(e,t){void 0!==t&&e.errorAction&&(this.warn("switching to level "+t+" after "+e.details),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)},t}(m),si=function(e){function t(t,i){return(i=e.call(this,i,t.logger)||this).hls=void 0,i.timer=-1,i.requestScheduled=-1,i.canLoad=!1,i.hls=t,i}c(t,e);var i=t.prototype;return i.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},i.clearTimer=function(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)},i.startLoad=function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()},i.stopLoad=function(){this.canLoad=!1,this.clearTimer()},i.switchParams=function(e,t){var i=null==t?void 0:t.renditionReports;if(i){for(var r,n,a,s=-1,o=0;o<i.length;o++){var l=i[o],u=void 0;try{u=new self.URL(l.URI,t.url).href}catch(e){this.warn("Could not construct new URL for Rendition Report: "+e),u=l.URI||""}if(u===e){s=o;break}u===e.substring(0,u.length)&&(s=o)}if(-1!==s)return n=i[s],r=parseInt(n["LAST-MSN"])||(null==t?void 0:t.lastPartSn),n=parseInt(n["LAST-PART"])||(null==t?void 0:t.lastPartIndex),this.hls.config.lowLatencyMode&&(a=Math.min(t.age-t.partTarget,t.targetduration),0<=n)&&a>t.partTarget&&(n+=1),new Gt(r,0<=n?n:void 0,"")}},i.loadPlaylist=function(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())},i.shouldLoadPlaylist=function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)},i.shouldReloadPlaylist=function(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)},i.playlistLoaded=function(e,t,i){var r=this,n=t.details,a=t.stats,s=self.performance.now(),o=a.loading.first?Math.max(0,s-a.loading.first):0;if(n.advancedDateTime=Date.now()-o,n.live||null!=i&&i.live){if(n.reloaded(i),i&&this.log("live playlist "+e+" "+(n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED")),i&&0<n.fragments.length&&function(e,t){for(var i=null,r=e.fragments,n=r.length-1;0<=n;n--){var a=r[n].initSegment;if(a){i=a;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;for(var s,o=0,l=e,c=t,d=function(e,r){e.relurl&&(o=e.cc-r.cc),E(e.startPTS)&&E(e.endPTS)&&(r.start=r.startPTS=e.startPTS,r.startDTS=e.startDTS,r.maxStartPTS=e.maxStartPTS,r.endPTS=e.endPTS,r.endDTS=e.endDTS,r.minEndPTS=e.minEndPTS,r.duration=e.endPTS-e.startPTS,r.duration&&(s=r),t.PTSKnown=t.alignedSliding=!0),r.elementaryStreams=e.elementaryStreams,r.loader=e.loader,r.stats=e.stats,e.initSegment&&(r.initSegment=e.initSegment,i=e.initSegment)},h=c.skippedSegments,f=Math.max(l.startSN,c.startSN)-c.startSN,p=(l.fragmentHint?1:0)+(h?c.endSN:Math.min(l.endSN,c.endSN))-c.startSN,m=c.startSN-l.startSN,g=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments,v=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,y=f;y<=p;y++){var _=v[m+y],b=g[y];h&&!b&&y<h&&(b=c.fragments[y]=_),_&&b&&d(_,b)}if(i&&(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach(function(e){!e||e.initSegment&&e.initSegment.relurl!==(null==i?void 0:i.relurl)||(e.initSegment=i)}),t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some(function(e){return!e}),t.deltaUpdateFailed){B.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var T=t.skippedSegments;T--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){var r=u({},e);return i&&i.forEach(function(e){delete r[e]}),Object.keys(t).forEach(function(e){var i=new F(t[e].attr,r[e]);i.isValid?r[e]=i:B.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(t[e].attr)+'"')}),r}(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));var S=t.fragments;if(o){B.warn("discontinuity sliding from playlist, take drift into account");for(var k=0;k<S.length;k++)S[k].cc+=o}t.skippedSegments&&(t.startCC=t.fragments[0].cc);var w=e.partList,C=t.partList,L=function(e,t){t.elementaryStreams=e.elementaryStreams,t.stats=e.stats};if(w&&C)for(var A=0,R=0,P=w.length;R<=P;R++){var D=w[R],I=C[R+A];D&&I&&D.index===I.index&&D.fragment.sn===I.fragment.sn?L(D,I):A--}s?qt(t,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):Wt(e,t),S.length&&(t.totalduration=t.edge-S[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart,l=t.advancedDateTime,t.advanced&&l?(f=t.edge,t.driftStart||(t.driftStartTime=l,t.driftStart=f),t.driftEndTime=l,t.driftEnd=f):(t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime)}(i,n),this.canLoad&&n.live){o=void 0;var l,c=void 0;if(n.canBlockReload&&n.endSN&&n.advanced){var d,h,f=this.hls.config.lowLatencyMode,p=(d=n.lastPartSn)===(h=n.endSN),m=(d=(-1!==(m=n.lastPartIndex)?(o=p?h+1:d,c=p?f?0:m:m+1):o=h+1,n.age))+n.ageHeader;if(0<(h=Math.min(m-n.partTarget,1.5*n.targetduration))&&(m>3*n.targetduration?(this.log("Playlist last advanced "+d.toFixed(2)+"s ago. Omitting segment and part directives."),c=o=void 0):null!=i&&i.tuneInGoal&&m-n.partTarget>i.tuneInGoal?(this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+h+" with playlist age: "+n.age),h=0):(o+=m=Math.floor(h/n.targetduration),void 0!==c&&(c+=Math.round(h%n.targetduration/n.partTarget)),this.log("CDN Tune-in age: "+n.ageHeader+"s last advanced "+d.toFixed(2)+"s goal: "+h+" skip sn "+m+" to part "+c)),n.tuneInGoal=h),l=this.getDeliveryDirectives(n,t.deliveryDirectives,o,c),f||!p)return void this.loadPlaylist(l)}else(n.canBlockReload||n.canSkipUntil)&&(l=this.getDeliveryDirectives(n,t.deliveryDirectives,o,c));d=(i=this.hls.mainForwardBufferInfo)?i.end-i.len:0,void 0===(h=m=1e3*(n.edge-d))&&(h=1/0),p=1e3*(f=n).targetduration,f.updated?(f=f.fragments).length&&h<4*p&&(h=1e3*f[f.length-1].duration)<p&&(p=h):p/=2,t=Math.round(p),n.updated&&s>this.requestScheduled+t&&(this.requestScheduled=a.loading.start),void 0!==o&&n.canBlockReload?this.requestScheduled=a.loading.first+t-(1e3*n.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+t<s?this.requestScheduled=s:this.requestScheduled-s<=0&&(this.requestScheduled+=t),c=this.requestScheduled-s,c=Math.max(0,c),this.log("reload live playlist "+e+" in "+Math.round(c)+" ms"),this.timer=self.setTimeout(function(){return r.loadPlaylist(l)},c)}}else this.clearTimer()},i.getDeliveryDirectives=function(e,t,i,r){o=i,a=e.canSkipUntil,s=e.canSkipDateRanges,n=e.endSN;var n,a,s,o=a&&(void 0!==o?o-n:0)<a?s?"v2":"YES":"";return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,o=""),new Gt(i,r,o)},i.checkRetry=function(e){var t=this,i=e.details,r=Qt(e),n=e.errorAction,a=(o=n||{}).action,s=void 0===(s=o.retryCount)?0:s,o=o.retryConfig;if(a=!!n&&!!o&&(5===a||!n.resolved&&2===a)){if(this.requestScheduled=-1,s>=o.maxNumRetry)return!1;r&&null!=(r=e.context)&&r.deliveryDirectives?(this.warn("Retrying playlist loading "+(s+1)+"/"+o.maxNumRetry+' after "'+i+'" without delivery-directives'),this.loadPlaylist()):(r=Zt(o,s),this.timer=self.setTimeout(function(){return t.loadPlaylist()},r),this.warn("Retrying playlist loading "+(s+1)+"/"+o.maxNumRetry+' after "'+i+'" in '+r+"ms")),e.levelRetry=!0,n.resolved=!0}return a},t}(m),oi=function(){function e(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}var t=e.prototype;return t.sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},e}(),li=function(){function e(e,t,i,r){void 0===r&&(r=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new oi(e),this.fast_=new oi(t),this.defaultTTFB_=r,this.ttfb_=new oi(e)}var t=e.prototype;return t.update=function(e,t){var i=this.slow_,r=this.fast_,n=this.ttfb_;i.halfLife!==e&&(this.slow_=new oi(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new oi(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new oi(e,n.getEstimate(),n.getTotalWeight()))},t.sample=function(e,t){t=8*t/(e=(e=Math.max(e,this.minDelayMs_))/1e3),this.fast_.sample(e,t),this.slow_.sample(e,t)},t.sampleTTFB=function(e){var t=e/1e3;t=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(t,Math.max(e,5))},t.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},t.destroy=function(){},e}(),ui={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},ci={};function di(e,t,r){var n,a,s,o=e.videoCodec,l=e.audioCodec;return o&&l&&r?(n={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},"SDR"!==(a=e.videoRange)&&(n.transferFunction=a.toLowerCase()),s=o.split(",").map(function(e){return{type:"media-source",video:i(i({},n),{},{contentType:Qe(e,"video")})}}),l&&e.audioGroups&&e.audioGroups.forEach(function(e){var i;e&&null!=(i=t.groups[e])&&i.tracks.forEach(function(t){var i;t.groupId===e&&(t=t.channels||"",i=parseFloat(t),E(i))&&2<i&&s.push.apply(s,l.split(",").map(function(e){return{type:"media-source",audio:{contentType:Qe(e,"audio"),channels:""+i}}}))})}),Promise.all(s.map(function(e){var t=function(e){var t=e.audio,i=(e=e.video)||t;if(i){if(i=i.contentType.split('"')[1],e)return"r"+e.height+"x"+e.width+"f"+Math.ceil(e.framerate)+(e.transferFunction||"sd")+"_"+i+"_"+Math.ceil(e.bitrate/1e5);if(t)return"c"+t.channels+(t.spatialRendering?"s":"n")+"_"+i}return""}(e);return ci[t]||(ci[t]=r.decodingInfo(e))})).then(function(e){return{supported:!e.some(function(e){return!e.supported}),configurations:s,decodingInfoResults:e}}).catch(function(e){return{supported:!1,configurations:s,decodingInfoResults:[],error:e}})):Promise.resolve(ui)}function hi(e,t,i,r,n){for(var a=Object.keys(e),s=null==r?void 0:r.channels,o=null==r?void 0:r.audioCodec,l=s&&2===parseInt(s),u=!0,c=!1,d=1/0,h=1/0,f=1/0,p=0,m=[],g=(n=(r=function(e,t){var i=!1,r=[];return e&&(i="SDR"!==e,r=[e]),t&&(r=t.allowedVideoRanges||jt.slice(0),r=(i=void 0!==t.preferHDR?t.preferHDR:function(){if("function"==typeof matchMedia){var e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}())?r.filter(function(e){return"SDR"!==e}):["SDR"]),{preferHDR:i,allowedVideoRanges:r}}(t,n)).preferHDR,r.allowedVideoRanges),v=a.length;v--;)!function(){var t=e[a[v]],i=(u=0<t.channels[2],d=Math.min(d,t.minHeight),h=Math.min(h,t.minFramerate),f=Math.min(f,t.minBitrate),g.filter(function(e){return 0<t.videoRanges[e]}));0<i.length&&(c=!0,m=i)}();d=E(d)?d:0,h=E(h)?h:0;var y=Math.max(1080,d),_=Math.max(30,h);f=E(f)?f:i;return i=Math.max(f,i),c||(t=void 0,m=[]),{codecSet:a.reduce(function(t,r){var n=e[r];if(r===t)return t;if(n.minBitrate>i)return fi(r,"min bitrate of "+n.minBitrate+" > current estimate of "+i),t;if(!n.hasDefaultAudio)return fi(r,"no renditions with default or auto-select sound found"),t;if(o&&r.indexOf(o.substring(0,4))%5!=0)return fi(r,'audio codec preference "'+o+'" not found'),t;if(s&&!l){if(!n.channels[s])return fi(r,"no renditions with "+s+" channel sound found (channels options: "+Object.keys(n.channels)+")"),t}else if((!o||l)&&u&&0===n.channels[2])return fi(r,"no renditions with stereo sound found"),t;return n.minHeight>y?(fi(r,"min resolution of "+n.minHeight+" > maximum of "+y),t):n.minFramerate>_?(fi(r,"min framerate of "+n.minFramerate+" > maximum of "+_),t):m.some(function(e){return 0<n.videoRanges[e]})?n.maxScore<p?(fi(r,"max score of "+n.maxScore+" < selected max of "+p),t):t&&(Ze(r)>=Ze(t)||n.fragmentError>e[t].fragmentError)?t:(p=n.maxScore,r):(fi(r,"no variants with VIDEO-RANGE of "+JSON.stringify(m)+" found"),t)},void 0),videoRanges:m,preferHDR:n,minFramerate:h,minBitrate:f}}function fi(e,t){B.log('[abr] start candidates with "'+e+'" ignored because '+t)}function pi(e,t,i){if("attrs"in e){var r=t.indexOf(e);if(-1!==r)return r}for(var n=0;n<t.length;n++)if(mi(e,t[n],i))return n;return-1}function mi(e,t,i){var r,n=e.groupId,a=e.name,s=e.lang,o=e.assocLang,l=e.characteristics,u=e.default,c=e.forced;return(void 0===n||t.groupId===n)&&(void 0===a||t.name===a)&&(void 0===s||t.lang===s)&&(void 0===s||t.assocLang===o)&&(void 0===u||t.default===u)&&(void 0===c||t.forced===c)&&(void 0===l||(n=l,void 0===(a=t.characteristics)&&(a=""),n=n.split(","),r=a.split(","),n.length===r.length&&!n.some(function(e){return-1===r.indexOf(e)})))&&(void 0===i||i(e,t))}function gi(e,t){var i=e.audioCodec;e=e.channels;return!(void 0!==i&&(t.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==e&&e!==(t.channels||"2"))}function vi(e,t,i){for(var r=t;r;r--)if(i(e[r]))return r;for(var n=t+1;n<e.length;n++)if(i(e[n]))return n;return-1}var yi=function(e){function t(t){var i=e.call(this,"abr",t.logger)||this;return i.hls=void 0,i.lastLevelLoadSec=0,i.lastLoadedFragLevel=-1,i.firstSelection=-1,i._nextAutoLevel=-1,i.nextAutoLevelKey="",i.audioTracksByGroup=null,i.codecTiers=null,i.timer=-1,i.fragCurrent=null,i.partCurrent=null,i.bitrateTestDelay=0,i.bwEstimator=void 0,i._abandonRulesCheck=function(){var e,t=(e=i).fragCurrent,r=e.partCurrent,n=(e=e.hls).autoLevelEnabled,a=e.media;if(t&&a){var s=performance.now(),o=(r||t).stats,l=(r||t).duration,u=(s=s-o.loading.start,e.minAutoLevel);if(o.aborted||o.loaded&&o.loaded===o.total||t.level<=u)i.clearTimer(),i._nextAutoLevel=-1;else if(n&&!a.paused&&a.playbackRate&&a.readyState&&null!==(n=e.mainForwardBufferInfo)){var c=i.bwEstimator.getEstimateTTFB();a=Math.abs(a.playbackRate);if(!(s<=Math.max(c,l/(2*a)*1e3))){var d,h=n.len/a,f=(n=o.loading.first?o.loading.first-o.loading.start:-1,a=o.loaded&&-1<n,i.getBwEstimate()),p=e.levels,m=p[t.level];m=o.total||Math.max(o.loaded,Math.round(l*m.averageBitrate/8));if(!((m=(d=((d=a?s-n:s)<1&&a&&(d=Math.min(s,8*o.loaded/f)),a?1e3*o.loaded/d:0))?(m-o.loaded)/d:8*m/f+c/1e3)<=h)){for(var g=d?8*d:f,v=Number.POSITIVE_INFINITY,y=t.level-1;u<y;y--){var _=p[y].maxBitrate;if((v=i.getTimeToLoadFrag(c/1e3,g,l*_,!p[y].details))<h)break}m<=v||10*l<v||(e.nextLoadLevel=e.nextAutoLevel=y,a?i.bwEstimator.sample(s-Math.min(c,n),o.loaded):i.bwEstimator.sampleTTFB(s),d=p[y].maxBitrate,i.getBwEstimate()*i.hls.config.abrBandWidthUpFactor>d&&i.resetEstimator(d),i.clearTimer(),i.warn("Fragment "+t.sn+(r?" part "+r.index:"")+" of level "+t.level+" is loading too slowly;\n Time to underbuffer: "+h.toFixed(3)+" s\n Estimated load time for current fragment: "+m.toFixed(3)+" s\n Estimated load time for down switch fragment: "+v.toFixed(3)+" s\n TTFB estimate: "+(0|n)+" ms\n Current BW estimate: "+(E(f)?0|f:"Unknown")+" bps\n New BW estimate: "+(0|i.getBwEstimate())+" bps\n Switching to level "+y+" @ "+(0|d)+" bps"),e.trigger(C.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:r,stats:o}))}}}}},i.hls=t,i.bwEstimator=i.initEstimator(),i.registerListeners(),i}c(t,e);var i=t.prototype;return i.resetEstimator=function(e){e&&(this.log("setting initial bwe to "+e),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()},i.initEstimator=function(){var e=this.hls.config;return new li(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)},i.registerListeners=function(){var e=this.hls;e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.FRAG_LOADING,this.onFragLoading,this),e.on(C.FRAG_LOADED,this.onFragLoaded,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this),e.on(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(C.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(C.ERROR,this.onError,this)},i.unregisterListeners=function(){var e=this.hls;e&&(e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.FRAG_LOADING,this.onFragLoading,this),e.off(C.FRAG_LOADED,this.onFragLoaded,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this),e.off(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(C.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(C.ERROR,this.onError,this))},i.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null},i.onManifestLoading=function(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()},i.onLevelsUpdated=function(){-1<this.lastLoadedFragLevel&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null},i.onMaxAutoLevelUpdated=function(){this.firstSelection=-1,this.nextAutoLevelKey=""},i.onFragLoading=function(e,t){var i=t.frag;this.ignoreFragment(i)||(i.bitrateTest||(this.fragCurrent=i,this.partCurrent=null!=(i=t.part)?i:null),this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100))},i.onLevelSwitching=function(e,t){this.clearTimer()},i.onError=function(e,t){if(!t.fatal)switch(t.details){case A.BUFFER_ADD_CODEC_ERROR:case A.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case A.FRAG_LOAD_TIMEOUT:var i,r=t.frag,n=this.fragCurrent,a=this.partCurrent;r&&n&&r.sn===n.sn&&r.level===n.level&&(a=performance.now()-(n=(a||r).stats).loading.start,r=n.loading.first?n.loading.first-n.loading.start:-1,n.loaded&&-1<r?(i=this.bwEstimator.getEstimateTTFB(),this.bwEstimator.sample(a-Math.min(i,r),n.loaded)):this.bwEstimator.sampleTTFB(a))}},i.getTimeToLoadFrag=function(e,t,i,r){return e+i/t+(r?this.lastLevelLoadSec:0)},i.onLevelLoaded=function(e,t){var i=this.hls.config,r=(r=t.stats.loading).end-r.start;E(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},i.onFragLoaded=function(e,t){var i,r,n,a=t.frag,s=((t=t.part)||a).stats;a.type===bt&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),this.ignoreFragment(a)||(this.clearTimer(),a.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate&&(r=(t||a).duration,i=((n=this.hls.levels[a.level]).loaded?n.loaded.bytes:0)+s.loaded,r=(n.loaded?n.loaded.duration:0)+r,n.loaded={bytes:i,duration:r},n.realBitrate=Math.round(8*i/r)),a.bitrateTest?(n={stats:s,frag:a,part:t,id:a.type},this.onFragBuffered(C.FRAG_BUFFERED,n),a.bitrateTest=!1):this.lastLoadedFragLevel=a.level)},i.onFragBuffered=function(e,t){var i,r=t.frag;(t=(null!=(t=t.part)&&t.stats.loaded?t:r).stats).aborted||this.ignoreFragment(r)||(i=t.parsing.end-t.loading.start-Math.min(t.loading.first-t.loading.start,this.bwEstimator.getEstimateTTFB()),this.bwEstimator.sample(i,t.loaded),t.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=i/1e3:this.bitrateTestDelay=0)},i.ignoreFragment=function(e){return e.type!==bt||"initSegment"===e.sn},i.clearTimer=function(){-1<this.timer&&(self.clearInterval(this.timer),this.timer=-1)},i.getAutoLevelKey=function(){return this.getBwEstimate()+"_"+this.getStarvationDelay().toFixed(2)},i.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls;if(i.levels.length<=1)return i.loadLevel;var r=i.maxAutoLevel,n=i.config,a=i.minAutoLevel,s=(t=t?t.duration:e?e.duration:0,e=this.getBwEstimate(),this.getStarvationDelay()),o=n.abrBandWidthFactor,l=n.abrBandWidthUpFactor;if(s&&0<=(c=this.findBestLevel(e,a,r,s,0,o,l)))return c;var u,c=t?Math.min(t,n.maxStarvationDelay):n.maxStarvationDelay;s||(u=this.bitrateTestDelay)&&(c=(t?Math.min(t,n.maxLoadingDelay):n.maxLoadingDelay)-u,this.info("bitrate test took "+Math.round(1e3*u)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*c)+" ms"),o=l=1),t=this.findBestLevel(e,a,r,s,c,o,l);return this.info((s?"rebuffering expected":"buffer is empty")+", optimal quality level "+t),-1<t?t:(n=i.levels[a],u=i.levels[i.loadLevel],(null==n?void 0:n.bitrate)<(null==u?void 0:u.bitrate)?a:i.loadLevel)},i.getStarvationDelay=function(){var e=this.hls,t=e.media;return t?(t=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,((e=e.mainForwardBufferInfo)?e.len:0)/t):1/0},i.getBwEstimate=function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate},i.findBestLevel=function(e,t,i,r,n,a,s){var o=this,l=r+n,u=this.lastLoadedFragLevel,c=-1===u?this.hls.firstLevel:u,d=this.fragCurrent,h=this.partCurrent,f=(w=this.hls).levels,p=w.allAudioTracks,m=w.loadLevel,g=w.config;if(1===f.length)return 0;var v,y=f[c],_=!(null==y||null==(w=y.details)||!w.live),b=-1===m||-1===u,T="SDR",S=(null==y?void 0:y.frameRate)||0,k=g.audioPreference,w=g.videoPreference,C=this.audioTracksByGroup||(this.audioTracksByGroup=p.reduce(function(e,t){var i=e.groups[t.groupId],r=((i=i||(e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1})).tracks.push(t),t.channels||"2");return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}}));if(b){if(-1!==this.firstSelection)return this.firstSelection;w=(p=hi(this.codecTiers||(this.codecTiers=(v=C,f.slice(t,i+1).reduce(function(e,t){var i,r,n;return t.codecSet&&(i=t.audioGroups,(r=e[t.codecSet])||(e[t.codecSet]=r={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}),r.minBitrate=Math.min(r.minBitrate,t.bitrate),n=Math.min(t.height,t.width),r.minHeight=Math.min(r.minHeight,n),r.minFramerate=Math.min(r.minFramerate,t.frameRate),r.maxScore=Math.max(r.maxScore,t.score),r.fragmentError+=t.fragmentError,r.videoRanges[t.videoRange]=(r.videoRanges[t.videoRange]||0)+1,i)&&i.forEach(function(e){var t;e&&(t=v.groups[e],r.hasDefaultAudio=r.hasDefaultAudio||v.hasDefaultAudio?t.hasDefault:t.hasAutoSelect||!v.hasDefaultAudio&&!v.hasAutoSelectAudio,Object.keys(t.channels).forEach(function(e){r.channels[e]=(r.channels[e]||0)+t.channels[e]}))}),e},{}))),T,e,k,w)).codecSet;var L=p.videoRanges,A=p.minFramerate,R=p.minBitrate,P=w;T=p.preferHDR?L[L.length-1]:L[0],S=A;e=Math.max(e,R),this.log("picked start tier "+JSON.stringify(p))}else P=null==y?void 0:y.codecSet,T=null==y?void 0:y.videoRange;for(var D,I=h?h.duration:d?d.duration:0,x=this.bwEstimator.getEstimateTTFB()/1e3,O=[],M=function(){var t,d,p,v,w=f[U],L=c<U;return w?(!g.useMediaCapabilities||w.supportedResult||w.supportedPromise||("function"==typeof(null==(p=navigator.mediaCapabilities)?void 0:p.decodingInfo)&&function(e,t,i,r,n,a){var s=e.audioCodec?e.audioGroups:null,o=null==a?void 0:a.audioCodec,l=(a=null==a?void 0:a.channels)?parseInt(a):o?1/0:2;a=null;if(null!=s&&s.length)try{a=1===s.length&&s[0]?t.groups[s[0]].channels:s.reduce(function(e,i){if(i){var r=t.groups[i];if(!r)throw new Error("Audio track group "+i+" not found");Object.keys(r.channels).forEach(function(t){e[t]=(e[t]||0)+r.channels[t]})}return e},{2:0})}catch(e){return 1}return void 0!==e.videoCodec&&(1920<e.width&&1088<e.height||1920<e.height&&1088<e.width||e.frameRate>Math.max(r,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(n,8e6))||a&&E(l)&&Object.keys(a).some(function(e){return parseInt(e)>l})}(w,C,T,S,e,k)?(w.supportedPromise=di(w,C,p),w.supportedPromise.then(function(e){var t,i;o.hls&&(w.supportedResult=e,i=(t=o.hls.levels).indexOf(w),e.error?o.warn('MediaCapabilities decodingInfo error: "'+e.error+'" for level '+i+" "+JSON.stringify(e)):e.supported||(o.warn("Unsupported MediaCapabilities decodingInfo result for level "+i+" "+JSON.stringify(e)),-1<i&&1<t.length&&(o.log("Removing unsupported level "+i),o.hls.removeLevel(i))))})):w.supportedResult=ui),P&&w.codecSet!==P||T&&w.videoRange!==T||L&&S>w.frameRate||!L&&0<S&&S<w.frameRate||w.supportedResult&&(null==(p=w.supportedResult.decodingInfoResults)||!p[0].smooth)?(O.push(U),0):(p=w.details,t=(h?null==p?void 0:p.partTarget:null==p?void 0:p.averagetargetduration)||I,L=L?s*e:a*e,d=I&&2*I<=r&&0===n?f[U].averageBitrate:f[U].maxBitrate,p=o.getTimeToLoadFrag(x,L,d*t,void 0===p),d<=L&&(U===u||0===w.loadError&&0===w.fragmentError)&&(p<=x||!E(p)||_&&!o.bitrateTestDelay||p<l)?(v=o.forcedAutoLevel,U===m||-1!==v&&v===m||(O.length&&o.trace("Skipped level(s) "+O.join(",")+" of "+i+' max with CODECS and VIDEO-RANGE:"'+f[O[0]].codecs+'" '+f[O[0]].videoRange+'; not compatible with "'+y.codecs+'" '+T),o.info("switch candidate:"+c+"->"+U+" adjustedbw("+Math.round(L)+")-bitrate="+Math.round(L-d)+" ttfb:"+x.toFixed(1)+" avgDuration:"+t.toFixed(1)+" maxFetchDuration:"+l.toFixed(1)+" fetchDuration:"+p.toFixed(1)+" firstSelection:"+b+" codecSet:"+P+" videoRange:"+T+" hls.loadLevel:"+m)),b&&(o.firstSelection=U),{v:U}):void 0)):0},U=i;t<=U;U--)if(0!==(D=M())&&D)return D.v;return-1},l(t,[{key:"firstAutoLevel",get:function(){var e=(t=this.hls).maxAutoLevel,t=t.minAutoLevel,i=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay;return-1<(i=this.findBestLevel(i,t,e,0,r,1,1))||(r=this.hls.firstLevel,i=Math.min(Math.max(r,t),e),this.warn("Could not find best starting auto level. Defaulting to first in playlist "+r+" clamped to "+i)),i}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){var e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=-1<this.lastLoadedFragLevel;return-1===e||t&&i&&this.nextAutoLevelKey!==this.getAutoLevelKey()?(t=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel,-1!==e&&(i=this.hls.levels).length>Math.max(e,t)&&i[e].loadError<=i[t].loadError?e:(this._nextAutoLevel=t,this.nextAutoLevelKey=this.getAutoLevelKey(),t)):e},set:function(e){var t=(i=this.hls).maxAutoLevel,i=i.minAutoLevel;e=Math.min(Math.max(e,i),t);this._nextAutoLevel!==e&&(this.nextAutoLevelKey="",this._nextAutoLevel=e)}}])}(m),_i=function(e){function t(t,i){return(t=e.call(this,t,i)||this)._boundTick=void 0,t._tickTimer=null,t._tickInterval=null,t._tickCallCount=0,t._boundTick=t.tick.bind(t),t}c(t,e);var i=t.prototype;return i.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},i.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},i.onHandlerDestroyed=function(){},i.hasInterval=function(){return!!this._tickInterval},i.hasNextTick=function(){return!!this._tickTimer},i.setInterval=function(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)},i.clearInterval=function(){return!(!this._tickInterval||(self.clearInterval(this._tickInterval),this._tickInterval=null))},i.clearNextTick=function(){return!(!this._tickTimer||(self.clearTimeout(this._tickTimer),this._tickTimer=null))},i.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),1<this._tickCallCount&&this.tickImmediate(),this._tickCallCount=0)},i.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},i.doTick=function(){},t}(m),bi="NOT_LOADED",Ti="APPENDING",Si="PARTIAL",Ei="OK",ki=function(){function e(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}var t=e.prototype;return t._registerListeners=function(){var e=this.hls;e.on(C.BUFFER_APPENDED,this.onBufferAppended,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this),e.on(C.FRAG_LOADED,this.onFragLoaded,this)},t._unregisterListeners=function(){var e=this.hls;e.off(C.BUFFER_APPENDED,this.onBufferAppended,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this),e.off(C.FRAG_LOADED,this.onFragLoaded,this)},t.destroy=function(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null},t.getAppendedFrag=function(e,t){var i=this.activePartLists[t];if(i)for(var r=i.length;r--;){var n=i[r];if(!n)break;var a=n.end;if(n.start<=e&&null!==a&&e<=a)return n}return this.getBufferedFrag(e,t)},t.getBufferedFrag=function(e,t){return this.getFragAtPos(e,t,!0)},t.getFragAtPos=function(e,t,i){for(var r=this.fragments,n=Object.keys(r),a=n.length;a--;){var s=r[n[a]];if((null==s?void 0:s.body.type)===t&&(!i||s.buffered)&&(s=s.body).start<=e&&e<=s.end)return s}return null},t.detectEvictedFragments=function(e,t,i,r){var n=this,a=(this.timeRanges&&(this.timeRanges[e]=t),(null==r?void 0:r.fragment.sn)||-1);Object.keys(this.fragments).forEach(function(r){var s=n.fragments[r];!s||a>=s.body.sn||(s.buffered||s.loaded?(r=s.range[e])&&r.time.some(function(e){return(e=!n.isTimeBuffered(e.startPTS,e.endPTS,t))&&n.removeFragment(s.body),e}):s.body.type===i&&n.removeFragment(s.body))})},t.detectPartialFragments=function(e){var t,i,r=this,n=this.timeRanges,a=e.frag,s=e.part;n&&"initSegment"!==a.sn&&(e=Ci(a),!(t=this.fragments[e])||t.buffered&&a.gap||(i=!a.relurl,Object.keys(n).forEach(function(e){var o,l=a.elementaryStreams[e];l&&(o=n[e],l=i||!0===l.partial,t.range[e]=r.getBufferedTimes(a,s,l,o))}),t.loaded=null,Object.keys(t.range).length?(t.buffered=!0,(t.body.endList=a.endList||t.body.endList)&&(this.endListFragments[t.body.type]=t),wi(t)||this.removeParts(a.sn-1,a.type)):this.removeFragment(t.body)))},t.removeParts=function(e,t){var i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(function(t){return t.fragment.sn>=e}))},t.fragBuffered=function(e,t){var i=Ci(e),r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap)&&(this.hasGaps=!0),r&&(r.loaded=null,r.buffered=!0)},t.getBufferedTimes=function(e,t,i,r){for(var n={time:[],partial:i},a=e.start,s=e.end,o=e.minEndPTS||s,l=e.maxStartPTS||a,u=0;u<r.length;u++){var c=r.start(u)-this.bufferPadding,d=r.end(u)+this.bufferPadding;if(c<=l&&o<=d){n.time.push({startPTS:Math.max(a,r.start(u)),endPTS:Math.min(s,r.end(u))});break}if(a<d&&c<s){d=Math.max(a,r.start(u));var h=Math.min(s,r.end(u));d<h&&(n.partial=!0,n.time.push({startPTS:d,endPTS:h}))}else if(s<=c)break}return n},t.getPartialFragment=function(e){var t,i,r=null,n=0,a=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(o){(o=s[o])&&wi(o)&&(t=o.body.start-a,i=o.body.end+a,t<=e)&&e<=i&&(t=Math.min(e-t,i-e),n<=t)&&(r=o.body,n=t)}),r},t.isEndListAppended=function(e){return void 0!==(e=this.endListFragments[e])&&(e.buffered||wi(e))},t.getState=function(e){return e=Ci(e),(e=this.fragments[e])?e.buffered?wi(e)?Si:Ei:Ti:bi},t.isTimeBuffered=function(e,t,i){for(var r,n,a=0;a<i.length;a++){if(r=i.start(a)-this.bufferPadding,n=i.end(a)+this.bufferPadding,r<=e&&t<=n)return!0;if(t<=r)return!1}return!1},t.onFragLoaded=function(e,t){var i,r=t.frag,n=t.part;"initSegment"===r.sn||r.bitrateTest||(i=Ci(r),this.fragments[i]={body:r,appendedPTS:null,loaded:n?null:t,buffered:!1,range:Object.create(null)})},t.onBufferAppended=function(e,t){var i,r=t.frag,n=t.part,a=t.timeRanges;t=t.type;"initSegment"!==r.sn&&(r=r.type,n&&((i=this.activePartLists[r])||(this.activePartLists[r]=i=[]),i.push(n)),i=(this.timeRanges=a)[t],this.detectEvictedFragments(t,i,r,n))},t.onFragBuffered=function(e,t){this.detectPartialFragments(t)},t.hasFragment=function(e){return e=Ci(e),!!this.fragments[e]},t.hasParts=function(e){return!(null==(e=this.activePartLists[e])||!e.length)},t.removeFragmentsInRange=function(e,t,i,r,n){var a=this;r&&!this.hasGaps||Object.keys(this.fragments).forEach(function(s){var o;!(s=a.fragments[s])||(o=s.body).type!==i||r&&!o.gap||o.start<t&&o.end>e&&(s.buffered||n)&&a.removeFragment(o)})},t.removeFragment=function(e){var t,i=Ci(e),r=(e.stats.loaded=0,e.clearElementaryStreamInfo(),this.activePartLists[e.type]);r&&(t=e.sn,this.activePartLists[e.type]=r.filter(function(e){return e.fragment.sn!==t})),delete this.fragments[i],e.endList&&delete this.endListFragments[e.type]},t.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1},e}();function wi(e){var t;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(t=e.range.audio)?void 0:t.partial)||(null==(t=e.range.audiovideo)?void 0:t.partial))}function Ci(e){return e.type+"_"+e.level+"_"+e.sn}function Li(e,t,i,r,n,a){void 0===r&&(r=0),void 0===n&&(n=-1),void 0===a&&(a=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=a}var Ai={length:0,start:function(){return 0},end:function(){return 0}},Ri=function(){function e(){}return e.isBuffered=function(t,i){if(t)for(var r=e.getBuffered(t),n=r.length;n--;)if(i>=r.start(n)&&i<=r.end(n))return!0;return!1},e.bufferInfo=function(t,i,r){if(t){var n=e.getBuffered(t);if(n.length){for(var a=[],s=0;s<n.length;s++)a.push({start:n.start(s),end:n.end(s)});return e.bufferedInfo(a,i,r)}}return{len:0,start:i,end:i,nextStart:void 0}},e.bufferedInfo=function(e,t,i){t=Math.max(0,t),e.sort(function(e,t){return e.start-t.start||t.end-e.end});var r=[];if(i)for(var n=0;n<e.length;n++){var a,s=r.length;s&&(a=r[s-1].end,e[n].start-a<i)?e[n].end>a&&(r[s-1].end=e[n].end):r.push(e[n])}else r=e;for(var o,l=0,u=t,c=t,d=0;d<r.length;d++){var h=r[d].start,f=r[d].end;if(h<=t+i&&t<f)u=h,l=(c=f)-t;else if(t+i<h){o=h;break}}return{len:l,start:u||0,end:c||0,nextStart:o}},e.getBuffered=function(e){try{return e.buffered||Ai}catch(e){return B.log("failed to get media.buffered",e),Ai}},e}();function Pi(e,t){for(var i,r=0,n=e.length;r<n;r++)if((null==(i=e[r])?void 0:i.cc)===t)return e[r];return null}function Di(e,t){e&&(t=e.start+t,e.start=e.startPTS=t,e.endPTS=t+e.duration)}function Ii(e,t){for(var i=t.fragments,r=0,n=i.length;r<n;r++)Di(i[r],e);t.fragmentHint&&Di(t.fragmentHint,e),t.alignedSliding=!0}function xi(e,t){var i,r,n,a,s;e.hasProgramDateTime&&t.hasProgramDateTime&&(i=e.fragments,r=t.fragments,i.length)&&r.length&&(s=Math.min(t.endCC,e.endCC),t.startCC<s&&e.startCC<s&&(n=Pi(r,s),a=Pi(i,s)),n&&a||(a=Pi(i,(n=r[Math.floor(r.length/2)]).cc)||i[Math.floor(i.length/2)]),t=n.programDateTime,s=a.programDateTime,t)&&s&&Ii((s-t)/1e3-(a.start-n.start),e)}var Oi=Math.pow(2,17),Mi=function(){function e(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var t=e.prototype;return t.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(e,t){var r=this,n=e.url;if(!n)return Promise.reject(new Ni({type:L.NETWORK_ERROR,details:A.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(n?"part list":"url")),networkDetails:null}));this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise(function(l,u){if(r.loader&&r.loader.destroy(),e.gap){if(e.tagList.some(function(e){return"GAP"===e[0]}))return void u(Bi(e));e.gap=!1}var c=r.loader=e.loader=new(s||o)(a),d=Ui(e),h=ei(a.fragLoadPolicy.default),f={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:Oi};e.stats=c.stats,c.load(d,f,{onSuccess:function(t,i,n,a){r.resetLoader(e,c),t=t.data,n.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(t.slice(0,16)),t=t.slice(16)),l({frag:e,part:null,payload:t,networkDetails:a})},onError:function(t,a,s,o){r.resetLoader(e,c),u(new Ni({type:L.NETWORK_ERROR,details:A.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:i({url:n,data:void 0},t),error:new Error("HTTP Error "+t.code+" "+t.text),networkDetails:s,stats:o}))},onAbort:function(t,i,n){r.resetLoader(e,c),u(new Ni({type:L.NETWORK_ERROR,details:A.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:n,stats:t}))},onTimeout:function(t,i,n){r.resetLoader(e,c),u(new Ni({type:L.NETWORK_ERROR,details:A.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after "+f.timeout+"ms"),networkDetails:n,stats:t}))},onProgress:function(i,r,n,a){t&&t({frag:e,part:null,payload:n,networkDetails:a})}})})},t.loadPart=function(e,t,r){var n=this,a=(this.abort(),this.config),s=a.fLoader,o=a.loader;return new Promise(function(l,u){var c,d,h,f;n.loader&&n.loader.destroy(),e.gap||t.gap?u(Bi(e,t)):(c=n.loader=e.loader=new(s||o)(a),d=Ui(e,t),h=ei(a.fragLoadPolicy.default),f={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Oi},t.stats=c.stats,c.load(d,f,{onSuccess:function(i,a,s,o){n.resetLoader(e,c),n.updateStatsFromPart(e,t),i={frag:e,part:t,payload:i.data,networkDetails:o},r(i),l(i)},onError:function(r,a,s,o){n.resetLoader(e,c),u(new Ni({type:L.NETWORK_ERROR,details:A.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:i({url:d.url,data:void 0},r),error:new Error("HTTP Error "+r.code+" "+r.text),networkDetails:s,stats:o}))},onAbort:function(i,r,a){e.stats.aborted=t.stats.aborted,n.resetLoader(e,c),u(new Ni({type:L.NETWORK_ERROR,details:A.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:a,stats:i}))},onTimeout:function(i,r,a){n.resetLoader(e,c),u(new Ni({type:L.NETWORK_ERROR,details:A.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after "+f.timeout+"ms"),networkDetails:a,stats:i}))}}))})},t.updateStatsFromPart=function(e,t){var i=e.stats,r=t.stats,n=r.total;i.loaded+=r.loaded,n?(n=((e=Math.round(e.duration/t.duration))-(t=Math.min(Math.round(i.loaded/n),e)))*Math.round(i.loaded/t),i.total=i.loaded+n):i.total=Math.max(i.loaded,i.total),e=i.loading,t=r.loading;e.start?e.first+=t.first-t.start:(e.start=t.start,e.first=t.first),e.end=t.end},t.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},e}();function Ui(e,t){var i,r,n=(t=void 0===t?null:t)||e,a=(t={frag:e,part:t,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},n.byteRangeStartOffset);n=n.byteRangeEndOffset;return E(a)&&E(n)&&(i=a,r=n,"initSegment"!==e.sn||"AES-128"!==(e=null==(e=e.decryptdata)?void 0:e.method)&&"AES-256"!==e||((e=n-a)%16&&(r=n+(16-e%16)),0!==a&&(t.resetIV=!0,i=a-16)),t.rangeStart=i,t.rangeEnd=r),t}function Bi(e,t){var i=new Error("GAP "+(e.gap?"tag":"attribute")+" found");i={type:L.MEDIA_ERROR,details:A.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(i.part=t),(t||e).stats.aborted=!0,new Ni(i)}var Ni=function(e){function t(t){var i=e.call(this,t.error.message)||this;return i.data=void 0,i.data=t,i}return c(t,e),t}(f(Error)),Fi=function(){function e(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}return e.prototype.decrypt=function(e,t){switch(this.aesMode){case Y:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case X:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error("[AESCrypto] invalid aes mode "+this.aesMode)}},e}(),ji=function(){function e(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}return e.prototype.expandKey=function(){var e=function(e){switch(e){case Y:return"AES-CBC";case X:return"AES-CTR";default:throw new Error("[FastAESKey] invalid aes mode "+e)}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])},e}(),Gi=function(){function e(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var t=e.prototype;return t.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),i=new Uint32Array(4),r=0;r<4;r++)i[r]=t.getUint32(4*r);return i},t.initTable=function(){var e,t=this.sBox,i=this.invSBox,r=(e=this.subMix)[0],n=e[1],a=e[2],s=e[3],o=(e=this.invSubMix)[0],l=e[1],u=e[2],c=e[3],d=new Uint32Array(256),h=0,f=0,p=0;for(p=0;p<256;p++)d[p]=p<128?p<<1:p<<1^283;for(p=0;p<256;p++){var m=f^f<<1^f<<2^f<<3^f<<4,g=(t[h]=m=m>>>8^255&m^99,d[i[m]=h]),v=d[g],y=d[v],_=257*d[m]^16843008*m;r[h]=_<<24|_>>>8,n[h]=_<<16|_>>>16,a[h]=_<<8|_>>>24,s[h]=_,o[m]=(_=16843009*y^65537*v^257*g^16843008*h)<<24|_>>>8,l[m]=_<<16|_>>>16,u[m]=_<<8|_>>>24,c[m]=_,h?(h=g^d[d[d[y^g]]],f^=d[d[f]]):h=f=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,r=0;r<t.length&&i;)i=t[r]===this.key[r],r++;if(!i){this.key=t;var n=this.keySize=t.length;if(4!==n&&6!==n&&8!==n)throw new Error("Invalid aes key size="+n);for(var a,s,o,l=this.ksRows=4*(n+6+1),u=this.keySchedule=new Uint32Array(l),c=this.invKeySchedule=new Uint32Array(l),d=this.sBox,h=this.rcon,f=(e=this.invSubMix)[0],p=e[1],m=e[2],g=e[3],v=0;v<l;v++)v<n?s=u[v]=t[v]:(o=s,v%n==0?(o=d[(o=o<<8|o>>>24)>>>24]<<24|d[o>>>16&255]<<16|d[o>>>8&255]<<8|d[255&o],o^=h[v/n|0]<<24):6<n&&v%n==4&&(o=d[o>>>24]<<24|d[o>>>16&255]<<16|d[o>>>8&255]<<8|d[255&o]),u[v]=s=(u[v-n]^o)>>>0);for(a=0;a<l;a++)v=l-a,o=3&a?u[v]:u[v-4],c[a]=a<4||v<=4?o:f[d[o>>>24]]^p[d[o>>>16&255]]^m[d[o>>>8&255]]^g[d[255&o]],c[a]=c[a]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,i){for(var r,n,a,s,o,l,u,c,d,h,f,p,m,g,v,y=this.keySize+6,_=this.invKeySchedule,b=this.invSBox,T=(v=this.invSubMix)[0],S=v[1],E=v[2],k=v[3],w=(v=this.uint8ArrayToUint32Array_(i))[0],C=v[1],L=v[2],A=v[3],R=new Int32Array(e),P=new Int32Array(R.length),D=this.networkToHostOrderSwap;t<R.length;){for(d=D(R[t]),h=D(R[t+1]),f=D(R[t+2]),p=D(R[t+3]),o=d^_[0],l=p^_[1],u=f^_[2],c=h^_[3],m=4,g=1;g<y;g++)r=T[o>>>24]^S[l>>16&255]^E[u>>8&255]^k[255&c]^_[m],n=T[l>>>24]^S[u>>16&255]^E[c>>8&255]^k[255&o]^_[m+1],a=T[u>>>24]^S[c>>16&255]^E[o>>8&255]^k[255&l]^_[m+2],s=T[c>>>24]^S[o>>16&255]^E[l>>8&255]^k[255&u]^_[m+3],o=r,l=n,u=a,c=s,m+=4;r=b[o>>>24]<<24^b[l>>16&255]<<16^b[u>>8&255]<<8^b[255&c]^_[m],n=b[l>>>24]<<24^b[u>>16&255]<<16^b[c>>8&255]<<8^b[255&o]^_[m+1],a=b[u>>>24]<<24^b[c>>16&255]<<16^b[o>>8&255]<<8^b[255&l]^_[m+2],s=b[c>>>24]<<24^b[o>>16&255]<<16^b[l>>8&255]<<8^b[255&u]^_[m+3],P[t]=D(r^w),P[t+1]=D(s^C),P[t+2]=D(a^L),P[t+3]=D(n^A),w=d,C=h,L=f,A=p,t+=4}return P.buffer},e}(),Vi=function(){function e(e,t){if(t=void 0===(t=(void 0===t?{}:t).removePKCS7Padding)||t,this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t)try{var i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch(e){}this.useSoftware=null===this.subtle}var t=e.prototype;return t.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},t.isSync=function(){return this.useSoftware},t.flush=function(){var e,t,i=this.currentResult,r=this.remainderData;return!i||r?(this.reset(),null):(r=new Uint8Array(i),this.reset(),this.removePKCS7Padding?(t=(e=(i=r).byteLength)&&new DataView(i.buffer).getUint8(e-1))?ae(i,0,e-t):i:r)},t.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},t.decrypt=function(e,t,i,r){var n=this;return this.useSoftware?new Promise(function(a,s){n.softwareDecrypt(new Uint8Array(e),t,i,r);var o=n.flush();o?a(o.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,r)},t.softwareDecrypt=function(e,t,i,r){var n=this.currentIV,a=this.currentResult,s=this.remainderData;return r!==Y||16!==t.byteLength?(B.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null):(this.logOnce("JS AES decrypt"),s&&(e=Ue(s,e),this.remainderData=null),(r=this.getValidChunk(e)).length?(n&&(i=n),(s=(s=this.softwareDecrypter)||(this.softwareDecrypter=new Gi)).expandKey(t),e=a,this.currentResult=s.decrypt(r.buffer,0,i),this.currentIV=ae(r,-16).buffer,e||null):null)},t.webCryptoDecrypt=function(e,t,i,r){var n=this,a=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new ji(a,t,r)),this.fastAesKey.expandKey().then(function(t){return a?(n.logOnce("WebCrypto AES decrypt"),new Fi(a,new Uint8Array(i),r).decrypt(e.buffer,t)):Promise.reject(new Error("web crypto not initialized"))}).catch(function(a){return B.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+a.name+": "+a.message),n.onWebCryptoError(e,t,i,r)})},t.onWebCryptoError=function(e,t,i,r){var n=this.enableSoftwareAES;if(n&&(this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,r),e=this.flush()))return e.buffer;throw new Error("WebCrypto"+(n?" and softwareDecrypt":"")+": failed to decrypt data")},t.getValidChunk=function(e){var t=e,i=e.length-e.length%16;return i!==e.length&&(t=ae(e,0,i),this.remainderData=ae(e,i)),t},t.logOnce=function(e){this.logEnabled&&(B.log("[decrypter]: "+e),this.logEnabled=!1)},e}(),Hi="STOPPED",Ki="IDLE",qi="KEY_LOADING",Wi="FRAG_LOADING",zi="FRAG_LOADING_WAITING_RETRY",Yi="WAITING_TRACK",Xi="PARSING",$i="PARSED",Qi="ENDED",Ji="ERROR",Zi="WAITING_INIT_PTS",er="WAITING_LEVEL",tr=(_i=function(e){function t(t,i,r,n,a){var s=e.call(this,n,t.logger)||this;return s.hls=void 0,s.fragPrevious=null,s.fragCurrent=null,s.fragmentTracker=void 0,s.transmuxer=null,s._state=Hi,s.playlistType=void 0,s.media=null,s.mediaBuffer=null,s.config=void 0,s.bitrateTest=!1,s.lastCurrentTime=0,s.nextLoadPosition=0,s.startPosition=0,s.startTimeOffset=null,s.loadedmetadata=!1,s.retryDate=0,s.levels=null,s.fragmentLoader=void 0,s.keyLoader=void 0,s.levelLastLoaded=null,s.startFragRequested=!1,s.decrypter=void 0,s.initPTS=[],s.buffering=!0,s.loadingParts=!1,s.onMediaSeeking=function(){var e=(n=s).config,t=n.fragCurrent,i=n.media,r=n.mediaBuffer,n=n.state,a=i?i.currentTime:0;r=Ri.bufferInfo(r||i,a,e.maxBufferHole);s.log("media seeking to "+(E(a)?a.toFixed(3):a)+", state: "+n),s.state===Qi?s.resetLoadingState():t&&(n=e.maxFragLookUpTolerance,e=t.start-n,n=t.start+t.duration+n,!r.len||n<r.start||e>r.end)&&(n=n<a,a<e||n)&&(n&&t.loader&&(s.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),s.resetLoadingState()),s.fragPrevious=null),i&&(s.fragmentTracker.removeFragmentsInRange(a,1/0,s.playlistType,!0),s.lastCurrentTime=a,!s.loadingParts)&&(e=Math.max(r.end,a),n=s.shouldLoadParts(s.getLevelDetails(),e))&&(s.log("LL-Part loading ON after seeking to "+a.toFixed(2)+" with buffer @"+e.toFixed(2)),s.loadingParts=n),s.loadedmetadata||r.len||(s.nextLoadPosition=s.startPosition=a),s.tickImmediate()},s.onMediaEnded=function(){s.startPosition=s.lastCurrentTime=0,s.playlistType===bt&&s.hls.trigger(C.MEDIA_ENDED,{stalled:!1})},s.playlistType=a,s.hls=t,s.fragmentLoader=new Mi(t.config),s.keyLoader=r,s.fragmentTracker=i,s.config=t.config,s.decrypter=new Vi(t.config),s}c(t,e);var i=t.prototype;return i.registerListeners=function(){var e=this.hls;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(C.ERROR,this.onError,this)},i.unregisterListeners=function(){var e=this.hls;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(C.ERROR,this.onError,this)},i.doTick=function(){this.onTickEnd()},i.onTickEnd=function(){},i.startLoad=function(e){},i.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);var e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Hi},i.pauseBuffering=function(){this.buffering=!1},i.resumeBuffering=function(){this.buffering=!0},i._streamEnded=function(e,t){return!(t.live||e.nextStart||!e.end||!this.media)&&(null!=(e=t.partList)&&e.length?(e=e[e.length-1],Ri.isBuffered(this.media,e.start+e.duration/2)):(e=t.fragments[t.fragments.length-1].type,this.fragmentTracker.isEndListAppended(e)))},i.getLevelDetails=function(){var e;return this.levels&&null!==this.levelLastLoaded&&null!=(e=this.levelLastLoaded)?e.details:void 0},i.onMediaAttached=function(e,t){(t=this.media=this.mediaBuffer=t.media).addEventListener("seeking",this.onMediaSeeking),t.addEventListener("ended",this.onMediaEnded),t=this.config,this.levels&&t.autoStartLoad&&this.state===Hi&&this.startLoad(t.startPosition)},i.onMediaDetaching=function(){var e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onMediaSeeking),e.removeEventListener("ended",this.onMediaEnded)),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},i.onManifestLoading=function(){},i.onError=function(e,t){},i.onManifestLoaded=function(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]},i.onHandlerDestroying=function(){this.stopLoad(),e.prototype.onHandlerDestroying.call(this),this.hls=this.onMediaSeeking=this.onMediaEnded=null},i.onHandlerDestroyed=function(){this.state=Hi,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,e.prototype.onHandlerDestroyed.call(this)},i.loadFragment=function(e,t,i){this._loadFragForPlayback(e,t,i)},i._loadFragForPlayback=function(e,t,i){var r=this;this._doFragLoad(e,t,i,function(t){r.fragContextChanged(e)?(r.warn("Fragment "+e.sn+(t.part?" p: "+t.part.index:"")+" of level "+e.level+" was dropped during download."),r.fragmentTracker.removeFragment(e)):(e.stats.chunkCount++,r._handleFragmentLoadProgress(t))}).then(function(t){var i;t&&(i=r.state,r.fragContextChanged(e)?i!==Wi&&(r.fragCurrent||i!==Xi)||(r.fragmentTracker.removeFragment(e),r.state=Ki):("payload"in t&&(r.log("Loaded fragment "+e.sn+" of level "+e.level),r.hls.trigger(C.FRAG_LOADED,t)),r._handleFragmentLoadComplete(t)))}).catch(function(t){r.state!==Hi&&r.state!==Ji&&(r.warn(t),r.resetFragmentLoading(e))})},i.clearTrackerIfNeeded=function(e){var t,i=this.fragmentTracker;i.getState(e)===Ti?(t=e.type,t=this.getFwdBufferInfo(this.mediaBuffer,t),t=Math.max(e.duration,t?t.len:this.config.maxBufferLength),this.reduceMaxBufferLength(t)&&i.removeFragment(e)):0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Si)&&i.removeFragment(e)},i.checkLiveUpdate=function(e){var t;e.updated&&!e.live&&(t=e.fragments[e.fragments.length-1],this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})),e.fragments[0]||(e.deltaUpdateFailed=!0)},i.flushMainBuffer=function(e,t,i){void 0===i&&(i=null),e-t&&this.hls.trigger(C.BUFFER_FLUSHING,{startOffset:e,endOffset:t,type:i})},i._loadInitSegment=function(e,t){var i=this;this._doFragLoad(e,t).then(function(t){if(t&&!i.fragContextChanged(e)&&i.levels)return t;throw new Error("init load aborted")}).then(function(t){var r,n=i.hls,a=t.payload,s=e.decryptdata;return a&&0<a.byteLength&&null!=s&&s.key&&s.iv&&$(s.method)?(r=self.performance.now(),i.decrypter.decrypt(new Uint8Array(a),s.key.buffer,s.iv.buffer,Q(s.method)).catch(function(t){throw n.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t}).then(function(a){var s=self.performance.now();return n.trigger(C.FRAG_DECRYPTED,{frag:e,payload:a,stats:{tstart:r,tdecrypt:s}}),t.payload=a,i.completeInitSegmentLoad(t)})):i.completeInitSegmentLoad(t)}).catch(function(t){i.state!==Hi&&i.state!==Ji&&(i.warn(t),i.resetFragmentLoading(e))})},i.completeInitSegmentLoad=function(e){if(!this.levels)throw new Error("init load aborted, missing levels");var t=e.frag.stats;this.state!==Hi&&(this.state=Ki),e.frag.data=new Uint8Array(e.payload),t.parsing.start=t.buffering.start=self.performance.now(),t.parsing.end=t.buffering.end=self.performance.now(),this.tick()},i.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.sn!==t.sn||e.level!==t.level},i.fragBufferedComplete=function(e,t){var i=this.mediaBuffer||this.media;if(this.log("Buffered "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+(this.playlistType===bt?"level":"track")+" "+e.level+" (frag:["+(null!=(t=e.startPTS)?t:NaN).toFixed(3)+"-"+(null!=(t=e.endPTS)?t:NaN).toFixed(3)+"] > buffer:"+(i?function(e){for(var t="",i=e.length,r=0;r<i;r++)t+="["+e.start(r).toFixed(3)+"-"+e.end(r).toFixed(3)+"]";return t}(Ri.getBuffered(i)):"(detached)")+")"),"initSegment"!==e.sn){if(e.type!==St){var r=e.elementaryStreams;if(!Object.keys(r).some(function(e){return!!r[e]}))return void(this.state=Ki)}null!=(t=null==(t=this.levels)?void 0:t[e.level])&&t.fragmentError&&(this.log("Resetting level fragment error count of "+t.fragmentError+" on frag buffered"),t.fragmentError=0)}this.state=Ki,i&&(!this.loadedmetadata&&e.type==bt&&i.buffered.length&&(null==(t=this.fragCurrent)?void 0:t.sn)===(null==(e=this.fragPrevious)?void 0:e.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},i.seekToStartPos=function(){},i._handleFragmentLoadComplete=function(e){var t,i,r=this.transmuxer;r&&(i=e.frag,t=e.part,e=!(e=e.partsLoaded)||0===e.length||e.some(function(e){return!e}),i=new Li(i.level,i.sn,i.stats.chunkCount+1,0,t?t.index:-1,!e),r.flush(i))},i._handleFragmentLoadProgress=function(e){},i._doFragLoad=function(e,t,i,r){var n=this,a=(void 0===i&&(i=null),null==t?void 0:t.details);if(!this.levels||!a)throw new Error("frag load aborted, missing level"+(a?"":" detail")+"s");var s=null,o=(!e.encrypted||null!=(o=e.decryptdata)&&o.key?!e.encrypted&&a.encryptedFragments.length&&this.keyLoader.loadClear(e,a.encryptedFragments):(this.log("Loading key for "+e.sn+" of ["+a.startSN+"-"+a.endSN+"], "+(this.playlistType===bt?"level":"track")+" "+e.level),this.state=qi,this.fragCurrent=e,s=this.keyLoader.load(e).then(function(e){if(!n.fragContextChanged(e.frag))return n.hls.trigger(C.KEY_LOADED,e),n.state===qi&&(n.state=Ki),e}),this.hls.trigger(C.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(s=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),this.fragPrevious);if("initSegment"===e.sn||o&&e.sn===o.sn||(c=this.shouldLoadParts(t.details,e.end))!==this.loadingParts&&(this.log("LL-Part loading "+(c?"ON":"OFF")+" loading sn "+(null==o?void 0:o.sn)+"->"+e.sn),this.loadingParts=c),i=Math.max(e.start,i||0),this.loadingParts&&"initSegment"!==e.sn&&(o=a.partList)&&r){var l;if(i>e.end&&a.fragmentHint&&(e=a.fragmentHint),-1<(c=this.getNextPart(o,e,i)))return l=o[c],this.log("Loading part sn: "+e.sn+" p: "+l.index+" cc: "+e.cc+" of playlist ["+a.startSN+"-"+a.endSN+"] parts [0-"+c+"-"+(o.length-1)+"] "+(this.playlistType===bt?"level":"track")+": "+e.level+", target: "+parseFloat(i.toFixed(3))),this.nextLoadPosition=l.start+l.duration,this.state=Wi,c=s?s.then(function(i){return!i||n.fragContextChanged(i.frag)?null:n.doFragPartsLoad(e,l,t,r)}).catch(function(e){return n.handleFragLoadError(e)}):this.doFragPartsLoad(e,l,t,r).catch(function(e){return n.handleFragLoadError(e)}),this.hls.trigger(C.FRAG_LOADING,{frag:e,part:l,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):c;if(!e.url||this.loadedEndOfParts(o,i))return Promise.resolve(null)}if("initSegment"!==e.sn&&this.loadingParts)this.log("LL-Part loading OFF after next part miss @"+i.toFixed(2)),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log("Loading fragment "+e.sn+" cc: "+e.cc+" "+(a?"of ["+a.startSN+"-"+a.endSN+"] ":"")+(this.playlistType===bt?"level":"track")+": "+e.level+", target: "+parseFloat(i.toFixed(3))),E(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Wi;var u=this.config.progressive,c=u&&s?s.then(function(t){return!t||n.fragContextChanged(null==t?void 0:t.frag)?null:n.fragmentLoader.load(e,r)}).catch(function(e){return n.handleFragLoadError(e)}):Promise.all([this.fragmentLoader.load(e,u?r:void 0),s]).then(function(e){return e=e[0],!u&&e&&r&&r(e),e}).catch(function(e){return n.handleFragLoadError(e)});return this.hls.trigger(C.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c},i.doFragPartsLoad=function(e,t,i,r){var n=this;return new Promise(function(a,s){var o,l=[],u=null==(o=i.details)?void 0:o.partList;!function t(o){n.fragmentLoader.loadPart(e,o,r).then(function(r){var s=(l[o.index]=r).part;if(!(r=(n.hls.trigger(C.FRAG_LOADED,r),Yt(i,e.sn,o.index+1)||Xt(u,e.sn,o.index+1))))return a({frag:e,part:s,partsLoaded:l});t(r)}).catch(s)}(t)})},i.handleFragLoadError=function(e){var t;return"data"in e?(t=e.data,e.data&&t.details===A.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(C.ERROR,t)):this.hls.trigger(C.ERROR,{type:L.OTHER_ERROR,details:A.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0}),null},i._handleTransmuxerFlush=function(e){var t,i,r,n=this.getCurrentContext(e);n&&this.state===Xi?(t=n.frag,i=n.part,n=n.level,r=self.performance.now(),t.stats.parsing.end=r,i&&(i.stats.parsing.end=r),"initSegment"!==t.sn&&(r=(r=this.getLevelDetails())&&t.sn>r.endSN||this.shouldLoadParts(r,t.end))!==this.loadingParts&&(this.log("LL-Part loading "+(r?"ON":"OFF")+" after parsing segment ending @"+t.end.toFixed(2)),this.loadingParts=r),this.updateLevelTiming(t,i,n,e.partial)):this.fragCurrent||this.state===Hi||this.state===Ji||(this.state=Ki)},i.shouldLoadParts=function(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(null!=e&&e.partList){var i=e.partList[0];if(i.end+((null==(e=e.fragmentHint)?void 0:e.duration)||0)<=t&&this.lastCurrentTime>i.start-i.fragment.duration)return!0}}return!1},i.getCurrentContext=function(e){var t,i,r,n,a=this.levels,s=this.fragCurrent,o=e.level,l=e.sn;e=e.part;return null!=a&&a[o]?(a=a[o],(n=(e=-1<e?Yt(a,l,e):null)?e.fragment:(i=l,r=s,null!=(t=a)&&t.details?(n=(t=t.details).fragments[i-t.startSN])||((n=t.fragmentHint)&&n.sn===i?n:i<t.startSN&&r&&r.sn===i?r:null):null))?(s&&s!==n&&(n.stats=s.stats),{frag:n,part:e,level:a}):null):(this.warn("Levels object was unset while buffering fragment "+l+" of level "+o+". The current chunk will not be buffered."),null)},i.bufferFragmentData=function(e,t,i,r,n){var a,s,o;e&&this.state===Xi&&(o=e.data1,a=e.data2,null!=(s=(s=o)&&a?Ue(o,a):s))&&s.length&&(o={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:s},this.hls.trigger(C.BUFFER_APPENDING,o),e.dropped)&&e.independent&&!i&&!n&&this.flushBufferGap(t)},i.flushBufferGap=function(e){var t,i,r=this.media;r&&(Ri.isBuffered(r,r.currentTime)?(t=r.currentTime,r=Ri.bufferInfo(r,t,0),i=e.duration,i=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),r=Math.max(Math.min(e.start-i,r.end-i),t+i),e.start-r>i&&this.flushMainBuffer(r,e.start)):this.flushMainBuffer(0,e.start))},i.getFwdBufferInfo=function(e,t){var i=this.getLoadPosition();return E(i)?this.getFwdBufferInfoAtPos(e,i,t):null},i.getFwdBufferInfoAtPos=function(e,t,i){var r=this.config.maxBufferHole,n=Ri.bufferInfo(e,t,r);return 0===n.len&&void 0!==n.nextStart&&(i=this.fragmentTracker.getBufferedFrag(t,i))&&(n.nextStart<=i.end||i.gap)?Ri.bufferInfo(e,t,Math.max(n.nextStart,r)):n},i.getMaxBufferLength=function(e){var t=this.config;e=e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength;return Math.min(e,t.maxMaxBufferLength)},i.reduceMaxBufferLength=function(e){var t=this.config;e=e||t.maxBufferLength;return t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},i.getAppendedFrag=function(e,t){return(e=this.fragmentTracker.getAppendedFrag(e,bt))&&"fragment"in e?e.fragment:e},i.getNextFragment=function(e,t){var i=t.fragments,r=i.length;if(!r)return null;var n=this.config,a=i[0].start,s=n.lowLatencyMode&&!!t.partList,o=null;if(t.live){if(r<(n=n.initialLiveManifestSize))return this.warn("Not enough fragments to start playback (have: "+r+", need: "+n+")"),null;(!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||e<a)&&(s&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),o=this.getInitialLiveFragment(t,i),this.startPosition=this.nextLoadPosition=o?this.hls.liveSyncPosition||o.start:e)}else e<=a&&(o=i[0]);return o||(r=this.loadingParts?t.partEnd:t.fragmentEnd,o=this.getFragmentAtPosition(e,r,t)),this.mapToInitFragWhenRequired(o)},i.isLoopLoading=function(e,t){var i=this.fragmentTracker.getState(e);return(i===Ei||i===Si&&!!e.gap)&&this.nextLoadPosition>t},i.getNextFragmentLoopLoading=function(e,t,i,r,n){var a=e.gap;return null===(t=this.getNextFragment(this.nextLoadPosition,t))?t:(e=t,a&&e&&!e.gap&&i.nextStart&&null!==(t=this.getFwdBufferInfoAtPos(this.mediaBuffer||this.media,i.nextStart,r))&&i.len+t.len>=n?(this.log('buffer full after gaps in "'+r+'" playlist starting at sn: '+e.sn),null):e)},i.mapToInitFragWhenRequired=function(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment},i.getNextPart=function(e,t,i){for(var r=-1,n=!1,a=!0,s=0,o=e.length;s<o;s++){var l=e[s];a=a&&!l.independent;if(-1<r&&i<l.start)break;var u=l.loaded;u?r=-1:(n||l.independent||a)&&l.fragment===t&&(r=s),n=u}return r},i.loadedEndOfParts=function(e,t){return(e=e[e.length-1])&&t>e.start&&e.loaded},i.getInitialLiveFragment=function(e,t){var i,r,n=this.fragPrevious,a=null;return n?(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+n.programDateTime),a=function(e,t,i){if(null!==t&&Array.isArray(e)&&e.length&&E(t)){var r=e[0].programDateTime;if(!(t<(r||0)||((r=e[e.length-1].endProgramDateTime)||0)<=t)){i=i||0;for(var n=0;n<e.length;++n){var a=e[n];if(function(e,t,i){return t=1e3*Math.min(t,i.duration+(i.deltaPTS||0)),(i.endProgramDateTime||0)-t>e}(t,i,a))return a}}}return null}(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),a||((i=n.sn+1)>=e.startSN&&i<=e.endSN&&(i=t[i-e.startSN],n.cc===i.cc)&&this.log("Live playlist, switching playlist, load frag with next SN: "+(a=i).sn),!a&&(i=t,r=n.cc,a=ii.search(i,function(e){return e.cc<r?1:e.cc>r?-1:0}))&&this.log("Live playlist, switching playlist, load frag with same CC: "+a.sn))):null!==(t=this.hls.liveSyncPosition)&&(a=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e)),a},i.getFragmentAtPosition=function(e,t,i){var r=this.config,n=this.fragPrevious,a=i.fragments,s=i.endSN,o=i.fragmentHint,l=(r=r.maxFragLookUpTolerance,i.partList),u=!!(this.loadingParts&&null!=l&&l.length&&o);return u&&o&&!this.bitrateTest&&(a=a.concat(o),s=o.sn),(o=e<t?ri(n,a,e,t-r<e?0:r):a[a.length-1])&&(t=o.sn-i.startSN,n=(e=this.fragmentTracker.getState(o))===Ei||e===Si&&o.gap?o:n)&&o.sn===n.sn&&(!u||l[0].fragment.sn>o.sn)&&n&&o.level===n.level&&(r=a[1+t],o=o.sn<s&&this.fragmentTracker.getState(r)!==Ei?r:null),o},i.synchronizeToLiveEdge=function(e){var t,i,r,n,a=this.config,s=this.media;s&&(t=this.hls.liveSyncPosition,i=s.currentTime,n=e.fragments[0].start,r=e.edge,n=i>=n-a.maxFragLookUpTolerance&&i<=r,null!==t)&&s.duration>t&&(i<t||!n)&&(a=void 0!==a.liveMaxLatencyDuration?a.liveMaxLatencyDuration:a.liveMaxLatencyDurationCount*e.targetduration,!n&&s.readyState<4||i<r-a)&&(this.loadedmetadata||(this.nextLoadPosition=t),s.readyState)&&(this.warn("Playback: "+i.toFixed(3)+" is located too far from the end of live sliding playlist: "+r+", reset currentTime to : "+t.toFixed(3)),s.currentTime=t)},i.alignPlaylists=function(e,t,i){var r,n,a,s=e.fragments.length;return s?(r=e.fragments[0].start,n=!t,a=e.alignedSliding&&E(r),n||!a&&!r?(function(e,t,i){var r,n;t&&(function(e,t,i){return!(!t||!(i.endCC>i.startCC||e&&e.cc<i.startCC))}(e=e,n=t,r=i)&&(e=function(e,t){if(e=e.fragments,(t=t.fragments).length&&e.length){if((e=Pi(e,t[0].cc))&&e.startPTS)return e;B.log("No frag in previous level to align on")}else B.log("No fragments to align")}(n,r))&&E(e.start)&&(B.log("Adjusting PTS using last level due to CC increase within current level "+r.url),Ii(e.start,r)),!i.alignedSliding&&t&&xi(i,t),i.alignedSliding||!t||i.skippedSegments||Wt(t,i))}(n=this.fragPrevious,i,e),a=e.fragments[0].start,this.log("Live playlist sliding: "+a.toFixed(2)+" start-sn: "+(t?t.startSN:"na")+"->"+e.startSN+" prev-sn: "+(n?n.sn:"na")+" fragments: "+s),a):r):(this.warn("No fragments in live playlist"),0)},i.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},i.setStartPosition=function(e,t){var i,r,n=this.startPosition;-1!==(n=n<t?-1:n)&&-1!==this.lastCurrentTime||(null!==(r=((i=null!==this.startTimeOffset)?this:e).startTimeOffset)&&E(r)?(n=t+r,r<0&&(n+=e.totalduration),n=Math.min(Math.max(t,n),t+e.totalduration),this.log("Start time offset "+r+" found in "+(i?"multivariant":"media")+" playlist, adjust startPosition to "+n),this.startPosition=n):e.live?n=this.hls.liveSyncPosition||t:this.startPosition=n=0,this.lastCurrentTime=n),this.nextLoadPosition=n},i.getLoadPosition=function(){var e=this.media,t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t},i.handleFragLoadAborted=function(e,t){this.transmuxer&&"initSegment"!==e.sn&&e.stats.aborted&&(this.warn("Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+" was aborted"),this.resetFragmentLoading(e))},i.resetFragmentLoading=function(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===zi)||(this.state=Ki)},i.onFragmentOrKeyLoadError=function(e,t){t.chunkMeta&&!t.frag&&(i=this.getCurrentContext(t.chunkMeta))&&(t.frag=i.frag);var i=t.frag;if(i&&i.type===e&&this.levels)if(this.fragContextChanged(i))this.warn("Frag load error must match current frag to retry "+i.url+" > "+(null==(r=this.fragCurrent)?void 0:r.url));else{var r=t.details===A.FRAG_GAP,n=(r&&this.fragmentTracker.fragBuffered(i,!0),t.errorAction),a=(o=n||{}).action,s=void 0===(s=o.retryCount)?0:s,o=o.retryConfig;if(n&&5===a&&o){this.resetStartWhenNotLoaded(this.levelLastLoaded);var l=Zt(o,s);this.warn("Fragment "+i.sn+" of "+e+" "+i.level+" errored with "+t.details+", retrying loading "+(s+1)+"/"+o.maxNumRetry+" in "+l+"ms"),n.resolved=!0,this.retryDate=self.performance.now()+l,this.state=zi}else if(o&&n){if(this.resetFragmentErrors(e),!(s<o.maxNumRetry))return void this.warn(t.details+" reached or exceeded max retry ("+s+")");r||3===a||(n.resolved=!0)}else 2===(null==n?void 0:n.action)?this.state=er:this.state=Ji;this.tickImmediate()}},i.reduceLengthAndFlushBuffer=function(e){var t,i,r;return(this.state===Xi||this.state===$i)&&(t=e.parent,(i=(r=this.getFwdBufferInfo(this.mediaBuffer,t))&&.5<r.len)&&this.reduceMaxBufferLength(r.len),(r=!i)&&this.warn("Buffer full error while media.currentTime is not buffered, flush "+t+" buffer"),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),r)},i.resetFragmentErrors=function(e){e===Tt&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Hi&&(this.state=Ki)},i.afterBufferFlushed=function(e,t,i){e&&(e=Ri.getBuffered(e),this.fragmentTracker.detectEvictedFragments(t,e,i),this.state===Qi)&&this.resetLoadingState()},i.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Hi&&(this.state=Ki)},i.resetStartWhenNotLoaded=function(e){this.loadedmetadata||(this.startFragRequested=!1,null!=(e=e?e.details:null)&&e.live?(this.startPosition=-1,this.setStartPosition(e,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition)},i.resetWhenMissingContext=function(e){this.warn("The loading context changed while buffering fragment "+e.sn+" of level "+e.level+". This chunk will not be buffered."),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()},i.removeUnbufferedFrags=function(e){this.fragmentTracker.removeFragmentsInRange(e=void 0===e?0:e,1/0,this.playlistType,!1,!0)},i.updateLevelTiming=function(e,t,i,r){var n=this,a=i.details;if(a){if(!Object.keys(e.elementaryStreams).reduce(function(t,s){var o,l=e.elementaryStreams[s];return l?(o=l.endPTS-l.startPTS)<=0?(n.warn("Could not parse fragment "+e.sn+" "+s+" duration reliably ("+o+")"),t||!1):(o=r?0:qt(a,e,l.startPTS,l.endPTS,l.startDTS,l.endDTS),n.hls.trigger(C.LEVEL_PTS_UPDATED,{details:a,level:i,drift:o,type:s,frag:e,start:l.startPTS,end:l.endPTS}),!0):t},!1)&&null===(null==(s=this.transmuxer)?void 0:s.error)){var s=new Error("Found no media in fragment "+e.sn+" of level "+e.level+" resetting transmuxer to fallback to playlist timing");if(0===i.fragmentError&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(s.message),this.hls.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.FRAG_PARSING_ERROR,fatal:!1,error:s,frag:e,reason:"Found no media in msn "+e.sn+' of level "'+i.url+'"'}),!this.hls)return;this.resetTransmuxer()}this.state=$i,this.hls.trigger(C.FRAG_PARSED,{frag:e,part:t})}else this.warn("level.details undefined")},i.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},i.recoverWorkerError=function(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())},l(t,[{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}])}(_i),function(){function e(){this.chunks=[],this.dataLength=0}var t=e.prototype;return t.push=function(e){this.chunks.push(e),this.dataLength+=e.length},t.flush=function(){var e=this.chunks,t=this.dataLength;return e.length?(e=1===e.length?e[0]:function(e,t){for(var i=new Uint8Array(t),r=0,n=0;n<e.length;n++){var a=e[n];i.set(a,r),r+=a.length}return i}(e,t),this.reset(),e):new Uint8Array(0)},t.reset=function(){this.chunks.length=0,this.dataLength=0},e}());function ir(e,t){return{type:e=void 0===e?"":e,id:-1,pid:-1,inputTimeScale:t=void 0===t?9e4:t,sequenceNumber:-1,samples:[],dropped:0}}var rr=function(){function e(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var t=e.prototype;return t.resetInitSegment=function(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},t.resetTimeStamp=function(e){this.initPTS=e,this.resetContiguity()},t.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},t.canParse=function(e,t){return!1},t.appendFrame=function(e,t,i){},t.demux=function(e,t){this.cachedData&&(e=Ue(this.cachedData,e),this.cachedData=null);var i,r,n,a=le(e,0),s=a?a.length:0,o=this._audioTrack,l=this._id3Track,u=a?ue(a):void 0,c=e.length;for((null===this.basePTS||0===this.frameIndex&&E(u))&&(this.basePTS=nr(u,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),a&&0<a.length&&l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Dt,duration:Number.POSITIVE_INFINITY});s<c;)this.canParse(e,s)?(r=this.appendFrame(o,e,s))?(this.frameIndex++,this.lastPTS=r.sample.pts,i=s+=r.length):s=c:se(r=e,n=s)&&me(r,n+6)+10<=r.length-n?(a=le(e,s),l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:Dt,duration:Number.POSITIVE_INFINITY}),i=s+=a.length):s++,s===c&&i!==c&&(n=ae(e,i),this.cachedData?this.cachedData=Ue(this.cachedData,n):this.cachedData=n);return{audioTrack:o,videoTrack:ir(),id3Track:l,textTrack:ir()}},t.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},t.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:ir(),id3Track:this._id3Track,textTrack:ir()}},t.destroy=function(){},e}(),nr=function(e,t,i){return E(e)?90*e:9e4*t+(i?9e4*i.baseTime/i.timescale:0)};function ar(e,t){return 255===e[t]&&240==(246&e[t+1])}function sr(e,t){return 1&e[t+1]?7:9}function or(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function lr(e,t){return t+1<e.length&&ar(e,t)}function ur(e,t,i,r,n){e.samplerate||(t=function(e,t,i,r){var n,a,s,o=navigator.userAgent.toLowerCase(),l=r,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],c=n=1+((192&t[i+2])>>>6),d=(60&t[i+2])>>>2;if(!(u.length-1<d))return a=(1&t[i+2])<<2,a|=(192&t[i+3])>>>6,B.log("manifest codec:"+r+", ADTS type:"+c+", samplingIndex:"+d),t=/firefox|palemoon/i.test(o)?6<=d?(c=5,s=new Array(4),d-3):(c=2,s=new Array(2),d):-1!==o.indexOf("android")?(c=2,s=new Array(2),d):(c=5,s=new Array(4),r&&(-1!==r.indexOf("mp4a.40.29")||-1!==r.indexOf("mp4a.40.5"))||!r&&6<=d?d-3:((r&&-1!==r.indexOf("mp4a.40.2")&&(6<=d&&1==a||/vivaldi/i.test(o))||!r&&1==a)&&(c=2,s=new Array(2)),d)),s[0]=c<<3,s[0]|=(14&d)>>1,s[1]|=(1&d)<<7,s[1]|=a<<3,5===c&&(s[1]|=(14&t)>>1,s[2]=(1&t)<<7,s[2]|=8,s[3]=0),{config:s,samplerate:u[d],channelCount:a,codec:"mp4a.40."+c,parsedCodec:"mp4a.40."+n,manifestCodec:l};i=new Error("invalid ADTS sampling index:"+d),e.emit(C.ERROR,C.ERROR,{type:L.MEDIA_ERROR,details:A.FRAG_PARSING_ERROR,fatal:!0,error:i,reason:i.message})}(t,i,r,n))&&(e.config=t.config,e.samplerate=t.samplerate,e.channelCount=t.channelCount,e.codec=t.codec,e.manifestCodec=t.manifestCodec,e.parsedCodec=t.parsedCodec,B.log("parsed codec:"+e.parsedCodec+", codec:"+e.codec+", rate:"+t.samplerate+", channels:"+t.channelCount))}function cr(e){return 9216e4/e}function dr(e,t,i,r,n){var a,s,o;r+=n*cr(e.samplerate);return(n=function(e,t){var i=sr(e,t);if(t+i<=e.length&&0<(e=or(e,t)-i))return{headerLength:i,frameLength:e}}(t,i))?(a=n.frameLength,a=(n=n.headerLength)+a,(s=Math.max(0,i+a-t.length))?(o=new Uint8Array(a-n)).set(t.subarray(i+n,t.length),0):o=t.subarray(i+n,i+a),n={unit:o,pts:r},s||e.samples.push(n),{sample:n,length:a,missing:s}):(e=t.length-i,(o=new Uint8Array(e)).set(t.subarray(i,t.length),0),{sample:{unit:o,pts:r},length:e,missing:-1})}var hr=null,fr=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],pr=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],mr=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],gr=[0,1,1,4];function vr(e,t,i,r,n){var a;return!(i+24>t.length)&&(a=yr(t,i))&&i+a.frameLength<=t.length?(r+=n*(9e4*a.samplesPerFrame/a.sampleRate),n={unit:t.subarray(i,i+a.frameLength),pts:r,dts:r},e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(n),{sample:n,length:a.frameLength,missing:0}):void 0}function yr(e,t){var i,r,n,a,s,o=e[t+1]>>3&3,l=e[t+1]>>1&3,u=e[t+2]>>4&15,c=e[t+2]>>2&3;if(1!=o&&0!=u&&15!=u&&3!=c)return s=e[t+2]>>1&1,i=e[t+3]>>6,u=1e3*fr[14*(3==o?3-l:3==l?3:4)+u-1],c=pr[3*(3==o?0:2==o?1:2)+c],r=3==i?1:2,a=8*(o=mr[o][l])*(n=gr[l]),o=Math.floor(o*u/c+s)*n,null===hr&&(s=(navigator.userAgent||"").match(/Chrome\/(\d+)/i),hr=s?parseInt(s[1]):0),!!hr&&hr<=87&&2==l&&224e3<=u&&0==i&&(e[t+3]=128|e[t+3]),{sampleRate:c,channelCount:r,frameLength:o,samplesPerFrame:a}}function _r(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function br(e,t){return t+1<e.length&&_r(e,t)}function Tr(e,t){var i;if(t+1<e.length&&_r(e,t))return i=4,(t+=i=null!=(t=yr(e,t))&&t.frameLength?t.frameLength:i)===e.length||br(e,t)}function Sr(e,t){for(var i=0,r=5,n=(t+=r,new Uint32Array(1)),a=new Uint32Array(1),s=new Uint8Array(1);0<r;){s[0]=e[t];var o=Math.min(r,8),l=8-o;a[0]=4278190080>>>24+l<<l,n[0]=(s[0]&a[0])>>l,i=i?i<<o|n[0]:n[0],t+=1,r-=o}return i}var Er=function(e){function t(t,i){var r=e.call(this)||this;return r.observer=void 0,r.config=void 0,r.observer=t,r.config=i,r}c(t,e);var i=t.prototype;return i.resetInitSegment=function(t,i,r,n){e.prototype.resetInitSegment.call(this,t,i,r,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:i,duration:n,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(e){var t=le(e,0),i=(null==t?void 0:t.length)||0;if(!Tr(e,i))for(var r,n,a,s,o=e.length;i<o;i++)if(s=a=void 0,!lr(r=e,n=i)||n+(s=sr(r,n))>=r.length?void 0:!((a=or(r,n))<=s)&&((s=n+a)===r.length||lr(r,s)))return B.log("ADTS sync word found !"),!0}return!1},i.canParse=function(e,t){return(t=t)+5<(e=e).length&&ar(e,t)&&or(e,t)<=e.length-t},i.appendFrame=function(e,t,i){if(ur(e,this.observer,t,i,e.manifestCodec),(e=dr(e,t,i,this.basePTS,this.frameIndex))&&0===e.missing)return e},t}(rr),kr=/\/emsg[-/]ID3/i,wr=function(){function e(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}var t=e.prototype;return t.resetTimeStamp=function(){},t.resetInitSegment=function(e,t,i,r){var n,a,s,o=this.videoTrack=ir("video",1),l=this.audioTrack=ir("audio",1),u=this.txtTrack=ir("text",1);this.id3Track=ir("id3",1),this.timeOffset=0,null!=e&&e.byteLength&&((e=De(e)).video&&(n=(s=e.video).id,a=s.timescale,s=s.codec,o.id=n,o.timescale=u.timescale=a,o.codec=s),e.audio&&(a=(n=e.audio).id,s=n.timescale,e=n.codec,l.id=a,l.timescale=s,l.codec=e),u.id=Ee.text,o.sampleDuration=0,o.duration=l.duration=r)},t.resetContiguity=function(){this.remainderData=null},e.probe=function(e){for(var t=e,i=t.byteLength,r=0;r<i;){var n=Ce(t,r);if(8<n&&109===t[r+4]&&111===t[r+5]&&111===t[r+6]&&102===t[r+7])return!0;r=1<n?r+n:i}return!1},t.demux=function(e,t){this.timeOffset=t;var i,r=e,n=this.videoTrack,a=this.txtTrack,s=(this.config.progressive?(this.remainderData&&(r=Ue(this.remainderData,e)),e={valid:null,remainder:null},(s=Pe(i=r,["moof"])).length<2?e.remainder=i:(s=s[s.length-1],e.valid=ae(i,0,s.byteOffset-8),e.remainder=ae(i,s.byteOffset-8)),i=e,this.remainderData=i.remainder,n.samples=i.valid||new Uint8Array):n.samples=r,this.extractID3Track(n,t));return a.samples=Be(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}},t.flush=function(){var e=this.timeOffset,t=this.videoTrack,i=this.txtTrack,r=(t.samples=this.remainderData||new Uint8Array,this.remainderData=null,this.extractID3Track(t,this.timeOffset));return i.samples=Be(e,t),{videoTrack:t,audioTrack:ir(),id3Track:r,textTrack:ir()}},t.extractID3Track=function(e,t){var i=this.id3Track;return e.samples.length&&(e=Pe(e.samples,["emsg"]))&&e.forEach(function(e){var r,n;e=function(e){var t="",i="",r=0,n=0,a=0,s=0,o=0,l=0;if(0===(u=e[0])){for(;"\0"!==ke(e.subarray(l,l+1));)t+=ke(e.subarray(l,l+1)),l+=1;for(t+=ke(e.subarray(l,l+1)),l+=1;"\0"!==ke(e.subarray(l,l+1));)i+=ke(e.subarray(l,l+1)),l+=1;i+=ke(e.subarray(l,l+1)),l+=1,r=Ce(e,12),n=Ce(e,16),s=Ce(e,20),o=Ce(e,24),l=28}else if(1===u){r=Ce(e,l+=4);var u=Ce(e,l+=4),c=Ce(e,l+=4);for(l+=4,a=Math.pow(2,32)*u+c,k(a)||(a=Number.MAX_SAFE_INTEGER,B.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),s=Ce(e,l),o=Ce(e,l+=4),l+=4;"\0"!==ke(e.subarray(l,l+1));)t+=ke(e.subarray(l,l+1)),l+=1;for(t+=ke(e.subarray(l,l+1)),l+=1;"\0"!==ke(e.subarray(l,l+1));)i+=ke(e.subarray(l,l+1)),l+=1;i+=ke(e.subarray(l,l+1)),l+=1}return{schemeIdUri:t,value:i,timeScale:r,presentationTime:a,presentationTimeDelta:n,eventDuration:s,id:o,payload:e.subarray(l,e.byteLength)}}(e);kr.test(e.schemeIdUri)&&(r=E(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale,(n=4294967295===e.eventDuration?Number.POSITIVE_INFINITY:e.eventDuration/e.timeScale)<=.001&&(n=Number.POSITIVE_INFINITY),e=e.payload,i.samples.push({data:e,len:e.byteLength,dts:r,pts:r,type:It,duration:n}))}),i},t.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},t.destroy=function(){},e}(),Cr=function(e){function t(t){var i=e.call(this)||this;return i.observer=void 0,i.observer=t,i}c(t,e);var i=t.prototype;return i.resetInitSegment=function(t,i,r,n){e.prototype.resetInitSegment.call(this,t,i,r,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:i,duration:n,inputTimeScale:9e4,dropped:0}},i.canParse=function(e,t){return t+64<e.length},i.appendFrame=function(e,t,i){if(-1!==(t=Lr(e,t,i,this.basePTS,this.frameIndex)))return{sample:e.samples[e.samples.length-1],length:t,missing:0}},t.probe=function(e){var t,i;return!!e&&!!(t=le(e,0))&&11===e[i=t.length]&&119===e[i+1]&&void 0!==ue(t)&&Sr(e,i)<16},t}(rr);function Lr(e,t,i,r,n){var a,s,o,l,u,c,d,h,f;return i+8>t.length||11!==t[i]||119!==t[i+1]||3<=(d=t[i+4]>>6)||(a=[48e3,44100,32e3][d],i+(o=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*(s=63&t[i+4])+d])>t.length)?-1:(u=0,(2==(l=t[i+6]>>5)||(1&l&&1!=l&&(u+=2),4&l))&&(u+=2),u=(t[i+6]<<8|t[i+7])>>12-u&1,c=[2,1,2,3,3,4,4,5][l]+u,h=t[i+5]>>3,f=7&t[i+5],d=new Uint8Array([d<<6|h<<1|f>>2,(3&f)<<6|l<<3|u<<2|s>>4,s<<4&224]),h=r+n*(1536/a*9e4),f=t.subarray(i,i+o),e.config=d,e.channelCount=c,e.samplerate=a,e.samples.push({unit:f,pts:h}),o)}var Ar=function(){function e(){this.VideoSample=null}var t=e.prototype;return t.createVideoSample=function(e,t,i,r){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:r,length:0}},t.getLastNalUnit=function(e){var t,i=this.VideoSample;return null!=(i=i&&0!==i.units.length?i:e[e.length-1])&&i.units?(e=i.units)[e.length-1]:t},t.pushAccessUnit=function(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var i=t.samples,r=i.length;if(!r)return void t.dropped++;i=i[r-1],e.pts=i.pts,e.dts=i.dts}t.samples.push(e)}e.debug.length&&B.log(e.pts+"/"+e.dts+":"+e.debug)},t.parseNALu=function(e,t){var i,r=t.byteLength,n=d=e.naluState||0,a=[],s=0,o=-1,l=0;for(-1===d&&(l=this.getNALuType(t,o=0),d=0,s=1);s<r;){var u,c,d,h=t[s++];d=d?1===d?h?0:2:h?1===h?(c=s-d-1,0<=o?(u={data:t.subarray(o,c),type:l},a.push(u)):(u=this.getLastNalUnit(e.samples))&&(n&&s<=4-n&&u.state&&(u.data=u.data.subarray(0,u.data.byteLength-n)),0<c)&&(u.data=Ue(u.data,t.subarray(0,c)),u.state=0),s<r?(o=s,l=this.getNALuType(t,s),0):-1):0:3:h?0:1}return 0<=o&&0<=d&&(i={data:t.subarray(o,r),type:l,state:d},a.push(i)),0===a.length&&(i=this.getLastNalUnit(e.samples))&&(i.data=Ue(i.data,t)),e.naluState=d,a},e}(),Rr=function(){function e(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4);if(0===(t=Math.min(4,t)))throw new Error("no bytes available");r.set(e.subarray(i,i+t)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*t,this.bytesAvailable-=t},t.skipBits=function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e||(e=(e-=this.bitsAvailable)-((t=e>>3)<<3),this.bytesAvailable-=t,this.loadWord()),this.word<<=e,this.bitsAvailable-=e},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;if(32<e&&B.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,0<this.bitsAvailable)this.word<<=t;else{if(!(0<this.bytesAvailable))throw new Error("no bits available");this.loadWord()}return 0<(t=e-t)&&this.bitsAvailable?i<<t|this.readBits(t):i},t.skipLZ=function(){for(var e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},e}(),Pr=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var i=t.prototype;return i.parsePES=function(e,t,i,r,n){var a,s=this,o=this.parseNALu(e,i.data),l=this.VideoSample,u=!1;i.data=null,l&&o.length&&!e.audFound&&(this.pushAccessUnit(l,e),l=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"")),o.forEach(function(r){switch(r.type){case 1:var o=!1,c=(a=!0,r.data);u&&4<c.length&&(2!==(c=s.readSliceType(c))&&4!==c&&7!==c&&9!==c||(o=!0)),o&&null!=l&&l.frame&&!l.key&&(s.pushAccessUnit(l,e),l=s.VideoSample=null),(l=l||(s.VideoSample=s.createVideoSample(!0,i.pts,i.dts,""))).frame=!0,l.key=o;break;case 5:a=!0,null!=l&&l.frame&&!l.key&&(s.pushAccessUnit(l,e),l=s.VideoSample=null),(l=l||(s.VideoSample=s.createVideoSample(!0,i.pts,i.dts,""))).key=!0,l.frame=!0;break;case 6:a=!0,Ne(r.data,1,i.pts,t.samples);break;case 7:u=a=!0;var d;c=r.data,o=s.readSPS(c);if(!e.sps||e.width!==o.width||e.height!==o.height||(null==(d=e.pixelRatio)?void 0:d[0])!==o.pixelRatio[0]||(null==(d=e.pixelRatio)?void 0:d[1])!==o.pixelRatio[1]){e.width=o.width,e.height=o.height,e.pixelRatio=o.pixelRatio,e.sps=[c],e.duration=n;for(var h=c.subarray(1,4),f="avc1.",p=0;p<3;p++){var m=h[p].toString(16);f+=m=m.length<2?"0"+m:m}e.codec=f}break;case 8:a=!0,e.pps=[r.data];break;case 9:a=!0,e.audFound=!0,l&&s.pushAccessUnit(l,e),l=s.VideoSample=s.createVideoSample(!1,i.pts,i.dts,"");break;case 12:a=!0;break;default:a=!1,l&&(l.debug+="unknown NAL "+r.type+" ")}l&&a&&l.units.push(r)}),r&&l&&(this.pushAccessUnit(l,e),this.VideoSample=null)},i.getNALuType=function(e,t){return 31&e[t]},i.readSliceType=function(e){return(e=new Rr(e)).readUByte(),e.readUEG(),e.readUEG()},i.skipScalingList=function(e,t){for(var i=8,r=8,n=0;n<e;n++)i=0===(r=0!==r?(i+t.readEG()+256)%256:r)?i:r},i.readSPS=function(e){var t,i,r,n=new Rr(e),a=(e=0,0),s=0,o=0,l=n.readUByte.bind(n),u=n.readBits.bind(n),c=n.readUEG.bind(n),d=n.readBoolean.bind(n),h=n.skipBits.bind(n),f=n.skipEG.bind(n),p=n.skipUEG.bind(n),m=this.skipScalingList.bind(this),g=(l(),l());if(u(5),h(3),l(),p(),(100===g||110===g||122===g||244===g||44===g||83===g||86===g||118===g||128===g)&&(3===(g=c())&&h(1),p(),p(),h(1),d()))for(i=3!==g?8:12,r=0;r<i;r++)d()&&m(r<6?16:64,n);if(p(),0===(g=c()))c();else if(1===g)for(h(1),f(),f(),t=c(),r=0;r<t;r++)f();p(),h(1);g=c(),p=c();var v=(0===(u=u(1))&&h(1),h(1),d()&&(e=c(),a=c(),s=c(),o=c()),[1,1]);if(d()&&d())switch(l()){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:v=[l()<<8|l(),l()<<8|l()]}return{width:Math.ceil(16*(g+1)-2*e-2*a),height:(2-u)*(p+1)*16-(u?2:4)*(s+o),pixelRatio:v}},t}(Ar),Dr=function(e){function t(){for(var t,i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];return(t=e.call.apply(e,[this].concat(r))||this).initVPS=null,t}c(t,e);var r=t.prototype;return r.parsePES=function(e,t,r,a,s){var o,l=this,u=this.parseNALu(e,r.data),c=this.VideoSample,d=!1;r.data=null,c&&u.length&&!e.audFound&&(this.pushAccessUnit(c,e),c=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"")),u.forEach(function(a){var u;switch(a.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:(c=c||(l.VideoSample=l.createVideoSample(!1,r.pts,r.dts,""))).frame=!0,o=!0;break;case 16:case 17:case 18:case 21:o=!0,d&&null!=c&&c.frame&&!c.key&&(l.pushAccessUnit(c,e),c=l.VideoSample=null),(c=c||(l.VideoSample=l.createVideoSample(!0,r.pts,r.dts,""))).key=!0,c.frame=!0;break;case 19:case 20:o=!0,null!=c&&c.frame&&!c.key&&(l.pushAccessUnit(c,e),c=l.VideoSample=null),(c=c||(l.VideoSample=l.createVideoSample(!0,r.pts,r.dts,""))).key=!0,c.frame=!0;break;case 39:o=!0,Ne(a.data,2,r.pts,t.samples);break;case 32:o=!0,e.vps||(u=l.readVPS(a.data),e.params=i({},u),l.initVPS=a.data),e.vps=[a.data];break;case 33:if(d=o=!0,"object"===n(e.params)){if(void 0===e.vps||e.vps[0]===l.initVPS||void 0===e.sps||l.matchSPS(e.sps[0],a.data)||(l.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){var h,f=l.readSPS(a.data);for(h in e.width=f.width,e.height=f.height,e.pixelRatio=f.pixelRatio,e.duration=s,e.codec=f.codecString,e.sps=[],f.params)e.params[h]=f.params[h]}void 0!==e.vps&&e.vps[0]===l.initVPS&&e.sps.push(a.data)}(c=c||(l.VideoSample=l.createVideoSample(!0,r.pts,r.dts,""))).key=!0;break;case 34:if(o=!0,"object"===n(e.params)){if(!e.pps){e.pps=[];var p,m=l.readPPS(a.data);for(p in m)e.params[p]=m[p]}null===l.initVPS&&0!==e.pps.length||e.pps.push(a.data)}break;case 35:o=!0,e.audFound=!0,c&&l.pushAccessUnit(c,e),c=l.VideoSample=l.createVideoSample(!1,r.pts,r.dts,"");break;default:o=!1,c&&(c.debug+="unknown or irrelevant NAL "+a.type+" ")}c&&o&&c.units.push(a)}),a&&c&&(this.pushAccessUnit(c,e),this.VideoSample=null)},r.getNALuType=function(e,t){return(126&e[t])>>>1},r.ebsp2rbsp=function(e){for(var t=new Uint8Array(e.byteLength),i=0,r=0;r<e.byteLength;r++)2<=r&&3===e[r]&&0===e[r-1]&&0===e[r-2]||(t[i]=e[r],i++);return new Uint8Array(t.buffer,0,i)},r.readVPS=function(e){return(e=new Rr(e)).readUByte(),e.readUByte(),e.readBits(4),e.skipBits(2),e.readBits(6),{numTemporalLayers:e.readBits(3)+1,temporalIdNested:e.readBoolean()}},r.readSPS=function(e){for(var t=new Rr(this.ebsp2rbsp(e)),i=(t.readUByte(),t.readUByte(),t.readBits(4),t.readBits(3)),r=(e=(t.readBoolean(),t.readBits(2)),t.readBoolean()),n=t.readBits(5),a=t.readUByte(),s=t.readUByte(),o=t.readUByte(),l=t.readUByte(),u=t.readUByte(),c=t.readUByte(),d=t.readUByte(),h=t.readUByte(),f=t.readUByte(),p=t.readUByte(),m=t.readUByte(),g=[],v=[],y=0;y<i;y++)g.push(t.readBoolean()),v.push(t.readBoolean());if(0<i)for(var _=i;_<8;_++)t.readBits(2);for(var b=0;b<i;b++)g[b]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),v[b]&&t.readUByte();t.readUEG();for(var T=t.readUEG(),S=(3==T&&t.skipBits(1),t.readUEG()),E=t.readUEG(),k=t.readBoolean(),w=0,C=0,L=0,A=0,R=(k&&(w+=t.readUEG(),C+=t.readUEG(),L+=t.readUEG(),A+=t.readUEG()),t.readUEG()),P=t.readUEG(),D=t.readUEG(),I=t.readBoolean()?0:i;I<=i;I++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),(J=t.readBoolean())&&t.readBoolean())for(var x=0;x<4;x++)for(var O=0;O<(3===x?2:6);O++)if(t.readBoolean()){var M=Math.min(64,1<<4+(x<<1));1<x&&t.readEG();for(var U=0;U<M;U++)t.readEG()}else t.readUEG();t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());for(var B=t.readUEG(),N=0,F=0;F<B;F++){var j=!1;if(j=0!==F?t.readBoolean():j){F===B&&t.readUEG(),t.readBoolean(),t.readUEG();for(var G=0,V=0;V<=N;V++){var H=t.readBoolean(),K=!1;H||(K=t.readBoolean()),(H||K)&&G++}N=G}else{for(var q=t.readUEG(),W=t.readUEG(),z=(N=q+W,0);z<q;z++)t.readUEG(),t.readBoolean();for(var Y=0;Y<W;Y++)t.readUEG(),t.readBoolean()}}if(t.readBoolean())for(var X=t.readUEG(),$=0;$<X;$++){for(var Q=0;Q<D+4;Q++)t.readBits(1);t.readBits(1)}var J=0,Z=1,ee=1,te=!0,ie=1,re=0,ne=(t.readBoolean(),t.readBoolean(),!1);if(t.readBoolean()){if(t.readBoolean()&&(0<(fe=t.readUByte())&&fe<16?(Z=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][fe-1],ee=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][fe-1]):255===fe&&(Z=t.readBits(16),ee=t.readBits(16))),t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean())&&(t.readUByte(),t.readUByte(),t.readUByte()),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),(ne=t.readBoolean())&&(w+=t.readUEG(),C+=t.readUEG(),L+=t.readUEG(),A+=t.readUEG()),t.readBoolean()&&(ie=t.readBits(32),re=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){var ae=t.readBoolean(),se=t.readBoolean(),oe=!1;(ae||se)&&((oe=t.readBoolean())&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),oe&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(var le=0;le<=i;le++){var ue=!1,ce=((te=t.readBoolean())||t.readBoolean()?t.readEG():ue=t.readBoolean(),ue?1:t.readUEG()+1);if(ae)for(var de=0;de<ce;de++)t.readUEG(),t.readUEG(),oe&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(se)for(var he=0;he<ce;he++)t.readUEG(),t.readUEG(),oe&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),J=t.readUEG())}for(var fe=S,pe=E,me=(S=((k||ne)&&((ne=k=1)===T?k=ne=2:2==T&&(k=2),fe=S-k*C-k*w,pe=E-ne*A-ne*L),e?["A","B","C"][e]:""),a<<24|s<<16|o<<8|l),ge=0,ve=0;ve<32;ve++)ge=(ge|(me>>ve&1)<<31-ve)>>>0;return C=ge.toString(16),{codecString:"hvc1."+S+n+"."+(C=1===n&&"2"===C?"6":C)+"."+(r?"H":"L")+m+".B0",params:{general_tier_flag:r,general_profile_idc:n,general_profile_space:e,general_profile_compatibility_flags:[a,s,o,l],general_constraint_indicator_flags:[u,c,d,h,f,p],general_level_idc:m,bit_depth:R+8,bit_depth_luma_minus8:R,bit_depth_chroma_minus8:P,min_spatial_segmentation_idc:J,chroma_format_idc:T,frame_rate:{fixed:te,fps:re/ie}},width:fe,height:pe,pixelRatio:[Z,ee]}},r.readPPS=function(e){(e=new Rr(this.ebsp2rbsp(e))).readUByte(),e.readUByte(),e.skipUEG(),e.skipUEG(),e.skipBits(2),e.skipBits(3),e.skipBits(2),e.skipUEG(),e.skipUEG(),e.skipEG(),e.skipBits(2),e.readBoolean()&&e.skipUEG(),e.skipEG(),e.skipEG(),e.skipBits(4);var t=e.readBoolean(),i=1;return(e=e.readBoolean())&&t?i=0:e?i=3:t&&(i=2),{parallelismType:i}},r.matchSPS=function(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)},t}(Ar),Ir=function(){function e(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Vi(t,{removePKCS7Padding:!1})}var t=e.prototype;return t.decryptBuffer=function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Y)},t.decryptAacSample=function(e,t,i){var r,n=this,a=e[t].unit;a.length<=16||(r=(r=a.subarray(16,a.length-a.length%16)).buffer.slice(r.byteOffset,r.byteOffset+r.length),this.decryptBuffer(r).then(function(r){r=new Uint8Array(r),a.set(r,16),n.decrypter.isSync()||n.decryptAacSamples(e,t+1,i)}))},t.decryptAacSamples=function(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,i),this.decrypter.isSync())))return}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),r=0,n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i},t.getAvcDecryptedUnit=function(e,t){for(var i=new Uint8Array(t),r=0,n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e},t.decryptAvcSample=function(e,t,i,r,n){var a=this,s=Fe(n.data),o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then(function(o){n.data=a.getAvcDecryptedUnit(s,o),a.decrypter.isSync()||a.decryptAvcSamples(e,t,i+1,r)})},t.decryptAvcSamples=function(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void r();for(var n=e[t].units;!(i>=n.length);i++){var a=n[i];if(!(a.data.length<=48||1!==a.type&&5!==a.type||(this.decryptAvcSample(e,t,i,r,a),this.decrypter.isSync())))return}}},e}(),xr=188;Ar=function(){function e(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.videoParser=null}e.probe=function(t){return 0<(t=e.syncOffset(t))&&B.warn("MPEG2-TS detected but first sync word found @ offset "+t),-1!==t},e.syncOffset=function(e){for(var t=e.length,i=Math.min(940,t-xr)+1,r=0;r<i;){for(var n=!1,a=-1,s=0,o=r;o<t;o+=xr){if(71!==e[o]||t-o!=xr&&71!==e[o+xr]){if(s)return-1;break}if(s++,-1===a&&0!==(a=o)&&(i=Math.min(a+18612,e.length-xr)+1),(n=n||0===Or(e,o))&&1<s&&(0===a&&2<s||i<o+xr))return a}r++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Ee[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}};var t=e.prototype;return t.resetInitSegment=function(t,i,r,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._audioTrack=e.createTrack("audio",n),this._id3Track=e.createTrack("id3"),this._txtTrack=e.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=i,this.videoCodec=r,this._duration=n},t.resetTimeStamp=function(){},t.resetContiguity=function(){var e=this._audioTrack,t=this._videoTrack,i=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null},t.demux=function(t,i,r,n){void 0===n&&(n=!1),(r=void 0!==r&&r)||(this.sampleAes=null);var a,s=this._videoTrack,o=this._audioTrack,l=this._id3Track,u=this._txtTrack,c=s.pid,d=s.pesData,h=o.pid,f=l.pid,p=o.pesData,m=l.pesData,g=null,v=this.pmtParsed,y=this._pmtId,_=t.length;if(this.remainderData&&(_=(t=Ue(this.remainderData,t)).length,this.remainderData=null),_<xr&&!n)return this.remainderData=t,{audioTrack:o,videoTrack:s,id3Track:l,textTrack:u};for(var b,T=Math.max(0,e.syncOffset(t)),S=((_-=(_-T)%xr)<t.byteLength&&!n&&(this.remainderData=new Uint8Array(t.buffer,_,t.buffer.byteLength-_)),0),E=T;E<_;E+=xr)if(71===t[E]){var k=!!(64&t[E+1]),w=Or(t,E),R=void 0;if(1<(48&t[E+3])>>4){if((R=E+5+t[E+4])===E+xr)continue}else R=E+4;switch(w){case c:if(k){if(d&&(a=Ur(d))){if(null===this.videoParser)switch(s.segmentCodec){case"avc":this.videoParser=new Pr;break;case"hevc":this.videoParser=new Dr}null!==this.videoParser&&this.videoParser.parsePES(s,u,a,!1,this._duration)}d={data:[],size:0}}d&&(d.data.push(t.subarray(R,E+xr)),d.size+=E+xr-R);break;case h:if(k){if(p&&(a=Ur(p)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,a);break;case"mp3":this.parseMPEGPES(o,a);break;case"ac3":this.parseAC3PES(o,a)}p={data:[],size:0}}p&&(p.data.push(t.subarray(R,E+xr)),p.size+=E+xr-R);break;case f:k&&(m&&(a=Ur(m))&&this.parseID3PES(l,a),m={data:[],size:0}),m&&(m.data.push(t.subarray(R,E+xr)),m.size+=E+xr-R);break;case 0:k&&(R+=t[R]+1),y=this._pmtId=(31&(P=t)[(b=R)+10])<<8|P[b+11];break;case y:k&&(R+=t[R]+1);var P=function(e,t,i,r){var n={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<a;){var s=Or(e,t),o=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!r){Mr("ADTS AAC");break}case 15:-1===n.audioPid&&(n.audioPid=s);break;case 21:-1===n.id3Pid&&(n.id3Pid=s);break;case 219:if(!r){Mr("H.264");break}case 27:-1===n.videoPid&&(n.videoPid=s,n.segmentVideoCodec="avc");break;case 3:case 4:i.mpeg||i.mp3?-1===n.audioPid&&(n.audioPid=s,n.segmentAudioCodec="mp3"):B.log("MPEG audio found, not supported in this browser");break;case 193:if(!r){Mr("AC-3");break}case 129:i.ac3?-1===n.audioPid&&(n.audioPid=s,n.segmentAudioCodec="ac3"):B.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===n.audioPid&&0<o)for(var l=t+5,u=o;2<u;){106===e[l]&&(!0!==i.ac3?B.log("AC-3 audio found, not supported in this browser for now"):(n.audioPid=s,n.segmentAudioCodec="ac3"));var c=e[l+1]+2;l+=c,u-=c}break;case 194:case 135:B.warn("Unsupported EC-3 in M2TS found");break;case 36:-1===n.videoPid&&(n.videoPid=s,n.segmentVideoCodec="hevc",B.log("HEVC in M2TS found"))}t+=5+o}return n}(t,R,this.typeSupported,r);0<(c=P.videoPid)&&(s.pid=c,s.segmentCodec=P.segmentVideoCodec),0<(h=P.audioPid)&&(o.pid=h,o.segmentCodec=P.segmentAudioCodec),0<(f=P.id3Pid)&&(l.pid=f),null===g||v||(B.warn("MPEG-TS PMT found at "+E+" after unknown PID '"+g+"'. Backtracking to sync byte @"+T+" to parse all TS packets."),g=null,E=T-188),v=this.pmtParsed=!0;break;case 17:case 8191:break;default:g=w}}else S++;0<S&&(D=new Error("Found "+S+" TS packet/s that do not start with 0x47"),this.observer.emit(C.ERROR,C.ERROR,{type:L.MEDIA_ERROR,details:A.FRAG_PARSING_ERROR,fatal:!1,error:D,reason:D.message})),s.pesData=d,o.pesData=p,l.pesData=m;var D={audioTrack:o,videoTrack:s,id3Track:l,textTrack:u};return n&&this.extractRemainingSamples(D),D},t.flush=function(){var e=this.remainderData;return this.remainderData=null,e=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},t.extractRemainingSamples=function(e){var t,i=e.audioTrack,r=e.videoTrack,n=e.id3Track,a=(e=e.textTrack,r.pesData),s=i.pesData,o=n.pesData;if(a&&(t=Ur(a))){if(null===this.videoParser)switch(r.segmentCodec){case"avc":this.videoParser=new Pr;break;case"hevc":this.videoParser=new Dr}null!==this.videoParser&&(this.videoParser.parsePES(r,e,t,!0,this._duration),r.pesData=null)}else r.pesData=a;if(s&&(t=Ur(s))){switch(i.segmentCodec){case"aac":this.parseAACPES(i,t);break;case"mp3":this.parseMPEGPES(i,t);break;case"ac3":this.parseAC3PES(i,t)}i.pesData=null}else null!=s&&s.size&&B.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=s;o&&(t=Ur(o))?(this.parseID3PES(n,t),n.pesData=null):n.pesData=o},t.demuxSampleAes=function(e,t,i){return e=this.demux(e,i,!0,!this.config.progressive),i=this.sampleAes=new Ir(this.observer,this.config,t),this.decrypt(e,i)},t.decrypt=function(e,t){return new Promise(function(i){var r=e.audioTrack,n=e.videoTrack;r.samples&&"aac"===r.segmentCodec?t.decryptAacSamples(r.samples,0,function(){n.samples?t.decryptAvcSamples(n.samples,0,0,function(){i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,function(){i(e)})})},t.destroy=function(){this._duration=0},t.parseAACPES=function(e,t){var i,r,n=0,a=this.aacOverFlow,s=t.data;for(a&&(this.aacOverFlow=null,o=a.missing,l=a.sample.unit.byteLength,-1===o?s=Ue(a.sample.unit,s):(l-=o,a.sample.unit.set(s.subarray(0,o),l),e.samples.push(a.sample),n=a.missing)),i=n,r=s.length;i<r-1&&!lr(s,i);i++);if(i!==n){var o=i<r-1,l=o?"AAC PES did not start with ADTS header,offset:"+i:"No ADTS header found in AAC PES";n=new Error(l);if(B.warn("parsing error: "+l),this.observer.emit(C.ERROR,C.ERROR,{type:L.MEDIA_ERROR,details:A.FRAG_PARSING_ERROR,fatal:!1,levelRetry:o,error:n,reason:l}),!o)return}if(ur(e,this.observer,s,i,this.audioCodec),void 0!==t.pts)u=t.pts;else{if(!a)return void B.warn("[tsdemuxer]: AAC PES unknown PTS");n=cr(e.samplerate);var u=a.sample.pts+n}for(var c,d=0;i<r;){if(i+=(c=dr(e,s,i,u,d)).length,c.missing){this.aacOverFlow=c;break}for(d++;i<r-1&&!lr(s,i);i++);}},t.parseMPEGPES=function(e,t){var i=t.data,r=i.length,n=0,a=0,s=t.pts;if(void 0===s)B.warn("[tsdemuxer]: MPEG PES unknown PTS");else for(;a<r;)if(br(i,a)){var o=vr(e,i,a,s,n);if(!o)break;a+=o.length,n++}else a++},t.parseAC3PES=function(e,t){var i=t.data,r=t.pts;if(void 0===r)B.warn("[tsdemuxer]: AC3 PES unknown PTS");else for(var n,a=i.length,s=0,o=0;o<a&&0<(n=Lr(e,i,o,r,s++));)o+=n},t.parseID3PES=function(e,t){void 0===t.pts?B.warn("[tsdemuxer]: ID3 PES unknown PTS"):(t=u({},t,{type:this._videoTrack?It:Dt,duration:Number.POSITIVE_INFINITY}),e.samples.push(t))},e}();function Or(e,t){return((31&e[t+1])<<8)+e[t+2]}function Mr(e){B.log(e+" with AES-128-CBC encryption found in unencrypted stream")}function Ur(e){var t,i,r,n=0,a=e.data;if(!e||0===e.size)return null;for(;a[0].length<19&&1<a.length;)a[0]=Ue(a[0],a[1]),a.splice(1,1);if(1!==((d=a[0])[0]<<16)+(d[1]<<8)+d[2])return null;if((t=(d[4]<<8)+d[5])&&t>e.size-6)return null;var s=d[7],o=(192&s&&(i=536870912*(14&d[9])+4194304*(255&d[10])+16384*(254&d[11])+128*(255&d[12])+(254&d[13])/2,64&s?54e5<i-(r=536870912*(14&d[14])+4194304*(255&d[15])+16384*(254&d[16])+128*(255&d[17])+(254&d[18])/2)&&(B.warn(Math.round((i-r)/9e4)+"s delta between PTS and DTS, align them"),i=r):r=i),(s=d[8])+9);if(e.size<=o)return null;e.size-=o;for(var l=new Uint8Array(e.size),u=0,c=a.length;u<c;u++){var d,h=(d=a[u]).byteLength;if(o){if(h<o){o-=h;continue}d=d.subarray(o),h-=o,o=0}l.set(d,n),n+=h}return t&&(t-=s+3),{data:l,pts:i,dts:r,len:t}}rr=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var i=t.prototype;return i.resetInitSegment=function(t,i,r,n){e.prototype.resetInitSegment.call(this,t,i,r,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:i,duration:n,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(e){var t=le(e,0),i=(null==t?void 0:t.length)||0;if(!(t&&11===e[i]&&119===e[i+1]&&void 0!==ue(t)&&Sr(e,i)<=16))for(var r=e.length;i<r;i++)if(Tr(e,i))return B.log("MPEG Audio sync word found !"),!0}return!1},i.canParse=function(e,t){return _r(e=e,t=t)&&4<=e.length-t},i.appendFrame=function(e,t,i){if(null!==this.basePTS)return vr(e,t,i,this.basePTS,this.frameIndex)},t}(rr);var Br=function(){function e(){}return e.getSilentFrame=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])}},e}(),Nr=Math.pow(2,32)-1,Fr=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]})e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=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]),r=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=(i=(e.HDLR_TYPES={video:i,audio:r},new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])),r=new Uint8Array([0,0,0,0,0,0,0,0]),r=(e.STTS=e.STSC=e.STCO=r,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]),new Uint8Array([105,115,111,109])),new Uint8Array([97,118,99,49])),a=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,r,a,r,n),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,i))},e.box=function(e){for(var t=8,i=arguments.length,r=new Array(1<i?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];for(var a=r.length,s=a;a--;)t+=r[a].byteLength;var o=new Uint8Array(t);for(o[0]=t>>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=255&t,o.set(e,4),a=0,t=8;a<s;a++)o.set(r[a],t),t+=r[a].byteLength;return o},e.hdlr=function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])},e.mdat=function(t){return e.box(e.types.mdat,t)},e.mdhd=function(t,i){i*=t;var r=Math.floor(i/(1+Nr));i=Math.floor(i%(1+Nr));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,i,r){return e.box(e.types.moof,e.mfhd(t),e.traf(r,i))},e.moov=function(t){for(var i=t.length,r=[];i--;)r[i]=e.trak(t[i]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(r).concat(e.mvex(t)))},e.mvex=function(t){for(var i=t.length,r=[];i--;)r[i]=e.trex(t[i]);return e.box.apply(null,[e.types.mvex].concat(r))},e.mvhd=function(t,i){i*=t;var r=Math.floor(i/(1+Nr));i=Math.floor(i%(1+Nr)),t=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,t)},e.sdtp=function(t){for(var i,r=t.samples||[],n=new Uint8Array(4+r.length),a=0;a<r.length;a++)i=r[a].flags,n[a+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return e.box(e.types.sdtp,n)},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))},e.avc1=function(t){for(var i,r,n=[],a=[],s=0;s<t.sps.length;s++)r=(i=t.sps[s]).byteLength,n.push(r>>>8&255),n.push(255&r),n=n.concat(Array.prototype.slice.call(i));for(s=0;s<t.pps.length;s++)r=(i=t.pps[s]).byteLength,a.push(r>>>8&255),a.push(255&r),a=a.concat(Array.prototype.slice.call(i));var o=e.box(e.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n).concat([t.pps.length]).concat(a))),l=t.width,u=t.height,c=t.pixelRatio[0],d=t.pixelRatio[1];return e.box(e.types.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,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,d>>24,d>>16&255,d>>8&255,255&d])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.audioStsd=function(e){var t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])},e.mp4a=function(t){return e.box(e.types.mp4a,e.audioStsd(t),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){return e.box(e.types[".mp3"],e.audioStsd(t))},e.ac3=function(t){return e.box(e.types["ac-3"],e.audioStsd(t),e.box(e.types.dac3,t.config))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.segmentCodec&&"mp3"===t.codec?e.box(e.types.stsd,e.STSD,e.mp3(t)):"ac3"===t.segmentCodec?e.box(e.types.stsd,e.STSD,e.ac3(t)):e.box(e.types.stsd,e.STSD,e.mp4a(t)):"avc"===t.segmentCodec?e.box(e.types.stsd,e.STSD,e.avc1(t)):e.box(e.types.stsd,e.STSD,e.hvc1(t))},e.tkhd=function(t){var i=t.id,r=t.duration*t.timescale,n=t.width,a=(t=t.height,Math.floor(r/(1+Nr)));r=Math.floor(r%(1+Nr));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,i>>24&255,i>>16&255,i>>8&255,255&i,0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,r>>24,r>>16&255,r>>8&255,255&r,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,n>>8&255,255&n,0,0,t>>8&255,255&t,0,0]))},e.traf=function(t,i){var r=e.sdtp(t),n=t.id,a=Math.floor(i/(1+Nr));i=Math.floor(i%(1+Nr));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,i>>24,i>>16&255,i>>8&255,255&i])),e.trun(t,r.length+16+20+8+16+8+8),r)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){return t=t.id,e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,i){var r,n,a,s,o,l=t.samples||[],u=l.length,c=12+16*u,d=new Uint8Array(c);for(d.set(["video"===t.type?1:0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,(i+=8+c)>>>24&255,i>>>16&255,i>>>8&255,255&i],0),r=0;r<u;r++)n=(o=l[r]).duration,a=o.size,s=o.flags,o=o.cts,d.set([n>>>24&255,n>>>16&255,n>>>8&255,255&n,a>>>24&255,a>>>16&255,a>>>8&255,255&a,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12+16*r);return e.box(e.types.trun,d)},e.initSegment=function(t){return e.types||e.init(),t=e.moov(t),Ue(e.FTYP,t)},e.hvc1=function(t){for(var i=t.params,r=[t.vps,t.sps,t.pps],n=(i=new Uint8Array([1,i.general_profile_space<<6|(i.general_tier_flag?32:0)|i.general_profile_idc,i.general_profile_compatibility_flags[0],i.general_profile_compatibility_flags[1],i.general_profile_compatibility_flags[2],i.general_profile_compatibility_flags[3],i.general_constraint_indicator_flags[0],i.general_constraint_indicator_flags[1],i.general_constraint_indicator_flags[2],i.general_constraint_indicator_flags[3],i.general_constraint_indicator_flags[4],i.general_constraint_indicator_flags[5],i.general_level_idc,240|i.min_spatial_segmentation_idc>>8,255&i.min_spatial_segmentation_idc,252|i.parallelismType,252|i.chroma_format_idc,248|i.bit_depth_luma_minus8,248|i.bit_depth_chroma_minus8,0,parseInt(i.frame_rate.fps),3|i.temporal_id_nested<<2|i.num_temporal_layers<<3|(i.frame_rate.fixed?64:0),r.length])).length,a=0;a<r.length;a+=1){n+=3;for(var s=0;s<r[a].length;s+=1)n+=2+r[a][s].length}for(var o=new Uint8Array(n),l=(o.set(i,0),n=i.length,r.length-1),u=0;u<r.length;u+=1){o.set(new Uint8Array([32+u|(u===l?128:0),0,r[u].length]),n),n+=3;for(var c=0;c<r[u].length;c+=1)o.set(new Uint8Array([r[u][c].length>>8,255&r[u][c].length]),n),n+=2,o.set(r[u][c],n),n+=r[u][c].length}i=e.box(e.types.hvcC,o);var d=t.width,h=t.height,f=t.pixelRatio[0];t=t.pixelRatio[1];return e.box(e.types.hvc1,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,d>>8&255,255&d,h>>8&255,255&h,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,255&f,t>>24,t>>16&255,t>>8&255,255&t])))},e}(),jr=(Fr.types=void 0,Fr.HDLR_TYPES=void 0,Fr.STTS=void 0,Fr.STSC=void 0,Fr.STCO=void 0,Fr.STSZ=void 0,Fr.VMHD=void 0,Fr.SMHD=void 0,Fr.STSD=void 0,Fr.FTYP=void 0,Fr.DINF=void 0,9e4);function Gr(e,t,i,r){return e=e*t*(i=void 0===i?1:i),(r=void 0!==r&&r)?Math.round(e):e}function Vr(e,t){return Gr(e,1e3,1/jr,t=void 0!==t&&t)}var Hr=null,Kr=null,qr=function(){function e(e,t,i,r){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===Hr&&(e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i),Hr=e?parseInt(e[1]):0),null===Kr&&(t=navigator.userAgent.match(/Safari\/(\d+)/i),Kr=t?parseInt(t[1]):0)}var t=e.prototype;return t.destroy=function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null},t.resetTimeStamp=function(e){B.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){B.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){B.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0},t.getVideoStartPts=function(e){var t=!1;e=e.reduce(function(e,i){var r=i.pts-e;return r<-4294967296?(t=!0,Wr(e,i.pts)):0<r?e:i.pts},e[0].pts);return t&&B.debug("PTS rollover detected"),e},t.remux=function(e,t,i,r,n,a,s,o){var l,u,c,d,h,f,p,m=n,g=n,v=-1<e.pid,y=-1<t.pid,_=t.samples.length,b=0<e.samples.length,T=s&&0<_||1<_;return((!v||b)&&(!y||T)||this.ISGenerated||s)&&(this.ISGenerated?!(v=this.videoTrackConfig)||t.width===v.width&&t.height===v.height&&(null==(s=t.pixelRatio)?void 0:s[0])===(null==(s=v.pixelRatio)?void 0:s[0])&&(null==(s=t.pixelRatio)?void 0:s[1])===(null==(s=v.pixelRatio)?void 0:s[1])||this.resetInitSegment():c=this.generateIS(e,t,n,a),v=this.isVideoContiguous,s=-1,T&&(s=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!v)&&this.config.forceKeyFrameOnDiscontinuity&&(p=!0,0<s?(B.warn("[mp4-remuxer]: Dropped "+s+" out of "+_+" video samples due to a missing keyframe"),f=this.getVideoStartPts(t.samples),t.samples=t.samples.slice(s),t.dropped+=s,f=g+=(t.samples[0].pts-f)/t.inputTimeScale):-1===s&&(B.warn("[mp4-remuxer]: No keyframe found out of "+_+" video samples"),p=!1)),this.ISGenerated)&&(b&&T&&(_=this.getVideoStartPts(t.samples),_=(Wr(e.samples[0].pts,_)-_)/t.inputTimeScale,m+=Math.max(0,_),g+=Math.max(0,-_)),b?(e.samplerate||(B.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),c=this.generateIS(e,t,n,a)),u=this.remuxAudio(e,m,this.isAudioContiguous,a,y||T||o===Tt?g:void 0),T&&(_=u?u.endPTS-u.startPTS:0,t.inputTimeScale||(B.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(e,t,n,a)),l=this.remuxVideo(t,g,v,_))):T&&(l=this.remuxVideo(t,g,v,0)),l)&&(l.firstKeyFrame=s,l.independent=-1!==s,l.firstKeyFramePTS=f),{audio:u,video:l,initSegment:c,independent:p,text:d=this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(h=zr(i,n,this._initPTS,this._initDTS)),r.samples.length)?Yr(r,n,this._initPTS):d,id3:h}},t.generateIS=function(e,t,i,r){var n,a,s,o=e.samples,l=t.samples,u=this.typeSupported,c={},d=this._initPTS,h="audio/mp4";if((r=!d||r)&&(a=n=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":u.mpeg?(h="audio/mpeg",e.codec=""):u.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}c.audio={id:"audio",container:h,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&u.mpeg?new Uint8Array(0):Fr.initSegment([e]),metadata:{channelCount:e.channelCount}},r&&(s=e.inputTimeScale,d&&s===d.timescale?r=!1:a=n=o[0].pts-Math.round(s*i))}if(t.sps&&t.pps&&l.length&&(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Fr.initSegment([t]),metadata:{width:t.width,height:t.height}},r&&(s=t.inputTimeScale,d&&s===d.timescale?r=!1:(o=this.getVideoStartPts(l),d=Math.round(s*i),n=Math.min(n,Wr(l[0].dts,o)-d),a=Math.min(a,o-d))),this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}),Object.keys(c).length)return this.ISGenerated=!0,r?(this._initPTS={baseTime:a,timescale:s},this._initDTS={baseTime:n,timescale:s}):a=s=void 0,{tracks:c,initPTS:a,timescale:s}},t.remuxVideo=function(e,t,i,r){for(var n=e.inputTimeScale,a=e.samples,s=[],o=a.length,l=this._initPTS,c=this.nextAvcDts,d=8,h=this.videoSampleDuration,f=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,m=!1,g=(i&&null!==c||(S=t*n,T=a[0].pts-Wr(a[0].dts,a[0].pts),Hr&&null!==c&&Math.abs(S-T-c)<15e3?i=!0:c=S-T),l.baseTime*n/l.timescale),v=0;v<o;v++){var y=a[v];y.pts=Wr(y.pts-g,c),y.dts=Wr(y.dts-g,c),y.dts<a[0<v?v-1:v].dts&&(m=!0)}m&&a.sort(function(e,t){var i=e.dts-t.dts;e=e.pts-t.pts;return i||e}),S=a[0].dts;var _=(T=a[a.length-1].dts-S)?Math.round(T/(o-1)):h||e.inputTimeScale/30;if(i){var b=S-c,T=b<-1;if(((l=_<b)||T)&&(l?B.warn((e.segmentCodec||"").toUpperCase()+": "+Vr(b,!0)+" ms ("+b+"dts) hole between fragments detected at "+t.toFixed(3)):B.warn((e.segmentCodec||"").toUpperCase()+": "+Vr(-b,!0)+" ms ("+b+"dts) overlapping between fragments detected at "+t.toFixed(3)),!T||c>=a[0].pts||Hr)){var S=c,E=a[0].pts-b;if(l)a[0].dts=S,a[0].pts=E;else for(var k=!0,w=0;w<a.length&&!(a[w].dts>E&&k);w++){var R,P=a[w].pts;a[w].dts-=b,a[w].pts-=b,w<a.length-1&&(k=(R=a[w+1].pts)<=a[w].pts==R<=P)}B.log("Video: Initial PTS/DTS adjusted: "+Vr(E,!0)+"/"+Vr(S,!0)+", delta: "+Vr(b,!0)+" ms")}}for(var D=0,I=0,x=S=Math.max(0,S),O=0;O<o;O++){for(var M=a[O],U=M.units,N=U.length,F=0,j=0;j<N;j++)F+=U[j].data.length;I+=F,D+=N,M.length=F,M.dts<x?(M.dts=x,x+=_/4|0||1):x=M.dts,f=Math.min(M.pts,f),p=Math.max(M.pts,p)}i=a[o-1].dts;var G;t=I+4*D+8;try{G=new Uint8Array(t)}catch(e){return void this.observer.emit(C.ERROR,C.ERROR,{type:L.MUX_ERROR,details:A.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:t,reason:"fail allocating video mdat "+t})}for(var V=new DataView(G.buffer),H=(V.setUint32(0,t),G.set(Fr.types.mdat,4),!1),K=Number.POSITIVE_INFINITY,q=Number.POSITIVE_INFINITY,W=Number.NEGATIVE_INFINITY,z=Number.NEGATIVE_INFINITY,Y=0;Y<o;Y++){for(var X=a[Y],$=X.units,Q=0,J=0,Z=$.length;J<Z;J++){var ee=(te=$[J]).data,te=te.data.byteLength;V.setUint32(d,te),d+=4,G.set(ee,d),d+=te,Q+=4+te}var ie,re=void 0,ne=(Y<o-1?(h=a[Y+1].dts-X.dts,re=a[Y+1].pts-X.pts):(ne=this.config,ie=0<Y?X.dts-a[Y-1].dts:_,re=0<Y?X.pts-a[Y-1].pts:_,ne.stretchShortVideoTrack&&null!==this.nextAudioPts&&Math.floor(ne.maxBufferHole*n)<(ne=(r?f+r*n:this.nextAudioPts)-X.pts)?((h=ne-ie)<0?h=ie:H=!0,B.log("[mp4-remuxer]: It is approximately "+ne/90+" ms to the next segment; using duration "+h/90+" ms for the last video frame.")):h=ie),Math.round(X.pts-X.dts));K=Math.min(K,h),W=Math.max(W,h),q=Math.min(q,re),z=Math.max(z,re);s.push(new $r(X.key,h,Q,ne))}if(s.length)if(Hr)Hr<70&&((T=s[0].flags).dependsOn=2,T.isNonSync=0);else if(Kr&&z-q<W-K&&_/W<.025&&0===s[0].cts){B.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var ae=S,se=0,oe=s.length;se<oe;se++){var le,ue=ae+s[se].duration,ce=ae+s[se].cts;se<oe-1?(le=ue+s[se+1].cts,s[se].duration=le-ce):s[se].duration=se?s[se-1].duration:_,s[se].cts=0,ae=ue}}return this.nextAvcDts=c=i+(h=H||!h?_:h),this.videoSampleDuration=h,this.isVideoContiguous=!0,l={data1:Fr.moof(e.sequenceNumber++,S,u({},e,{samples:s})),data2:G,startPTS:f/n,endPTS:(p+h)/n,startDTS:S/n,endDTS:c/n,type:"video",hasAudio:!1,hasVideo:!0,nb:s.length,dropped:e.dropped},e.samples=[],e.dropped=0,l},t.getSamplesPerFrame=function(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}},t.remuxAudio=function(e,t,i,r,n){var a=e.inputTimeScale,s=a/(e.samplerate||a),o=this.getSamplesPerFrame(e),l=o*s,c=this._initPTS,d="mp3"===e.segmentCodec&&this.typeSupported.mpeg,h=[],f=void 0!==n,p=e.samples,m=d?0:8,g=this.nextAudioPts||-1,v=t*a,y=c.baseTime*a/c.timescale;if(this.isAudioContiguous=i=i||p.length&&0<g&&(r&&Math.abs(v-g)<9e3||Math.abs(Wr(p[0].pts-y,v)-g)<20*l),p.forEach(function(e){e.pts=Wr(e.pts-y,v)}),!i||g<0){if(!(p=p.filter(function(e){return 0<=e.pts})).length)return;g=0===n?0:r&&!f?Math.max(0,v):p[0].pts}if("aac"===e.segmentCodec)for(var _=this.config.maxAudioFramesDrift,b=0,T=g;b<p.length;b++){var S=p[b],E=S.pts,k=E-T,w=Math.abs(1e3*k/a);if(k<=-_*l&&f)0===b&&(B.warn("Audio frame @ "+(E/a).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*k/a)+" ms."),this.nextAudioPts=g=T=E);else if(_*l<=k&&w<1e4&&f){var R=Math.round(k/l);(T=E-R*l)<0&&(R--,T+=l),0===b&&(this.nextAudioPts=g=T),B.warn("[mp4-remuxer]: Injecting "+R+" audio frame @ "+(T/a).toFixed(3)+"s due to "+Math.round(1e3*k/a)+" ms gap.");for(var P=0;P<R;P++){var D=Math.max(T,0),I=Br.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);I||(B.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),I=S.unit.subarray()),p.splice(b,0,{unit:I,pts:D}),T+=l,b++}}S.pts=T,T+=l}for(var x,O=null,M=null,U=0,N=p.length;N--;)U+=p[N].unit.byteLength;for(var F=0,j=p.length;F<j;F++){var G=(V=p[F]).unit,V=V.pts;if(null!==M)h[F-1].duration=Math.round((V-M)/s);else{if(O=V=i&&"aac"===e.segmentCodec?g:V,!(0<U))return;U+=m;try{x=new Uint8Array(U)}catch(e){return void this.observer.emit(C.ERROR,C.ERROR,{type:L.MUX_ERROR,details:A.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:U,reason:"fail allocating audio mdat "+U})}d||(new DataView(x.buffer).setUint32(0,U),x.set(Fr.types.mdat,4))}x.set(G,m),m+=G=G.byteLength,h.push(new $r(!0,o,G,0)),M=V}if(t=h.length)return c=h[h.length-1],this.nextAudioPts=g=M+s*c.duration,c={data1:d?new Uint8Array(0):Fr.moof(e.sequenceNumber++,O/s,u({},e,{samples:h})),data2:x,startPTS:n=O/a,endPTS:r=g/a,startDTS:n,endDTS:r,type:"audio",hasAudio:!0,hasVideo:!(e.samples=[]),nb:t},this.isAudioContiguous=!0,c},t.remuxEmptyAudio=function(e,t,i,r){var n=e.inputTimeScale,a=e.samplerate||n,s=this.nextAudioPts,o=9e4*(o=this._initDTS).baseTime/o.timescale,l=(null!==s?s:r.startDTS*n)+o,u=(s=r.endDTS*n+o,n/a*1024),c=Math.ceil((s-l)/u),d=Br.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);if(B.warn("[mp4-remuxer]: remux empty Audio"),d){for(var h=[],f=0;f<c;f++){var p=l+f*u;h.push({unit:d,pts:p,dts:p})}return e.samples=h,this.remuxAudio(e,t,i,!1)}B.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},e}();function Wr(e,t){var i;if(null!==t)for(i=t<e?-8589934592:8589934592;4294967296<Math.abs(e-t);)e+=i;return e}function zr(e,t,i,r){var n=e.samples.length;if(n){for(var a=e.inputTimeScale,s=0;s<n;s++){var o=e.samples[s];o.pts=Wr(o.pts-i.baseTime*a/i.timescale,t*a)/a,o.dts=Wr(o.dts-r.baseTime*a/r.timescale,t*a)/a}var l=e.samples;return e.samples=[],{samples:l}}}function Yr(e,t,i){var r=e.samples.length;if(r){for(var n=e.inputTimeScale,a=0;a<r;a++){var s=e.samples[a];s.pts=Wr(s.pts-i.baseTime*n/i.timescale,t*n)/n}e.samples.sort(function(e,t){return e.pts-t.pts});var o=e.samples;return e.samples=[],{samples:o}}}var Xr,$r=function(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}},Qr=function(){function e(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){this.initPTS=e,this.lastEndTime=null},t.resetNextTimestamp=function(){this.lastEndTime=null},t.resetInitSegment=function(e,t,i,r){var n;this.audioCodec=t,this.videoCodec=i,this.generateInitSegment((t=r,(i=e)&&t&&(n=t.keyId)&&t.isCommonEncryption&&Pe(i,["moov","trak"]).forEach(function(e){var t=Pe(e=Pe(e,["mdia","minf","stbl","stsd"])[0].subarray(8),["enca"]),i=0<t.length;(t=i?t:Pe(e,["encv"])).forEach(function(e){Pe(i?e.subarray(28):e.subarray(78),["sinf"]).forEach(function(e){var t;(e=Me(e))&&!(t=e.subarray(8,24)).some(function(e){return 0!==e})&&(B.log("[eme] Patching keyId in 'enc"+(i?"a":"v")+">sinf>>tenc' box: "+be.hexDump(t)+" -> "+be.hexDump(n)),e.set(n,8))})})}),i)),this.emitInitSegment=!0},t.generateInitSegment=function(e){var t,i,r=this.audioCodec,n=this.videoCodec;null!=e&&e.byteLength?((t=this.initData=De(e)).audio&&(r=Jr(t.audio,j)),t.video&&(n=Jr(t.video,G)),i={},t.audio&&t.video?i.audiovideo={container:"video/mp4",codec:r+","+n,initSegment:e,id:"main"}:t.audio?i.audio={container:"audio/mp4",codec:r,initSegment:e,id:"audio"}:t.video?i.video={container:"video/mp4",codec:n,initSegment:e,id:"main"}:B.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i):(this.initTracks=void 0,this.initData=void 0)},t.remux=function(e,t,i,r,n,a){var s,o,l,u,c,d,h,f=this.initPTS,p=this.lastEndTime,m={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};return null!=(t=(E(p)||(p=this.lastEndTime=n||0),t.samples))&&t.length&&(s={initPTS:void 0,timescale:1},null!=(h=this.initData)&&h.length||(this.generateInitSegment(t),h=this.initData),null!=h&&h.length?(this.emitInitSegment&&(s.tracks=this.initTracks,this.emitInitSegment=!1),c=function(e,t){for(var i=0,r=0,n=0,a=Pe(e,["moof","traf"]),s=0;s<a.length;s++){var o=a[s],l=Pe(o,["tfhd"])[0],u=t[Ce(l,4)];if(u)for(var c=u.default,d=Ce(l,0)|(null==c?void 0:c.flags),h=null==c?void 0:c.duration,f=(8&d&&(h=Ce(l,2&d?12:8)),u.timescale||9e4),p=Pe(o,["trun"]),m=0;m<p.length;m++)!(i=function(e){var t=Ce(e,0),i=8;1&t&&(i+=4),4&t&&(i+=4);for(var r=0,n=Ce(e,4),a=0;a<n;a++)256&t&&(r+=Ce(e,i),i+=4),512&t&&(i+=4),1024&t&&(i+=4),2048&t&&(i+=4);return r}(p[m]))&&h&&(i=h*Ce(p[m],4)),u.type===G?r+=i/f:u.type===j&&(n+=i/f)}if(0===r&&0===n){for(var g=1/0,v=0,y=0,_=Pe(e,["sidx"]),b=0;b<_.length;b++){var T,S=function(e){var t=[],i=e[0],r=8,n=Ce(e,r),a=(r+=4,0),s=0,o=(0===i?(a=Ce(e,r),s=Ce(e,r+4),r+=8):(a=Le(e,r),s=Le(e,r+8),r+=16),e.length+s),l=we(e,r+=2);r+=2;for(var u=0;u<l;u++){var c=r,d=Ce(e,c),h=(c+=4,2147483647&d);if(1==(2147483648&d)>>>31)return B.warn("SIDX has hierarchical references (not supported)"),null;d=Ce(e,c),c+=4,t.push({referenceSize:h,subsegmentDuration:d,info:{duration:d/n,start:o,end:o+h-1}}),o+=h,r=c+=4}return{earliestPresentationTime:a,timescale:n,version:i,referencesCount:l,references:t}}(_[b]);null!=S&&S.references&&(g=Math.min(g,S.earliestPresentationTime/S.timescale),T=S.references.reduce(function(e,t){return e+t.info.duration||0},0),y=(v=Math.max(v,T+S.earliestPresentationTime/S.timescale))-g)}if(y&&E(y))return y}return r||n}(t,h),o=h,(function(e,t,i,r){return null===e?1:(r=Math.max(r,1),t-=e.baseTime/e.timescale,Math.abs(t-i)>r)}(f,d=null===(d=Pe(t,["moof","traf"]).reduce(function(e,t){var i=Pe(t,["tfdt"])[0],r=i[0];return null!==(t=Pe(t,["tfhd"]).reduce(function(e,t){if(t=Ce(t,4),t=o[t]){var n=Ce(i,4);if(1===r){if(n===Te)return B.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),e;n=n*(1+Te)+Ce(i,8)}if(n/=t.timescale||9e4,E(n)&&(null===e||n<e))return n}return e},null))&&E(t)&&(null===e||t<e)?t:e},null))?n:d,n,c)||s.timescale!==f.timescale&&a)&&(s.initPTS=d-n,f&&1===f.timescale&&B.warn("Adjusting initPTS by "+(s.initPTS-f.baseTime)),this.initPTS=f={baseTime:s.initPTS,timescale:1}),e=(a=e?d-f.baseTime/f.timescale:p)+c,l=h,u=f.baseTime/f.timescale,Pe(t,["moof","traf"]).forEach(function(e){Pe(e,["tfhd"]).forEach(function(t){var i;t=Ce(t,4);(t=l[t])&&(i=t.timescale||9e4,Pe(e,["tfdt"]).forEach(function(e){var t,r=e[0],n=u*i;n&&(t=Ce(e,4),0===r?(t-=n,Re(e,4,t=Math.max(t,0))):(t=(t*=Math.pow(2,32))+Ce(e,8)-n,t=Math.max(t,0),r=Math.floor(t/(1+Te)),n=Math.floor(t%(1+Te)),Re(e,4,r),Re(e,8,n)))}))})}),0<c?this.lastEndTime=e:(B.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp()),d="",(p=!!h.audio)&&(d+="audio"),(c=!!h.video)&&(d+="video"),m.audio="audio"===(h={data1:t,startPTS:a,startDTS:a,endPTS:e,endDTS:e,type:d,hasAudio:p,hasVideo:c,nb:1,dropped:0}).type?h:void 0,m.video="audio"!==h.type?h:void 0,m.initSegment=s,m.id3=zr(i,n,f,f),r.samples.length&&(m.text=Yr(r,n,f))):B.warn("[passthrough-remuxer.ts]: Failed to generate initSegment.")),m},e}();function Jr(e,t){return(e=null==e?void 0:e.codec)&&4<e.length?e:t===j?"ec-3"===e||"ac-3"===e||"alac"===e?e:"fLaC"===e||"Opus"===e?it(e,!1):(B.info('Parsed audio codec "'+e+'" or audio object type not handled. Using "mp4a.40.5"'),"mp4a.40.5"):(B.warn('Unhandled video codec "'+e+'"'),"hvc1"===e||"hev1"===e?"hvc1.1.6.L120.90":"av01"===e?"av01.0.04M.08":"avc1.42e01e")}try{Xr=self.performance.now.bind(self.performance)}catch(un){B.debug("Unable to use Performance API on this environment"),Xr=null==wa?void 0:wa.Date.now}var Zr,en,tn=[{demux:wr,remux:Qr},{demux:Ar,remux:qr},{demux:Er,remux:qr},{demux:rr,remux:qr}],rn=(tn.splice(2,0,{demux:Cr,remux:qr}),function(){function e(e,t,i,r,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=n}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,i,r){var n=this,a=i.transmuxing,s=(e=(a.executeStart=Xr(),new Uint8Array(e)),this.currentTransmuxState),o=this.transmuxConfig,l=(s=(r=(r&&(this.currentTransmuxState=r),r||s)).contiguous,r.discontinuity),u=r.trackSwitch,c=r.accurateTimeOffset,d=r.timeOffset,h=(r=r.initSegmentChange,o.audioCodec),f=o.videoCodec,p=o.defaultInitPts,m=o.duration,g=(o=o.initSegmentData,function(e,t){var i=null;return 0<e.byteLength&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(i=t),i}(e,t));if(g&&$(g.method)){var v=this.getDecrypter(),y=Q(g.method);if(!v.isSync())return this.decryptionPromise=v.webCryptoDecrypt(e,g.key.buffer,g.iv.buffer,y).then(function(e){return e=n.push(e,null,i),n.decryptionPromise=null,e}),this.decryptionPromise;if(y=v.softwareDecrypt(e,g.key.buffer,g.iv.buffer,y),!(y=-1<i.part?v.flush():y))return a.executeEnd=Xr(),nn(i);e=new Uint8Array(y)}return(v=this.needsProbing(l,u))&&(y=this.configureTransmuxer(e))?(B.warn("[transmuxer] "+y.message),this.observer.emit(C.ERROR,C.ERROR,{type:L.MEDIA_ERROR,details:A.FRAG_PARSING_ERROR,fatal:!1,error:y,reason:y.message}),a.executeEnd=Xr(),nn(i)):((l||u||r||v)&&this.resetInitSegment(o,h,f,m,t),(l||r||v)&&this.resetInitialTimestamp(p),s||this.resetContiguity(),y=this.transmux(e,g,d,c,i),(u=this.currentTransmuxState).contiguous=!0,u.discontinuity=!1,u.trackSwitch=!1,a.executeEnd=Xr(),y)},t.flush=function(e){var t,i=this,r=e.transmuxing,n=(r.executeStart=Xr(),this.decrypter),a=this.currentTransmuxState,s=this.decryptionPromise;return s?s.then(function(){return i.flush(e)}):(t=[],s=a.timeOffset,n&&(a=n.flush())&&t.push(this.push(a,null,e)),n=this.demuxer,a=this.remuxer,n&&a?an(a=n.flush(s))?a.then(function(r){return i.flushRemux(t,r,e),t}):(this.flushRemux(t,a,e),t):(r.executeEnd=Xr(),[nn(e)]))},t.flushRemux=function(e,t,i){var r=t.audioTrack,n=t.videoTrack,a=t.id3Track,s=(t=t.textTrack,(o=this.currentTransmuxState).accurateTimeOffset),o=o.timeOffset;B.log("[transmuxer.ts]: Flushed fragment "+i.sn+(-1<i.part?" p: "+i.part:"")+" of level "+i.level),r=this.remuxer.remux(r,n,a,t,o,s,!0,this.id);e.push({remuxResult:r,chunkMeta:i}),i.transmuxing.executeEnd=Xr()},t.resetInitialTimestamp=function(e){var t=this.demuxer,i=this.remuxer;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,i,r,n){var a=this.demuxer,s=this.remuxer;a&&s&&(a.resetInitSegment(e,t,i,r),s.resetInitSegment(e,t,i,n))},t.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},t.transmux=function(e,t,i,r,n){return t=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,r,n):this.transmuxUnencrypted(e,i,r,n)},t.transmuxUnencrypted=function(e,t,i,r){var n=(e=this.demuxer.demux(e,t,!1,!this.config.progressive)).audioTrack,a=e.videoTrack,s=e.id3Track;e=e.textTrack;return{remuxResult:this.remuxer.remux(n,a,s,e,t,i,!1,this.id),chunkMeta:r}},t.transmuxSampleAes=function(e,t,i,r,n){var a=this;return this.demuxer.demuxSampleAes(e,t,i).then(function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,r,!1,a.id),chunkMeta:n}})},t.configureTransmuxer=function(e){for(var t,i,r=this.config,n=this.observer,a=this.typeSupported,s=this.vendor,o=0,l=tn.length;o<l;o++)if(null!=(i=tn[o].demux)&&i.probe(e)){t=tn[o];break}if(!t)return new Error("Failed to find demuxer by probing fragment data");var u=this.demuxer,c=this.remuxer,d=t.remux,h=t.demux;c&&c instanceof d||(this.remuxer=new d(n,r,a,s)),u&&u instanceof h||(this.demuxer=new h(n,r,a),this.probe=h.probe)},t.needsProbing=function(e,t){return!this.demuxer||!this.remuxer||e||t},t.getDecrypter=function(){return this.decrypter||(this.decrypter=new Vi(this.config))},e}()),nn=function(e){return{remuxResult:{},chunkMeta:e}};function an(e){return"then"in e&&e.then instanceof Function}function sn(){}function on(e,t,i,r,n){if("function"!=typeof i)throw new TypeError("The listener must be a function");return i=new function(e,t,i){this.fn=e,this.context=t,this.once=i||!1}(i,r||e,n),r=en?en+t:t,e._events[r]?e._events[r].fn?e._events[r]=[e._events[r],i]:e._events[r].push(i):(e._events[r]=i,e._eventsCount++),e}function ln(e,t){0==--e._eventsCount?e._events=new sn:delete e._events[t]}function un(){this._events=new sn,this._eventsCount=0}Qr=wr={exports:{}},Zr=Object.prototype.hasOwnProperty,en="~",Object.create&&(sn.prototype=Object.create(null),(new sn).__proto__||(en=!1)),un.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)Zr.call(e,t)&&i.push(en?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},un.prototype.listeners=function(e){e=en?en+e:e;var t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var i=0,r=t.length,n=new Array(r);i<r;i++)n[i]=t[i].fn;return n},un.prototype.listenerCount=function(e){return e=en?en+e:e,(e=this._events[e])?e.fn?1:e.length:0},un.prototype.emit=function(e,t,i,r,n,a){var s=en?en+e:e;if(!this._events[s])return!1;var o,l=this._events[s],u=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,r),!0;case 5:return l.fn.call(l.context,t,i,r,n),!0;case 6:return l.fn.call(l.context,t,i,r,n,a),!0}for(h=1,o=new Array(u-1);h<u;h++)o[h-1]=arguments[h];l.fn.apply(l.context,o)}else for(var c,d=l.length,h=0;h<d;h++)switch(l[h].once&&this.removeListener(e,l[h].fn,void 0,!0),u){case 1:l[h].fn.call(l[h].context);break;case 2:l[h].fn.call(l[h].context,t);break;case 3:l[h].fn.call(l[h].context,t,i);break;case 4:l[h].fn.call(l[h].context,t,i,r);break;default:if(!o)for(c=1,o=new Array(u-1);c<u;c++)o[c-1]=arguments[c];l[h].fn.apply(l[h].context,o)}return!0},un.prototype.on=function(e,t,i){return on(this,e,t,i,!1)},un.prototype.once=function(e,t,i){return on(this,e,t,i,!0)},un.prototype.removeListener=function(e,t,i,r){if(e=en?en+e:e,this._events[e])if(t){var n=this._events[e];if(n.fn)n.fn!==t||r&&!n.once||i&&n.context!==i||ln(this,e);else{for(var a=0,s=[],o=n.length;a<o;a++)(n[a].fn!==t||r&&!n[a].once||i&&n[a].context!==i)&&s.push(n[a]);s.length?this._events[e]=1===s.length?s[0]:s:ln(this,e)}}else ln(this,e);return this},un.prototype.removeAllListeners=function(e){return e?(e=en?en+e:e,this._events[e]&&ln(this,e)):(this._events=new sn,this._eventsCount=0),this},un.prototype.off=un.prototype.removeListener,un.prototype.addListener=un.prototype.on,un.prefixed=en,Qr.exports=un.EventEmitter=un;var cn,dn,hn=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(wr.exports);function fn(e,t){cn.postMessage({event:e,data:t})}function pn(e,t){var i,r,n;return!!((i=t.remuxResult).audio||i.video||i.text||i.id3||i.initSegment)&&(i=[],r=(n=t.remuxResult).audio,n=n.video,r&&mn(i,r),n&&mn(i,n),e.postMessage({event:"transmuxComplete",data:t},i),!0)}function mn(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function gn(e,t,i){t.reduce(function(t,i){return pn(e,i)||t},!1)||e.postMessage({event:"transmuxComplete",data:t[0]}),e.postMessage({event:"flush",data:i})}void 0!==s&&s&&(cn=self,(dn=new hn).on(C.FRAG_DECRYPTED,fn),dn.on(C.ERROR,fn),cn.addEventListener("message",function(e){var t=e.data;switch(t.cmd){case"init":var i=JSON.parse(t.config);(function(e){for(var t in e)!function(t){e[t]=function(e){fn("workerLog",{logType:t,message:e})}}(t)})(i=(cn.transmuxer=new rn(dn,t.typeSupported,i,t.vendor,t.id),U(i.debug,t.id))),fn("init",null);break;case"configure":cn.transmuxer.configure(t.config);break;case"demux":an(i=cn.transmuxer.push(t.data,t.decryptdata,t.chunkMeta,t.state))?(cn.transmuxer.async=!0,i.then(function(e){pn(cn,e)}).catch(function(e){fn(C.ERROR,{type:L.MEDIA_ERROR,details:A.FRAG_PARSING_ERROR,chunkMeta:t.chunkMeta,fatal:!1,error:e,err:e,reason:"transmuxer-worker push error"})})):(cn.transmuxer.async=!1,pn(cn,i));break;case"flush":var r=t.chunkMeta;an(i=cn.transmuxer.flush(r))||cn.transmuxer.async?(i=an(i)?i:Promise.resolve(i)).then(function(e){gn(cn,e,r)}).catch(function(e){fn(C.ERROR,{type:L.MEDIA_ERROR,details:A.FRAG_PARSING_ERROR,chunkMeta:t.chunkMeta,fatal:!1,error:e,err:e,reason:"transmuxer-worker flush error"})}):gn(cn,i,r)}}));var vn=function(){function e(e,t,i,r){function n(e,t){(t=t||{}).frag=l.frag,t.id=l.id,e===C.ERROR&&(l.error=t.error),l.hls.trigger(e,t)}var s,o,l=this,u=(this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,e.config);this.hls=e,this.id=t,this.useWorker=!!u.enableWorker,this.onTransmuxComplete=i,this.onFlush=r,this.observer=new hn,this.observer.on(C.FRAG_DECRYPTED,n),this.observer.on(C.ERROR,n),i={mpeg:(e=ze(e=u.preferManagedMediaSource)||{isTypeSupported:function(){return!1}}).isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')},r=navigator.vendor;if(!this.useWorker||"undefined"==typeof Worker||!u.workerPath&&"function"!=typeof a)this.transmuxer=new rn(this.observer,i,u,r,t);else try{u.workerPath?(B.log("loading Web Worker "+u.workerPath+' for "'+t+'"'),this.workerContext=(o=u.workerPath,o=new self.URL(o,self.location.href).href,{worker:new self.Worker(o),scriptURL:o})):(B.log('injecting Web Worker for "'+t+'"'),this.workerContext=(s=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;("+a.toString()+")(true);"],{type:"text/javascript"}),s=self.URL.createObjectURL(s),{worker:new self.Worker(s),objectURL:s})),this.onwmsg=function(e){return l.onWorkerMessage(e)};var c=this.workerContext.worker;c.addEventListener("message",this.onwmsg),c.onerror=function(e){e=new Error(e.message+" ("+e.filename+":"+e.lineno+")"),u.enableWorker=!1,B.warn('Error in "'+t+'" Web Worker, fallback to inline'),l.hls.trigger(C.ERROR,{type:L.OTHER_ERROR,details:A.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:e})},c.postMessage({cmd:"init",typeSupported:i,vendor:r,id:t,config:JSON.stringify(u)})}catch(e){B.warn('Error setting up "'+t+'" Web Worker, fallback to inline',e),this.resetWorker(),this.error=null,this.transmuxer=new rn(this.observer,i,u,r,t)}}var t=e.prototype;return t.resetWorker=function(){var e,t;this.workerContext&&(e=(t=this.workerContext).worker,(t=t.objectURL)&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null)},t.destroy=function(){this.workerContext?(this.resetWorker(),this.onwmsg=void 0):(e=this.transmuxer)&&(e.destroy(),this.transmuxer=null);var e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},t.push=function(e,t,i,r,n,a,s,o,l,u){var c=this,d=(l.transmuxing.start=self.performance.now(),this.transmuxer),h=(a||n).start,f=n.decryptdata,p=this.frag,m=!(p&&n.cc===p.cc),g=!(p&&l.level===p.level),v=p?l.sn-p.sn:-1,y=this.part?l.part-this.part.index:-1,_=0==v&&1<l.id&&l.id===(null==p?void 0:p.stats.chunkCount),b=(_=!g&&(1==v||0==v&&(1==y||_&&y<=0)),self.performance.now());v=new function(e,t,i,r,n,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=a}(m,_,o,g,h,b=((g||v||0===n.stats.parsing.start)&&(n.stats.parsing.start=b),!a||!y&&_||(a.stats.parsing.start=b),!(p&&(null==(v=n.initSegment)?void 0:v.url)===(null==(y=p.initSegment)?void 0:y.url))));_&&!m&&!b||(B.log("[transmuxer-interface, "+n.type+"]: Starting new transmux session for sn: "+l.sn+" p: "+l.part+" level: "+l.level+" id: "+l.id+"\n discontinuity: "+m+"\n trackSwitch: "+g+"\n contiguous: "+_+"\n accurateTimeOffset: "+o+"\n timeOffset: "+h+"\n initSegmentChange: "+b),p=new function(e,t,i,r,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=n||null}(i,r,t,s,u),this.configureTransmuxer(p)),this.frag=n,this.part=a,this.workerContext?this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:v},e instanceof ArrayBuffer?[e]:[]):d&&(an(y=d.push(e,f,l,v))?(d.async=!0,y.then(function(e){c.handleTransmuxComplete(e)}).catch(function(e){c.transmuxerError(e,l,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(y)))},t.flush=function(e){var t,i=this,r=(e.transmuxing.start=self.performance.now(),this.transmuxer);this.workerContext?this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e}):r&&(an(t=r.flush(e))||r.async?(t=an(t)?t:Promise.resolve(t)).then(function(t){i.handleFlushResult(t,e)}).catch(function(t){i.transmuxerError(t,e,"transmuxer-interface flush error")}):this.handleFlushResult(t,e))},t.transmuxerError=function(e,t,i){this.hls&&(this.error=e,this.hls.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))},t.handleFlushResult=function(e,t){var i=this;e.forEach(function(e){i.handleTransmuxComplete(e)}),this.onFlush(t)},t.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":var r=null==(r=this.workerContext)?void 0:r.objectURL;r&&self.URL.revokeObjectURL(r);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":B[t.data.logType]&&B[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}},t.configureTransmuxer=function(e){var t=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)},t.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},e}();function yn(e,t){if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(!_n(e[i].attrs,t[i].attrs))return!1;return!0}function _n(e,t,i){var r=e["STABLE-RENDITION-ID"];return r&&!i?r===t["STABLE-RENDITION-ID"]:!(i||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(function(i){return e[i]!==t[i]})}function bn(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}Ar=function(e){function t(t,i,r){return(t=e.call(this,t,i,r,"audio-stream-controller",Tt)||this).videoBuffer=null,t.videoTrackCC=-1,t.waitingVideoCC=-1,t.bufferedTrack=null,t.switchingTrack=null,t.trackId=-1,t.waitingData=null,t.mainDetails=null,t.flushing=!1,t.bufferFlushed=!1,t.cachedTrackLoadedData=null,t.registerListeners(),t}c(t,e);var r=t.prototype;return r.onHandlerDestroying=function(){this.unregisterListeners(),e.prototype.onHandlerDestroying.call(this),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null},r.registerListeners=function(){e.prototype.registerListeners.call(this);var t=this.hls;t.on(C.LEVEL_LOADED,this.onLevelLoaded,this),t.on(C.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(C.BUFFER_RESET,this.onBufferReset,this),t.on(C.BUFFER_CREATED,this.onBufferCreated,this),t.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(C.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(C.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(C.FRAG_BUFFERED,this.onFragBuffered,this)},r.unregisterListeners=function(){var t=this.hls;t&&(e.prototype.unregisterListeners.call(this),t.off(C.LEVEL_LOADED,this.onLevelLoaded,this),t.off(C.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(C.BUFFER_RESET,this.onBufferReset,this),t.off(C.BUFFER_CREATED,this.onBufferCreated,this),t.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(C.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(C.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(C.FRAG_BUFFERED,this.onFragBuffered,this))},r.onInitPtsFound=function(e,t){var i=t.frag,r=t.id,n=t.initPTS;t=t.timescale;"main"===r&&(r=i.cc,this.initPTS[i.cc]={baseTime:n,timescale:t},this.log("InitPTS for cc: "+r+" found from main: "+n),this.videoTrackCC=r,this.state===Zi)&&this.tick()},r.startLoad=function(e){var t;this.levels?(t=this.lastCurrentTime,this.stopLoad(),this.setInterval(100),0<t&&-1===e?(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t,this.state=Ki):(this.loadedmetadata=!1,this.state=Yi),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()):(this.startPosition=e,this.state=Hi)},r.doTick=function(){switch(this.state){case Ki:this.doTickIdle();break;case Yi:var t=this.levels,i=this.trackId;if(i=null==t||null==(t=t[i])?void 0:t.details){if(this.waitForCdnTuneIn(i))break;this.state=Zi}break;case zi:t=performance.now();(!(i=this.retryDate)||i<=t||null!=(i=this.media)&&i.seeking)&&(t=this.levels,i=this.trackId,this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==t?void 0:t[i])||null),this.state=Ki);break;case Zi:var r,n;(t=this.waitingData)?(i=t.frag,r=t.part,n=t.cache,t=t.complete,void 0!==this.initPTS[i.cc]?(this.waitingData=null,this.waitingVideoCC=-1,this.state=Wi,r={frag:i,part:r,payload:n.flush(),networkDetails:null},this._handleFragmentLoadProgress(r),t&&e.prototype._handleFragmentLoadComplete.call(this,r)):this.videoTrackCC!==this.waitingVideoCC?(this.log("Waiting fragment cc ("+i.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment()):(n=this.getLoadPosition(),ni((t=Ri.bufferInfo(this.mediaBuffer,n,this.config.maxBufferHole)).end,this.config.maxFragLookUpTolerance,i)<0&&(this.log("Waiting fragment cc ("+i.cc+") @ "+i.start+" cancelled because another fragment at "+t.end+" is needed"),this.clearWaitingFragment()))):this.state=Ki}this.onTickEnd()},r.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state!==Hi)&&(this.state=Ki)},r.resetLoadingState=function(){this.clearWaitingFragment(),e.prototype.resetLoadingState.call(this)},r.onTickEnd=function(){var e=this.media;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)},r.doTickIdle=function(){var e=this.hls,t=this.levels,i=this.media,r=this.trackId,n=e.config;if(this.buffering&&(i||!this.startFragRequested&&n.startFragPrefetch)&&null!=t&&t[r])if(!(t=(n=t[r]).details)||t.live&&this.levelLastLoaded!==n||this.waitForCdnTuneIn(t))this.state=Yi;else if(r=this.mediaBuffer||this.media,this.bufferFlushed&&r&&(this.bufferFlushed=!1,this.afterBufferFlushed(r,j,Tt)),null!==(r=this.getFwdBufferInfo(r,Tt))){var a=this.bufferedTrack,s=this.switchingTrack;if(!s&&this._streamEnded(r,t))e.trigger(C.BUFFER_EOS,{type:"audio"}),this.state=Qi;else{var o=r.len,l=(e=e.maxBufferLength,t.fragments),u=l[0].start,c=this.flushing?this.getLoadPosition():r.end;if(s&&i&&(d=this.getLoadPosition(),a&&!_n(s.attrs,a.attrs)&&(c=d),t.PTSKnown)&&d<u&&(r.end>u||r.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=u+.05),!(e<=o&&!s&&c<l[l.length-1].start)){var d=!1;if((a=this.getNextFragment(c,t))&&this.isLoopLoading(a,c)&&(d=!!a.gap,a=this.getNextFragmentLoopLoading(a,t,r,bt,e)),a){if((!t.live||c<this.hls.liveSyncPosition)&&(i=this.getFwdBufferInfo(this.videoBuffer||this.media,bt))&&a.start>i.end+a.duration){if(null===(u=this.fragmentTracker.getFragAtPos(a.start,bt)))return;if(!(d=d||!!u.gap||0===i.len)||r.nextStart&&r.nextStart<u.end)return}this.loadFragment(a,n,c)}else this.bufferFlushed=!0}}}},r.onMediaDetaching=function(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,e.prototype.onMediaDetaching.call(this)},r.onAudioTracksUpdated=function(e,t){t=t.audioTracks,this.resetTransmuxer(),this.levels=t.map(function(e){return new Vt(e)})},r.onAudioTrackSwitching=function(e,t){var i=!!t.url,r=(this.trackId=t.id,this.fragCurrent);r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==Hi&&(this.setInterval(100),this.state=Ki,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())},r.onManifestLoading=function(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1},r.onLevelLoaded=function(e,t){this.mainDetails=t.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(C.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},r.onAudioTrackLoaded=function(e,t){if(null==this.mainDetails)this.cachedTrackLoadedData=t;else{var i=this.levels,r=t.details;t=t.id;if(i){this.log("Audio track "+t+" loaded ["+r.startSN+","+r.endSN+"]"+(r.lastPartSn?"[part-"+r.lastPartSn+"-"+r.lastPartIndex+"]":"")+",duration:"+r.totalduration);i=i[t];var n=0;if(r.live||null!=(a=i.details)&&a.live){this.checkLiveUpdate(r);var a=this.mainDetails;if(r.deltaUpdateFailed||!a)return;n=!i.details&&r.hasProgramDateTime&&a.hasProgramDateTime?(xi(r,a),r.fragments[0].start):this.alignPlaylists(r,i.details,null==(a=this.levelLastLoaded)?void 0:a.details)}i.details=r,this.levelLastLoaded=i,this.startFragRequested||!this.mainDetails&&r.live||this.setStartPosition(this.mainDetails||r,n),this.state!==Yi||this.waitForCdnTuneIn(r)||(this.state=Ki),this.tick()}else this.warn("Audio tracks were reset while loading level "+t)}},r._handleFragmentLoadProgress=function(e){var t,i,r,n,a=e.frag,s=e.part,o=(e=e.payload,this.config),l=this.trackId,u=this.levels;u?(u=u[l])?(t=u.details)?(o=o.defaultAudioCodec||u.audioCodec||"mp4a.40.2",u=(u=this.transmuxer)||(this.transmuxer=new vn(this.hls,Tt,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this))),i=this.initPTS[a.cc],r=null==(r=a.initSegment)?void 0:r.data,void 0!==i?(n=s?s.index:-1,n=new Li(a.level,a.sn,a.stats.chunkCount,e.byteLength,n,-1!==n),u.push(e,r,o,"",a,s,t.totalduration,!1,n,i)):(this.log("Unknown video PTS for cc "+a.cc+", waiting for video PTS before demuxing audio frag "+a.sn+" of ["+t.startSN+" ,"+t.endSN+"],track "+l),(this.waitingData=this.waitingData||{frag:a,part:s,cache:new tr,complete:!1}).cache.push(new Uint8Array(e)),this.waitingVideoCC=this.videoTrackCC,this.state=Zi)):(this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(a.start)):this.warn("Audio track is undefined on fragment load progress"):this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered")},r._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:e.prototype._handleFragmentLoadComplete.call(this,t)},r.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},r.onBufferCreated=function(e,t){var i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)},r.onFragBuffered=function(e,t){var r,n=t.frag;t=t.part;n.type!==Tt?this.loadedmetadata||n.type!==bt||(r=this.videoBuffer||this.media)&&Ri.getBuffered(r).length&&(this.loadedmetadata=!0):this.fragContextChanged(n)?this.warn("Fragment "+n.sn+(t?" p: "+t.index:"")+" of level "+n.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+(this.switchingTrack?this.switchingTrack.name:"false")):("initSegment"!==n.sn&&(this.fragPrevious=n,r=this.switchingTrack)&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger(C.AUDIO_TRACK_SWITCHED,i({},r))),this.fragBufferedComplete(n,t))},r.onError=function(t,i){var r;if(i.fatal)this.state=Ji;else switch(i.details){case A.FRAG_GAP:case A.FRAG_PARSING_ERROR:case A.FRAG_DECRYPT_ERROR:case A.FRAG_LOAD_ERROR:case A.FRAG_LOAD_TIMEOUT:case A.KEY_LOAD_ERROR:case A.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Tt,i);break;case A.AUDIO_TRACK_LOAD_ERROR:case A.AUDIO_TRACK_LOAD_TIMEOUT:case A.LEVEL_PARSING_ERROR:i.levelRetry||this.state!==Yi||(null==(r=i.context)?void 0:r.type)!==yt||(this.state=Ki);break;case A.BUFFER_APPEND_ERROR:case A.BUFFER_FULL_ERROR:i.parent&&"audio"===i.parent&&(i.details===A.BUFFER_APPEND_ERROR?this.resetLoadingState():this.reduceLengthAndFlushBuffer(i)&&(this.bufferedTrack=null,e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")));break;case A.INTERNAL_EXCEPTION:this.recoverWorkerError(i)}},r.onBufferFlushing=function(e,t){t.type!==G&&(this.flushing=!0)},r.onBufferFlushed=function(e,t){var i;(t=t.type)!==G&&(this.flushing=!1,this.bufferFlushed=!0,this.state===Qi&&(this.state=Ki),i=this.mediaBuffer||this.media)&&(this.afterBufferFlushed(i,t,Tt),this.tick())},r._handleTransmuxComplete=function(e){var t,i,r,n,a,s,o,l,c=this.hls,d=e.remuxResult,h=(e=e.chunkMeta,this.getCurrentContext(e));h?(t=h.frag,i=h.part,r=(h=h.level).details,n=d.audio,a=d.text,s=d.id3,d=d.initSegment,this.fragContextChanged(t)||!r?this.fragmentTracker.removeFragment(t):(this.state=Xi,this.switchingTrack&&n&&this.completeAudioSwitch(this.switchingTrack),null!=d&&d.tracks&&(l=t.initSegment||t,this._bufferInitSegment(h,d.tracks,l,e),c.trigger(C.FRAG_PARSING_INIT_SEGMENT,{frag:l,id:"audio",tracks:d.tracks})),n&&(h=n.startPTS,l=n.endPTS,d=n.startDTS,o=n.endDTS,i&&(i.elementaryStreams[j]={startPTS:h,endPTS:l,startDTS:d,endDTS:o}),t.setElementaryStreamInfo(j,h,l,d,o),this.bufferFragmentData(n,t,i,e)),null!=s&&null!=(h=s.samples)&&h.length&&(l=u({id:"audio",frag:t,details:r},s),c.trigger(C.FRAG_PARSING_METADATA,l)),a&&(d=u({id:"audio",frag:t,details:r},a),c.trigger(C.FRAG_PARSING_USERDATA,d)))):this.resetWhenMissingContext(e)},r._bufferInitSegment=function(e,t,i,r){var n;this.state===Xi&&(t.video&&delete t.video,n=t.audio)&&(n.id="audio",e=e.audioCodec,this.log("Init audio buffer, container:"+n.container+", codecs[level/parsed]=["+e+"/"+n.codec+"]"),e&&1===e.split(",").length&&(n.levelCodec=e),this.hls.trigger(C.BUFFER_CODECS,t),null!=(e=n.initSegment)&&e.byteLength&&(t={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:e},this.hls.trigger(C.BUFFER_APPENDING,t)),this.tickImmediate())},r.loadFragment=function(t,i,r){var n=this.fragmentTracker.getState(t);this.fragCurrent=t,this.switchingTrack||n===bi||n===Si?"initSegment"===t.sn?this._loadInitSegment(t,i):null!=(n=i.details)&&n.live&&!this.initPTS[t.cc]?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=Zi,(n=this.mainDetails)&&n.fragments[0].start!==i.details.fragments[0].start&&xi(i.details,n)):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,i,r)):this.clearTrackerIfNeeded(t)},r.flushAudioIfNeeded=function(t){var i=this.media,r=this.bufferedTrack,n=null==r?void 0:r.attrs,a=t.attrs;i&&n&&(n.CHANNELS!==a.CHANNELS||r.name!==t.name||r.lang!==t.lang)&&(this.log("Switching audio track : flushing all audio"),e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)},r.completeAudioSwitch=function(e){var t=this.hls;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(C.AUDIO_TRACK_SWITCHED,i({},e))},t}(_i),Er=function(e){function t(t){return(t=e.call(this,t,"audio-track-controller")||this).tracks=[],t.groupIds=null,t.tracksInGroup=[],t.trackId=-1,t.currentTrack=null,t.selectDefaultTrack=!0,t.registerListeners(),t}c(t,e);var r=t.prototype;return r.registerListeners=function(){var e=this.hls;e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(C.ERROR,this.onError,this)},r.unregisterListeners=function(){var e=this.hls;e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.LEVEL_LOADING,this.onLevelLoading,this),e.off(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(C.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(C.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,e.prototype.destroy.call(this)},r.onManifestLoading=function(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0},r.onManifestParsed=function(e,t){this.tracks=t.audioTracks||[]},r.onAudioTrackLoaded=function(e,t){var i,r=t.id,n=t.groupId,a=t.details,s=this.tracksInGroup[r];s&&s.groupId===n?(i=s.details,s.details=t.details,this.log("Audio track "+r+' "'+s.name+'" lang:'+s.lang+" group:"+n+" loaded ["+a.startSN+"-"+a.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,t,i)):this.warn("Audio track with id:"+r+" and group:"+n+" not found in active group "+(null==s?void 0:s.groupId))},r.onLevelLoading=function(e,t){this.switchLevel(t.level)},r.onLevelSwitching=function(e,t){this.switchLevel(t.level)},r.switchLevel=function(e){if(e=this.hls.levels[e]){var t=e.audioGroups||null,i=this.groupIds;e=this.currentTrack;if(!t||(null==i?void 0:i.length)!==(null==t?void 0:t.length)||null!=t&&t.some(function(e){return-1===(null==i?void 0:i.indexOf(e))})){this.groupIds=t,this.trackId=-1,this.currentTrack=null;var r=this.tracks.filter(function(e){return!t||-1!==t.indexOf(e.groupId)});if(r.length)this.selectDefaultTrack&&!r.some(function(e){return e.default})&&(this.selectDefaultTrack=!1),r.forEach(function(e,t){e.id=t});else if(!e&&!this.tracksInGroup.length)return;this.tracksInGroup=r;var n=this.hls.config.audioPreference,a=(-1===(n=(!e&&n&&(e=-1<(a=pi(n,r,gi))?r[a]:(a=pi(n,this.tracks),this.tracks[a])),this.findTrackId(e)))&&e&&(n=this.findTrackId(null)),{audioTracks:r});a=(this.log("Updating audio tracks, "+r.length+" track(s) found in group(s): "+(null==t?void 0:t.join(","))),this.hls.trigger(C.AUDIO_TRACKS_UPDATED,a),this.trackId);-1!==n&&-1===a?this.setAudioTrack(n):r.length&&-1===a&&(a=new Error("No audio track selected for current audio group-ID(s): "+(null==(n=this.groupIds)?void 0:n.join(","))+" track count: "+r.length),this.warn(a.message),this.hls.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:a}))}else this.shouldReloadPlaylist(e)&&this.setAudioTrack(this.trackId)}},r.onError=function(e,t){t.fatal||!t.context||t.context.type!==yt||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t))},r.setAudioOption=function(e){var t,i,r,n,a,s,o=this.hls;if(o.config.audioPreference=e){var l=this.allAudioTracks;if(this.selectDefaultTrack=!1,l.length){var u,c=this.currentTrack;if(c&&mi(e,c,gi))return c;if(-1<(d=pi(e,this.tracksInGroup,gi)))return u=this.tracksInGroup[d],this.setAudioTrack(d),u;if(c){var d;if(-1===(d=(-1===(d=o.loadLevel)&&(d=o.firstAutoLevel),t=e,u=o.levels,i=l,r=gi,d=u[c=d],1<(h=u.reduce(function(e,t,i){return(e[t=t.uri]||(e[t]=[])).push(i),e},{})[d.uri]).length&&(c=Math.max.apply(Math,h)),n=d.videoRange,a=d.frameRate,s=d.codecSet.substring(0,4),-1<(h=vi(u,c,function(e){var o;if(e.videoRange===n&&e.frameRate===a&&e.codecSet.substring(0,4)===s)return o=e.audioGroups,e=i.filter(function(e){return!o||-1!==o.indexOf(e.groupId)}),-1<pi(t,e,r)}))?h:vi(u,c,function(e){var n=e.audioGroups;e=i.filter(function(e){return!n||-1!==n.indexOf(e.groupId)});return-1<pi(t,e,r)}))))return null;o.nextLoadLevel=d}if(e.channels||e.audioCodec){var h=pi(e,l);if(-1<h)return l[h]}}}return null},r.setAudioTrack=function(e){var t,r,n=this.tracksInGroup;e<0||e>=n.length?this.warn("Invalid audio track id: "+e):(this.clearTimer(),this.selectDefaultTrack=!1,t=this.currentTrack,r=(n=n[e]).details&&!n.details.live,e===this.trackId&&n===t&&r||(this.log("Switching to audio-track "+e+' "'+n.name+'" lang:'+n.lang+" group:"+n.groupId+" channels:"+n.channels),this.trackId=e,this.currentTrack=n,this.hls.trigger(C.AUDIO_TRACK_SWITCHING,i({},n)),r)||(e=this.switchParams(n.url,null==t?void 0:t.details),this.loadPlaylist(e)))},r.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;i<t.length;i++){var r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||mi(e,r,gi)))return i}if(e){for(var n=e.name,a=e.lang,s=e.assocLang,o=e.characteristics,l=e.audioCodec,u=e.channels,c=0;c<t.length;c++)if(mi({name:n,lang:a,assocLang:s,characteristics:o,audioCodec:l,channels:u},t[c],gi))return c;for(var d=0;d<t.length;d++){var h=t[d];if(_n(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return d}for(var f=0;f<t.length;f++){var p=t[f];if(_n(e.attrs,p.attrs,["LANGUAGE"]))return f}}return-1},r.loadPlaylist=function(t){var i=this.currentTrack;if(this.shouldLoadPlaylist(i)&&i){e.prototype.loadPlaylist.call(this);var r=i.id,n=i.groupId,a=i.url;if(t)try{a=t.addDirectives(a)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("loading audio-track playlist "+r+' "'+i.name+'" lang:'+i.lang+" group:"+n),this.clearTimer(),this.hls.trigger(C.AUDIO_TRACK_LOADING,{url:a,id:r,groupId:n,deliveryDirectives:t||null})}},l(t,[{key:"allAudioTracks",get:function(){return this.tracks}},{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}}])}(si),rr=function(e){function t(t,i,r){return(t=e.call(this,t,i,r,"subtitle-stream-controller",St)||this).currentTrackId=-1,t.tracksBuffered=[],t.mainDetails=null,t.registerListeners(),t}c(t,e);var i=t.prototype;return i.onHandlerDestroying=function(){this.unregisterListeners(),e.prototype.onHandlerDestroying.call(this),this.mainDetails=null},i.registerListeners=function(){e.prototype.registerListeners.call(this);var t=this.hls;t.on(C.LEVEL_LOADED,this.onLevelLoaded,this),t.on(C.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(C.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(C.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(C.FRAG_BUFFERED,this.onFragBuffered,this)},i.unregisterListeners=function(){e.prototype.unregisterListeners.call(this);var t=this.hls;t.off(C.LEVEL_LOADED,this.onLevelLoaded,this),t.off(C.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(C.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(C.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(C.FRAG_BUFFERED,this.onFragBuffered,this)},i.startLoad=function(e){this.stopLoad(),this.state=Ki,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},i.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},i.onMediaDetaching=function(){this.tracksBuffered=[],e.prototype.onMediaDetaching.call(this)},i.onLevelLoaded=function(e,t){this.mainDetails=t.details},i.onSubtitleFragProcessed=function(e,t){var i=t.frag;t=t.success;if(this.fragPrevious=i,this.state=Ki,t){var r=this.tracksBuffered[this.currentTrackId];if(r){for(var n,a=i.start,s=0;s<r.length;s++)if(a>=r[s].start&&a<=r[s].end){n=r[s];break}t=i.start+i.duration,n?n.end=t:r.push(n={start:a,end:t}),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}}},i.onBufferFlushing=function(e,t){var i,r=t.startOffset,n=t.endOffset;0!==r||n===Number.POSITIVE_INFINITY||(i=n-1)<=0||(t.endOffsetSubtitles=Math.max(0,i),this.tracksBuffered.forEach(function(e){for(var t=0;t<e.length;)if(e[t].end<=i)e.shift();else{if(!(e[t].start<i))break;e[t].start=i,t++}}),this.fragmentTracker.removeFragmentsInRange(r,i,St))},i.onFragBuffered=function(e,t){this.loadedmetadata||t.frag.type!==bt||null!=(t=this.media)&&t.buffered.length&&(this.loadedmetadata=!0)},i.onError=function(e,t){(null==(t=t.frag)?void 0:t.type)===St&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Hi)&&(this.state=Ki)},i.onSubtitleTracksUpdated=function(e,t){var i=this;t=t.subtitleTracks;this.levels&&yn(this.levels,t)?this.levels=t.map(function(e){return new Vt(e)}):(this.tracksBuffered=[],this.levels=t.map(function(e){return e=new Vt(e),i.tracksBuffered[e.id]=[],e}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,St),this.fragPrevious=null,this.mediaBuffer=null)},i.onSubtitleTrackSwitch=function(e,t){this.currentTrackId=t.id,null!=(t=this.levels)&&t.length&&-1!==this.currentTrackId?(null!=(t=this.levels[this.currentTrackId])&&t.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,t&&this.state!==Hi&&this.setInterval(500)):this.clearInterval()},i.onSubtitleTrackLoaded=function(e,t){var i=this.currentTrackId,r=this.levels,n=t.details;t=t.id;if(r){var a=r[i];if(!(t>=r.length||t!==i)&&a){if(this.log("Subtitle track "+t+" loaded ["+n.startSN+","+n.endSN+"]"+(n.lastPartSn?"[part-"+n.lastPartSn+"-"+n.lastPartIndex+"]":"")+",duration:"+n.totalduration),this.mediaBuffer=this.mediaBufferTimeRanges,r=0,n.live||null!=(i=a.details)&&i.live){if(i=this.mainDetails,n.deltaUpdateFailed||!i)return;var s,o=i.fragments[0];a.details?0===(r=this.alignPlaylists(n,a.details,null==(s=this.levelLastLoaded)?void 0:s.details))&&o&&zt(n,r=o.start):n.hasProgramDateTime&&i.hasProgramDateTime?(xi(n,i),r=n.fragments[0].start):o&&zt(n,r=o.start)}a.details=n,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&n.live||this.setStartPosition(this.mainDetails||n,r),this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===Ki&&!ri(null,n.fragments,this.media.currentTime,0)&&(this.warn("Subtitle playlist not aligned with playback"),a.details=void 0)}}else this.warn("Subtitle tracks were reset while loading level "+t)},i._handleFragmentLoadComplete=function(e){var t,i=this,r=e.frag,n=(e=e.payload,r.decryptdata),a=this.hls;this.fragContextChanged(r)||e&&0<e.byteLength&&null!=n&&n.key&&n.iv&&$(n.method)&&(t=performance.now(),this.decrypter.decrypt(new Uint8Array(e),n.key.buffer,n.iv.buffer,Q(n.method)).catch(function(e){throw a.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:r}),e}).then(function(e){var i=performance.now();a.trigger(C.FRAG_DECRYPTED,{frag:r,payload:e,stats:{tstart:t,tdecrypt:i}})}).catch(function(e){i.warn(e.name+": "+e.message),i.state=Ki}))},i.doTick=function(){var e,t,i,r,n,a,s,o,l;this.media?this.state===Ki&&(e=this.currentTrackId,e=null==(s=this.levels)?void 0:s[e])&&s.length&&e.details&&(s=this.config,r=this.getLoadPosition(),t=(r=Ri.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,s.maxBufferHole)).end,r=r.len,i=e.details,this.hls.maxBufferLength+i.levelTargetDuration<r||(n=(r=i.fragments).length,l=i.edge,o=null,a=this.fragPrevious,t<l?(s=l-(l=s.maxFragLookUpTolerance)<t?0:l,!(o=ri(a,r,Math.max(r[0].start,t),s))&&a&&a.start<r[0].start&&(o=r[0])):o=r[n-1],o&&("initSegment"!==(o=this.mapToInitFragWhenRequired(o)).sn&&(l=r[o.sn-i.startSN-1])&&l.cc===o.cc&&this.fragmentTracker.getState(l)===bi&&(o=l),this.fragmentTracker.getState(o)===bi)&&this.loadFragment(o,e,t))):this.state=Ki},i.loadFragment=function(t,i,r){"initSegment"===(this.fragCurrent=t).sn?this._loadInitSegment(t,i):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,i,r))},l(t,[{key:"mediaBufferTimeRanges",get:function(){return new Tn(this.tracksBuffered[this.currentTrackId]||[])}}])}(_i);var Tn=function(e){function t(t,i,r){if(r-1<(i>>>=0))throw new DOMException("Failed to execute '"+t+"' on 'TimeRanges': The index provided ("+i+") is greater than the maximum bound ("+r+")");return e[i][t]}this.buffered=void 0,this.buffered={get length(){return e.length},end:function(i){return t("end",i,e.length)},start:function(i){return t("start",i,e.length)}}},Sn=(Cr=function(e){function t(t){var i=e.call(this,t,"subtitle-track-controller")||this;return i.media=null,i.tracks=[],i.groupIds=null,i.tracksInGroup=[],i.trackId=-1,i.currentTrack=null,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i._subtitleDisplay=!0,i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.onTextTracksChanged=function(){if(i.useTextTrackPolling||self.clearInterval(i.subtitlePollingInterval),i.media&&i.hls.config.renderTextTracksNatively){for(var e=null,t=Pt(i.media.textTracks),r=0;r<t.length;r++)if("hidden"===t[r].mode)e=t[r];else if("showing"===t[r].mode){e=t[r];break}var n=i.findTrackForTextTrack(e);i.subtitleTrack!==n&&i.setSubtitleTrack(n)}},i.registerListeners(),i}c(t,e);var i=t.prototype;return i.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,e.prototype.destroy.call(this)},i.registerListeners=function(){var e=this.hls;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(C.ERROR,this.onError,this)},i.unregisterListeners=function(){var e=this.hls;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.LEVEL_LOADING,this.onLevelLoading,this),e.off(C.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(C.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(C.ERROR,this.onError,this)},i.onMediaAttached=function(e,t){this.media=t.media,this.media&&(-1<this.queuedDefaultTrack&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},i.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)},i.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),-1<this.trackId&&(this.queuedDefaultTrack=this.trackId),Pt(this.media.textTracks).forEach(function(e){At(e)}),this.subtitleTrack=-1,this.media=null)},i.onManifestLoading=function(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},i.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},i.onSubtitleTrackLoaded=function(e,t){var i,r=t.id,n=t.groupId,a=t.details,s=this.tracksInGroup[r];s&&s.groupId===n?(i=s.details,s.details=t.details,this.log("Subtitle track "+r+' "'+s.name+'" lang:'+s.lang+" group:"+n+" loaded ["+a.startSN+"-"+a.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,t,i)):this.warn("Subtitle track with id:"+r+" and group:"+n+" not found in active group "+(null==s?void 0:s.groupId))},i.onLevelLoading=function(e,t){this.switchLevel(t.level)},i.onLevelSwitching=function(e,t){this.switchLevel(t.level)},i.switchLevel=function(e){if(e=this.hls.levels[e]){var t=e.subtitleGroups||null,i=this.groupIds;e=this.currentTrack;if(!t||(null==i?void 0:i.length)!==(null==t?void 0:t.length)||null!=t&&t.some(function(e){return-1===(null==i?void 0:i.indexOf(e))})){this.groupIds=t,this.trackId=-1,this.currentTrack=null;var r=this.tracks.filter(function(e){return!t||-1!==t.indexOf(e.groupId)});if(r.length)this.selectDefaultTrack&&!r.some(function(e){return e.default})&&(this.selectDefaultTrack=!1),r.forEach(function(e,t){e.id=t});else if(!e&&!this.tracksInGroup.length)return;this.tracksInGroup=r;var n=this.hls.config.subtitlePreference,a=(-1===(n=(!e&&n&&(this.selectDefaultTrack=!1,e=-1<(a=pi(n,r))?r[a]:(a=pi(n,this.tracks),this.tracks[a])),this.findTrackId(e)))&&e&&(n=this.findTrackId(null)),{subtitleTracks:r});this.log("Updating subtitle tracks, "+r.length+' track(s) found in "'+(null==t?void 0:t.join(","))+'" group-id'),this.hls.trigger(C.SUBTITLE_TRACKS_UPDATED,a),-1!==n&&-1===this.trackId&&this.setSubtitleTrack(n)}else this.shouldReloadPlaylist(e)&&this.setSubtitleTrack(this.trackId)}},i.findTrackId=function(e){for(var t=this.tracksInGroup,i=this.selectDefaultTrack,r=0;r<t.length;r++){var n=t[r];if((!i||n.default)&&(i||e)&&(!e||mi(n,e)))return r}if(e){for(var a=0;a<t.length;a++){var s=t[a];if(_n(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return a}for(var o=0;o<t.length;o++){var l=t[o];if(_n(e.attrs,l.attrs,["LANGUAGE"]))return o}}return-1},i.findTrackForTextTrack=function(e){if(e)for(var t=this.tracksInGroup,i=0;i<t.length;i++)if(bn(t[i],e))return i;return-1},i.onError=function(e,t){t.fatal||!t.context||t.context.type!==_t||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t)},i.setSubtitleOption=function(e){if(this.hls.config.subtitlePreference=e){var t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){var i=this.currentTrack;if(i&&mi(e,i))return i;var r,n=pi(e,this.tracksInGroup);if(-1<n)return r=this.tracksInGroup[n],this.setSubtitleTrack(n),r;if(i)return null;if(-1<(n=pi(e,t)))return t[n]}}return null},i.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this);var i=this.currentTrack;if(this.shouldLoadPlaylist(i)&&i){var r=i.id,n=i.groupId;i=i.url;if(t)try{i=t.addDirectives(i)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Loading subtitle playlist for id "+r),this.hls.trigger(C.SUBTITLE_TRACK_LOADING,{url:i,id:r,groupId:n,deliveryDirectives:t||null})}},i.toggleTrackModes=function(){var e,t,i=this.media;i&&(i=Pt(i.textTracks),(e=this.currentTrack)&&!(t=i.filter(function(t){return bn(e,t)})[0])&&this.warn('Unable to find subtitle TextTrack with name "'+e.name+'" and language "'+e.lang+'"'),[].slice.call(i).forEach(function(e){"disabled"!==e.mode&&e!==t&&(e.mode="disabled")}),t)&&(i=this.subtitleDisplay?"showing":"hidden",t.mode!==i)&&(t.mode=i)},i.setSubtitleTrack=function(e){var t,i,r,n,a,s,o=this.tracksInGroup;this.media?e<-1||e>=o.length||!E(e)?this.warn("Invalid subtitle track id: "+e):(this.clearTimer(),this.selectDefaultTrack=!1,t=this.currentTrack,o=o[e]||null,this.trackId=e,this.currentTrack=o,this.toggleTrackModes(),o?(s=!!o.details&&!o.details.live,e===this.trackId&&o===t&&s||(this.log("Switching to subtitle-track "+e+(o?' "'+o.name+'" lang:'+o.lang+" group:"+o.groupId:"")),s=o.id,i=o.groupId,r=o.name,n=o.type,a=o.url,this.hls.trigger(C.SUBTITLE_TRACK_SWITCH,{id:s,groupId:void 0===i?"":i,name:r,type:n,url:a}),s=this.switchParams(o.url,null==t?void 0:t.details),this.loadPlaylist(s))):this.hls.trigger(C.SUBTITLE_TRACK_SWITCH,{id:e})):this.queuedDefaultTrack=e},l(t,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(e){this._subtitleDisplay=e,-1<this.trackId&&this.toggleTrackModes()}},{key:"allSubtitleTracks",get:function(){return this.tracks}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}}])}(si),function(){function e(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var t=e.prototype;return t.append=function(e,t,i){var r=this.queues[t];r.push(e),1!==r.length||i||this.executeNext(t)},t.appendBlocker=function(e){var t=this;return new Promise(function(i){t.append({execute:i,onStart:function(){},onComplete:function(){},onError:function(){}},e)})},t.unblockAudio=function(e){this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")},t.executeNext=function(e){var t=this.queues[e];if(t.length){t=t[0];try{t.execute()}catch(i){B.warn('[buffer-operation-queue]: Exception executing "'+e+'" SourceBuffer operation: '+i),t.onError(i),null!=(t=this.buffers[e])&&t.updating||this.shiftAndExecuteNext(e)}}},t.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},t.current=function(e){return this.queues[e][0]},e}()),En=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;qr=function(e){function t(t,i){var r=e.call(this,"buffer-controller",t.logger)||this;return r.details=null,r._objectUrl=null,r.operationQueue=void 0,r.listeners=void 0,r.hls=void 0,r.fragmentTracker=void 0,r.bufferCodecEventsExpected=0,r._bufferCodecEventsTotal=0,r.media=null,r.mediaSource=null,r.lastMpegAudioChunk=null,r.blockedAudioAppend=null,r.lastVideoAppendEnd=0,r.appendSource=void 0,r.appendErrors={audio:0,video:0,audiovideo:0},r.tracks={},r.pendingTracks={},r.sourceBuffer=void 0,r._onEndStreaming=function(e){r.hls&&r.hls.pauseBuffering()},r._onStartStreaming=function(e){r.hls&&r.hls.resumeBuffering()},r._onMediaSourceOpen=function(){var e,t=(i=r).media,i=i.mediaSource;r.log("Media source opened"),t&&(t.removeEventListener("emptied",r._onMediaEmptied),(e=r.getDurationAndRange())&&r.updateMediaSource(e),r.hls.trigger(C.MEDIA_ATTACHED,{media:t,mediaSource:i})),i&&i.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},r._onMediaSourceClose=function(){r.log("Media source closed")},r._onMediaSourceEnded=function(){r.log("Media source ended")},r._onMediaEmptied=function(){var e,t=(e=r).mediaSrc;t!==(e=e._objectUrl)&&r.error("Media element src was set while attaching MediaSource ("+e+" > "+t+")")},r.hls=t,r.fragmentTracker=i,r.appendSource=t.config.preferManagedMediaSource&&"undefined"!=typeof self&&self.ManagedMediaSource,r._initSourceBuffer(),r.registerListeners(),r}c(t,e);var i=t.prototype;return i.hasSourceTypes=function(){return 0<this.getSourceBufferTypes().length||0<Object.keys(this.pendingTracks).length},i.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null},i.registerListeners=function(){var e=this.hls;e.on(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.BUFFER_RESET,this.onBufferReset,this),e.on(C.BUFFER_APPENDING,this.onBufferAppending,this),e.on(C.BUFFER_CODECS,this.onBufferCodecs,this),e.on(C.BUFFER_EOS,this.onBufferEos,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(C.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(C.FRAG_PARSED,this.onFragParsed,this),e.on(C.FRAG_CHANGED,this.onFragChanged,this)},i.unregisterListeners=function(){var e=this.hls;e.off(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.BUFFER_RESET,this.onBufferReset,this),e.off(C.BUFFER_APPENDING,this.onBufferAppending,this),e.off(C.BUFFER_CODECS,this.onBufferCodecs,this),e.off(C.BUFFER_EOS,this.onBufferEos,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(C.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(C.FRAG_PARSED,this.onFragParsed,this),e.off(C.FRAG_CHANGED,this.onFragChanged,this)},i._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new Sn(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0},i.onManifestLoading=function(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null},i.onManifestParsed=function(e,t){var i=2;(!t.audio||t.video)&&t.altAudio||(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},i.onMediaAttaching=function(e,t){t=this.media=t.media;var i,r,n,a=ze(this.appendSource);if(t&&a){a=this.mediaSource=new a;var s=(this.log("created media source: "+(null==(s=a.constructor)?void 0:s.name)),a.addEventListener("sourceopen",this._onMediaSourceOpen),a.addEventListener("sourceended",this._onMediaSourceEnded),a.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(a.addEventListener("startstreaming",this._onStartStreaming),a.addEventListener("endstreaming",this._onEndStreaming)),this._objectUrl=self.URL.createObjectURL(a));if(this.appendSource)try{t.removeAttribute("src");var o=self.ManagedMediaSource;t.disableRemotePlayback=t.disableRemotePlayback||o&&a instanceof o,kn(t),i=t,r=s,(n=self.document.createElement("source")).type="video/mp4",n.src=r,i.appendChild(n),t.load()}catch(e){t.src=s}else t.src=s;t.addEventListener("emptied",this._onMediaEmptied)}},i.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,i=this._objectUrl;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn("onMediaDetaching: "+e.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&kn(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup"),this.media=null),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={},this.hls.trigger(C.MEDIA_DETACHED,void 0)},i.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(t){e.resetBuffer(t)}),this._initSourceBuffer(),this.hls.resumeBuffering()},i.resetBuffer=function(e){var t,i=this.sourceBuffer[e];try{i&&(this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(t=this.mediaSource))&&t.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(t){this.warn("onBufferReset "+e,t)}},i.onBufferCodecs=function(e,t){var i,r=this,n=this.getSourceBufferTypes().length,a=Object.keys(t);a.forEach(function(e){var i,a,s,o,l,u,c,d,h,f;n?(i=r.tracks[e])&&"function"==typeof(null==(u=i.buffer)?void 0:u.changeType)&&(a=(u=t[e]).id,s=u.codec,o=u.levelCodec,l=u.container,u=u.metadata,d=null==(c=rt(i.codec,i.levelCodec))?void 0:c.replace(En,"$1"),f=null==(h=rt(s,o))?void 0:h.replace(En,"$1"),h)&&d!==f&&("audio"===e.slice(0,5)&&(h=it(h,r.appendSource)),r.appendChangeType(e,l+";codecs="+h),r.log("switching codec "+c+" to "+h),r.tracks[e]={buffer:i.buffer,codec:s,container:l,levelCodec:o,metadata:u,id:a}):r.pendingTracks[e]=t[e]}),n||(i=Math.max(this.bufferCodecEventsExpected-1,0),this.bufferCodecEventsExpected!==i&&(this.log(i+" bufferCodec event(s) expected "+a.join(",")),this.bufferCodecEventsExpected=i),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},i.appendChangeType=function(e,t){var i=this,r=this.operationQueue;r.append({execute:function(){var n=i.sourceBuffer[e];n&&(i.log("changing "+e+" sourceBuffer type to "+t),n.changeType(t)),r.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){i.warn("Failed to change "+e+" SourceBuffer type",t)}},e,!!this.pendingTracks[e])},i.blockAudio=function(e){var t=this,i=e.start,r=i+.05*e.duration;!0!==(null==(i=this.fragmentTracker.getAppendedFrag(i,bt))?void 0:i.gap)&&(this.blockedAudioAppend={op:i={execute:function(){var e;(t.lastVideoAppendEnd>r||t.sourceBuffer.video&&Ri.isBuffered(t.sourceBuffer.video,r)||!0===(null==(e=t.fragmentTracker.getAppendedFrag(r,bt))?void 0:e.gap))&&(t.blockedAudioAppend=null,t.operationQueue.shiftAndExecuteNext("audio"))},onStart:function(){},onComplete:function(){},onError:function(){}},frag:e},this.operationQueue.append(i,"audio",!0))},i.unblockAudio=function(){var e=this.blockedAudioAppend;e&&(this.blockedAudioAppend=null,this.operationQueue.unblockAudio(e.op))},i.onBufferAppending=function(e,t){var i,r,n=this,a=this.operationQueue,s=this.tracks,o=t.data,l=t.type,u=t.parent,c=t.frag,d=t.part,h=t.chunkMeta,f=h.buffering[l],p=c.sn,m=(t=self.performance.now(),f.start=t,c.stats.buffering),g=d?d.stats.buffering:null,v=(t=(0===m.start&&(m.start=t),g&&0===g.start&&(g.start=t),s.audio),!1),y=((s=("audio"===l&&"audio/mpeg"===(null==t?void 0:t.container)&&(v=!this.lastMpegAudioChunk||1===h.id||this.lastMpegAudioChunk.sn!==h.sn,this.lastMpegAudioChunk=h),this.sourceBuffer.video))&&"initSegment"!==p&&(t=d||c,i=this.blockedAudioAppend,"audio"!==l||"main"===u||this.blockedAudioAppend?"video"===l&&(u=t.end,i&&((i=i.frag.start)<u||u<this.lastVideoAppendEnd||Ri.isBuffered(s,i))&&this.unblockAudio(),this.lastVideoAppendEnd=u):(i=t.start+.05*t.duration,u=s.buffered,r=this.operationQueue.current("video"),(!u.length&&!r||!r&&!Ri.isBuffered(s,i)&&this.lastVideoAppendEnd<i)&&this.blockAudio(t))),(d||c).start);a.append({execute:function(){var e,t;f.executeStart=self.performance.now(),v&&(e=n.sourceBuffer[l])&&(t=y-e.timestampOffset,.1<=Math.abs(t))&&(n.log("Updating audio SourceBuffer timestampOffset to "+y+" (delta: "+t+") sn: "+p+")"),e.timestampOffset=y),n.appendExecutor(o,l)},onStart:function(){},onComplete:function(){var e,t=self.performance.now(),i=(f.executeEnd=f.end=t,0===m.first&&(m.first=t),g&&0===g.first&&(g.first=t),n.sourceBuffer),r={};for(e in i)r[e]=Ri.getBuffered(i[e]);n.appendErrors[l]=0,"audio"===l||"video"===l?n.appendErrors.audiovideo=0:(n.appendErrors.audio=0,n.appendErrors.video=0),n.hls.trigger(C.BUFFER_APPENDED,{type:l,frag:c,part:d,chunkMeta:h,parent:c.type,timeRanges:r})},onError:function(e){var t={type:L.MEDIA_ERROR,parent:c.type,details:A.BUFFER_APPEND_ERROR,sourceBufferName:l,frag:c,part:d,chunkMeta:h,error:e,err:e,fatal:!1};e.code===DOMException.QUOTA_EXCEEDED_ERR?t.details=A.BUFFER_FULL_ERROR:(e=++n.appendErrors[l],t.details=A.BUFFER_APPEND_ERROR,n.warn("Failed "+e+"/"+n.hls.config.appendErrorMaxRetry+' times to append segment in "'+l+'" sourceBuffer'),e>=n.hls.config.appendErrorMaxRetry&&(t.fatal=!0)),n.hls.trigger(C.ERROR,t)}},l,!!this.pendingTracks[l])},i.getFlushOp=function(e,t,i){var r=this;return{execute:function(){r.removeExecutor(e,t,i)},onStart:function(){},onComplete:function(){r.hls.trigger(C.BUFFER_FLUSHED,{type:e})},onError:function(t){r.warn("Failed to remove from "+e+" SourceBuffer",t)}}},i.onBufferFlushing=function(e,t){var i=this,r=this.operationQueue,n=t.type,a=t.startOffset,s=t.endOffset;n?r.append(this.getFlushOp(n,a,s),n):this.getSourceBufferTypes().forEach(function(e){r.append(i.getFlushOp(e,a,s),e)})},i.onFragParsed=function(e,t){var i=this,r=t.frag,n=t.part,a=(t=[],(n||r).elementaryStreams);a[V]?t.push("audiovideo"):(a[j]&&t.push("audio"),a[G]&&t.push("video")),0===t.length&&this.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers(function(){var e=self.performance.now();r.stats.buffering.end=e,n&&(n.stats.buffering.end=e),e=(n||r).stats;i.hls.trigger(C.FRAG_BUFFERED,{frag:r,part:n,stats:e,id:r.type})},t)},i.onFragChanged=function(e,t){this.trimBuffers()},i.onBufferEos=function(e,t){var i=this;"video"===t.type&&this.unblockAudio(),this.getSourceBufferTypes().reduce(function(e,r){var n=i.sourceBuffer[r];return!n||t.type&&t.type!==r||(n.ending=!0,n.ended)||(n.ended=!0,i.log(r+" sourceBuffer now EOS")),e&&!(n&&!n.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){i.getSourceBufferTypes().forEach(function(e){(e=i.sourceBuffer[e])&&(e.ending=!1)});var e=i.mediaSource;e&&"open"===e.readyState?(i.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&i.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: "+e.readyState)}))},i.onLevelUpdated=function(e,t){var i,r=this;(t=t.details).fragments.length&&(this.details=t,i=this.getDurationAndRange())&&(this.getSourceBufferTypes().length?this.blockBuffers(function(){return r.updateMediaSource(i)}):this.updateMediaSource(i))},i.trimBuffers=function(){var e,t=this.hls,i=this.details,r=this.media;r&&null!==i&&this.getSourceBufferTypes().length&&(t=t.config,r=r.currentTime,e=i.levelTargetDuration,i=i.live&&null!==t.liveBackBufferLength?t.liveBackBufferLength:t.backBufferLength,E(i)&&0<i&&(i=Math.max(i,e),i=Math.floor(r/e)*e-i,this.flushBackBuffer(r,e,i)),E(t.frontBufferFlushThreshold))&&0<t.frontBufferFlushThreshold&&(i=Math.max(t.maxBufferLength,t.frontBufferFlushThreshold),t=Math.max(i,e),i=Math.floor(r/e)*e+t,this.flushFrontBuffer(r,e,i))},i.flushBackBuffer=function(e,t,i){var r=this,n=this.details,a=this.sourceBuffer;this.getSourceBufferTypes().forEach(function(s){var o=a[s];if(o){var l=Ri.getBuffered(o);if(0<l.length&&i>l.start(0)){if(r.hls.trigger(C.BACK_BUFFER_REACHED,{bufferEnd:i}),null!=n&&n.live)r.hls.trigger(C.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(o.ended&&l.end(l.length-1)-e<2*t)return void r.log("Cannot flush "+s+" back buffer while SourceBuffer is in ended state");r.hls.trigger(C.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:s})}}})},i.flushFrontBuffer=function(e,t,i){var r=this,n=this.sourceBuffer;this.getSourceBufferTypes().forEach(function(a){var s,o,l,u=n[a];!u||(s=(l=Ri.getBuffered(u)).length)<2||(o=l.start(s-1),l=l.end(s-1),o<i)||o<=e&&e<=l||(u.ended&&e-l<2*t?r.log("Cannot flush "+a+" front buffer while SourceBuffer is in ended state"):r.hls.trigger(C.BUFFER_FLUSHING,{startOffset:o,endOffset:1/0,type:a}))})},i.getDurationAndRange=function(){var e,t,i,r,n,a;return this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState?(e=this.details,a=this.hls,r=this.media,t=this.mediaSource,i=e.fragments[0].start+e.totalduration,r=r.duration,n=E(t.duration)?t.duration:0,e.live&&a.config.liveDurationInfinity?(t.duration=1/0,e.fragments.length&&e.live&&t.setLiveSeekableRange?{duration:1/0,start:a=Math.max(0,e.fragments[0].start),end:Math.max(a,a+e.totalduration)}:{duration:1/0}):n<i&&r<i||!E(r)?{duration:i}:null):null},i.updateMediaSource=function(e){var t=e.duration,i=e.start;e=e.end;this.media&&this.mediaSource&&"open"===this.mediaSource.readyState&&(E(t)&&this.log("Updating Media Source duration to "+t.toFixed(3)),this.mediaSource.duration=t,void 0!==i)&&void 0!==e&&(this.log("Media Source duration is set to "+this.mediaSource.duration+". Setting seekable range to "+i+"-"+e+"."),this.mediaSource.setLiveSeekableRange(i,e))},i.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,r=Object.keys(i).length;r&&(!e||2===r||"audiovideo"in i)&&(this.createSourceBuffers(i),this.pendingTracks={},(e=this.getSourceBufferTypes()).length?(this.hls.trigger(C.BUFFER_CREATED,{tracks:this.tracks}),e.forEach(function(e){t.executeNext(e)})):(r=new Error("could not create source buffer for media codec(s)"),this.hls.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:r,reason:r.message})))},i.createSourceBuffers=function(e){var t=this,i=this.sourceBuffer,r=this.mediaSource;if(!r)throw Error("createSourceBuffers called when mediaSource was null");for(var n in e)!function(n){if(!i[n]){var a=e[n];if(!a)throw Error("source buffer exists for track "+n+", however track does not");var s=a.levelCodec||a.codec,o=(s&&"audio"===n.slice(0,5)&&(s=it(s,t.appendSource)),a.container+";codecs="+s);t.log("creating sourceBuffer("+o+")");try{var l=i[n]=r.addSourceBuffer(o),u=n;t.addBufferListener(u,"updatestart",t._onSBUpdateStart),t.addBufferListener(u,"updateend",t._onSBUpdateEnd),t.addBufferListener(u,"error",t._onSBUpdateError),t.appendSource&&t.addBufferListener(u,"bufferedchange",function(e,i){null!=(i=i.removedRanges)&&i.length&&t.hls.trigger(C.BUFFER_FLUSHED,{type:n})}),t.tracks[n]={buffer:l,codec:s,container:a.container,levelCodec:a.levelCodec,metadata:a.metadata,id:a.id}}catch(a){t.error("error while trying to add sourceBuffer: "+a.message),t.hls.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:a,sourceBufferName:n,mimeType:o})}}}(n)},i._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},i._onSBUpdateEnd=function(e){var t;"closed"===(null==(t=this.mediaSource)?void 0:t.readyState)?this.resetBuffer(e):((t=this.operationQueue).current(e).onComplete(),t.shiftAndExecuteNext(e))},i._onSBUpdateError=function(e,t){var i=new Error(e+" SourceBuffer error. MediaSource readyState: "+(null==(i=this.mediaSource)?void 0:i.readyState));(t=(this.error(""+i,t),this.hls.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1}),this.operationQueue.current(e)))&&t.onError(i)},i.removeExecutor=function(e,t,i){var r=this.media,n=this.mediaSource,a=this.operationQueue,s=this.sourceBuffer[e];r&&n&&s?(r=E(r.duration)?r.duration:1/0,n=E(n.duration)?n.duration:1/0,(t=Math.max(0,t))<(i=Math.min(i,r,n))&&(!s.ending||s.ended)?(s.ended=!1,this.log("Removing ["+t+","+i+"] from the "+e+" SourceBuffer"),s.remove(t,i)):a.shiftAndExecuteNext(e)):(this.warn("Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),a.shiftAndExecuteNext(e))},i.appendExecutor=function(e,t){var i=this.sourceBuffer[t];if(!i){if(this.pendingTracks[t])return;throw new Error("Attempting to append to the "+t+" SourceBuffer, but it does not exist")}i.ending=!1,i.ended=!1,i.appendBuffer(e)},i.blockBuffers=function(e,t){var i,r,n=this;(t=void 0===t?this.getSourceBufferTypes():t).length?(i=this.operationQueue,r=t.map(function(e){return i.appendBlocker(e)}),1<t.length&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(function(r){e(),t.forEach(function(e,t){var r=n.sourceBuffer[e];null!=r&&r.updating||i.shiftAndExecuteNext(e)})})):(this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e))},i.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},i.addBufferListener=function(e,t,i){var r=this.sourceBuffer[e];r&&(i=i.bind(this,e),this.listeners[e].push({event:t,listener:i}),r.addEventListener(t,i))},i.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach(function(e){t.removeEventListener(e.event,e.listener)})},l(t,[{key:"mediaSrc",get:function(){var e=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==e?void 0:e.src}}])}(m);function kn(e){var t=e.querySelectorAll("source");[].slice.call(t).forEach(function(t){e.removeChild(t)})}function wn(e){var t=e;return Ln.hasOwnProperty(e)&&(t=Ln[e]),String.fromCharCode(t)}function Cn(e){for(var t=[],i=0;i<e.length;i++)t.push(e[i].toString(16));return t}var Ln={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},An=100,Rn={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Pn={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Dn={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},In={25:2,26:4,29:6,30:8,31:10,27:13,28:15},xn=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],On=function(){function e(){this.time=null,this.verboseLevel=0}return e.prototype.log=function(e,t){this.verboseLevel>=e&&(t="function"==typeof t?t():t,B.log(this.time+" ["+e+"] "+t))},e}(),Mn=function(){function e(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}var t=e.prototype;return t.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},t.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;i<t.length;i++){var r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}},t.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},t.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},t.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},t.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},e}(),Un=function(){function e(){this.uchar=" ",this.penState=new Mn}var t=e.prototype;return t.reset=function(){this.uchar=" ",this.penState.reset()},t.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},t.setPenState=function(e){this.penState.copy(e)},t.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},t.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},t.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},e}(),Bn=function(){function e(e){this.chars=[],this.pos=0,this.currPenState=new Mn,this.cueStartTime=null,this.logger=void 0;for(var t=0;t<An;t++)this.chars.push(new Un);this.logger=e}var t=e.prototype;return t.equals=function(e){for(var t=0;t<An;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0},t.copy=function(e){for(var t=0;t<An;t++)this.chars[t].copy(e.chars[t])},t.isEmpty=function(){for(var e=!0,t=0;t<An;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},t.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>An&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=An)},t.moveCursor=function(e){var t=this.pos+e;if(1<e)for(var i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)},t.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},t.insertChar=function(e){var t=this,i=(144<=e&&this.backSpace(),wn(e));this.pos>=An?this.logger.log(0,function(){return"Cannot insert "+e.toString(16)+" ("+i+") at position "+t.pos+". Skipping it!"}):(this.chars[this.pos].setChar(i,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){for(var t=e;t<An;t++)this.chars[t].reset()},t.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},t.clearToEndOfRow=function(){this.clearFromPos(this.pos)},t.getTextString=function(){for(var e=[],t=!0,i=0;i<An;i++){var r=this.chars[i].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e}(),Nn=function(){function e(e){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(var t=0;t<15;t++)this.rows.push(new Bn(e));this.logger=e}var t=e.prototype;return t.reset=function(){for(var e=0;e<15;e++)this.rows[e].clear();this.currRow=14},t.equals=function(e){for(var t=!0,i=0;i<15;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<15;t++)this.rows[t].copy(e.rows[t])},t.isEmpty=function(){for(var e=!0,t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},t.backSpace=function(){this.rows[this.currRow].backSpace()},t.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},t.insertChar=function(e){this.rows[this.currRow].insertChar(e)},t.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},t.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},t.setCursor=function(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},t.setPAC=function(e){this.logger.log(2,function(){return"pacData = "+JSON.stringify(e)});var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var i=0;i<15;i++)this.rows[i].clear();var r=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){var a=n.rows[r].cueStartTime,s=this.logger.time;if(null!==a&&null!==s&&a<s)for(var o=0;o<this.nrRollUpRows;o++)this.rows[t-this.nrRollUpRows+o+1].copy(n.rows[r+o])}}this.currRow=t,a=this.rows[this.currRow],null!==e.indent&&(s=e.indent,s=Math.max(s-1,0),a.setCursor(e.indent),e.color=a.chars[s].penState.foreground),a={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1},this.setPen(a)},t.setBkgData=function(e){this.logger.log(2,function(){return"bkgData = "+JSON.stringify(e)}),this.backSpace(),this.setPen(e),this.insertChar(32)},t.setRollUpRows=function(e){this.nrRollUpRows=e},t.rollUp=function(){var e,t=this;null===this.nrRollUpRows?this.logger.log(3,"roll_up but nrRollUpRows not set yet"):(this.logger.log(1,function(){return t.getDisplayText()}),e=this.currRow+1-this.nrRollUpRows,(e=this.rows.splice(e,1)[0]).clear(),this.rows.splice(this.currRow,0,e),this.logger.log(2,"Rolling up"))},t.getDisplayText=function(e){e=e||!1;for(var t=[],i="",r=0;r<15;r++){var n=this.rows[r].getTextString();n&&t.push(e?"Row "+(r+1)+": '"+n+"'":n.trim())}return 0<t.length?e?"["+t.join(" | ")+"]":t.join("\n"):i},t.getTextAndFormat=function(){return this.rows},e}(),Fn=function(){function e(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Nn(i),this.nonDisplayedMemory=new Nn(i),this.lastOutputScreen=new Nn(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(2,function(){return"MODE="+e}),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=this,i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,function(){return r+": "+t.writeScreen.getDisplayText(!0)}),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,function(){return"DISPLAYED: "+t.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())},t.ccRCL=function(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},t.ccBS=function(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory)&&this.outputDataUpdate()},t.ccAOF=function(){},t.ccAON=function(){},t.ccDER=function(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},t.ccRU=function(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},t.ccFON=function(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},t.ccRDC=function(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},t.ccTR=function(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")},t.ccRTD=function(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")},t.ccEDM=function(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},t.ccCR=function(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},t.ccENM=function(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},t.ccEOC=function(){var e,t=this;this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode&&(e=this.displayedMemory,this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,function(){return"DISP: "+t.displayedMemory.getDisplayText()})),this.outputDataUpdate(!0)},t.ccTO=function(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},t.ccMIDROW=function(e){var t={flash:!1};t.underline=e%2==1,t.italics=46<=e,t.italics?t.foreground="white":(e=Math.floor(e/2)-16,t.foreground=["white","green","blue","cyan","red","yellow","magenta"][e]),this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){!this.outputFilter||this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e)},e}(),jn=function(){function e(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;var r=this.logger=new On;this.channels=[null,new Fn(e,t,r),new Fn(e+1,i,r)]}var t=e.prototype;return t.getHandler=function(e){return this.channels[e].getHandler()},t.setHandler=function(e,t){this.channels[e].setHandler(t)},t.addData=function(e,t){var i,r=!1;this.logger.time=e;for(var n=0;n<t.length;n+=2){var a,s=127&t[n],o=127&t[n+1];0==s&&0==o||(this.logger.log(3,"["+Cn([t[n],t[n+1]])+"] -> ("+Cn([s,o])+")"),(i=(i=(i=(i=this.parseCmd(s,o))||this.parseMidrow(s,o))||this.parsePAC(s,o))||this.parseBackgroundAttributes(s,o))||(r=this.parseChars(s,o))&&((a=this.currentChannel)&&0<a?this.channels[a].insertChars(r):this.logger.log(2,"No channel found yet. TEXT-MODE?")),i)||r||this.logger.log(2,"Couldn't parse cleaned data "+Cn([s,o])+" orig: "+Cn([t[n],t[n+1]]))}},t.parseCmd=function(e,t){var i,r,n=this.cmdHistory;return((20===e||28===e||21===e||29===e)&&32<=t&&t<=47||(23===e||31===e)&&33<=t&&t<=35)&&(Vn(e,t,n)?(Gn(null,null,n),this.logger.log(3,"Repeated command ("+Cn([e,t])+") is dropped")):(r=this.channels[i=20===e||21===e||23===e?1:2],20===e||21===e||28===e||29===e?32===t?r.ccRCL():33===t?r.ccBS():34===t?r.ccAOF():35===t?r.ccAON():36===t?r.ccDER():37===t?r.ccRU(2):38===t?r.ccRU(3):39===t?r.ccRU(4):40===t?r.ccFON():41===t?r.ccRDC():42===t?r.ccTR():43===t?r.ccRTD():44===t?r.ccEDM():45===t?r.ccCR():46===t?r.ccENM():47===t&&r.ccEOC():r.ccTO(t-32),Gn(e,t,n),this.currentChannel=i),!0)},t.parseMidrow=function(e,t){var i=0;return(17===e||25===e)&&32<=t&&t<=47&&((i=17===e?1:2)!==this.currentChannel?(this.logger.log(0,"Mismatch channel in midrow parsing"),!1):!!(i=this.channels[i])&&(i.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Cn([e,t])+")"),!0))},t.parsePAC=function(e,t){var i=this.cmdHistory;if(!((17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127||(16===e||24===e)&&64<=t&&t<=95))return!1;if(Vn(e,t,i))Gn(null,null,i);else{var r=e<=23?1:2,n=(64<=t&&t<=95?1==r?Rn:Dn:1==r?Pn:In)[e],a=this.channels[r];if(!a)return!1;a.setPAC(this.interpretPAC(n,t)),Gn(e,t,i),this.currentChannel=r}return!0},t.interpretPAC=function(e,t){return e={color:null,italics:!1,indent:null,underline:!1,row:e},t=95<t?t-96:t-64,e.underline=1==(1&t),t<=13?e.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(t/2)]:t<=15?(e.italics=!0,e.color="white"):e.indent=4*Math.floor((t-16)/2),e},t.parseChars=function(e,t){var i,r=null,n=null;return 17<=(n=25<=e?(i=2,e-8):(i=1,e))&&n<=19?(this.logger.log(2,"Special char '"+wn(n=17===n?t+80:18===n?t+112:t+144)+"' in channel "+i),r=[n]):32<=e&&e<=127&&(r=0===t?[e]:[e,t]),r&&(i=Cn(r),this.logger.log(3,"Char codes = "+i.join(",")),Gn(e,t,this.cmdHistory)),r},t.parseBackgroundAttributes=function(e,t){var i,r;return((16===e||24===e)&&32<=t&&t<=47||(23===e||31===e)&&45<=t&&t<=47)&&(r={},16===e||24===e?(i=Math.floor((t-32)/2),r.background=xn[i],t%2==1&&(r.background=r.background+"_semi")):45===t?r.background="transparent":(r.foreground="black",47===t&&(r.underline=!0)),this.channels[e<=23?1:2].setBkgData(r),Gn(e,t,this.cmdHistory),!0)},t.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}this.cmdHistory={a:null,b:null}},t.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var i=this.channels[t];i&&i.cueSplitAtTime(e)}},e}();function Gn(e,t,i){i.a=e,i.b=t}function Vn(e,t,i){return i.a===e&&i.b===t}var Hn,Kn,qn=function(){function e(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}var t=e.prototype;return t.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},t.newCue=function(e,t,i){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},t.reset=function(){this.cueRanges=[],this.startTime=null},e}(),Wn=null!=wa&&wa.VTTCue?self.VTTCue:(Hn=["","lr","rl"],Kn=["start","middle","end","left","right"],$n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},$n);function zn(e,t){return"string"==typeof t&&!!Array.isArray(e)&&(t=t.toLowerCase(),!!~e.indexOf(t))&&t}function Yn(e){return zn(Kn,e)}function Xn(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var n=1;n<arguments.length;n++){var a,s=arguments[n];for(a in s)e[a]=s[a]}return e}function $n(e,t,i){var r=this,n={enumerable:!0},a=(r.hasBeenReset=!1,""),s=!1,o=e,l=t,u=i,c=null,d="",h=!0,f="auto",p="start",m=50,g="middle",v=50,y="middle";Object.defineProperty(r,"id",Xn({},n,{get:function(){return a},set:function(e){a=""+e}})),Object.defineProperty(r,"pauseOnExit",Xn({},n,{get:function(){return s},set:function(e){s=!!e}})),Object.defineProperty(r,"startTime",Xn({},n,{get:function(){return o},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");o=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"endTime",Xn({},n,{get:function(){return l},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");l=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"text",Xn({},n,{get:function(){return u},set:function(e){u=""+e,this.hasBeenReset=!0}})),Object.defineProperty(r,"region",Xn({},n,{get:function(){return c},set:function(e){c=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"vertical",Xn({},n,{get:function(){return d},set:function(e){if(!1===(e=zn(Hn,e)))throw new SyntaxError("An invalid or illegal string was specified.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"snapToLines",Xn({},n,{get:function(){return h},set:function(e){h=!!e,this.hasBeenReset=!0}})),Object.defineProperty(r,"line",Xn({},n,{get:function(){return f},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");f=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"lineAlign",Xn({},n,{get:function(){return p},set:function(e){if(!(e=Yn(e)))throw new SyntaxError("An invalid or illegal string was specified.");p=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"position",Xn({},n,{get:function(){return m},set:function(e){if(e<0||100<e)throw new Error("Position must be between 0 and 100.");m=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"positionAlign",Xn({},n,{get:function(){return g},set:function(e){if(!(e=Yn(e)))throw new SyntaxError("An invalid or illegal string was specified.");g=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"size",Xn({},n,{get:function(){return v},set:function(e){if(e<0||100<e)throw new Error("Size must be between 0 and 100.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"align",Xn({},n,{get:function(){return y},set:function(e){if(!(e=Yn(e)))throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),r.displayState=void 0}var Qn=function(){function e(){}return e.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},e}();function Jn(e){function t(e,t,i,r){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(r||0)}return(e=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/))?59<parseFloat(e[2])?t(e[2],e[3],0,e[4]):t(e[1],e[2],e[3],e[4]):null}var Zn=function(){function e(){this.values=Object.create(null)}var t=e.prototype;return t.set=function(e,t){this.get(e)||""===t||(this.values[e]=t)},t.get=function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},t.has=function(e){return e in this.values},t.alt=function(e,t,i){for(var r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}},t.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},t.percent=function(e,t){return!!(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)&&0<=(t=parseFloat(t))&&t<=100)&&(this.set(e,t),!0)},e}();function ea(e,t,i,r){var n,a,s=r?e.split(r):[e];for(n in s)"string"==typeof s[n]&&2===(a=s[n].split(i)).length&&t(a[0],a[1])}var ta=new Wn(0,0,""),ia="middle"===ta.align?"middle":"center";function ra(e){return e.replace(/<br(?: \/)?>/gi,"\n")}function na(e,t,i){return e.slice(i=void 0===i?0:i,i+t.length)===t}var aa=function(){function e(){this.state="INITIAL",this.buffer="",this.decoder=new Qn,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var t=e.prototype;return t.parse=function(e){var t=this;function i(){for(var e=0,i=ra(i=t.buffer);e<i.length&&"\r"!==i[e]&&"\n"!==i[e];)++e;var r=i.slice(0,e);return"\r"===i[e]&&++e,"\n"===i[e]&&++e,t.buffer=i.slice(e),r}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 n=(r=i()).match(/^()?WEBVTT([ \t].*)?$/);if(null==n||!n[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var a=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:r=i(),t.state){case"HEADER":/:/.test(r)?ea(r,function(e,t){},/:/):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 Wn(0,0,""),t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{!function(e,t,i){var r,n,a=e;function s(){var t=Jn(e);if(null===t)throw new Error("Malformed timestamp: "+a);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function o(){e=e.replace(/^\s+/,"")}if(o(),t.startTime=s(),o(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+a);e=e.slice(3),o(),t.endTime=s(),o(),r=e,t=t,n=new Zn,ea(r,function(e,t){var r;switch(e){case"region":for(var a=i.length-1;0<=a;a--)if(i[a].id===t){n.set(e,i[a].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),n.integer(e,r[0]),n.percent(e,r[0])&&n.set("snapToLines",!1),n.alt(e,r[0],["auto"]),2===r.length&&n.alt("lineAlign",r[1],["start",ia,"end"]);break;case"position":r=t.split(","),n.percent(e,r[0]),2===r.length&&n.alt("positionAlign",r[1],["start",ia,"end","line-left","line-right","auto"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start",ia,"end","left","right"])}},/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical",""),"auto"===(r=n.get("line","auto"))&&-1===ta.line&&(r=-1),t.line=r,t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100),t.align=n.get("align",ia),"auto"===(r=n.get("position","auto"))&&50===ta.position&&(r="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=r}(r,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var s=-1!==r.indexOf("--\x3e");if(!r||s&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r;continue;case"BADCUE":r||(t.state="ID")}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},t.flush=function(){var e=this;try{if(!e.cue&&"HEADER"!==e.state||(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state||"BADWEBVTT"===e.state)throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this},e}(),sa=/\r\n|\n\r|\n|\r/g,oa=function(e){for(var t=5381,i=e.length;i;)t=33*t^e.charCodeAt(--i);return(t>>>0).toString()};function la(e,t,i){return oa(e.toString())+oa(t.toString())+oa(i)}var ua="stpp.ttml.im1t",ca=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,da=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,ha={left:"start",center:"center",right:"end",start:"start",end:"end"};function fa(e,t,i,r){if(0===(e=Pe(new Uint8Array(e),["mdat"])).length)r(new Error("Could not parse IMSC1 mdat"));else{e=e.map(function(e){return _e(e)});var n,a=(1,Gr(t.baseTime,1,1/(t=void 0===(t=t.timescale)?1:t),n=void 0!==n&&n));try{e.forEach(function(e){return i(function(e,t){var i,r,n,a,s,o=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(o)return i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(i).reduce(function(e,t){return e[t]=o.getAttribute("ttp:"+t)||i[t],e},{}),n="preserve"!==o.getAttribute("xml:space"),a=ma(pa(o,"styling","style")),s=ma(pa(o,"layout","region")),e=pa(o,"body","[begin]"),[].map.call(e,function(e){var i=function e(t,i){return[].slice.call(t.childNodes).reduce(function(t,r,n){return"br"===r.nodeName&&n?t+"\n":null!=(n=r.childNodes)&&n.length?e(r,i):i?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent},"")}(e,n);if(!i||!e.hasAttribute("begin"))return null;var o=ya(e.getAttribute("begin"),r),l=ya(e.getAttribute("dur"),r),c=ya(e.getAttribute("end"),r);if(null===o)throw va(e);if(null===c){if(null===l)throw va(e);c=o+l}return(l=new Wn(o-t,c-t,i)).id=la(l.startTime,l.endTime,l.text),(c=(o=function(e,t,i){var r="http://www.w3.org/ns/ttml#styling",n=null,a=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;return a&&i.hasOwnProperty(a)&&(n=i[a]),["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce(function(i,a){var s=ga(t,r,a)||ga(e,r,a)||ga(n,r,a);return s&&(i[a]=s),i},{})}(s[e.getAttribute("region")],a[e.getAttribute("style")],a)).textAlign)&&((i=ha[c])&&(l.lineAlign=i),l.align=c),u(l,o),l}).filter(function(e){return null!==e});throw new Error("Invalid ttml")}(e,a))})}catch(e){r(e)}}}function pa(e,t,i){return(e=e.getElementsByTagName(t)[0])?[].slice.call(e.querySelectorAll(i)):[]}function ma(e){return e.reduce(function(e,t){var i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function ga(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function va(e){return new Error("Could not parse ttml timestamp "+e)}function ya(e,t){var i,r,n,a;return e?(null===(i=Jn(e))&&(ca.test(e)?(r=e,n=t,a=(0|(r=ca.exec(r))[4])+(0|r[5])/n.subFrameRate,i=3600*(0|r[1])+60*(0|r[2])+(0|r[3])+a/n.frameRate):da.test(e)&&(i=function(e,t){e=da.exec(e);var i=Number(e[1]);switch(e[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/t.frameRate;case"t":return i/t.tickRate}return i}(e,t))),i):null}function _a(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function ba(e,t){return e&&e.kind===_a(t)&&bn(t,e)}function Ta(e,t){Array.isArray(e)&&(e=e.map(function(e){return e instanceof Ta?e:new Ta(e)})),this.value=e,this.params=t}Qr=function(){function e(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(C.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(C.FRAG_LOADING,this.onFragLoading,this),e.on(C.FRAG_LOADED,this.onFragLoaded,this),e.on(C.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(C.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(C.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(C.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(C.BUFFER_FLUSHING,this.onBufferFlushing,this)}var t=e.prototype;return t.destroy=function(){var e=this.hls;e.off(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(C.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(C.FRAG_LOADING,this.onFragLoading,this),e.off(C.FRAG_LOADED,this.onFragLoaded,this),e.off(C.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(C.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(C.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(C.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(C.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0},t.initCea608Parsers=function(){var e=new qn(this,"textTrack1"),t=new qn(this,"textTrack2"),i=new qn(this,"textTrack3"),r=new qn(this,"textTrack4");this.cea608Parser1=new jn(1,e,t),this.cea608Parser2=new jn(3,i,r)},t.addCues=function(e,t,i,r,n){for(var a,s,o,l=!1,u=n.length;u--;){var c=n[u],d=(a=c[0],d=c[1],s=t,Math.min(d,i)-Math.max(a,s));if(0<=d&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],i),l=!0,.5<d/(i-t)))return}l||n.push([t,i]),this.config.renderTextTracksNatively?(o=this.captionsTracks[e],this.Cues.newCue(o,t,i,r)):(o=this.Cues.newCue(null,t,i,r),this.hls.trigger(C.CUES_PARSED,{type:"captions",cues:o,track:e}))},t.onInitPtsFound=function(e,t){var i=this,r=t.frag,n=t.id,a=t.initPTS,s=(t=t.timescale,this.unparsedVttFrags);"main"===n&&(this.initPTS[r.cc]={baseTime:a,timescale:t}),s.length&&(this.unparsedVttFrags=[],s.forEach(function(e){i.onFragLoaded(C.FRAG_LOADED,e)}))},t.getExistingTrack=function(e,t){var i=this.media;if(i)for(var r=0;r<i.textTracks.length;r++){var n=i.textTracks[r];if(ba(n,{name:e,lang:t,attrs:{}}))return n}return null},t.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},t.createNativeTrack=function(e){var t,i,r,n,a;this.captionsTracks[e]||(n=this.captionsProperties,t=this.captionsTracks,i=this.media,r=(n=n[e]).label,n=n.languageCode,(a=this.getExistingTrack(r,n))?(t[e]=a,At(t[e]),Ct(t[e],i)):(a=this.createTextTrack("captions",r,n))&&(a[e]=!0,t[e]=a))},t.createNonNativeTrack=function(e){var t;this.nonNativeCaptionsTracks[e]||(t=this.captionsProperties[e])&&(t={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media},this.nonNativeCaptionsTracks[e]=t,this.hls.trigger(C.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[t]}))},t.createTextTrack=function(e,t,i){var r=this.media;if(r)return r.addTextTrack(e,t,i)},t.onMediaAttaching=function(e,t){this.media=t.media,this._cleanTracks()},t.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach(function(t){At(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={},this.media=null},t.onManifestLoading=function(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},t._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var i=0;i<t.length;i++)At(t[i])}},t.onSubtitleTracksUpdated=function(e,t){var i,r=this,n=(t=t.subtitleTracks||[]).some(function(e){return e.textCodec===ua});(this.config.enableWebVTT||n&&this.config.enableIMSC1)&&(yn(this.tracks,t)?this.tracks=t:(this.textTracks=[],this.tracks=t,this.config.renderTextTracksNatively?(n=this.media,i=n?Pt(n.textTracks):null,this.tracks.forEach(function(e,t){var n,a;if(i){for(var s=null,o=0;o<i.length;o++)if(i[o]&&ba(i[o],e)){s=i[o],i[o]=null;break}s&&(a=s)}a?At(a):(n=_a(e),(a=r.createTextTrack(n,e.name,e.lang))&&(a.mode="disabled")),a&&r.textTracks.push(a)}),null!=i&&i.length&&(t=i.filter(function(e){return null!==e}).map(function(e){return e.label})).length&&this.hls.logger.warn("Media element contains unused subtitle tracks: "+t.join(", ")+". Replace media element for each source to clear TextTracks and captions menu.")):this.tracks.length&&(n=this.tracks.map(function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}}),this.hls.trigger(C.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:n}))))},t.onManifestLoaded=function(e,t){var i=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(function(e){var t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);t&&(t="textTrack"+t[1],t=i.captionsProperties[t])&&(t.label=e.name,e.lang&&(t.languageCode=e.lang),t.media=e)})},t.closedCaptionsForLevel=function(e){return null==(e=this.hls.levels[e.level])?void 0:e.attrs["CLOSED-CAPTIONS"]},t.onFragLoading=function(e,t){var i,r,n,a,s;this.enabled&&t.frag.type===bt&&(i=this.cea608Parser1,r=this.cea608Parser2,n=this.lastSn,i)&&r&&(a=(s=t.frag).cc,s=s.sn,t=null!=(t=null==(t=t.part)?void 0:t.index)?t:-1,s===n+1||s===n&&t===this.lastPartIndex+1||a===this.lastCc||(i.reset(),r.reset()),this.lastCc=a,this.lastSn=s,this.lastPartIndex=t)},t.onFragLoaded=function(e,t){var i,r,n=t.frag,a=t.payload;n.type===St&&(a.byteLength?(r="stats"in t,null!=(i=n.decryptdata)&&i.encrypted&&!r||(i=this.tracks[n.level],(r=this.vttCCs)[n.cc]||(r[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),i&&i.textCodec===ua?this._parseIMSC1(n,a):this._parseVTTs(t))):this.hls.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")}))},t._parseIMSC1=function(e,t){var i=this,r=this.hls;fa(t,this.initPTS[e.cc],function(t){i._appendCues(t,e.level),r.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(t){r.logger.log("Failed to parse IMSC1: "+t),r.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})})},t._parseVTTs=function(e){var t,i=this,r=e.frag,n=e.payload,a=this.initPTS,s=this.unparsedVttFrags,o=a.length-1;a[r.cc]||-1!=o?(t=this.hls,function(e,t,i,r,n,a,s){var o,l,u,c=new aa,d=(e=_e(new Uint8Array(e)).trim().replace(sa,"\n").split("\n"),[]),h=t?(o=t.baseTime,l=t.timescale,Gr(o,jr,1/(l=void 0===l?1:l))):0,f="00:00.000",p=0,m=0,g=!0;c.oncue=function(e){var a=i[r],s=i.ccOffset,o=(p-h)/9e4;if(null!=a&&a.new)if(void 0!==m)s=i.ccOffset=a.start;else{var l=i,c=(a=o,l[r]),f=l[c.prevCC];if(!f||!f.new&&c.new)l.ccOffset=l.presentationOffset=c.start,c.new=!1;else{for(;null!=f&&f.new;)l.ccOffset+=c.start-f.start,c.new=!1,f=l[(c=f).prevCC];l.presentationOffset=a}}if(o){if(!t)return void(u=new Error("Missing initPTS for VTT MPEGTS"));s=o-i.presentationOffset}a=e.endTime-e.startTime,o=Wr(9e4*(e.startTime+s-m),9e4*n)/9e4,e.startTime=Math.max(o,0),e.endTime=Math.max(o+a,0),s=e.text.trim(),e.text=decodeURIComponent(encodeURIComponent(s)),e.id||(e.id=la(e.startTime,e.endTime,s)),0<e.endTime&&d.push(e)},c.onparsingerror=function(e){u=e},c.onflush=function(){u?s(u):a(d)},e.forEach(function(e){if(g){if(na(e,"X-TIMESTAMP-MAP=")){g=!1,e.slice(16).split(",").forEach(function(e){na(e,"LOCAL:")?f=e.slice(6):na(e,"MPEGTS:")&&(p=parseInt(e.slice(7)))});try{m=function(e){var t=parseInt(e.slice(-3)),i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=9<e.length?parseInt(e.substring(0,e.indexOf(":"))):0;if(E(t)&&E(i)&&E(r)&&E(n))return(t+=1e3*i)+6e4*r+36e5*n;throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e)}(f)/1e3}catch(e){u=e}return}""===e&&(g=!1)}c.parse(e+"\n")}),c.flush()}(null!=(a=r.initSegment)&&a.data?Ue(r.initSegment.data,new Uint8Array(n)):n,this.initPTS[r.cc],this.vttCCs,r.cc,r.start,function(e){i._appendCues(e,r.level),t.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},function(a){var l="Missing initPTS for VTT MPEGTS"===a.message;l?s.push(e):i._fallbackToIMSC1(r,n),t.logger.log("Failed to parse VTT cue: "+a),l&&o>r.cc||t.trigger(C.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:a})})):s.push(e)},t._fallbackToIMSC1=function(e,t){var i=this,r=this.tracks[e.level];r.textCodec||fa(t,this.initPTS[e.cc],function(){r.textCodec=ua,i._parseIMSC1(e,t)},function(){r.textCodec="wvtt"})},t._appendCues=function(e,t){var i,r,n=this.hls;this.config.renderTextTracksNatively?(i=this.textTracks[t])&&"disabled"!==i.mode&&e.forEach(function(e){return Lt(i,e)}):(r=this.tracks[t])&&(r=r.default?"default":"subtitles"+t,n.trigger(C.CUES_PARSED,{type:"subtitles",cues:e,track:r}))},t.onFragDecrypted=function(e,t){t.frag.type===St&&this.onFragLoaded(C.FRAG_LOADED,t)},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(e,t){if(this.enabled&&this.config.enableCEA708Captions){var i=t.frag,r=t.samples;if(i.type!==bt||"NONE"!==this.closedCaptionsForLevel(i))for(var n=0;n<r.length;n++){var a=r[n].bytes;a&&(this.cea608Parser1||this.initCea608Parsers(),a=this.extractCea608Data(a),this.cea608Parser1.addData(r[n].pts,a[0]),this.cea608Parser2.addData(r[n].pts,a[1]))}}},t.onBufferFlushing=function(e,t){var i,r,n=t.startOffset,a=t.endOffset,s=t.endOffsetSubtitles,o=(t=t.type,this.media);!o||o.currentTime<a||(t&&"video"!==t||(i=this.captionsTracks,Object.keys(i).forEach(function(e){return Rt(i[e],n,a)})),this.config.renderTextTracksNatively&&0===n&&void 0!==s&&(r=this.textTracks,Object.keys(r).forEach(function(e){return Rt(r[e],n,s)})))},t.extractCea608Data=function(e){for(var t=[[],[]],i=31&e[0],r=2,n=0;n<i;n++){var a=e[r++],s=127&e[r++],o=127&e[r++];0==s&&0==o||0==(4&a)||0!=(a&=3)&&1!=a||(t[a].push(s),t[a].push(o))}return t},e}();wr=function(){function e(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.destroy=function(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},t.registerListeners=function(){var e=this.hls;e.on(C.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(C.BUFFER_CODECS,this.onBufferCodecs,this),e.on(C.MEDIA_DETACHING,this.onMediaDetaching,this)},t.unregisterListener=function(){var e=this.hls;e.off(C.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(C.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(C.BUFFER_CODECS,this.onBufferCodecs,this),e.off(C.MEDIA_DETACHING,this.onMediaDetaching,this)},t.onFpsDropLevelCapping=function(e,t){t=this.hls.levels[t.droppedLevel],this.isLevelAllowed(t)&&this.restrictedLevels.push({bitrate:t.bitrate,height:t.height,width:t.width})},t.onMediaAttaching=function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()},t.onManifestParsed=function(e,t){var i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()},t.onLevelsUpdated=function(e,t){this.timer&&E(this.autoLevelCapping)&&this.detectPlayerSize()},t.onBufferCodecs=function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()},t.onMediaDetaching=function(){this.stopCapping(),this.media=null},t.detectPlayerSize=function(){var e,t,i;this.media&&(this.mediaHeight<=0||this.mediaWidth<=0?this.clientRect=null:(e=this.hls.levels).length&&(t=this.hls,(i=this.getMaxLevel(e.length-1))!==this.autoLevelCapping&&t.logger.log("Setting autoLevelCapping to "+i+": "+e[i].height+"p@"+e[i].bitrate+" for media "+this.mediaWidth+"x"+this.mediaHeight),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping))},t.getMaxLevel=function(t){var i=this,r=this.hls.levels;return r.length?(r=r.filter(function(e,r){return i.isLevelAllowed(e)&&r<=t}),this.clientRect=null,e.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)):-1},t.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},t.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},t.getDimensions=function(){var e,t,i;return this.clientRect||(t={width:0,height:0},(e=this.media)&&(i=e.getBoundingClientRect(),t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)),this.clientRect=t)},t.isLevelAllowed=function(e){return!this.restrictedLevels.some(function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height})},e.getMaxLevelByMediaSize=function(e,t,i){if(null==e||!e.length)return-1;for(var r,n=e.length-1,a=Math.max(t,i),s=0;s<e.length;s+=1){var o=e[s];if((o.width>=a||o.height>=a)&&(o=o,!(r=e[s+1])||o.width!==r.width||o.height!==r.height)){n=s;break}}return n},l(e,[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}}])}();var Sa,Ea,ka,wa=function(){function e(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.registerListeners=function(){this.hls.on(C.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(C.MEDIA_DETACHING,this.onMediaDetaching,this)},t.unregisterListeners=function(){this.hls.off(C.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(C.MEDIA_DETACHING,this.onMediaDetaching,this)},t.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},t.onMediaAttaching=function(e,t){var i=this.hls.config;i.capLevelOnFPSDrop&&(t=t.media instanceof self.HTMLVideoElement?t.media:null,(this.media=t)&&"function"==typeof t.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod))},t.onMediaDetaching=function(){this.media=null},t.checkFPS=function(e,t,i){var r,n,a,s,o=performance.now();t&&(this.lastTime&&(s=o-this.lastTime,r=i-this.lastDroppedFrames,n=t-this.lastDecodedFrames,s=1e3*r/s,(a=this.hls).trigger(C.FPS_DROP,{currentDropped:r,currentDecoded:n,totalDroppedFrames:i}),0<s)&&r>a.config.fpsDroppedMonitoringThreshold*n&&(s=a.currentLevel,a.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),0<s)&&(-1===a.autoLevelCapping||a.autoLevelCapping>=s)&&(a.trigger(C.FPS_DROP_LEVEL_CAPPING,{level:s-=1,droppedLevel:a.currentLevel}),a.autoLevelCapping=s,this.streamController.nextLevelSwitch()),this.lastTime=o,this.lastDroppedFrames=i,this.lastDecodedFrames=t)},t.checkFPSInterval=function(){var e,t=this.media;t&&(this.isVideoPlaybackQualityAvailable?(e=t.getVideoPlaybackQuality(),this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)):this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount))},e}(),Ca=function(e){function t(i){var r=e.call(this,"eme",i.logger)||this;return r.hls=void 0,r.config=void 0,r.media=null,r.keyFormatPromise=null,r.keySystemAccessPromises={},r._requestLicenseFailureCount=0,r.mediaKeySessions=[],r.keyIdToKeySessionPromise={},r.setMediaKeysQueue=t.CDMCleanupPromise?[t.CDMCleanupPromise]:[],r.onMediaEncrypted=function(e){var t,i,n=e.initDataType,a=e.initData;if(r.debug('"'+e.type+'" event: init data type: "'+n+'"'),null!==a){if("sinf"===n&&r.config.drmSystems[J.FAIRPLAY]){e=ke(new Uint8Array(a));try{var s=W(JSON.parse(e).sinf),o=Me(new Uint8Array(s));if(!o)return;t=o.subarray(8,24),i=J.FAIRPLAY}catch(e){return void r.warn('Failed to parse sinf "encrypted" event message initData')}}else{if(null===(e=function(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;var t={version:0,systemId:"",kids:null,data:null},i=new DataView(e),r=i.getUint32(0);if(e.byteLength!==r&&44<r)return null;if(1886614376!==i.getUint32(4))return null;if(t.version=i.getUint32(8)>>>24,1<t.version)return null;t.systemId=be.hexDump(new Uint8Array(e,12,16));var n=i.getUint32(28);if(0===t.version){if(r-32<n)return null;t.data=new Uint8Array(e,32,n)}else if(1===t.version){t.kids=[];for(var a=0;a<n;a++)t.kids.push(new Uint8Array(e,32+16*a,16))}return t}(a)))return;0===e.version&&e.systemId===te.WIDEVINE&&e.data&&(t=e.data.subarray(8,24)),i=function(e){if(e===te.WIDEVINE)return J.WIDEVINE}(e.systemId)}if(i&&t){for(var l,u=be.hexDump(t),c=(s=r).keyIdToKeySessionPromise,d=s.mediaKeySessions,h=c[u],f=0;f<d.length&&(0===(l=function(){var e,i=d[f],s=i.decryptdata;return s.pssh||!s.keyId?0:(e=be.hexDump(s.keyId),u===e||-1!==s.uri.replace(/-/g,"").indexOf(u)?(h=c[e],delete c[e],s.pssh=new Uint8Array(a),s.keyId=t,h=c[u]=h.then(function(){return r.generateRequestWithPreferredKeySession(i,n,a,"encrypted-event-key-match")}),1):void 0)}())||1!==l);f++);(h=h||(c[u]=r.getKeySystemSelectionPromise([i]).then(function(e){var i=e.keySystem,s=e.mediaKeys,o=(r.throwIfDestroyed(),new Ge("ISO-23001-7",u,null!=(e=ie(i))?e:""));return o.pssh=new Uint8Array(a),o.keyId=t,r.attemptSetMediaKeys(i,s).then(function(){r.throwIfDestroyed();var e=r.createMediaKeySessionContext({decryptdata:o,keySystem:i,mediaKeys:s});return r.generateRequestWithPreferredKeySession(e,n,a,"encrypted-event-no-match")})}))).catch(function(e){return r.handleError(e)})}}},r.onWaitingForKey=function(e){r.log('"'+e.type+'" event')},r.hls=i,r.config=i.config,r.registerListeners(),r}c(t,e);var r=t.prototype;return r.destroy=function(){this.unregisterListeners(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null},r.registerListeners=function(){this.hls.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(C.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(C.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(C.MANIFEST_LOADED,this.onManifestLoaded,this)},r.unregisterListeners=function(){this.hls.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(C.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(C.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(C.MANIFEST_LOADED,this.onManifestLoaded,this)},r.getLicenseServerUrl=function(e){var t=(i=this.config).drmSystems,i=i.widevineLicenseUrl;if(t=t[e])return t.licenseUrl;if(e===J.WIDEVINE&&i)return i;throw new Error('no license server URL configured for key-system "'+e+'"')},r.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},r.attemptKeySystemAccess=function(e){function t(e,t,i){return!!e&&i.indexOf(e)===t}var i=this,r=this.hls.levels,n=r.map(function(e){return e.audioCodec}).filter(t),a=r.map(function(e){return e.videoCodec}).filter(t);return n.length+a.length===0&&a.push("avc1.42e01e"),new Promise(function(t,r){!function e(s){var o=s.shift();i.getMediaKeysPromise(o,n,a).then(function(e){return t({keySystem:o,mediaKeys:e})}).catch(function(t){s.length?e(s):r(t instanceof La?t:new La({type:L.KEY_SYSTEM_ERROR,details:A.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})}(e)})},r.requestMediaKeySystemAccess=function(e,t){var i,r=this.config.requestMediaKeySystemAccessFunc;return"function"!=typeof r?(i="Configured requestMediaKeySystemAccess is not a function "+r,null===ne&&"http:"===self.location.protocol&&(i="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(i))):r(e,t)},r.getMediaKeysPromise=function(e,t,i){var r,n=this,a=(t=function(e,t,i,r){var n,a;switch(e){case J.FAIRPLAY:n=["cenc","sinf"];break;case J.WIDEVINE:case J.PLAYREADY:n=["cenc"];break;case J.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+e)}return i=i,[{initDataTypes:n,persistentState:(a=r).persistentState||"optional",distinctiveIdentifier:a.distinctiveIdentifier||"optional",sessionTypes:a.sessionTypes||[a.sessionType||"temporary"],audioCapabilities:t.map(function(e){return{contentType:'audio/mp4; codecs="'+e+'"',robustness:a.audioRobustness||"",encryptionScheme:a.audioEncryptionScheme||null}}),videoCapabilities:i.map(function(e){return{contentType:'video/mp4; codecs="'+e+'"',robustness:a.videoRobustness||"",encryptionScheme:a.videoEncryptionScheme||null}})}]}(e,t,i,this.config.drmSystemOptions),this.keySystemAccessPromises[e]);return(i=null==a?void 0:a.keySystemAccess)?i.then(function(){return a.mediaKeys}):(this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(t)),i=this.requestMediaKeySystemAccess(e,t),r=this.keySystemAccessPromises[e]={keySystemAccess:i},i.catch(function(t){n.log('Failed to obtain access to key-system "'+e+'": '+t)}),i.then(function(t){n.log('Access for key-system "'+t.keySystem+'" obtained');var i=n.fetchServerCertificate(e);return n.log('Create media-keys for "'+e+'"'),r.mediaKeys=t.createMediaKeys().then(function(t){return n.log('Media-keys created for "'+e+'"'),i.then(function(i){return i?n.setMediaKeysServerCertificate(t,e,i):t})}),r.mediaKeys.catch(function(t){n.error('Failed to create media-keys for "'+e+'"}: '+t)}),r.mediaKeys}))},r.createMediaKeySessionContext=function(e){var t=e.decryptdata,i=e.keySystem;t={decryptdata:t,keySystem:i,mediaKeys:e=e.mediaKeys,mediaKeysSession:(this.log('Creating key-system session "'+i+'" keyId: '+be.hexDump(t.keyId||[])),e.createSession()),keyStatus:"status-pending"};return this.mediaKeySessions.push(t),t},r.renewKeySession=function(e){var t,i,r=e.decryptdata;r.pssh?(t=this.createMediaKeySessionContext(e),i=this.getKeyIdString(r),this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(t,"cenc",r.pssh,"expired")):this.warn("Could not renew expired session. Missing pssh initData."),this.removeSession(e)},r.getKeyIdString=function(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return be.hexDump(e.keyId)},r.updateKeySession=function(e,t){var i=e.mediaKeysSession;return this.log('Updating key-session "'+i.sessionId+'" for keyID '+be.hexDump((null==(e=e.decryptdata)?void 0:e.keyId)||[])+"\n } (data length: "+(t&&t.byteLength)+")"),i.update(t)},r.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},r.getKeyFormatPromise=function(e){var t=this;return new Promise(function(i,r){var n=re(t.config),a=e.map(ee).filter(function(e){return!!e&&-1!==n.indexOf(e)});return t.getKeySystemSelectionPromise(a).then(function(e){var t=ie(e=e.keySystem);t?i(t):r(new Error('Unable to find format for key-system "'+e+'"'))}).catch(r)})},r.loadKey=function(e){var t=this,i=e.keyInfo.decryptdata,r=this.getKeyIdString(i),n="(keyId: "+r+' format: "'+i.keyFormat+'" method: '+i.method+" uri: "+i.uri+")",a=(this.log("Starting session for key "+n),this.keyIdToKeySessionPromise[r]);return a||(a=this.keyIdToKeySessionPromise[r]=this.getKeySystemForKeyPromise(i).then(function(r){var a=r.keySystem,s=r.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+n),t.attemptSetMediaKeys(a,s).then(function(){t.throwIfDestroyed();var e=t.createMediaKeySessionContext({keySystem:a,mediaKeys:s,decryptdata:i});return t.generateRequestWithPreferredKeySession(e,"cenc",i.pssh,"playlist-key")})})).catch(function(e){return t.handleError(e)}),a},r.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},r.handleError=function(e){this.hls&&(this.error(e.message),e instanceof La?this.hls.trigger(C.ERROR,e.data):this.hls.trigger(C.ERROR,{type:L.KEY_SYSTEM_ERROR,details:A.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},r.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e);return(t=this.keyIdToKeySessionPromise[t])||(e=(t=ee(e.keyFormat))?[t]:re(this.config),this.attemptKeySystemAccess(e))},r.getKeySystemSelectionPromise=function(e){if(0===(e=e.length?e:re(this.config)).length)throw new La({type:L.KEY_SYSTEM_ERROR,details:A.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},r.attemptSetMediaKeys=function(e,t){var i=this,r=this.setMediaKeysQueue.slice(),n=(this.log('Setting media-keys for "'+e+'"'),Promise.all(r).then(function(){if(i.media)return i.media.setMediaKeys(t);throw new Error("Attempted to set mediaKeys without media element attached")}));return this.setMediaKeysQueue.push(n),n.then(function(){i.log('Media-keys set for "'+e+'"'),r.push(n),i.setMediaKeysQueue=i.setMediaKeysQueue.filter(function(e){return-1===r.indexOf(e)})})},r.generateRequestWithPreferredKeySession=function(e,t,i,r){var n,a,s,o=this,l=null==(l=this.config.drmSystems)||null==(l=l[e.keySystem])?void 0:l.generateRequest;if(l)try{var u=l.call(this.hls,t,i,e);if(!u)throw new Error("Invalid response from configured generateRequest filter");t=u.initDataType,i=e.decryptdata.pssh=u.initData?new Uint8Array(u.initData):null}catch(t){if(this.warn(t.message),null!=(l=this.hls)&&l.config.debug)throw t}return null===i?(this.log('Skipping key-session request for "'+r+'" (no initData)'),Promise.resolve(e)):(n=this.getKeyIdString(e.decryptdata),this.log('Generating key-session request for "'+r+'": '+n+" (init data type: "+t+" length: "+(i?i.byteLength:null)+")"),a=new hn,u=e._onmessage=function(t){var i,r=e.mediaKeysSession;r?(i=t.messageType,t=t.message,o.log('"'+i+'" message event for session "'+r.sessionId+'" message size: '+t.byteLength),"license-request"===i||"license-renewal"===i?o.renewLicense(e,t).catch(function(e){o.handleError(e),a.emit("error",e)}):"license-release"===i?e.keySystem===J.FAIRPLAY&&(o.updateKeySession(e,z("acknowledged")),o.removeSession(e)):o.warn('unhandled media key message type "'+i+'"')):a.emit("error",new Error("invalid state"))},l=e._onkeystatuseschange=function(t){var i;e.mediaKeysSession?(o.onKeyStatusChange(e),i=e.keyStatus,a.emit("keyStatus",i),"expired"===i&&(o.warn(e.keySystem+" expired for key "+n),o.renewKeySession(e))):a.emit("error",new Error("invalid state"))},e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",l),s=new Promise(function(e,t){a.on("error",t),a.on("keyStatus",function(i){i.startsWith("usable")?e():"output-restricted"===i?t(new La({type:L.KEY_SYSTEM_ERROR,details:A.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===i?t(new La({type:L.KEY_SYSTEM_ERROR,details:A.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+i+'"')):"expired"===i?t(new Error("key expired while generating request")):o.warn('unhandled key status change "'+i+'"')})}),e.mediaKeysSession.generateRequest(t,i).then(function(){var t;o.log('Request generated for key-session "'+(null==(t=e.mediaKeysSession)?void 0:t.sessionId)+'" keyId: '+n)}).catch(function(e){throw new La({type:L.KEY_SYSTEM_ERROR,details:A.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},"Error generating key-session request: "+e)}).then(function(){return s}).catch(function(t){throw a.removeAllListeners(),o.removeSession(e),t}).then(function(){return a.removeAllListeners(),e}))},r.onKeyStatusChange=function(e){var t=this;e.mediaKeysSession.keyStatuses.forEach(function(i,r){t.log('key status change "'+i+'" for keyStatuses keyId: '+be.hexDump("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r))+" session keyId: "+be.hexDump(new Uint8Array(e.decryptdata.keyId||[]))+" uri: "+e.decryptdata.uri),e.keyStatus=i})},r.fetchServerCertificate=function(e){var t=this.config,r=new t.loader(t),n=this.getServerCertificateUrl(e);return n?(this.log('Fetching server certificate for "'+e+'"'),new Promise(function(a,s){var o={responseType:"arraybuffer",url:n},l={loadPolicy:l=t.certLoadPolicy.default,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};r.load(o,l,{onSuccess:function(e,t,i,r){a(e.data)},onError:function(t,r,a,l){s(new La({type:L.KEY_SYSTEM_ERROR,details:A.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:i({url:o.url,data:void 0},t)},'"'+e+'" certificate request failed ('+n+"). Status: "+t.code+" ("+t.text+")"))},onTimeout:function(t,i,r){s(new La({type:L.KEY_SYSTEM_ERROR,details:A.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:o.url,data:void 0}},'"'+e+'" certificate request timed out ('+n+")"))},onAbort:function(e,t,i){s(new Error("aborted"))}})})):Promise.resolve()},r.setMediaKeysServerCertificate=function(e,t,i){var r=this;return new Promise(function(n,a){e.setServerCertificate(i).then(function(a){r.log("setServerCertificate "+(a?"success":"not supported by CDM")+" ("+(null==i?void 0:i.byteLength)+') on "'+t+'"'),n(e)}).catch(function(e){a(new La({type:L.KEY_SYSTEM_ERROR,details:A.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})},r.renewLicense=function(e,t){var i=this;return this.requestLicense(e,new Uint8Array(t)).then(function(t){return i.updateKeySession(e,new Uint8Array(t)).catch(function(e){throw new La({type:L.KEY_SYSTEM_ERROR,details:A.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)})})},r.unpackPlayReadyKeyMessage=function(e,t){var i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;var r=(t=(new DOMParser).parseFromString(i,"application/xml")).querySelectorAll("HttpHeader");if(0<r.length)for(var n=0,a=r.length;n<a;n++){var s=null==(s=(o=r[n]).querySelector("name"))?void 0:s.textContent,o=null==(o=o.querySelector("value"))?void 0:o.textContent;s&&o&&e.setRequestHeader(s,o)}if(t=null==(i=t.querySelector("Challenge"))?void 0:i.textContent)return z(atob(t));throw new Error("Cannot find <Challenge> in key message")},r.setupLicenseXHR=function(e,t,i,r){var n=this,a=this.config.licenseXhrSetup;return a?Promise.resolve().then(function(){if(i.decryptdata)return a.call(n.hls,e,t,i,r);throw new Error("Key removed")}).catch(function(s){if(i.decryptdata)return e.open("POST",t,!0),a.call(n.hls,e,t,i,r);throw s}).then(function(i){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:i||r}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))},r.requestLicense=function(e,t){var i=this,r=this.config.keyLoadPolicy.default;return new Promise(function(n,a){var s=i.getLicenseServerUrl(e.keySystem),o=(i.log("Sending license request to URL: "+s),new XMLHttpRequest);o.responseType="arraybuffer",o.onreadystatechange=function(){if(!i.hls||!e.mediaKeysSession)return a(new Error("invalid state"));if(4===o.readyState)if(200===o.status){i._requestLicenseFailureCount=0;var l=o.response;if(u=(i.log("License received "+(l instanceof ArrayBuffer?l.byteLength:l)),i.config.licenseResponseCallback))try{l=u.call(i.hls,o,s,e)}catch(l){i.error(l)}n(l)}else{var u;l=(u=r.errorRetry)?u.maxNumRetry:0;i._requestLicenseFailureCount++,i._requestLicenseFailureCount>l||400<=o.status&&o.status<500?a(new La({type:L.KEY_SYSTEM_ERROR,details:A.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:s,data:void 0,code:o.status,text:o.statusText}},"License Request XHR failed ("+s+"). Status: "+o.status+" ("+o.statusText+")")):(u=l-i._requestLicenseFailureCount+1,i.warn("Retrying license request, "+u+" attempts left"),i.requestLicense(e,t).then(n,a))}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,i.setupLicenseXHR(o,s,e,t).then(function(t){var r=t.xhr;t=t.licenseChallenge;e.keySystem==J.PLAYREADY&&(t=i.unpackPlayReadyKeyMessage(r,t)),r.send(t)})})},r.onMediaAttached=function(e,t){this.config.emeEnabled&&(t=t.media,(this.media=t).addEventListener("encrypted",this.onMediaEncrypted),t.addEventListener("waitingforkey",this.onWaitingForKey))},r.onMediaDetached=function(){var e=this,i=this.media,r=this.mediaKeySessions,n=(i&&(i.removeEventListener("encrypted",this.onMediaEncrypted),i.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ge.clearKeyUriToKeyIdMap(),r.length);t.CDMCleanupPromise=Promise.all(r.map(function(t){return e.removeSession(t)}).concat(null==i?void 0:i.setMediaKeys(null).catch(function(t){e.log("Could not clear media keys: "+t)}))).then(function(){n&&(e.log("finished closing key sessions and clearing media keys"),r.length=0)}).catch(function(t){e.log("Could not close sessions and clear media keys: "+t)})},r.onManifestLoading=function(){this.keyFormatPromise=null},r.onManifestLoaded=function(e,t){(t=t.sessionKeys)&&this.config.emeEnabled&&(this.keyFormatPromise||(t=t.reduce(function(e,t){return-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e},[]),this.log("Selecting key-system from session-keys "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)))},r.removeSession=function(e){var t=this,i=e.mediaKeysSession,r=e.licenseXhr;if(i)return this.log("Remove licenses and keys and close session "+i.sessionId),e._onmessage&&(i.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(i.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0,-1<(r=this.mediaKeySessions.indexOf(e))&&this.mediaKeySessions.splice(r,1),i.remove().catch(function(e){t.log("Could not remove session: "+e)}).then(function(){return i.close()}).catch(function(e){t.log("Could not close session: "+e)})},t}(m),La=(Ca.CDMCleanupPromise=void 0,function(e){function t(t,i){var r=e.call(this,i)||this;return r.data=void 0,t.error||(t.error=new Error(i)),(r.data=t).err=t.error,r}return c(t,e),t}(f(Error))),Aa=((qa=Sa=Sa||{}).MANIFEST="m",qa.AUDIO="a",qa.VIDEO="v",qa.MUXED="av",qa.INIT="i",qa.CAPTION="c",qa.TIMED_TEXT="tt",qa.KEY="k",qa.OTHER="o",(qa=Ea=Ea||{}).DASH="d",qa.HLS="h",qa.SMOOTH="s",qa.OTHER="o",(qa=ka=ka||{}).OBJECT="CMCD-Object",qa.REQUEST="CMCD-Request",qa.SESSION="CMCD-Session",qa.STATUS="CMCD-Status",(qa={})[ka.OBJECT]=["br","d","ot","tb"],qa[ka.REQUEST]=["bl","dl","mtp","nor","nrr","su"],qa[ka.SESSION]=["cid","pr","sf","sid","st","v"],qa[ka.STATUS]=["bs","rtp"],qa);function Ra(e,t,i){return function(e,t,i,r){return new Error("failed to "+e+' "'+(e=t,Array.isArray(e)?JSON.stringify(e):e instanceof Map?"Map{}":e instanceof Set?"Set{}":"object"===(void 0===e?"undefined":n(e))?JSON.stringify(e):String(e))+'" as '+i,{cause:r})}("serialize",e,t,i)}function Pa(e){this.description=e}var Da="Bare Item";function Ia(e){if((t=e)<-999999999999999||999999999999999<t)throw Ra(e,"Integer");var t;return e.toString()}var xa=/[\x00-\x1f\x7f]+/;function Oa(e){if(e=(e=e).description||e.toString().slice(7,-1),!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e))throw Ra(e,"Token");return e}function Ma(e){switch(void 0===e?"undefined":n(e)){case"number":if(E(e))return(Number.isInteger(e)?Ia:function(e){var t=function e(t,i){var r;return t<0?-e(-t,i):(i=Math.pow(10,i),Math.abs(t*i%1-.5)<Number.EPSILON?((r=Math.floor(t*i))%2==0?r:r+1)/i:Math.round(t*i)/i)}(e,3);if(12<Math.floor(Math.abs(t)).toString().length)throw Ra(e,"Decimal");return(e=t.toString()).includes(".")?e:e+".0"})(e);throw Ra(e,Da);case"string":var t=e;if(xa.test(t))throw Ra(t,"String");return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"';case"symbol":return Oa(e);case"boolean":if("boolean"!=typeof(t=e))throw Ra(t,"Boolean");return t?"?1":"?0";case"object":if(e instanceof Date)return"@"+Ia(e.getTime()/1e3);if(e instanceof Uint8Array)return function(e){if(!1===ArrayBuffer.isView(e))throw Ra(e,"Byte Sequence");return":"+btoa(String.fromCharCode.apply(String,e))+":"}(e);if(e instanceof Pa)return Oa(e);default:throw Ra(e,Da)}}function Ua(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw Ra(e,"Key");return e}function Ba(e){return null==e?"":Object.entries(e).map(function(e){var t=e[0];return!0===(e=e[1])?";"+Ua(t):";"+Ua(t)+"="+Ma(e)}).join("")}function Na(e){return e instanceof Ta?""+Ma(e.value)+Ba(e.params):Ma(e)}function Fa(e){return Math.round(e)}function ja(e){return 100*Fa(e/100)}var Ga={br:Fa,d:Fa,bl:ja,dl:ja,mtp:ja,nor:function(e,t){return null!=t&&t.baseUrl&&(e=function(e,t){var i=new URL(e);t=new URL(t);if(i.origin!==t.origin)return e;for(var r=i.pathname.split("/").slice(1),n=t.pathname.split("/").slice(1,-1);r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")}(e,t.baseUrl)),encodeURIComponent(e)},rtp:ja,tb:Fa};function Va(e,t){return void 0===t&&(t={}),e?function(e,t){if(void 0===t&&(t={whitespace:!0}),"object"!==(void 0===e?"undefined":n(e)))throw Ra(e,"Dict");return e=e instanceof Map?e.entries():Object.entries(e),t=null!=t&&t.whitespace?" ":"",Array.from(e).map(function(e){var t,i=e[0];return(e=e[1])instanceof Ta==0&&(e=new Ta(e)),i=Ua(i),!0===e.value?i+=Ba(e.params):(i+="=",Array.isArray(e.value)?i+="("+(t=e).value.map(Na).join(" ")+")"+Ba(t.params):i+=Na(e)),i}).join(","+t)}(function(e,t){var i,r,a,s={};return null!=e&&"object"===(void 0===e?"undefined":n(e))&&(i=Object.keys(e).sort(),r=u({},Ga,null==t?void 0:t.formatters),a=null==t?void 0:t.filter,i.forEach(function(i){var n,o;null!=a&&a(i)||(n=e[i],(o=r[i])&&(n=o(n,t)),"v"===i&&1===n)||"pr"==i&&1===n||("number"==typeof(o=n)?E(o):null!=o&&""!==o&&!1!==o)&&("ot"!==(o=i)&&"sf"!==o&&"st"!==o||"string"!=typeof n||(n=new Pa(n)),s[i]=n)})),s}(e,t),u({whitespace:!1},t)):""}var Ha="CMCD",Ka=/CMCD=[^&#]+/;var qa=function(){function e(e){var t=this,i=(e=(this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(e){try{t.apply(e,{ot:Sa.MANIFEST,su:!t.initialized})}catch(e){t.hls.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=function(e){try{var i=e.frag,r=t.hls.levels[i.level],n=t.getObjectType(i),a={d:1e3*i.duration,ot:n},s=(n!==Sa.VIDEO&&n!==Sa.AUDIO&&n!=Sa.MUXED||(a.br=r.bitrate/1e3,a.tb=t.getTopBandwidth(n)/1e3,a.bl=t.getBufferLength(n)),t.getNextFrag(i));s&&s.url&&s.url!==i.url&&(a.nor=s.url),t.apply(e,a)}catch(e){t.hls.logger.warn("Could not generate segment CMCD data.",e)}},this.hls=e,this.config=e.config)).cmcd;null!=i&&(e.pLoader=this.createPlaylistLoader(),e.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||function(){try{return crypto.randomUUID()}catch(r){try{var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){var i=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"==e?t:3&t|8).toString(16)})}}}(),this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(C.MEDIA_DETACHED,this.onMediaDetached,this),e.on(C.BUFFER_CREATED,this.onBufferCreated,this)},t.unregisterListeners=function(){var e=this.hls;e.off(C.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(C.MEDIA_DETACHED,this.onMediaDetached,this),e.off(C.BUFFER_CREATED,this.onBufferCreated,this)},t.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},t.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},t.onBufferCreated=function(e,t){var i;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(i=t.tracks.video)?void 0:i.buffer},t.createData=function(){var e;return{v:1,sf:Ea.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},t.apply=function(e,t){u(t=void 0===t?{}:t,this.createData());var i=t.ot===Sa.INIT||t.ot===Sa.VIDEO||t.ot===Sa.MUXED,r=(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering),this.includeKeys);r&&(t=Object.keys(t).reduce(function(e,i){return r.includes(i)&&(e[i]=t[i]),e},{})),i={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),function(e,t,i){var r,n;u(e,(void 0===(r=i)&&(r={}),(e=t)?(e=Object.entries(e),n=Object.entries(Aa).concat(Object.entries((null==r?void 0:r.customHeaderMap)||{})),e=e.reduce(function(e,t){var i=t[0],r=(t=t[1],(null==(r=n.find(function(e){return e[1].includes(i)}))?void 0:r[0])||ka.REQUEST);return null==e[r]&&(e[r]={}),e[r][i]=t,e},{}),Object.entries(e).reduce(function(e,t){var i=t[0];return t=t[1],e[i]=Va(t,r),e},{})):{}))}(e.headers,t,i)):e.url=function(e,t,i){return void 0===(i=i)&&(i={}),(i=(t=t)?(t=Va(t,i),Ha+"="+encodeURIComponent(t)):"")?Ka.test(e)?e.replace(Ka,i):e+(t=e.includes("?")?"&":"?")+i:e}(e.url,t,i)},t.getNextFrag=function(e){var t=null==(t=this.hls.levels[e.level])?void 0:t.details;if(t)return e=e.sn-t.startSN,t.fragments[1+e]},t.getObjectType=function(e){var t=e.type;return"subtitle"===t?Sa.TIMED_TEXT:"initSegment"===e.sn?Sa.INIT:"audio"===t?Sa.AUDIO:"main"===t?this.hls.audioTracks.length?Sa.VIDEO:Sa.MUXED:void 0},t.getTopBandwidth=function(e){for(var t=0,i=this.hls,r=function(e,t){var i,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){var i;if(e)return"string"==typeof e?p(e,t):"Map"===(i="Object"===(i=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?p(e,t):void 0}(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),i=0,function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e===Sa.AUDIO?i.audioTracks:(e=-1<(e=i.maxAutoLevel)?e+1:i.levels.length,i.levels.slice(0,e)));!(n=r()).done;){var n=n.value;n.bitrate>t&&(t=n.bitrate)}return 0<t?t:NaN},t.getBufferLength=function(e){var t=this.media;return(e=e===Sa.AUDIO?this.audioBuffer:this.videoBuffer)&&t?1e3*Ri.bufferInfo(e,t.currentTime,this.config.maxBufferHole).len:NaN},t.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function e(e){this.loader=void 0,this.loader=new i(e)}var r=e.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(e,i,r){t(e),this.loader.load(e,i,r)},l(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}])}()},t.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function e(e){this.loader=void 0,this.loader=new i(e)}var r=e.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(e,i,r){t(e),this.loader.load(e,i,r)},l(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}])}()},e}(),Wa=function(e){function t(t){var i=e.call(this,"content-steering",t.logger)||this;return i.hls=void 0,i.loader=null,i.uri=null,i.pathwayId=".",i.pathwayPriority=null,i.timeToLoad=300,i.reloadTimer=-1,i.updated=0,i.started=!1,i.enabled=!0,i.levels=null,i.audioTracks=null,i.subtitleTracks=null,i.penalizedPathways={},i.hls=t,i.registerListeners(),i}c(t,e);var i=t.prototype;return i.registerListeners=function(){var e=this.hls;e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(C.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.ERROR,this.onError,this)},i.unregisterListeners=function(){var e=this.hls;e&&(e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(C.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.ERROR,this.onError,this))},i.startLoad=function(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){var e=1e3*this.timeToLoad-(performance.now()-this.updated);if(0<e)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}},i.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()},i.clearTimeout=function(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)},i.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},i.removeLevel=function(e){var t=this.levels;t&&(this.levels=t.filter(function(t){return t!==e}))},i.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},i.onManifestLoaded=function(e,t){null!==(t=t.contentSteering)&&(this.pathwayId=t.pathwayId,this.uri=t.uri,this.started)&&this.startLoad()},i.onManifestParsed=function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks},i.onError=function(e,t){var i,r,n,a,s,o,l=t.errorAction;2===(null==l?void 0:l.action)&&1===l.flags&&(i=this.levels,r=this.pathwayPriority,n=this.pathwayId,t.context&&(a=(o=t.context).groupId,s=o.pathwayId,o=o.type,a&&i?n=this.getPathwayForGroupId(a,o,n):s&&(n=s)),n in this.penalizedPathways||(this.penalizedPathways[n]=performance.now()),(r=!r&&i?i.reduce(function(e,t){return-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e},[]):r)&&1<r.length&&(this.updatePathwayPriority(r),l.resolved=this.pathwayId!==n),l.resolved||this.warn("Could not resolve "+t.details+' ("'+t.error.message+'") with content-steering for Pathway: '+n+" levels: "+(i&&i.length)+" priorities: "+JSON.stringify(r)+" penalized: "+JSON.stringify(this.penalizedPathways)))},i.filterParsedLevels=function(e){this.levels=e;var t,i=this.getLevelsForPathway(this.pathwayId);return 0===i.length&&(t=e[0].pathwayId,this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+t+'"'),i=this.getLevelsForPathway(t),this.pathwayId=t),i.length!==e.length?(this.log("Found "+i.length+"/"+e.length+' levels in Pathway "'+this.pathwayId+'"'),i):e},i.getLevelsForPathway=function(e){return null===this.levels?[]:this.levels.filter(function(t){return e===t.pathwayId})},i.updatePathwayPriority=function(e){this.pathwayPriority=e;var t=this.penalizedPathways,i=performance.now();Object.keys(t).forEach(function(e){3e5<i-t[e]&&delete t[e]});for(var r=0;r<e.length;r++){var n=e[r];if(!(n in t)){if(n===this.pathwayId)return;var a,s=this.hls.nextLoadLevel,o=this.hls.levels[s];if(0<(a=this.getLevelsForPathway(n)).length){this.log('Setting Pathway to "'+n+'"'),this.pathwayId=n,$t(a),this.hls.trigger(C.LEVELS_UPDATED,{levels:a}),n=this.hls.levels[s],o&&n&&this.levels&&(n.attrs["STABLE-VARIANT-ID"]!==o.attrs["STABLE-VARIANT-ID"]&&n.bitrate!==o.bitrate&&this.log("Unstable Pathways change from bitrate "+o.bitrate+" to "+n.bitrate),this.hls.nextLoadLevel=s);break}}}},i.getPathwayForGroupId=function(e,t,i){for(var r=this.getLevelsForPathway(i).concat(this.levels||[]),n=0;n<r.length;n++)if(t===yt&&r[n].hasAudioGroup(e)||t===_t&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return i},i.clonePathways=function(e){var t,i,r=this,n=this.levels;n&&(t={},i={},e.forEach(function(e){var a=e.ID,s=e["BASE-ID"],o=e["URI-REPLACEMENT"];n.some(function(e){return e.pathwayId===a})||(e=r.getLevelsForPathway(s).map(function(e){var r=new D(e.attrs),n=(r["PATHWAY-ID"]=a,r.AUDIO&&r.AUDIO+"_clone_"+a),s=r.SUBTITLES&&r.SUBTITLES+"_clone_"+a,l=(n=(n&&(t[r.AUDIO]=n,r.AUDIO=n),s&&(i[r.SUBTITLES]=s,r.SUBTITLES=s),Ya(e.uri,r["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",o)),new Vt({attrs:r,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:n,videoCodec:e.videoCodec,width:e.width}));if(e.audioGroups)for(var u=1;u<e.audioGroups.length;u++)l.addGroupId("audio",e.audioGroups[u]+"_clone_"+a);if(e.subtitleGroups)for(var c=1;c<e.subtitleGroups.length;c++)l.addGroupId("text",e.subtitleGroups[c]+"_clone_"+a);return l}),n.push.apply(n,e),za(r.audioTracks,t,o,a),za(r.subtitleTracks,i,o,a))}))},i.loadSteeringManifest=function(e){var t,i=this,r=this.hls.config,n=r.loader;this.loader&&this.loader.destroy(),this.loader=new n(r);try{t=new self.URL(e)}catch(r){return this.enabled=!1,void this.log("Failed to parse Steering Manifest URI: "+e)}"data:"!==t.protocol&&(n=0|(this.hls.bandwidthEstimate||r.abrEwmaDefaultEstimate),t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+n)),e={responseType:"json",url:t.href},r=(n=r.steeringManifestLoadPolicy.default).errorRetry||n.timeoutRetry||{},n={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:r.maxNumRetry||0,retryDelay:r.retryDelayMs||0,maxRetryDelay:r.maxRetryDelayMs||0},r={onSuccess:function(e,r,n,a){if(i.log('Loaded steering manifest: "'+t+'"'),1!==(null==(e=e.data)?void 0:e.VERSION))i.log("Steering VERSION "+e.VERSION+" not supported!");else{i.updated=performance.now(),i.timeToLoad=e.TTL;var s=e["RELOAD-URI"],o=e["PATHWAY-CLONES"],l=e["PATHWAY-PRIORITY"];if(s)try{i.uri=new self.URL(s,t).href}catch(e){return i.enabled=!1,void i.log("Failed to parse Steering Manifest RELOAD-URI: "+s)}i.scheduleRefresh(i.uri||n.url),o&&i.clonePathways(o),s={steeringManifest:e,url:t.toString()},i.hls.trigger(C.STEERING_MANIFEST_LOADED,s),l&&i.updatePathwayPriority(l)}},onError:function(e,t,r,n){var a;i.log("Error loading steering manifest: "+e.code+" "+e.text+" ("+t.url+")"),i.stopLoad(),410===e.code?(i.enabled=!1,i.log("Steering manifest "+t.url+" no longer available")):(a=1e3*i.timeToLoad,429===e.code?("function"==typeof(null==(e=i.loader)?void 0:e.getResponseHeader)&&(e=e.getResponseHeader("Retry-After"))&&(a=1e3*parseFloat(e)),i.log("Steering manifest "+t.url+" rate limited")):i.scheduleRefresh(i.uri||t.url,a))},onTimeout:function(e,t,r){i.log("Timeout loading steering manifest ("+t.url+")"),i.scheduleRefresh(i.uri||t.url)}},this.log("Requesting steering manifest: "+t),this.loader.load(e,n,r)},i.scheduleRefresh=function(e,t){var i=this;void 0===t&&(t=1e3*this.timeToLoad),this.clearTimeout(),this.reloadTimer=self.setTimeout(function(){var t=null==(t=i.hls)?void 0:t.media;t&&!t.ended?i.loadSteeringManifest(e):i.scheduleRefresh(e,1e3*i.timeToLoad)},t)},t}(m);function za(e,t,i,r){e&&Object.keys(t).forEach(function(n){var a=e.filter(function(e){return e.groupId===n}).map(function(e){var a=u({},e);return a.details=void 0,a.attrs=new D(a.attrs),a.url=a.attrs.URI=Ya(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),a.groupId=a.attrs["GROUP-ID"]=t[n],a.attrs["PATHWAY-ID"]=r,a});e.push.apply(e,a)})}function Ya(e,t,i,r){var n,a=r.HOST,s=r.PARAMS,o=(r=r[i],t&&(n=null==r?void 0:r[t])&&(e=n),new self.URL(e));return a&&!n&&(o.host=a),s&&Object.keys(s).sort().forEach(function(e){e&&o.searchParams.set(e,s[e])}),o.href}var Xa=/^age:\s*[\d.]+\s*$/im,$a=function(){function e(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new N,this.retryDelay=0}var t=e.prototype;return t.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null,this.stats=null},t.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState)&&(this.stats.aborted=!0,e.abort())},t.abort=function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},t.load=function(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()},t.loadInternal=function(){var e,t,i,r=this,n=this.config,a=this.context;n&&a&&(e=this.loader=new self.XMLHttpRequest,(t=this.stats).loading.first=0,t.loaded=0,t.aborted=!1,(i=this.xhrSetup)?Promise.resolve().then(function(){if(!r.stats.aborted)return i(e,a.url)}).catch(function(t){return e.open("GET",a.url,!0),i(e,a.url)}).then(function(){r.stats.aborted||r.openAndSendXhr(e,a,n)}).catch(function(i){r.callbacks.onError({code:e.status,text:i.message},a,e,t)}):this.openAndSendXhr(e,a,n))},t.openAndSendXhr=function(e,t,i){e.readyState||e.open("GET",t.url,!0);var r=t.headers,n=(a=i.loadPolicy).maxTimeToFirstByteMs,a=a.maxLoadTimeMs;if(r)for(var s in r)e.setRequestHeader(s,r[s]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=n&&E(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()},t.readystatechange=function(){var e,t,i,r,n=this.context,a=this.loader,s=this.stats;n&&a&&(t=a.readyState,e=this.config,s.aborted||2<=t&&(0===s.loading.first&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),e.timeout!==e.loadPolicy.maxLoadTimeMs)&&(self.clearTimeout(this.requestTimeout),e.timeout=e.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start))),4===t)&&(self.clearTimeout(this.requestTimeout),a.onreadystatechange=null,a.onprogress=null,t=a.status,r="text"!==a.responseType,200<=t&&t<300&&(r&&a.response||null!==a.responseText)?(s.loading.end=Math.max(self.performance.now(),s.loading.first),r=r?a.response:a.responseText,i="arraybuffer"===a.responseType?r.byteLength:r.length,s.loaded=s.total=i,s.bwEstimate=8e3*s.total/(s.loading.end-s.loading.first),this.callbacks&&((i=this.callbacks.onProgress)&&i(s,n,r,a),this.callbacks)&&(i={url:a.responseURL,data:r,code:t},this.callbacks.onSuccess(i,s,n,a))):ti(r=e.loadPolicy.errorRetry,s.retry,!1,{url:n.url,data:void 0,code:t})?this.retry(r):(B.error(t+" while loading "+n.url),this.callbacks.onError({code:t,text:a.statusText},n,a,s))))},t.loadtimeout=function(){var e=null==(e=this.config)?void 0:e.loadPolicy.timeoutRetry;ti(e,this.stats.retry,!0)?this.retry(e):(B.warn("timeout while loading "+(null==(e=this.context)?void 0:e.url)),(e=this.callbacks)&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader)))},t.retry=function(e){var t=this.context,i=this.stats;this.retryDelay=Zt(e,i.retry),i.retry++,B.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+(null==t?void 0:t.url)+", retrying "+i.retry+"/"+e.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},t.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},t.getCacheAge=function(){var e,t=null;return this.loader&&Xa.test(this.loader.getAllResponseHeaders())?(e=this.loader.getResponseHeader("age"))?parseFloat(e):null:t},t.getResponseHeader=function(e){return this.loader&&new RegExp("^"+e+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null},e}(),Qa=/(\d+)-(\d+)\/(\d+)/,Ja=function(){function e(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Za,this.controller=new self.AbortController,this.stats=new N}var t=e.prototype;return t.destroy=function(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null},t.abortInternal=function(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())},t.abort=function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},t.load=function(e,t,i){var r=this,n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();var a=function(e,t){return t={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(u({},e.headers))},e.rangeEnd&&t.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)),t}(e,this.controller.signal),s=i.onProgress,o="arraybuffer"===e.responseType,l=o?"byteLength":"length",c=t.loadPolicy,d=c.maxTimeToFirstByteMs,h=c.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,a),self.clearTimeout(this.requestTimeout),t.timeout=d&&E(d)?d:h,this.requestTimeout=self.setTimeout(function(){r.abortInternal(),i.onTimeout(n,e,r.response)},t.timeout),self.fetch(this.request).then(function(a){r.response=r.loader=a;var l,u=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(r.requestTimeout),t.timeout=h,r.requestTimeout=self.setTimeout(function(){r.abortInternal(),i.onTimeout(n,e,r.response)},h-(u-n.loading.start)),a.ok)return n.loading.first=u,n.total=function(e){var t=e.get("Content-Range");return t&&(t=function(e){if(e=Qa.exec(e))return parseInt(e[2])-parseInt(e[1])+1}(t),E(t))?t:(t=e.get("Content-Length"))?parseInt(t):void 0}(a.headers)||n.total,s&&E(t.highWaterMark)?r.loadProgressively(a,n,e,t.highWaterMark,s):o?a.arrayBuffer():"json"===e.responseType?a.json():a.text();throw u=a.status,l=a.statusText,new es(l||"fetch, bad network response",u,a)}).then(function(a){var o=r.response;if(!o)throw new Error("loader destroyed");self.clearTimeout(r.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);var u=((u=a[l])&&(n.loaded=n.total=u),{url:o.url,data:a,code:o.status});s&&!E(t.highWaterMark)&&s(n,e,a,o),i.onSuccess(u,n,e,o)}).catch(function(t){var a,s;self.clearTimeout(r.requestTimeout),n.aborted||(a=t&&t.code||0,s=t?t.message:null,i.onError({code:a,text:s},e,t?t.details:null,n))})},t.getCacheAge=function(){var e,t=null;return this.response?(e=this.response.headers.get("age"))?parseFloat(e):null:t},t.getResponseHeader=function(e){return this.response?this.response.headers.get(e):null},t.loadProgressively=function(e,t,i,r,n){void 0===r&&(r=0);var a=new tr,s=e.body.getReader();return function o(){return s.read().then(function(s){var l;return s.done?(a.dataLength&&n(t,i,a.flush(),e),Promise.resolve(new ArrayBuffer(0))):(l=(s=s.value).length,t.loaded+=l,l<r||a.dataLength?(a.push(s),a.dataLength>=r&&n(t,i,a.flush(),e)):n(t,i,s,e),o())}).catch(function(){return Promise.reject()})}()},e}();function Za(e,t){return new self.Request(e.url,t)}var es=function(e){function t(t,i,r){return(t=e.call(this,t)||this).code=void 0,t.details=void 0,t.code=i,t.details=r,t}return c(t,e),t}(f(Error)),ts=/\s/,is=i(i({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:$a,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:yi,bufferController:qr,capLevelController:wr,errorController:ai,fpsController:wa,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:ne,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:{newCue:function(e,t,i,r){for(var n,a,s,o,l=[],u=self.VTTCue||self.TextTrackCue,c=0;c<r.rows.length;c++)if(a=!0,s=0,o="",!(n=r.rows[c]).isEmpty()){for(var d,h=0;h<n.chars.length;h++)ts.test(n.chars[h].uchar)&&a?s++:(o+=n.chars[h].uchar,a=!1);(n.cueStartTime=t)===i&&(i+=1e-4),16<=s?s--:s++;var f=ra(o.trim()),p=la(t,i,f);null!=e&&null!=(d=e.cues)&&d.getCueById(p)||((d=new u(t,i,f)).id=p,d.line=c+1,d.align="left",d.position=10+Math.min(80,10*Math.floor(8*s/32)),l.push(d))}return e&&l.length&&(l.sort(function(e,t){return"auto"===e.line||"auto"===t.line?0:8<e.line&&8<t.line?t.line-e.line:e.line-t.line}),l.forEach(function(t){return Lt(e,t)})),l}},enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:rr,subtitleTrackController:Cr,timelineController:Qr,audioStreamController:Ar,audioTrackController:Er,emeController:Ca,cmcdController:qa,contentSteeringController:Wa});function rs(e){return e&&"object"===(void 0===e?"undefined":n(e))?Array.isArray(e)?e.map(rs):Object.keys(e).reduce(function(t,i){return t[i]=rs(e[i]),t},{}):e}var ns=function(e){function t(t,i){return(t=e.call(this,t,"level-controller")||this)._levels=[],t._firstLevel=-1,t._maxAutoLevel=-1,t._startLevel=void 0,t.currentLevel=null,t.currentLevelIndex=-1,t.manualLevelIndex=-1,t.steering=void 0,t.onParsedComplete=void 0,t.steering=i,t._registerListeners(),t}c(t,e);var i=t.prototype;return i._registerListeners=function(){var e=this.hls;e.on(C.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(C.LEVEL_LOADED,this.onLevelLoaded,this),e.on(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(C.FRAG_BUFFERED,this.onFragBuffered,this),e.on(C.ERROR,this.onError,this)},i._unregisterListeners=function(){var e=this.hls;e.off(C.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(C.LEVEL_LOADED,this.onLevelLoaded,this),e.off(C.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(C.FRAG_BUFFERED,this.onFragBuffered,this),e.off(C.ERROR,this.onError,this)},i.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),e.prototype.destroy.call(this)},i.stopLoad=function(){this._levels.forEach(function(e){e.loadError=0,e.fragmentError=0}),e.prototype.stopLoad.call(this)},i.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1},i.onManifestLoading=function(e,t){this.resetLevels()},i.onManifestLoaded=function(e,t){var i=this.hls.config.preferManagedMediaSource,r=[],n={},a={},s=!1,o=!1,l=!1;t.levels.forEach(function(e){var t,u,c,d,h=e.attrs,f=e.audioCodec,p=e.videoCodec,m=(f&&(e.audioCodec=f=it(f,i)||void 0),0===(null==p?void 0:p.indexOf("avc1"))&&(p=e.videoCodec=2<(g=(v=p).split(".")).length?(m=g.shift()+".",(m+=parseInt(g.shift()).toString(16))+("000"+parseInt(g.shift()).toString(16)).slice(-4)):v),e.width),g=e.height,v=e.unknownCodecs;s=s||!(!m||!g),o=o||!!p,l=l||!!f,null!=v&&v.length||f&&!Xe(f,"audio",i)||p&&!Xe(p,"video",i)||(f=h.CODECS,p=h["FRAME-RATE"],t=h["HDCP-LEVEL"],c=h["PATHWAY-ID"],d=h.RESOLUTION,u=h["VIDEO-RANGE"],c=(c||".")+"-"+e.bitrate+"-"+d+"-"+p+"-"+f+"-"+u+"-"+t,n[c]?n[c].uri===e.url||e.attrs["PATHWAY-ID"]?(n[c].addGroupId("audio",h.AUDIO),n[c].addGroupId("text",h.SUBTITLES)):(d=a[c]+=1,e.attrs["PATHWAY-ID"]=new Array(d+1).join("."),p=new Vt(e),r.push(n[c]=p)):(f=new Vt(e),n[c]=f,a[c]=1,r.push(f)))}),this.filterAndSortMediaOptions(r,t,s,o,l)},i.filterAndSortMediaOptions=function(e,t,i,r,n){var a=this,s=[],o=[],l=e;if(0===(l=(i||r)&&n?l.filter(function(e){var t=e.videoCodec,i=e.videoRange,r=e.width;e=e.height;return(!!t||!(!r||!e))&&!!(t=i)&&-1<jt.indexOf(t)}):l).length)Promise.resolve().then(function(){var e;a.hls&&(t.levels.length&&a.warn("One or more CODECS in variant not supported: "+JSON.stringify(t.levels[0].attrs)),e=new Error("no level with compatible codecs found in manifest"),a.hls.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message}))});else{t.audioTracks&&(u=this.hls.config.preferManagedMediaSource,as(s=t.audioTracks.filter(function(e){return!e.audioCodec||Xe(e.audioCodec,"audio",u)}))),t.subtitles&&as(o=t.subtitles);var u,c=l.slice(0),d=(l.sort(function(e,t){if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return jt.indexOf(e.videoRange)-jt.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){var r=Je(e.videoCodec),n=Je(t.videoCodec);if(r!==n)return n-r}return e.uri===t.uri&&e.codecSet!==t.codecSet&&(n=Ze(e.codecSet))!==(r=Ze(t.codecSet))?r-n:e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}),c[0]);if(this.steering&&(l=this.steering.filterParsedLevels(l)).length!==c.length)for(var h=0;h<c.length;h++)if(c[h].pathwayId===l[0].pathwayId){d=c[h];break}this._levels=l;for(var f=0;f<l.length;f++)if(l[f]===d){this._firstLevel=f;var p,m=d.bitrate,g=this.hls.bandwidthEstimate;this.log("manifest loaded, "+l.length+" level(s) found, first bitrate: "+m),void 0===(null==(p=this.hls.userConfig)?void 0:p.abrEwmaDefaultEstimate)&&g<(p=Math.min(m,this.hls.config.abrEwmaDefaultEstimateMax))&&g===is.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=p);break}e={levels:l,audioTracks:s,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:!(n&&!r)&&s.some(function(e){return!!e.url})},this.hls.trigger(C.MANIFEST_PARSED,e),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}},i.onError=function(e,t){!t.fatal&&t.context&&t.context.type===vt&&t.context.level===this.level&&this.checkRetry(t)},i.onFragBuffered=function(e,t){var i;void 0!==(t=t.frag)&&t.type===bt&&(i=t.elementaryStreams,Object.keys(i).some(function(e){return!!i[e]}))&&null!=(t=this._levels[t.level])&&t.loadError&&(this.log("Resetting level error count of "+t.loadError+" on frag buffered"),t.loadError=0)},i.onLevelLoaded=function(e,t){var i=t.level,r=t.details,n=this._levels[i];n?i===this.currentLevelIndex?(0===n.fragmentError&&(n.loadError=0),(n=n.details)===t.details&&n.advanced&&(n=void 0),this.playlistLoaded(i,t,n)):null!=(n=t.deliveryDirectives)&&n.skip&&(r.deltaUpdateFailed=!0):(this.warn("Invalid level index "+i),null!=(n=t.deliveryDirectives)&&n.skip&&(r.deltaUpdateFailed=!0))},i.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this);var i=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){var n=r.uri;if(t)try{n=t.addDirectives(n)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}var a=r.attrs["PATHWAY-ID"];this.log("Loading level index "+i+(void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")+" with"+(a?" Pathway "+a:"")+" "+n),this.clearTimer(),this.hls.trigger(C.LEVEL_LOADING,{url:n,level:i,pathwayId:r.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}},i.removeLevel=function(e){var t,i=this,r=this._levels.filter(function(t,r){return r!==e||(i.steering&&i.steering.removeLevel(t),t===i.currentLevel&&(i.currentLevel=null,i.currentLevelIndex=-1,t.details)&&t.details.fragments.forEach(function(e){return e.level=-1}),!1)});$t(r),this._levels=r,-1<this.currentLevelIndex&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(C.LEVELS_UPDATED,{levels:r})},i.onLevelsUpdated=function(e,t){t=t.levels,this._levels=t},i.checkMaxAutoUpdated=function(){var e=(i=this.hls).autoLevelCapping,t=i.maxAutoLevel,i=i.maxHdcpLevel;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(C.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))},l(t,[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){if(0!==(r=this._levels).length){if(e<0||e>=r.length){var t=new Error("invalid level idx"),i=e<0;if(this.hls.trigger(C.ERROR,{type:L.OTHER_ERROR,details:A.LEVEL_SWITCH_ERROR,level:e,fatal:i,error:t,reason:t.message}),i)return;e=Math.min(e,r.length-1)}t=this.currentLevelIndex;var r,n=(i=this.currentLevel)?i.attrs["PATHWAY-ID"]:void 0,a=(r=r[e]).attrs["PATHWAY-ID"];this.currentLevelIndex=e,this.currentLevel=r,t===e&&r.details&&i&&n===a||(this.log("Switching to level "+e+" ("+(r.height?r.height+"p ":"")+(r.videoRange?r.videoRange+" ":"")+(r.codecSet?r.codecSet+" ":"")+"@"+r.bitrate+")"+(a?" with Pathway "+a:"")+" from level "+t+(n?" with Pathway "+n:"")),a={level:e,attrs:r.attrs,details:r.details,bitrate:r.bitrate,averageBitrate:r.averageBitrate,maxBitrate:r.maxBitrate,realBitrate:r.realBitrate,width:r.width,height:r.height,codecSet:r.codecSet,audioCodec:r.audioCodec,videoCodec:r.videoCodec,audioGroups:r.audioGroups,subtitleGroups:r.subtitleGroups,loaded:r.loaded,loadError:r.loadError,fragmentError:r.fragmentError,name:r.name,id:r.id,uri:r.uri,url:r.url,urlId:0,audioGroupIds:r.audioGroupIds,textGroupIds:r.textGroupIds},this.hls.trigger(C.LEVEL_SWITCHING,a),(t=r.details)&&!t.live)||(n=this.switchParams(r.uri,null==i?void 0:i.details),this.loadPlaylist(n))}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){var e;return void 0===this._startLevel?void 0!==(e=this.hls.config.startLevel)?e:this.hls.firstAutoLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}])}(si);function as(e){var t={};e.forEach(function(e){var i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++})}var ss=function(){function e(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var t=e.prototype;return t.abort=function(e){for(var t in this.keyUriToKeyInfo){var i;if(t=this.keyUriToKeyInfo[t].loader){if(e&&e!==(null==(i=t.context)?void 0:i.frag.type))return;t.abort()}}},t.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},t.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo)(e=this.keyUriToKeyInfo[e].loader)&&e.destroy();this.keyUriToKeyInfo={}},t.createKeyLoadError=function(e,t,i,r,n){return void 0===t&&(t=A.KEY_LOAD_ERROR),new Ni({type:L.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r})},t.loadClear=function(e,t){var i=this;if(this.emeController&&this.config.emeEnabled)for(var r=e.sn,n=e.cc,a=0;a<t.length&&!function(){var e=t[a];if(n<=e.cc&&("initSegment"===r||"initSegment"===e.sn||r<e.sn))return i.emeController.selectKeySystemFormat(e).then(function(t){e.setKeyFormat(t)}),1}();a++);},t.load=function(e){var t=this;return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(function(i){return t.loadInternal(e,i)}):this.loadInternal(e)},t.loadInternal=function(e,t){t&&e.setKeyFormat(t);var i=e.decryptdata;if(!i)return t=new Error(t?"Expected frag.decryptdata to be defined after setting format "+t:"Missing decryption data on fragment in onKeyLoading"),Promise.reject(this.createKeyLoadError(e,A.KEY_LOAD_ERROR,t));if(!(t=i.uri))return Promise.reject(this.createKeyLoadError(e,A.KEY_LOAD_ERROR,new Error('Invalid key URI: "'+t+'"')));var r,n=this.keyUriToKeyInfo[t];if(null!=n&&n.decryptdata.key)return i.key=n.decryptdata.key,Promise.resolve({frag:e,keyInfo:n});if(null!=n&&n.keyLoadPromise)switch(null==(r=n.mediaKeySessionContext)?void 0:r.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return n.keyLoadPromise.then(function(t){return i.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:n}})}switch(n=this.keyUriToKeyInfo[t]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===i.keyFormat?this.loadKeyHTTP(n,e):this.loadKeyEME(n,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(n,e);default:return Promise.reject(this.createKeyLoadError(e,A.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'+i.method+'"')))}},t.loadKeyEME=function(e,t){var i={frag:t,keyInfo:e};return this.emeController&&this.config.emeEnabled&&(t=this.emeController.loadKey(i))?(e.keyLoadPromise=t.then(function(t){return e.mediaKeySessionContext=t,i})).catch(function(t){throw e.keyLoadPromise=null,t}):Promise.resolve(i)},t.loadKeyHTTP=function(e,t){var r=this,n=this.config,a=new n.loader(n);return t.keyLoader=e.loader=a,e.keyLoadPromise=new Promise(function(s,o){var l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u={loadPolicy:u=n.keyLoadPolicy.default,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};a.load(l,u,{onSuccess:function(e,t,i,n){var a=i.frag,l=i.keyInfo;i=i.url;if(!a.decryptdata||l!==r.keyUriToKeyInfo[i])return o(r.createKeyLoadError(a,A.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),n));l.decryptdata.key=a.decryptdata.key=new Uint8Array(e.data),a.keyLoader=null,l.loader=null,s({frag:a,keyInfo:l})},onError:function(e,n,a,s){r.resetLoader(n),o(r.createKeyLoadError(t,A.KEY_LOAD_ERROR,new Error("HTTP Error "+e.code+" loading key "+e.text),a,i({url:l.url,data:void 0},e)))},onTimeout:function(e,i,n){r.resetLoader(i),o(r.createKeyLoadError(t,A.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),n))},onAbort:function(e,i,n){r.resetLoader(i),o(r.createKeyLoadError(t,A.INTERNAL_ABORTED,new Error("key loading aborted"),n))}})})},t.resetLoader=function(e){var t=e.frag,i=e.keyInfo,r=(e=e.url,i.loader);t.keyLoader===r&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[e],r&&r.destroy()},e}();function os(){return self.SourceBuffer||self.WebKitSourceBuffer}function ls(){var e;return!!ze()&&(!(e=os())||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove)}var us=function(e){function t(t,i,r,n){var a=e.call(this,"gap-controller",n.logger)||this;return a.config=void 0,a.media=null,a.fragmentTracker=void 0,a.hls=void 0,a.nudgeRetry=0,a.stallReported=!1,a.stalled=null,a.moved=!1,a.seeking=!1,a.ended=0,a.config=t,a.media=i,a.fragmentTracker=r,a.hls=n,a}c(t,e);var i=t.prototype;return i.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},i.poll=function(e,t,i,r){var n=this.config,a=this.media,s=this.stalled;if(null!==a){var o=a.currentTime,l=a.seeking,u=this.seeking&&!l,c=!this.seeking&&l;if(this.seeking=l,o!==e)this.ended=0,this.moved=!0,l||(this.nudgeRetry=0),null!==s&&(this.stallReported&&(e=self.performance.now()-s,this.warn("playback not stuck anymore @"+o+", after "+Math.round(e)+"ms"),this.stallReported=!1),this.stalled=null);else if(c||u)this.stalled=null;else if(a.paused&&!l||a.ended||0===a.playbackRate||!Ri.getBuffered(a).length)this.nudgeRetry=0;else{if(c=(e=Ri.bufferInfo(a,o,0)).nextStart||0,l){if(u=2<e.len,t=!c||t&&t.start<=o||2<c-o&&!this.fragmentTracker.getPartialFragment(o),u||t)return;this.moved=!1}if(!this.moved&&null!==this.stalled){if(!(0<e.len||c))return;if(u=Math.max(c,e.start||0)-o,t=null!=i&&i.live?2*i.targetduration:2,c=this.fragmentTracker.getPartialFragment(o),0<u&&(u<=t||c))return void(a.paused||this._trySkipBufferHole(c))}if(u=self.performance.now(),null===s)this.stalled=u;else{if(t=u-s,!l&&250<=t){if(r===Qi&&(!i||!i.live)&&Math.abs(o-((null==i?void 0:i.edge)||0))<1)return t<1e3||this.ended?void 0:(this.ended=o,void this.hls.trigger(C.MEDIA_ENDED,{stalled:!0}));if(this._reportStall(e),!this.media)return}c=Ri.bufferInfo(a,o,n.maxBufferHole),this._tryFixBufferStall(c,t)}}}},i._tryFixBufferStall=function(e,t){var i=this.config,r=this.fragmentTracker,n=this.media;if(null!==n){if(n=n.currentTime,(r=r.getPartialFragment(n))&&(this._trySkipBufferHole(r)||!this.media))return;(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-n<i.maxBufferHole)&&t>1e3*i.highBufferWatchdogPeriod&&(this.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},i._reportStall=function(e){var t=this.hls,i=this.media;!this.stallReported&&i&&(this.stallReported=!0,i=new Error("Playback stalling at @"+i.currentTime+" due to low buffer ("+JSON.stringify(e)+")"),this.warn(i.message),t.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.BUFFER_STALLED_ERROR,fatal:!1,error:i,buffer:e.len}))},i._trySkipBufferHole=function(e){var t=this.config,i=this.hls,r=this.media;if(null!==r){var n=r.currentTime,a=n<(o=Ri.bufferInfo(r,n,0)).start?o.start:o.nextStart;if(a){var s=o.len<=t.maxBufferHole,o=0<o.len&&o.len<1&&r.readyState<3,l=a-n;if(0<l&&(s||o)){if(l>t.maxBufferHole){var u=this.fragmentTracker;s=!1;if(!(s=!!(0===n&&(o=u.getAppendedFrag(0,bt))&&a<o.end)||s)&&(l=e||u.getAppendedFrag(n,bt))){for(var c=!1,d=l.end;d<a;){var h=u.getPartialFragment(d);if(!h){c=!0;break}d+=h.duration}if(c)return 0}}return t=Math.max(a+.05,n+.1),this.warn("skipping hole, adjusting currentTime from "+n+" to "+t),this.moved=!0,this.stalled=null,r.currentTime=t,e&&!e.gap&&(o=new Error("fragment loaded with buffer holes, seeking from "+n+" to "+t),i.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:o,reason:o.message,frag:e})),t}}}return 0},i._tryNudgeBuffer=function(){var e,t,i=this.config,r=this.hls,n=this.media,a=this.nudgeRetry;null!==n&&(e=n.currentTime,this.nudgeRetry++,a<i.nudgeMaxRetry?(a=e+(a+1)*i.nudgeOffset,t=new Error("Nudging 'currentTime' from "+e+" to "+a),this.warn(t.message),n.currentTime=a,r.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.BUFFER_NUDGE_ON_STALL,error:t,fatal:!1})):(n=new Error("Playhead still not moving while enough data buffered @"+e+" after "+i.nudgeMaxRetry+" nudges"),this.error(n.message),r.trigger(C.ERROR,{type:L.MEDIA_ERROR,details:A.BUFFER_STALLED_ERROR,error:n,fatal:!0})))},t}(m),cs=function(e){function t(t,i,r){var n=e.call(this,t,i,r,"stream-controller",bt)||this;return n.audioCodecSwap=!1,n.gapController=null,n.level=-1,n._forceStartLoad=!1,n.altAudio=!1,n.audioOnly=!1,n.fragPlaying=null,n.fragLastKbps=0,n.couldBacktrack=!1,n.backtrackFragment=null,n.audioCodecSwitch=!1,n.videoBuffer=null,n.onMediaPlaying=function(){n.tick()},n.onMediaSeeked=function(){var e=(e=n.media)?e.currentTime:null;null===(e=(E(e)&&n.log("Media seeked to "+e.toFixed(3)),n.getMainFwdBufferInfo()))||0===e.len?n.warn('Main forward buffer length on "seeked" event '+(e?e.len:"empty")+")"):n.tick()},n.registerListeners(),n}c(t,e);var i=t.prototype;return i.registerListeners=function(){e.prototype.registerListeners.call(this);var t=this.hls;t.on(C.MANIFEST_PARSED,this.onManifestParsed,this),t.on(C.LEVEL_LOADING,this.onLevelLoading,this),t.on(C.LEVEL_LOADED,this.onLevelLoaded,this),t.on(C.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(C.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(C.BUFFER_CREATED,this.onBufferCreated,this),t.on(C.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(C.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(C.FRAG_BUFFERED,this.onFragBuffered,this)},i.unregisterListeners=function(){e.prototype.unregisterListeners.call(this);var t=this.hls;t.off(C.MANIFEST_PARSED,this.onManifestParsed,this),t.off(C.LEVEL_LOADED,this.onLevelLoaded,this),t.off(C.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(C.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(C.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(C.BUFFER_CREATED,this.onBufferCreated,this),t.off(C.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(C.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(C.FRAG_BUFFERED,this.onFragBuffered,this)},i.onHandlerDestroying=function(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),e.prototype.onHandlerDestroying.call(this)},i.startLoad=function(e){var t,i,r;this.levels?(t=this.lastCurrentTime,i=this.hls,this.stopLoad(),this.setInterval(100),this.level=-1,this.startFragRequested||(-1===(r=i.startLevel)&&(i.config.testBandwidth&&1<this.levels.length?this.bitrateTest=!(r=0):r=i.firstAutoLevel),i.nextLoadLevel=r,this.level=i.loadLevel,this.loadedmetadata=!1),0<t&&-1===e&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=Ki,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()):(this._forceStartLoad=!0,this.state=Hi)},i.stopLoad=function(){this._forceStartLoad=!1,e.prototype.stopLoad.call(this)},i.doTick=function(){switch(this.state){case er:var e=this.levels,t=this.level;if(!(t=null==(e=null==e?void 0:e[t])?void 0:e.details)||t.live&&this.levelLastLoaded!==e)this.hls.nextLoadLevel!==this.level&&(this.state=Ki);else{if(this.waitForCdnTuneIn(t))break;this.state=Ki}break;case zi:e=self.performance.now();(!(t=this.retryDate)||t<=e||null!=(t=this.media)&&t.seeking)&&(e=this.levels,t=this.level,e=null==e?void 0:e[t],this.resetStartWhenNotLoaded(e||null),this.state=Ki)}this.state===Ki&&this.doTickIdle(),this.onTickEnd()},i.onTickEnd=function(){e.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},i.doTickIdle=function(){var e,t,i,r,n,a,s,o;this.buffering&&(n=this.hls,r=this.levelLastLoaded,t=this.levels,e=this.media,null===r||!(e||!this.startFragRequested&&n.config.startFragPrefetch)||this.altAudio&&this.audioOnly||(r=n.nextLoadLevel,null!=t&&t[r]&&(e=t[r],null!==(t=this.getMainFwdBufferInfo()))&&((i=this.getLevelDetails())&&this._streamEnded(t,i)?(i={},this.altAudio&&(i.type="video"),this.hls.trigger(C.BUFFER_EOS,i),this.state=Qi):(n.loadLevel!==r&&-1===n.manualLevel&&this.log("Adapting to level "+r+" from level "+this.level),this.level=n.nextLoadLevel=r,!(i=e.details)||this.state===er||i.live&&this.levelLastLoaded!==e?(this.level=r,this.state=er):(n=t.len,(r=this.getMaxBufferLength(e.maxBitrate))<=n||(this.backtrackFragment&&this.backtrackFragment.start>t.end&&(this.backtrackFragment=null),n=this.backtrackFragment?this.backtrackFragment.start:t.end,a=this.getNextFragment(n,i),this.couldBacktrack&&!this.fragPrevious&&a&&"initSegment"!==a.sn&&this.fragmentTracker.getState(a)!==Ei?(s=(null!=(s=this.backtrackFragment)?s:a).sn-i.startSN,(s=i.fragments[s-1])&&a.cc===s.cc&&this.fragmentTracker.removeFragment(a=s)):this.backtrackFragment&&t.len&&(this.backtrackFragment=null),a&&this.isLoopLoading(a,n)&&(a.gap||(o=((s=this.audioOnly&&!this.altAudio?j:G)===G?this.videoBuffer:this.mediaBuffer)||this.media)&&this.afterBufferFlushed(o,s,bt),a=this.getNextFragmentLoopLoading(a,i,t,bt,r)),a&&(!a.initSegment||a.initSegment.data||this.bitrateTest||(a=a.initSegment),this.loadFragment(a,e,n))))))))},i.loadFragment=function(t,i,r){var n=this.fragmentTracker.getState(t);this.fragCurrent=t,n===bi||n===Si?"initSegment"===t.sn?this._loadInitSegment(t,i):this.bitrateTest?(this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t,i)):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,i,r)):this.clearTrackerIfNeeded(t)},i.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,bt)},i.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},i.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},i.nextLevelSwitch=function(){var e=this.levels,t=this.media;if(null!=t&&t.readyState){var i;if(null!=(i=((i=this.getAppendedFrag(t.currentTime))&&1<i.start&&this.flushMainBuffer(0,i.start-1),this.getLevelDetails()))&&i.live){var r=this.getMainFwdBufferInfo();if(!r||r.len<2*i.targetduration)return}e=!t.paused&&e&&(r=e[this.hls.nextLoadLevel],i=this.fragLastKbps)&&this.fragCurrent?this.fragCurrent.duration*r.maxBitrate/(1e3*i)+1:0,(r=this.getBufferedFrag(t.currentTime+e))&&(i=this.followingBufferedFrag(r))&&(this.abortCurrentFrag(),t=i.maxStartPTS||i.start,e=i.duration,i=Math.max(r.end,t+Math.min(Math.max(e-this.config.maxFragLookUpTolerance,e*(this.couldBacktrack?.5:.125)),e*(this.couldBacktrack?.75:.25))),this.flushMainBuffer(i,Number.POSITIVE_INFINITY))}},i.abortCurrentFrag=function(){var e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case qi:case Wi:case zi:case Xi:case $i:this.state=Ki}this.nextLoadPosition=this.getLoadPosition()},i.flushMainBuffer=function(t,i){e.prototype.flushMainBuffer.call(this,t,i,this.altAudio?"video":null)},i.onMediaAttached=function(t,i){e.prototype.onMediaAttached.call(this,t,i),(t=i.media).addEventListener("playing",this.onMediaPlaying),t.addEventListener("seeked",this.onMediaSeeked),this.gapController=new us(this.config,t,this.fragmentTracker,this.hls)},i.onMediaDetaching=function(){var t=this.media;t&&(t.removeEventListener("playing",this.onMediaPlaying),t.removeEventListener("seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),e.prototype.onMediaDetaching.call(this)},i.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(C.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1},i.onManifestParsed=function(e,t){var i,r=!1,n=!1;t.levels.forEach(function(e){(e=e.audioCodec)&&(r=r||-1!==e.indexOf("mp4a.40.2"),n=n||-1!==e.indexOf("mp4a.40.5"))}),this.audioCodecSwitch=r&&n&&!("function"==typeof(null==(i=os())||null==(i=i.prototype)?void 0:i.changeType)),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},i.onLevelLoading=function(e,t){var i=this.levels;i&&this.state===Ki&&(!(i=i[t.level]).details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=er)},i.onLevelLoaded=function(e,t){var i=this.levels,r=t.level,n=t.details,a=n.totalduration;if(i){this.log("Level "+r+" loaded ["+n.startSN+","+n.endSN+"]"+(n.lastPartSn?"[part-"+n.lastPartSn+"-"+n.lastPartIndex+"]":"")+", cc ["+n.startCC+", "+n.endCC+"] duration:"+a);a=i[r],t=(!(i=this.fragCurrent)||this.state!==Wi&&this.state!==zi||i.level!==t.level&&i.loader&&this.abortCurrentFrag(),0);if(n.live||null!=(i=a.details)&&i.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;t=this.alignPlaylists(n,a.details,null==(i=this.levelLastLoaded)?void 0:i.details)}if(a.details=n,this.levelLastLoaded=a,this.hls.trigger(C.LEVEL_UPDATED,{details:n,level:r}),this.state===er){if(this.waitForCdnTuneIn(n))return;this.state=Ki}this.startFragRequested?n.live&&this.synchronizeToLiveEdge(n):this.setStartPosition(n,t),this.tick()}else this.warn("Levels were reset while loading level "+r)},i._handleFragmentLoadProgress=function(e){var t,i,r,n,a,s,o,l=e.frag,u=e.part,c=(e=e.payload,this.levels);c?(t=(c=c[l.level]).details)?(i=c.videoCodec,r=t.PTSKnown||!t.live,n=null==(n=l.initSegment)?void 0:n.data,c=this._getAudioCodec(c),a=this.transmuxer=this.transmuxer||new vn(this.hls,bt,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),s=u?u.index:-1,s=new Li(l.level,l.sn,l.stats.chunkCount,e.byteLength,s,-1!==s),o=this.initPTS[l.cc],a.push(e,n,c,i,l,u,t.totalduration,r,s,o)):(this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset"),this.fragmentTracker.removeFragment(l)):this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered")},i.onAudioTrackSwitching=function(e,t){var i,r=this.altAudio;!t.url&&(this.mediaBuffer!==this.media?(this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media,(i=this.fragCurrent)&&(this.log("Switching to main audio track, cancel main fragment load"),i.abortRequests(),this.fragmentTracker.removeFragment(i)),this.resetTransmuxer(),this.resetLoadingState()):this.audioOnly&&this.resetTransmuxer(),i=this.hls,r&&(i.trigger(C.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),i.trigger(C.AUDIO_TRACK_SWITCHED,t))},i.onAudioTrackSwitched=function(e,t){var i;t=t.id;(t=!!this.hls.audioTracks[t].url)&&(i=this.videoBuffer)&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i),this.altAudio=t,this.tick()},i.onBufferCreated=function(e,t){var i,r=t.tracks,n=!1;for(i in r){var a,s,o=r[i];"main"===o.id?(s=o,"video"===(a=i)&&(o=r[i])&&(this.videoBuffer=o.buffer)):n=!0}n&&s?(this.log("Alternate track found, use "+a+".buffered to schedule main fragment loading"),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media},i.onFragBuffered=function(e,t){var i,r=t.frag;t=t.part;r&&r.type!==bt||(this.fragContextChanged(r)?(this.warn("Fragment "+r.sn+(t?" p: "+t.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),this.state===$i&&(this.state=Ki)):(i=(t||r).stats,this.fragLastKbps=Math.round(8*i.total/(i.buffering.end-i.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,t)))},i.onError=function(e,t){var i;if(t.fatal)this.state=Ji;else switch(t.details){case A.FRAG_GAP:case A.FRAG_PARSING_ERROR:case A.FRAG_DECRYPT_ERROR:case A.FRAG_LOAD_ERROR:case A.FRAG_LOAD_TIMEOUT:case A.KEY_LOAD_ERROR:case A.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(bt,t);break;case A.LEVEL_LOAD_ERROR:case A.LEVEL_LOAD_TIMEOUT:case A.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==er||(null==(i=t.context)?void 0:i.type)!==vt||(this.state=Ki);break;case A.BUFFER_APPEND_ERROR:case A.BUFFER_FULL_ERROR:t.parent&&"main"===t.parent&&(t.details===A.BUFFER_APPEND_ERROR?this.resetLoadingState():this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case A.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}},i.checkBuffer=function(){var e,t,i,r=this.media,n=this.gapController;r&&n&&r.readyState&&(!this.loadedmetadata&&Ri.getBuffered(r).length||(t=(e=this.state)!==Ki?this.fragCurrent:null,i=this.getLevelDetails(),n.poll(this.lastCurrentTime,t,i,e)),this.lastCurrentTime=r.currentTime)},i.onFragLoadEmergencyAborted=function(){this.state=Ki,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},i.onBufferFlushed=function(e,t){var i;((t=t.type)!==j||this.audioOnly&&!this.altAudio)&&(i=(t===G?this.videoBuffer:this.mediaBuffer)||this.media,this.afterBufferFlushed(i,t,bt),this.tick())},i.onLevelsUpdated=function(e,t){-1<this.level&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels},i.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},i.seekToStartPos=function(){var e,t,i,r=this.media;r&&(e=r.currentTime,0<=(t=this.startPosition))&&e<t&&(r.seeking?this.log("could not seek to "+t+", already seeking at "+e):(0<(i=((i=Ri.getBuffered(r)).length?i.start(0):0)-t)&&(i<this.config.maxBufferHole||i<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+i+" to match buffer start"),this.startPosition=t+=i),this.log("seek to target start position "+t+" from current time "+e),r.currentTime=t))},i._getAudioCodec=function(e){return e=this.config.defaultAudioCodec||e.audioCodec,this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),e},i._loadBitrateTestFrag=function(e,t){var i=this;e.bitrateTest=!0,this._doFragLoad(e,t).then(function(r){var n,a=i.hls;r&&!i.fragContextChanged(e)&&(t.fragmentError=0,i.state=Ki,i.startFragRequested=!1,i.bitrateTest=!1,(n=e.stats).parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),a.trigger(C.FRAG_LOADED,r),e.bitrateTest=!1)})},i._handleTransmuxComplete=function(e){var t="main",i=this.hls,r=e.remuxResult;e=e.chunkMeta;if(s=this.getCurrentContext(e)){var n=s.frag,a=s.part,s=s.level,o=r.video,l=r.text,u=r.id3,c=r.initSegment,d=s.details,h=this.altAudio?void 0:r.audio;if(this.fragContextChanged(n))this.fragmentTracker.removeFragment(n);else{if(this.state=Xi,c&&(null!=c&&c.tracks&&(f=n.initSegment||n,this._bufferInitSegment(s,c.tracks,f,e),i.trigger(C.FRAG_PARSING_INIT_SEGMENT,{frag:f,id:t,tracks:c.tracks})),s=c.initPTS,f=c.timescale,E(s))&&(this.initPTS[n.cc]={baseTime:s,timescale:f},i.trigger(C.INIT_PTS_FOUND,{frag:n,id:t,initPTS:s,timescale:f})),o&&d&&"initSegment"!==n.sn){c=d.fragments[n.sn-1-d.startSN],s=n.sn===d.startSN;var f=!c||n.cc>c.cc;if(!1!==r.independent){c=o.startPTS,r=o.endPTS;var p=o.startDTS,m=o.endDTS;if(a)a.elementaryStreams[o.type]={startPTS:c,endPTS:r,startDTS:p,endDTS:m};else if(o.firstKeyFrame&&o.independent&&1===e.id&&!f&&(this.couldBacktrack=!0),o.dropped&&o.independent){var g=((g=this.getMainFwdBufferInfo())?g.end:this.getLoadPosition())+this.config.maxBufferHole,v=o.firstKeyFramePTS||c;if(!s&&g<v-this.config.maxBufferHole&&!f)return void this.backtrack(n);f&&(n.gap=!0),n.setElementaryStreamInfo(o.type,n.start,r,n.start,m,!0)}else s&&2<c&&(n.gap=!0);n.setElementaryStreamInfo(o.type,c,r,p,m),this.backtrackFragment&&(this.backtrackFragment=n),this.bufferFragmentData(o,n,a,e,s||f)}else{if(!s&&!f)return void this.backtrack(n);n.gap=!0}}h&&(g=h.startPTS,v=h.endPTS,c=h.startDTS,r=h.endDTS,a&&(a.elementaryStreams[j]={startPTS:g,endPTS:v,startDTS:c,endDTS:r}),n.setElementaryStreamInfo(j,g,v,c,r),this.bufferFragmentData(h,n,a,e)),d&&null!=u&&null!=(p=u.samples)&&p.length&&(m={id:t,frag:n,details:d,samples:u.samples},i.trigger(C.FRAG_PARSING_METADATA,m)),d&&l&&(o={id:t,frag:n,details:d,samples:l.samples},i.trigger(C.FRAG_PARSING_USERDATA,o))}}else this.resetWhenMissingContext(e)},i._bufferInitSegment=function(e,t,i,r){var n,a,s,o,l,u=this;this.state===Xi&&(this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio,n=t.audio,a=t.video,s=t.audiovideo,n&&(o=e.audioCodec,l=navigator.userAgent.toLowerCase(),(o=this.audioCodecSwitch&&(o=o&&(-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==n.metadata.channelCount)&&-1===l.indexOf("firefox")?"mp4a.40.5":o)&&-1!==o.indexOf("mp4a.40.5")&&-1!==l.indexOf("android")&&"audio/mpeg"!==n.container&&this.log("Android: force audio codec to "+(o="mp4a.40.2")),e.audioCodec&&e.audioCodec!==o&&this.log('Swapping manifest audio codec "'+e.audioCodec+'" for "'+o+'"'),n.levelCodec=o,n.id="main",this.log("Init audio buffer, container:"+n.container+", codecs[selected/level/parsed]=["+(o||"")+"/"+(e.audioCodec||"")+"/"+n.codec+"]")),a&&(a.levelCodec=e.videoCodec,a.id="main",this.log("Init video buffer, container:"+a.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+a.codec+"]")),s&&this.log("Init audiovideo buffer, container:"+s.container+", codecs[level/parsed]=["+e.codecs+"/"+s.codec+"]"),this.hls.trigger(C.BUFFER_CODECS,t),Object.keys(t).forEach(function(e){var n=t[e].initSegment;null!=n&&n.byteLength&&u.hls.trigger(C.BUFFER_APPENDING,{type:e,data:n,frag:i,part:null,chunkMeta:r,parent:i.type})}),this.tickImmediate())},i.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer||this.media,bt)},i.backtrack=function(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Ki},i.checkFragmentChanged=function(){var e,t=this.media,i=null;t&&1<t.readyState&&!1===t.seeking&&(e=t.currentTime,Ri.isBuffered(t,e)?i=this.getAppendedFrag(e):Ri.isBuffered(t,e+.1)&&(i=this.getAppendedFrag(e+.1)),i)&&(this.backtrackFragment=null,t=this.fragPlaying,e=i.level,t&&i.sn===t.sn&&t.level===e||(this.fragPlaying=i,this.hls.trigger(C.FRAG_CHANGED,{frag:i}),t&&t.level===e)||this.hls.trigger(C.LEVEL_SWITCHED,{level:e}))},l(t,[{key:"maxBufferLength",get:function(){var e=this.levels,t=this.level;return(e=null==e?void 0:e[t])?this.getMaxBufferLength(e.maxBitrate):this.config.maxBufferLength}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentFrag",get:function(){var e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}},{key:"currentProgramDateTime",get:function(){if(e=this.media){var e=e.currentTime,t=this.currentFrag;if(t&&E(e)&&E(t.programDateTime))return e=t.programDateTime+1e3*(e-t.start),new Date(e)}return null}},{key:"currentLevel",get:function(){var e=this.currentFrag;return e?e.level:-1}},{key:"nextBufferedFrag",get:function(){var e=this.currentFrag;return e?this.followingBufferedFrag(e):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])}(_i);return(yi=function(){function e(t){void 0===t&&(t={}),this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new hn,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0;var r=this.logger=U(t.debug||!1,"Hls instance"),n=this.config=function(e,t,r){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var n=rs(e),a=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(function(e){var i=("level"===e?"playlist":e)+"LoadPolicy",s=void 0===t[i],o=[];a.forEach(function(r){var a=e+"Loading"+r,l=t[a];if(void 0!==l&&s){o.push(a);var u=n[i].default;switch(t[i]={default:u},r){case"TimeOut":u.maxLoadTimeMs=l,u.maxTimeToFirstByteMs=l;break;case"MaxRetry":u.errorRetry.maxNumRetry=l,u.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":u.errorRetry.retryDelayMs=l,u.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":u.errorRetry.maxRetryDelayMs=l,u.timeoutRetry.maxRetryDelayMs=l}}}),o.length&&r.warn('hls.js config: "'+o.join('", "')+'" setting(s) are deprecated, use "'+i+'": '+JSON.stringify(t[i]))}),i(i({},n),t)}(e.DefaultConfig,t,r),a=(t=(this.userConfig=t,n.progressive&&function(e,t){var i=e.loader;i!==Ja&&i!==$a?(t.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}()&&(e.loader=Ja,e.progressive=!0,e.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}(n,r),n.abrController),r=n.bufferController,n.capLevelController),s=n.errorController,o=n.fpsController,l=(s=new s(this),t=this.abrController=new t(this),new ki(this)),u=(r=this.bufferController=new r(this,l),a=this.capLevelController=new a(this),o=new o(this),new wt(this)),c=new Bt(this),d=(d=n.contentSteeringController)?new d(this):null,h=this.levelController=new ns(this,d),f=new ss(this.config),p=this.streamController=new cs(this,l,f);a.setStreamController(p),o.setStreamController(p),u=[u,h,p],d&&u.splice(1,0,d),this.networkControllers=u,h=[t,r,a,o,c,l];"function"==typeof(t=((d=((p=(this.audioTrackController=this.createController(n.audioTrackController,u),n.audioStreamController))&&u.push(new p(this,l,f)),this.subtitleTrackController=this.createController(n.subtitleTrackController,u),n.subtitleStreamController))&&u.push(new d(this,l,f)),this.createController(n.timelineController,h),f.emeController=this.emeController=this.createController(n.emeController,h),this.cmcdController=this.createController(n.cmcdController,h),this.latencyController=this.createController(Nt,h),this.coreComponents=h,u.push(s),s.onErrorOut))&&this.on(C.ERROR,t,s)}e.isMSESupported=ls,e.isSupported=function(){return!!ls()&&"function"==typeof(null==(e=ze())?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(function(t){return e.isTypeSupported(Qe(t,"video"))})||["mp4a.40.2","fLaC"].some(function(t){return e.isTypeSupported(Qe(t,"audio"))}));var e},e.getMediaSource=function(){return ze()};var t=e.prototype;return t.createController=function(e,t){return e?(e=new e(this),t&&t.push(e),e):null},t.on=function(e,t,i){this._emitter.on(e,t,i=void 0===i?this:i)},t.once=function(e,t,i){this._emitter.once(e,t,i=void 0===i?this:i)},t.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},t.off=function(e,t,i,r){this._emitter.off(e,t,i=void 0===i?this:i,r)},t.listeners=function(e){return this._emitter.listeners(e)},t.emit=function(e,t,i){return this._emitter.emit(e,t,i)},t.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.triggeringException||(this.triggeringException=!0,t=e===C.ERROR,this.trigger(C.ERROR,{type:L.OTHER_ERROR,details:A.INTERNAL_EXCEPTION,fatal:t,event:e,error:i}),this.triggeringException=!1)}return!1},t.listenerCount=function(e){return this._emitter.listenerCount(e)},t.destroy=function(){this.logger.log("destroy"),this.trigger(C.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(e){return e.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(e){return e.destroy()}),this.coreComponents.length=0;var e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null},t.attachMedia=function(e){this.logger.log("attachMedia"),this._media=e,this.trigger(C.MEDIA_ATTACHING,{media:e})},t.detachMedia=function(){this.logger.log("detachMedia"),this.trigger(C.MEDIA_DETACHING,void 0),this._media=null},t.loadSource=function(e){this.stopLoad();var t=this.media,i=this.url,r=this.url=S.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log("loadSource:"+r),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(C.MANIFEST_LOADING,{url:e})},t.startLoad=function(e){void 0===e&&(e=-1),this.logger.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},t.stopLoad=function(){this.logger.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},t.resumeBuffering=function(){this.networkControllers.forEach(function(e){e.resumeBuffering&&e.resumeBuffering()})},t.pauseBuffering=function(){this.networkControllers.forEach(function(e){e.pauseBuffering&&e.pauseBuffering()})},t.swapAudioCodec=function(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},t.recoverMediaError=function(){this.logger.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},t.removeLevel=function(e){this.levelController.removeLevel(e)},t.setAudioOption=function(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)},t.setSubtitleOption=function(e){var t;return null!=(t=this.subtitleTrackController)&&t.setSubtitleOption(e),null},l(e,[{key:"levels",get:function(){return this.levelController.levels||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){this.logger.log("set currentLevel:"+e),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){this.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){this.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){this.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){var e=this.levelController.startLevel;return-1===e&&-1<this.abrController.forcedAutoLevel?this.abrController.forcedAutoLevel:e},set:function(e){this.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){(e=!!e)!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(this.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN},set:function(e){this.abrController.resetEstimator(e)}},{key:"ttfbEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(e){-1<Ft.indexOf(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(e)for(var i=e.length,r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping,i=this.maxHdcpLevel;t=-1===t&&null!=e&&e.length?e.length-1:t;if(i)for(var r=t;r--;){var n=e[r].attrs["HDCP-LEVEL"];if(n&&n<=i)return r}return t}},{key:"firstAutoLevel",get:function(){return this.abrController.firstAutoLevel}},{key:"nextAutoLevel",get:function(){return this.abrController.nextAutoLevel},set:function(e){this.abrController.nextAutoLevel=e}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"maxBufferLength",get:function(){return this.streamController.maxBufferLength}},{key:"allAudioTracks",get:function(){var e=this.audioTrackController;return e?e.allAudioTracks:[]}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"allSubtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){}},{key:"Events",get:function(){return C}},{key:"ErrorTypes",get:function(){return L}},{key:"ErrorDetails",get:function(){return A}},{key:"DefaultConfig",get:function(){return e.defaultConfig||is},set:function(t){e.defaultConfig=t}}])}()).defaultConfig=void 0,yi},"object"===n(t)&&void 0!==e?e.exports=o():void 0!==(r="function"==typeof(r=o)?r.call(t,i,t,e):r)&&(e.exports=r)}(!1)}]),"object"==typeof module&&module.exports&&(module.exports=window.hlsSourceHandler),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).adapter=e()}}(function(){return function(){return function e(t,i,r){function n(s,o){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=i[s]={exports:{}};t[s][0].call(c.exports,function(e){return n(t[s][1][e]||e)},c,c.exports,e,t,i,r)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}}()({1:[function(e,t,i){"use strict";var r=(0,e("./adapter_factory.js").adapterFactory)({window:"undefined"==typeof window?void 0:window});t.exports=r},{"./adapter_factory.js":2}],2:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.adapterFactory=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).window,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0},i=r.log,u=r.detectBrowser(e),c={browserDetails:u,commonShim:l,extractVersion:r.extractVersion,disableLog:r.disableLog,disableWarnings:r.disableWarnings};switch(u.browser){case"chrome":if(!n||!n.shimPeerConnection||!t.shimChrome)return i("Chrome shim is not included in this adapter release."),c;if(null===u.version)return i("Chrome shim can not determine version, not shimming."),c;i("adapter.js shimming chrome."),c.browserShim=n,n.shimGetUserMedia(e),n.shimMediaStream(e),n.shimPeerConnection(e),n.shimOnTrack(e),n.shimAddTrackRemoveTrack(e),n.shimGetSendersWithDtmf(e),n.shimGetStats(e),n.shimSenderReceiverGetStats(e),n.fixNegotiationNeeded(e),l.shimRTCIceCandidate(e),l.shimConnectionState(e),l.shimMaxMessageSize(e),l.shimSendThrowTypeError(e),l.removeAllowExtmapMixed(e);break;case"firefox":if(!s||!s.shimPeerConnection||!t.shimFirefox)return i("Firefox shim is not included in this adapter release."),c;i("adapter.js shimming firefox."),c.browserShim=s,s.shimGetUserMedia(e),s.shimPeerConnection(e),s.shimOnTrack(e),s.shimRemoveStream(e),s.shimSenderGetStats(e),s.shimReceiverGetStats(e),s.shimRTCDataChannel(e),s.shimAddTransceiver(e),s.shimGetParameters(e),s.shimCreateOffer(e),s.shimCreateAnswer(e),l.shimRTCIceCandidate(e),l.shimConnectionState(e),l.shimMaxMessageSize(e),l.shimSendThrowTypeError(e);break;case"edge":if(!a||!a.shimPeerConnection||!t.shimEdge)return i("MS edge shim is not included in this adapter release."),c;i("adapter.js shimming edge."),c.browserShim=a,a.shimGetUserMedia(e),a.shimGetDisplayMedia(e),a.shimPeerConnection(e),a.shimReplaceTrack(e),l.shimMaxMessageSize(e),l.shimSendThrowTypeError(e);break;case"safari":if(!o||!t.shimSafari)return i("Safari shim is not included in this adapter release."),c;i("adapter.js shimming safari."),c.browserShim=o,o.shimRTCIceServerUrls(e),o.shimCreateOfferLegacy(e),o.shimCallbacksAPI(e),o.shimLocalStreamsAPI(e),o.shimRemoteStreamsAPI(e),o.shimTrackEventTransceiver(e),o.shimGetUserMedia(e),o.shimAudioContext(e),l.shimRTCIceCandidate(e),l.shimMaxMessageSize(e),l.shimSendThrowTypeError(e),l.removeAllowExtmapMixed(e);break;default:i("Unsupported browser!")}return c};var r=u(e("./utils")),n=u(e("./chrome/chrome_shim")),a=u(e("./edge/edge_shim")),s=u(e("./firefox/firefox_shim")),o=u(e("./safari/safari_shim")),l=u(e("./common_shim"));function u(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}},{"./chrome/chrome_shim":3,"./common_shim":6,"./edge/edge_shim":7,"./firefox/firefox_shim":11,"./safari/safari_shim":14,"./utils":15}],3:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=i.shimGetUserMedia=void 0;var 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},n=e("./getusermedia");Object.defineProperty(i,"shimGetUserMedia",{enumerable:!0,get:function(){return n.shimGetUserMedia}});var a=e("./getdisplaymedia");Object.defineProperty(i,"shimGetDisplayMedia",{enumerable:!0,get:function(){return a.shimGetDisplayMedia}}),i.shimMediaStream=function(e){e.MediaStream=e.MediaStream||e.webkitMediaStream},i.shimOnTrack=function(e){if("object"!==(void 0===e?"undefined":r(e))||!e.RTCPeerConnection||"ontrack"in e.RTCPeerConnection.prototype)s.wrapPeerConnectionEvent(e,"track",function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e});else{Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var i=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",function(r){var n=void 0;n=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find(function(e){return e.track&&e.track.id===r.track.id}):{track:r.track};var a=new Event("track");a.track=r.track,a.receiver=n,a.transceiver={receiver:n},a.streams=[t.stream],i.dispatchEvent(a)}),t.stream.getTracks().forEach(function(r){var n=void 0;n=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find(function(e){return e.track&&e.track.id===r.id}):{track:r};var a=new Event("track");a.track=r,a.receiver=n,a.transceiver={receiver:n},a.streams=[t.stream],i.dispatchEvent(a)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}},i.shimGetSendersWithDtmf=function(e){if("object"===(void 0===e?"undefined":r(e))&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var n=i.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var a=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var i=this;this._senders=this._senders||[],a.apply(this,[e]),e.getTracks().forEach(function(e){i._senders.push(t(i,e))})};var s=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],s.apply(this,[e]),e.getTracks().forEach(function(e){var i=t._senders.find(function(t){return t.track===e});i&&t._senders.splice(t._senders.indexOf(i),1)})}}else if("object"===(void 0===e?"undefined":r(e))&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var o=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=o.apply(this,[]);return t.forEach(function(t){return t._pc=e}),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}},i.shimGetStats=function(e){if(!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,i=Array.prototype.slice.call(arguments),r=i[0],n=i[1],a=i[2];if(arguments.length>0&&"function"==typeof r)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof r))return t.apply(this,[]);var s=function(e){var t={},i=e.result();return i.forEach(function(e){var i={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(function(t){i[t]=e.stat(t)}),t[i.id]=i}),t},o=function(e){return new Map(Object.keys(e).map(function(t){return[t,e[t]]}))};if(arguments.length>=2){return t.apply(this,[function(e){n(o(s(e)))},r])}return new Promise(function(i,r){t.apply(e,[function(e){i(o(s(e)))},r])}).then(n,a)}},i.shimSenderReceiverGetStats=function(e){if(!("object"===(void 0===e?"undefined":r(e))&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,i=t.apply(this,[]);return i.forEach(function(t){return t._pc=e}),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then(function(t){return s.filterStats(t,e.track,!0)})}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach(function(t){return t._pc=e}),t}),s.wrapPeerConnectionEvent(e,"track",function(e){return e.receiver._pc=e.srcElement,e}),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then(function(t){return s.filterStats(t,e.track,!1)})}}if(!("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype))return;var a=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t=arguments[0],i=void 0,r=void 0,n=void 0;return this.getSenders().forEach(function(e){e.track===t&&(i?n=!0:i=e)}),this.getReceivers().forEach(function(e){return e.track===t&&(r?n=!0:r=e),e.track===t}),n||i&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return a.apply(this,arguments)}},i.shimAddTrackRemoveTrackWithNative=l,i.shimAddTrackRemoveTrack=function(e){if(!e.RTCPeerConnection)return;var t=s.detectBrowser(e);if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return l(e);var i=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=i.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map(function(t){return e._reverseStreams[t.id]})};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var i=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(function(e){var t=i.getSenders().find(function(t){return t.track===e});if(t)throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){var n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};var n=e.RTCPeerConnection.prototype.removeStream;function a(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(n.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:i})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,i){var r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find(function(e){return e===t}))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var a=this.getSenders().find(function(e){return e.track===t});if(a)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var s=this._streams[i.id];if(s)s.addTrack(t),Promise.resolve().then(function(){r.dispatchEvent(new Event("negotiationneeded"))});else{var o=new e.MediaStream([t]);this._streams[i.id]=o,this._reverseStreams[o.id]=i,this.addStream(o)}return this.getSenders().find(function(e){return e.track===t})},["createOffer","createAnswer"].forEach(function(t){var i=e.RTCPeerConnection.prototype[t],r=o({},t,function(){var e=this,t=arguments,r=arguments.length&&"function"==typeof arguments[0];return r?i.apply(this,[function(i){var r=a(e,i);t[0].apply(null,[r])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):i.apply(this,arguments).then(function(t){return a(e,t)})});e.RTCPeerConnection.prototype[t]=r[t]});var u=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=(e=this,t=arguments[0],i=t.sdp,Object.keys(e._reverseStreams||[]).forEach(function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(r.id,"g"),n.id)}),new RTCSessionDescription({type:t.type,sdp:i})),u.apply(this,arguments)):u.apply(this,arguments);var e,t,i};var c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=c.get.apply(this);return""===e.type?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");var i=e._pc===this;if(!i)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var r=void 0;Object.keys(this._streams).forEach(function(i){var n=t._streams[i].getTracks().find(function(t){return e.track===t});n&&(r=t._streams[i])}),r&&(1===r.getTracks().length?this.removeStream(this._reverseStreams[r.id]):r.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}},i.shimPeerConnection=function(e){var t=s.detectBrowser(e);!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection);if(!e.RTCPeerConnection)return;var i=0===e.RTCPeerConnection.prototype.addIceCandidate.length;t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var i=e.RTCPeerConnection.prototype[t],r=o({},t,function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)});e.RTCPeerConnection.prototype[t]=r[t]});var r=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return i||arguments[0]?t.version<78&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}},i.fixNegotiationNeeded=function(e){var t=s.detectBrowser(e);s.wrapPeerConnectionEvent(e,"negotiationneeded",function(e){var i=e.target;if(!(t.version<72||i.getConfiguration&&"plan-b"===i.getConfiguration().sdpSemantics)||"stable"===i.signalingState)return e})};var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils.js"));function o(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function l(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(function(t){return e._shimmedLocalStreams[t][0]})};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){if(!i)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var r=t.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(r)&&this._shimmedLocalStreams[i.id].push(r):this._shimmedLocalStreams[i.id]=[i,r],r};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(function(e){if(t.getSenders().find(function(t){return t.track===e}))throw new DOMException("Track already exists.","InvalidAccessError")});var r=this.getSenders();i.apply(this,arguments);var n=this.getSenders().filter(function(e){return-1===r.indexOf(e)});this._shimmedLocalStreams[e.id]=[e].concat(n)};var r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(function(i){var r=t._shimmedLocalStreams[i].indexOf(e);-1!==r&&t._shimmedLocalStreams[i].splice(r,1),1===t._shimmedLocalStreams[i].length&&delete t._shimmedLocalStreams[i]}),n.apply(this,arguments)}}},{"../utils.js":15,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=function(e,t){if(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices)return;if(!e.navigator.mediaDevices)return;if("function"!=typeof t)return void console.error("shimGetDisplayMedia: getSourceId argument is not a function");e.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then(function(t){var r=i.video&&i.video.width,n=i.video&&i.video.height,a=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:a||3}},r&&(i.video.mandatory.maxWidth=r),n&&(i.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(i)})}}},{}],5:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var 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};i.shimGetUserMedia=function(e){var t=e&&e.navigator;if(!t.mediaDevices)return;var i=n.detectBrowser(e),s=function(e){if("object"!==(void 0===e?"undefined":r(e))||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(i){if("require"!==i&&"advanced"!==i&&"mediaSource"!==i){var n="object"===r(e[i])?e[i]:{ideal:e[i]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var a=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];var s={};"number"==typeof n.ideal?(s[a("min",i)]=n.ideal,t.optional.push(s),(s={})[a("max",i)]=n.ideal,t.optional.push(s)):(s[a("",i)]=n.ideal,t.optional.push(s))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[a("",i)]=n.exact):["min","max"].forEach(function(e){void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[a(e,i)]=n[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},o=function(e,n){if(i.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===r(e.audio)){var o=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),o(e.audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=s(e.audio)}if(e&&"object"===r(e.video)){var l=e.video.facingMode;l=l&&("object"===(void 0===l?"undefined":r(l))?l:{ideal:l});var u=i.version<66;if(l&&("user"===l.exact||"environment"===l.exact||"user"===l.ideal||"environment"===l.ideal)&&(!t.mediaDevices.getSupportedConstraints||!t.mediaDevices.getSupportedConstraints().facingMode||u)){delete e.video.facingMode;var c=void 0;if("environment"===l.exact||"environment"===l.ideal?c=["back","rear"]:"user"!==l.exact&&"user"!==l.ideal||(c=["front"]),c)return t.mediaDevices.enumerateDevices().then(function(t){var i=(t=t.filter(function(e){return"videoinput"===e.kind})).find(function(e){return c.some(function(t){return e.label.toLowerCase().includes(t)})});return!i&&t.length&&c.includes("back")&&(i=t[t.length-1]),i&&(e.video.deviceId=l.exact?{exact:i.deviceId}:{ideal:i.deviceId}),e.video=s(e.video),a("chrome: "+JSON.stringify(e)),n(e)})}e.video=s(e.video)}return a("chrome: "+JSON.stringify(e)),n(e)},l=function(e){return i.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(t.getUserMedia=function(e,i,r){o(e,function(e){t.webkitGetUserMedia(e,i,function(e){r&&r(l(e))})})}.bind(t),t.mediaDevices.getUserMedia){var u=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return o(e,function(e){return u(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(l(e))})})}}};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils.js"));var a=n.log},{"../utils.js":15}],6:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var 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};i.shimRTCIceCandidate=function(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===(void 0===e?"undefined":r(e))&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var i=new t(e),n=s.default.parseCandidate(e.candidate),a=Object.assign(i,n);return a.toJSON=function(){return{candidate:a.candidate,sdpMid:a.sdpMid,sdpMLineIndex:a.sdpMLineIndex,usernameFragment:a.usernameFragment}},a}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,o.wrapPeerConnectionEvent(e,"icecandidate",function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t})},i.shimMaxMessageSize=function(e){if(!e.RTCPeerConnection)return;var t=o.detectBrowser(e);"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),r=e.sdpSemantics;"plan-b"===r&&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 n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var i=parseInt(t[1],10);return i!=i?-1:i}(arguments[0]),a=function(e){var i=65536;"firefox"===t.browser&&(i=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637);return i}(n),o=function(e,i){var r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);var n=s.default.matchPrefix(e.sdp,"a=max-message-size:");n.length>0?r=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==i&&(r=2147483637);return r}(arguments[0],n),l=void 0;l=0===a&&0===o?Number.POSITIVE_INFINITY:0===a||0===o?Math.max(a,o):Math.min(a,o);var u={};Object.defineProperty(u,"maxMessageSize",{get:function(){return l}}),this._sctp=u}return i.apply(this,arguments)}},i.shimSendThrowTypeError=function(e){if(!(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){var i=e.send;e.send=function(){var r=arguments[0],n=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return i.apply(e,arguments)}}var i=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=i.apply(this,arguments);return t(e,this),e},o.wrapPeerConnectionEvent(e,"datachannel",function(e){return t(e.channel,e.target),e})},i.shimConnectionState=function(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(function(e){var i=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var i=new Event("connectionstatechange",e);t.dispatchEvent(i)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}})},i.removeAllowExtmapMixed=function(e){if(!e.RTCPeerConnection)return;var t=o.detectBrowser(e);if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(e){return e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")&&(e.sdp=e.sdp.split("\n").filter(function(e){return"a=extmap-allow-mixed"!==e.trim()}).join("\n")),i.apply(this,arguments)}};var n,a=e("sdp"),s=(n=a)&&n.__esModule?n:{default:n},o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("./utils"))},{"./utils":15,sdp:17}],7:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=i.shimGetUserMedia=void 0;var r=e("./getusermedia");Object.defineProperty(i,"shimGetUserMedia",{enumerable:!0,get:function(){return r.shimGetUserMedia}});var n=e("./getdisplaymedia");Object.defineProperty(i,"shimGetDisplayMedia",{enumerable:!0,get:function(){return n.shimGetDisplayMedia}}),i.shimPeerConnection=function(e){var t=s.detectBrowser(e);if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){var i=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){i.set.call(this,e);var t=new Event("enabled");t.enabled=e,this.dispatchEvent(t)}})}!e.RTCRtpSender||"dtmf"in e.RTCRtpSender.prototype||Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}});e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);var r=(0,u.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 r(e)},e.RTCPeerConnection.prototype=r.prototype},i.shimReplaceTrack=function(e){!e.RTCRtpSender||"replaceTrack"in e.RTCRtpSender.prototype||(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)};var a,s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils")),o=e("./filtericeservers"),l=e("rtcpeerconnection-shim"),u=(a=l)&&a.__esModule?a:{default:a}},{"../utils":15,"./filtericeservers":8,"./getdisplaymedia":9,"./getusermedia":10,"rtcpeerconnection-shim":16}],8:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.filterIceServers=function(e,t){var i=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var t=e.urls||e.url;e.url&&!e.urls&&r.deprecated("RTCIceServer.url","RTCIceServer.urls");var n="string"==typeof t;return n&&(t=[t]),t=t.filter(function(e){if(0===e.indexOf("stun:"))return!1;var t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!i?(i=!0,!0):t&&!i}),delete e.url,e.urls=n?t[0]:t,!!t.length}})};var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils"))},{"../utils":15}],9:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=function(e){if(!("getDisplayMedia"in e.navigator))return;if(!e.navigator.mediaDevices)return;if(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices)return;e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)}},{}],10:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetUserMedia=function(e){var t=e&&e.navigator,i=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return i(e).catch(function(e){return Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}}(e))})}}},{}],11:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=i.shimGetUserMedia=void 0;var 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},n=e("./getusermedia");Object.defineProperty(i,"shimGetUserMedia",{enumerable:!0,get:function(){return n.shimGetUserMedia}});var a=e("./getdisplaymedia");Object.defineProperty(i,"shimGetDisplayMedia",{enumerable:!0,get:function(){return a.shimGetDisplayMedia}}),i.shimOnTrack=function(e){"object"===(void 0===e?"undefined":r(e))&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},i.shimPeerConnection=function(e){var t=s.detectBrowser(e);if("object"!==(void 0===e?"undefined":r(e))||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection);t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var i=e.RTCPeerConnection.prototype[t],r=function(e,t,i){t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i;return e}({},t,function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)});e.RTCPeerConnection.prototype[t]=r[t]});if(t.version<68){var i=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}var n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},a=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),i=e[0],r=e[1],s=e[2];return a.apply(this,[i||null]).then(function(e){if(t.version<53&&!r)try{e.forEach(function(e){e.type=n[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach(function(t,i){e.set(i,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(r,s)}},i.shimSenderGetStats=function(e){if("object"!==(void 0===e?"undefined":r(e))||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,i=t.apply(this,[]);return i.forEach(function(t){return t._pc=e}),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e});e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}},i.shimReceiverGetStats=function(e){if("object"!==(void 0===e?"undefined":r(e))||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,i=t.apply(this,[]);return i.forEach(function(t){return t._pc=e}),i});s.wrapPeerConnectionEvent(e,"track",function(e){return e.receiver._pc=e.srcElement,e}),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}},i.shimRemoveStream=function(e){if(!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype)return;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;s.deprecated("removeStream","removeTrack"),this.getSenders().forEach(function(i){i.track&&e.getTracks().includes(i.track)&&t.removeTrack(i)})}},i.shimRTCDataChannel=function(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)},i.shimAddTransceiver=function(e){if("object"!==(void 0===e?"undefined":r(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],i=e&&"sendEncodings"in e;i&&e.sendEncodings.forEach(function(e){if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});var r=t.apply(this,arguments);if(i){var n=r.sender,a=n.getParameters();"encodings"in a&&(1!==a.encodings.length||0!==Object.keys(a.encodings[0]).length)||(a.encodings=e.sendEncodings,n.sendEncodings=e.sendEncodings,this.setParametersPromises.push(n.setParameters(a).then(function(){delete n.sendEncodings}).catch(function(){delete n.sendEncodings})))}return r})},i.shimGetParameters=function(e){if("object"!==(void 0===e?"undefined":r(e))||!e.RTCRtpSender)return;var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})},i.shimCreateOffer=function(e){if("object"!==(void 0===e?"undefined":r(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=this,i=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return t.apply(e,i)}).finally(function(){e.setParametersPromises=[]}):t.apply(this,arguments)}},i.shimCreateAnswer=function(e){if("object"!==(void 0===e?"undefined":r(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=this,i=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return t.apply(e,i)}).finally(function(){e.setParametersPromises=[]}):t.apply(this,arguments)}};var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils"))},{"../utils":15,"./getdisplaymedia":12,"./getusermedia":13}],12:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.shimGetDisplayMedia=function(e,t){if(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices)return;if(!e.navigator.mediaDevices)return;e.navigator.mediaDevices.getDisplayMedia=function(i){if(!i||!i.video){var r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return!0===i.video?i.video={mediaSource:t}:i.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(i)}}},{}],13:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var 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};i.shimGetUserMedia=function(e){var t=n.detectBrowser(e),i=e&&e.navigator,a=e&&e.MediaStreamTrack;if(i.getUserMedia=function(e,t,r){n.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){var s=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])},o=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(e){return"object"===(void 0===e?"undefined":r(e))&&"object"===r(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 l=a.prototype.getSettings;a.prototype.getSettings=function(){var e=l.apply(this,arguments);return s(e,"mozAutoGainControl","autoGainControl"),s(e,"mozNoiseSuppression","noiseSuppression"),e}}if(a&&a.prototype.applyConstraints){var u=a.prototype.applyConstraints;a.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===(void 0===e?"undefined":r(e))&&(e=JSON.parse(JSON.stringify(e)),s(e,"autoGainControl","mozAutoGainControl"),s(e,"noiseSuppression","mozNoiseSuppression")),u.apply(this,[e])}}}};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils"))},{"../utils":15}],14:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var 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};i.shimLocalStreamsAPI=function(e){if("object"!==(void 0===e?"undefined":r(e))||!e.RTCPeerConnection)return;"getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams});if(!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(function(r){return t.call(i,r,e)}),e.getVideoTracks().forEach(function(r){return t.call(i,r,e)})},e.RTCPeerConnection.prototype.addTrack=function(e){for(var i=this,r=arguments.length,n=Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return n&&n.forEach(function(e){i._localStreams?i._localStreams.includes(e)||i._localStreams.push(e):i._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var i=this._localStreams.indexOf(e);if(-1!==i){this._localStreams.splice(i,1);var r=e.getTracks();this.getSenders().forEach(function(e){r.includes(e.track)&&t.removeTrack(e)})}})},i.shimRemoteStreamsAPI=function(e){if("object"!==(void 0===e?"undefined":r(e))||!e.RTCPeerConnection)return;"getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]});if(!("onaddstream"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach(function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var i=new Event("addstream");i.stream=e,t.dispatchEvent(i)}})})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var i=new Event("addstream");i.stream=t,e.dispatchEvent(i)}})}),t.apply(e,arguments)}}},i.shimCallbacksAPI=function(e){if("object"!==(void 0===e?"undefined":r(e))||!e.RTCPeerConnection)return;var t=e.RTCPeerConnection.prototype,i=t.createOffer,n=t.createAnswer,a=t.setLocalDescription,s=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=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};var l=function(e,t,i){var r=a.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r};t.setLocalDescription=l,l=function(e,t,i){var r=s.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},t.setRemoteDescription=l,l=function(e,t,i){var r=o.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},t.addIceCandidate=l},i.shimGetUserMedia=function(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var i=t.mediaDevices,r=i.getUserMedia.bind(i);t.mediaDevices.getUserMedia=function(e){return r(a(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,i,r){t.mediaDevices.getUserMedia(e).then(i,r)}.bind(t))},i.shimConstraints=a,i.shimRTCIceServerUrls=function(e){if(!e.RTCPeerConnection)return;var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,i){if(e&&e.iceServers){for(var r=[],a=0;a<e.iceServers.length;a++){var s=e.iceServers[a];!s.hasOwnProperty("urls")&&s.hasOwnProperty("url")?(n.deprecated("RTCIceServer.url","RTCIceServer.urls"),(s=JSON.parse(JSON.stringify(s))).urls=s.url,delete s.url,r.push(s)):r.push(e.iceServers[a])}e.iceServers=r}return new t(e,i)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})},i.shimTrackEventTransceiver=function(e){"object"===(void 0===e?"undefined":r(e))&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},i.shimCreateOfferLegacy=function(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=this.getTransceivers().find(function(e){return"audio"===e.receiver.track.kind});!1===e.offerToReceiveAudio&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveAudio||i||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var r=this.getTransceivers().find(function(e){return"video"===e.receiver.track.kind});!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}},i.shimAudioContext=function(e){if("object"!==(void 0===e?"undefined":r(e))||e.AudioContext)return;e.AudioContext=e.webkitAudioContext};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(e("../utils"));function a(e){return e&&void 0!==e.video?Object.assign({},e,{video:n.compactObject(e.video)}):e}},{"../utils":15}],15:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var 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};i.extractVersion=s,i.wrapPeerConnectionEvent=function(e,t,i){if(!e.RTCPeerConnection)return;var r=e.RTCPeerConnection.prototype,n=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return n.apply(this,arguments);var a=function(e){var t=i(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),n.apply(this,[e,a])};var a=r.removeEventListener;r.removeEventListener=function(e,i){if(e!==t||!this._eventMap||!this._eventMap[t])return a.apply(this,arguments);if(!this._eventMap[t].has(i))return a.apply(this,arguments);var r=this._eventMap[t].get(i);return this._eventMap[t].delete(i),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})},i.disableLog=function(e){if("boolean"!=typeof e)return new Error("Argument type: "+(void 0===e?"undefined":r(e))+". Please use a boolean.");return n=e,e?"adapter.js logging disabled":"adapter.js logging enabled"},i.disableWarnings=function(e){if("boolean"!=typeof e)return new Error("Argument type: "+(void 0===e?"undefined":r(e))+". Please use a boolean.");return a=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled")},i.log=function(){if("object"===("undefined"==typeof window?"undefined":r(window))){if(n)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}},i.deprecated=function(e,t){if(!a)return;console.warn(e+" is deprecated, please use "+t+" instead.")},i.detectBrowser=function(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var i=e.navigator;if(i.mozGetUserMedia)t.browser="firefox",t.version=s(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=s(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(i.mediaDevices&&i.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=s(i.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!i.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=s(i.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t},i.compactObject=function e(t){if(!o(t))return t;return Object.keys(t).reduce(function(i,r){var n=o(t[r]),a=n?e(t[r]):t[r],s=n&&!Object.keys(a).length;return void 0===a||s?i:Object.assign(i,function(e,t,i){t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i;return e}({},r,a))},{})},i.walkStats=l,i.filterStats=function(e,t,i){var r=i?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;var a=[];return e.forEach(function(e){"track"===e.type&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(function(t){e.forEach(function(i){i.type===r&&i.trackId===t.id&&l(e,i,n)})}),n};var n=!0,a=!0;function s(e,t,i){var r=e.match(t);return r&&r.length>=i&&parseInt(r[i],10)}function o(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e,t,i){t&&!i.has(t.id)&&(i.set(t.id,t),Object.keys(t).forEach(function(r){r.endsWith("Id")?l(e,e.get(t[r]),i):r.endsWith("Ids")&&t[r].forEach(function(t){l(e,e.get(t),i)})}))}},{}],16:[function(e,t,i){"use strict";var r=e("sdp");function n(e,t,i,n,a){var s=r.writeRtpDescription(e.kind,t);if(s+=r.writeIceParameters(e.iceGatherer.getLocalParameters()),s+=r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===i?"actpass":a||"active"),s+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?s+="a=sendrecv\r\n":e.rtpSender?s+="a=sendonly\r\n":e.rtpReceiver?s+="a=recvonly\r\n":s+="a=inactive\r\n",e.rtpSender){var o=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=o;var l="msid:"+(n?n.id:"-")+" "+o+"\r\n";s+="a="+l,s+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+l,e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+l,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:"+r.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+r.localCName+"\r\n"),s}function a(e,t){var i={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var i=0;i<t.length;i++)if(t[i].payloadType===e||t[i].preferredPayloadType===e)return t[i]},n=function(e,t,i,n){var a=r(e.parameters.apt,i),s=r(t.parameters.apt,n);return a&&s&&a.name.toLowerCase()===s.name.toLowerCase()};return e.codecs.forEach(function(r){for(var a=0;a<t.codecs.length;a++){var s=t.codecs[a];if(r.name.toLowerCase()===s.name.toLowerCase()&&r.clockRate===s.clockRate){if("rtx"===r.name.toLowerCase()&&r.parameters&&s.parameters.apt&&!n(r,s,e.codecs,t.codecs))continue;(s=JSON.parse(JSON.stringify(s))).numChannels=Math.min(r.numChannels,s.numChannels),i.codecs.push(s),s.rtcpFeedback=s.rtcpFeedback.filter(function(e){for(var t=0;t<r.rtcpFeedback.length;t++)if(r.rtcpFeedback[t].type===e.type&&r.rtcpFeedback[t].parameter===e.parameter)return!0;return!1});break}}}),e.headerExtensions.forEach(function(e){for(var r=0;r<t.headerExtensions.length;r++){var n=t.headerExtensions[r];if(e.uri===n.uri){i.headerExtensions.push(n);break}}}),i}function s(e,t,i){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(i)}function o(e,t){var i=e.getRemoteCandidates().find(function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type});return i||e.addRemoteCandidate(t),!i}function l(e,t){var i=new Error(t);return i.name=e,i.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],i}t.exports=function(e,t){function i(t,i){i.addTrack(t),i.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function u(t,i,r,n){var a=new Event("track");a.track=i,a.receiver=r,a.transceiver={receiver:r},a.streams=n,e.setTimeout(function(){t._dispatchEvent("track",a)})}var c=function(i){var n=this,a=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){n[e]=a[e].bind(a)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",i=JSON.parse(JSON.stringify(i||{})),this.usingBundle="max-bundle"===i.bundlePolicy,"negotiate"===i.rtcpMuxPolicy)throw l("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(i.rtcpMuxPolicy||(i.rtcpMuxPolicy="require"),i.iceTransportPolicy){case"all":case"relay":break;default:i.iceTransportPolicy="all"}switch(i.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:i.bundlePolicy="balanced"}if(i.iceServers=function(e,t){var i=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var n="string"==typeof r;return n&&(r=[r]),r=r.filter(function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||i?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(i=!0,!0)}),delete e.url,e.urls=n?r[0]:r,!!r.length}})}(i.iceServers||[],t),this._iceGatherers=[],i.iceCandidatePoolSize)for(var s=i.iceCandidatePoolSize;s>0;s--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:i.iceServers,gatherPolicy:i.iceTransportPolicy}));else i.iceCandidatePoolSize=0;this._config=i,this.transceivers=[],this._sdpSessionId=r.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(c.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(c.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),c.prototype.onicecandidate=null,c.prototype.onaddstream=null,c.prototype.ontrack=null,c.prototype.onremovestream=null,c.prototype.onsignalingstatechange=null,c.prototype.oniceconnectionstatechange=null,c.prototype.onconnectionstatechange=null,c.prototype.onicegatheringstatechange=null,c.prototype.onnegotiationneeded=null,c.prototype.ondatachannel=null,c.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},c.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},c.prototype.getConfiguration=function(){return this._config},c.prototype.getLocalStreams=function(){return this.localStreams},c.prototype.getRemoteStreams=function(){return this.remoteStreams},c.prototype._createTransceiver=function(e,t){var i=this.transceivers.length>0,r={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&i)r.iceTransport=this.transceivers[0].iceTransport,r.dtlsTransport=this.transceivers[0].dtlsTransport;else{var n=this._createIceAndDtlsTransports();r.iceTransport=n.iceTransport,r.dtlsTransport=n.dtlsTransport}return t||this.transceivers.push(r),r},c.prototype.addTrack=function(t,i){if(this._isClosed)throw l("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find(function(e){return e.track===t}))throw l("InvalidAccessError","Track already exists.");for(var n=0;n<this.transceivers.length;n++)this.transceivers[n].track||this.transceivers[n].kind!==t.kind||(r=this.transceivers[n]);return r||(r=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(i)&&this.localStreams.push(i),r.track=t,r.stream=i,r.rtpSender=new e.RTCRtpSender(t,r.dtlsTransport),r.rtpSender},c.prototype.addStream=function(e){var i=this;if(t>=15025)e.getTracks().forEach(function(t){i.addTrack(t,e)});else{var r=e.clone();e.getTracks().forEach(function(e,t){var i=r.getTracks()[t];e.addEventListener("enabled",function(e){i.enabled=e.enabled})}),r.getTracks().forEach(function(e){i.addTrack(e,r)})}},c.prototype.removeTrack=function(t){if(this._isClosed)throw l("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var i=this.transceivers.find(function(e){return e.rtpSender===t});if(!i)throw l("InvalidAccessError","Sender was not created by this connection.");var r=i.stream;i.rtpSender.stop(),i.rtpSender=null,i.track=null,i.stream=null,-1===this.transceivers.map(function(e){return e.stream}).indexOf(r)&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},c.prototype.removeStream=function(e){var t=this;e.getTracks().forEach(function(e){var i=t.getSenders().find(function(t){return t.track===e});i&&t.removeTrack(i)})},c.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},c.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},c.prototype._createIceGatherer=function(t,i){var r=this;if(i&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var n=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(n,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var i=!e.candidate||0===Object.keys(e.candidate).length;n.state=i?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},n.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),n},c.prototype._gather=function(t,i){var n=this,a=this.transceivers[i].iceGatherer;if(!a.onlocalcandidate){var s=this.transceivers[i].bufferedCandidateEvents;this.transceivers[i].bufferedCandidateEvents=null,a.removeEventListener("localcandidate",this.transceivers[i].bufferCandidates),a.onlocalcandidate=function(e){if(!(n.usingBundle&&i>0)){var s=new Event("icecandidate");s.candidate={sdpMid:t,sdpMLineIndex:i};var o=e.candidate,l=!o||0===Object.keys(o).length;if(l)"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 u=r.writeCandidate(o);s.candidate=Object.assign(s.candidate,r.parseCandidate(u)),s.candidate.candidate=u,s.candidate.toJSON=function(){return{candidate:s.candidate.candidate,sdpMid:s.candidate.sdpMid,sdpMLineIndex:s.candidate.sdpMLineIndex,usernameFragment:s.candidate.usernameFragment}}}var c=r.getMediaSections(n._localDescription.sdp);c[s.candidate.sdpMLineIndex]+=l?"a=end-of-candidates\r\n":"a="+s.candidate.candidate+"\r\n",n._localDescription.sdp=r.getDescription(n._localDescription.sdp)+c.join("");var d=n.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});"gathering"!==n.iceGatheringState&&(n.iceGatheringState="gathering",n._emitGatheringStateChange()),l||n._dispatchEvent("icecandidate",s),d&&(n._dispatchEvent("icecandidate",new Event("icecandidate")),n.iceGatheringState="complete",n._emitGatheringStateChange())}},e.setTimeout(function(){s.forEach(function(e){a.onlocalcandidate(e)})},0)}},c.prototype._createIceAndDtlsTransports=function(){var t=this,i=new e.RTCIceTransport(null);i.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var r=new e.RTCDtlsTransport(i);return r.ondtlsstatechange=function(){t._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:i,dtlsTransport:r}},c.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var i=this.transceivers[e].iceTransport;i&&(delete i.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlsstatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},c.prototype._transceive=function(e,i,n){var s=a(e.localCapabilities,e.remoteCapabilities);i&&e.rtpSender&&(s.encodings=e.sendEncodingParameters,s.rtcp={cname:r.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(s.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(s)),n&&e.rtpReceiver&&s.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach(function(e){delete e.rtx}),e.recvEncodingParameters.length?s.encodings=e.recvEncodingParameters:s.encodings=[{}],s.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(s.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(s.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(s))},c.prototype.setLocalDescription=function(e){var t,i,n=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(l("TypeError",'Unsupported type "'+e.type+'"'));if(!s("setLocalDescription",e.type,n.signalingState)||n._isClosed)return Promise.reject(l("InvalidStateError","Can not set local "+e.type+" in state "+n.signalingState));if("offer"===e.type)t=r.splitSections(e.sdp),i=t.shift(),t.forEach(function(e,t){var i=r.parseRtpParameters(e);n.transceivers[t].localCapabilities=i}),n.transceivers.forEach(function(e,t){n._gather(e.mid,t)});else if("answer"===e.type){t=r.splitSections(n._remoteDescription.sdp),i=t.shift();var o=r.matchPrefix(i,"a=ice-lite").length>0;t.forEach(function(e,t){var s=n.transceivers[t],l=s.iceGatherer,u=s.iceTransport,c=s.dtlsTransport,d=s.localCapabilities,h=s.remoteCapabilities;if(!(r.isRejected(e)&&0===r.matchPrefix(e,"a=bundle-only").length)&&!s.rejected){var f=r.getIceParameters(e,i),p=r.getDtlsParameters(e,i);o&&(p.role="server"),n.usingBundle&&0!==t||(n._gather(s.mid,t),"new"===u.state&&u.start(l,f,o?"controlling":"controlled"),"new"===c.state&&c.start(p));var m=a(d,h);n._transceive(s,m.codecs.length>0,!1)}})}return n._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?n._updateSignalingState("have-local-offer"):n._updateSignalingState("stable"),Promise.resolve()},c.prototype.setRemoteDescription=function(n){var c=this;if(-1===["offer","answer"].indexOf(n.type))return Promise.reject(l("TypeError",'Unsupported type "'+n.type+'"'));if(!s("setRemoteDescription",n.type,c.signalingState)||c._isClosed)return Promise.reject(l("InvalidStateError","Can not set remote "+n.type+" in state "+c.signalingState));var d={};c.remoteStreams.forEach(function(e){d[e.id]=e});var h=[],f=r.splitSections(n.sdp),p=f.shift(),m=r.matchPrefix(p,"a=ice-lite").length>0,g=r.matchPrefix(p,"a=group:BUNDLE ").length>0;c.usingBundle=g;var v=r.matchPrefix(p,"a=ice-options:")[0];return c.canTrickleIceCandidates=!!v&&v.substr(14).split(" ").indexOf("trickle")>=0,f.forEach(function(s,l){var u=r.splitLines(s),f=r.getKind(s),v=r.isRejected(s)&&0===r.matchPrefix(s,"a=bundle-only").length,y=u[0].substr(2).split(" ")[2],_=r.getDirection(s,p),b=r.parseMsid(s),T=r.getMid(s)||r.generateIdentifier();if(v||"application"===f&&("DTLS/SCTP"===y||"UDP/DTLS/SCTP"===y))c.transceivers[l]={mid:T,kind:f,protocol:y,rejected:!0};else{var S,E,k,w,C,L,A,R,P;!v&&c.transceivers[l]&&c.transceivers[l].rejected&&(c.transceivers[l]=c._createTransceiver(f,!0));var D,I,x=r.parseRtpParameters(s);v||(D=r.getIceParameters(s,p),(I=r.getDtlsParameters(s,p)).role="client"),A=r.parseRtpEncodingParameters(s);var O=r.parseRtcpParameters(s),M=r.matchPrefix(s,"a=end-of-candidates",p).length>0,U=r.matchPrefix(s,"a=candidate:").map(function(e){return r.parseCandidate(e)}).filter(function(e){return 1===e.component});if(("offer"===n.type||"answer"===n.type)&&!v&&g&&l>0&&c.transceivers[l]&&(c._disposeIceAndDtlsTransports(l),c.transceivers[l].iceGatherer=c.transceivers[0].iceGatherer,c.transceivers[l].iceTransport=c.transceivers[0].iceTransport,c.transceivers[l].dtlsTransport=c.transceivers[0].dtlsTransport,c.transceivers[l].rtpSender&&c.transceivers[l].rtpSender.setTransport(c.transceivers[0].dtlsTransport),c.transceivers[l].rtpReceiver&&c.transceivers[l].rtpReceiver.setTransport(c.transceivers[0].dtlsTransport)),"offer"!==n.type||v){if("answer"===n.type&&!v){E=(S=c.transceivers[l]).iceGatherer,k=S.iceTransport,w=S.dtlsTransport,C=S.rtpReceiver,L=S.sendEncodingParameters,R=S.localCapabilities,c.transceivers[l].recvEncodingParameters=A,c.transceivers[l].remoteCapabilities=x,c.transceivers[l].rtcpParameters=O,U.length&&"new"===k.state&&(!m&&!M||g&&0!==l?U.forEach(function(e){o(S.iceTransport,e)}):k.setRemoteCandidates(U)),g&&0!==l||("new"===k.state&&k.start(E,D,"controlling"),"new"===w.state&&w.start(I)),!a(S.localCapabilities,S.remoteCapabilities).codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&S.sendEncodingParameters[0].rtx&&delete S.sendEncodingParameters[0].rtx,c._transceive(S,"sendrecv"===_||"recvonly"===_,"sendrecv"===_||"sendonly"===_),!C||"sendrecv"!==_&&"sendonly"!==_?delete S.rtpReceiver:(P=C.track,b?(d[b.stream]||(d[b.stream]=new e.MediaStream),i(P,d[b.stream]),h.push([P,C,d[b.stream]])):(d.default||(d.default=new e.MediaStream),i(P,d.default),h.push([P,C,d.default])))}}else{(S=c.transceivers[l]||c._createTransceiver(f)).mid=T,S.iceGatherer||(S.iceGatherer=c._createIceGatherer(l,g)),U.length&&"new"===S.iceTransport.state&&(!M||g&&0!==l?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})),L=S.sendEncodingParameters||[{ssrc:1001*(2*l+2)}];var B,N=!1;if("sendrecv"===_||"sendonly"===_){if(N=!S.rtpReceiver,C=S.rtpReceiver||new e.RTCRtpReceiver(S.dtlsTransport,f),N)P=C.track,b&&"-"===b.stream||(b?(d[b.stream]||(d[b.stream]=new e.MediaStream,Object.defineProperty(d[b.stream],"id",{get:function(){return b.stream}})),Object.defineProperty(P,"id",{get:function(){return b.track}}),B=d[b.stream]):(d.default||(d.default=new e.MediaStream),B=d.default)),B&&(i(P,B),S.associatedRemoteMediaStreams.push(B)),h.push([P,C,B])}else S.rtpReceiver&&S.rtpReceiver.track&&(S.associatedRemoteMediaStreams.forEach(function(t){var i,r,n=t.getTracks().find(function(e){return e.id===S.rtpReceiver.track.id});n&&(i=n,(r=t).removeTrack(i),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:i})))}),S.associatedRemoteMediaStreams=[]);S.localCapabilities=R,S.remoteCapabilities=x,S.rtpReceiver=C,S.rtcpParameters=O,S.sendEncodingParameters=L,S.recvEncodingParameters=A,c._transceive(c.transceivers[l],!1,N)}}}),void 0===c._dtlsRole&&(c._dtlsRole="offer"===n.type?"active":"passive"),c._remoteDescription={type:n.type,sdp:n.sdp},"offer"===n.type?c._updateSignalingState("have-remote-offer"):c._updateSignalingState("stable"),Object.keys(d).forEach(function(t){var i=d[t];if(i.getTracks().length){if(-1===c.remoteStreams.indexOf(i)){c.remoteStreams.push(i);var r=new Event("addstream");r.stream=i,e.setTimeout(function(){c._dispatchEvent("addstream",r)})}h.forEach(function(e){var t=e[0],r=e[1];i.id===e[2].id&&u(c,t,r,[i])})}}),h.forEach(function(e){e[2]||u(c,e[0],e[1],[])}),e.setTimeout(function(){c&&c.transceivers&&c.transceivers.forEach(function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},c.prototype.close=function(){this.transceivers.forEach(function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},c.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},c.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}},0))},c.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++}),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var i=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",i)}},c.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)}),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var i=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",i)}},c.prototype.createOffer=function(){var i=this;if(i._isClosed)return Promise.reject(l("InvalidStateError","Can not call createOffer after close"));var a=i.transceivers.filter(function(e){return"audio"===e.kind}).length,s=i.transceivers.filter(function(e){return"video"===e.kind}).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(a=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(s=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(i.transceivers.forEach(function(e){"audio"===e.kind?--a<0&&(e.wantReceive=!1):"video"===e.kind&&--s<0&&(e.wantReceive=!1)});a>0||s>0;)a>0&&(i._createTransceiver("audio"),a--),s>0&&(i._createTransceiver("video"),s--);var u=r.writeSessionBoilerplate(i._sdpSessionId,i._sdpSessionVersion++);i.transceivers.forEach(function(n,a){var s=n.track,o=n.kind,l=n.mid||r.generateIdentifier();n.mid=l,n.iceGatherer||(n.iceGatherer=i._createIceGatherer(a,i.usingBundle));var u=e.RTCRtpSender.getCapabilities(o);t<15019&&(u.codecs=u.codecs.filter(function(e){return"rtx"!==e.name})),u.codecs.forEach(function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),n.remoteCapabilities&&n.remoteCapabilities.codecs&&n.remoteCapabilities.codecs.forEach(function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)})}),u.headerExtensions.forEach(function(e){(n.remoteCapabilities&&n.remoteCapabilities.headerExtensions||[]).forEach(function(t){e.uri===t.uri&&(e.id=t.id)})});var c=n.sendEncodingParameters||[{ssrc:1001*(2*a+1)}];s&&t>=15019&&"video"===o&&!c[0].rtx&&(c[0].rtx={ssrc:c[0].ssrc+1}),n.wantReceive&&(n.rtpReceiver=new e.RTCRtpReceiver(n.dtlsTransport,o)),n.localCapabilities=u,n.sendEncodingParameters=c}),"max-compat"!==i._config.bundlePolicy&&(u+="a=group:BUNDLE "+i.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),u+="a=ice-options:trickle\r\n",i.transceivers.forEach(function(e,t){u+=n(e,e.localCapabilities,"offer",e.stream,i._dtlsRole),u+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===i.iceGatheringState||0!==t&&i.usingBundle||(e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1,u+="a="+r.writeCandidate(e)+"\r\n"}),"completed"===e.iceGatherer.state&&(u+="a=end-of-candidates\r\n"))});var c=new e.RTCSessionDescription({type:"offer",sdp:u});return Promise.resolve(c)},c.prototype.createAnswer=function(){var i=this;if(i._isClosed)return Promise.reject(l("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==i.signalingState&&"have-local-pranswer"!==i.signalingState)return Promise.reject(l("InvalidStateError","Can not call createAnswer in signalingState "+i.signalingState));var s=r.writeSessionBoilerplate(i._sdpSessionId,i._sdpSessionVersion++);i.usingBundle&&(s+="a=group:BUNDLE "+i.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),s+="a=ice-options:trickle\r\n";var o=r.getMediaSections(i._remoteDescription.sdp).length;i.transceivers.forEach(function(e,r){if(!(r+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 l;if(e.stream)"audio"===e.kind?l=e.stream.getAudioTracks()[0]:"video"===e.kind&&(l=e.stream.getVideoTracks()[0]),l&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var u=a(e.localCapabilities,e.remoteCapabilities);!u.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,s+=n(e,u,"answer",e.stream,i._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(s+="a=rtcp-rsize\r\n")}});var u=new e.RTCSessionDescription({type:"answer",sdp:s});return Promise.resolve(u)},c.prototype.addIceCandidate=function(e){var t,i=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(n,a){if(!i._remoteDescription)return a(l("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var s=e.sdpMLineIndex;if(e.sdpMid)for(var u=0;u<i.transceivers.length;u++)if(i.transceivers[u].mid===e.sdpMid){s=u;break}var c=i.transceivers[s];if(!c)return a(l("OperationError","Can not add ICE candidate"));if(c.rejected)return n();var d=Object.keys(e.candidate).length>0?r.parseCandidate(e.candidate):{};if("tcp"===d.protocol&&(0===d.port||9===d.port))return n();if(d.component&&1!==d.component)return n();if((0===s||s>0&&c.iceTransport!==i.transceivers[0].iceTransport)&&!o(c.iceTransport,d))return a(l("OperationError","Can not add ICE candidate"));var h=e.candidate.trim();0===h.indexOf("a=")&&(h=h.substr(2)),(t=r.getMediaSections(i._remoteDescription.sdp))[s]+="a="+(d.type?h:"end-of-candidates")+"\r\n",i._remoteDescription.sdp=r.getDescription(i._remoteDescription.sdp)+t.join("")}else for(var f=0;f<i.transceivers.length&&(i.transceivers[f].rejected||(i.transceivers[f].iceTransport.addRemoteCandidate({}),(t=r.getMediaSections(i._remoteDescription.sdp))[f]+="a=end-of-candidates\r\n",i._remoteDescription.sdp=r.getDescription(i._remoteDescription.sdp)+t.join(""),!i.usingBundle));f++);n()})},c.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var i=null;if(this.transceivers.forEach(function(e){e.rtpSender&&e.rtpSender.track===t?i=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(i=e.rtpReceiver)}),!i)throw l("InvalidAccessError","Invalid selector.");return i.getStats()}var r=[];return this.transceivers.forEach(function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(t){e[t]&&r.push(e[t].getStats())})}),Promise.all(r).then(function(e){var t=new Map;return e.forEach(function(e){e.forEach(function(e){t.set(e.id,e)})}),t})};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(t){var i=e[t];if(i&&i.prototype&&i.prototype.getStats){var r=i.prototype.getStats;i.prototype.getStats=function(){return r.apply(this).then(function(e){var t=new Map;return Object.keys(e).forEach(function(i){var r;e[i].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(r=e[i]).type]||r.type,t.set(i,e[i])}),t})}}});var d=["createOffer","createAnswer"];return d.forEach(function(e){var t=c.prototype[e];c.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then(function(t){"function"==typeof e[0]&&e[0].apply(null,[t])},function(t){"function"==typeof e[1]&&e[1].apply(null,[t])}):t.apply(this,arguments)}}),(d=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(e){var t=c.prototype[e];c.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)},function(t){"function"==typeof e[2]&&e[2].apply(null,[t])}):t.apply(this,arguments)}}),["getStats"].forEach(function(e){var t=c.prototype[e];c.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)}):t.apply(this,arguments)}}),c}},{sdp:17}],17:[function(e,t,i){"use strict";var r={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};r.localCName=r.generateIdentifier(),r.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})},r.splitSections=function(e){return e.split("\nm=").map(function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"})},r.getDescription=function(e){var t=r.splitSections(e);return t&&t[0]},r.getMediaSections=function(e){var t=r.splitSections(e);return t.shift(),t},r.matchPrefix=function(e,t){return r.splitLines(e).filter(function(e){return 0===e.indexOf(t)})},r.parseCandidate=function(e){for(var t,i={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":i.relatedAddress=t[r+1];break;case"rport":i.relatedPort=parseInt(t[r+1],10);break;case"tcptype":i.tcpType=t[r+1];break;case"ufrag":i.ufrag=t[r+1],i.usernameFragment=t[r+1];break;default:i[t[r]]=t[r+1]}return i},r.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var i=e.type;return t.push("typ"),t.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},r.parseIceOptions=function(e){return e.substr(14).split(" ")},r.parseRtpMap=function(e){var t=e.substr(9).split(" "),i={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),i.name=t[0],i.clockRate=parseInt(t[1],10),i.channels=3===t.length?parseInt(t[2],10):1,i.numChannels=i.channels,i},r.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var i=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==i?"/"+i:"")+"\r\n"},r.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]}},r.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},r.parseFmtp=function(e){for(var t,i={},r=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<r.length;n++)i[(t=r[n].trim().split("="))[0].trim()]=t[1];return i},r.writeFmtp=function(e){var t="",i=e.payloadType;if(void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach(function(t){e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)}),t+="a=fmtp:"+i+" "+r.join(";")+"\r\n"}return t},r.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},r.writeRtcpFb=function(e){var t="",i=e.payloadType;return void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+i+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},r.parseSsrcMedia=function(e){var t=e.indexOf(" "),i={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(i.attribute=e.substr(t+1,r-t-1),i.value=e.substr(r+1)):i.attribute=e.substr(t+1),i},r.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(function(e){return parseInt(e,10)})}},r.getMid=function(e){var t=r.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},r.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},r.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:r.matchPrefix(e+t,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(e,t){var i="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){i+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),i},r.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)}},r.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?r.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},r.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}},r.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},r.getCryptoParameters=function(e,t){return r.matchPrefix(e+t,"a=crypto:").map(r.parseCryptoLine)},r.getIceParameters=function(e,t){var i=r.matchPrefix(e+t,"a=ice-ufrag:")[0],n=r.matchPrefix(e+t,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substr(12),password:n.substr(10)}:null},r.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},r.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=r.splitLines(e)[0].split(" "),n=3;n<i.length;n++){var a=i[n],s=r.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(s){var o=r.parseRtpMap(s),l=r.matchPrefix(e,"a=fmtp:"+a+" ");switch(o.parameters=l.length?r.parseFmtp(l[0]):{},o.rtcpFeedback=r.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(r.parseRtcpFb),t.codecs.push(o),o.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(o.name.toUpperCase())}}}return r.matchPrefix(e,"a=extmap:").forEach(function(e){t.headerExtensions.push(r.parseExtmap(e))}),t},r.writeRtpDescription=function(e,t){var i="";i+="m="+e+" ",i+=t.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=t.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(function(e){i+=r.writeRtpMap(e),i+=r.writeFmtp(e),i+=r.writeRtcpFb(e)});var n=0;return t.codecs.forEach(function(e){e.maxptime>n&&(n=e.maxptime)}),n>0&&(i+="a=maxptime:"+n+"\r\n"),i+="a=rtcp-mux\r\n",t.headerExtensions&&t.headerExtensions.forEach(function(e){i+=r.writeExtmap(e)}),i},r.parseRtpEncodingParameters=function(e){var t,i=[],n=r.parseRtpParameters(e),a=-1!==n.fecMechanisms.indexOf("RED"),s=-1!==n.fecMechanisms.indexOf("ULPFEC"),o=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),l=o.length>0&&o[0].ssrc,u=r.matchPrefix(e,"a=ssrc-group:FID").map(function(e){return e.substr(17).split(" ").map(function(e){return parseInt(e,10)})});u.length>0&&u[0].length>1&&u[0][0]===l&&(t=u[0][1]),n.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var r={ssrc:l,codecPayloadType:parseInt(e.parameters.apt,10)};l&&t&&(r.rtx={ssrc:t}),i.push(r),a&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:l,mechanism:s?"red+ulpfec":"red"},i.push(r))}}),0===i.length&&l&&i.push({ssrc:l});var c=r.matchPrefix(e,"b=");return c.length&&(c=0===c[0].indexOf("b=TIAS:")?parseInt(c[0].substr(7),10):0===c[0].indexOf("b=AS:")?1e3*parseInt(c[0].substr(5),10)*.95-16e3:void 0,i.forEach(function(e){e.maxBitrate=c})),i},r.parseRtcpParameters=function(e){var t={},i=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];i&&(t.cname=i.value,t.ssrc=i.ssrc);var n=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var a=r.matchPrefix(e,"a=rtcp-mux");return t.mux=a.length>0,t},r.parseMsid=function(e){var t,i=r.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(t=i[0].substr(7).split(" "))[0],track:t[1]};var n=r.matchPrefix(e,"a=ssrc:").map(function(e){return r.parseSsrcMedia(e)}).filter(function(e){return"msid"===e.attribute});return n.length>0?{stream:(t=n[0].value.split(" "))[0],track:t[1]}:void 0},r.parseSctpDescription=function(e){var t,i=r.parseMLine(e),n=r.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var a=r.matchPrefix(e,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substr(12),10),protocol:i.fmt,maxMessageSize:t};if(r.matchPrefix(e,"a=sctpmap:").length>0){var s=r.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:t}}},r.writeSctpDescription=function(e,t){var i=[];return i="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&i.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),i.join("")},r.generateSessionId=function(){return Math.random().toString().substr(2,21)},r.writeSessionBoilerplate=function(e,t,i){var n,a=void 0!==t?t:2;return n=e||r.generateSessionId(),"v=0\r\no="+(i||"thisisadapterortc")+" "+n+" "+a+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.writeMediaSection=function(e,t,i,n){var a=r.writeRtpDescription(e.kind,t);if(a+=r.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=r.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===i?"actpass":"active"),a+="a=mid:"+e.mid+"\r\n",e.direction?a+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var s="msid:"+n.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:"+r.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+r.localCName+"\r\n"),a},r.getDirection=function(e,t){for(var i=r.splitLines(e),n=0;n<i.length;n++)switch(i[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[n].substr(2)}return t?r.getDirection(t):"sendrecv"},r.getKind=function(e){return r.splitLines(e)[0].split(" ")[0].substr(2)},r.isRejected=function(e){return"0"===e.split(" ",2)[1]},r.parseMLine=function(e){var t=r.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},r.parseOLine=function(e){var t=r.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]}},r.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=r.splitLines(e),i=0;i<t.length;i++)if(t[i].length<2||"="!==t[i].charAt(1))return!1;return!0},"object"==typeof t&&(t.exports=r)},{}]},{},[1])(1)}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).videojsFlvjs=e()}}(function(){return function e(t,i,r){function n(s,o){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=i[s]={exports:{}};t[s][0].call(c.exports,function(e){var i=t[s][1][e];return n(i||e)},c,c.exports,e,t,i,r)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t,r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),n="undefined"!=typeof window?window.videojs:void 0!==e?e.videojs:null,a=(t=n)&&t.__esModule?t:{default:t};var s=a.default.getTech("Html5"),o=a.default.mergeOptions||a.default.util.mergeOptions,l={dataInterval:3e3},u=function(e){function t(e,i){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=o(l,e),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,i))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s),r(t,[{key:"setSrc",value:function(e){var t=this,i=!!this.options_.debug;this.options_.autoplay;this.debug=i;var r=this.options_.dataInterval;i&&console.log("rtc debug on"),this.src=e,this.stream=new MediaStream;var n=new RTCPeerConnection;this.pc=n,n.ontrack=function(e){t.stream.addTrack(e.track),t.el_.srcObject!=t.stream&&(t.el_.srcObject=t.stream),i&&console.log(e.streams.length,"track",e.track.kind,"is delivered")},n.oniceconnectionstatechange=function(e){"disconnected"==n.iceConnectionState&&t.sendChannelTicker&&(t.eventBusEl_&&t.trigger({type:"error",name:"ice disconnected"}),clearInterval(t.sendChannelTicker),t.sendChannelTicker=0),i&&console.log("ice connection state change: "+n.iceConnectionState)};var a=n.createDataChannel("keepalive");this.sendChannel=a,a.onclose=function(){t.sendChannelTicker&&(t.eventBusEl_&&t.trigger({type:"error",name:"send channel closed"}),clearInterval(t.sendChannelTicker),t.sendChannelTicker=0),i&&console.log("sendChannel has closed")},a.onopen=function(){i&&console.log("sendChannel has opened"),a.send("ping");var e=setInterval(function(){i&&console.log("sendChannel ping..."),a.send("ping")},r);t.sendChannelTicker=e},a.onmessage=function(e){i&&console.log("sendChannel message",e.data)},n.createOffer({offerToReceiveVideo:!0,offerToReceiveAudio:!0}).then(function(r){n.setLocalDescription(r).then(function(){var r=new XMLHttpRequest;r.open("POST",e.replace("webrtc","http"),!0),r.onreadystatechange=function(){if(4==r.readyState)if(r.status>=200&&r.status<300||304===r.status)try{n.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:atob(r.responseText)})).catch(function(e){t.eventBusEl_&&t.trigger({type:"error",name:"set rtc remote sdp failed"}),i&&console.log("set rtc remote sdp error",e)})}catch(e){t.eventBusEl_&&t.trigger({type:"error",name:"set rtc remote sdp failed"}),i&&console.log("set rtc remote sdp error",e)}else t.eventBusEl_&&t.trigger({type:"error",name:"post rtc status "+r.status}),i&&console.log("post rtc status",r.status,r.statusText)},r.send(btoa(n.localDescription.sdp))}).catch(function(e){i&&console.log("pc setLocalDescription error",e)})}).catch(function(e){i&&console.log("pc createOffer error",e)})}},{key:"dispose",value:function(){this.debug&&console.log("rtc dispose"),this.sendChannelTicker&&(clearInterval(this.sendChannelTicker),this.sendChannelTicker=0),this.sendChannel&&(this.sendChannel.close(),this.sendChannel=null),this.pc&&(this.pc.close(),this.pc=null),this.el_.srcObject&&(this.el_.srcObject=null),function e(t,i,r){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,i);if(void 0===n){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,i,r)}if("value"in n)return n.value;var s=n.get;return void 0!==s?s.call(r):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}();u.isSupported=function(){return!!window.RTCPeerConnection},u.formats={"video/webrtc":"RTC"},u.canPlayType=function(e){return u.isSupported()?"maybe":""},u.canPlaySource=function(e,t){return u.canPlayType(e.type)},u.VERSION="0.2.0",a.default.registerTech("Webrtc",u),i.default=u}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}),function(){"use strict";var e=null;e=void 0===window.videojs&&"function"==typeof require?require("video.js"):window.videojs,function(e,t){var i,r={},n={},a={};function s(e,t,i,r){return n={label:i,sources:t},"function"==typeof r?r(e,t,i):e.src(t.map(function(e){return{src:e.src,type:e.type,res:e.res}}))}var o=t.getComponent("MenuItem"),l=t.extend(o,{constructor:function(e,t,i,r){this.onClickListener=i,this.label=r,o.call(this,e,t),this.src=t.src,this.on("click",this.onClick),this.on("touchstart",this.onClick),t.initialySelected&&(this.showAsLabel(),this.selected(!0),this.addClass("vjs-selected"))},showAsLabel:function(){this.label&&(this.label.innerHTML=this.options_.label)},onClick:function(e){this.onClickListener(this);var t=this.player_.currentTime(),i=this.player_.paused();this.showAsLabel(),this.addClass("vjs-selected"),i||this.player_.bigPlayButton.hide(),"function"!=typeof e&&"function"==typeof this.options_.customSourcePicker&&(e=this.options_.customSourcePicker);var r="loadeddata";"Youtube"!==this.player_.techName_&&"none"===this.player_.preload()&&"Flash"!==this.player_.techName_&&(r="timeupdate"),s(this.player_,this.src,this.options_.label,e),this.player_.one(r,function(){this.player_.currentTime(t),this.player_.handleTechSeeked_(),this.player_.trigger("resolutionchange")})}}),u=t.getComponent("MenuButton"),c=t.extend(u,{constructor:function(e,i,r,n){if(this.sources=i.sources,this.label=n,this.label.innerHTML=i.initialySelectedLabel,u.call(this,e,i,r),this.controlText("Quality"),r.dynamicLabel)this.el().appendChild(n);else{var a=document.createElement("span");t.dom.addClass(a,"vjs-resolution-button-staticlabel"),this.el().appendChild(a)}},createItems:function(){var e=[],t=this.sources&&this.sources.label||{},i=function(t){e.map(function(e){e.selected(e===t),e.removeClass("vjs-selected")})};for(var r in t)t.hasOwnProperty(r)&&(e.push(new l(this.player_,{label:r,src:t[r],initialySelected:r===this.options_.initialySelectedLabel,customSourcePicker:this.options_.customSourcePicker},i,this.label)),a[r]=e[e.length-1]);return e}});i=function(e){var i=t.mergeOptions(r,e),o=this,l=document.createElement("span"),u={};function d(e,t){return e.res&&t.res?+t.res-+e.res:0}function h(e){var t={label:{},res:{},type:{}};return e.map(function(e){f(t,"label",e),f(t,"res",e),f(t,"type",e),p(t,"label",e),p(t,"res",e),p(t,"type",e)}),t}function f(e,t,i){null==e[t][i[t]]&&(e[t][i[t]]=[])}function p(e,t,i){e[t][i[t]].push(i)}t.dom.addClass(l,"vjs-menu"),t.browser.IE_VERSION?t.dom.addClass(l,"vjs-resolution-button-label-ie"):t.dom.addClass(l,"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 r=function(e,t){var r=i.default,n="";"high"===r?(r=t[0].res,n=t[0].label):"low"!==r&&null!=r&&e.res[r]?e.res[r]&&(n=e.res[r][0].label):(r=t[t.length-1].res,n=t[t.length-1].label);return{res:r,label:n,sources:e.res[r]}}(u=h(e),e),n=new c(o,{sources:u,initialySelectedLabel:r.label,initialySelectedRes:r.res,customSourcePicker:i.customSourcePicker},i,l);return t.dom.addClass(n.el(),"vjs-resolution-button"),o.controlBar.resolutionSwitcher=o.controlBar.el_.insertBefore(n.el_,o.controlBar.getChild("fullscreenToggle").el_),o.controlBar.resolutionSwitcher.dispose=function(){this.parentNode.removeChild(this)},s(o,r.sources,r.label)},o.currentResolution=function(e,t){return null==e?n:(null!=a[e]&&a[e].onClick(t),o)},o.getGroupedSrc=function(){return u},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"}},r=[];e.tech_.ytPlayer.getAvailableQualityLevels().map(function(i){r.push({src:e.src().src,type:e.src().type,label:t[i].label,res:t[i].res,_yt:t[i].yt})});var n="auto",a=0,s=((u=h(r)).label.auto,new c(e,{sources:u,initialySelectedLabel:n,initialySelectedRes:a,customSourcePicker:function(t,i,r){return e.tech_.ytPlayer.setPlaybackQuality(i[0]._yt),e}},i,l));s.el().classList.add("vjs-resolution-button"),e.controlBar.resolutionSwitcher=e.controlBar.addChild(s)})}(o)})},t.registerPlugin("videoJsResolutionSwitcher",i)}(window,e)}(),function(e,t){"undefined"!=typeof window&&window.videojs?t(window.videojs):"function"==typeof define&&define.amd?define("videojs-hotkeys",["video.js"],function(e){return t(e.default||e)}):"undefined"!=typeof module&&module.exports&&(module.exports=t(require("video.js")))}(0,function(e){"use strict";"undefined"!=typeof window&&(window.videojs_hotkeys={version:"0.2.22"});(e.registerPlugin||e.plugin)("hotkeys",function(t){var i=this,r=i.el(),n=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,l=t.seekStep,u=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;r.hasAttribute("tabIndex")||r.setAttribute("tabIndex","-1"),r.style.outline="none",!p&&i.autoplay()||v||i.one("play",function(){r.focus({preventScroll:!0})}),g&&i.on("userinactive",function(){var e=function(){clearTimeout(t)},t=setTimeout(function(){i.off("useractive",e);var t=n.activeElement,a=r.querySelector(".vjs-control-bar");t&&t.parentElement==a&&r.focus()},10);i.one("useractive",e)}),i.on("play",function(){var e=r.querySelector(".iframeblocker");e&&""===e.style.display&&(e.style.display="block",e.style.bottom="39px")});var y=function(e){if(i.controls()){var t=n.activeElement;if((p||t==r||t==r.querySelector(".vjs-tech")||t==r.querySelector(".iframeblocker")||t==r.querySelector(".vjs-control-bar"))&&c){e=window.event||e;var a=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));e.preventDefault(),1==a?i.volume(i.volume()+o):-1==a&&i.volume(i.volume()-o)}}},_=function(e,i){return t.playPauseKey(e,i)?1:t.rewindKey(e,i)?2:t.forwardKey(e,i)?3:t.volumeUpKey(e,i)?4:t.volumeDownKey(e,i)?5:t.muteKey(e,i)?6:t.fullscreenKey(e,i)?7:void 0};function b(e){return"function"==typeof l?l(e):l}return i.on("keydown",function(e){var a,s,l=e.which,c=e.preventDefault,g=i.duration();if(i.controls()){var v=n.activeElement;if(p||v==r||v==r.querySelector(".vjs-tech")||v==r.querySelector(".vjs-control-bar")||v==r.querySelector(".iframeblocker"))switch(_(e,i)){case 1:c(),p&&e.stopPropagation(),i.paused()?i.play():i.pause();break;case 2:a=!i.paused(),c(),a&&i.pause(),(s=i.currentTime()-b(e))<=0&&(s=0),i.currentTime(s),a&&i.play();break;case 3:a=!i.paused(),c(),a&&i.pause(),(s=i.currentTime()+b(e))>=g&&(s=a?g-.001:g),i.currentTime(s),a&&i.play();break;case 5:c(),f?(s=i.currentTime()-1,i.currentTime()<=1&&(s=0),i.currentTime(s)):i.volume(i.volume()-o);break;case 4:c(),f?((s=i.currentTime()+1)>=g&&(s=g),i.currentTime(s)):i.volume(i.volume()+o);break;case 6:u&&i.muted(!i.muted());break;case 7:d&&(i.isFullscreen()?i.exitFullscreen():i.requestFullscreen());break;default:if((l>47&&l<59||l>95&&l<106)&&(m||!(e.metaKey||e.ctrlKey||e.altKey))&&h){var y=48;l>95&&(y=96);var T=l-y;c(),i.currentTime(i.duration()*T*.1)}for(var S in t.customKeys){var E=t.customKeys[S];E&&E.key&&E.handler&&E.key(e)&&(c(),E.handler(i,t,e))}}}}),i.on("mousewheel",y),i.on("DOMMouseScroll",y),this})}),function(e){e.URL=e.URL||e.webkitURL,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;var t=function(t,i){(i=i||{}).sampleBits=i.sampleBits||8,i.sampleRate=i.sampleRate||8e3;var r=new(e.webkitAudioContext||e.AudioContext),n=r.createMediaStreamSource(t),a=(r.createScriptProcessor||r.createJavaScriptNode).apply(r,[4096,1,1]),s=!1,o={size:0,buffer:[],level:0,inputSampleRate:r.sampleRate,inputSampleBits:16,outputSampleRate:i.sampleRate,oututSampleBits:i.sampleBits,input:function(e){this.buffer.push(new Float32Array(e)),this.size+=e.length,i.pcmCallback&&(i.pcmCallback(this.encodePCM(),this.level),this.buffer.splice(0,this.size),this.size=0)},compress:function(){for(var e=new Float32Array(this.size),t=0,i=0;i<this.buffer.length;i++)e.set(this.buffer[i],t),t+=this.buffer[i].length;for(var r=parseInt(this.inputSampleRate/this.outputSampleRate),n=e.length/r,a=new Float32Array(n),s=0,o=0;s<n;)a[s]=e[o],o+=r,s++;return a},powerLevel:function(e,t){var i=e/t||0;return i<1251?Math.round(i/1250*10):Math.round(Math.min(100,Math.max(0,100*(1+Math.log(i/1e4)/Math.log(10)))))},encodePCM:function(){var e=Math.min(this.inputSampleBits,this.oututSampleBits),t=this.compress(),i=t.length*(e/8),r=new ArrayBuffer(i),n=new DataView(r),a=0,s=0;if(8===e)for(var o=0;o<t.length;o++,a++){var l=(u=Math.max(-1,Math.min(1,t[o])))<0?32768*u:32767*u;l=parseInt(255/(65535/(l+32768))),s+=Math.abs(l),n.setInt8(a,l,!0)}else for(o=0;o<t.length;o++,a+=2){var u;l=(u=Math.max(-1,Math.min(1,t[o])))<0?32768*u:32767*u;s+=Math.abs(l),n.setInt16(a,l,!0)}return this.level=this.powerLevel(s,t.length),new Blob([n],{type:"audio/pcm"})},encodeWAV:function(){var e=Math.min(this.inputSampleRate,this.outputSampleRate),t=Math.min(this.inputSampleBits,this.oututSampleBits),i=this.compress(),r=i.length*(t/8),n=new ArrayBuffer(44+r),a=new DataView(n),s=0,o=0,l=function(e){for(var t=0;t<e.length;t++)a.setUint8(s+t,e.charCodeAt(t))};if(l("RIFF"),s+=4,a.setUint32(s,36+r,!0),s+=4,l("WAVE"),s+=4,l("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,l("data"),s+=4,a.setUint32(s,r,!0),s+=4,8===t)for(var u=0;u<i.length;u++,s++){var c=(d=Math.max(-1,Math.min(1,i[u])))<0?32768*d:32767*d;c=parseInt(255/(65535/(c+32768))),o+=Math.abs(c),a.setInt8(s,c,!0)}else for(u=0;u<i.length;u++,s+=2){var d;c=(d=Math.max(-1,Math.min(1,i[u])))<0?32768*d:32767*d;o+=Math.abs(c),a.setInt16(s,c,!0)}return this.level=this.powerLevel(o,i.length),new Blob([a],{type:"audio/wav"})}};this.start=function(){s||(n.connect(a),a.connect(r.destination),s=!0)},this.stop=function(){s&&(a.disconnect(),s=!1)},this.destroy=function(){this.stop(),r&&(r.close(),r=null,t.getAudioTracks().forEach(function(e){e.stop()}))},this.getBlob=function(){return this.stop(),o.encodeWAV()},this.getPCMBlob=function(){return this.stop(),o.encodePCM()},this.getLevel=function(){return o.level},this.play=function(t){t.src=e.URL.createObjectURL(this.getBlob())},this.recording=function(){return s},this.upload=function(e,t){var i=new FormData;i.append("audioData",this.getBlob()),i.append("pcmData",this.getPCMBlob());var r=new XMLHttpRequest;t&&(r.upload.addEventListener("progress",function(e){t("uploading",e)},!1),r.addEventListener("load",function(e){t("ok",e)},!1),r.addEventListener("error",function(e){t("error",e)},!1),r.addEventListener("abort",function(e){t("cancel",e)},!1)),r.open("POST",e),r.send(i)},a.onaudioprocess=function(e){o.input(e.inputBuffer.getChannelData(0))}};t.canRecording=null!=navigator.getUserMedia,t.get=function(e,i){if(e){if(!navigator.getUserMedia)return"https:"!=String(location.protocol).toLowerCase()?void e(null,"当前浏览器不支持录音功能, 请确认当前是否访问 HTTPS 服务!"):void e(null,"当前浏览器不支持录音功能。");navigator.getUserMedia({audio:!0},function(r){var n=new t(r,i);e(n,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":"点击切换到流畅播放"});