LocalCDN-Firefox-Chrome-Brave/resources/clappr/0.4.7/clappr.min.jsm

86 lines
470 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var Clappr=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(t){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?e(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function o(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?f(e):t}function g(e){var t=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}}();return function(){var n,i=d(e);if(t){var r=d(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return p(this,n)}}function v(e,t,n){return(v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],i=!0,r=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){r=!0,a=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw a}}return n}(e,t)||A(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||A(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function E(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=A(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var a=t[r];if(e.call(i,a,r,t))return a;r++}}}),Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}),Object.values||(Object.values=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=e[t[n]];return i}),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),i=1;i<arguments.length;i++){var r=arguments[i];if(null!=r)for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(n[a]=r[a])}return n},writable:!0,configurable:!0}),Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r<n;){var a=t[r];if(e.call(i,a,r,t))return r;r++}return-1},configurable:!0,writable:!0});var T,k={mp4:"data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAAAhmcmVlAAAC721kYXQhEAUgpBv/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3pwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCEQBSCkG//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADengAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAsJtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAALwABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAB7HRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAIAAAAAAAAALwAAAAAAAAAAAAAAAQEAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAAC8AAAAAAAEAAAAAAWRtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAAKxEAAAIAFXEAAAAAAAtaGRscgAAAAAAAAAAc291bgAAAAAAAAAAAAAAAFNvdW5kSGFuZGxlcgAAAAEPbWluZgAAABBzbWhkAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAADTc3RibAAAAGdzdHNkAAAAAAAAAAEAAABXbXA0YQAAAAAAAAABAAAAAAAAAAAAAgAQAAAAAKxEAAAAAAAzZXNkcwAAAAADgICAIgACAASAgIAUQBUAAAAAAfQAAAHz+QWAgIACEhAGgICAAQIAAAAYc3R0cwAAAAAAAAABAAAAAgAABAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAIAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAFzAAABdAAAABRzdGNvAAAAAAAAAAEAAAAsAAAAYnVkdGEAAABabWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWRpcmFwcGwAAAAAAAAAAAAAAAAtaWxzdAAAACWpdG9vAAAAHWRhdGEAAAABAAAAAExhdmY1Ni40MC4xMDE="},_=function(){var e,t,n,i,r,a,o=[],s=o.concat,l=o.filter,u=o.slice,c=window.document,d={},h={},f={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},p=/^\s*<(\w+|!)[^>]*>/,g=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,m=/^(?:body|html)$/i,y=/([A-Z])/g,A=["val","css","html","text","data","width","height","offset"],b=c.createElement("table"),E=c.createElement("tr"),T={tr:c.createElement("tbody"),tbody:b,thead:b,tfoot:b,td:E,th:E,"*":c.createElement("div")},k=/complete|loaded|interactive/,_=/^[\w-]*$/,S={},C=S.toString,R={},w=c.createElement("div"),O={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},L=Array.isArray||function(e){return e instanceof Array};function D(e){return null==e?String(e):S[C.call(e)]||"object"}function I(e){return"function"==D(e)}function P(e){return null!=e&&e==e.window}function x(e){return null!=e&&e.nodeType==e.DOCUMENT_NODE}function N(e){return"object"==D(e)}function M(e){return N(e)&&!P(e)&&Object.getPrototypeOf(e)==Object.prototype}function F(e){var t=!!e&&"length"in e&&e.length,i=n.type(e);return"function"!=i&&!P(e)&&("array"==i||0===t||"number"==typeof t&&t>0&&t-1 in e)}function B(e){return e.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function U(e){return e in h?h[e]:h[e]=new RegExp("(^|\\s)"+e+"(\\s|$)")}function V(e,t){return"number"!=typeof t||f[B(e)]?t:t+"px"}function j(e){return"children"in e?u.call(e.children):n.map(e.childNodes,(function(e){if(1==e.nodeType)return e}))}function K(e,t){var n,i=e?e.length:0;for(n=0;n<i;n++)this[n]=e[n];this.length=i,this.selector=t||""}function G(n,i,r){for(t in i)r&&(M(i[t])||L(i[t]))?(M(i[t])&&!M(n[t])&&(n[t]={}),L(i[t])&&!L(n[t])&&(n[t]=[]),G(n[t],i[t],r)):i[t]!==e&&(n[t]=i[t])}function Y(e,t){return null==t?n(e):n(e).filter(t)}function H(e,t,n,i){return I(t)?t.call(e,n,i):t}function $(e,t,n){null==n?e.removeAttribute(t):e.setAttribute(t,n)}function z(t,n){var i=t.className||"",r=i&&i.baseVal!==e;if(n===e)return r?i.baseVal:i;r?i.baseVal=n:t.className=n}function W(e){try{return e?"true"==e||"false"!=e&&("null"==e?null:+e+""==e?+e:/^[\[\{]/.test(e)?n.parseJSON(e):e):e}catch(t){return e}}function q(e,t){t(e);for(var n=0,i=e.childNodes.length;n<i;n++)q(e.childNodes[n],t)}return R.matches=function(e,t){if(!t||!e||1!==e.nodeType)return!1;var n=e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.matchesSelector;if(n)return n.call(e,t);var i,r=e.parentNode,a=!r;return a&&(r=w).appendChild(e),i=~R.qsa(r,t).indexOf(e),a&&w.removeChild(e),i},r=function(e){return e.replace(/-+(.)?/g,(function(e,t){return t?t.toUpperCase():""}))},a=function(e){return l.call(e,(function(t,n){return e.indexOf(t)==n}))},R.fragment=function(t,i,r){var a,o,s;return g.test(t)&&(a=n(c.createElement(RegExp.$1))),a||(t.replace&&(t=t.replace(v,"<$1></$2>")),i===e&&(i=p.test(t)&&RegExp.$1),i in T||(i="*"),(s=T[i]).innerHTML=""+t,a=n.each(u.call(s.childNodes),(function(){s.removeChild(this)}))),M(r)&&(o=n(a),n.each(r,(function(e,t){A.indexOf(e)>-1?o[e](t):o.attr(e,t)}))),a},R.Z=function(e,t){return new K(e,t)},R.isZ=function(e){return e instanceof R.Z},R.init=function(t,i){var r,a;if(!t)return R.Z();if("string"==typeof t)if("<"==(t=t.trim())[0]&&p.test(t))r=R.fragment(t,RegExp.$1,i),t=null;else{if(i!==e)return n(i).find(t);r=R.qsa(c,t)}else{if(I(t))return n(c).ready(t);if(R.isZ(t))return t;if(L(t))a=t,r=l.call(a,(function(e){return null!=e}));else if(N(t))r=[t],t=null;else if(p.test(t))r=R.fragment(t.trim(),RegExp.$1,i),t=null;else{if(i!==e)return n(i).find(t);r=R.qsa(c,t)}}return R.Z(r,t)},(n=function(e,t){return R.init(e,t)}).extend=function(e){var t,n=u.call(arguments,1);return"boolean"==typeof e&&(t=e,e=n.shift()),n.forEach((function(n){G(e,n,t)})),e},R.qsa=function(e,t){var n,i="#"==t[0],r=!i&&"."==t[0],a=i||r?t.slice(1):t,o=_.test(a);return e.getElementById&&o&&i?(n=e.getElementById(a))?[n]:[]:1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType?[]:u.call(o&&!i&&e.getElementsByClassName?r?e.getElementsByClassName(a):e.getElementsByTagName(t):e.querySelectorAll(t))},n.contains=c.documentElement.contains?function(e,t){return e!==t&&e.contains(t)}:function(e,t){for(;t&&(t=t.parentNode);)if(t===e)return!0;return!1},n.type=D,n.isFunction=I,n.isWindow=P,n.isArray=L,n.isPlainObject=M,n.isEmptyObject=function(e){var t;for(t in e)return!1;return!0},n.isNumeric=function(e){var t=Number(e),n=typeof e;return null!=e&&"boolean"!=n&&("string"!=n||e.length)&&!isNaN(t)&&isFinite(t)||!1},n.inArray=function(e,t,n){return o.indexOf.call(t,e,n)},n.camelCase=r,n.trim=function(e){return null==e?"":String.prototype.trim.call(e)},n.uuid=0,n.support={},n.expr={},n.noop=function(){},n.map=function(e,t){var i,r,a,o,s=[];if(F(e))for(r=0;r<e.length;r++)null!=(i=t(e[r],r))&&s.push(i);else for(a in e)null!=(i=t(e[a],a))&&s.push(i);return(o=s).length>0?n.fn.concat.apply([],o):o},n.each=function(e,t){var n,i;if(F(e)){for(n=0;n<e.length;n++)if(!1===t.call(e[n],n,e[n]))return e}else for(i in e)if(!1===t.call(e[i],i,e[i]))return e;return e},n.grep=function(e,t){return l.call(e,t)},window.JSON&&(n.parseJSON=JSON.parse),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),(function(e,t){S["[object "+t+"]"]=t.toLowerCase()})),n.fn={constructor:R.Z,length:0,forEach:o.forEach,reduce:o.reduce,push:o.push,sort:o.sort,splice:o.splice,indexOf:o.indexOf,concat:function(){var e,t,n=[];for(e=0;e<arguments.length;e++)t=arguments[e],n[e]=R.isZ(t)?t.toArray():t;return s.apply(R.isZ(this)?this.toArray():this,n)},map:function(e){return n(n.map(this,(function(t,n){return e.call(t,n,t)})))},slice:function(){return n(u.apply(this,arguments))},ready:function(e){return k.test(c.readyState)&&c.body?e(n):c.addEventListener("DOMContentLoaded",(function(){e(n)}),!1),this},get:function(t){return t===e?u.call(this):this[t>=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each((function(){null!=this.parentNode&&this.parentNode.removeChild(this)}))},each:function(e){return o.every.call(this,(function(t,n){return!1!==e.call(t,n,t)})),this},filter:function(e){return I(e)?this.not(this.not(e)):n(l.call(this,(function(t){return R.matches(t,e)})))},add:function(e,t){return n(a(this.concat(n(e,t))))},is:function(e){return this.length>0&&R.matches(this[0],e)},not:function(t){var i=[];if(I(t)&&t.call!==e)this.each((function(e){t.call(this,e)||i.push(this)}));else{var r="string"==typeof t?this.filter(t):F(t)&&I(t.item)?u.call(t):n(t);this.forEach((function(e){r.indexOf(e)<0&&i.push(e)}))}return n(i)},has:function(e){return this.filter((function(){return N(e)?n.contains(this,e):n(this).find(e).size()}))},eq:function(e){return-1===e?this.slice(e):this.slice(e,+e+1)},first:function(){var e=this[0];return e&&!N(e)?e:n(e)},last:function(){var e=this[this.length-1];return e&&!N(e)?e:n(e)},find:function(e){var t=this;return e?"object"==typeof e?n(e).filter((function(){var e=this;return o.some.call(t,(function(t){return n.contains(t,e)}))})):1==this.length?n(R.qsa(this[0],e)):this.map((function(){return R.qsa(this,e)})):n()},closest:function(e,t){var i=[],r="object"==typeof e&&n(e);return this.each((function(n,a){for(;a&&!(r?r.indexOf(a)>=0:R.matches(a,e));)a=a!==t&&!x(a)&&a.parentNode;a&&i.indexOf(a)<0&&i.push(a)})),n(i)},parents:function(e){for(var t=[],i=this;i.length>0;)i=n.map(i,(function(e){if((e=e.parentNode)&&!x(e)&&t.indexOf(e)<0)return t.push(e),e}));return Y(t,e)},parent:function(e){return Y(a(this.pluck("parentNode")),e)},children:function(e){return Y(this.map((function(){return j(this)})),e)},contents:function(){return this.map((function(){return this.contentDocument||u.call(this.childNodes)}))},siblings:function(e){return Y(this.map((function(e,t){return l.call(j(t.parentNode),(function(e){return e!==t}))})),e)},empty:function(){return this.each((function(){this.innerHTML=""}))},pluck:function(e){return n.map(this,(function(t){return t[e]}))},show:function(){return this.each((function(){var e,t,n;"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=(e=this.nodeName,d[e]||(t=c.createElement(e),c.body.appendChild(t),n=getComputedStyle(t,"").getPropertyValue("display"),t.parentNode.removeChild(t),"none"==n&&(n="block"),d[e]=n),d[e]))}))},replaceWith:function(e){return this.before(e).remove()},wrap:function(e){var t=I(e);if(this[0]&&!t)var i=n(e).get(0),r=i.parentNode||this.length>1;return this.each((function(a){n(this).wrapAll(t?e.call(this,a):r?i.cloneNode(!0):i)}))},wrapAll:function(e){if(this[0]){var t;for(n(this[0]).before(e=n(e));(t=e.children()).length;)e=t.first();n(e).append(this)}return this},wrapInner:function(e){var t=I(e);return this.each((function(i){var r=n(this),a=r.contents(),o=t?e.call(this,i):e;a.length?a.wrapAll(o):r.append(o)}))},unwrap:function(){return this.parent().each((function(){n(this).replaceWith(n(this).children())})),this},clone:function(){return this.map((function(){return this.cloneNode(!0)}))},hide:function(){return this.css("display","none")},toggle:function(t){return this.each((function(){var i=n(this);(t===e?"none"==i.css("display"):t)?i.show():i.hide()}))},prev:function(e){return n(this.pluck("previousElementSibling")).filter(e||"*")},next:function(e){return n(this.pluck("nextElementSibling")).filter(e||"*")},html:function(e){return 0 in arguments?this.each((function(t){var i=this.innerHTML;n(this).empty().append(H(this,e,t,i))})):0 in this?this[0].innerHTML:null},text:function(e){return 0 in arguments?this.each((function(t){var n=H(this,e,t,this.textContent);this.textContent=null==n?"":""+n})):0 in this?this.pluck("textContent").join(""):null},attr:function(n,i){var r;return"string"!=typeof n||1 in arguments?this.each((function(e){if(1===this.nodeType)if(N(n))for(t in n)$(this,t,n[t]);else $(this,n,H(this,i,e,this.getAttribute(n)))})):0 in this&&1==this[0].nodeType&&null!=(r=this[0].getAttribute(n))?r:e},removeAttr:function(e){return this.each((function(){1===this.nodeType&&e.split(" ").forEach((function(e){$(this,e)}),this)}))},prop:function(e,t){return e=O[e]||e,1 in arguments?this.each((function(n){this[e]=H(this,t,n,this[e])})):this[0]&&this[0][e]},removeProp:function(e){return e=O[e]||e,this.each((function(){delete this[e]}))},data:function(t,n){var i="data-"+t.replace(y,"-$1").toLowerCase(),r=1 in arguments?this.attr(i,n):this.attr(i);return null!==r?W(r):e},val:function(e){return 0 in arguments?(null==e&&(e=""),this.each((function(t){this.value=H(this,e,t,this.value)}))):this[0]&&(this[0].multiple?n(this[0]).find("option").filter((function(){return this.selected})).pluck("value"):this[0].value)},offset:function(e){if(e)return this.each((function(t){var i=n(this),r=H(this,e,t,i.offset()),a=i.offsetParent().offset(),o={top:r.top-a.top,left:r.left-a.left};"static"==i.css("position")&&(o.position="relative"),i.css(o)}));if(!this.length)return null;if(c.documentElement!==this[0]&&!n.contains(c.documentElement,this[0]))return{top:0,left:0};var t=this[0].getBoundingClientRect();return{left:t.left+window.pageXOffset,top:t.top+window.pageYOffset,width:Math.round(t.width),height:Math.round(t.height)}},css:function(e,i){if(arguments.length<2){var a=this[0];if("string"==typeof e){if(!a)return;return a.style[r(e)]||getComputedStyle(a,"").getPropertyValue(e)}if(L(e)){if(!a)return;var o={},s=getComputedStyle(a,"");return n.each(e,(function(e,t){o[t]=a.style[r(t)]||s.getPropertyValue(t)})),o}}var l="";if("string"==D(e))i||0===i?l=B(e)+":"+V(e,i):this.each((function(){this.style.removeProperty(B(e))}));else for(t in e)e[t]||0===e[t]?l+=B(t)+":"+V(t,e[t])+";":this.each((function(){this.style.removeProperty(B(t))}));return this.each((function(){this.style.cssText+=";"+l}))},index:function(e){return e?this.indexOf(n(e)[0]):this.parent().children().indexOf(this[0])},hasClass:function(e){return!!e&&o.some.call(this,(function(e){return this.test(z(e))}),U(e))},addClass:function(e){return e?this.each((function(t){if("className"in this){i=[];var r=z(this);H(this,e,t,r).split(/\s+/g).forEach((function(e){n(this).hasClass(e)||i.push(e)}),this),i.length&&z(this,r+(r?" ":"")+i.join(" "))}})):this},removeClass:function(t){return this.each((function(n){if("className"in this){if(t===e)return z(this,"");i=z(this),H(this,t,n,i).split(/\s+/g).forEach((function(e){i=i.replace(U(e)," ")})),z(this,i.trim())}}))},toggleClass:function(t,i){return t?this.each((function(r){var a=n(this);H(this,t,r,z(this)).split(/\s+/g).forEach((function(t){(i===e?!a.hasClass(t):i)?a.addClass(t):a.removeClass(t)}))})):this},scrollTop:function(t){if(this.length){var n="scrollTop"in this[0];return t===e?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var n="scrollLeft"in this[0];return t===e?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var e=this[0],t=this.offsetParent(),i=this.offset(),r=m.test(t[0].nodeName)?{top:0,left:0}:t.offset();return i.top-=parseFloat(n(e).css("margin-top"))||0,i.left-=parseFloat(n(e).css("margin-left"))||0,r.top+=parseFloat(n(t[0]).css("border-top-width"))||0,r.left+=parseFloat(n(t[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent||c.body;e&&!m.test(e.nodeName)&&"static"==n(e).css("position");)e=e.offsetParent;return e}))}},n.fn.detach=n.fn.remove,["width","height"].forEach((function(t){var i=t.replace(/./,(function(e){return e[0].toUpperCase()}));n.fn[t]=function(r){var a,o=this[0];return r===e?P(o)?o["inner"+i]:x(o)?o.documentElement["scroll"+i]:(a=this.offset())&&a[t]:this.each((function(e){(o=n(this)).css(t,H(this,r,e,o[t]()))}))}})),["after","prepend","before","append"].forEach((function(t,i){var r=i%2;n.fn[t]=function(){var t,a,o=n.map(arguments,(function(i){var r=[];return"array"==(t=D(i))?(i.forEach((function(t){return t.nodeType!==e?r.push(t):n.zepto.isZ(t)?r=r.concat(t.get()):void(r=r.concat(R.fragment(t)))})),r):"object"==t||null==i?i:R.fragment(i)})),s=this.length>1;return o.length<1?this:this.each((function(e,t){a=r?t:t.parentNode,t=0==i?t.nextSibling:1==i?t.firstChild:2==i?t:null;var l=n.contains(c.documentElement,a);o.forEach((function(e){if(s)e=e.cloneNode(!0);else if(!a)return n(e).remove();a.insertBefore(e,t),l&&q(e,(function(e){if(!(null==e.nodeName||"SCRIPT"!==e.nodeName.toUpperCase()||e.type&&"text/javascript"!==e.type||e.src)){var t=e.ownerDocument?e.ownerDocument.defaultView:window;t.eval.call(t,e.innerHTML)}}))}))}))},n.fn[r?t+"To":"insert"+(i?"Before":"After")]=function(e){return n(e)[t](this),this}})),R.Z.prototype=K.prototype=n.fn,R.uniq=a,R.deserializeValue=W,n.zepto=R,n}();window.Zepto=_,void 0===window.$&&(window.$=_),function(e){var t,n,i=+new Date,r=window.document,a=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,o=/^(?:text|application)\/javascript/i,s=/^(?:text|application)\/xml/i,l="application/json",u="text/html",c=/^\s*$/,d=r.createElement("a");function h(t,n,i,a){if(t.global)return function(t,n,i){var r=e.Event(n);return e(t).trigger(r,i),!r.isDefaultPrevented()}(n||r,i,a)}function f(e,t){var n=t.context;if(!1===t.beforeSend.call(n,e,t)||!1===h(t,n,"ajaxBeforeSend",[e,t]))return!1;h(t,n,"ajaxSend",[e,t])}function p(e,t,n,i){var r=n.context,a="success";n.success.call(r,e,a,t),i&&i.resolveWith(r,[e,a,t]),h(n,r,"ajaxSuccess",[t,n,e]),v(a,t,n)}function g(e,t,n,i,r){var a=i.context;i.error.call(a,n,t,e),r&&r.rejectWith(a,[n,t,e]),h(i,a,"ajaxError",[n,i,e||t]),v(t,n,i)}function v(t,n,i){var r=i.context;i.complete.call(r,n,t),h(i,r,"ajaxComplete",[n,i]),function(t){t.global&&!--e.active&&h(t,null,"ajaxStop")}(i)}function m(){}function y(e,t){return""==t?e:(e+"&"+t).replace(/[&?]{1,2}/,"?")}function A(t,n,i,r){return e.isFunction(n)&&(r=i,i=n,n=void 0),e.isFunction(i)||(r=i,i=void 0),{url:t,data:n,success:i,dataType:r}}d.href=window.location.href,e.active=0,e.ajaxJSONP=function(t,n){if(!("type"in t))return e.ajax(t);var a,o,s=t.jsonpCallback,l=(e.isFunction(s)?s():s)||"Zepto"+i++,u=r.createElement("script"),c=window[l],d=function(t){e(u).triggerHandler("error",t||"abort")},h={abort:d};return n&&n.promise(h),e(u).on("load error",(function(i,r){clearTimeout(o),e(u).off().remove(),"error"!=i.type&&a?p(a[0],h,t,n):g(null,r||"error",h,t,n),window[l]=c,a&&e.isFunction(c)&&c(a[0]),c=a=void 0})),!1===f(h,t)?(d("abort"),h):(window[l]=function(){a=arguments},u.src=t.url.replace(/\?(.+)=\?/,"?$1="+l),r.head.appendChild(u),t.timeout>0&&(o=setTimeout((function(){d("timeout")}),t.timeout)),h)},e.ajaxSettings={type:"GET",beforeSend:m,success:m,error:m,complete:m,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:l,xml:"application/xml, text/xml",html:u,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:m},e.ajax=function(i){var a,v,A=e.extend({},i||{}),b=e.Deferred&&e.Deferred();for(t in e.ajaxSettings)void 0===A[t]&&(A[t]=e.ajaxSettings[t]);!function(t){t.global&&0==e.active++&&h(t,null,"ajaxStart")}(A),A.crossDomain||((a=r.createElement("a")).href=A.url,a.href=a.href,A.crossDomain=d.protocol+"//"+d.host!=a.protocol+"//"+a.host),A.url||(A.url=window.location.toString()),(v=A.url.indexOf("#"))>-1&&(A.url=A.url.slice(0,v)),function(t){t.processData&&t.data&&"string"!=e.type(t.data)&&(t.data=e.param(t.data,t.traditional)),!t.data||t.type&&"GET"!=t.type.toUpperCase()&&"jsonp"!=t.dataType||(t.url=y(t.url,t.data),t.data=void 0)}(A);var E=A.dataType,T=/\?.+=\?/.test(A.url);if(T&&(E="jsonp"),!1!==A.cache&&(i&&!0===i.cache||"script"!=E&&"jsonp"!=E)||(A.url=y(A.url,"_="+Date.now())),"jsonp"==E)return T||(A.url=y(A.url,A.jsonp?A.jsonp+"=?":!1===A.jsonp?"":"callback=?")),e.ajaxJSONP(A,b);var k,_=A.accepts[E],S={},C=function(e,t){S[e.toLowerCase()]=[e,t]},R=/^([\w-]+:)\/\//.test(A.url)?RegExp.$1:window.location.protocol,w=A.xhr(),O=w.setRequestHeader;if(b&&b.promise(w),A.crossDomain||C("X-Requested-With","XMLHttpRequest"),C("Accept",_||"*/*"),(_=A.mimeType||_)&&(_.indexOf(",")>-1&&(_=_.split(",",2)[0]),w.overrideMimeType&&w.overrideMimeType(_)),(A.contentType||!1!==A.contentType&&A.data&&"GET"!=A.type.toUpperCase())&&C("Content-Type",A.contentType||"application/x-www-form-urlencoded"),A.headers)for(n in A.headers)C(n,A.headers[n]);if(w.setRequestHeader=C,w.onreadystatechange=function(){if(4==w.readyState){w.onreadystatechange=m,clearTimeout(k);var t,n=!1;if(w.status>=200&&w.status<300||304==w.status||0==w.status&&"file:"==R){if(E=E||function(e){return e&&(e=e.split(";",2)[0]),e&&(e==u?"html":e==l?"json":o.test(e)?"script":s.test(e)&&"xml")||"text"}(A.mimeType||w.getResponseHeader("content-type")),"arraybuffer"==w.responseType||"blob"==w.responseType)t=w.response;else{t=w.responseText;try{t=function(e,t,n){if(n.dataFilter==m)return e;var i=n.context;return n.dataFilter.call(i,e,t)}(t,E,A),"script"==E?(0,eval)(t):"xml"==E?t=w.responseXML:"json"==E&&(t=c.test(t)?null:e.parseJSON(t))}catch(e){n=e}if(n)return g(n,"parsererror",w,A,b)}p(t,w,A,b)}else g(w.statusText||null,w.status?"error":"abort",w,A,b)}},!1===f(w,A))return w.abort(),g(null,"abort",w,A,b),w;var L=!("async"in A)||A.async;if(w.open(A.type,A.url,L,A.username,A.password),A.xhrFields)for(n in A.xhrFields)w[n]=A.xhrFields[n];for(n in S)O.apply(w,S[n]);return A.timeout>0&&(k=setTimeout((function(){w.onreadystatechange=m,w.abort(),g(null,"timeout",w,A,b)}),A.timeout)),w.send(A.data?A.data:null),w},e.get=function(){return e.ajax(A.apply(null,arguments))},e.post=function(){var t=A.apply(null,arguments);return t.type="POST",e.ajax(t)},e.getJSON=function(){var t=A.apply(null,arguments);return t.dataType="json",e.ajax(t)},e.fn.load=function(t,n,i){if(!this.length)return this;var r,o=this,s=t.split(/\s/),l=A(t,n,i),u=l.success;return s.length>1&&(l.url=s[0],r=s[1]),l.success=function(t){o.html(r?e("<div>").html(t.replace(a,"")).find(r):t),u&&u.apply(o,arguments)},e.ajax(l),this};var b=encodeURIComponent;function E(t,n,i,r){var a,o=e.isArray(n),s=e.isPlainObject(n);e.each(n,(function(n,l){a=e.type(l),r&&(n=i?r:r+"["+(s||"object"==a||"array"==a?n:"")+"]"),!r&&o?t.add(l.name,l.value):"array"==a||!i&&"object"==a?E(t,l,i,n):t.add(n,l)}))}e.param=function(t,n){var i=[];return i.add=function(t,n){e.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(b(t)+"="+b(n))},E(i,t,n),i.join("&").replace(/%20/g,"+")}}(_),(T=_).Callbacks=function(e){e=T.extend({},e);var t,n,i,r,a,o,s=[],l=!e.once&&[],u=function(d){for(t=e.memory&&d,n=!0,o=r||0,r=0,a=s.length,i=!0;s&&o<a;++o)if(!1===s[o].apply(d[0],d[1])&&e.stopOnFalse){t=!1;break}i=!1,s&&(l?l.length&&u(l.shift()):t?s.length=0:c.disable())},c={add:function(){if(s){var n=s.length,o=function(t){T.each(t,(function(t,n){"function"==typeof n?e.unique&&c.has(n)||s.push(n):n&&n.length&&"string"!=typeof n&&o(n)}))};o(arguments),i?a=s.length:t&&(r=n,u(t))}return this},remove:function(){return s&&T.each(arguments,(function(e,t){for(var n;(n=T.inArray(t,s,n))>-1;)s.splice(n,1),i&&(n<=a&&--a,n<=o&&--o)})),this},has:function(e){return!(!s||!(e?T.inArray(e,s)>-1:s.length))},empty:function(){return a=s.length=0,this},disable:function(){return s=l=t=void 0,this},disabled:function(){return!s},lock:function(){return l=void 0,t||c.disable(),this},locked:function(){return!l},fireWith:function(e,t){return!s||n&&!l||(t=[e,(t=t||[]).slice?t.slice():t],i?l.push(t):u(t)),this},fire:function(){return c.fireWith(this,arguments)},fired:function(){return!!n}};return c},function(e){var t=Array.prototype.slice;function n(t){var i=[["resolve","done",e.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",e.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",e.Callbacks({memory:1})]],r="pending",a={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var t=arguments;return n((function(n){e.each(i,(function(i,r){var s=e.isFunction(t[i])&&t[i];o[r[1]]((function(){var t=s&&s.apply(this,arguments);if(t&&e.isFunction(t.promise))t.promise().done(n.resolve).fail(n.reject).progress(n.notify);else{var i=this===a?n.promise():this,o=s?[t]:arguments;n[r[0]+"With"](i,o)}}))})),t=null})).promise()},promise:function(t){return null!=t?e.extend(t,a):a}},o={};return e.each(i,(function(e,t){var n=t[2],s=t[3];a[t[1]]=n.add,s&&n.add((function(){r=s}),i[1^e][2].disable,i[2][2].lock),o[t[0]]=function(){return o[t[0]+"With"](this===o?a:this,arguments),this},o[t[0]+"With"]=n.fireWith})),a.promise(o),t&&t.call(o,o),o}e.when=function(i){var r,a,o,s=t.call(arguments),l=s.length,u=0,c=1!==l||i&&e.isFunction(i.promise)?l:0,d=1===c?i:n(),h=function(e,n,i){return function(a){n[e]=this,i[e]=arguments.length>1?t.call(arguments):a,i===r?d.notifyWith(n,i):--c||d.resolveWith(n,i)}};if(l>1)for(r=new Array(l),a=new Array(l),o=new Array(l);u<l;++u)s[u]&&e.isFunction(s[u].promise)?s[u].promise().done(h(u,o,s)).fail(d.reject).progress(h(u,a,r)):--c;return c||d.resolveWith(o,s),d.promise()},e.Deferred=n}(_),function(e){var t,n=1,i=Array.prototype.slice,r=e.isFunction,a=function(e){return"string"==typeof e},o={},s={},l="onfocusin"in window,u={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};function d(e){return e._zid||(e._zid=n++)}function h(e,t,n,i){if((t=f(t)).ns)var r=(a=t.ns,new RegExp("(?:^| )"+a.replace(" "," .* ?")+"(?: |$)"));var a;return(o[d(e)]||[]).filter((function(e){return e&&(!t.e||e.e==t.e)&&(!t.ns||r.test(e.ns))&&(!n||d(e.fn)===d(n))&&(!i||e.sel==i)}))}function f(e){var t=(""+e).split(".");return{e:t[0],ns:t.slice(1).sort().join(" ")}}function p(e,t){return e.del&&!l&&e.e in u||!!t}function g(e){return c[e]||l&&u[e]||e}function v(n,i,r,a,s,l,u){var h=d(n),v=o[h]||(o[h]=[]);i.split(/\s/).forEach((function(i){if("ready"==i)return e(document).ready(r);var o=f(i);o.fn=r,o.sel=s,o.e in c&&(r=function(t){var n=t.relatedTarget;if(!n||n!==this&&!e.contains(this,n))return o.fn.apply(this,arguments)}),o.del=l;var d=l||r;o.proxy=function(e){if(!(e=T(e)).isImmediatePropagationStopped()){e.data=a;var i=d.apply(n,e._args==t?[e]:[e].concat(e._args));return!1===i&&(e.preventDefault(),e.stopPropagation()),i}},o.i=v.length,v.push(o),"addEventListener"in n&&n.addEventListener(g(o.e),o.proxy,p(o,u))}))}function m(e,t,n,i,r){var a=d(e);(t||"").split(/\s/).forEach((function(t){h(e,t,n,i).forEach((function(t){delete o[a][t.i],"removeEventListener"in e&&e.removeEventListener(g(t.e),t.proxy,p(t,r))}))}))}s.click=s.mousedown=s.mouseup=s.mousemove="MouseEvents",e.event={add:v,remove:m},e.proxy=function(t,n){var o=2 in arguments&&i.call(arguments,2);if(r(t)){var s=function(){return t.apply(n,o?o.concat(i.call(arguments)):arguments)};return s._zid=d(t),s}if(a(n))return o?(o.unshift(t[n],t),e.proxy.apply(null,o)):e.proxy(t[n],t);throw new TypeError("expected function")},e.fn.bind=function(e,t,n){return this.on(e,t,n)},e.fn.unbind=function(e,t){return this.off(e,t)},e.fn.one=function(e,t,n,i){return this.on(e,t,n,i,1)};var y=function(){return!0},A=function(){return!1},b=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};function T(n,i){return!i&&n.isDefaultPrevented||(i||(i=n),e.each(E,(function(e,t){var r=i[e];n[e]=function(){return this[t]=y,r&&r.apply(i,arguments)},n[t]=A})),n.timeStamp||(n.timeStamp=Date.now()),(i.defaultPrevented!==t?i.defaultPrevented:"returnValue"in i?!1===i.returnValue:i.getPreventDefault&&i.getPreventDefault())&&(n.isDefaultPrevented=y)),n}function k(e){var n,i={originalEvent:e};for(n in e)b.test(n)||e[n]===t||(i[n]=e[n]);return T(i,e)}e.fn.delegate=function(e,t,n){return this.on(t,e,n)},e.fn.undelegate=function(e,t,n){return this.off(t,e,n)},e.fn.live=function(t,n){return e(document.body).delegate(this.selector,t,n),this},e.fn.die=function(t,n){return e(document.body).undelegate(this.selector,t,n),this},e.fn.on=function(n,o,s,l,u){var c,d,h=this;return n&&!a(n)?(e.each(n,(function(e,t){h.on(e,o,s,t,u)})),h):(a(o)||r(l)||!1===l||(l=s,s=o,o=t),l!==t&&!1!==s||(l=s,s=t),!1===l&&(l=A),h.each((function(t,r){u&&(c=function(e){return m(r,e.type,l),l.apply(this,arguments)}),o&&(d=function(t){var n,a=e(t.target).closest(o,r).get(0);if(a&&a!==r)return n=e.extend(k(t),{currentTarget:a,liveFired:r}),(c||l).apply(a,[n].concat(i.call(arguments,1)))}),v(r,n,l,s,o,d||c)})))},e.fn.off=function(n,i,o){var s=this;return n&&!a(n)?(e.each(n,(function(e,t){s.off(e,i,t)})),s):(a(i)||r(o)||!1===o||(o=i,i=t),!1===o&&(o=A),s.each((function(){m(this,n,o,i)})))},e.fn.trigger=function(t,n){return(t=a(t)||e.isPlainObject(t)?e.Event(t):T(t))._args=n,this.each((function(){t.type in u&&"function"==typeof this[t.type]?this[t.type]():"dispatchEvent"in this?this.dispatchEvent(t):e(this).triggerHandler(t,n)}))},e.fn.triggerHandler=function(t,n){var i,r;return this.each((function(o,s){(i=k(a(t)?e.Event(t):t))._args=n,i.target=s,e.each(h(s,t.type||t),(function(e,t){if(r=t.proxy(i),i.isImmediatePropagationStopped())return!1}))})),r},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach((function(t){e.fn[t]=function(e){return 0 in arguments?this.bind(t,e):this.trigger(t)}})),e.Event=function(e,t){a(e)||(e=(t=e).type);var n=document.createEvent(s[e]||"Events"),i=!0;if(t)for(var r in t)"bubbles"==r?i=!!t[r]:n[r]=t[r];return n.initEvent(e,i,!0),T(n)}}(_),function(){try{getComputedStyle(void 0)}catch(t){var e=getComputedStyle;window.getComputedStyle=function(t,n){try{return e(t,n)}catch(e){return null}}}}(),function(e){var t=e.zepto,n=t.qsa,i=t.matches;function r(t){return!(!(t=e(t)).width()&&!t.height())&&"none"!==t.css("display")}var a=e.expr[":"]={visible:function(){if(r(this))return this},hidden:function(){if(!r(this))return this},selected:function(){if(this.selected)return this},checked:function(){if(this.checked)return this},parent:function(){return this.parentNode},first:function(e){if(0===e)return this},last:function(e,t){if(e===t.length-1)return this},eq:function(e,t,n){if(e===n)return this},contains:function(t,n,i){if(e(this).text().indexOf(i)>-1)return this},has:function(e,n,i){if(t.qsa(this,i).length)return this}},o=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),s=/^\s*>/,l="Zepto"+ +new Date;function u(e,t){e=e.replace(/=#\]/g,'="#"]');var n,i,r=o.exec(e);if(r&&r[2]in a&&(n=a[r[2]],i=r[3],e=r[1],i)){var s=Number(i);i=isNaN(s)?i.replace(/^["']|["']$/g,""):s}return t(e,n,i)}t.qsa=function(i,r){return u(r,(function(a,o,u){try{var c;!a&&o?a="*":s.test(a)&&(c=e(i).addClass(l),a="."+l+" "+a);var d=n(i,a)}catch(e){throw console.error("error performing selector: %o",r),e}finally{c&&c.removeClass(l)}return o?t.uniq(e.map(d,(function(e,t){return o.call(e,t,d,u)}))):d}))},t.matches=function(e,t){return u(t,(function(t,n,r){return(!t||i(e,t))&&(!n||n.call(e,null,r)===e)}))}}(_);var S,C,R,w=_,O=[{name:"Chromium",group:"Chrome",identifier:"Chromium/([0-9.]*)"},{name:"Chrome Mobile",group:"Chrome",identifier:"Chrome/([0-9.]*) Mobile",versionIdentifier:"Chrome/([0-9.]*)"},{name:"Chrome",group:"Chrome",identifier:"Chrome/([0-9.]*)"},{name:"Chrome for iOS",group:"Chrome",identifier:"CriOS/([0-9.]*)"},{name:"Android Browser",group:"Chrome",identifier:"CrMo/([0-9.]*)"},{name:"Firefox",group:"Firefox",identifier:"Firefox/([0-9.]*)"},{name:"Opera Mini",group:"Opera",identifier:"Opera Mini/([0-9.]*)"},{name:"Opera",group:"Opera",identifier:"Opera ([0-9.]*)"},{name:"Opera",group:"Opera",identifier:"Opera/([0-9.]*)",versionIdentifier:"Version/([0-9.]*)"},{name:"IEMobile",group:"Explorer",identifier:"IEMobile/([0-9.]*)"},{name:"Internet Explorer",group:"Explorer",identifier:"MSIE ([a-zA-Z0-9.]*)"},{name:"Internet Explorer",group:"Explorer",identifier:"Trident/([0-9.]*)",versionIdentifier:"rv:([0-9.]*)"},{name:"Spartan",group:"Spartan",identifier:"Edge/([0-9.]*)",versionIdentifier:"Edge/([0-9.]*)"},{name:"Safari",group:"Safari",identifier:"Safari/([0-9.]*)",versionIdentifier:"Version/([0-9.]*)"}],L=[{name:"Windows 2000",group:"Windows",identifier:"Windows NT 5.0",version:"5.0"},{name:"Windows XP",group:"Windows",identifier:"Windows NT 5.1",version:"5.1"},{name:"Windows Vista",group:"Windows",identifier:"Windows NT 6.0",version:"6.0"},{name:"Windows 7",group:"Windows",identifier:"Windows NT 6.1",version:"7.0"},{name:"Windows 8",group:"Windows",identifier:"Windows NT 6.2",version:"8.0"},{name:"Windows 8.1",group:"Windows",identifier:"Windows NT 6.3",version:"8.1"},{name:"Windows 10",group:"Windows",identifier:"Windows NT 10.0",version:"10.0"},{name:"Windows Phone",group:"Windows Phone",identifier:"Windows Phone ([0-9.]*)"},{name:"Windows Phone",group:"Windows Phone",identifier:"Windows Phone OS ([0-9.]*)"},{name:"Windows",group:"Windows",identifier:"Windows"},{name:"Chrome OS",group:"Chrome OS",identifier:"CrOS"},{name:"Android",group:"Android",identifier:"Android",versionIdentifier:"Android ([a-zA-Z0-9.-]*)"},{name:"iPad",group:"iOS",identifier:"iPad",versionIdentifier:"OS ([0-9_]*)",versionSeparator:"[_|.]"},{name:"iPod",group:"iOS",identifier:"iPod",versionIdentifier:"OS ([0-9_]*)",versionSeparator:"[_|.]"},{name:"iPhone",group:"iOS",identifier:"iPhone OS",versionIdentifier:"OS ([0-9_]*)",versionSeparator:"[_|.]"},{name:"Mac OS X High Sierra",group:"Mac OS",identifier:"Mac OS X (10([_|.])13([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Sierra",group:"Mac OS",identifier:"Mac OS X (10([_|.])12([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X El Capitan",group:"Mac OS",identifier:"Mac OS X (10([_|.])11([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Yosemite",group:"Mac OS",identifier:"Mac OS X (10([_|.])10([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Mavericks",group:"Mac OS",identifier:"Mac OS X (10([_|.])9([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Mountain Lion",group:"Mac OS",identifier:"Mac OS X (10([_|.])8([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Lion",group:"Mac OS",identifier:"Mac OS X (10([_|.])7([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Snow Leopard",group:"Mac OS",identifier:"Mac OS X (10([_|.])6([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Leopard",group:"Mac OS",identifier:"Mac OS X (10([_|.])5([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Tiger",group:"Mac OS",identifier:"Mac OS X (10([_|.])4([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Panther",group:"Mac OS",identifier:"Mac OS X (10([_|.])3([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Jaguar",group:"Mac OS",identifier:"Mac OS X (10([_|.])2([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Puma",group:"Mac OS",identifier:"Mac OS X (10([_|.])1([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS X Cheetah",group:"Mac OS",identifier:"Mac OS X (10([_|.])0([0-9_.]*))",versionSeparator:"[_|.]"},{name:"Mac OS",group:"Mac OS",identifier:"Mac OS"},{name:"Ubuntu",group:"Linux",identifier:"Ubuntu",versionIdentifier:"Ubuntu/([0-9.]*)"},{name:"Debian",group:"Linux",identifier:"Debian"},{name:"Gentoo",group:"Linux",identifier:"Gentoo"},{name:"Linux",group:"Linux",identifier:"Linux"},{name:"BlackBerry",group:"BlackBerry",identifier:"BlackBerry"}],D={},I=function(e,t){var n=e.split(".",2);t.fullVersion=e,n[0]&&(t.majorVersion=parseInt(n[0])),n[1]&&(t.minorVersion=parseInt(n[1]))},P=function(e,t,n){var i="["==t.substr(0,1)?new RegExp(t,"g"):t,r=e.split(i,2);"."!=t&&(e=e.replace(new RegExp(t,"g"),".")),n.fullVersion=e,r&&r[0]&&(n.majorVersion=parseInt(r[0])),r&&r[1]&&(n.minorVersion=parseInt(r[1]))},x=function(e){var t,n=e.match(/\b(playstation 4|nx|opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(n[1]))return t=/\brv[ :]+(\d+)/g.exec(e)||[],{name:"IE",version:parseInt(t[1]||"")};if("Chrome"===n[1]){if(null!=(t=e.match(/\bOPR\/(\d+)/)))return{name:"Opera",version:parseInt(t[1])};if(null!=(t=e.match(/\bEdge\/(\d+)/)))return{name:"Edge",version:parseInt(t[1])}}else/android/i.test(e)&&(t=e.match(/version\/(\d+)/i))&&(n.splice(1,1,"Android WebView"),n.splice(2,1,t[1]));return{name:(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"])[0],version:parseInt(n[1])}}(navigator.userAgent);D.isEdge=/edge/i.test(navigator.userAgent),D.isChrome=/chrome|CriOS/i.test(navigator.userAgent)&&!D.isEdge,D.isSafari=/safari/i.test(navigator.userAgent)&&!D.isChrome&&!D.isEdge,D.isFirefox=/firefox/i.test(navigator.userAgent),D.isLegacyIE=!!window.ActiveXObject,D.isIE=D.isLegacyIE||/trident.*rv:1\d/i.test(navigator.userAgent),D.isIE11=/trident.*rv:11/i.test(navigator.userAgent),D.isChromecast=D.isChrome&&/CrKey/i.test(navigator.userAgent),D.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Mobile Safari|Opera Mini/i.test(navigator.userAgent),D.isiOS=/iPad|iPhone|iPod/i.test(navigator.userAgent),D.isAndroid=/Android/i.test(navigator.userAgent),D.isWindowsPhone=/Windows Phone/i.test(navigator.userAgent),D.isWin8App=/MSAppHost/i.test(navigator.userAgent),D.isWiiU=/WiiU/i.test(navigator.userAgent),D.isPS4=/PlayStation 4/i.test(navigator.userAgent),D.hasLocalstorage=function(){try{return localStorage.setItem("clappr","clappr"),localStorage.removeItem("clappr"),!0}catch(e){return!1}}(),D.hasFlash=function(){try{return!!new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){return!(!navigator.mimeTypes||void 0===navigator.mimeTypes["application/x-shockwave-flash"]||!navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)}}(),D.name=x.name,D.version=x.version,D.userAgent=navigator.userAgent,D.data=function(){var e,t={},n=D.userAgent.toLowerCase(),i=E(O);try{for(i.s();!(e=i.n()).done;){var r=e.value,a=new RegExp(r.identifier.toLowerCase()).exec(n);if(null!=a&&a[1]){if(t.name=r.name,t.group=r.group,r.versionIdentifier){var o=new RegExp(r.versionIdentifier.toLowerCase()).exec(n);null!=o&&o[1]&&I(o[1],t)}else I(a[1],t);break}}}catch(e){i.e(e)}finally{i.f()}return t}(),D.os=function(){var e,t={},n=D.userAgent.toLowerCase(),i=E(L);try{for(i.s();!(e=i.n()).done;){var r=e.value,a=new RegExp(r.identifier.toLowerCase()).exec(n);if(null!=a){if(t.name=r.name,t.group=r.group,r.version)P(r.version,r.versionSeparator?r.versionSeparator:".",t);else if(a[1])P(a[1],r.versionSeparator?r.versionSeparator:".",t);else if(r.versionIdentifier){var o=new RegExp(r.versionIdentifier.toLowerCase()).exec(n);null!=o&&o[1]&&P(o[1],r.versionSeparator?r.versionSeparator:".",t)}break}}}catch(e){i.e(e)}finally{i.f()}return t}(),D.viewport=((S={}).width=w(window).width(),S.height=w(window).height(),S),D.device=(C=D.userAgent,(R=/\((iP(?:hone|ad|od))?(?:[^;]*; ){0,2}([^)]+(?=\)))/.exec(C))&&(R[1]||R[2])||""),void 0!==window.orientation&&function(){switch(window.orientation){case-90:case 90:D.viewport.orientation="landscape";break;default:D.viewport.orientation="portrait"}}();var N={},M=[],F=(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}).bind(window),B=(window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout).bind(window);function U(e,t){if(t)for(var n in t){var i=Object.getOwnPropertyDescriptor(t,n);i?Object.defineProperty(e,n,i):e[n]=t[n]}return e}function V(e,t){var n=function(e){c(i,e);var n=g(i);function i(){var e;r(this,i);for(var a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];return e=n.call.apply(n,[this].concat(o)),t.initialize&&t.initialize.apply(f(e),o),e}return i}(e);return U(n.prototype,t),n}var j={fullscreenElement:function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},requestFullscreen:function(e){if(e.requestFullscreen)return e.requestFullscreen();if(e.webkitRequestFullscreen){if("function"==typeof e.then)return e.webkitRequestFullscreen();e.webkitRequestFullscreen()}else{if(e.mozRequestFullScreen)return e.mozRequestFullScreen();if(e.msRequestFullscreen)return e.msRequestFullscreen();e.querySelector&&e.querySelector("video")&&e.querySelector("video").webkitEnterFullScreen?e.querySelector("video").webkitEnterFullScreen():e.webkitEnterFullScreen&&e.webkitEnterFullScreen()}},cancelFullscreen:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e.exitFullscreen?e.exitFullscreen():e.webkitCancelFullScreen?e.webkitCancelFullScreen():e.webkitExitFullscreen?e.webkitExitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.msExitFullscreen&&e.msExitFullscreen()},fullscreenEnabled:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},K=function(){function e(){r(this,e)}return o(e,null,[{key:"_defaultConfig",value:function(){return{volume:{value:100,parse:parseInt}}}},{key:"_defaultValueFor",value:function(e){try{return this._defaultConfig()[e].parse(this._defaultConfig()[e].value)}catch(e){return}}},{key:"_createKeyspace",value:function(e){return"clappr.".concat(document.domain,".").concat(e)}},{key:"restore",value:function(e){return D.hasLocalstorage&&localStorage[this._createKeyspace(e)]?this._defaultConfig()[e].parse(localStorage[this._createKeyspace(e)]):this._defaultValueFor(e)}},{key:"persist",value:function(e,t){if(D.hasLocalstorage)try{return localStorage[this._createKeyspace(e)]=t,!0}catch(e){return!1}}}]),e}(),G=function(){function e(){r(this,e)}return o(e,null,[{key:"parse",value:function(e){for(var t,n=/\+/g,i=/([^&=]+)=?([^&]*)/g,r=function(e){return decodeURIComponent(e.replace(n," "))},a={};t=i.exec(e);)a[r(t[1]).toLowerCase()]=r(t[2]);return a}},{key:"params",get:function(){var e=window.location.search.substring(1);return e!==this.query&&(this._urlParams=this.parse(e),this.query=e),this._urlParams}},{key:"hashParams",get:function(){var e=window.location.hash.substring(1);return e!==this.hash&&(this._hashParams=this.parse(e),this.hash=e),this._hashParams}}]),e}();function Y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"t",t=0,n=G.params[e]||G.hashParams[e]||"",i=n.match(/[0-9]+[hms]+/g)||[];if(i.length>0){var r={h:3600,m:60,s:1};i.forEach((function(e){if(e){var n=e[e.length-1],i=parseInt(e.slice(0,e.length-1),10);t+=i*r[n]}}))}else n&&(t=parseInt(n,10));return t}function H(e){return N[e]||(N[e]=0),e+ ++N[e]}function $(e){return e-parseFloat(e)+1>=0}function z(){var e=document.getElementsByTagName("script");return e.length?e[e.length-1].src:""}function W(){return window.navigator&&window.navigator.language}function q(e,t){var n=(t=Object.assign({inline:!1,muted:!1,timeout:250,type:"video",source:k.mp4,element:null},t)).element?t.element:document.createElement(t.type);n.muted=t.muted,!0===t.muted&&n.setAttribute("muted","muted"),!0===t.inline&&n.setAttribute("playsinline","playsinline"),n.src=t.source;var i=n.play(),r=setTimeout((function(){a(!1,new Error("Timeout ".concat(t.timeout," ms has been reached")))}),t.timeout),a=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;clearTimeout(r),e(t,n)};void 0!==i?i.then((function(){return a(!0)})).catch((function(e){return a(!1,e)})):a(!0)}var X=function(){function e(){r(this,e)}return o(e,null,[{key:"configure",value:function(e){this.options=w.extend(!0,this.options,e)}},{key:"create",value:function(e){return this.options.recycleVideo&&"video"===e&&M.length>0?M.shift():document.createElement(e)}},{key:"garbage",value:function(e){this.options.recycleVideo&&"VIDEO"===e.tagName.toUpperCase()&&(w(e).children().remove(),Object.values(e.attributes).forEach((function(t){return e.removeAttribute(t.name)})),M.push(e))}}]),e}();X.options={recycleVideo:!1};var Z=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;r(this,e),this.delay=t,this.lastTime=0}return o(e,[{key:"handle",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=(new Date).getTime(),r=i-this.lastTime;r<this.delay&&r>0&&(t(),n&&e.preventDefault()),this.lastTime=i}}]),e}(),Q={Config:K,Fullscreen:j,QueryString:G,DomRecycler:X,assign:U,extend:V,formatTime:function(e,t){if(!isFinite(e))return"--:--";e*=1e3;var n=(e=parseInt(e/1e3))%60,i=(e=parseInt(e/60))%60,r=(e=parseInt(e/60))%24,a=parseInt(e/24),o="";return a&&a>0&&(o+=a+":",r<1&&(o+="00:")),(r&&r>0||t)&&(o+=("0"+r).slice(-2)+":"),o+=("0"+i).slice(-2)+":",(o+=("0"+n).slice(-2)).trim()},seekStringToSeconds:Y,uniqueId:H,currentScriptUrl:z,isNumber:$,requestAnimationFrame:F,cancelAnimationFrame:B,getBrowserLanguage:W,now:function(){return window.performance&&window.performance.now?performance.now():Date.now()},removeArrayItem:function(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)},listContainsIgnoreCase:function(e,t){return void 0!==e&&void 0!==t&&void 0!==t.find((function(t){return e.toLowerCase()===t.toLowerCase()}))},canAutoPlayMedia:q,Media:k,DoubleEventHandler:Z},J="font-weight: bold; font-size: 13px;",ee="color: #ff8000;"+J,te="color: #ff0000;"+J,ne=["color: #0000ff;font-weight: bold; font-size: 13px;","color: #006600;font-weight: bold; font-size: 13px;",ee,te,te],ie=["debug","info","warn","error","disabled"],re=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;r(this,e),this.EXCLUDE_LIST=["timeupdate","playback:timeupdate","playback:progress","container:hover","container:timeupdate","container:progress"],this.level=t,this.previousLevel=this.level,this.offLevel=n}return o(e,[{key:"level",get:function(){return this._level},set:function(e){this._level=e}}]),o(e,[{key:"debug",value:function(e){this.log(e,0,Array.prototype.slice.call(arguments,1))}},{key:"info",value:function(e){this.log(e,1,Array.prototype.slice.call(arguments,1))}},{key:"warn",value:function(e){this.log(e,2,Array.prototype.slice.call(arguments,1))}},{key:"error",value:function(e){this.log(e,3,Array.prototype.slice.call(arguments,1))}},{key:"onOff",value:function(){this.level===this.offLevel?this.level=this.previousLevel:(this.previousLevel=this.level,this.level=this.offLevel),window.console&&window.console.log&&window.console.log("%c[Clappr.Log] set log level to "+ie[this.level],ee)}},{key:"log",value:function(e,t,n){if(!(this.EXCLUDE_LIST.indexOf(n[0])>=0||t<this.level)){n||(n=e,e=null);var i=ne[t],r="";e&&(r="["+e+"]"),window.console&&window.console.log&&window.console.log.apply(console,["%c["+ie[t]+"]"+r,i].concat(n))}}}]),e}();re.LEVEL_DEBUG=0,re.LEVEL_INFO=1,re.LEVEL_WARN=2,re.LEVEL_ERROR=3,re.getInstance=function(){return void 0===this._instance&&(this._instance=new this),this._instance},re.setLevel=function(e){this.getInstance().level=e},re.debug=function(){this.getInstance().debug.apply(this.getInstance(),arguments)},re.info=function(){this.getInstance().info.apply(this.getInstance(),arguments)},re.warn=function(){this.getInstance().warn.apply(this.getInstance(),arguments)},re.error=function(){this.getInstance().error.apply(this.getInstance(),arguments)};var ae=Array.prototype.slice,oe=/\s+/,se=function(e,t,n,r){if(!n)return!0;if("object"===i(n)){for(var a in n)e[t].apply(e,[a,n[a]].concat(r));return!1}if(oe.test(n)){for(var o=n.split(oe),s=0,l=o.length;s<l;s++)e[t].apply(e,[o[s]].concat(r));return!1}return!0},le=function(e,t,n,i){var r,a=-1,o=e.length,s=t[0],l=t[1],u=t[2];!function c(){try{switch(t.length){case 0:for(;++a<o;)(r=e[a]).callback.call(r.ctx);return;case 1:for(;++a<o;)(r=e[a]).callback.call(r.ctx,s);return;case 2:for(;++a<o;)(r=e[a]).callback.call(r.ctx,s,l);return;case 3:for(;++a<o;)(r=e[a]).callback.call(r.ctx,s,l,u);return;default:for(;++a<o;)(r=e[a]).callback.apply(r.ctx,t);return}}catch(e){re.error.apply(re,[n,"error on event",i,"trigger","-",e]),c()}}()},ue=function(){function e(){r(this,e)}return o(e,[{key:"on",value:function(e,t,n){return se(this,"on",e,[t,n])&&t?(this._events||(this._events={}),(this._events[e]||(this._events[e]=[])).push({callback:t,context:n,ctx:n||this}),this):this}},{key:"once",value:function(e,t,n){var i,r=this;if(!se(this,"once",e,[t,n])||!t)return this;var a=function(){return r.off(e,i)};return i=function(){a(),t.apply(this,arguments)},this.on(e,i,n)}},{key:"off",value:function(e,t,n){var i,r,a,o,s,l,u,c;if(!this._events||!se(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events=void 0,this;for(s=0,l=(o=e?[e]:Object.keys(this._events)).length;s<l;s++)if(e=o[s],a=this._events[e]){if(this._events[e]=i=[],t||n)for(u=0,c=a.length;u<c;u++)r=a[u],(t&&t!==r.callback&&t!==r.callback._callback||n&&n!==r.context)&&i.push(r);i.length||delete this._events[e]}return this}},{key:"trigger",value:function(e){var t=this.name||this.constructor.name;if(re.debug.apply(re,[t].concat(Array.prototype.slice.call(arguments))),!this._events)return this;var n=ae.call(arguments,1);if(!se(this,"trigger",e,n))return this;var i=this._events[e],r=this._events.all;return i&&le(i,n,t,e),r&&le(r,arguments,t,e),this}},{key:"stopListening",value:function(e,t,n){var r=this._listeningTo;if(!r)return this;var a=!t&&!n;for(var o in n||"object"!==i(t)||(n=this),e&&((r={})[e._listenId]=e),r)(e=r[o]).off(t,n,this),(a||0===Object.keys(e._events).length)&&delete this._listeningTo[o];return this}}],[{key:"register",value:function(t){e.Custom||(e.Custom={});var n="string"==typeof t&&t.toUpperCase().trim();n&&!e.Custom[n]?e.Custom[n]=n.toLowerCase().split("_").map((function(e,t){return 0===t?e:e=e[0].toUpperCase()+e.slice(1)})).join(""):re.error("Events","Error when register event: "+t)}},{key:"listAvailableCustomEvents",value:function(){return e.Custom||(e.Custom={}),Object.keys(e.Custom).filter((function(t){return"string"==typeof e.Custom[t]}))}}]),e}(),ce={listenTo:"on",listenToOnce:"once"};Object.keys(ce).forEach((function(e){ue.prototype[e]=function(t,n,r){return(this._listeningTo||(this._listeningTo={}))[t._listenId||(t._listenId=H("l"))]=t,r||"object"!==i(n)||(r=this),t[ce[e]](n,r,this),this}})),ue.PLAYER_READY="ready",ue.PLAYER_RESIZE="resize",ue.PLAYER_FULLSCREEN="fullscreen",ue.PLAYER_PLAY="play",ue.PLAYER_PAUSE="pause",ue.PLAYER_STOP="stop",ue.PLAYER_ENDED="ended",ue.PLAYER_SEEK="seek",ue.PLAYER_ERROR="playererror",ue.ERROR="error",ue.PLAYER_TIMEUPDATE="timeupdate",ue.PLAYER_VOLUMEUPDATE="volumeupdate",ue.PLAYER_SUBTITLE_AVAILABLE="subtitleavailable",ue.PLAYBACK_PROGRESS="playback:progress",ue.PLAYBACK_TIMEUPDATE="playback:timeupdate",ue.PLAYBACK_READY="playback:ready",ue.PLAYBACK_BUFFERING="playback:buffering",ue.PLAYBACK_BUFFERFULL="playback:bufferfull",ue.PLAYBACK_SETTINGSUPDATE="playback:settingsupdate",ue.PLAYBACK_LOADEDMETADATA="playback:loadedmetadata",ue.PLAYBACK_HIGHDEFINITIONUPDATE="playback:highdefinitionupdate",ue.PLAYBACK_BITRATE="playback:bitrate",ue.PLAYBACK_LEVELS_AVAILABLE="playback:levels:available",ue.PLAYBACK_LEVEL_SWITCH_START="playback:levels:switch:start",ue.PLAYBACK_LEVEL_SWITCH_END="playback:levels:switch:end",ue.PLAYBACK_PLAYBACKSTATE="playback:playbackstate",ue.PLAYBACK_DVR="playback:dvr",ue.PLAYBACK_MEDIACONTROL_DISABLE="playback:mediacontrol:disable",ue.PLAYBACK_MEDIACONTROL_ENABLE="playback:mediacontrol:enable",ue.PLAYBACK_ENDED="playback:ended",ue.PLAYBACK_PLAY_INTENT="playback:play:intent",ue.PLAYBACK_PLAY="playback:play",ue.PLAYBACK_PAUSE="playback:pause",ue.PLAYBACK_SEEK="playback:seek",ue.PLAYBACK_SEEKED="playback:seeked",ue.PLAYBACK_STOP="playback:stop",ue.PLAYBACK_ERROR="playback:error",ue.PLAYBACK_STATS_ADD="playback:stats:add",ue.PLAYBACK_FRAGMENT_LOADED="playback:fragment:loaded",ue.PLAYBACK_LEVEL_SWITCH="playback:level:switch",ue.PLAYBACK_SUBTITLE_AVAILABLE="playback:subtitle:available",ue.PLAYBACK_SUBTITLE_CHANGED="playback:subtitle:changed",ue.CORE_CONTAINERS_CREATED="core:containers:created",ue.CORE_ACTIVE_CONTAINER_CHANGED="core:active:container:changed",ue.CORE_OPTIONS_CHANGE="core:options:change",ue.CORE_READY="core:ready",ue.CORE_FULLSCREEN="core:fullscreen",ue.CORE_RESIZE="core:resize",ue.CORE_SCREEN_ORIENTATION_CHANGED="core:screen:orientation:changed",ue.CORE_MOUSE_MOVE="core:mousemove",ue.CORE_MOUSE_LEAVE="core:mouseleave",ue.CONTAINER_PLAYBACKSTATE="container:playbackstate",ue.CONTAINER_PLAYBACKDVRSTATECHANGED="container:dvr",ue.CONTAINER_BITRATE="container:bitrate",ue.CONTAINER_STATS_REPORT="container:stats:report",ue.CONTAINER_DESTROYED="container:destroyed",ue.CONTAINER_READY="container:ready",ue.CONTAINER_RESIZE="container:resize",ue.CONTAINER_ERROR="container:error",ue.CONTAINER_LOADEDMETADATA="container:loadedmetadata",ue.CONTAINER_SUBTITLE_AVAILABLE="container:subtitle:available",ue.CONTAINER_SUBTITLE_CHANGED="container:subtitle:changed",ue.CONTAINER_TIMEUPDATE="container:timeupdate",ue.CONTAINER_PROGRESS="container:progress",ue.CONTAINER_PLAY="container:play",ue.CONTAINER_STOP="container:stop",ue.CONTAINER_PAUSE="container:pause",ue.CONTAINER_ENDED="container:ended",ue.CONTAINER_CLICK="container:click",ue.CONTAINER_DBLCLICK="container:dblclick",ue.CONTAINER_CONTEXTMENU="container:contextmenu",ue.CONTAINER_MOUSE_ENTER="container:mouseenter",ue.CONTAINER_MOUSE_LEAVE="container:mouseleave",ue.CONTAINER_MOUSE_UP="container:mouseup",ue.CONTAINER_MOUSE_DOWN="container:mousedown",ue.CONTAINER_SEEK="container:seek",ue.CONTAINER_SEEKED="container:seeked",ue.CONTAINER_VOLUME="container:volume",ue.CONTAINER_FULLSCREEN="container:fullscreen",ue.CONTAINER_STATE_BUFFERING="container:state:buffering",ue.CONTAINER_STATE_BUFFERFULL="container:state:bufferfull",ue.CONTAINER_SETTINGSUPDATE="container:settingsupdate",ue.CONTAINER_HIGHDEFINITIONUPDATE="container:highdefinitionupdate",ue.CONTAINER_MEDIACONTROL_SHOW="container:mediacontrol:show",ue.CONTAINER_MEDIACONTROL_HIDE="container:mediacontrol:hide",ue.CONTAINER_MEDIACONTROL_DISABLE="container:mediacontrol:disable",ue.CONTAINER_MEDIACONTROL_ENABLE="container:mediacontrol:enable",ue.CONTAINER_STATS_ADD="container:stats:add",ue.CONTAINER_OPTIONS_CHANGE="container:options:change",ue.MEDIACONTROL_RENDERED="mediacontrol:rendered",ue.MEDIACONTROL_FULLSCREEN="mediacontrol:fullscreen",ue.MEDIACONTROL_SHOW="mediacontrol:show",ue.MEDIACONTROL_HIDE="mediacontrol:hide",ue.MEDIACONTROL_MOUSEMOVE_SEEKBAR="mediacontrol:mousemove:seekbar",ue.MEDIACONTROL_MOUSELEAVE_SEEKBAR="mediacontrol:mouseleave:seekbar",ue.MEDIACONTROL_PLAYING="mediacontrol:playing",ue.MEDIACONTROL_NOTPLAYING="mediacontrol:notplaying",ue.MEDIACONTROL_CONTAINERCHANGED="mediacontrol:containerchanged",ue.MEDIACONTROL_OPTIONS_CHANGE="mediacontrol:options:change";var de=function(e){c(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(this,n),(e=t.call(this,i))._options=i,e.uniqueId=H("o"),e}return o(n,[{key:"options",get:function(){return this._options}}]),n}(ue),he={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},fe=/(.)^/,pe={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},ge=/\\|'|\r|\n|\t|\u2028|\u2029/g,ve={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},me=new RegExp("[&<>\"']","g"),ye=function(e){return null===e?"":(""+e).replace(me,(function(e){return ve[e]}))},Ae=0,be=function(e,t){var n,i=new RegExp([(he.escape||fe).source,(he.interpolate||fe).source,(he.evaluate||fe).source].join("|")+"|$","g"),r=0,a="__p+='";e.replace(i,(function(t,n,i,o,s){return a+=e.slice(r,s).replace(ge,(function(e){return"\\"+pe[e]})),n&&(a+="'+\n((__t=("+n+"))==null?'':escapeExpr(__t))+\n'"),i&&(a+="'+\n((__t=("+i+"))==null?'':__t)+\n'"),o&&(a+="';\n"+o+"\n__p+='"),r=s+t.length,t})),a+="';\n",he.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n//# sourceURL=/microtemplates/source["+Ae+++"]";try{n=new Function(he.variable||"obj","escapeExpr",a)}catch(e){throw e.source=a,e}if(t)return n(t,ye);var o=function(e){return n.call(this,e,ye)};return o.source="function("+(he.variable||"obj")+"){\n"+a+"}",o};be.settings=he;var Ee={getStyleFor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{baseUrl:""};return w('<style class="clappr-style"></style>').html(be(e.toString())(t))}},Te=/^(\S+)\s*(.*)$/,ke=function(e){c(n,e);var t=g(n);function n(e){var i;return r(this,n),(i=t.call(this,e)).cid=H("c"),i._ensureElement(),i.delegateEvents(),i}return o(n,[{key:"tagName",get:function(){return"div"}},{key:"events",get:function(){return{}}},{key:"attributes",get:function(){return{}}}]),o(n,[{key:"$",value:function(e){return this.$el.find(e)}},{key:"render",value:function(){return this}},{key:"destroy",value:function(){return this.$el.remove(),this.stopListening(),this.undelegateEvents(),this}},{key:"setElement",value:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=w.zepto.isZ(e)?e:w(e),this.el=this.$el[0],!1!==t&&this.delegateEvents(),this}},{key:"delegateEvents",value:function(e){for(var t in e||(e=this.events),this.undelegateEvents(),e){var n=e[t];if(n&&n.constructor!==Function&&(n=this[e[t]]),n){var i=t.match(Te),r=i[1],a=i[2];r+=".delegateEvents"+this.cid,""===a?this.$el.on(r,n.bind(this)):this.$el.on(r,a,n.bind(this))}}return this}},{key:"undelegateEvents",value:function(){return this.$el.off(".delegateEvents"+this.cid),this}},{key:"_ensureElement",value:function(){if(this.el)this.setElement(this.el,!1);else{var e=w.extend(!0,{},this.attributes);this.id&&(e.id=this.id),this.className&&(e.class=this.className);var t=w(X.create(this.tagName)).attr(e);this.setElement(t,!1)}}}]),n}(de),_e=function(e){c(n,e);var t=g(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;return r(this,n),(e=t.call(this,i)).core=a,e}return o(n,[{key:"name",get:function(){return"error"}}],[{key:"Levels",get:function(){return{FATAL:"FATAL",WARN:"WARN",INFO:"INFO"}}}]),o(n,[{key:"createError",value:function(e){this.core?this.core.trigger(ue.ERROR,e):re.warn(this.name,"Core is not set. Error: ",e)}}]),n}(de),Se={createError:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{useCodePrefix:!0},n=this.constructor&&this.constructor.type||"",i=this.name||n,r=this.i18n||this.core&&this.core.i18n||this.container&&this.container.i18n,a="".concat(i,":").concat(e&&e.code||"unknown"),o={description:"",level:_e.Levels.FATAL,origin:i,scope:n,raw:{}},s=Object.assign({},o,e,{code:t.useCodePrefix?a:e.code});if(r&&s.level==_e.Levels.FATAL&&!s.UI){var l={title:r.t("default_error_title"),message:r.t("default_error_message")};s.UI=l}return this.playerError?this.playerError.createError(s):re.warn(i,"PlayerError is not defined. Error: ",s),s}},Ce=function(e){c(n,e);var t=g(n);function n(e){var i;return r(this,n),(i=t.call(this,e.options)).core=e,i.enabled=!0,i.bindEvents(),i.render(),i}return o(n,[{key:"playerError",get:function(){return this.core.playerError}}]),o(n,[{key:"bindEvents",value:function(){}},{key:"getExternalInterface",value:function(){return{}}},{key:"enable",value:function(){this.enabled||(this.bindEvents(),this.$el.show(),this.enabled=!0)}},{key:"disable",value:function(){this.stopListening(),this.$el.hide(),this.enabled=!1}},{key:"render",value:function(){return this}}]),n}(ke);Object.assign(Ce.prototype,Se),Ce.extend=function(e){return V(Ce,e)},Ce.type="core";var Re=function(e){c(n,e);var t=g(n);function n(e,i,a){var o;return r(this,n),(o=t.call(this,e))._i18n=i,o.currentTime=0,o.volume=100,o.playback=e.playback,o.playerError=a,o.settings=w.extend(!0,{},o.playback.settings),o.isReady=!1,o.mediaControlDisabled=!1,o.plugins=[o.playback],o.dblTapHandler=new Z(500),o.clickTimer=null,o.clickDelay=200,o.actionsMetadata={},o.bindEvents(),o}return o(n,[{key:"name",get:function(){return"Container"}},{key:"attributes",get:function(){return{class:"container","data-container":""}}},{key:"events",get:function(){return{click:"clicked",dblclick:"dblClicked",touchend:"dblTap",contextmenu:"onContextMenu",mouseenter:"mouseEnter",mouseleave:"mouseLeave",mouseup:"onMouseUp",mousedown:"onMouseDown"}}},{key:"ended",get:function(){return this.playback.ended}},{key:"buffering",get:function(){return this.playback.buffering}},{key:"i18n",get:function(){return this._i18n}},{key:"hasClosedCaptionsTracks",get:function(){return this.playback.hasClosedCaptionsTracks}},{key:"closedCaptionsTracks",get:function(){return this.playback.closedCaptionsTracks}},{key:"closedCaptionsTrackId",get:function(){return this.playback.closedCaptionsTrackId},set:function(e){this.playback.closedCaptionsTrackId=e}}]),o(n,[{key:"bindEvents",value:function(){this.listenTo(this.playback,ue.PLAYBACK_PROGRESS,this.onProgress),this.listenTo(this.playback,ue.PLAYBACK_TIMEUPDATE,this.timeUpdated),this.listenTo(this.playback,ue.PLAYBACK_READY,this.ready),this.listenTo(this.playback,ue.PLAYBACK_BUFFERING,this.onBuffering),this.listenTo(this.playback,ue.PLAYBACK_BUFFERFULL,this.bufferfull),this.listenTo(this.playback,ue.PLAYBACK_SETTINGSUPDATE,this.settingsUpdate),this.listenTo(this.playback,ue.PLAYBACK_LOADEDMETADATA,this.loadedMetadata),this.listenTo(this.playback,ue.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinitionUpdate),this.listenTo(this.playback,ue.PLAYBACK_BITRATE,this.updateBitrate),this.listenTo(this.playback,ue.PLAYBACK_PLAYBACKSTATE,this.playbackStateChanged),this.listenTo(this.playback,ue.PLAYBACK_DVR,this.playbackDvrStateChanged),this.listenTo(this.playback,ue.PLAYBACK_MEDIACONTROL_DISABLE,this.disableMediaControl),this.listenTo(this.playback,ue.PLAYBACK_MEDIACONTROL_ENABLE,this.enableMediaControl),this.listenTo(this.playback,ue.PLAYBACK_SEEK,this.onSeek),this.listenTo(this.playback,ue.PLAYBACK_SEEKED,this.onSeeked),this.listenTo(this.playback,ue.PLAYBACK_ENDED,this.onEnded),this.listenTo(this.playback,ue.PLAYBACK_PLAY,this.playing),this.listenTo(this.playback,ue.PLAYBACK_PAUSE,this.paused),this.listenTo(this.playback,ue.PLAYBACK_STOP,this.stopped),this.listenTo(this.playback,ue.PLAYBACK_ERROR,this.error),this.listenTo(this.playback,ue.PLAYBACK_SUBTITLE_AVAILABLE,this.subtitleAvailable),this.listenTo(this.playback,ue.PLAYBACK_SUBTITLE_CHANGED,this.subtitleChanged)}},{key:"subtitleAvailable",value:function(){this.trigger(ue.CONTAINER_SUBTITLE_AVAILABLE)}},{key:"subtitleChanged",value:function(e){this.trigger(ue.CONTAINER_SUBTITLE_CHANGED,e)}},{key:"playbackStateChanged",value:function(e){this.trigger(ue.CONTAINER_PLAYBACKSTATE,e)}},{key:"playbackDvrStateChanged",value:function(e){this.settings=this.playback.settings,this.dvrInUse=e,this.trigger(ue.CONTAINER_PLAYBACKDVRSTATECHANGED,e)}},{key:"updateBitrate",value:function(e){this.trigger(ue.CONTAINER_BITRATE,e)}},{key:"statsReport",value:function(e){this.trigger(ue.CONTAINER_STATS_REPORT,e)}},{key:"getPlaybackType",value:function(){return this.playback.getPlaybackType()}},{key:"isDvrEnabled",value:function(){return!!this.playback.dvrEnabled}},{key:"isDvrInUse",value:function(){return!!this.dvrInUse}},{key:"destroy",value:function(){this.disableResizeObserver(),this.trigger(ue.CONTAINER_DESTROYED,this,this.name),this.stopListening(),this.plugins.forEach((function(e){return e.destroy()})),this.$el.remove()}},{key:"setStyle",value:function(e){this.$el.css(e)}},{key:"animate",value:function(e,t){return this.$el.animate(e,t).promise()}},{key:"ready",value:function(){this.isReady=!0,this.trigger(ue.CONTAINER_READY,this.name)}},{key:"isPlaying",value:function(){return this.playback.isPlaying()}},{key:"getStartTimeOffset",value:function(){return this.playback.getStartTimeOffset()}},{key:"getCurrentTime",value:function(){return this.currentTime}},{key:"getDuration",value:function(){return this.playback.getDuration()}},{key:"error",value:function(e){this.isReady||this.ready(),this.trigger(ue.CONTAINER_ERROR,e,this.name)}},{key:"loadedMetadata",value:function(e){this.trigger(ue.CONTAINER_LOADEDMETADATA,e)}},{key:"timeUpdated",value:function(e){this.currentTime=e.current,this.trigger(ue.CONTAINER_TIMEUPDATE,e,this.name)}},{key:"onProgress",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.trigger.apply(this,[ue.CONTAINER_PROGRESS].concat(t,[this.name]))}},{key:"playing",value:function(){this.trigger(ue.CONTAINER_PLAY,this.name,this.actionsMetadata.playEvent||{}),this.actionsMetadata.playEvent={}}},{key:"paused",value:function(){this.trigger(ue.CONTAINER_PAUSE,this.name,this.actionsMetadata.pauseEvent||{}),this.actionsMetadata.pauseEvent={}}},{key:"stopped",value:function(){this.trigger(ue.CONTAINER_STOP,this.actionsMetadata.stopEvent||{}),this.actionsMetadata.stopEvent={}}},{key:"play",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.actionsMetadata.playEvent=e,this.playback.play(e)}},{key:"stop",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.actionsMetadata.stopEvent=e,this.playback.stop(e),this.currentTime=0}},{key:"pause",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.actionsMetadata.pauseEvent=e,this.playback.pause(e)}},{key:"onEnded",value:function(){this.trigger(ue.CONTAINER_ENDED,this,this.name),this.currentTime=0}},{key:"clicked",value:function(){var e=this;this.options.chromeless&&!this.options.allowUserInteraction||(this.clickTimer=setTimeout((function(){e.clickTimer&&e.trigger(ue.CONTAINER_CLICK,e,e.name)}),this.clickDelay))}},{key:"cancelClicked",value:function(){clearTimeout(this.clickTimer),this.clickTimer=null}},{key:"dblClicked",value:function(){this.options.chromeless&&!this.options.allowUserInteraction||(this.cancelClicked(),this.trigger(ue.CONTAINER_DBLCLICK,this,this.name))}},{key:"dblTap",value:function(e){var t=this;this.options.chromeless&&!this.options.allowUserInteraction||this.dblTapHandler.handle(e,(function(){t.cancelClicked(),t.trigger(ue.CONTAINER_DBLCLICK,t,t.name)}))}},{key:"onContextMenu",value:function(e){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(ue.CONTAINER_CONTEXTMENU,e,this.name)}},{key:"seek",value:function(e){this.playback.seek(e)}},{key:"onSeek",value:function(e){this.trigger(ue.CONTAINER_SEEK,e,this.name)}},{key:"onSeeked",value:function(){this.trigger(ue.CONTAINER_SEEKED,this.name)}},{key:"seekPercentage",value:function(e){var t=this.getDuration();if(e>=0&&e<=100){var n=t*(e/100);this.seek(n)}}},{key:"setVolume",value:function(e){this.volume=parseFloat(e),this.trigger(ue.CONTAINER_VOLUME,this.volume,this.name),this.playback.volume(this.volume)}},{key:"fullscreen",value:function(){this.trigger(ue.CONTAINER_FULLSCREEN,this.name)}},{key:"onBuffering",value:function(){this.trigger(ue.CONTAINER_STATE_BUFFERING,this.name)}},{key:"bufferfull",value:function(){this.trigger(ue.CONTAINER_STATE_BUFFERFULL,this.name)}},{key:"addPlugin",value:function(e){this.plugins.push(e)}},{key:"hasPlugin",value:function(e){return!!this.getPlugin(e)}},{key:"getPlugin",value:function(e){return this.plugins.filter((function(t){return t.name===e}))[0]}},{key:"mouseEnter",value:function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(ue.CONTAINER_MOUSE_ENTER)}},{key:"mouseLeave",value:function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(ue.CONTAINER_MOUSE_LEAVE)}},{key:"mouseUp",value:function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(ue.CONTAINER_MOUSE_UP)}},{key:"mouseDown",value:function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(ue.CONTAINER_MOUSE_DOWN)}},{key:"settingsUpdate",value:function(){this.settings=this.playback.settings,this.trigger(ue.CONTAINER_SETTINGSUPDATE)}},{key:"highDefinitionUpdate",value:function(e){this.trigger(ue.CONTAINER_HIGHDEFINITIONUPDATE,e)}},{key:"isHighDefinitionInUse",value:function(){return this.playback.isHighDefinitionInUse()}},{key:"disableMediaControl",value:function(){this.mediaControlDisabled||(this.mediaControlDisabled=!0,this.trigger(ue.CONTAINER_MEDIACONTROL_DISABLE))}},{key:"enableMediaControl",value:function(){this.mediaControlDisabled&&(this.mediaControlDisabled=!1,this.trigger(ue.CONTAINER_MEDIACONTROL_ENABLE))}},{key:"updateStyle",value:function(){!this.options.chromeless||this.options.allowUserInteraction?this.$el.removeClass("chromeless"):this.$el.addClass("chromeless")}},{key:"enableResizeObserver",value:function(){var e=this;this.disableResizeObserver(),this.resizeObserverInterval=setInterval((function(){return e.checkResize()}),500)}},{key:"disableResizeObserver",value:function(){this.resizeObserverInterval&&clearInterval(this.resizeObserverInterval)}},{key:"checkResize",value:function(){var e={width:this.el.clientWidth,height:this.el.clientHeight},t=this.currentSize||{},n=t.width;(t.height!==e.height||n!==e.width)&&(this.currentSize=e,this.trigger(ue.CONTAINER_RESIZE,e))}},{key:"configure",value:function(e){this._options=w.extend(!0,this._options,e),this.updateStyle(),this.playback.configure(this.options),this.trigger(ue.CONTAINER_OPTIONS_CHANGE)}},{key:"render",value:function(){var e=Ee.getStyleFor(".container[data-container] {\n position: absolute;\n background-color: black;\n height: 100%;\n width: 100%;\n max-width: 100%; }\n .container[data-container] .chromeless {\n cursor: default; }\n\n[data-player]:not(.nocursor) .container[data-container]:not(.chromeless).pointer-enabled {\n cursor: pointer; }\n".toString(),{baseUrl:this.options.baseUrl});return this.$el.append(e[0]),this.$el.append(this.playback.render().el),this.updateStyle(),this.checkResize(),this.enableResizeObserver(),this}}]),n}(ke);Object.assign(Re.prototype,Se);var we=function(e){c(n,e);var t=g(n);function n(e,i,a){var o;return r(this,n),(o=t.call(this,e)).settings={},o._i18n=i,o.playerError=a,o._consented=!1,o}return o(n,[{key:"isAudioOnly",get:function(){return!1}},{key:"isAdaptive",get:function(){return!1}},{key:"ended",get:function(){return!1}},{key:"i18n",get:function(){return this._i18n}},{key:"buffering",get:function(){return!1}}]),o(n,[{key:"consent",value:function(e){"function"==typeof e&&e()}},{key:"play",value:function(){}},{key:"pause",value:function(){}},{key:"stop",value:function(){}},{key:"seek",value:function(e){}},{key:"seekPercentage",value:function(e){}},{key:"getStartTimeOffset",value:function(){return 0}},{key:"getDuration",value:function(){return 0}},{key:"isPlaying",value:function(){return!1}},{key:"getPlaybackType",value:function(){return n.NO_OP}},{key:"isHighDefinitionInUse",value:function(){return!1}},{key:"mute",value:function(){}},{key:"unmute",value:function(){}},{key:"volume",value:function(e){}},{key:"configure",value:function(e){this._options=w.extend(!0,this._options,e)}},{key:"attemptAutoPlay",value:function(){var e=this;this.canAutoPlay((function(t,n){t&&e.play()}))}},{key:"canAutoPlay",value:function(e){e(!0,null)}},{key:"isReady",get:function(){return!1}},{key:"hasClosedCaptionsTracks",get:function(){return this.closedCaptionsTracks.length>0}},{key:"closedCaptionsTracks",get:function(){return[]}},{key:"closedCaptionsTrackId",get:function(){return-1},set:function(e){}}]),n}(ke);Object.assign(we.prototype,Se),we.extend=function(e){return V(we,e)},we.canPlay=function(e,t){return!1},we.VOD="vod",we.AOD="aod",we.LIVE="live",we.NO_OP="no_op",we.type="playback";var Oe=function(e){c(n,e);var t=g(n);function n(e,i,a,o){var s;return r(this,n),(s=t.call(this,e))._i18n=a,s.loader=i,s.playerError=o,s}return o(n,[{key:"options",get:function(){return this._options},set:function(e){this._options=e}}]),o(n,[{key:"createContainers",value:function(){var e=this;return w.Deferred((function(t){t.resolve(e.options.sources.map((function(t){return e.createContainer(t)})))}))}},{key:"findPlaybackPlugin",value:function(e,t){return this.loader.playbackPlugins.filter((function(n){return n.canPlay(e,t)}))[0]}},{key:"createContainer",value:function(e){var t=null,n=this.options.mimeType;"object"===i(e)?(t=e.source.toString(),e.mimeType&&(n=e.mimeType)):t=e.toString(),t.match(/^\/\//)&&(t=window.location.protocol+t);var r=u(u({},this.options),{},{src:t,mimeType:n}),a=this.findPlaybackPlugin(t,n),o=a?new a(r,this._i18n,this.playerError):new we;r=u(u({},r),{},{playback:o});var s=new Re(r,this._i18n,this.playerError),l=w.Deferred();return l.promise(s),this.addContainerPlugins(s),this.listenToOnce(s,ue.CONTAINER_READY,(function(){return l.resolve(s)})),s}},{key:"addContainerPlugins",value:function(e){this.loader.containerPlugins.forEach((function(t){e.addPlugin(new t(e))}))}}]),n}(de),Le=function(e){c(n,e);var t=g(n);function n(e){var i;return r(this,n),(i=t.call(this,e)).playerError=new _e(e,f(i)),i.configureDomRecycler(),i.firstResize=!0,i.plugins=[],i.containers=[],i._boundFullscreenHandler=function(){return i.handleFullscreenChange()},w(document).bind("fullscreenchange",i._boundFullscreenHandler),w(document).bind("MSFullscreenChange",i._boundFullscreenHandler),w(document).bind("mozfullscreenchange",i._boundFullscreenHandler),D.isMobile&&w(window).bind("resize",(function(e){i.handleWindowResize(e)})),i}return o(n,[{key:"events",get:function(){return{webkitfullscreenchange:"handleFullscreenChange",mousemove:"onMouseMove",mouseleave:"onMouseLeave"}}},{key:"attributes",get:function(){return{"data-player":"",tabindex:9999}}},{key:"isReady",get:function(){return!!this.ready}},{key:"i18n",get:function(){return this.getPlugin("strings")||{t:function(e){return e}}}},{key:"mediaControl",get:function(){return this._mediaControl||(this._mediaControl=this.getPlugin("media_control"))||this.dummyMediaControl}},{key:"dummyMediaControl",get:function(){return this._dummyMediaControl||(this._dummyMediaControl=new Ce(this)),this._dummyMediaControl}},{key:"activeContainer",get:function(){return this._activeContainer},set:function(e){this._activeContainer=e,this.trigger(ue.CORE_ACTIVE_CONTAINER_CHANGED,this._activeContainer)}},{key:"activePlayback",get:function(){return this.activeContainer&&this.activeContainer.playback}}]),o(n,[{key:"configureDomRecycler",value:function(){var e=this.options&&this.options.playback&&this.options.playback.recycleVideo;X.configure({recycleVideo:e})}},{key:"createContainers",value:function(e){this.defer=w.Deferred(),this.defer.promise(this),this.containerFactory=new Oe(e,e.loader,this.i18n,this.playerError),this.prepareContainers()}},{key:"prepareContainers",value:function(){var e=this;this.containerFactory.createContainers().then((function(t){return e.setupContainers(t)})).then((function(t){return e.resolveOnContainersReady(t)}))}},{key:"updateSize",value:function(){this.isFullscreen()?this.setFullscreen():this.setPlayerSize()}},{key:"setFullscreen",value:function(){D.isiOS||(this.$el.addClass("fullscreen"),this.$el.removeAttr("style"),this.previousSize={width:this.options.width,height:this.options.height},this.currentSize={width:w(window).width(),height:w(window).height()})}},{key:"setPlayerSize",value:function(){this.$el.removeClass("fullscreen"),this.currentSize=this.previousSize,this.previousSize={width:w(window).width(),height:w(window).height()},this.resize(this.currentSize)}},{key:"resize",value:function(e){$(e.height)||$(e.width)?(this.el.style.height="".concat(e.height,"px"),this.el.style.width="".concat(e.width,"px")):(this.el.style.height="".concat(e.height),this.el.style.width="".concat(e.width)),this.previousSize={width:this.options.width,height:this.options.height},this.options.width=e.width,this.options.height=e.height,this.currentSize=e,this.triggerResize(this.currentSize)}},{key:"enableResizeObserver",value:function(){var e=this;this.disableResizeObserver();this.resizeObserverInterval=setInterval((function(){e.triggerResize({width:e.el.clientWidth,height:e.el.clientHeight})}),500)}},{key:"triggerResize",value:function(e){(this.firstResize||this.oldHeight!==e.height||this.oldWidth!==e.width)&&(this.oldHeight=e.height,this.oldWidth=e.width,this.computedSize=e,this.firstResize=!1,this.trigger(ue.CORE_RESIZE,e))}},{key:"disableResizeObserver",value:function(){this.resizeObserverInterval&&clearInterval(this.resizeObserverInterval),this.resizeObserverInterval=null}},{key:"resolveOnContainersReady",value:function(e){var t=this;w.when.apply(w,e).done((function(){t.defer.resolve(t),t.ready=!0,t.trigger(ue.CORE_READY)}))}},{key:"addPlugin",value:function(e){this.plugins.push(e)}},{key:"hasPlugin",value:function(e){return!!this.getPlugin(e)}},{key:"getPlugin",value:function(e){return this.plugins.filter((function(t){return t.name===e}))[0]}},{key:"load",value:function(e,t){this.options.mimeType=t,e=e&&e.constructor===Array?e:[e],this.options.sources=e,this.containers.forEach((function(e){return e.destroy()})),this.containerFactory.options=w.extend(!0,this.options,{sources:e}),this.prepareContainers()}},{key:"destroy",value:function(){this.disableResizeObserver(),this.containers.forEach((function(e){return e.destroy()})),this.plugins.forEach((function(e){return e.destroy()})),this.$el.remove(),w(document).unbind("fullscreenchange",this._boundFullscreenHandler),w(document).unbind("MSFullscreenChange",this._boundFullscreenHandler),w(document).unbind("mozfullscreenchange",this._boundFullscreenHandler),this.stopListening()}},{key:"handleFullscreenChange",value:function(){this.trigger(ue.CORE_FULLSCREEN,this.isFullscreen()),this.updateSize()}},{key:"handleWindowResize",value:function(e){var t=window.innerWidth>window.innerHeight?"landscape":"portrait";this._screenOrientation!==t&&(this._screenOrientation=t,this.triggerResize({width:this.el.clientWidth,height:this.el.clientHeight}),this.trigger(ue.CORE_SCREEN_ORIENTATION_CHANGED,{event:e,orientation:this._screenOrientation}))}},{key:"removeContainer",value:function(e){this.stopListening(e),this.containers=this.containers.filter((function(t){return t!==e}))}},{key:"setupContainer",value:function(e){this.listenTo(e,ue.CONTAINER_DESTROYED,this.removeContainer),this.containers.push(e)}},{key:"setupContainers",value:function(e){return e.forEach(this.setupContainer.bind(this)),this.trigger(ue.CORE_CONTAINERS_CREATED),this.renderContainers(),this.activeContainer=e[0],this.render(),this.appendToParent(),this.containers}},{key:"renderContainers",value:function(){var e=this;this.containers.forEach((function(t){return e.el.appendChild(t.render().el)}))}},{key:"createContainer",value:function(e,t){var n=this.containerFactory.createContainer(e,t);return this.setupContainer(n),this.el.appendChild(n.render().el),n}},{key:"getCurrentContainer",value:function(){return this.activeContainer}},{key:"getCurrentPlayback",value:function(){return this.activePlayback}},{key:"getPlaybackType",value:function(){return this.activeContainer&&this.activeContainer.getPlaybackType()}},{key:"isFullscreen",value:function(){var e=j.fullscreenElement();if(!e)return!1;var t=this.activePlayback&&this.activePlayback.el;return e===this.el||e===t}},{key:"toggleFullscreen",value:function(){var e=this;if(this.isFullscreen())j.cancelFullscreen(),!D.isiOS&&this.$el.removeClass("fullscreen nocursor");else{var t=D.isiOS?this.activePlayback&&this.activePlayback.el:this.el;if(!t)return;D.isSafari||D.isiOS?j.requestFullscreen(t):j.requestFullscreen(t).then((function(e){return e}),(function(t){return setTimeout((function(){if(!e.isFullscreen())throw new ReferenceError(t)}),600)})),!D.isiOS&&this.$el.addClass("fullscreen")}}},{key:"onMouseMove",value:function(e){this.trigger(ue.CORE_MOUSE_MOVE,e)}},{key:"onMouseLeave",value:function(e){this.trigger(ue.CORE_MOUSE_LEAVE,e)}},{key:"configure",value:function(e){var t=this;this._options=w.extend(!0,this._options,e),this.configureDomRecycler();var n=e.source||e.sources;n&&this.load(n,e.mimeType||this.options.mimeType),this.trigger(ue.CORE_OPTIONS_CHANGE,e),this.containers.forEach((function(e){return e.configure(t.options)}))}},{key:"appendToParent",value:function(){var e=Ee.getStyleFor('[data-player] {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n transform: translate3d(0, 0, 0);\n position: relative;\n margin: 0;\n padding: 0;\n border: 0;\n font-style: normal;\n font-weight: normal;\n text-align: center;\n overflow: hidden;\n font-size: 100%;\n font-family: "Roboto", "Open Sans", Arial, sans-serif;\n text-shadow: 0 0 0;\n box-sizing: border-box; }\n [data-player]:focus {\n outline: 0; }\n [data-player] * {\n box-sizing: inherit; }\n [data-player] > * {\n float: none;\n max-width: none; }\n [data-player] > div {\n display: block; }\n [data-player].fullscreen {\n width: 100% !important;\n height: 100% !important;\n top: 0;\n left: 0; }\n [data-player].nocursor {\n cursor: none; }\n\n.clappr-style {\n display: none !important; }\n'.toString(),{baseUrl:this.options.baseUrl}),t=Ee.getStyleFor('[data-player] div, [data-player] span, [data-player] applet, [data-player] object, [data-player] iframe,\n[data-player] h1, [data-player] h2, [data-player] h3, [data-player] h4, [data-player] h5, [data-player] h6, [data-player] p, [data-player] blockquote, [data-player] pre,\n[data-player] a, [data-player] abbr, [data-player] acronym, [data-player] address, [data-player] big, [data-player] cite, [data-player] code,\n[data-player] del, [data-player] dfn, [data-player] em, [data-player] img, [data-player] ins, [data-player] kbd, [data-player] q, [data-player] s, [data-player] samp,\n[data-player] small, [data-player] strike, [data-player] strong, [data-player] sub, [data-player] sup, [data-player] tt, [data-player] var,\n[data-player] b, [data-player] u, [data-player] i, [data-player] center,\n[data-player] dl, [data-player] dt, [data-player] dd, [data-player] ol, [data-player] ul, [data-player] li,\n[data-player] fieldset, [data-player] form, [data-player] label, [data-player] legend,\n[data-player] table, [data-player] caption, [data-player] tbody, [data-player] tfoot, [data-player] thead, [data-player] tr, [data-player] th, [data-player] td,\n[data-player] article, [data-player] aside, [data-player] canvas, [data-player] details, [data-player] embed,\n[data-player] figure, [data-player] figcaption, [data-player] footer, [data-player] header, [data-player] hgroup,\n[data-player] menu, [data-player] nav, [data-player] output, [data-player] ruby, [data-player] section, [data-player] summary,\n[data-player] time, [data-player] mark, [data-player] audio, [data-player] video {\n margin: 0;\n padding: 0;\n border: 0;\n font: inherit;\n font-size: 100%;\n vertical-align: baseline; }\n\n[data-player] table {\n border-collapse: collapse;\n border-spacing: 0; }\n\n[data-player] caption, [data-player] th, [data-player] td {\n text-align: left;\n font-weight: normal;\n vertical-align: middle; }\n\n[data-player] q, [data-player] blockquote {\n quotes: none; }\n [data-player] q:before, [data-player] q:after, [data-player] blockquote:before, [data-player] blockquote:after {\n content: "";\n content: none; }\n\n[data-player] a img {\n border: none; }\n'.toString(),{baseUrl:this.options.baseUrl});this.$el.append(e[0]),this.options.includeResetStyle&&this.$el.append(t[0]),!(this.$el.parent()&&this.$el.parent().length)&&this.$el.appendTo(this.options.parentElement)}},{key:"render",value:function(){this.options.width=this.options.width||this.$el.width(),this.options.height=this.options.height||this.$el.height();var e={width:this.options.width,height:this.options.height};return this.previousSize=this.currentSize=this.computedSize=e,this.updateSize(),this.enableResizeObserver(),this}}]),n}(ke);Object.assign(Le.prototype,Se);var De,Ie,Pe=function(e){c(n,e);var t=g(n);function n(e){var i;return r(this,n),(i=t.call(this,e.options)).player=e,i}return o(n,[{key:"loader",get:function(){return this.player.loader}}]),o(n,[{key:"create",value:function(){return this.options.loader=this.loader,this.core=new Le(this.options),this.addCorePlugins(),this.core.createContainers(this.options),this.core}},{key:"addCorePlugins",value:function(){var e=this;return this.loader.corePlugins.forEach((function(t){var n=new t(e.core);e.core.addPlugin(n),e.setupExternalInterface(n)})),this.core}},{key:"setupExternalInterface",value:function(e){var t=e.getExternalInterface();for(var n in t)this.player[n]=t[n].bind(e)}}]),n}(de),xe=/(\d+)(?:\.(\d+))?(?:\.(\d+))?/,Ne=function(){function e(t,n,i){r(this,e),this.major=parseInt(t||0,10),this.minor=parseInt(n||0,10),this.patch=parseInt(i||0,10)}return o(e,null,[{key:"parse",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=t.match(xe)||[],i=m(n,4),r=i[1],a=i[2],o=i[3];return void 0===r?null:new e(r,a,o)}}]),o(e,[{key:"compare",value:function(e){var t=this.major-e.major;return t=(t=t||this.minor-e.minor)||this.patch-e.patch}},{key:"inc",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"patch";return void 0!==this[e]&&(this[e]+=1),this}},{key:"satisfies",value:function(e,t){return this.compare(e)>=0&&(!t||this.compare(t)<0)}},{key:"toString",value:function(){return"".concat(this.major,".").concat(this.minor,".").concat(this.patch)}}]),e}(),Me=function(e,t){return e&&t?Object.entries(e).filter((function(e){return m(e,2)[1].type===t})).reduce((function(e,t){var n=m(t,2),i=n[0],r=n[1];return e[i]=r,e}),{}):{}},Fe=(De={plugins:{},playbacks:[]},Ie="0.4.20",function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;r(this,e),this.playerId=n,this.playbackPlugins=y(De.playbacks);var i=e.registeredPlugins,a=i.core,o=i.container;this.containerPlugins=Object.values(o),this.corePlugins=Object.values(a),Array.isArray(t)||this.validateExternalPluginsType(t),this.addExternalPlugins(t)}return o(e,null,[{key:"checkVersionSupport",value:function(e){var t=e.prototype,n=t.supportedVersion,i=t.name;if(!n||!n.min)return re.warn("Loader","missing version information for ".concat(i)),!1;var r=n.max?Ne.parse(n.max):Ne.parse(n.min).inc("minor"),a=Ne.parse(n.min);return!!Ne.parse(Ie).satisfies(a,r)||(re.warn("Loader","unsupported plugin ".concat(i,": Clappr version ").concat(Ie," does not match required range [").concat(a,",").concat(r,")")),!1)}},{key:"registerPlugin",value:function(t){if(!t||!t.prototype.name)return re.warn("Loader","missing information to register plugin: ".concat(t)),!1;e.checkVersionSupport(t);var n=De.plugins;if(!n)return!1;var i=n[t.prototype.name];return i&&re.warn("Loader","overriding plugin entry: ".concat(t.prototype.name," - ").concat(i)),n[t.prototype.name]=t,!0}},{key:"registerPlayback",value:function(t){if(!t||!t.prototype.name)return!1;e.checkVersionSupport(t);var n=De.playbacks,i=n.findIndex((function(e){return e.prototype.name===t.prototype.name}));if(i>=0){var r=n[i];n.splice(i,1),re.warn("Loader","overriding playback entry: ".concat(r.name," - ").concat(r))}return De.playbacks=[t].concat(y(n)),!0}},{key:"unregisterPlugin",value:function(e){if(!e)return!1;var t=De.plugins;return!!t[e]&&(delete t[e],!0)}},{key:"unregisterPlayback",value:function(e){if(!e)return!1;var t=De.playbacks,n=t.findIndex((function(t){return t.prototype.name===e}));return!(n<0||(t.splice(n,1),De.playbacks=t,0))}},{key:"clearPlugins",value:function(){De.plugins={}}},{key:"clearPlaybacks",value:function(){De.playbacks=[]}},{key:"registeredPlaybacks",get:function(){return y(De.playbacks)}},{key:"registeredPlugins",get:function(){var e=De.plugins;return{core:Me(e,"core"),container:Me(e,"container")}}}]),o(e,[{key:"groupPluginsByType",value:function(e){return Array.isArray(e)&&(e=e.reduce((function(e,t){return e[t.type]||(e[t.type]=[]),e[t.type].push(t),e}),{})),e}},{key:"removeDups",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=function(e,n){return e[n.prototype.name]&&t||(e[n.prototype.name]&&delete e[n.prototype.name],e[n.prototype.name]=n),e},i=e.reduceRight(n,Object.create(null)),r=[];for(var a in i)r.unshift(i[a]);return r}},{key:"addExternalPlugins",value:function(t){var n="boolean"!=typeof t.loadExternalPluginsFirst||t.loadExternalPluginsFirst,i="boolean"!=typeof t.loadExternalPlaybacksFirst||t.loadExternalPlaybacksFirst;if((t=this.groupPluginsByType(t)).playback){var r=t.playback.filter((function(t){return e.checkVersionSupport(t),!0}));this.playbackPlugins=i?this.removeDups(r.concat(this.playbackPlugins)):this.removeDups(this.playbackPlugins.concat(r),!0)}if(t.container){var a=t.container.filter((function(t){return e.checkVersionSupport(t),!0}));this.containerPlugins=n?this.removeDups(a.concat(this.containerPlugins)):this.removeDups(this.containerPlugins.concat(a),!0)}if(t.core){var o=t.core.filter((function(t){return e.checkVersionSupport(t),!0}));this.corePlugins=n?this.removeDups(o.concat(this.corePlugins)):this.removeDups(this.corePlugins.concat(o),!0)}}},{key:"validateExternalPluginsType",value:function(e){["playback","container","core"].forEach((function(t){(e[t]||[]).forEach((function(e){var n="external "+e.type+" plugin on "+t+" array";if(e.type!==t)throw new ReferenceError(n)}))}))}}]),e}()),Be=z().replace(/\/[^/]+$/,""),Ue=function(e){c(n,e);var t=g(n);function n(e){var i;r(this,n),i=t.call(this,e);var a={playerId:H(""),persistConfig:!0,width:640,height:360,baseUrl:Be,allowUserInteraction:D.isMobile,includeResetStyle:!0,playback:{recycleVideo:!0}};return i._options=w.extend(!0,a,e),i.options.sources=i._normalizeSources(e),i.options.chromeless||(i.options.allowUserInteraction=!0),i.options.allowUserInteraction||(i.options.disableKeyboardShortcuts=!0),i._registerOptionEventListeners(i.options.events),i._coreFactory=new Pe(f(i)),i.options.parentId?i.setParentId(i.options.parentId):i.options.parent&&i.attachTo(i.options.parent),i}return o(n,[{key:"loader",set:function(e){this._loader=e},get:function(){return this._loader||(this._loader=new Fe(this.options.plugins||{},this.options.playerId)),this._loader}},{key:"ended",get:function(){return this.core.activeContainer.ended}},{key:"buffering",get:function(){return this.core.activeContainer.buffering}},{key:"isReady",get:function(){return!!this._ready}},{key:"eventsMapping",get:function(){return{onReady:ue.PLAYER_READY,onResize:ue.PLAYER_RESIZE,onPlay:ue.PLAYER_PLAY,onPause:ue.PLAYER_PAUSE,onStop:ue.PLAYER_STOP,onEnded:ue.PLAYER_ENDED,onSeek:ue.PLAYER_SEEK,onError:ue.PLAYER_ERROR,onTimeUpdate:ue.PLAYER_TIMEUPDATE,onVolumeUpdate:ue.PLAYER_VOLUMEUPDATE,onSubtitleAvailable:ue.PLAYER_SUBTITLE_AVAILABLE}}}]),o(n,[{key:"setParentId",value:function(e){var t=document.querySelector(e);return t&&this.attachTo(t),this}},{key:"attachTo",value:function(e){return this.options.parentElement=e,this.core=this._coreFactory.create(),this._addEventListeners(),this}},{key:"_addEventListeners",value:function(){return this.core.isReady?this._onReady():this.listenToOnce(this.core,ue.CORE_READY,this._onReady),this.listenTo(this.core,ue.CORE_ACTIVE_CONTAINER_CHANGED,this._containerChanged),this.listenTo(this.core,ue.CORE_FULLSCREEN,this._onFullscreenChange),this.listenTo(this.core,ue.CORE_RESIZE,this._onResize),this}},{key:"_addContainerEventListeners",value:function(){var e=this.core.activeContainer;return e&&(this.listenTo(e,ue.CONTAINER_PLAY,this._onPlay),this.listenTo(e,ue.CONTAINER_PAUSE,this._onPause),this.listenTo(e,ue.CONTAINER_STOP,this._onStop),this.listenTo(e,ue.CONTAINER_ENDED,this._onEnded),this.listenTo(e,ue.CONTAINER_SEEK,this._onSeek),this.listenTo(e,ue.CONTAINER_ERROR,this._onError),this.listenTo(e,ue.CONTAINER_TIMEUPDATE,this._onTimeUpdate),this.listenTo(e,ue.CONTAINER_VOLUME,this._onVolumeUpdate),this.listenTo(e,ue.CONTAINER_SUBTITLE_AVAILABLE,this._onSubtitleAvailable)),this}},{key:"_registerOptionEventListeners",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Object.keys(t).length>0;return i&&Object.keys(n).forEach((function(t){var i=e.eventsMapping[t];i&&e.off(i,n[t])})),Object.keys(t).forEach((function(n){var i=e.eventsMapping[n];if(i){var r=t[n];(r="function"==typeof r&&r)&&e.on(i,r)}})),this}},{key:"_containerChanged",value:function(){this.stopListening(),this._addEventListeners()}},{key:"_onReady",value:function(){this._ready=!0,this._addContainerEventListeners(),this.trigger(ue.PLAYER_READY)}},{key:"_onFullscreenChange",value:function(e){this.trigger(ue.PLAYER_FULLSCREEN,e)}},{key:"_onVolumeUpdate",value:function(e){this.trigger(ue.PLAYER_VOLUMEUPDATE,e)}},{key:"_onSubtitleAvailable",value:function(){this.trigger(ue.PLAYER_SUBTITLE_AVAILABLE)}},{key:"_onResize",value:function(e){this.trigger(ue.PLAYER_RESIZE,e)}},{key:"_onPlay",value:function(){this.trigger(ue.PLAYER_PLAY)}},{key:"_onPause",value:function(){this.trigger(ue.PLAYER_PAUSE)}},{key:"_onStop",value:function(){this.trigger(ue.PLAYER_STOP,this.getCurrentTime())}},{key:"_onEnded",value:function(){this.trigger(ue.PLAYER_ENDED)}},{key:"_onSeek",value:function(e){this.trigger(ue.PLAYER_SEEK,e)}},{key:"_onTimeUpdate",value:function(e){this.trigger(ue.PLAYER_TIMEUPDATE,e)}},{key:"_onError",value:function(e){this.trigger(ue.PLAYER_ERROR,e)}},{key:"_normalizeSources",value:function(e){var t=e.sources||(void 0!==e.source?[e.source]:[]);return 0===t.length?[{source:"",mimeType:""}]:t}},{key:"resize",value:function(e){return this.core.resize(e),this}},{key:"load",value:function(e,t,n){return void 0!==n&&this.configure({autoPlay:!!n}),this.core.load(e,t),this}},{key:"destroy",value:function(){return this.stopListening(),this.core.destroy(),this}},{key:"consent",value:function(e){this.core.getCurrentPlayback().consent(e)}},{key:"play",value:function(){return this.core.activeContainer.play(),this}},{key:"pause",value:function(){return this.core.activeContainer.pause(),this}},{key:"stop",value:function(){return this.core.activeContainer.stop(),this}},{key:"seek",value:function(e){return this.core.activeContainer.seek(e),this}},{key:"seekPercentage",value:function(e){return this.core.activeContainer.seekPercentage(e),this}},{key:"mute",value:function(){return this.core.activePlayback.mute(),this}},{key:"unmute",value:function(){return this.core.activePlayback.unmute(),this}},{key:"isPlaying",value:function(){return this.core.activeContainer.isPlaying()}},{key:"isDvrEnabled",value:function(){return this.core.activeContainer.isDvrEnabled()}},{key:"isDvrInUse",value:function(){return this.core.activeContainer.isDvrInUse()}},{key:"configure",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._registerOptionEventListeners(e.events,this.options.events),this.core.configure(e),this}},{key:"getPlugin",value:function(e){return this.core.plugins.concat(this.core.activeContainer.plugins).filter((function(t){return t.name===e}))[0]}},{key:"getCurrentTime",value:function(){return this.core.activeContainer.getCurrentTime()}},{key:"getStartTimeOffset",value:function(){return this.core.activeContainer.getStartTimeOffset()}},{key:"getDuration",value:function(){return this.core.activeContainer.getDuration()}}]),n}(de);Object.assign(Ue.prototype,Se);var Ve=function(e){c(n,e);var t=g(n);function n(e){var i;return r(this,n),(i=t.call(this,e.options)).container=e,i.enabled=!0,i.bindEvents(),i}return o(n,[{key:"playerError",get:function(){return this.container.playerError}}]),o(n,[{key:"enable",value:function(){this.enabled||(this.bindEvents(),this.enabled=!0)}},{key:"disable",value:function(){this.enabled&&(this.stopListening(),this.enabled=!1)}},{key:"bindEvents",value:function(){}},{key:"destroy",value:function(){this.stopListening()}}]),n}(de);Object.assign(Ve.prototype,Se),Ve.extend=function(e){return V(Ve,e)},Ve.type="container";var je=function(e){c(n,e);var t=g(n);function n(e){var i;return r(this,n),(i=t.call(this,e.options)).core=e,i.enabled=!0,i.bindEvents(),i}return o(n,[{key:"playerError",get:function(){return this.core.playerError}}]),o(n,[{key:"bindEvents",value:function(){}},{key:"enable",value:function(){this.enabled||(this.bindEvents(),this.enabled=!0)}},{key:"disable",value:function(){this.enabled&&(this.stopListening(),this.enabled=!1)}},{key:"getExternalInterface",value:function(){return{}}},{key:"destroy",value:function(){this.stopListening()}}]),n}(de);Object.assign(je.prototype,Se),je.extend=function(e){return V(je,e)},je.type="core";var Ke=function(e){c(n,e);var t=g(n);function n(e){var i;return r(this,n),(i=t.call(this,e.options)).container=e,i.enabled=!0,i.bindEvents(),i}return o(n,[{key:"playerError",get:function(){return this.container.playerError}}]),o(n,[{key:"enable",value:function(){this.enabled||(this.bindEvents(),this.$el.show(),this.enabled=!0)}},{key:"disable",value:function(){this.stopListening(),this.$el.hide(),this.enabled=!1}},{key:"bindEvents",value:function(){}}]),n}(ke);Object.assign(Ke.prototype,Se),Ke.extend=function(e){return V(Ke,e)},Ke.type="container";var Ge={mp4:["avc1.42E01E","avc1.58A01E","avc1.4D401E","avc1.64001E","mp4v.20.8","mp4v.20.240","mp4a.40.2"].map((function(e){return'video/mp4; codecs="'+e+', mp4a.40.2"'})),ogg:['video/ogg; codecs="theora, vorbis"','video/ogg; codecs="dirac"','video/ogg; codecs="theora, speex"'],"3gpp":['video/3gpp; codecs="mp4v.20.8, samr"'],webm:['video/webm; codecs="vp8, vorbis"'],mkv:['video/x-matroska; codecs="theora, vorbis"'],m3u8:["application/x-mpegurl"]};Ge.ogv=Ge.ogg,Ge["3gp"]=Ge["3gpp"];var Ye={wav:["audio/wav"],mp3:["audio/mp3",'audio/mpeg;codecs="mp3"'],aac:['audio/mp4;codecs="mp4a.40.5"'],oga:["audio/ogg"]},He=Object.keys(Ye).reduce((function(e,t){return[].concat(y(e),y(Ye[t]))}),[]),$e={code:"unknown",message:"unknown"},ze=function(e){c(n,e);var t=g(n);function n(){var e;r(this,n);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];(e=t.call.apply(t,[this].concat(a)))._destroyed=!1,e._loadStarted=!1,e._isBuffering=!1,e._playheadMoving=!1,e._playheadMovingTimer=null,e._stopped=!1,e._ccTrackId=-1,e._setupSrc(e.options.src),e.options.playback||(e.options.playback=e.options||{}),e.options.playback.disableContextMenu=e.options.playback.disableContextMenu||e.options.disableVideoTagContextMenu,e._minDvrSize=e.isValidMinimumDVRSizeConfig?e.minimumDVRSizeConfig:60;var s,l=e.options.playback,u=l.preload||(D.isSafari?"auto":e.options.preload);return e.options.poster&&("string"==typeof e.options.poster?s=e.options.poster:"string"==typeof e.options.poster.url&&(s=e.options.poster.url)),w.extend(!0,e.el,{muted:e.options.mute,defaultMuted:e.options.mute,loop:e.options.loop,poster:s,preload:u||"metadata",crossOrigin:l.crossOrigin,"x-webkit-playsinline":l.playInline}),(l.controls||e.options.useVideoTagDefaultControls)&&e.$el.attr("controls",""),l.playInline&&e.$el.attr({playsinline:"playsinline"}),l.crossOrigin&&e.$el.attr({crossorigin:l.crossOrigin}),e.settings={default:["seekbar"]},e.settings.left=["playpause","position","duration"],e.settings.right=["fullscreen","volume","hd-indicator"],l.externalTracks&&e._setupExternalTracks(l.externalTracks),e.options.autoPlay&&e.attemptAutoPlay(),e}return o(n,[{key:"name",get:function(){return"html5_video"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"tagName",get:function(){return this.isAudioOnly?"audio":"video"}},{key:"isAudioOnly",get:function(){var e=this.options.src,t=n._mimeTypesForUrl(e,Ye,this.options.mimeType);return this.options.playback&&this.options.playback.audioOnly||this.options.audioOnly||He.indexOf(t[0])>=0}},{key:"attributes",get:function(){return{"data-html5-video":""}}},{key:"events",get:function(){return{canplay:"_onCanPlay",canplaythrough:"_handleBufferingEvents",durationchange:"_onDurationChange",ended:"_onEnded",error:"_onError",loadeddata:"_onLoadedData",loadedmetadata:"_onLoadedMetadata",pause:"_onPause",playing:"_onPlaying",progress:"_onProgress",seeking:"_onSeeking",seeked:"_onSeeked",stalled:"_handleBufferingEvents",timeupdate:"_onTimeUpdate",waiting:"_onWaiting"}}},{key:"ended",get:function(){return this.el.ended}},{key:"buffering",get:function(){return this._isBuffering}},{key:"isLive",get:function(){return this.getPlaybackType()===we.LIVE}},{key:"dvrEnabled",get:function(){return this.getDuration()>=this._minDvrSize&&this.isLive}},{key:"minimumDVRSizeConfig",get:function(){return this.options.playback&&this.options.playback.minimumDvrSize}},{key:"isValidMinimumDVRSizeConfig",get:function(){return void 0!==this.minimumDVRSizeConfig&&"number"==typeof this.minimumDVRSizeConfig}}]),o(n,[{key:"configure",value:function(e){v(d(n.prototype),"configure",this).call(this,e),this.el.loop=!!e.loop}},{key:"attemptAutoPlay",value:function(){var e=this;this.canAutoPlay((function(t,n){n&&re.warn(e.name,"autoplay error.",{result:t,error:n}),t&&setTimeout((function(){return!e._destroyed&&e.play()}),0)}))}},{key:"canAutoPlay",value:function(e){if(this.options.disableCanAutoPlay)e(!0,null);else{var t={timeout:this.options.autoPlayTimeout||500,inline:this.options.playback.playInline||!1,muted:this.options.mute||!1};D.isMobile&&X.options.recycleVideo&&(t.element=this.el),q(e,t)}}},{key:"_setupExternalTracks",value:function(e){this._externalTracks=e.map((function(e){return{kind:e.kind||"subtitles",label:e.label,lang:e.lang,src:e.src}}))}},{key:"_setupSrc",value:function(e){this.el.src!==e&&(this._ccIsSetup=!1,this.el.src=e,this._src=this.el.src)}},{key:"_onLoadedMetadata",value:function(e){this._handleBufferingEvents(),this.trigger(ue.PLAYBACK_LOADEDMETADATA,{duration:e.target.duration,data:e}),this._updateSettings();var t=void 0===this._options.autoSeekFromUrl||this._options.autoSeekFromUrl;this.getPlaybackType()!==we.LIVE&&t&&this._checkInitialSeek()}},{key:"_onDurationChange",value:function(){this._updateSettings(),this._onTimeUpdate(),this._onProgress()}},{key:"_updateSettings",value:function(){this.getPlaybackType()===we.VOD||this.getPlaybackType()===we.AOD?this.settings.left=["playpause","position","duration"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(ue.PLAYBACK_SETTINGSUPDATE)}},{key:"isSeekEnabled",value:function(){return isFinite(this.getDuration())}},{key:"getPlaybackType",value:function(){var e="audio"===this.tagName?we.AOD:we.VOD;return[0,void 0,1/0].indexOf(this.el.duration)>=0?we.LIVE:e}},{key:"isHighDefinitionInUse",value:function(){return!1}},{key:"consent",value:function(e){var t=this;if(this.isPlaying()||this.el._consented)v(d(n.prototype),"consent",this).call(this,e);else{var i=function i(){t.el.removeEventListener("loadedmetadata",i,!1),t.el.removeEventListener("error",i,!1),t.el._consented=!0,v(d(n.prototype),"consent",t).call(t,e)};this.el.addEventListener("loadedmetadata",i,!1),this.el.addEventListener("error",i,!1),this.el.load()}}},{key:"play",value:function(){this.trigger(ue.PLAYBACK_PLAY_INTENT),this._stopped=!1,this._setupSrc(this._src),this._handleBufferingEvents();var e=this.el.play();e&&e.catch&&e.catch((function(){}))}},{key:"pause",value:function(){this.el.pause(),this.dvrEnabled&&this._updateDvr(!0)}},{key:"stop",value:function(){this.pause(),this._stopped=!0,this.el.removeAttribute("src"),this.el.load(),this._stopPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(ue.PLAYBACK_STOP)}},{key:"volume",value:function(e){0===e?(this.$el.attr({muted:"true"}),this.el.muted=!0):(this.$el.attr({muted:null}),this.el.muted=!1,this.el.volume=e/100)}},{key:"mute",value:function(){this.el.muted=!0}},{key:"unmute",value:function(){this.el.muted=!1}},{key:"isMuted",value:function(){return!0===this.el.muted||0===this.el.volume}},{key:"isPlaying",value:function(){return!this.el.paused&&!this.el.ended}},{key:"_startPlayheadMovingChecks",value:function(){null===this._playheadMovingTimer&&(this._playheadMovingTimeOnCheck=null,this._determineIfPlayheadMoving(),this._playheadMovingTimer=setInterval(this._determineIfPlayheadMoving.bind(this),500))}},{key:"_stopPlayheadMovingChecks",value:function(){null!==this._playheadMovingTimer&&(clearInterval(this._playheadMovingTimer),this._playheadMovingTimer=null,this._playheadMoving=!1)}},{key:"_determineIfPlayheadMoving",value:function(){var e=this._playheadMovingTimeOnCheck,t=this.el.currentTime;this._playheadMoving=e!==t,this._playheadMovingTimeOnCheck=t,this._handleBufferingEvents()}},{key:"_onWaiting",value:function(){this._loadStarted=!0,this._handleBufferingEvents()}},{key:"_onLoadedData",value:function(){this._loadStarted=!0,this._handleBufferingEvents()}},{key:"_onCanPlay",value:function(){this._handleBufferingEvents()}},{key:"_onPlaying",value:function(){this._checkForClosedCaptions(),this._startPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(ue.PLAYBACK_PLAY)}},{key:"_onPause",value:function(){this._stopPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(ue.PLAYBACK_PAUSE)}},{key:"_onSeeking",value:function(){this.trigger(ue.PLAYBACK_SEEK,this.getCurrentTime()),this._handleBufferingEvents()}},{key:"_onSeeked",value:function(){this._handleBufferingEvents(),this.trigger(ue.PLAYBACK_SEEKED)}},{key:"_onEnded",value:function(){this._handleBufferingEvents(),this.trigger(ue.PLAYBACK_ENDED,this.name)}},{key:"_handleBufferingEvents",value:function(){var e=!this.el.ended&&!this.el.paused,t=this._loadStarted&&!this.el.ended&&!this._stopped&&(e&&!this._playheadMoving||this.el.readyState<this.el.HAVE_FUTURE_DATA);this._isBuffering!==t&&(this._isBuffering=t,t?this.trigger(ue.PLAYBACK_BUFFERING,this.name):this.trigger(ue.PLAYBACK_BUFFERFULL,this.name))}},{key:"_onError",value:function(){var e=this.el.error||$e,t=e.code,n=e.message,i=t===$e.code,r=this.createError({code:t,description:n,raw:this.el.error,level:i?_e.Levels.WARN:_e.Levels.FATAL});i?re.warn(this.name,"HTML5 unknown error: ",r):this.trigger(ue.PLAYBACK_ERROR,r)}},{key:"destroy",value:function(){this._destroyed=!0,this.handleTextTrackChange&&this.el.textTracks.removeEventListener("change",this.handleTextTrackChange),v(d(n.prototype),"destroy",this).call(this),this.el.removeAttribute("src"),this.el.load(),this._src=null,X.garbage(this.el)}},{key:"_updateDvr",value:function(e){this.trigger(ue.PLAYBACK_DVR,e),this.trigger(ue.PLAYBACK_STATS_ADD,{dvr:e})}},{key:"seek",value:function(e){e<0&&(re.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),e=this.getDuration()),this.dvrEnabled&&this._updateDvr(e<this.getDuration()-3),e+=this.el.seekable.start(0),this.el.currentTime=e}},{key:"seekPercentage",value:function(e){var t=this.el.duration*(e/100);this.seek(t)}},{key:"_checkInitialSeek",value:function(){var e=Y();0!==e&&this.seek(e)}},{key:"getCurrentTime",value:function(){return this.el.currentTime}},{key:"getDuration",value:function(){if(this.isLive){if(this.el.seekable.length>0)return this.el.seekable.end(0)-this.el.seekable.start(0);this._scheduleUpdateSettingsCheck()}return this.el.duration}},{key:"_scheduleUpdateSettingsCheck",value:function(){var e=this;this._updateSettingsCheckInFlight||(this._updateSettingsCheckInFlight=setTimeout((function(){e._updateSettings(),e._updateSettingsCheckInFlight=null}),1e3))}},{key:"_onTimeUpdate",value:function(){var e=this.isLive?this.getDuration():this.el.duration;this.trigger(ue.PLAYBACK_TIMEUPDATE,{current:this.el.currentTime,total:e},this.name)}},{key:"_onProgress",value:function(){if(this.el.buffered.length){for(var e=[],t=0,n=0;n<this.el.buffered.length;n++)e=[].concat(y(e),[{start:this.el.buffered.start(n),end:this.el.buffered.end(n)}]),this.el.currentTime>=e[n].start&&this.el.currentTime<=e[n].end&&(t=n);var i={start:e[t].start,current:e[t].end,total:this.el.duration};this.trigger(ue.PLAYBACK_PROGRESS,i,e)}}},{key:"_typeFor",value:function(e){var t=n._mimeTypesForUrl(e,Ge,this.options.mimeType);return 0===t.length&&(t=n._mimeTypesForUrl(e,Ye,this.options.mimeType)),(t[0]||"").split(";")[0]}},{key:"_ready",value:function(){this._isReadyState||(this._isReadyState=!0,this.trigger(ue.PLAYBACK_READY,this.name))}},{key:"_checkForClosedCaptions",value:function(){if(this.isHTML5Video&&!this._ccIsSetup){if(this.hasClosedCaptionsTracks){this.trigger(ue.PLAYBACK_SUBTITLE_AVAILABLE);var e=this.closedCaptionsTrackId;this.closedCaptionsTrackId=e,this.handleTextTrackChange=this._handleTextTrackChange.bind(this),this.el.textTracks.addEventListener("change",this.handleTextTrackChange)}this._ccIsSetup=!0}}},{key:"_handleTextTrackChange",value:function(){var e=this.closedCaptionsTracks.find((function(e){return"showing"===e.track.mode}))||{id:-1};this._ccTrackId!==e.id&&(this._ccTrackId=e.id,this.trigger(ue.PLAYBACK_SUBTITLE_CHANGED,{id:e.id}))}},{key:"render",value:function(){this.options.playback.disableContextMenu&&this.$el.on("contextmenu",(function(){return!1})),this._externalTracks&&this._externalTracks.length>0&&this.$el.html(this.template({tracks:this._externalTracks})),this._ready();var e=Ee.getStyleFor("[data-html5-video] {\n position: absolute;\n height: 100%;\n width: 100%;\n display: block; }\n".toString(),{baseUrl:this.options.baseUrl});return this.$el.append(e[0]),this}},{key:"isReady",get:function(){return this._isReadyState}},{key:"isHTML5Video",get:function(){return this.name===n.prototype.name}},{key:"closedCaptionsTracks",get:function(){var e=0;return(this.el.textTracks?Array.from(this.el.textTracks):[]).filter((function(e){return"subtitles"===e.kind||"captions"===e.kind})).map((function(t){return{id:e++,name:t.label,track:t}}))}},{key:"closedCaptionsTrackId",get:function(){return this._ccTrackId},set:function(e){if($(e)){var t,n=this.closedCaptionsTracks;if(-1!==e){if(!(t=n.find((function(t){return t.id===e}))))return;if("showing"===t.track.mode)return}n.filter((function(e){return"hidden"!==e.track.mode})).forEach((function(e){return e.track.mode="hidden"})),t&&(t.track.mode="showing"),this._ccTrackId=e,this.trigger(ue.PLAYBACK_SUBTITLE_CHANGED,{id:e})}}},{key:"template",get:function(){return be('<% for (var i = 0; i < tracks.length; i++) { %>\n <track data-html5-video-track="<%= i %>" kind="<%= tracks[i].kind %>" label="<%= tracks[i].label %>" srclang="<%= tracks[i].lang %>" src="<%= tracks[i].src %>">\n<% }; %>\n')}}]),n}(we);ze._mimeTypesForUrl=function(e,t,n){var i=(e.split("?")[0].match(/.*\.(.*)$/)||[])[1],r=n||i&&t[i.toLowerCase()]||[];return r.constructor===Array?r:[r]},ze._canPlay=function(e,t,n,i){var r=ze._mimeTypesForUrl(n,t,i),a=document.createElement(e);return!!r.filter((function(e){return!!a.canPlayType(e).replace(/no/,"")}))[0]},ze.canPlay=function(e,t){return ze._canPlay("audio",Ye,e,t)||ze._canPlay("video",Ge,e,t)};var We=function(e){c(n,e);var t=g(n);function n(){return r(this,n),t.apply(this,arguments)}return o(n,[{key:"updateSettings",value:function(){this.settings.left=["playpause","position","duration"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(ue.PLAYBACK_SETTINGSUPDATE)}},{key:"getPlaybackType",value:function(){return we.AOD}},{key:"name",get:function(){return"html5_audio"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"tagName",get:function(){return"audio"}},{key:"isAudioOnly",get:function(){return!0}}]),n}(ze);We.canPlay=function(e,t){return ze._canPlay("audio",{wav:["audio/wav"],mp3:["audio/mp3",'audio/mpeg;codecs="mp3"'],aac:['audio/mp4;codecs="mp4a.40.5"'],oga:["audio/ogg"]},e,t)};var qe=function(e){c(n,e);var t=g(n);function n(e){var i;return r(this,n),(i=t.call(this,e)).el.src=e.src,i}return o(n,[{key:"getPlaybackType",value:function(){return we.NO_OP}},{key:"name",get:function(){return"html_img"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"tagName",get:function(){return"img"}},{key:"attributes",get:function(){return{"data-html-img":""}}},{key:"events",get:function(){return{load:"_onLoad",abort:"_onError",error:"_onError"}}}]),o(n,[{key:"render",value:function(){var e=Ee.getStyleFor("[data-html-img] {\n max-width: 100%;\n max-height: 100%; }\n".toString(),{baseUrl:this.options.baseUrl});return this.$el.append(e[0]),this.trigger(ue.PLAYBACK_READY,this.name),this}},{key:"_onLoad",value:function(){this.trigger(ue.PLAYBACK_ENDED,this.name)}},{key:"_onError",value:function(e){var t="error"===e.type?"load error":"loading aborted";this.trigger(ue.PLAYBACK_ERROR,{message:t},this.name)}}]),n}(we);qe.canPlay=function(e){return/\.(png|jpg|jpeg|gif|bmp|tiff|pgm|pnm|webp)(|\?.*)$/i.test(e)};var Xe=function(e){c(n,e);var t=g(n);function n(){var e;r(this,n);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return(e=t.call.apply(t,[this].concat(a)))._noiseFrameNum=-1,e}return o(n,[{key:"name",get:function(){return"no_op"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"template",get:function(){return be("<canvas data-no-op-canvas></canvas>\n<p data-no-op-msg><%=message%></p><p>\n</p>")}},{key:"attributes",get:function(){return{"data-no-op":""}}}]),o(n,[{key:"render",value:function(){var e=this.options.playbackNotSupportedMessage||this.i18n.t("playback_not_supported"),t=Ee.getStyleFor("[data-no-op] {\n position: absolute;\n height: 100%;\n width: 100%;\n text-align: center; }\n\n[data-no-op] p[data-no-op-msg] {\n position: absolute;\n text-align: center;\n font-size: 25px;\n left: 0;\n right: 0;\n color: white;\n padding: 10px;\n /* center vertically */\n top: 50%;\n transform: translateY(-50%);\n max-height: 100%;\n overflow: auto; }\n\n[data-no-op] canvas[data-no-op-canvas] {\n background-color: #777;\n height: 100%;\n width: 100%; }\n".toString(),{baseUrl:this.options.baseUrl});this.$el.append(t[0]),this.$el.html(this.template({message:e})),this.trigger(ue.PLAYBACK_READY,this.name);var n=!(!this.options.poster||!this.options.poster.showForNoOp);return!this.options.autoPlay&&n||this._animate(),this}},{key:"_noise",value:function(){if(this._noiseFrameNum=(this._noiseFrameNum+1)%5,!this._noiseFrameNum){var e,t=this.context.createImageData(this.context.canvas.width,this.context.canvas.height);try{e=new Uint32Array(t.data.buffer)}catch(r){e=new Uint32Array(this.context.canvas.width*this.context.canvas.height*4);for(var n=t.data,i=0;i<n.length;i++)e[i]=n[i]}for(var r=e.length,a=6*Math.random()+4,o=0,s=0,l=0;l<r;){if(o<0)o=a*Math.random(),s=255*Math.pow(Math.random(),.4)<<24;o-=1,e[l++]=s}this.context.putImageData(t,0,0)}}},{key:"_loop",value:function(){var e=this;this._stop||(this._noise(),this._animationHandle=F((function(){return e._loop()})))}},{key:"destroy",value:function(){this._animationHandle&&(B(this._animationHandle),this._stop=!0)}},{key:"_animate",value:function(){this.canvas=this.$el.find("canvas[data-no-op-canvas]")[0],this.context=this.canvas.getContext("2d"),this._loop()}}]),n}(we);Xe.canPlay=function(e){return!0};var Ze=function(e){c(n,e);var t=g(n);function n(e){var i;return r(this,n),(i=t.call(this,e))._initializeMessages(),i}return o(n,[{key:"name",get:function(){return"strings"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}}]),o(n,[{key:"t",value:function(e){var t=this._language(),n=this._messages.en;return(t&&this._messages[t]||n)[e]||n[e]||e}},{key:"_language",value:function(){return this.core.options.language||W()}},{key:"_initializeMessages",value:function(){this._messages=w.extend(!0,{en:{live:"live",back_to_live:"back to live",disabled:"Disabled",playback_not_supported:"Your browser does not support the playback of this video. Please try using a different browser.",default_error_title:"Could not play video.",default_error_message:"There was a problem trying to load the video."},de:{live:"Live",back_to_live:"Zurück zum Live-Video",disabled:"Deaktiviert",playback_not_supported:"Ihr Browser unterstützt das Playback Verfahren nicht. Bitte vesuchen Sie es mit einem anderen Browser.",default_error_title:"Video kann nicht abgespielt werden",default_error_message:"Es gab ein Problem beim Laden des Videos"},pt:{live:"ao vivo",back_to_live:"voltar para o ao vivo",disabled:"Desativado",playback_not_supported:"Seu navegador não supporta a reprodução deste video. Por favor, tente usar um navegador diferente.",default_error_title:"Não foi possível reproduzir o vídeo.",default_error_message:"Ocorreu um problema ao tentar carregar o vídeo."},es:{live:"vivo",back_to_live:"volver en vivo",disabled:"Discapacitado",playback_not_supported:"Su navegador no soporta la reproducción de un video. Por favor, trate de usar un navegador diferente."},ru:{live:"прямой эфир",back_to_live:"к прямому эфиру",disabled:"Отключено",playback_not_supported:"Ваш браузер не поддерживает воспроизведение этого видео. Пожалуйста, попробуйте другой браузер."},fr:{live:"en direct",back_to_live:"retour au direct",disabled:"Désactivé",playback_not_supported:"Votre navigateur ne supporte pas la lecture de cette vidéo. Merci de tenter sur un autre navigateur.",default_error_title:"Impossible de lire la vidéo.",default_error_message:"Un problème est survenu lors du chargement de la vidéo."},tr:{live:"canlı",back_to_live:"canlı yayına dön",disabled:"Engelli",playback_not_supported:"Tarayıcınız bu videoyu oynatma desteğine sahip değil. Lütfen farklı bir tarayıcı ile deneyin."},et:{live:"Otseülekanne",back_to_live:"Tagasi otseülekande juurde",disabled:"Keelatud",playback_not_supported:"Teie brauser ei toeta selle video taasesitust. Proovige kasutada muud brauserit."},ar:{live:"مباشر",back_to_live:"الرجوع إلى المباشر",disabled:"معطّل",playback_not_supported:"المتصفح الذي تستخدمه لا يدعم تشغيل هذا الفيديو. الرجاء إستخدام متصفح آخر.",default_error_title:"غير قادر الى التشغيل.",default_error_message:"حدثت مشكلة أثناء تحميل الفيديو."}},this.core.options.strings||{}),this._messages["de-DE"]=this._messages.de,this._messages["pt-BR"]=this._messages.pt,this._messages["en-US"]=this._messages.en,this._messages["es-419"]=this._messages.es,this._messages["fr-FR"]=this._messages.fr,this._messages["tr-TR"]=this._messages.tr,this._messages["et-EE"]=this._messages.et,this._messages["ar-IQ"]=this._messages.ar}}]),n}(je),Qe=function(e){c(n,e);var t=g(n);function n(){return r(this,n),t.apply(this,arguments)}return o(n,[{key:"bindEvents",value:function(){this.listenTo(this.core,ue.CORE_CONTAINERS_CREATED,this.onContainersCreated)}},{key:"onContainersCreated",value:function(){var e=this.core.containers.filter((function(e){return"no_op"!==e.playback.name}))[0]||this.core.containers[0];e&&this.core.containers.forEach((function(t){t!==e&&t.destroy()}))}},{key:"name",get:function(){return"sources"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}}]),n}(je);Fe.registerPlugin(Ze),Fe.registerPlugin(Qe),Fe.registerPlayback(Xe),Fe.registerPlayback(qe),Fe.registerPlayback(We),Fe.registerPlayback(ze);var Je={Player:Ue,Events:ue,Browser:D,ContainerPlugin:Ve,UIContainerPlugin:Ke,CorePlugin:je,UICorePlugin:Ce,Playback:we,Container:Re,Core:Le,PlayerError:_e,Loader:Fe,BaseObject:de,UIObject:ke,Utils:Q,HTML5Audio:We,HTML5Video:ze,HTMLImg:qe,Log:re,Styler:Ee,version:"0.4.20",template:be,$:w};function et(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function nt(e,t,n){return t&&tt(e.prototype,t),n&&tt(e,n),e}function it(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&at(e,t)}function rt(e){return(rt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function at(e,t){return(at=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ot(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function st(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=rt(e);if(t){var r=rt(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return ot(this,n)}}function lt(e,t,n){return(lt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=rt(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}var ut=function(e){it(n,e);var t=st(n);function n(e){return et(this,n),t.call(this,e)}return nt(n,[{key:"name",get:function(){return"click_to_pause"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"config",get:function(){return this.container.options.clickToPauseConfig||{}}},{key:"bindEvents",value:function(){this.listenTo(this.container,ue.CONTAINER_CLICK,this.click),this.listenTo(this.container,ue.CONTAINER_SETTINGSUPDATE,this.settingsUpdate)}},{key:"click",value:function(){var e=this.config.onClickPayload;(this.container.getPlaybackType()!==we.LIVE||this.container.isDvrEnabled())&&(this.container.isPlaying()?this.container.pause(e):this.container.play(e))}},{key:"settingsUpdate",value:function(){var e=this.container.getPlaybackType()!==we.LIVE||this.container.isDvrEnabled();if(e!==this.pointerEnabled){var t=e?"addClass":"removeClass";this.container.$el[t]("pointer-enabled"),this.pointerEnabled=e}}}]),n}(Ve),ct=function(e){it(n,e);var t=st(n);function n(e){var i;et(this,n),i=t.call(this,e);var r=e.options.closedCaptionsConfig;return i._title=r&&r.title?r.title:null,i._ariaLabel=r&&r.ariaLabel?r.ariaLabel:"cc-button",i._labelCb=r&&r.labelCallback&&"function"==typeof r.labelCallback?r.labelCallback:function(e){return e.name},i}return nt(n,[{key:"name",get:function(){return"closed_captions"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"template",get:function(){return be('<button type="button" class="cc-button media-control-button media-control-icon" data-cc-button aria-label="<%= ariaLabel %>"></button>\n<ul>\n <% if (title) { %>\n <li data-title><%= title %></li>\n <% }; %>\n <li><a href="#" data-cc-select="-1"><%= disabledLabel %></a></li>\n <% for (var i = 0; i < tracks.length; i++) { %>\n <li><a href="#" data-cc-select="<%= tracks[i].id %>"><%= tracks[i].label %></a></li>\n <% }; %>\n</ul>\n')}},{key:"events",get:function(){return{"click [data-cc-button]":"toggleContextMenu","click [data-cc-select]":"onTrackSelect"}}},{key:"attributes",get:function(){return{class:"cc-controls","data-cc-controls":""}}},{key:"bindEvents",value:function(){this.listenTo(this.core,ue.CORE_ACTIVE_CONTAINER_CHANGED,this.containerChanged),this.listenTo(this.core.mediaControl,ue.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.core.mediaControl,ue.MEDIACONTROL_HIDE,this.hideContextMenu),this.bindContainerEvents()}},{key:"bindContainerEvents",value:function(){this.container=this.core.activeContainer,this.container&&(this.listenTo(this.container,ue.CONTAINER_SUBTITLE_AVAILABLE,this.onSubtitleAvailable),this.listenTo(this.container,ue.CONTAINER_SUBTITLE_CHANGED,this.onSubtitleChanged),this.listenTo(this.container,ue.CONTAINER_STOP,this.onContainerStop))}},{key:"onContainerStop",value:function(){this.ccAvailable(!1)}},{key:"containerChanged",value:function(){this.ccAvailable(!1),this.stopListening(),this.bindEvents()}},{key:"onSubtitleAvailable",value:function(){this.renderCcButton(),this.ccAvailable(!0)}},{key:"onSubtitleChanged",value:function(e){this.setCurrentContextMenuElement(e.id)}},{key:"onTrackSelect",value:function(e){var t=parseInt(e.target.dataset.ccSelect,10);return this.container.closedCaptionsTrackId=t,this.hideContextMenu(),e.stopPropagation(),!1}},{key:"ccAvailable",value:function(e){var t=e?"addClass":"removeClass";this.$el[t]("available")}},{key:"toggleContextMenu",value:function(){this.$el.find("ul").toggle()}},{key:"hideContextMenu",value:function(){this.$el.find("ul").hide()}},{key:"contextMenuElement",value:function(e){return this.$el.find("ul a"+(isNaN(e)?"":'[data-cc-select="'+e+'"]')).parent()}},{key:"setCurrentContextMenuElement",value:function(e){if(this._trackId!==e){this.contextMenuElement().removeClass("current"),this.contextMenuElement(e).addClass("current");var t=e>-1?"addClass":"removeClass";this.$ccButton[t]("enabled"),this._trackId=e}}},{key:"renderCcButton",value:function(){for(var e=this.container?this.container.closedCaptionsTracks:[],t=0;t<e.length;t++)e[t].label=this._labelCb(e[t]);var n=Ee.getStyleFor(".cc-controls[data-cc-controls] {\n float: right;\n position: relative;\n display: none; }\n .cc-controls[data-cc-controls].available {\n display: block; }\n .cc-controls[data-cc-controls] .cc-button {\n padding: 6px !important; }\n .cc-controls[data-cc-controls] .cc-button.enabled {\n display: block;\n opacity: 1.0; }\n .cc-controls[data-cc-controls] .cc-button.enabled:hover {\n opacity: 1.0;\n text-shadow: none; }\n .cc-controls[data-cc-controls] > ul {\n list-style-type: none;\n position: absolute;\n bottom: 25px;\n border: 1px solid black;\n display: none;\n background-color: #e6e6e6; }\n .cc-controls[data-cc-controls] li {\n font-size: 10px; }\n .cc-controls[data-cc-controls] li[data-title] {\n background-color: #c3c2c2;\n padding: 5px; }\n .cc-controls[data-cc-controls] li a {\n color: #444;\n padding: 2px 10px;\n display: block;\n text-decoration: none; }\n .cc-controls[data-cc-controls] li a:hover {\n background-color: #555;\n color: white; }\n .cc-controls[data-cc-controls] li a:hover a {\n color: white;\n text-decoration: none; }\n .cc-controls[data-cc-controls] li.current a {\n color: #f00; }\n",{baseUrl:this.options.baseUrl});this.$el.html(this.template({ariaLabel:this._ariaLabel,disabledLabel:this.core.i18n.t("disabled"),title:this._title,tracks:e})),this.$ccButton=this.$el.find("button.cc-button[data-cc-button]"),this.$ccButton.append('<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 49 41.8" style="enable-background:new 0 0 49 41.8;" xml:space="preserve">\n<path d="M47.1,0H3.2C1.6,0,0,1.2,0,2.8v31.5C0,35.9,1.6,37,3.2,37h11.9l3.2,1.9l4.7,2.7c0.9,0.5,2-0.1,2-1.1V37h22.1\n\tc1.6,0,1.9-1.1,1.9-2.7V2.8C49,1.2,48.7,0,47.1,0z M7.2,18.6c0-4.8,3.5-9.3,9.9-9.3c4.8,0,7.1,2.7,7.1,2.7l-2.5,4\n\tc0,0-1.7-1.7-4.2-1.7c-2.8,0-4.3,2.1-4.3,4.3c0,2.1,1.5,4.4,4.5,4.4c2.5,0,4.9-2.1,4.9-2.1l2.2,4.2c0,0-2.7,2.9-7.6,2.9\n\tC10.8,27.9,7.2,23.5,7.2,18.6z M36.9,27.9c-6.4,0-9.9-4.4-9.9-9.3c0-4.8,3.5-9.3,9.9-9.3C41.7,9.3,44,12,44,12l-2.5,4\n\tc0,0-1.7-1.7-4.2-1.7c-2.8,0-4.3,2.1-4.3,4.3c0,2.1,1.5,4.4,4.5,4.4c2.5,0,4.9-2.1,4.9-2.1l2.2,4.2C44.5,25,41.9,27.9,36.9,27.9z"/>\n</svg>'),this.$el.append(n[0])}},{key:"render",value:function(){this.renderCcButton();var e=this.core.mediaControl.$el.find("button[data-fullscreen]");return e[0]?this.$el.insertAfter(e):this.core.mediaControl.$el.find(".media-control-right-panel[data-media-control]").prepend(this.$el),this}}]),n}(Ce),dt=function(e){it(n,e);var t=st(n);function n(e){var i;return et(this,n),(i=t.call(this,e)).settingsUpdate(),i}return nt(n,[{key:"template",get:function(){return be('<div class="live-info"><%= live %></div>\n<button type="button" class="live-button" aria-label="<%= backToLive %>"><%= backToLive %></button>\n')}},{key:"name",get:function(){return"dvr_controls"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"events",get:function(){return{"click .live-button":"click"}}},{key:"attributes",get:function(){return{class:"dvr-controls","data-dvr-controls":""}}},{key:"bindEvents",value:function(){this.bindCoreEvents(),this.bindContainerEvents()}},{key:"bindCoreEvents",value:function(){var e=this;this.core.mediaControl.settings?(this.listenTo(this.core.mediaControl,ue.MEDIACONTROL_CONTAINERCHANGED,this.containerChanged),this.listenTo(this.core.mediaControl,ue.MEDIACONTROL_RENDERED,this.settingsUpdate),this.listenTo(this.core,ue.CORE_OPTIONS_CHANGE,this.render)):setTimeout((function(){return e.bindCoreEvents()}),100)}},{key:"bindContainerEvents",value:function(){this.core.activeContainer&&(this.listenToOnce(this.core.activeContainer,ue.CONTAINER_TIMEUPDATE,this.render),this.listenTo(this.core.activeContainer,ue.CONTAINER_PLAYBACKDVRSTATECHANGED,this.dvrChanged))}},{key:"containerChanged",value:function(){this.stopListening(),this.bindEvents()}},{key:"dvrChanged",value:function(e){this.core.getPlaybackType()===we.LIVE&&(this.settingsUpdate(),this.core.mediaControl.$el.addClass("live"),e?(this.core.mediaControl.$el.addClass("dvr"),this.core.mediaControl.$el.find(".media-control-indicator[data-position], .media-control-indicator[data-duration]").hide()):this.core.mediaControl.$el.removeClass("dvr"))}},{key:"click",value:function(){var e=this.core.mediaControl,t=e.container;t.isPlaying()||t.play(),e.$el.hasClass("dvr")&&t.seek(t.getDuration())}},{key:"settingsUpdate",value:function(){var e=this;this.stopListening(),this.core.mediaControl.$el.removeClass("live"),this.shouldRender()&&(this.render(),this.$el.click((function(){return e.click()}))),this.bindEvents()}},{key:"shouldRender",value:function(){return(void 0===this.core.options.useDvrControls||!!this.core.options.useDvrControls)&&this.core.getPlaybackType()===we.LIVE}},{key:"render",value:function(){var e=Ee.getStyleFor('.dvr-controls[data-dvr-controls] {\n display: inline-block;\n float: left;\n color: #fff;\n line-height: 32px;\n font-size: 10px;\n font-weight: bold;\n margin-left: 6px; }\n .dvr-controls[data-dvr-controls] .live-info {\n cursor: default;\n font-family: "Roboto", "Open Sans", Arial, sans-serif;\n text-transform: uppercase; }\n .dvr-controls[data-dvr-controls] .live-info:before {\n content: "";\n display: inline-block;\n position: relative;\n width: 7px;\n height: 7px;\n border-radius: 3.5px;\n margin-right: 3.5px;\n background-color: #ff0101; }\n .dvr-controls[data-dvr-controls] .live-info.disabled {\n opacity: 0.3; }\n .dvr-controls[data-dvr-controls] .live-info.disabled:before {\n background-color: #fff; }\n .dvr-controls[data-dvr-controls] .live-button {\n cursor: pointer;\n outline: none;\n display: none;\n border: 0;\n color: #fff;\n background-color: transparent;\n height: 32px;\n padding: 0;\n opacity: 0.7;\n font-family: "Roboto", "Open Sans", Arial, sans-serif;\n text-transform: uppercase;\n transition: all 0.1s ease; }\n .dvr-controls[data-dvr-controls] .live-button:before {\n content: "";\n display: inline-block;\n position: relative;\n width: 7px;\n height: 7px;\n border-radius: 3.5px;\n margin-right: 3.5px;\n background-color: #fff; }\n .dvr-controls[data-dvr-controls] .live-button:hover {\n opacity: 1;\n text-shadow: rgba(255, 255, 255, 0.75) 0 0 5px; }\n\n.dvr .dvr-controls[data-dvr-controls] .live-info {\n display: none; }\n\n.dvr .dvr-controls[data-dvr-controls] .live-button {\n display: block; }\n\n.dvr.media-control.live[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar] {\n background-color: #005aff; }\n\n.media-control.live[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar] {\n background-color: #ff0101; }\n',{baseUrl:this.options.baseUrl});return this.$el.html(this.template({live:this.core.i18n.t("live"),backToLive:this.core.i18n.t("back_to_live")})),this.$el.append(e[0]),this.shouldRender()&&(this.core.mediaControl.$el.addClass("live"),this.core.mediaControl.$(".media-control-left-panel[data-media-control]").append(this.$el)),this}}]),n}(Ce),ht=function(e){it(n,e);var t=st(n);function n(){return et(this,n),t.apply(this,arguments)}return nt(n,[{key:"name",get:function(){return"end_video"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"bindEvents",value:function(){this.listenTo(this.core,ue.CORE_ACTIVE_CONTAINER_CHANGED,this.containerChanged);var e=this.core.activeContainer;e&&(this.listenTo(e,ue.CONTAINER_ENDED,this.ended),this.listenTo(e,ue.CONTAINER_STOP,this.ended))}},{key:"containerChanged",value:function(){this.stopListening(),this.bindEvents()}},{key:"ended",value:function(){(void 0===this.core.options.exitFullscreenOnEnd||this.core.options.exitFullscreenOnEnd)&&this.core.isFullscreen()&&this.core.toggleFullscreen()}}]),n}(je),ft=function(e){it(n,e);var t=st(n);function n(e){var i;return et(this,n),(i=t.call(this,e)).options.disableErrorScreen?ot(i,i.disable()):i}return nt(n,[{key:"name",get:function(){return"error_screen"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"template",get:function(){return be('<div class="player-error-screen__content" data-error-screen>\n <% if (icon) { %>\n <div class="player-error-screen__icon" data-error-screen><%= icon %></div>\n <% } %>\n <div class="player-error-screen__title" data-error-screen><%= title %></div>\n <div class="player-error-screen__message" data-error-screen><%= message %></div>\n <div class="player-error-screen__code" data-error-screen>Error code: <%= code %></div>\n <div class="player-error-screen__reload" data-error-screen><%= reloadIcon %></div>\n</div>\n')}},{key:"container",get:function(){return this.core.getCurrentContainer()}},{key:"attributes",get:function(){return{class:"player-error-screen","data-error-screen":""}}},{key:"bindEvents",value:function(){this.listenTo(this.core,ue.ERROR,this.onError),this.listenTo(this.core,ue.CORE_ACTIVE_CONTAINER_CHANGED,this.onContainerChanged)}},{key:"bindReload",value:function(){this.reloadButton=this.$el.find(".player-error-screen__reload"),this.reloadButton&&this.reloadButton.on("click",this.reload.bind(this))}},{key:"reload",value:function(){var e=this;this.listenToOnce(this.core,ue.CORE_READY,(function(){return e.container.play()})),this.core.load(this.options.sources,this.options.mimeType),this.unbindReload()}},{key:"unbindReload",value:function(){this.reloadButton&&this.reloadButton.off("click")}},{key:"onContainerChanged",value:function(){this.err=null,this.unbindReload(),this.hide()}},{key:"onError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.level===_e.Levels.FATAL&&(this.err=e,this.container.disableMediaControl(),this.container.stop(),this.show())}},{key:"show",value:function(){this.render(),this.$el.show()}},{key:"hide",value:function(){this.$el.hide()}},{key:"render",value:function(){if(this.err){var e=Ee.getStyleFor("[data-player] .player-error-screen {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n color: #CCCACA;\n position: absolute;\n top: 0;\n height: 100%;\n width: 100%;\n background-color: rgba(0, 0, 0, 0.7);\n z-index: 2000;\n display: flex;\n flex-direction: column;\n justify-content: center; }\n [data-player] .player-error-screen__content[data-error-screen] {\n font-size: 14px;\n color: #CCCACA;\n margin-top: 45px; }\n [data-player] .player-error-screen__title[data-error-screen] {\n font-weight: bold;\n line-height: 30px;\n font-size: 18px; }\n [data-player] .player-error-screen__message[data-error-screen] {\n width: 90%;\n margin: 0 auto; }\n [data-player] .player-error-screen__code[data-error-screen] {\n font-size: 13px;\n margin-top: 15px; }\n [data-player] .player-error-screen__reload {\n cursor: pointer;\n width: 30px;\n margin: 15px auto 0 !important; }\n",{baseUrl:this.options.baseUrl});return this.$el.html(this.template({title:this.err.UI.title,message:this.err.UI.message,code:this.err.code,icon:this.err.UI.icon||"",reloadIcon:'<svg fill="#FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/>\n <path d="M0 0h24v24H0z" fill="none"/>\n</svg>'})),this.$el.append(e[0]),this.core.$el.append(this.el),this.bindReload(),this}}}]),n}(Ce),pt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill="#010101" d="M1.425.35L14.575 8l-13.15 7.65V.35z"/>\n</svg>',gt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M1.712 14.76H6.43V1.24H1.71v13.52zm7.86-13.52v13.52h4.716V1.24H9.573z"/>\n</svg>',vt=w('link[rel="shortcut icon"]'),mt=function(e){it(n,e);var t=st(n);function n(e){var i;return et(this,n),(i=t.call(this,e))._container=null,i.configure(),i}return nt(n,[{key:"name",get:function(){return"favicon"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"oldIcon",get:function(){return vt}},{key:"configure",value:function(){this.core.options.changeFavicon?this.enabled||(this.stopListening(this.core,ue.CORE_OPTIONS_CHANGE),this.enable()):this.enabled&&(this.disable(),this.listenTo(this.core,ue.CORE_OPTIONS_CHANGE,this.configure))}},{key:"bindEvents",value:function(){this.listenTo(this.core,ue.CORE_OPTIONS_CHANGE,this.configure),this.listenTo(this.core,ue.CORE_ACTIVE_CONTAINER_CHANGED,this.containerChanged),this.core.activeContainer&&this.containerChanged()}},{key:"containerChanged",value:function(){this._container&&this.stopListening(this._container),this._container=this.core.activeContainer,this.listenTo(this._container,ue.CONTAINER_PLAY,this.setPlayIcon),this.listenTo(this._container,ue.CONTAINER_PAUSE,this.setPauseIcon),this.listenTo(this._container,ue.CONTAINER_STOP,this.resetIcon),this.listenTo(this._container,ue.CONTAINER_ENDED,this.resetIcon),this.listenTo(this._container,ue.CONTAINER_ERROR,this.resetIcon),this.resetIcon()}},{key:"disable",value:function(){lt(rt(n.prototype),"disable",this).call(this),this.resetIcon()}},{key:"destroy",value:function(){lt(rt(n.prototype),"destroy",this).call(this),this.resetIcon()}},{key:"createIcon",value:function(e){var t=w("<canvas/>");t[0].width=16,t[0].height=16;var n=t[0].getContext("2d");n.fillStyle="#000";var i=w(e).find("path").attr("d"),r=new Path2D(i);n.fill(r);var a=w('<link rel="shortcut icon" type="image/png"/>');return a.attr("href",t[0].toDataURL("image/png")),a}},{key:"setPlayIcon",value:function(){this.playIcon||(this.playIcon=this.createIcon(pt)),this.changeIcon(this.playIcon)}},{key:"setPauseIcon",value:function(){this.pauseIcon||(this.pauseIcon=this.createIcon(gt)),this.changeIcon(this.pauseIcon)}},{key:"resetIcon",value:function(){w('link[rel="shortcut icon"]').remove(),w("head").append(this.oldIcon)}},{key:"changeIcon",value:function(e){e&&(w('link[rel="shortcut icon"]').remove(),w("head").append(e))}}]),n}(je),yt=function(e){it(n,e);var t=st(n);function n(e){var i;return et(this,n),(i=t.call(this,e)).container.options.gaAccount&&(i.account=i.container.options.gaAccount,i.trackerName=i.container.options.gaTrackerName?i.container.options.gaTrackerName+".":"Clappr.",i.domainName=i.container.options.gaDomainName,i.currentHDState=void 0,i.embedScript()),i}return nt(n,[{key:"name",get:function(){return"google_analytics"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"embedScript",value:function(){var e=this;if(window._gat)this.addEventListeners();else{var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("async","async"),t.setAttribute("src","//www.google-analytics.com/ga.js"),t.onload=function(){return e.addEventListeners()},document.body.appendChild(t)}}},{key:"addEventListeners",value:function(){var e=this;this.container&&(this.listenTo(this.container,ue.CONTAINER_READY,this.onReady),this.listenTo(this.container,ue.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,ue.CONTAINER_STOP,this.onStop),this.listenTo(this.container,ue.CONTAINER_PAUSE,this.onPause),this.listenTo(this.container,ue.CONTAINER_ENDED,this.onEnded),this.listenTo(this.container,ue.CONTAINER_STATE_BUFFERING,this.onBuffering),this.listenTo(this.container,ue.CONTAINER_STATE_BUFFERFULL,this.onBufferFull),this.listenTo(this.container,ue.CONTAINER_ERROR,this.onError),this.listenTo(this.container,ue.CONTAINER_PLAYBACKSTATE,this.onPlaybackChanged),this.listenTo(this.container,ue.CONTAINER_VOLUME,(function(t){return e.onVolumeChanged(t)})),this.listenTo(this.container,ue.CONTAINER_SEEK,(function(t){return e.onSeek(t)})),this.listenTo(this.container,ue.CONTAINER_FULL_SCREEN,this.onFullscreen),this.listenTo(this.container,ue.CONTAINER_HIGHDEFINITIONUPDATE,this.onHD),this.listenTo(this.container,ue.CONTAINER_PLAYBACKDVRSTATECHANGED,this.onDVR)),_gaq.push([this.trackerName+"_setAccount",this.account]),this.domainName&&_gaq.push([this.trackerName+"_setDomainName",this.domainName])}},{key:"onReady",value:function(){this.push(["Video","Playback",this.container.playback.name])}},{key:"onPlay",value:function(){this.push(["Video","Play",this.container.playback.src])}},{key:"onStop",value:function(){this.push(["Video","Stop",this.container.playback.src])}},{key:"onEnded",value:function(){this.push(["Video","Ended",this.container.playback.src])}},{key:"onBuffering",value:function(){this.push(["Video","Buffering",this.container.playback.src])}},{key:"onBufferFull",value:function(){this.push(["Video","Bufferfull",this.container.playback.src])}},{key:"onError",value:function(){this.push(["Video","Error",this.container.playback.src])}},{key:"onHD",value:function(e){var t=e?"ON":"OFF";t!==this.currentHDState&&(this.currentHDState=t,this.push(["Video","HD - "+t,this.container.playback.src]))}},{key:"onPlaybackChanged",value:function(e){null!==e.type&&this.push(["Video","Playback Type - "+e.type,this.container.playback.src])}},{key:"onDVR",value:function(e){var t=e?"ON":"OFF";this.push(["Interaction","DVR - "+t,this.container.playback.src])}},{key:"onPause",value:function(){this.push(["Video","Pause",this.container.playback.src])}},{key:"onSeek",value:function(){this.push(["Video","Seek",this.container.playback.src])}},{key:"onVolumeChanged",value:function(){this.push(["Interaction","Volume",this.container.playback.src])}},{key:"onFullscreen",value:function(){this.push(["Interaction","Fullscreen",this.container.playback.src])}},{key:"push",value:function(e){var t=[this.trackerName+"_trackEvent"].concat(e);_gaq.push(t)}}]),n}(Ve),At=function(e){this.element=e||window.document,this.initialize()};At.KEY_NAMES_BY_CODE={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"caps_lock",27:"esc",32:"space",37:"left",38:"up",39:"right",40:"down",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"},At.KEY_CODES_BY_NAME={},function(){for(var e in At.KEY_NAMES_BY_CODE)Object.prototype.hasOwnProperty.call(At.KEY_NAMES_BY_CODE,e)&&(At.KEY_CODES_BY_NAME[At.KEY_NAMES_BY_CODE[e]]=+e)}(),At.MODIFIERS=["shift","ctrl","alt"],At.registerEvent=document.addEventListener?function(e,t,n){e.addEventListener(t,n,!1)}:document.attachEvent?function(e,t,n){e.attachEvent("on"+t,n)}:void 0,At.unregisterEvent=document.removeEventListener?function(e,t,n){e.removeEventListener(t,n,!1)}:document.detachEvent?function(e,t,n){e.detachEvent("on"+t,n)}:void 0,At.stringContains=function(e,t){return-1!==e.indexOf(t)},At.neatString=function(e){return e.replace(/^\s+|\s+$/g,"").replace(/\s+/g," ")},At.capitalize=function(e){return e.toLowerCase().replace(/^./,(function(e){return e.toUpperCase()}))},At.isString=function(e){return At.stringContains(Object.prototype.toString.call(e),"String")},At.arrayIncludes=Array.prototype.indexOf?function(e,t){return-1!==e.indexOf(t)}:function(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return!0;return!1},At.extractModifiers=function(e){var t,n;for(t=[],n=0;n<At.MODIFIERS.length;n++)At.stringContains(e,At.MODIFIERS[n])&&t.push(At.MODIFIERS[n]);return t},At.extractKey=function(e){var t,n;for(t=At.neatString(e).split(" "),n=0;n<t.length;n++)if(!At.arrayIncludes(At.MODIFIERS,t[n]))return t[n]},At.modifiersAndKey=function(e){var t,n;return At.stringContains(e,"any")?At.neatString(e).split(" ").slice(0,2).join(" "):(t=At.extractModifiers(e),(n=At.extractKey(e))&&!At.arrayIncludes(At.MODIFIERS,n)&&t.push(n),t.join(" "))},At.keyName=function(e){return At.KEY_NAMES_BY_CODE[e+""]},At.keyCode=function(e){return+At.KEY_CODES_BY_NAME[e]},At.prototype.initialize=function(){var e,t=this;for(this.lastKeyCode=-1,this.lastModifiers={},e=0;e<At.MODIFIERS.length;e++)this.lastModifiers[At.MODIFIERS[e]]=!1;this.keysDown={any:[]},this.keysUp={any:[]},this.downHandler=this.handler("down"),this.upHandler=this.handler("up"),At.registerEvent(this.element,"keydown",this.downHandler),At.registerEvent(this.element,"keyup",this.upHandler),At.registerEvent(window,"unload",(function e(){At.unregisterEvent(t.element,"keydown",t.downHandler),At.unregisterEvent(t.element,"keyup",t.upHandler),At.unregisterEvent(window,"unload",e)}))},At.prototype.handler=function(e){var t=this;return function(n){var i,r,a;for(n=n||window.event,t.lastKeyCode=n.keyCode,i=0;i<At.MODIFIERS.length;i++)t.lastModifiers[At.MODIFIERS[i]]=n[At.MODIFIERS[i]+"Key"];for(At.arrayIncludes(At.MODIFIERS,At.keyName(t.lastKeyCode))&&(t.lastModifiers[At.keyName(t.lastKeyCode)]=!0),r=t["keys"+At.capitalize(e)],i=0;i<r.any.length;i++)!1===r.any[i](n)&&n.preventDefault&&n.preventDefault();if(r[a=t.lastModifiersAndKey()])for(i=0;i<r[a].length;i++)!1===r[a][i](n)&&n.preventDefault&&n.preventDefault()}},At.prototype.registerKeys=function(e,t,n){var i,r,a=this["keys"+At.capitalize(e)];for(At.isString(t)&&(t=[t]),i=0;i<t.length;i++)r=t[i],a[r=At.modifiersAndKey(r+"")]?a[r].push(n):a[r]=[n];return this},At.prototype.unregisterKeys=function(e,t,n){var i,r,a,o=this["keys"+At.capitalize(e)];for(At.isString(t)&&(t=[t]),i=0;i<t.length;i++)if(a=t[i],a=At.modifiersAndKey(a+""),null===n)delete o[a];else if(o[a])for(r=0;r<o[a].length;r++)if(String(o[a][r])===String(n)){o[a].splice(r,1);break}return this},At.prototype.off=function(e){return this.unregisterKeys("down",e,null)},At.prototype.delegate=function(e,t,n){return null!==n||void 0!==n?this.registerKeys(e,t,n):this.unregisterKeys(e,t,n)},At.prototype.down=function(e,t){return this.delegate("down",e,t)},At.prototype.up=function(e,t){return this.delegate("up",e,t)},At.prototype.lastKey=function(e){return e?this.lastModifiers[e]:At.keyName(this.lastKeyCode)},At.prototype.lastModifiersAndKey=function(){var e,t;for(e=[],t=0;t<At.MODIFIERS.length;t++)this.lastKey(At.MODIFIERS[t])&&e.push(At.MODIFIERS[t]);return At.arrayIncludes(e,this.lastKey())||e.push(this.lastKey()),e.join(" ")};var bt={Kibo:At},Et='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M1.712 1.24h12.6v13.52h-12.6z"/>\n</svg>',Tt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M11.5 11h-.002v1.502L7.798 10H4.5V6h3.297l3.7-2.502V4.5h.003V11zM11 4.49L7.953 6.5H5v3h2.953L11 11.51V4.49z"/>\n</svg>',kt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill="#010101" d="M7.156 8L4 11.156V8.5H3V13h4.5v-1H4.844L8 8.844 7.156 8zM8.5 3v1h2.657L8 7.157 8.846 8 12 4.844V7.5h1V3H8.5z"/>\n</svg>',_t=Q.Config,St=Q.Fullscreen,Ct=Q.formatTime,Rt=Q.extend,wt=Q.removeArrayItem,Ot=function(e){it(n,e);var t=st(n);function n(e){var i;return et(this,n),(i=t.call(this,e)).persistConfig=i.options.persistConfig,i.currentPositionValue=null,i.currentDurationValue=null,i.keepVisible=!1,i.fullScreenOnVideoTagSupported=null,i.setInitialVolume(),i.settings={left:["play","stop","pause"],right:["volume"],default:["position","seekbar","duration"]},i.kibo=new At(i.options.focusElement),i.bindKeyEvents(),i.container?w.isEmptyObject(i.container.settings)||(i.settings=w.extend({},i.container.settings)):i.settings={},i.userDisabled=!1,(i.container&&i.container.mediaControlDisabled||i.options.chromeless)&&i.disable(),i.stopDragHandler=function(e){return i.stopDrag(e)},i.updateDragHandler=function(e){return i.updateDrag(e)},w(document).bind("mouseup",i.stopDragHandler),w(document).bind("mousemove",i.updateDragHandler),i}return nt(n,[{key:"name",get:function(){return"media_control"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"disabled",get:function(){var e=this.container&&this.container.getPlaybackType()===we.NO_OP;return this.userDisabled||e}},{key:"container",get:function(){return this.core&&this.core.activeContainer}},{key:"playback",get:function(){return this.core&&this.core.activePlayback}},{key:"attributes",get:function(){return{class:"media-control","data-media-control":""}}},{key:"events",get:function(){return{"click [data-play]":"play","click [data-pause]":"pause","click [data-playpause]":"togglePlayPause","click [data-stop]":"stop","click [data-playstop]":"togglePlayStop","click [data-fullscreen]":"toggleFullscreen","click .bar-container[data-seekbar]":"seek","click .bar-container[data-volume]":"onVolumeClick","click .drawer-icon[data-volume]":"toggleMute","mouseenter .drawer-container[data-volume]":"showVolumeBar","mouseleave .drawer-container[data-volume]":"hideVolumeBar","mousedown .bar-container[data-volume]":"startVolumeDrag","mousemove .bar-container[data-volume]":"mousemoveOnVolumeBar","mousedown .bar-scrubber[data-seekbar]":"startSeekDrag","mousemove .bar-container[data-seekbar]":"mousemoveOnSeekBar","mouseleave .bar-container[data-seekbar]":"mouseleaveOnSeekBar","mouseenter .media-control-layer[data-controls]":"setUserKeepVisible","mouseleave .media-control-layer[data-controls]":"resetUserKeepVisible"}}},{key:"template",get:function(){return be('<div class="media-control-background" data-background></div>\n<div class="media-control-layer" data-controls>\n <% var renderBar = function(name) { %>\n <div class="bar-container" data-<%= name %>>\n <div class="bar-background" data-<%= name %>>\n <div class="bar-fill-1" data-<%= name %>></div>\n <div class="bar-fill-2" data-<%= name %>></div>\n <div class="bar-hover" data-<%= name %>></div>\n </div>\n <div class="bar-scrubber" data-<%= name %>>\n <div class="bar-scrubber-icon" data-<%= name %>></div>\n </div>\n </div>\n <% }; %>\n <% var renderSegmentedBar = function(name, segments) {\n segments = segments || 10; %>\n <div class="bar-container" data-<%= name %>>\n <% for (var i = 0; i < segments; i++) { %>\n <div class="segmented-bar-element" data-<%= name %>></div>\n <% } %>\n </div>\n <% }; %>\n <% var renderDrawer = function(name, renderContent) { %>\n <div class="drawer-container" data-<%= name %>>\n <div class="drawer-icon-container" data-<%= name %>>\n <div class="drawer-icon media-control-icon" data-<%= name %>></div>\n <span class="drawer-text" data-<%= name %>></span>\n </div>\n <% renderContent(name); %>\n </div>\n <% }; %>\n <% var renderIndicator = function(name) { %>\n <div class="media-control-indicator" data-<%= name %>></div>\n <% }; %>\n <% var renderButton = function(name) { %>\n <button type="button" class="media-control-button media-control-icon" data-<%= name %> aria-label="<%= name %>"></button>\n <% }; %>\n <% var templates = {\n bar: renderBar,\n segmentedBar: renderSegmentedBar,\n };\n var render = function(settingsList) {\n settingsList.forEach(function(setting) {\n if(setting === "seekbar") {\n renderBar(setting);\n } else if (setting === "volume") {\n renderDrawer(setting, settings.volumeBarTemplate ? templates[settings.volumeBarTemplate] : function(name) { return renderSegmentedBar(name); });\n } else if (setting === "duration" || setting === "position") {\n renderIndicator(setting);\n } else {\n renderButton(setting);\n }\n });\n }; %>\n <% if (settings.default && settings.default.length) { %>\n <div class="media-control-center-panel" data-media-control>\n <% render(settings.default); %>\n </div>\n <% } %>\n <% if (settings.left && settings.left.length) { %>\n <div class="media-control-left-panel" data-media-control>\n <% render(settings.left); %>\n </div>\n <% } %>\n <% if (settings.right && settings.right.length) { %>\n <div class="media-control-right-panel" data-media-control>\n <% render(settings.right); %>\n </div>\n <% } %>\n</div>\n')}},{key:"volume",get:function(){return this.container&&this.container.isReady?this.container.volume:this.intendedVolume}},{key:"muted",get:function(){return 0===this.volume}},{key:"getExternalInterface",value:function(){var e=this;return{setVolume:this.setVolume,getVolume:function(){return e.volume}}}},{key:"bindEvents",value:function(){var e=this;this.stopListening(),this.listenTo(this.core,ue.CORE_ACTIVE_CONTAINER_CHANGED,this.onActiveContainerChanged),this.listenTo(this.core,ue.CORE_MOUSE_MOVE,this.show),this.listenTo(this.core,ue.CORE_MOUSE_LEAVE,(function(){return e.hide(e.options.hideMediaControlDelay)})),this.listenTo(this.core,ue.CORE_FULLSCREEN,this.show),this.listenTo(this.core,ue.CORE_OPTIONS_CHANGE,this.configure),this.listenTo(this.core,ue.CORE_RESIZE,this.playerResize),this.bindContainerEvents()}},{key:"bindContainerEvents",value:function(){this.container&&(this.listenTo(this.container,ue.CONTAINER_PLAY,this.changeTogglePlay),this.listenTo(this.container,ue.CONTAINER_PAUSE,this.changeTogglePlay),this.listenTo(this.container,ue.CONTAINER_STOP,this.changeTogglePlay),this.listenTo(this.container,ue.CONTAINER_DBLCLICK,this.toggleFullscreen),this.listenTo(this.container,ue.CONTAINER_TIMEUPDATE,this.onTimeUpdate),this.listenTo(this.container,ue.CONTAINER_PROGRESS,this.updateProgressBar),this.listenTo(this.container,ue.CONTAINER_SETTINGSUPDATE,this.settingsUpdate),this.listenTo(this.container,ue.CONTAINER_PLAYBACKDVRSTATECHANGED,this.settingsUpdate),this.listenTo(this.container,ue.CONTAINER_HIGHDEFINITIONUPDATE,this.highDefinitionUpdate),this.listenTo(this.container,ue.CONTAINER_MEDIACONTROL_DISABLE,this.disable),this.listenTo(this.container,ue.CONTAINER_MEDIACONTROL_ENABLE,this.enable),this.listenTo(this.container,ue.CONTAINER_ENDED,this.ended),this.listenTo(this.container,ue.CONTAINER_VOLUME,this.onVolumeChanged),this.listenTo(this.container,ue.CONTAINER_OPTIONS_CHANGE,this.setInitialVolume),"video"===this.container.playback.el.nodeName.toLowerCase()&&this.listenToOnce(this.container,ue.CONTAINER_LOADEDMETADATA,this.onLoadedMetadataOnVideoTag))}},{key:"disable",value:function(){this.userDisabled=!0,this.hide(),this.unbindKeyEvents(),this.$el.hide()}},{key:"enable",value:function(){this.options.chromeless||(this.userDisabled=!1,this.bindKeyEvents(),this.show())}},{key:"play",value:function(){this.container&&this.container.play()}},{key:"pause",value:function(){this.container&&this.container.pause()}},{key:"stop",value:function(){this.container&&this.container.stop()}},{key:"setInitialVolume",value:function(){var e=this.persistConfig?_t.restore("volume"):100,t=this.container&&this.container.options||this.options;this.setVolume(t.mute?0:e,!0)}},{key:"onVolumeChanged",value:function(){this.updateVolumeUI()}},{key:"onLoadedMetadataOnVideoTag",value:function(){var e=this.playback&&this.playback.el;!St.fullscreenEnabled()&&e.webkitSupportsFullscreen&&(this.fullScreenOnVideoTagSupported=!0,this.settingsUpdate())}},{key:"updateVolumeUI",value:function(){if(this.rendered){this.$volumeBarContainer.find(".bar-fill-2").css({});var e=this.$volumeBarContainer.width(),t=this.$volumeBarBackground.width(),n=(e-t)/2,i=t*this.volume/100+n;this.$volumeBarFill.css({width:"".concat(this.volume,"%")}),this.$volumeBarScrubber.css({left:i}),this.$volumeBarContainer.find(".segmented-bar-element").removeClass("fill");var r=Math.ceil(this.volume/10);this.$volumeBarContainer.find(".segmented-bar-element").slice(0,r).addClass("fill"),this.$volumeIcon.html(""),this.$volumeIcon.removeClass("muted"),this.muted?(this.$volumeIcon.append('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M9.75 11.51L6.7 9.5H3.75v-3H6.7L9.75 4.49v.664l.497.498V3.498L6.547 6H3.248v4h3.296l3.7 2.502v-2.154l-.497.5v.662zm3-5.165L12.404 6l-1.655 1.653L9.093 6l-.346.345L10.402 8 8.747 9.654l.346.347 1.655-1.653L12.403 10l.348-.346L11.097 8l1.655-1.655z"/>\n</svg>'),this.$volumeIcon.addClass("muted")):this.$volumeIcon.append(Tt),this.applyButtonStyle(this.$volumeIcon)}}},{key:"changeTogglePlay",value:function(){this.$playPauseToggle.html(""),this.$playStopToggle.html(""),this.container&&this.container.isPlaying()?(this.$playPauseToggle.append(gt),this.$playStopToggle.append(Et),this.trigger(ue.MEDIACONTROL_PLAYING)):(this.$playPauseToggle.append(pt),this.$playStopToggle.append(pt),this.trigger(ue.MEDIACONTROL_NOTPLAYING),D.isMobile&&this.show()),this.applyButtonStyle(this.$playPauseToggle),this.applyButtonStyle(this.$playStopToggle)}},{key:"mousemoveOnSeekBar",value:function(e){if(this.settings.seekEnabled){var t=e.pageX-this.$seekBarContainer.offset().left-this.$seekBarHover.width()/2;this.$seekBarHover.css({left:t})}this.trigger(ue.MEDIACONTROL_MOUSEMOVE_SEEKBAR,e)}},{key:"mouseleaveOnSeekBar",value:function(e){this.trigger(ue.MEDIACONTROL_MOUSELEAVE_SEEKBAR,e)}},{key:"onVolumeClick",value:function(e){this.setVolume(this.getVolumeFromUIEvent(e))}},{key:"mousemoveOnVolumeBar",value:function(e){this.draggingVolumeBar&&this.setVolume(this.getVolumeFromUIEvent(e))}},{key:"playerResize",value:function(e){this.$fullscreenToggle.html("");var t=this.core.isFullscreen()?'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill="#010101" d="M13.5 3.344l-.844-.844L9.5 5.656V3h-1v4.5H13v-1h-2.656L13.5 3.344zM3 9.5h2.656L2.5 12.656l.844.844L6.5 10.344V13h1V8.5H3v1z"/>\n</svg>':kt;this.$fullscreenToggle.append(t),this.applyButtonStyle(this.$fullscreenToggle),0!==this.$el.find(".media-control").length&&this.$el.removeClass("w320"),(e.width<=320||this.options.hideVolumeBar)&&this.$el.addClass("w320")}},{key:"togglePlayPause",value:function(){return this.container.isPlaying()?this.container.pause():this.container.play(),!1}},{key:"togglePlayStop",value:function(){this.container.isPlaying()?this.container.stop():this.container.play()}},{key:"startSeekDrag",value:function(e){this.settings.seekEnabled&&(this.draggingSeekBar=!0,this.$el.addClass("dragging"),this.$seekBarLoaded.addClass("media-control-notransition"),this.$seekBarPosition.addClass("media-control-notransition"),this.$seekBarScrubber.addClass("media-control-notransition"),e&&e.preventDefault())}},{key:"startVolumeDrag",value:function(e){this.draggingVolumeBar=!0,this.$el.addClass("dragging"),e&&e.preventDefault()}},{key:"stopDrag",value:function(e){this.draggingSeekBar&&this.seek(e),this.$el.removeClass("dragging"),this.$seekBarLoaded.removeClass("media-control-notransition"),this.$seekBarPosition.removeClass("media-control-notransition"),this.$seekBarScrubber.removeClass("media-control-notransition dragging"),this.draggingSeekBar=!1,this.draggingVolumeBar=!1}},{key:"updateDrag",value:function(e){if(this.draggingSeekBar){e.preventDefault();var t=(e.pageX-this.$seekBarContainer.offset().left)/this.$seekBarContainer.width()*100;t=Math.min(100,Math.max(t,0)),this.setSeekPercentage(t)}else this.draggingVolumeBar&&(e.preventDefault(),this.setVolume(this.getVolumeFromUIEvent(e)))}},{key:"getVolumeFromUIEvent",value:function(e){return(e.pageX-this.$volumeBarContainer.offset().left)/this.$volumeBarContainer.width()*100}},{key:"toggleMute",value:function(){this.setVolume(this.muted?100:0)}},{key:"setVolume",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e=Math.min(100,Math.max(e,0)),this.intendedVolume=e,this.persistConfig&&!n&&_t.persist("volume",e);var i=function(){t.container&&t.container.isReady?t.container.setVolume(e):t.listenToOnce(t.container,ue.CONTAINER_READY,(function(){t.container.setVolume(e)}))};this.container?i():this.listenToOnce(this,ue.MEDIACONTROL_CONTAINERCHANGED,(function(){return i()}))}},{key:"toggleFullscreen",value:function(){this.trigger(ue.MEDIACONTROL_FULLSCREEN,this.name),this.container.fullscreen(),this.core.toggleFullscreen(),this.resetUserKeepVisible()}},{key:"onActiveContainerChanged",value:function(){this.fullScreenOnVideoTagSupported=null,this.bindEvents(),this.setInitialVolume(),this.changeTogglePlay(),this.bindContainerEvents(),this.settingsUpdate(),this.container&&this.container.trigger(ue.CONTAINER_PLAYBACKDVRSTATECHANGED,this.container.isDvrInUse()),this.container&&this.container.mediaControlDisabled&&this.disable(),this.trigger(ue.MEDIACONTROL_CONTAINERCHANGED)}},{key:"showVolumeBar",value:function(){this.hideVolumeId&&clearTimeout(this.hideVolumeId),this.$volumeBarContainer.removeClass("volume-bar-hide")}},{key:"hideVolumeBar",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:400;this.$volumeBarContainer&&(this.draggingVolumeBar?this.hideVolumeId=setTimeout((function(){return e.hideVolumeBar()}),t):(this.hideVolumeId&&clearTimeout(this.hideVolumeId),this.hideVolumeId=setTimeout((function(){return e.$volumeBarContainer.addClass("volume-bar-hide")}),t)))}},{key:"ended",value:function(){this.changeTogglePlay()}},{key:"updateProgressBar",value:function(e){var t=e.start/e.total*100,n=e.current/e.total*100;this.$seekBarLoaded.css({left:"".concat(t,"%"),width:"".concat(n-t,"%")})}},{key:"onTimeUpdate",value:function(e){if(!this.draggingSeekBar){var t=e.current<0?e.total:e.current;this.currentPositionValue=t,this.currentDurationValue=e.total,this.renderSeekBar()}}},{key:"renderSeekBar",value:function(){if(null!==this.currentPositionValue&&null!==this.currentDurationValue){this.currentSeekBarPercentage=100,this.container&&(this.container.getPlaybackType()!==we.LIVE||this.container.isDvrInUse())&&(this.currentSeekBarPercentage=this.currentPositionValue/this.currentDurationValue*100),this.setSeekPercentage(this.currentSeekBarPercentage);var e=Ct(this.currentPositionValue),t=Ct(this.currentDurationValue);e!==this.displayedPosition&&(this.$position.text(e),this.displayedPosition=e),t!==this.displayedDuration&&(this.$duration.text(t),this.displayedDuration=t)}}},{key:"seek",value:function(e){if(this.settings.seekEnabled){var t=(e.pageX-this.$seekBarContainer.offset().left)/this.$seekBarContainer.width()*100;return t=Math.min(100,Math.max(t,0)),this.container&&this.container.seekPercentage(t),this.setSeekPercentage(t),!1}}},{key:"setKeepVisible",value:function(){this.keepVisible=!0}},{key:"resetKeepVisible",value:function(){this.keepVisible=!1}},{key:"setUserKeepVisible",value:function(){this.userKeepVisible=!0}},{key:"resetUserKeepVisible",value:function(){this.userKeepVisible=!1}},{key:"isVisible",value:function(){return!this.$el.hasClass("media-control-hide")}},{key:"show",value:function(e){var t=this;if(!this.disabled){var n=e&&e.clientX!==this.lastMouseX&&e.clientY!==this.lastMouseY;(!e||n||navigator.userAgent.match(/firefox/i))&&(clearTimeout(this.hideId),this.$el.show(),this.trigger(ue.MEDIACONTROL_SHOW,this.name),this.container&&this.container.trigger(ue.CONTAINER_MEDIACONTROL_SHOW,this.name),this.$el.removeClass("media-control-hide"),this.hideId=setTimeout((function(){return t.hide()}),2e3),e&&(this.lastMouseX=e.clientX,this.lastMouseY=e.clientY));this.updateCursorStyle(!0)}}},{key:"hide",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.isVisible()){var n=t||2e3;if(clearTimeout(this.hideId),this.disabled||!1!==this.options.hideMediaControl){var i=this.userKeepVisible||this.keepVisible,r=this.draggingSeekBar||this.draggingVolumeBar;if(!this.disabled&&(t||i||r))this.hideId=setTimeout((function(){return e.hide()}),n);else{this.trigger(ue.MEDIACONTROL_HIDE,this.name),this.container&&this.container.trigger(ue.CONTAINER_MEDIACONTROL_HIDE,this.name),this.$el.addClass("media-control-hide"),this.hideVolumeBar(0);var a=!1;this.updateCursorStyle(a)}}}}},{key:"updateCursorStyle",value:function(e){e?this.core.$el.removeClass("nocursor"):this.core.isFullscreen()&&this.core.$el.addClass("nocursor")}},{key:"settingsUpdate",value:function(){var e=this.getSettings();!e||this.fullScreenOnVideoTagSupported||St.fullscreenEnabled()||(e.default&&wt(e.default,"fullscreen"),e.left&&wt(e.left,"fullscreen"),e.right&&wt(e.right,"fullscreen")),JSON.stringify(this.settings)!==JSON.stringify(e)&&(this.settings=e,this.render())}},{key:"getSettings",value:function(){return w.extend(!0,{},this.container&&this.container.settings)}},{key:"highDefinitionUpdate",value:function(e){this.isHD=e;var t=e?"addClass":"removeClass";this.$hdIndicator[t]("enabled")}},{key:"createCachedElements",value:function(){var e=this.$el.find(".media-control-layer");this.$duration=e.find(".media-control-indicator[data-duration]"),this.$fullscreenToggle=e.find("button.media-control-button[data-fullscreen]"),this.$playPauseToggle=e.find("button.media-control-button[data-playpause]"),this.$playStopToggle=e.find("button.media-control-button[data-playstop]"),this.$position=e.find(".media-control-indicator[data-position]"),this.$seekBarContainer=e.find(".bar-container[data-seekbar]"),this.$seekBarHover=e.find(".bar-hover[data-seekbar]"),this.$seekBarLoaded=e.find(".bar-fill-1[data-seekbar]"),this.$seekBarPosition=e.find(".bar-fill-2[data-seekbar]"),this.$seekBarScrubber=e.find(".bar-scrubber[data-seekbar]"),this.$volumeBarContainer=e.find(".bar-container[data-volume]"),this.$volumeContainer=e.find(".drawer-container[data-volume]"),this.$volumeIcon=e.find(".drawer-icon[data-volume]"),this.$volumeBarBackground=this.$el.find(".bar-background[data-volume]"),this.$volumeBarFill=this.$el.find(".bar-fill-1[data-volume]"),this.$volumeBarScrubber=this.$el.find(".bar-scrubber[data-volume]"),this.$hdIndicator=this.$el.find("button.media-control-button[data-hd-indicator]"),this.resetIndicators(),this.initializeIcons()}},{key:"resetIndicators",value:function(){this.displayedPosition=this.$position.text(),this.displayedDuration=this.$duration.text()}},{key:"initializeIcons",value:function(){var e=this.$el.find(".media-control-layer");e.find("button.media-control-button[data-play]").append(pt),e.find("button.media-control-button[data-pause]").append(gt),e.find("button.media-control-button[data-stop]").append(Et),this.$playPauseToggle.append(pt),this.$playStopToggle.append(pt),this.$volumeIcon.append(Tt),this.$fullscreenToggle.append(kt),this.$hdIndicator.append('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill="#010101" d="M5.375 7.062H2.637V4.26H.502v7.488h2.135V8.9h2.738v2.848h2.133V4.26H5.375v2.802zm5.97-2.81h-2.84v7.496h2.798c2.65 0 4.195-1.607 4.195-3.77v-.022c0-2.162-1.523-3.704-4.154-3.704zm2.06 3.758c0 1.21-.81 1.896-2.03 1.896h-.83V6.093h.83c1.22 0 2.03.696 2.03 1.896v.02z"/>\n</svg>')}},{key:"setSeekPercentage",value:function(e){e=Math.max(Math.min(e,100),0),this.displayedSeekBarPercentage!==e&&(this.displayedSeekBarPercentage=e,this.$seekBarPosition.removeClass("media-control-notransition"),this.$seekBarScrubber.removeClass("media-control-notransition"),this.$seekBarPosition.css({width:"".concat(e,"%")}),this.$seekBarScrubber.css({left:"".concat(e,"%")}))}},{key:"seekRelative",value:function(e){if(this.settings.seekEnabled){var t=this.container.getCurrentTime(),n=this.container.getDuration(),i=Math.min(Math.max(t+e,0),n);i=Math.min(100*i/n,100),this.container.seekPercentage(i)}}},{key:"bindKeyAndShow",value:function(e,t){var n=this;this.kibo.down(e,(function(){return n.show(),t()}))}},{key:"bindKeyEvents",value:function(){var e=this;if(!D.isMobile&&!this.options.disableKeyboardShortcuts){this.unbindKeyEvents(),this.kibo=new At(this.options.focusElement||this.options.parentElement),this.bindKeyAndShow("space",(function(){return e.togglePlayPause()})),this.bindKeyAndShow("left",(function(){return e.seekRelative(-5)})),this.bindKeyAndShow("right",(function(){return e.seekRelative(5)})),this.bindKeyAndShow("shift left",(function(){return e.seekRelative(-10)})),this.bindKeyAndShow("shift right",(function(){return e.seekRelative(10)})),this.bindKeyAndShow("shift ctrl left",(function(){return e.seekRelative(-15)})),this.bindKeyAndShow("shift ctrl right",(function(){return e.seekRelative(15)}));["1","2","3","4","5","6","7","8","9","0"].forEach((function(t){e.bindKeyAndShow(t,(function(){e.settings.seekEnabled&&e.container&&e.container.seekPercentage(10*t)}))}))}}},{key:"unbindKeyEvents",value:function(){this.kibo&&(this.kibo.off("space"),this.kibo.off("left"),this.kibo.off("right"),this.kibo.off("shift left"),this.kibo.off("shift right"),this.kibo.off("shift ctrl left"),this.kibo.off("shift ctrl right"),this.kibo.off(["1","2","3","4","5","6","7","8","9","0"]))}},{key:"parseColors",value:function(){if(this.options.mediacontrol){this.buttonsColor=this.options.mediacontrol.buttons;var e=this.options.mediacontrol.seekbar;this.$el.find(".bar-fill-2[data-seekbar]").css("background-color",e),this.$el.find(".media-control-icon svg path").css("fill",this.buttonsColor),this.$el.find(".segmented-bar-element[data-volume]").css("boxShadow","inset 2px 0 0 "+this.buttonsColor)}}},{key:"applyButtonStyle",value:function(e){this.buttonsColor&&e&&w(e).find("svg path").css("fill",this.buttonsColor)}},{key:"destroy",value:function(){w(document).unbind("mouseup",this.stopDragHandler),w(document).unbind("mousemove",this.updateDragHandler),this.unbindKeyEvents(),this.stopListening(),lt(rt(n.prototype),"destroy",this).call(this)}},{key:"configure",value:function(e){this.options.chromeless||e.source||e.sources?this.disable():this.enable(),this.trigger(ue.MEDIACONTROL_OPTIONS_CHANGE)}},{key:"render",value:function(){var e=this,t=this.options.hideMediaControlDelay||2e3;this.settings&&this.$el.html(this.template({settings:this.settings}));var n=Ee.getStyleFor('.media-control-notransition {\n transition: none !important; }\n\n.media-control[data-media-control] {\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: 9999;\n pointer-events: none; }\n .media-control[data-media-control].dragging {\n pointer-events: auto;\n cursor: -webkit-grabbing !important;\n cursor: grabbing !important;\n cursor: url("closed-hand.cur"), move; }\n .media-control[data-media-control].dragging * {\n cursor: -webkit-grabbing !important;\n cursor: grabbing !important;\n cursor: url("closed-hand.cur"), move; }\n .media-control[data-media-control] .media-control-background[data-background] {\n position: absolute;\n height: 40%;\n width: 100%;\n bottom: 0;\n background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));\n will-change: transform, opacity;\n transition: opacity 0.6s ease-out; }\n .media-control[data-media-control] .media-control-icon {\n line-height: 0;\n letter-spacing: 0;\n speak: none;\n color: #fff;\n opacity: 0.5;\n vertical-align: middle;\n text-align: left;\n transition: all 0.1s ease; }\n .media-control[data-media-control] .media-control-icon:hover {\n color: white;\n opacity: 0.75;\n text-shadow: rgba(255, 255, 255, 0.8) 0 0 5px; }\n .media-control[data-media-control].media-control-hide .media-control-background[data-background] {\n opacity: 0; }\n .media-control[data-media-control].media-control-hide .media-control-layer[data-controls] {\n transform: translateY(50px); }\n .media-control[data-media-control].media-control-hide .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] {\n opacity: 0; }\n .media-control[data-media-control] .media-control-layer[data-controls] {\n position: absolute;\n transform: translateY(-7px);\n bottom: 0;\n width: 100%;\n height: 32px;\n font-size: 0;\n vertical-align: middle;\n pointer-events: auto;\n transition: bottom 0.4s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-left-panel[data-media-control] {\n position: absolute;\n top: 0;\n left: 4px;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-center-panel[data-media-control] {\n height: 100%;\n text-align: center;\n line-height: 32px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-right-panel[data-media-control] {\n position: absolute;\n top: 0;\n right: 4px;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button {\n background-color: transparent;\n border: 0;\n margin: 0 6px;\n padding: 0;\n cursor: pointer;\n display: inline-block;\n width: 32px;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button svg {\n width: 100%;\n height: 22px; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button svg path {\n fill: white; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button:focus {\n outline: none; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-play] {\n float: left;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-pause] {\n float: left;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-stop] {\n float: left;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-fullscreen] {\n float: right;\n background-color: transparent;\n border: 0;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator] {\n background-color: transparent;\n border: 0;\n cursor: default;\n display: none;\n float: right;\n height: 100%; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled {\n display: block;\n opacity: 1.0; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled:hover {\n opacity: 1.0;\n text-shadow: none; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause] {\n float: left; }\n .media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop] {\n float: left; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-position], .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration] {\n display: inline-block;\n font-size: 10px;\n color: white;\n cursor: default;\n line-height: 32px;\n position: relative; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-position] {\n margin: 0 6px 0 7px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration] {\n color: rgba(255, 255, 255, 0.5);\n margin-right: 6px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration]:before {\n content: "|";\n margin-right: 7px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] {\n position: absolute;\n top: -20px;\n left: 0;\n display: inline-block;\n vertical-align: middle;\n width: 100%;\n height: 25px;\n cursor: pointer; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] {\n width: 100%;\n height: 1px;\n position: relative;\n top: 12px;\n background-color: #666666; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-1[data-seekbar] {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n background-color: #c2c2c2;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar] {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n background-color: #005aff;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-hover[data-seekbar] {\n opacity: 0;\n position: absolute;\n top: -3px;\n width: 5px;\n height: 7px;\n background-color: rgba(255, 255, 255, 0.5);\n transition: opacity 0.1s ease; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar]:hover .bar-background[data-seekbar] .bar-hover[data-seekbar] {\n opacity: 1; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar].seek-disabled {\n cursor: default; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar].seek-disabled:hover .bar-background[data-seekbar] .bar-hover[data-seekbar] {\n opacity: 0; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] {\n position: absolute;\n transform: translateX(-50%);\n top: 2px;\n left: 0;\n width: 20px;\n height: 20px;\n opacity: 1;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] .bar-scrubber-icon[data-seekbar] {\n position: absolute;\n left: 6px;\n top: 6px;\n width: 8px;\n height: 8px;\n border-radius: 10px;\n box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.2);\n background-color: white; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] {\n float: right;\n display: inline-block;\n height: 32px;\n cursor: pointer;\n margin: 0 6px;\n box-sizing: border-box; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] {\n float: left;\n bottom: 0; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume] {\n background-color: transparent;\n border: 0;\n box-sizing: content-box;\n width: 32px;\n height: 32px;\n opacity: 0.5; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume]:hover {\n opacity: 0.75; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume] svg {\n height: 24px;\n position: relative;\n top: 3px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume] svg path {\n fill: white; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume].muted svg {\n margin-left: 2px; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] {\n float: left;\n position: relative;\n overflow: hidden;\n top: 6px;\n width: 42px;\n height: 18px;\n padding: 3px 0;\n transition: width .2s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] {\n height: 1px;\n position: relative;\n top: 7px;\n margin: 0 3px;\n background-color: #666666; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] .bar-fill-1[data-volume] {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n background-color: #c2c2c2;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] .bar-fill-2[data-volume] {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n background-color: #005aff;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] .bar-hover[data-volume] {\n opacity: 0;\n position: absolute;\n top: -3px;\n width: 5px;\n height: 7px;\n background-color: rgba(255, 255, 255, 0.5);\n transition: opacity 0.1s ease; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-scrubber[data-volume] {\n position: absolute;\n transform: translateX(-50%);\n top: 0px;\n left: 0;\n width: 20px;\n height: 20px;\n opacity: 1;\n transition: all 0.1s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-scrubber[data-volume] .bar-scrubber-icon[data-volume] {\n position: absolute;\n left: 6px;\n top: 6px;\n width: 8px;\n height: 8px;\n border-radius: 10px;\n box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.2);\n background-color: white; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume] {\n float: left;\n width: 4px;\n padding-left: 2px;\n height: 12px;\n opacity: 0.5;\n box-shadow: inset 2px 0 0 white;\n transition: transform .2s ease-out; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume].fill {\n box-shadow: inset 2px 0 0 #fff;\n opacity: 1; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]:nth-of-type(1) {\n padding-left: 0; }\n .media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]:hover {\n transform: scaleY(1.5); }\n .media-control[data-media-control].w320 .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume].volume-bar-hide {\n width: 0;\n height: 12px;\n top: 9px;\n padding: 0; }\n',{baseUrl:this.options.baseUrl});this.$el.append(n[0]),this.createCachedElements(),this.$playPauseToggle.addClass("paused"),this.$playStopToggle.addClass("stopped"),this.changeTogglePlay(),this.container&&(this.hideId=setTimeout((function(){return e.hide()}),t),this.disabled&&this.hide()),D.isSafari&&D.isMobile&&(D.version<10?this.$volumeContainer.css("display","none"):this.$volumeBarContainer.css("display","none")),this.$seekBarPosition.addClass("media-control-notransition"),this.$seekBarScrubber.addClass("media-control-notransition");var i=0;return this.displayedSeekBarPercentage&&(i=this.displayedSeekBarPercentage),this.displayedSeekBarPercentage=null,this.setSeekPercentage(i),setTimeout((function(){!e.settings.seekEnabled&&e.$seekBarContainer.addClass("seek-disabled"),!D.isMobile&&!e.options.disableKeyboardShortcuts&&e.bindKeyEvents(),e.playerResize({width:e.options.width,height:e.options.height}),e.hideVolumeBar(0)}),0),this.parseColors(),this.highDefinitionUpdate(this.isHD),this.core.$el.append(this.el),this.rendered=!0,this.updateVolumeUI(),this.trigger(ue.MEDIACONTROL_RENDERED),this}}]),n}(Ce);Ot.extend=function(e){return Rt(Ot,e)};for(var Lt=Q.formatTime,Dt={ClickToPause:ut,ClosedCaptions:ct,DVRControls:dt,EndVideo:ht,ErrorScreen:ft,Favicon:mt,GoogleAnalytics:yt,MediaControl:Ot,Poster:function(e){it(n,e);var t=st(n);function n(e){var i;return et(this,n),(i=t.call(this,e)).hasStartedPlaying=!1,i.playRequested=!1,i.render(),setTimeout((function(){return i.update()}),0),i}return nt(n,[{key:"name",get:function(){return"poster"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"template",get:function(){return be('<div class="play-wrapper" data-poster></div>\n')}},{key:"shouldRender",get:function(){var e=!(!this.options.poster||!this.options.poster.showForNoOp);return"html_img"!==this.container.playback.name&&(this.container.playback.getPlaybackType()!==we.NO_OP||e)}},{key:"attributes",get:function(){return{class:"player-poster","data-poster":""}}},{key:"events",get:function(){return{click:"clicked"}}},{key:"showOnVideoEnd",get:function(){return!this.options.poster||this.options.poster.showOnVideoEnd||void 0===this.options.poster.showOnVideoEnd}},{key:"bindEvents",value:function(){this.listenTo(this.container,ue.CONTAINER_STOP,this.onStop),this.listenTo(this.container,ue.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,ue.CONTAINER_STATE_BUFFERING,this.update),this.listenTo(this.container,ue.CONTAINER_STATE_BUFFERFULL,this.update),this.listenTo(this.container,ue.CONTAINER_OPTIONS_CHANGE,this.render),this.listenTo(this.container,ue.CONTAINER_ERROR,this.onError),this.showOnVideoEnd&&this.listenTo(this.container,ue.CONTAINER_ENDED,this.onStop)}},{key:"onError",value:function(e){this.hasFatalError=e.level===_e.Levels.FATAL,this.hasFatalError&&(this.hasStartedPlaying=!1,this.playRequested=!1,this.showPlayButton())}},{key:"onPlay",value:function(){this.hasStartedPlaying=!0,this.update()}},{key:"onStop",value:function(){this.hasStartedPlaying=!1,this.playRequested=!1,this.update()}},{key:"updatePlayButton",value:function(e){!e||this.options.chromeless&&!this.options.allowUserInteraction?this.hidePlayButton():this.showPlayButton()}},{key:"showPlayButton",value:function(){this.hasFatalError&&!this.options.disableErrorScreen||(this.$playButton.show(),this.$el.addClass("clickable"))}},{key:"hidePlayButton",value:function(){this.$playButton.hide(),this.$el.removeClass("clickable")}},{key:"clicked",value:function(){if(!this.hasStartedPlaying)return this.options.chromeless&&!this.options.allowUserInteraction||(this.playRequested=!0,this.update(),this.container.playback&&(this.container.playback._consented=!0),this.container.play()),!1}},{key:"shouldHideOnPlay",value:function(){return!this.container.playback.isAudioOnly}},{key:"update",value:function(){if(this.shouldRender){var e=!this.playRequested&&!this.hasStartedPlaying&&!this.container.buffering;this.updatePlayButton(e),this.updatePoster()}}},{key:"updatePoster",value:function(){this.hasStartedPlaying?this.hidePoster():this.showPoster()}},{key:"showPoster",value:function(){this.container.disableMediaControl(),this.$el.show()}},{key:"hidePoster",value:function(){this.container.enableMediaControl(),this.shouldHideOnPlay()&&this.$el.hide()}},{key:"render",value:function(){if(this.shouldRender){var e=Ee.getStyleFor(".player-poster[data-poster] {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n height: 100%;\n width: 100%;\n z-index: 998;\n top: 0;\n left: 0;\n background-color: transparent;\n background-size: cover;\n background-repeat: no-repeat;\n background-position: 50% 50%; }\n .player-poster[data-poster].clickable {\n cursor: pointer; }\n .player-poster[data-poster]:hover .play-wrapper[data-poster] {\n opacity: 1; }\n .player-poster[data-poster] .play-wrapper[data-poster] {\n width: 100%;\n height: 25%;\n margin: 0 auto;\n opacity: 0.75;\n transition: opacity 0.1s ease; }\n .player-poster[data-poster] .play-wrapper[data-poster] svg {\n height: 100%; }\n .player-poster[data-poster] .play-wrapper[data-poster] svg path {\n fill: #fff; }\n",{baseUrl:this.options.baseUrl});if(this.$el.html(this.template()),this.$el.append(e[0]),this.options.poster&&void 0===this.options.poster.custom){var t=this.options.poster.url||this.options.poster;this.$el.css({"background-image":"url("+t+")"}),this.removeVideoElementPoster()}else this.options.poster&&(this.$el.css({background:this.options.poster.custom}),this.removeVideoElementPoster());this.container.$el.append(this.el),this.$playWrapper=this.$el.find(".play-wrapper"),this.$playWrapper.append(pt),this.$playButton=this.$playWrapper.find("svg"),this.$playButton.addClass("poster-icon"),this.$playButton.attr("data-poster","");var n=this.options.mediacontrol&&this.options.mediacontrol.buttons;return n&&this.$el.find("svg path").css("fill",n),this.options.mediacontrol&&this.options.mediacontrol.buttons&&(n=this.options.mediacontrol.buttons,this.$playButton.css("color",n)),this.update(),this}}},{key:"removeVideoElementPoster",value:function(){this.container.playback&&this.container.playback.$el&&this.container.playback.$el[0]&&this.container.playback.$el[0].removeAttribute&&this.container.playback.$el[0].removeAttribute("poster")}}]),n}(Ke),SeekTime:function(e){it(n,e);var t=st(n);function n(e){var i;return et(this,n),(i=t.call(this,e)).hoveringOverSeekBar=!1,i.hoverPosition=null,i.duration=null,i.firstFragDateTime=null,i.actualLiveTime=!!i.mediaControl.options.actualLiveTime,i.actualLiveTime&&(i.mediaControl.options.actualLiveServerTime?i.actualLiveServerTimeDiff=(new Date).getTime()-new Date(i.mediaControl.options.actualLiveServerTime).getTime():i.actualLiveServerTimeDiff=0),i}return nt(n,[{key:"name",get:function(){return"seek_time"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"template",get:function(){return be("<span data-seek-time></span>\n<span data-duration></span>\n")}},{key:"attributes",get:function(){return{class:"seek-time","data-seek-time":""}}},{key:"mediaControl",get:function(){return this.core.mediaControl}},{key:"mediaControlContainer",get:function(){return this.mediaControl.container}},{key:"isLiveStreamWithDvr",get:function(){return this.mediaControlContainer&&this.mediaControlContainer.getPlaybackType()===we.LIVE&&this.mediaControlContainer.isDvrEnabled()}},{key:"durationShown",get:function(){return this.isLiveStreamWithDvr&&!this.actualLiveTime}},{key:"useActualLiveTime",get:function(){return this.actualLiveTime&&this.isLiveStreamWithDvr}},{key:"bindEvents",value:function(){this.listenTo(this.mediaControl,ue.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.mediaControl,ue.MEDIACONTROL_MOUSEMOVE_SEEKBAR,this.showTime),this.listenTo(this.mediaControl,ue.MEDIACONTROL_MOUSELEAVE_SEEKBAR,this.hideTime),this.listenTo(this.mediaControl,ue.MEDIACONTROL_CONTAINERCHANGED,this.onContainerChanged),this.mediaControlContainer&&(this.listenTo(this.mediaControlContainer,ue.CONTAINER_PLAYBACKDVRSTATECHANGED,this.update),this.listenTo(this.mediaControlContainer,ue.CONTAINER_TIMEUPDATE,this.updateDuration))}},{key:"onContainerChanged",value:function(){this.stopListening(),this.bindEvents()}},{key:"updateDuration",value:function(e){this.duration=e.total,this.firstFragDateTime=e.firstFragDateTime,this.update()}},{key:"showTime",value:function(e){this.hoveringOverSeekBar=!0,this.calculateHoverPosition(e),this.update()}},{key:"hideTime",value:function(){this.hoveringOverSeekBar=!1,this.update()}},{key:"calculateHoverPosition",value:function(e){var t=e.pageX-this.mediaControl.$seekBarContainer.offset().left;this.hoverPosition=Math.min(1,Math.max(t/this.mediaControl.$seekBarContainer.width(),0))}},{key:"getSeekTime",value:function(){var e,t,n,i;return this.useActualLiveTime?(this.firstFragDateTime?(i=new Date(this.firstFragDateTime),(n=new Date(this.firstFragDateTime)).setHours(0,0,0,0),t=(i.getTime()-n.getTime())/1e3+this.duration):(n=new Date((new Date).getTime()-this.actualLiveServerTimeDiff),t=((i=new Date(n))-n.setHours(0,0,0,0))/1e3),(e=t-this.duration+this.hoverPosition*this.duration)<0&&(e+=86400)):e=this.hoverPosition*this.duration,{seekTime:e,secondsSinceMidnight:t}}},{key:"update",value:function(){if(this.rendered)if(this.shouldBeVisible()){var e=this.getSeekTime(),t=Lt(e.seekTime,this.useActualLiveTime);if(t!==this.displayedSeekTime&&(this.$seekTimeEl.text(t),this.displayedSeekTime=t),this.durationShown){this.$durationEl.show();var n=Lt(this.actualLiveTime?e.secondsSinceMidnight:this.duration,this.actualLiveTime);n!==this.displayedDuration&&(this.$durationEl.text(n),this.displayedDuration=n)}else this.$durationEl.hide();this.$el.show();var i=this.mediaControl.$seekBarContainer.width(),r=this.$el.width(),a=this.hoverPosition*i;a-=r/2,a=Math.max(0,Math.min(a,i-r)),this.$el.css("left",a)}else this.$el.hide(),this.$el.css("left","-100%")}},{key:"shouldBeVisible",value:function(){return this.mediaControlContainer&&this.mediaControlContainer.settings.seekEnabled&&this.hoveringOverSeekBar&&null!==this.hoverPosition&&null!==this.duration}},{key:"render",value:function(){var e=Ee.getStyleFor('.seek-time[data-seek-time] {\n position: absolute;\n white-space: nowrap;\n height: 20px;\n line-height: 20px;\n font-size: 0;\n left: -100%;\n bottom: 55px;\n background-color: rgba(2, 2, 2, 0.5);\n z-index: 9999;\n transition: opacity 0.1s ease; }\n .seek-time[data-seek-time].hidden[data-seek-time] {\n opacity: 0; }\n .seek-time[data-seek-time] [data-seek-time] {\n display: inline-block;\n color: white;\n font-size: 10px;\n padding-left: 7px;\n padding-right: 7px;\n vertical-align: top; }\n .seek-time[data-seek-time] [data-duration] {\n display: inline-block;\n color: rgba(255, 255, 255, 0.5);\n font-size: 10px;\n padding-right: 7px;\n vertical-align: top; }\n .seek-time[data-seek-time] [data-duration]:before {\n content: "|";\n margin-right: 7px; }\n',{baseUrl:this.options.baseUrl});this.rendered=!0,this.displayedDuration=null,this.displayedSeekTime=null,this.$el.html(this.template()),this.$el.append(e[0]),this.$el.hide(),this.mediaControl.$el.append(this.el),this.$seekTimeEl=this.$el.find("[data-seek-time]"),this.$durationEl=this.$el.find("[data-duration]"),this.$durationEl.hide(),this.update()}}]),n}(Ce),SpinnerThreeBounce:function(e){it(n,e);var t=st(n);function n(e){var i;return et(this,n),(i=t.call(this,e)).template=be("<div data-bounce1></div><div data-bounce2></div><div data-bounce3></div>\n"),i.showTimeout=null,i.listenTo(i.container,ue.CONTAINER_STATE_BUFFERING,i.onBuffering),i.listenTo(i.container,ue.CONTAINER_STATE_BUFFERFULL,i.onBufferFull),i.listenTo(i.container,ue.CONTAINER_STOP,i.onStop),i.listenTo(i.container,ue.CONTAINER_ENDED,i.onStop),i.listenTo(i.container,ue.CONTAINER_ERROR,i.onStop),i.render(),i}return nt(n,[{key:"name",get:function(){return"spinner"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"attributes",get:function(){return{"data-spinner":"",class:"spinner-three-bounce"}}},{key:"onBuffering",value:function(){this.show()}},{key:"onBufferFull",value:function(){this.hide()}},{key:"onStop",value:function(){this.hide()}},{key:"show",value:function(){var e=this;null===this.showTimeout&&(this.showTimeout=setTimeout((function(){return e.$el.show()}),300))}},{key:"hide",value:function(){null!==this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.$el.hide()}},{key:"render",value:function(){var e=Ee.getStyleFor(".spinner-three-bounce[data-spinner] {\n position: absolute;\n margin: 0 auto;\n width: 70px;\n text-align: center;\n z-index: 999;\n left: 0;\n right: 0;\n margin-left: auto;\n margin-right: auto;\n /* center vertically */\n top: 50%;\n transform: translateY(-50%); }\n .spinner-three-bounce[data-spinner] > div {\n width: 18px;\n height: 18px;\n background-color: #FFFFFF;\n border-radius: 100%;\n display: inline-block;\n -webkit-animation: bouncedelay 1.4s infinite ease-in-out;\n animation: bouncedelay 1.4s infinite ease-in-out;\n /* Prevent first frame from flickering when animation starts */\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both; }\n .spinner-three-bounce[data-spinner] [data-bounce1] {\n -webkit-animation-delay: -0.32s;\n animation-delay: -0.32s; }\n .spinner-three-bounce[data-spinner] [data-bounce2] {\n -webkit-animation-delay: -0.16s;\n animation-delay: -0.16s; }\n\n@-webkit-keyframes bouncedelay {\n 0%, 80%, 100% {\n transform: scale(0); }\n 40% {\n transform: scale(1); } }\n\n@keyframes bouncedelay {\n 0%, 80%, 100% {\n transform: scale(0); }\n 40% {\n transform: scale(1); } }\n",{baseUrl:this.options.baseUrl});return this.$el.html(this.template()),this.$el.append(e[0]),this.container.$el.append(this.$el),this.$el.hide(),this.container.buffering&&this.onBuffering(),this}}]),n}(Ke),Stats:function(e){it(n,e);var t=st(n);function n(e){var i;return et(this,n),(i=t.call(this,e)).setInitialAttrs(),i.reportInterval=i.options.reportInterval||5e3,i.state="IDLE",i}return nt(n,[{key:"name",get:function(){return"stats"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"bindEvents",value:function(){this.listenTo(this.container.playback,ue.PLAYBACK_PLAY,this.onPlay),this.listenTo(this.container,ue.CONTAINER_STOP,this.onStop),this.listenTo(this.container,ue.CONTAINER_ENDED,this.onStop),this.listenTo(this.container,ue.CONTAINER_DESTROYED,this.onStop),this.listenTo(this.container,ue.CONTAINER_STATE_BUFFERING,this.onBuffering),this.listenTo(this.container,ue.CONTAINER_STATE_BUFFERFULL,this.onBufferFull),this.listenTo(this.container,ue.CONTAINER_STATS_ADD,this.onStatsAdd),this.listenTo(this.container,ue.CONTAINER_BITRATE,this.onStatsAdd),this.listenTo(this.container.playback,ue.PLAYBACK_STATS_ADD,this.onStatsAdd)}},{key:"setInitialAttrs",value:function(){this.firstPlay=!0,this.startupTime=0,this.rebufferingTime=0,this.watchingTime=0,this.rebuffers=0,this.externalMetrics={}}},{key:"onPlay",value:function(){this.state="PLAYING",this.watchingTimeInit=Date.now(),this.intervalId||(this.intervalId=setInterval(this.report.bind(this),this.reportInterval))}},{key:"onStop",value:function(){clearInterval(this.intervalId),this.report(),this.intervalId=void 0,this.state="STOPPED"}},{key:"onBuffering",value:function(){this.firstPlay?this.startupTimeInit=Date.now():this.rebufferingTimeInit=Date.now(),this.state="BUFFERING",this.rebuffers++}},{key:"onBufferFull",value:function(){this.firstPlay&&this.startupTimeInit?(this.firstPlay=!1,this.startupTime=Date.now()-this.startupTimeInit,this.watchingTimeInit=Date.now()):this.rebufferingTimeInit&&(this.rebufferingTime+=this.getRebufferingTime()),this.rebufferingTimeInit=void 0,this.state="PLAYING"}},{key:"getRebufferingTime",value:function(){return Date.now()-this.rebufferingTimeInit}},{key:"getWatchingTime",value:function(){return Date.now()-this.watchingTimeInit-this.rebufferingTime}},{key:"isRebuffering",value:function(){return!!this.rebufferingTimeInit}},{key:"onStatsAdd",value:function(e){w.extend(this.externalMetrics,e)}},{key:"getStats",value:function(){var e={startupTime:this.startupTime,rebuffers:this.rebuffers,rebufferingTime:this.isRebuffering()?this.rebufferingTime+this.getRebufferingTime():this.rebufferingTime,watchingTime:this.isRebuffering()?this.getWatchingTime()-this.getRebufferingTime():this.getWatchingTime()};return w.extend(e,this.externalMetrics),e}},{key:"report",value:function(){this.container.statsReport(this.getStats())}}]),n}(Ve),WaterMark:function(e){it(n,e);var t=st(n);function n(e){var i;return et(this,n),(i=t.call(this,e)).configure(),i}return nt(n,[{key:"name",get:function(){return"watermark"}},{key:"supportedVersion",get:function(){return{min:"0.4.20"}}},{key:"template",get:function(){return be('<div class="clappr-watermark" data-watermark data-watermark-<%=position %>>\n<% if(typeof imageLink !== \'undefined\') { %>\n<a target="_blank" href="<%= imageLink %>">\n<% } %>\n<img src="<%= imageUrl %>">\n<% if(typeof imageLink !== \'undefined\') { %>\n</a>\n<% } %>\n</div>\n')}},{key:"bindEvents",value:function(){this.listenTo(this.container,ue.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,ue.CONTAINER_STOP,this.onStop),this.listenTo(this.container,ue.CONTAINER_OPTIONS_CHANGE,this.configure)}},{key:"configure",value:function(){this.position=this.options.position||"bottom-right",this.options.watermark?(this.imageUrl=this.options.watermark,this.imageLink=this.options.watermarkLink,this.render()):this.$el.remove()}},{key:"onPlay",value:function(){this.hidden||this.$el.show()}},{key:"onStop",value:function(){this.$el.hide()}},{key:"render",value:function(){this.$el.hide();var e=Ee.getStyleFor(".clappr-watermark[data-watermark] {\n position: absolute;\n min-width: 70px;\n max-width: 200px;\n width: 12%;\n text-align: center;\n z-index: 10; }\n\n.clappr-watermark[data-watermark] a {\n outline: none;\n cursor: pointer; }\n\n.clappr-watermark[data-watermark] img {\n max-width: 100%; }\n\n.clappr-watermark[data-watermark-bottom-left] {\n bottom: 10px;\n left: 10px; }\n\n.clappr-watermark[data-watermark-bottom-right] {\n bottom: 10px;\n right: 42px; }\n\n.clappr-watermark[data-watermark-top-left] {\n top: 10px;\n left: 10px; }\n\n.clappr-watermark[data-watermark-top-right] {\n top: 10px;\n right: 37px; }\n",{baseUrl:this.options.baseUrl}),t={position:this.position,imageUrl:this.imageUrl,imageLink:this.imageLink};return this.$el.html(this.template(t)),this.$el.append(e[0]),this.container.$el.append(this.$el),this}}]),n}(Ke)},It=0,Pt=Object.values(Dt);It<Pt.length;It++){var xt=Pt[It];Fe.registerPlugin(xt)}var Nt=Dt.ClickToPause,Mt=Dt.ClosedCaptions,Ft=Dt.DVRControls,Bt=Dt.EndVideo,Ut=Dt.ErrorScreen,Vt=Dt.Favicon,jt=Dt.GoogleAnalytics,Kt=Dt.MediaControl,Gt=Dt.Poster,Yt=Dt.SeekTime,Ht=Dt.SpinnerThreeBounce,$t=Dt.Stats,zt=Dt.WaterMark,Wt=t(t({},Je),{},{ClickToPause:Nt,ClosedCaptions:Mt,DVRControls:Ft,EndVideo:Bt,ErrorScreen:Ut,Favicon:Vt,GoogleAnalytics:jt,MediaControl:Kt,Poster:Gt,SeekTime:Yt,SpinnerThreeBounce:Ht,Stats:$t,WaterMark:zt,Vendor:bt,Plugins:Dt,version:"0.4.6"});function qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Xt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qt(Object(n),!0).forEach((function(t){Jt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Zt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Jt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function en(e){return(en=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tn(e,t){return(tn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function nn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function rn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=en(e);if(t){var r=en(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return nn(this,n)}}function an(e,t,n){return(an="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=en(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}})(e,t,n||e)}function on(e){return function(e){if(Array.isArray(e))return sn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return sn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sn(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function ln(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var un,cn,dn={exports:{}};un=dn,"undefined"!=typeof window&&(cn=function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":
/*!*********************************************!*\
!*** ./node_modules/eventemitter3/index.js ***!
\*********************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){var i=Object.prototype.hasOwnProperty,r="~";function a(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,i,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,i||e,a),l=r?r+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function u(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(r=!1)),u.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(r?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},u.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=new Array(a);i<a;i++)o[i]=n[i].fn;return o},u.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},u.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var l,u,c=this._events[s],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var h,f=c.length;for(u=0;u<f;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,n);break;case 4:c[u].fn.call(c[u].context,t,n,i);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c[u].fn.apply(c[u].context,l)}}return!0},u.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},u.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},u.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return l(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||i&&!o.once||n&&o.context!==n||l(this,a);else{for(var s=0,u=[],c=o.length;s<c;s++)(o[s].fn!==t||i&&!o[s].once||n&&o[s].context!==n)&&u.push(o[s]);u.length?this._events[a]=1===u.length?u[0]:u:l(this,a)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&l(this,t)):(this._events=new a,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=r,u.EventEmitter=u,e.exports=u},"./node_modules/url-toolkit/src/url-toolkit.js":
/*!*****************************************************!*\
!*** ./node_modules/url-toolkit/src/url-toolkit.js ***!
\*****************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){var i,r,a,o,s;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/,r=/^([^\/?#]*)(.*)$/,a=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=s.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=s.normalizePath(i.path),s.buildURLFromParts(i)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return n.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var 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=n.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(a,"");e.length!==(e=e.replace(o,"")).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},"./node_modules/webworkify-webpack/index.js":
/*!**************************************************!*\
!*** ./node_modules/webworkify-webpack/index.js ***!
\**************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){function i(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n.oe=function(e){throw console.error(e),e};var i=n(n.s=ENTRY_MODULE);return i.default||i}var r="[\\.|\\-|\\+|\\w|/|@]+",a="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";function o(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function s(e,t,i){var s={};s[i]=[];var l=t.toString(),u=l.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return s;for(var c,d=u[1],h=new RegExp("(\\\\n|\\W)"+o(d)+a,"g");c=h.exec(l);)"dll-reference"!==c[3]&&s[i].push(c[3]);for(h=new RegExp("\\("+o(d)+'\\("(dll-reference\\s('+r+'))"\\)\\)'+a,"g");c=h.exec(l);)e[c[2]]||(s[i].push(c[1]),e[c[2]]=n(c[1]).m),s[c[2]]=s[c[2]]||[],s[c[2]].push(c[4]);for(var f,p=Object.keys(s),g=0;g<p.length;g++)for(var v=0;v<s[p[g]].length;v++)f=s[p[g]][v],isNaN(1*f)||(s[p[g]][v]=1*s[p[g]][v]);return s}function l(e){return Object.keys(e).reduce((function(t,n){return t||e[n].length>0}),!1)}e.exports=function(e,t){t=t||{};var r={main:n.m},a=t.all?{main:Object.keys(r.main)}:function(e,t){for(var n={main:[t]},i={main:[]},r={main:{}};l(n);)for(var a=Object.keys(n),o=0;o<a.length;o++){var u=a[o],c=n[u].pop();if(r[u]=r[u]||{},!r[u][c]&&e[u][c]){r[u][c]=!0,i[u]=i[u]||[],i[u].push(c);for(var d=s(e,e[u][c],u),h=Object.keys(d),f=0;f<h.length;f++)n[h[f]]=n[h[f]]||[],n[h[f]]=n[h[f]].concat(d[h[f]])}}return i}(r,e),o="";Object.keys(a).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;a[e][t];)t++;a[e].push(t),r[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+e+" = ("+i.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+a[e].map((function(t){return JSON.stringify(t)+": "+r[e][t].toString()})).join(",")+"});\n"})),o=o+"new (("+i.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+a.main.map((function(e){return JSON.stringify(e)+": "+r.main[e].toString()})).join(",")+"}))(self);";var u=new window.Blob([o],{type:"text/javascript"});if(t.bare)return u;var c=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(u),d=new window.Worker(c);return d.objectURL=c,d}},"./src/crypt/decrypter.js":
/*!********************************************!*\
!*** ./src/crypt/decrypter.js + 3 modules ***!
\********************************************/
/*! exports provided: default */
/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/hls.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/hls.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/hls.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/hls.ts */function(e,t,n){n.r(t);var i=function(){function e(e,t){this.subtle=e,this.aesIV=t}return e.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)},e}(),r=function(){function e(e,t){this.subtle=e,this.key=t}return e.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},e}(),a=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.initTable()}var t=e.prototype;return t.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),n=new Uint32Array(4),i=0;i<4;i++)n[i]=t.getUint32(4*i);return n},t.initTable=function(){var e=this.sBox,t=this.invSBox,n=this.subMix,i=n[0],r=n[1],a=n[2],o=n[3],s=this.invSubMix,l=s[0],u=s[1],c=s[2],d=s[3],h=new Uint32Array(256),f=0,p=0,g=0;for(g=0;g<256;g++)h[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^255&v^99,e[f]=v,t[v]=f;var m=h[f],y=h[m],A=h[y],b=257*h[v]^16843008*v;i[f]=b<<24|b>>>8,r[f]=b<<16|b>>>16,a[f]=b<<8|b>>>24,o[f]=b,b=16843009*A^65537*y^257*m^16843008*f,l[v]=b<<24|b>>>8,u[v]=b<<16|b>>>16,c[v]=b<<8|b>>>24,d[v]=b,f?(f=m^h[h[h[A^m]]],p^=h[h[p]]):f=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),n=!0,i=0;i<t.length&&n;)n=t[i]===this.key[i],i++;if(!n){this.key=t;var r=this.keySize=t.length;if(4!==r&&6!==r&&8!==r)throw new Error("Invalid aes key size="+r);var a,o,s,l,u=this.ksRows=4*(r+6+1),c=this.keySchedule=new Uint32Array(u),d=this.invKeySchedule=new Uint32Array(u),h=this.sBox,f=this.rcon,p=this.invSubMix,g=p[0],v=p[1],m=p[2],y=p[3];for(a=0;a<u;a++)a<r?s=c[a]=t[a]:(l=s,a%r==0?(l=h[(l=l<<8|l>>>24)>>>24]<<24|h[l>>>16&255]<<16|h[l>>>8&255]<<8|h[255&l],l^=f[a/r|0]<<24):r>6&&a%r==4&&(l=h[l>>>24]<<24|h[l>>>16&255]<<16|h[l>>>8&255]<<8|h[255&l]),c[a]=s=(c[a-r]^l)>>>0);for(o=0;o<u;o++)a=u-o,l=3&o?c[a]:c[a-4],d[o]=o<4||a<=4?l:g[h[l>>>24]]^v[h[l>>>16&255]]^m[h[l>>>8&255]]^y[h[255&l]],d[o]=d[o]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,n,i){for(var r,a,o,s,l,u,c,d,h,f,p,g,v,m,y,A,b,E=this.keySize+6,T=this.invKeySchedule,k=this.invSBox,_=this.invSubMix,S=_[0],C=_[1],R=_[2],w=_[3],O=this.uint8ArrayToUint32Array_(n),L=O[0],D=O[1],I=O[2],P=O[3],x=new Int32Array(e),N=new Int32Array(x.length),M=this.networkToHostOrderSwap;t<x.length;){for(h=M(x[t]),f=M(x[t+1]),p=M(x[t+2]),g=M(x[t+3]),l=h^T[0],u=g^T[1],c=p^T[2],d=f^T[3],v=4,m=1;m<E;m++)r=S[l>>>24]^C[u>>16&255]^R[c>>8&255]^w[255&d]^T[v],a=S[u>>>24]^C[c>>16&255]^R[d>>8&255]^w[255&l]^T[v+1],o=S[c>>>24]^C[d>>16&255]^R[l>>8&255]^w[255&u]^T[v+2],s=S[d>>>24]^C[l>>16&255]^R[u>>8&255]^w[255&c]^T[v+3],l=r,u=a,c=o,d=s,v+=4;r=k[l>>>24]<<24^k[u>>16&255]<<16^k[c>>8&255]<<8^k[255&d]^T[v],a=k[u>>>24]<<24^k[c>>16&255]<<16^k[d>>8&255]<<8^k[255&l]^T[v+1],o=k[c>>>24]<<24^k[d>>16&255]<<16^k[l>>8&255]<<8^k[255&u]^T[v+2],s=k[d>>>24]<<24^k[l>>16&255]<<16^k[u>>8&255]<<8^k[255&c]^T[v+3],v+=3,N[t]=M(r^L),N[t+1]=M(s^D),N[t+2]=M(o^I),N[t+3]=M(a^P),L=h,D=f,I=p,P=g,t+=4}return i?(y=N.buffer,A=y.byteLength,(b=A&&new DataView(y).getUint8(A-1))?y.slice(0,A-b):y):N.buffer},t.destroy=function(){this.key=void 0,this.keySize=void 0,this.ksRows=void 0,this.sBox=void 0,this.invSBox=void 0,this.subMix=void 0,this.invSubMix=void 0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.rcon=void 0},e}(),o=n("./src/errors.ts"),s=n("./src/utils/logger.js"),l=n("./src/events.js"),u=n("./src/utils/get-self-scope.js"),c=Object(u.getSelfScope)(),d=function(){function e(e,t,n){var i=(void 0===n?{}:n).removePKCS7Padding,r=void 0===i||i;if(this.logEnabled=!0,this.observer=e,this.config=t,this.removePKCS7Padding=r,r)try{var a=c.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(e){}this.disableWebCrypto=!this.subtle}var t=e.prototype;return t.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},t.decrypt=function(e,t,n,o){var l=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(s.logger.log("JS AES decrypt"),this.logEnabled=!1);var u=this.decryptor;u||(this.decryptor=u=new a),u.expandKey(t),o(u.decrypt(e,0,n,this.removePKCS7Padding))}else{this.logEnabled&&(s.logger.log("WebCrypto AES decrypt"),this.logEnabled=!1);var c=this.subtle;this.key!==t&&(this.key=t,this.fastAesKey=new r(c,t)),this.fastAesKey.expandKey().then((function(r){new i(c,n).decrypt(e,r).catch((function(i){l.onWebCryptoError(i,e,t,n,o)})).then((function(e){o(e)}))})).catch((function(i){l.onWebCryptoError(i,e,t,n,o)}))}},t.onWebCryptoError=function(e,t,n,i,r){this.config.enableSoftwareAES?(s.logger.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(t,n,i,r)):(s.logger.error("decrypting error : "+e.message),this.observer.trigger(l.default.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:e.message}))},t.destroy=function(){var e=this.decryptor;e&&(e.destroy(),this.decryptor=void 0)},e}();t.default=d},"./src/demux/demuxer-inline.js":
/*!**************************************************!*\
!*** ./src/demux/demuxer-inline.js + 12 modules ***!
\**************************************************/
/*! exports provided: default */
/*! ModuleConcatenation bailout: Cannot concat with ./src/crypt/decrypter.js because of ./src/hls.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/id3.js because of ./src/hls.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/mp4demuxer.js because of ./src/hls.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/hls.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/hls.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/polyfills/number.js because of ./src/hls.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/hls.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/hls.ts */function(e,t,n){n.r(t);var i=n("./src/events.js"),r=n("./src/errors.ts"),a=n("./src/crypt/decrypter.js"),o=n("./src/polyfills/number.js"),s=n("./src/utils/logger.js"),l=n("./src/utils/get-self-scope.js");function u(e,t){return 255===e[t]&&240==(246&e[t+1])}function c(e,t){return 1&e[t+1]?7:9}function d(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function h(e,t){return!!(t+1<e.length&&u(e,t))}function f(e,t){if(h(e,t)){var n=c(e,t);if(t+n>=e.length)return!1;var i=d(e,t);if(i<=n)return!1;var r=t+i;if(r===e.length||r+1<e.length&&u(e,r))return!0}return!1}function p(e,t,n,a,o){if(!e.samplerate){var l=function(e,t,n,a){var o,l,u,c,d,h=navigator.userAgent.toLowerCase(),f=a,p=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];if(o=1+((192&t[n+2])>>>6),!((l=(60&t[n+2])>>>2)>p.length-1))return c=(1&t[n+2])<<2,c|=(192&t[n+3])>>>6,s.logger.log("manifest codec:"+a+",ADTS data:type:"+o+",sampleingIndex:"+l+"["+p[l]+"Hz],channelConfig:"+c),/firefox/i.test(h)?l>=6?(o=5,d=new Array(4),u=l-3):(o=2,d=new Array(2),u=l):-1!==h.indexOf("android")?(o=2,d=new Array(2),u=l):(o=5,d=new Array(4),a&&(-1!==a.indexOf("mp4a.40.29")||-1!==a.indexOf("mp4a.40.5"))||!a&&l>=6?u=l-3:((a&&-1!==a.indexOf("mp4a.40.2")&&(l>=6&&1===c||/vivaldi/i.test(h))||!a&&1===c)&&(o=2,d=new Array(2)),u=l)),d[0]=o<<3,d[0]|=(14&l)>>1,d[1]|=(1&l)<<7,d[1]|=c<<3,5===o&&(d[1]|=(14&u)>>1,d[2]=(1&u)<<7,d[2]|=8,d[3]=0),{config:d,samplerate:p[l],channelCount:c,codec:"mp4a.40."+o,manifestCodec:f};e.trigger(i.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+l})}(t,n,a,o);e.config=l.config,e.samplerate=l.samplerate,e.channelCount=l.channelCount,e.codec=l.codec,e.manifestCodec=l.manifestCodec,s.logger.log("parsed codec:"+e.codec+",rate:"+l.samplerate+",nb channel:"+l.channelCount)}}function g(e){return 9216e4/e}function v(e,t,n,i,r){var a=function(e,t,n,i,r){var a,o,s=e.length;if(a=c(e,t),o=d(e,t),(o-=a)>0&&t+a+o<=s)return{headerLength:a,frameLength:o,stamp:n+i*r}}(t,n,i,r,g(e.samplerate));if(a){var o=a.stamp,s=a.headerLength,l=a.frameLength,u={unit:t.subarray(n+s,n+s+l),pts:o,dts:o};return e.samples.push(u),{sample:u,length:l+s}}}var m=n("./src/demux/id3.js"),y=function(){function e(e,t,n){this.observer=e,this.config=n,this.remuxer=t}var t=e.prototype;return t.resetInitSegment=function(e,t,n,i){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:t,duration:i,inputTimeScale:9e4}},t.resetTimeStamp=function(){},e.probe=function(e){if(!e)return!1;for(var t=(m.default.getID3Data(e,0)||[]).length,n=e.length;t<n;t++)if(f(e,t))return s.logger.log("ADTS sync word found !"),!0;return!1},t.append=function(e,t,n,i){for(var r=this._audioTrack,a=m.default.getID3Data(e,0)||[],l=m.default.getTimeStamp(a),u=Object(o.isFiniteNumber)(l)?90*l:9e4*t,c=0,d=u,f=e.length,g=a.length,y=[{pts:d,dts:d,data:a}];g<f-1;)if(h(e,g)&&g+5<f){p(r,this.observer,e,g,r.manifestCodec);var A=v(r,e,g,u,c);if(!A){s.logger.log("Unable to parse AAC frame");break}g+=A.length,d=A.sample.pts,c++}else m.default.isHeader(e,g)?(a=m.default.getID3Data(e,g),y.push({pts:d,dts:d,data:a}),g+=a.length):g++;this.remuxer.remux(r,{samples:[]},{samples:y,inputTimeScale:9e4},{samples:[]},t,n,i)},t.destroy=function(){},e}(),A=n("./src/demux/mp4demuxer.js"),b={BitratesMap:[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],SamplingRateMap:[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],SamplesCoefficients:[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],BytesInSlot:[0,1,1,4],appendFrame:function(e,t,n,i,r){if(!(n+24>t.length)){var a=this.parseHeader(t,n);if(a&&n+a.frameLength<=t.length){var o=i+r*(9e4*a.samplesPerFrame/a.sampleRate),s={unit:t.subarray(n,n+a.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(s),{sample:s,length:a.frameLength}}}},parseHeader:function(e,t){var n=e[t+1]>>3&3,i=e[t+1]>>1&3,r=e[t+2]>>4&15,a=e[t+2]>>2&3,o=e[t+2]>>1&1;if(1!==n&&0!==r&&15!==r&&3!==a){var s=3===n?3-i:3===i?3:4,l=1e3*b.BitratesMap[14*s+r-1],u=3===n?0:2===n?1:2,c=b.SamplingRateMap[3*u+a],d=e[t+3]>>6==3?1:2,h=b.SamplesCoefficients[n][i],f=b.BytesInSlot[i],p=8*h*f;return{sampleRate:c,channelCount:d,frameLength:parseInt(h*l/c+o,10)*f,samplesPerFrame:p}}},isHeaderPattern:function(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])},isHeader:function(e,t){return!!(t+1<e.length&&this.isHeaderPattern(e,t))},probe:function(e,t){if(t+1<e.length&&this.isHeaderPattern(e,t)){var n=this.parseHeader(e,t),i=4;n&&n.frameLength&&(i=n.frameLength);var r=t+i;if(r===e.length||r+1<e.length&&this.isHeaderPattern(e,r))return!0}return!1}},E=b,T=function(){function e(e){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,n=e.byteLength-t,i=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");i.set(e.subarray(n,n+r)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r},t.skipBits=function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(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),n=this.word>>>32-t;return e>32&&s.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),(t=e-t)>0&&this.bitsAvailable?n<<t|this.readBits(t):n},t.skipLZ=function(){var e;for(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)},t.skipScalingList=function(e){var t,n=8,i=8;for(t=0;t<e;t++)0!==i&&(i=(n+this.readEG()+256)%256),n=0===i?n:i},t.readSPS=function(){var e,t,n,i,r,a,o,s=0,l=0,u=0,c=0,d=this.readUByte.bind(this),h=this.readBits.bind(this),f=this.readUEG.bind(this),p=this.readBoolean.bind(this),g=this.skipBits.bind(this),v=this.skipEG.bind(this),m=this.skipUEG.bind(this),y=this.skipScalingList.bind(this);if(d(),e=d(),h(5),g(3),d(),m(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var A=f();if(3===A&&g(1),m(),m(),g(1),p())for(a=3!==A?8:12,o=0;o<a;o++)p()&&y(o<6?16:64)}m();var b=f();if(0===b)f();else if(1===b)for(g(1),v(),v(),t=f(),o=0;o<t;o++)v();m(),g(1),n=f(),i=f(),0===(r=h(1))&&g(1),g(1),p()&&(s=f(),l=f(),u=f(),c=f());var E=[1,1];if(p()&&p())switch(d()){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:E=[d()<<8|d(),d()<<8|d()]}return{width:Math.ceil(16*(n+1)-2*s-2*l),height:(2-r)*(i+1)*16-(r?2:4)*(u+c),pixelRatio:E}},t.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}(),k=function(){function e(e,t,n,i){this.decryptdata=n,this.discardEPB=i,this.decrypter=new a.default(e,t,{removePKCS7Padding:!1})}var t=e.prototype;return t.decryptBuffer=function(e,t){this.decrypter.decrypt(e,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,t)},t.decryptAacSample=function(e,t,n,i){var r=e[t].unit,a=r.subarray(16,r.length-r.length%16),o=a.buffer.slice(a.byteOffset,a.byteOffset+a.length),s=this;this.decryptBuffer(o,(function(a){a=new Uint8Array(a),r.set(a,16),i||s.decryptAacSamples(e,t+1,n)}))},t.decryptAacSamples=function(e,t,n){for(;;t++){if(t>=e.length)return void n();if(!(e[t].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(e,t,n,i),!i)return}}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,n=new Int8Array(t),i=0,r=32;r<=e.length-16;r+=160,i+=16)n.set(e.subarray(r,r+16),i);return n},t.getAvcDecryptedUnit=function(e,t){t=new Uint8Array(t);for(var n=0,i=32;i<=e.length-16;i+=160,n+=16)e.set(t.subarray(n,n+16),i);return e},t.decryptAvcSample=function(e,t,n,i,r,a){var o=this.discardEPB(r.data),s=this.getAvcEncryptedData(o),l=this;this.decryptBuffer(s.buffer,(function(s){r.data=l.getAvcDecryptedUnit(o,s),a||l.decryptAvcSamples(e,t,n+1,i)}))},t.decryptAvcSamples=function(e,t,n,i){for(;;t++,n=0){if(t>=e.length)return void i();for(var r=e[t].units;!(n>=r.length);n++){var a=r[n];if(!(a.data.length<=48||1!==a.type&&5!==a.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(e,t,n,i,a,o),!o)return}}}},e}(),_={video:1,audio:2,id3:3,text:4},S=function(){function e(e,t,n,i){this.observer=e,this.config=n,this.typeSupported=i,this.remuxer=t,this.sampleAes=null,this.pmtUnknownTypes={}}var t=e.prototype;return t.setDecryptData=function(e){null!=e&&null!=e.key&&"SAMPLE-AES"===e.method?this.sampleAes=new k(this.observer,this.config,e,this.discardEPB):this.sampleAes=null},e.probe=function(t){var n=e._syncOffset(t);return!(n<0||(n&&s.logger.warn("MPEG2-TS detected but first sync word found @ offset "+n+", junk ahead ?"),0))},e._syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),n=0;n<t;){if(71===e[n]&&71===e[n+188]&&71===e[n+376])return n;n++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:_[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:"video"===e?0:void 0,isAAC:"audio"===e||void 0,duration:"audio"===e?t:void 0}},t.resetInitSegment=function(t,n,i,r){this.pmtParsed=!1,this._pmtId=-1,this.pmtUnknownTypes={},this._avcTrack=e.createTrack("video",r),this._audioTrack=e.createTrack("audio",r),this._id3Track=e.createTrack("id3",r),this._txtTrack=e.createTrack("text",r),this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=n,this.videoCodec=i,this._duration=r},t.resetTimeStamp=function(){},t.append=function(t,n,a,o){var l,u,c,d,h,f=t.length,p=!1;this.pmtUnknownTypes={},this.contiguous=a;var g=this.pmtParsed,v=this._avcTrack,m=this._audioTrack,y=this._id3Track,A=v.pid,b=m.pid,E=y.pid,T=this._pmtId,k=v.pesData,_=m.pesData,S=y.pesData,C=this._parsePAT,R=this._parsePMT.bind(this),w=this._parsePES,O=this._parseAVCPES.bind(this),L=this._parseAACPES.bind(this),D=this._parseMPEGPES.bind(this),I=this._parseID3PES.bind(this),P=e._syncOffset(t);for(f-=(f+P)%188,l=P;l<f;l+=188)if(71===t[l]){if(u=!!(64&t[l+1]),c=((31&t[l+1])<<8)+t[l+2],(48&t[l+3])>>4>1){if((d=l+5+t[l+4])===l+188)continue}else d=l+4;switch(c){case A:u&&(k&&(h=w(k))&&O(h,!1),k={data:[],size:0}),k&&(k.data.push(t.subarray(d,l+188)),k.size+=l+188-d);break;case b:u&&(_&&(h=w(_))&&(m.isAAC?L(h):D(h)),_={data:[],size:0}),_&&(_.data.push(t.subarray(d,l+188)),_.size+=l+188-d);break;case E:u&&(S&&(h=w(S))&&I(h),S={data:[],size:0}),S&&(S.data.push(t.subarray(d,l+188)),S.size+=l+188-d);break;case 0:u&&(d+=t[d]+1),T=this._pmtId=C(t,d);break;case T:u&&(d+=t[d]+1);var x=R(t,d,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);(A=x.avc)>0&&(v.pid=A),(b=x.audio)>0&&(m.pid=b,m.isAAC=x.isAAC),(E=x.id3)>0&&(y.pid=E),p&&!g&&(s.logger.log("reparse from beginning"),p=!1,l=P-188),g=this.pmtParsed=!0;break;case 17:case 8191:break;default:p=!0}}else this.observer.trigger(i.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});k&&(h=w(k))?(O(h,!0),v.pesData=null):v.pesData=k,_&&(h=w(_))?(m.isAAC?L(h):D(h),m.pesData=null):(_&&_.size&&s.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=_),S&&(h=w(S))?(I(h),y.pesData=null):y.pesData=S,null==this.sampleAes?this.remuxer.remux(m,v,y,this._txtTrack,n,a,o):this.decryptAndRemux(m,v,y,this._txtTrack,n,a,o)},t.decryptAndRemux=function(e,t,n,i,r,a,o){if(e.samples&&e.isAAC){var s=this;this.sampleAes.decryptAacSamples(e.samples,0,(function(){s.decryptAndRemuxAvc(e,t,n,i,r,a,o)}))}else this.decryptAndRemuxAvc(e,t,n,i,r,a,o)},t.decryptAndRemuxAvc=function(e,t,n,i,r,a,o){if(t.samples){var s=this;this.sampleAes.decryptAvcSamples(t.samples,0,0,(function(){s.remuxer.remux(e,t,n,i,r,a,o)}))}else this.remuxer.remux(e,t,n,i,r,a,o)},t.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},t._parsePAT=function(e,t){return(31&e[t+10])<<8|e[t+11]},t._trackUnknownPmt=function(e,t,n){var i=this.pmtUnknownTypes[e]||0;return 0===i&&(this.pmtUnknownTypes[e]=0,t.call(s.logger,n)),this.pmtUnknownTypes[e]++,i},t._parsePMT=function(e,t,n,i){var r,a,o={audio:-1,avc:-1,id3:-1,isAAC:!0};for(r=t+3+((15&e[t+1])<<8|e[t+2])-4,t+=12+((15&e[t+10])<<8|e[t+11]);t<r;){switch(a=(31&e[t+1])<<8|e[t+2],e[t]){case 207:if(!i){this._trackUnknownPmt(e[t],s.logger.warn,"ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===o.audio&&(o.audio=a);break;case 21:-1===o.id3&&(o.id3=a);break;case 219:if(!i){this._trackUnknownPmt(e[t],s.logger.warn,"H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===o.avc&&(o.avc=a);break;case 3:case 4:n?-1===o.audio&&(o.audio=a,o.isAAC=!1):this._trackUnknownPmt(e[t],s.logger.warn,"MPEG audio found, not supported in this browser");break;case 36:this._trackUnknownPmt(e[t],s.logger.warn,"Unsupported HEVC stream type found");break;default:this._trackUnknownPmt(e[t],s.logger.log,"Unknown stream type:"+e[t])}t+=5+((15&e[t+3])<<8|e[t+4])}return o},t._parsePES=function(e){var t,n,i,r,a,o,l,u,c=0,d=e.data;if(!e||0===e.size)return null;for(;d[0].length<19&&d.length>1;){var h=new Uint8Array(d[0].length+d[1].length);h.set(d[0]),h.set(d[1],d[0].length),d[0]=h,d.splice(1,1)}if(1===((t=d[0])[0]<<16)+(t[1]<<8)+t[2]){if((i=(t[4]<<8)+t[5])&&i>e.size-6)return null;if(192&(n=t[7])&&(o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&n?o-(l=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(s.logger.warn(Math.round((o-l)/9e4)+"s delta between PTS and DTS, align them"),o=l):l=o),u=(r=t[8])+9,e.size<=u)return null;e.size-=u,a=new Uint8Array(e.size);for(var f=0,p=d.length;f<p;f++){var g=(t=d[f]).byteLength;if(u){if(u>g){u-=g;continue}t=t.subarray(u),g-=u,u=0}a.set(t,c),c+=g}return i&&(i-=r+3),{data:a,pts:o,dts:l,len:i}}return null},t.pushAccesUnit=function(e,t){if(e.units.length&&e.frame){var n=t.samples,i=n.length;if(isNaN(e.pts)){if(!i)return void t.dropped++;var r=n[i-1];e.pts=r.pts,e.dts=r.dts}!this.config.forceKeyFrameOnDiscontinuity||!0===e.key||t.sps&&(i||this.contiguous)?(e.id=i,n.push(e)):t.dropped++}e.debug.length&&s.logger.log(e.pts+"/"+e.dts+":"+e.debug)},t._parseAVCPES=function(e,t){var n,i,r,a=this,o=this._avcTrack,s=this._parseAVCNALu(e.data),l=this.avcSample,u=!1,c=this.pushAccesUnit.bind(this),d=function(e,t,n,i){return{key:e,pts:t,dts:n,units:[],debug:i}};e.data=null,l&&s.length&&!o.audFound&&(c(l,o),l=this.avcSample=d(!1,e.pts,e.dts,"")),s.forEach((function(t){switch(t.type){case 1:i=!0,l||(l=a.avcSample=d(!0,e.pts,e.dts,"")),l.frame=!0;var s=t.data;if(u&&s.length>4){var h=new T(s).readSliceType();2!==h&&4!==h&&7!==h&&9!==h||(l.key=!0)}break;case 5:i=!0,l||(l=a.avcSample=d(!0,e.pts,e.dts,"")),l.key=!0,l.frame=!0;break;case 6:i=!0,(n=new T(a.discardEPB(t.data))).readUByte();for(var f=0,p=0,g=!1,v=0;!g&&n.bytesAvailable>1;){f=0;do{f+=v=n.readUByte()}while(255===v);p=0;do{p+=v=n.readUByte()}while(255===v);if(4===f&&0!==n.bytesAvailable){if(g=!0,181===n.readUByte()&&49===n.readUShort()&&1195456820===n.readUInt()&&3===n.readUByte()){var y=n.readUByte(),A=31&y,b=[y,n.readUByte()];for(r=0;r<A;r++)b.push(n.readUByte()),b.push(n.readUByte()),b.push(n.readUByte());a._insertSampleInOrder(a._txtTrack.samples,{type:3,pts:e.pts,bytes:b})}}else if(5===f&&0!==n.bytesAvailable){if(g=!0,p>16){var E=[];for(r=0;r<16;r++)E.push(n.readUByte().toString(16)),3!==r&&5!==r&&7!==r&&9!==r||E.push("-");var k=p-16,_=new Uint8Array(k);for(r=0;r<k;r++)_[r]=n.readUByte();a._insertSampleInOrder(a._txtTrack.samples,{pts:e.pts,payloadType:f,uuid:E.join(""),userDataBytes:_,userData:Object(m.utf8ArrayToStr)(_.buffer)})}}else if(p<n.bytesAvailable)for(r=0;r<p;r++)n.readUByte()}break;case 7:if(i=!0,u=!0,!o.sps){var S=(n=new T(t.data)).readSPS();o.width=S.width,o.height=S.height,o.pixelRatio=S.pixelRatio,o.sps=[t.data],o.duration=a._duration;var C=t.data.subarray(1,4),R="avc1.";for(r=0;r<3;r++){var w=C[r].toString(16);w.length<2&&(w="0"+w),R+=w}o.codec=R}break;case 8:i=!0,o.pps||(o.pps=[t.data]);break;case 9:i=!1,o.audFound=!0,l&&c(l,o),l=a.avcSample=d(!1,e.pts,e.dts,"");break;case 12:i=!1;break;default:i=!1,l&&(l.debug+="unknown NAL "+t.type+" ")}l&&i&&l.units.push(t)})),t&&l&&(c(l,o),this.avcSample=null)},t._insertSampleInOrder=function(e,t){var n=e.length;if(n>0){if(t.pts>=e[n-1].pts)e.push(t);else for(var i=n-1;i>=0;i--)if(t.pts<e[i].pts){e.splice(i,0,t);break}}else e.push(t)},t._getLastNalUnit=function(){var e,t=this.avcSample;if(!t||0===t.units.length){var n=this._avcTrack.samples;t=n[n.length-1]}if(t){var i=t.units;e=i[i.length-1]}return e},t._parseAVCNALu=function(e){var t,n,i,r,a=0,o=e.byteLength,s=this._avcTrack,l=s.naluState||0,u=l,c=[],d=-1;for(-1===l&&(d=0,r=31&e[0],l=0,a=1);a<o;)if(t=e[a++],l)if(1!==l)if(t)if(1===t){if(d>=0)i={data:e.subarray(d,a-l-1),type:r},c.push(i);else{var h=this._getLastNalUnit();if(h&&(u&&a<=4-u&&h.state&&(h.data=h.data.subarray(0,h.data.byteLength-u)),(n=a-l-1)>0)){var f=new Uint8Array(h.data.byteLength+n);f.set(h.data,0),f.set(e.subarray(0,n),h.data.byteLength),h.data=f}}a<o?(d=a,r=31&e[a],l=0):l=-1}else l=0;else l=3;else l=t?0:2;else l=t?0:1;if(d>=0&&l>=0&&(i={data:e.subarray(d,o),type:r,state:l},c.push(i)),0===c.length){var p=this._getLastNalUnit();if(p){var g=new Uint8Array(p.data.byteLength+e.byteLength);g.set(p.data,0),g.set(e,p.data.byteLength),p.data=g}}return s.naluState=l,c},t.discardEPB=function(e){for(var t,n,i=e.byteLength,r=[],a=1;a<i-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=i-r.length,n=new Uint8Array(t);var o=0;for(a=0;a<t;o++,a++)o===r[0]&&(o++,r.shift()),n[a]=e[o];return n},t._parseAACPES=function(e){var t,n,a,o,l,u,c,d=this._audioTrack,f=e.data,m=e.pts,y=this.aacOverFlow,A=this.aacLastPTS;if(y){var b=new Uint8Array(y.byteLength+f.byteLength);b.set(y,0),b.set(f,y.byteLength),f=b}for(a=0,l=f.length;a<l-1&&!h(f,a);a++);if(!a||(a<l-1?(u="AAC PES did not start with ADTS header,offset:"+a,c=!1):(u="no ADTS header found in AAC PES",c=!0),s.logger.warn("parsing error:"+u),this.observer.trigger(i.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:c,reason:u}),!c)){if(p(d,this.observer,f,a,this.audioCodec),n=0,t=g(d.samplerate),y&&A){var E=A+t;Math.abs(E-m)>1&&(s.logger.log("AAC: align PTS for overlapping frames by "+Math.round((E-m)/90)),m=E)}for(;a<l;){if(h(f,a)){if(a+5<l){var T=v(d,f,a,m,n);if(T){a+=T.length,o=T.sample.pts,n++;continue}}break}a++}y=a<l?f.subarray(a,l):null,this.aacOverFlow=y,this.aacLastPTS=o}},t._parseMPEGPES=function(e){for(var t=e.data,n=t.length,i=0,r=0,a=e.pts;r<n;)if(E.isHeader(t,r)){var o=E.appendFrame(this._audioTrack,t,r,a,i);if(!o)break;r+=o.length,i++}else r++},t._parseID3PES=function(e){this._id3Track.samples.push(e)},e}(),C=function(){function e(e,t,n){this.observer=e,this.config=n,this.remuxer=t}var t=e.prototype;return t.resetInitSegment=function(e,t,n,i){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:t,duration:i,inputTimeScale:9e4}},t.resetTimeStamp=function(){},e.probe=function(e){var t,n,i=m.default.getID3Data(e,0);if(i&&void 0!==m.default.getTimeStamp(i))for(t=i.length,n=Math.min(e.length-1,t+100);t<n;t++)if(E.probe(e,t))return s.logger.log("MPEG Audio sync word found !"),!0;return!1},t.append=function(e,t,n,i){for(var r=m.default.getID3Data(e,0)||[],a=m.default.getTimeStamp(r),o=void 0!==a?90*a:9e4*t,s=r.length,l=e.length,u=0,c=0,d=this._audioTrack,h=[{pts:o,dts:o,data:r}];s<l;)if(E.isHeader(e,s)){var f=E.appendFrame(d,e,s,o,u);if(!f)break;s+=f.length,c=f.sample.pts,u++}else m.default.isHeader(e,s)?(r=m.default.getID3Data(e,s),h.push({pts:c,dts:c,data:r}),s+=r.length):s++;this.remuxer.remux(d,{samples:[]},{samples:h,inputTimeScale:9e4},{samples:[]},t,n,i)},t.destroy=function(){},e}(),R=function(){function e(){}return e.getSilentFrame=function(e,t){switch(e){case"mp4a.40.2":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]);break;default: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}(),w=Math.pow(2,32)-1,O=function(){function e(){}return e.init=function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var n=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=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]);e.HDLR_TYPES={video:n,audio:i};var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,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]);var o=new Uint8Array([105,115,111,109]),s=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,o,l,o,s),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,r))},e.box=function(e){for(var t,n=Array.prototype.slice.call(arguments,1),i=8,r=n.length,a=r;r--;)i+=n[r].byteLength;for((t=new Uint8Array(i))[0]=i>>24&255,t[1]=i>>16&255,t[2]=i>>8&255,t[3]=255&i,t.set(e,4),r=0,i=8;r<a;r++)t.set(n[r],i),i+=n[r].byteLength;return t},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,n){n*=t;var i=Math.floor(n/(w+1)),r=Math.floor(n%(w+1));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,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,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,n,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,n))},e.moov=function(t){for(var n=t.length,i=[];n--;)i[n]=e.trak(t[n]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))},e.mvex=function(t){for(var n=t.length,i=[];n--;)i[n]=e.trex(t[n]);return e.box.apply(null,[e.types.mvex].concat(i))},e.mvhd=function(t,n){n*=t;var i=Math.floor(n/(w+1)),r=Math.floor(n%(w+1)),a=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,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,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,a)},e.sdtp=function(t){var n,i,r=t.samples||[],a=new Uint8Array(4+r.length);for(i=0;i<r.length;i++)n=r[i].flags,a[i+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return e.box(e.types.sdtp,a)},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){var n,i,r,a=[],o=[];for(n=0;n<t.sps.length;n++)r=(i=t.sps[n]).byteLength,a.push(r>>>8&255),a.push(255&r),a=a.concat(Array.prototype.slice.call(i));for(n=0;n<t.pps.length;n++)r=(i=t.pps[n]).byteLength,o.push(r>>>8&255),o.push(255&r),o=o.concat(Array.prototype.slice.call(i));var s=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(o))),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]),s,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.mp4a=function(t){var n=t.samplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){var n=t.samplerate;return e.box(e.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]))},e.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var n=t.id,i=t.duration*t.timescale,r=t.width,a=t.height,o=Math.floor(i/(w+1)),s=Math.floor(i%(w+1));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,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,s>>24,s>>16&255,s>>8&255,255&s,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,a>>8&255,255&a,0,0]))},e.traf=function(t,n){var i=e.sdtp(t),r=t.id,a=Math.floor(n/(w+1)),o=Math.floor(n%(w+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,o>>24,o>>16&255,o>>8&255,255&o])),e.trun(t,i.length+16+20+8+16+8+8),i)},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){var n=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,n){var i,r,a,o,s,l,u=t.samples||[],c=u.length,d=12+16*c,h=new Uint8Array(d);for(n+=8+d,h.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0),i=0;i<c;i++)a=(r=u[i]).duration,o=r.size,s=r.flags,l=r.cts,h.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,h)},e.initSegment=function(t){e.types||e.init();var n,i=e.moov(t);return(n=new Uint8Array(e.FTYP.byteLength+i.byteLength)).set(e.FTYP),n.set(i,e.FTYP.byteLength),n},e}();function L(e,t,n,i){void 0===n&&(n=1),void 0===i&&(i=!1);var r=e*t*n;return i?Math.round(r):r}function D(e,t){return void 0===t&&(t=!1),L(e,1e3,1/9e4,t)}function I(e,t){return void 0===t&&(t=1),L(e,9e4,1/t)}var P=I(10),x=I(.2),N=null;function M(e,t){var n;if(void 0===t)return e;for(n=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=n;return e}var F,B=function(){function e(e,t,n,i){if(this.observer=e,this.config=t,this.typeSupported=n,this.ISGenerated=!1,null===N){var r=navigator.userAgent.match(/Chrome\/(\d+)/i);N=r?parseInt(r[1]):0}}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){this._initPTS=this._initDTS=e},t.resetInitSegment=function(){this.ISGenerated=!1},t.getVideoStartPts=function(e){var t=!1,n=e.reduce((function(e,n){var i=n.pts-e;return i<-4294967296?(t=!0,M(e,n.pts)):i>0?e:n.pts}),e[0].pts);return t&&s.logger.debug("PTS rollover detected"),n},t.remux=function(e,t,n,r,a,o,l){if(this.ISGenerated||this.generateIS(e,t,a),this.ISGenerated){var u=e.samples.length,c=t.samples.length,d=a,h=a;if(u&&c){var f=this.getVideoStartPts(t.samples),p=(M(e.samples[0].pts,f)-f)/t.inputTimeScale;d+=Math.max(0,p),h+=Math.max(0,-p)}if(u){e.timescale||(s.logger.warn("regenerate InitSegment as audio detected"),this.generateIS(e,t,a));var g,v=this.remuxAudio(e,d,o,l);c&&(v&&(g=v.endPTS-v.startPTS),t.timescale||(s.logger.warn("regenerate InitSegment as video detected"),this.generateIS(e,t,a)),this.remuxVideo(t,h,o,g))}else if(c){var m=this.remuxVideo(t,h,o,0,l);m&&e.codec&&this.remuxEmptyAudio(e,d,o,m)}}n.samples.length&&this.remuxID3(n,a),r.samples.length&&this.remuxText(r,a),this.observer.trigger(i.default.FRAG_PARSED)},t.generateIS=function(e,t,n){var a,o,l=this.observer,u=e.samples,c=t.samples,d=this.typeSupported,h="audio/mp4",f={},p={tracks:f},g=void 0===this._initPTS;if(g&&(a=o=1/0),e.config&&u.length&&(e.timescale=e.samplerate,s.logger.log("audio sampling rate : "+e.samplerate),e.isAAC||(d.mpeg?(h="audio/mpeg",e.codec=""):d.mp3&&(e.codec="mp3")),f.audio={container:h,codec:e.codec,initSegment:!e.isAAC&&d.mpeg?new Uint8Array:O.initSegment([e]),metadata:{channelCount:e.channelCount}},g&&(a=o=u[0].pts-Math.round(e.inputTimeScale*n))),t.sps&&t.pps&&c.length){var v=t.inputTimeScale;if(t.timescale=v,f.video={container:"video/mp4",codec:t.codec,initSegment:O.initSegment([t]),metadata:{width:t.width,height:t.height}},g){var m=this.getVideoStartPts(c),y=Math.round(v*n);o=Math.min(o,M(c[0].dts,m)-y),a=Math.min(a,m-y),this.observer.trigger(i.default.INIT_PTS_FOUND,{initPTS:a})}}else g&&f.audio&&this.observer.trigger(i.default.INIT_PTS_FOUND,{initPTS:a});Object.keys(f).length?(l.trigger(i.default.FRAG_PARSING_INIT_SEGMENT,p),this.ISGenerated=!0,g&&(this._initPTS=a,this._initDTS=o)):l.trigger(i.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},t.remuxVideo=function(e,t,n,a){var o,l,u,c,d,h=e.timescale,f=e.samples,p=[],g=f.length,v=this._initPTS,m=8,y=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,b=0,E=!1,T=this.nextAvcDts;if(0!==g){n||(T=t*h-(f[0].pts-M(f[0].dts,f[0].pts)));for(var k=0;k<g;k++){var _=f[k];_.pts=M(_.pts-v,T),_.dts=M(_.dts-v,T),_.dts>_.pts&&(b=Math.max(Math.min(b,_.pts-_.dts),-1*x)),_.dts<f[k>0?k-1:k].dts&&(E=!0)}E&&f.sort((function(e,t){var n=e.dts-t.dts,i=e.pts-t.pts;return n||i||e.id-t.id})),c=f[0].dts,d=f[g-1].dts;var S=Math.round((d-c)/(g-1));if(b<0){if(b<-2*S){s.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+D(-S,!0)+" ms");for(var C=b,R=0;R<g;R++)f[R].dts=C=Math.max(C,f[R].pts-S),f[R].pts=Math.max(C,f[R].pts)}else{s.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+D(b,!0)+" ms to overcome this issue");for(var w=0;w<g;w++)f[w].dts=f[w].dts+b}c=f[0].dts,d=f[g-1].dts}if(n){var L=c-T,I=L>S;if(I||L<-1){I?s.logger.warn("AVC: "+D(L,!0)+" ms ("+L+"dts) hole between fragments detected, filling it"):s.logger.warn("AVC: "+D(-L,!0)+" ms ("+L+"dts) overlapping between fragments detected"),c=T;var P=f[0].pts-L;f[0].dts=c,f[0].pts=P,s.logger.log("Video: First PTS/DTS adjusted: "+D(P,!0)+"/"+D(c,!0)+", delta: "+D(L,!0)+" ms")}}N&&N<75&&(c=Math.max(0,c));for(var F=0,B=0,U=0;U<g;U++){for(var V=f[U],j=V.units,K=j.length,G=0,Y=0;Y<K;Y++)G+=j[Y].data.length;B+=G,F+=K,V.length=G,V.dts=Math.max(V.dts,c),V.pts=Math.max(V.pts,V.dts,0),y=Math.min(V.pts,y),A=Math.max(V.pts,A)}d=f[g-1].dts;var H=B+4*F+8;try{l=new Uint8Array(H)}catch(e){return void this.observer.trigger(i.default.ERROR,{type:r.ErrorTypes.MUX_ERROR,details:r.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:H,reason:"fail allocating video mdat "+H})}var $=new DataView(l.buffer);$.setUint32(0,H),l.set(O.types.mdat,4);for(var z=0;z<g;z++){for(var W,q=f[z],X=q.units,Z=0,Q=0,J=X.length;Q<J;Q++){var ee=X[Q],te=ee.data,ne=ee.data.byteLength;$.setUint32(m,ne),m+=4,l.set(te,m),m+=ne,Z+=4+ne}if(z<g-1)o=f[z+1].dts-q.dts;else{var ie=this.config,re=q.dts-f[z>0?z-1:z].dts;if(ie.stretchShortVideoTrack){var ae=ie.maxBufferHole,oe=Math.floor(ae*h),se=(a?y+a*h:this.nextAudioPts)-q.pts;se>oe?((o=se-re)<0&&(o=re),s.logger.log("It is approximately "+D(se,!1)+" ms to the next segment; using duration "+D(o,!1)+" ms for the last video frame.")):o=re}else o=re}W=Math.round(q.pts-q.dts),p.push({size:Z,duration:o,cts:W,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:q.key?2:1,isNonSync:q.key?0:1}})}this.nextAvcDts=d+o;var le=e.dropped;if(e.nbNalu=0,e.dropped=0,p.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var ue=p[0].flags;ue.dependsOn=2,ue.isNonSync=0}e.samples=p,u=O.moof(e.sequenceNumber++,c,e),e.samples=[];var ce={data1:u,data2:l,startPTS:y/h,endPTS:(A+o)/h,startDTS:c/h,endDTS:this.nextAvcDts/h,type:"video",hasAudio:!1,hasVideo:!0,nb:p.length,dropped:le};return this.observer.trigger(i.default.FRAG_PARSING_DATA,ce),ce}},t.remuxAudio=function(e,t,n,a){var o,l,u,c,d,h,f=e.inputTimeScale,p=e.timescale,g=f/p,v=(e.isAAC?1024:1152)*g,m=this._initPTS,y=!e.isAAC&&this.typeSupported.mpeg,A=y?0:8,b=e.samples,E=[],T=this.nextAudioPts;if(n|=b.length&&T&&(a&&Math.abs(t-T/f)<.1||Math.abs(b[0].pts-T-m)<20*v),b.forEach((function(e){e.pts=e.dts=M(e.pts-m,t*f)})),0!==(b=b.filter((function(e){return e.pts>=0}))).length){if(n||(T=a?Math.max(0,t*f):b[0].pts),e.isAAC)for(var k=this.config.maxAudioFramesDrift,_=0,S=T;_<b.length;){var C=b[_],w=C.pts,L=w-S;if(L<=-k*v)n||_>0?(s.logger.warn("Dropping 1 audio frame @ "+D(S,!0)/1e3+"s due to "+D(L,!0)+" ms overlap."),b.splice(_,1)):(s.logger.warn("Audio frame @ "+D(w,!0)/1e3+"s overlaps nextAudioPts by "+D(L,!0)+" ms."),S=w+v,_++);else if(L>=k*v&&L<P&&S){var I=Math.round(L/v);s.logger.warn("Injecting "+I+" audio frames @ "+D(S,!0)/1e3+"s due to "+D(L,!0)+" ms gap.");for(var x=0;x<I;x++){var N=Math.max(S,0);(l=R.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(s.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),l=C.unit.subarray()),b.splice(_,0,{unit:l,pts:N,dts:N}),S+=v,_++}C.pts=C.dts=S,S+=v,_++}else C.pts=C.dts=S,S+=v,_++}for(var F=b.length,B=0;F--;)B+=b[F].unit.byteLength;for(var U=0,V=b.length;U<V;U++){var j=b[U],K=j.unit,G=j.pts;if(void 0!==h&&o)o.duration=Math.round((G-h)/g);else{var Y=G-T,H=0;if(n&&e.isAAC&&Y){if(Y>0&&Y<P)H=Math.round((G-T)/v),s.logger.log(D(Y,!0)+" ms hole between AAC samples detected,filling it"),H>0&&((l=R.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(l=K.subarray()),B+=H*l.length);else if(Y<-12){s.logger.log("drop overlapping AAC sample, expected/parsed/delta: "+D(T,!0)+" ms / "+D(G,!0)+" ms / "+D(-Y,!0)+" ms"),B-=K.byteLength;continue}G=T}if(d=G,!(B>0))return;B+=A;try{u=new Uint8Array(B)}catch(e){return void this.observer.trigger(i.default.ERROR,{type:r.ErrorTypes.MUX_ERROR,details:r.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:B,reason:"fail allocating audio mdat "+B})}y||(new DataView(u.buffer).setUint32(0,B),u.set(O.types.mdat,4));for(var $=0;$<H;$++)(l=R.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(s.logger.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),l=K.subarray()),u.set(l,A),A+=l.byteLength,o={size:l.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},E.push(o)}u.set(K,A);var z=K.byteLength;A+=z,o={size:z,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},E.push(o),h=G}var W=0;if((F=E.length)>=2&&(W=E[F-2].duration,o.duration=W),F){this.nextAudioPts=T=h+g*W,e.samples=E,c=y?new Uint8Array:O.moof(e.sequenceNumber++,d/g,e),e.samples=[];var q=d/f,X=T/f,Z={data1:c,data2:u,startPTS:q,endPTS:X,startDTS:q,endDTS:X,type:"audio",hasAudio:!0,hasVideo:!1,nb:F};return this.observer.trigger(i.default.FRAG_PARSING_DATA,Z),Z}return null}},t.remuxEmptyAudio=function(e,t,n,i){var r=e.inputTimeScale,a=r/(e.samplerate?e.samplerate:r),o=this.nextAudioPts,l=(void 0!==o?o:i.startDTS*r)+this._initDTS,u=i.endDTS*r+this._initDTS,c=1024*a,d=Math.ceil((u-l)/c),h=R.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(s.logger.warn("remux empty Audio"),h){for(var f=[],p=0;p<d;p++){var g=l+p*c;f.push({unit:h,pts:g,dts:g})}e.samples=f,this.remuxAudio(e,t,n)}else s.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!")},t.remuxID3=function(e,t){var n=e.samples.length;if(n){for(var r=e.inputTimeScale,a=this._initPTS,o=this._initDTS,s=0;s<n;s++){var l=e.samples[s];l.pts=M(l.pts-a,t*r)/r,l.dts=M(l.dts-o,t*r)/r}this.observer.trigger(i.default.FRAG_PARSING_METADATA,{samples:e.samples}),e.samples=[]}},t.remuxText=function(e,t){var n=e.samples.length,r=e.inputTimeScale,a=this._initPTS;if(n){for(var o=0;o<n;o++){var s=e.samples[o];s.pts=M(s.pts-a,t*r)/r}e.samples.sort((function(e,t){return e.pts-t.pts})),this.observer.trigger(i.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[]},e}(),U=function(){function e(e){this.observer=e}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(){},t.resetInitSegment=function(){},t.remux=function(e,t,n,r,a,o,s,l){var u=this.observer,c="";e&&(c+="audio"),t&&(c+="video"),u.trigger(i.default.FRAG_PARSING_DATA,{data1:l,startPTS:a,startDTS:a,type:c,hasAudio:!!e,hasVideo:!!t,nb:1,dropped:0}),u.trigger(i.default.FRAG_PARSED)},e}(),V=Object(l.getSelfScope)();try{F=V.performance.now.bind(V.performance)}catch(e){s.logger.debug("Unable to use Performance API on this environment"),F=V.Date.now}var j=function(){function e(e,t,n,i){this.observer=e,this.typeSupported=t,this.config=n,this.vendor=i}var t=e.prototype;return t.destroy=function(){var e=this.demuxer;e&&e.destroy()},t.push=function(e,t,n,r,o,s,l,u,c,d,h,f){var p=this;if(e.byteLength>0&&null!=t&&null!=t.key&&"AES-128"===t.method){var g=this.decrypter;null==g&&(g=this.decrypter=new a.default(this.observer,this.config));var v=F();g.decrypt(e,t.key.buffer,t.iv.buffer,(function(e){var a=F();p.observer.trigger(i.default.FRAG_DECRYPTED,{stats:{tstart:v,tdecrypt:a}}),p.pushDecrypted(new Uint8Array(e),t,new Uint8Array(n),r,o,s,l,u,c,d,h,f)}))}else this.pushDecrypted(new Uint8Array(e),t,new Uint8Array(n),r,o,s,l,u,c,d,h,f)},t.pushDecrypted=function(e,t,n,a,o,s,l,u,c,d,h,f){var p=this.demuxer,g=this.remuxer;if(!p||l||u){for(var v,m=this.observer,b=this.typeSupported,E=this.config,T=[{demux:S,remux:B},{demux:A.default,remux:U},{demux:y,remux:B},{demux:C,remux:B}],k=0,_=T.length;k<_&&!(v=T[k]).demux.probe(e);k++);if(!v)return void m.trigger(i.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});g&&g instanceof v.remux||(g=new v.remux(m,E,b,this.vendor)),p&&p instanceof v.demux||(p=new v.demux(m,g,E,b),this.probe=v.demux.probe),this.demuxer=p,this.remuxer=g}(l||u)&&(p.resetInitSegment(n,a,o,d),g.resetInitSegment()),l&&(p.resetTimeStamp(f),g.resetTimeStamp(f)),"function"==typeof p.setDecryptData&&p.setDecryptData(t),p.append(e,s,c,h)},e}();t.default=j},"./src/demux/demuxer-worker.js":
/*!*************************************!*\
!*** ./src/demux/demuxer-worker.js ***!
\*************************************/
/*! exports provided: default */
/*! ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./src/demux/demuxer.js (referenced with require.resolve) */function(e,t,n){n.r(t);var i=n(/*! ../demux/demuxer-inline */"./src/demux/demuxer-inline.js"),r=n(/*! ../events */"./src/events.js"),a=n(/*! ../utils/logger */"./src/utils/logger.js"),o=n(/*! eventemitter3 */"./node_modules/eventemitter3/index.js");t.default=function(e){var t=new o.EventEmitter;t.trigger=function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];t.emit.apply(t,[e,e].concat(i))},t.off=function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];t.removeListener.apply(t,[e].concat(i))};var n=function(t,n){e.postMessage({event:t,data:n})};e.addEventListener("message",(function(r){var o=r.data;switch(o.cmd){case"init":var s=JSON.parse(o.config);e.demuxer=new i.default(t,o.typeSupported,s,o.vendor),Object(a.enableLogs)(s.debug),n("init",null);break;case"demux":e.demuxer.push(o.data,o.decryptdata,o.initSegment,o.audioCodec,o.videoCodec,o.timeOffset,o.discontinuity,o.trackSwitch,o.contiguous,o.duration,o.accurateTimeOffset,o.defaultInitPTS)}})),t.on(r.default.FRAG_DECRYPTED,n),t.on(r.default.FRAG_PARSING_INIT_SEGMENT,n),t.on(r.default.FRAG_PARSED,n),t.on(r.default.ERROR,n),t.on(r.default.FRAG_PARSING_METADATA,n),t.on(r.default.FRAG_PARSING_USERDATA,n),t.on(r.default.INIT_PTS_FOUND,n),t.on(r.default.FRAG_PARSING_DATA,(function(t,n){var i=[],r={event:t,data:n};n.data1&&(r.data1=n.data1.buffer,i.push(n.data1.buffer),delete n.data1),n.data2&&(r.data2=n.data2.buffer,i.push(n.data2.buffer),delete n.data2),e.postMessage(r,i)}))}},"./src/demux/id3.js":
/*!**************************!*\
!*** ./src/demux/id3.js ***!
\**************************/
/*! exports provided: default, utf8ArrayToStr */function(e,t,n){n.r(t),n.d(t,"utf8ArrayToStr",(function(){return s}));var i,r=n(/*! ../utils/get-self-scope */"./src/utils/get-self-scope.js"),a=function(){function e(){}return e.isHeader=function(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},e.isFooter=function(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},e.getID3Data=function(t,n){for(var i=n,r=0;e.isHeader(t,n);)r+=10,r+=e._readSize(t,n+6),e.isFooter(t,n+10)&&(r+=10),n+=r;if(r>0)return t.subarray(i,i+r)},e._readSize=function(e,t){var n=0;return n=(127&e[t])<<21,n|=(127&e[t+1])<<14,n|=(127&e[t+2])<<7,n|=127&e[t+3]},e.getTimeStamp=function(t){for(var n=e.getID3Frames(t),i=0;i<n.length;i++){var r=n[i];if(e.isTimeStampFrame(r))return e._readTimeStamp(r)}},e.isTimeStampFrame=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},e._getFrameData=function(t){var n=String.fromCharCode(t[0],t[1],t[2],t[3]),i=e._readSize(t,4);return{type:n,size:i,data:t.subarray(10,10+i)}},e.getID3Frames=function(t){for(var n=0,i=[];e.isHeader(t,n);){for(var r=e._readSize(t,n+6),a=(n+=10)+r;n+8<a;){var o=e._getFrameData(t.subarray(n)),s=e._decodeFrame(o);s&&i.push(s),n+=o.size+10}e.isFooter(t,n)&&(n+=10)}return i},e._decodeFrame=function(t){return"PRIV"===t.type?e._decodePrivFrame(t):"W"===t.type[0]?e._decodeURLFrame(t):e._decodeTextFrame(t)},e._readTimeStamp=function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),n=1&t[3],i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,n&&(i+=47721858.84),Math.round(i)}},e._decodePrivFrame=function(t){if(!(t.size<2)){var n=e._utf8ArrayToStr(t.data,!0),i=new Uint8Array(t.data.subarray(n.length+1));return{key:t.type,info:n,data:i.buffer}}},e._decodeTextFrame=function(t){if(!(t.size<2)){if("TXXX"===t.type){var n=1,i=e._utf8ArrayToStr(t.data.subarray(n),!0);n+=i.length+1;var r=e._utf8ArrayToStr(t.data.subarray(n));return{key:t.type,info:i,data:r}}var a=e._utf8ArrayToStr(t.data.subarray(1));return{key:t.type,data:a}}},e._decodeURLFrame=function(t){if("WXXX"===t.type){if(t.size<2)return;var n=1,i=e._utf8ArrayToStr(t.data.subarray(n),!0);n+=i.length+1;var r=e._utf8ArrayToStr(t.data.subarray(n));return{key:t.type,info:i,data:r}}var a=e._utf8ArrayToStr(t.data);return{key:t.type,data:a}},e._utf8ArrayToStr=function(e,t){void 0===t&&(t=!1);var n=o();if(n){var i=n.decode(e);if(t){var r=i.indexOf("\0");return-1!==r?i.substring(0,r):i}return i.replace(/\0/g,"")}for(var a,s,l,u=e.length,c="",d=0;d<u;){if(0===(a=e[d++])&&t)return c;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(a);break;case 12:case 13:s=e[d++],c+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=e[d++],l=e[d++],c+=String.fromCharCode((15&a)<<12|(63&s)<<6|(63&l)<<0)}}return c},e}();function o(){var e=Object(r.getSelfScope)();return i||void 0===e.TextDecoder||(i=new e.TextDecoder("utf-8")),i}var s=a._utf8ArrayToStr;t.default=a},"./src/demux/mp4demuxer.js":
/*!*********************************!*\
!*** ./src/demux/mp4demuxer.js ***!
\*********************************/
/*! exports provided: default */function(e,t,n){n.r(t);var i=n(/*! ../utils/logger */"./src/utils/logger.js"),r=n(/*! ../events */"./src/events.js"),a=Math.pow(2,32)-1,o=function(){function e(e,t){this.observer=e,this.remuxer=t}var t=e.prototype;return t.resetTimeStamp=function(e){this.initPTS=e},t.resetInitSegment=function(t,n,i,a){if(t&&t.byteLength){var o=this.initData=e.parseInitSegment(t);null==n&&(n="mp4a.40.5"),null==i&&(i="avc1.42e01e");var s={};o.audio&&o.video?s.audiovideo={container:"video/mp4",codec:n+","+i,initSegment:a?t:null}:(o.audio&&(s.audio={container:"audio/mp4",codec:n,initSegment:a?t:null}),o.video&&(s.video={container:"video/mp4",codec:i,initSegment:a?t:null})),this.observer.trigger(r.default.FRAG_PARSING_INIT_SEGMENT,{tracks:s})}else n&&(this.audioCodec=n),i&&(this.videoCodec=i)},e.probe=function(t){return e.findBox({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0},e.bin2str=function(e){return String.fromCharCode.apply(null,e)},e.readUint16=function(e,t){e.data&&(t+=e.start,e=e.data);var n=e[t]<<8|e[t+1];return n<0?65536+n:n},e.readUint32=function(e,t){e.data&&(t+=e.start,e=e.data);var n=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return n<0?4294967296+n:n},e.writeUint32=function(e,t,n){e.data&&(t+=e.start,e=e.data),e[t]=n>>24,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n},e.findBox=function(t,n){var i,r,a,o,s,l,u=[];if(t.data?(s=t.start,a=t.end,t=t.data):(s=0,a=t.byteLength),!n.length)return null;for(i=s;i<a;)l=(r=e.readUint32(t,i))>1?i+r:a,e.bin2str(t.subarray(i+4,i+8))===n[0]&&(1===n.length?u.push({data:t,start:i+8,end:l}):(o=e.findBox({data:t,start:i+8,end:l},n.slice(1))).length&&(u=u.concat(o))),i=l;return u},e.parseSegmentIndex=function(t){var n,i=e.findBox(t,["moov"])[0],r=i?i.end:null,a=0,o=e.findBox(t,["sidx"]);if(!o||!o[0])return null;n=[];var s=(o=o[0]).data[0];a=0===s?8:16;var l=e.readUint32(o,a);a+=4,a+=0===s?8:16,a+=2;var u=o.end+0,c=e.readUint16(o,a);a+=2;for(var d=0;d<c;d++){var h=a,f=e.readUint32(o,h);h+=4;var p=2147483647&f;if(1==(2147483648&f)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");var g=e.readUint32(o,h);h+=4,n.push({referenceSize:p,subsegmentDuration:g,info:{duration:g/l,start:u,end:u+p-1}}),u+=p,a=h+=4}return{earliestPresentationTime:0,timescale:l,version:s,referencesCount:c,references:n,moovEndOffset:r}},e.parseInitSegment=function(t){var n=[];return e.findBox(t,["moov","trak"]).forEach((function(t){var r=e.findBox(t,["tkhd"])[0];if(r){var a=r.data[r.start],o=0===a?12:20,s=e.readUint32(r,o),l=e.findBox(t,["mdia","mdhd"])[0];if(l){o=0===(a=l.data[l.start])?12:20;var u=e.readUint32(l,o),c=e.findBox(t,["mdia","hdlr"])[0];if(c){var d={soun:"audio",vide:"video"}[e.bin2str(c.data.subarray(c.start+8,c.start+12))];if(d){var h=e.findBox(t,["mdia","minf","stbl","stsd"]);if(h.length){h=h[0];var f=e.bin2str(h.data.subarray(h.start+12,h.start+16));i.logger.log("MP4Demuxer:"+d+":"+f+" found")}n[s]={timescale:u,type:d},n[d]={timescale:u,id:s}}}}}})),n},e.getStartDTS=function(t,n){var i,r,a;return i=e.findBox(n,["moof","traf"]),r=[].concat.apply([],i.map((function(n){return e.findBox(n,["tfhd"]).map((function(i){var r,a;return r=e.readUint32(i,4),a=t[r].timescale||9e4,e.findBox(n,["tfdt"]).map((function(t){var n,i;return n=t.data[t.start],i=e.readUint32(t,4),1===n&&(i*=Math.pow(2,32),i+=e.readUint32(t,8)),i}))[0]/a}))}))),a=Math.min.apply(null,r),isFinite(a)?a:0},e.offsetStartDTS=function(t,n,i){e.findBox(n,["moof","traf"]).map((function(n){return e.findBox(n,["tfhd"]).map((function(r){var o=e.readUint32(r,4),s=t[o].timescale||9e4;e.findBox(n,["tfdt"]).map((function(t){var n=t.data[t.start],r=e.readUint32(t,4);if(0===n)e.writeUint32(t,4,r-i*s);else{r*=Math.pow(2,32),r+=e.readUint32(t,8),r-=i*s,r=Math.max(r,0);var o=Math.floor(r/(a+1)),l=Math.floor(r%(a+1));e.writeUint32(t,4,o),e.writeUint32(t,8,l)}}))}))}))},t.append=function(t,n,i,a){var o=this.initData;o||(this.resetInitSegment(t,this.audioCodec,this.videoCodec,!1),o=this.initData);var s,l=this.initPTS;if(void 0===l){var u=e.getStartDTS(o,t);this.initPTS=l=u-n,this.observer.trigger(r.default.INIT_PTS_FOUND,{initPTS:l})}e.offsetStartDTS(o,t,l),s=e.getStartDTS(o,t),this.remuxer.remux(o.audio,o.video,null,null,s,i,a,t)},t.destroy=function(){},e}();t.default=o},"./src/errors.ts":
/*!***********************!*\
!*** ./src/errors.ts ***!
\***********************/
/*! exports provided: ErrorTypes, ErrorDetails */function(e,t,n){var i,r;n.r(t),n.d(t,"ErrorTypes",(function(){return i})),n.d(t,"ErrorDetails",(function(){return r})),function(e){e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError"}(i||(i={})),function(e){e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",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_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",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"}(r||(r={}))},"./src/events.js":
/*!***********************!*\
!*** ./src/events.js ***!
\***********************/
/*! exports provided: default */function(e,t,n){n.r(t),t.default={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",LEVELS_UPDATED:"hlsLevelsUpdated",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",CUES_PARSED:"hlsCuesParsed",NON_NATIVE_TEXT_TRACKS_FOUND:"hlsNonNativeTextTracksFound",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition",LIVE_BACK_BUFFER_REACHED:"hlsLiveBackBufferReached"}},"./src/hls.ts":
/*!*********************************!*\
!*** ./src/hls.ts + 50 modules ***!
\*********************************/
/*! exports provided: default */
/*! ModuleConcatenation bailout: Cannot concat with ./src/crypt/decrypter.js because of ./src/demux/demuxer-worker.js */
/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/demuxer-inline.js because of ./src/demux/demuxer-worker.js */
/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/id3.js because of ./src/demux/demuxer-worker.js */
/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/mp4demuxer.js because of ./src/demux/demuxer-worker.js */
/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/demux/demuxer-worker.js */
/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/demux/demuxer-worker.js */
/*! ModuleConcatenation bailout: Cannot concat with ./src/polyfills/number.js because of ./src/demux/demuxer-worker.js */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/demux/demuxer-worker.js */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/demux/demuxer-worker.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/eventemitter3/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/url-toolkit/src/url-toolkit.js (<- Module is not an ECMAScript module) */function(e,t,n){n.r(t),n.d(t,"default",(function(){return ln}));var i={};n.r(i),n.d(i,"newCue",(function(){return ft}));var r,a,o=n("./node_modules/url-toolkit/src/url-toolkit.js"),s=n("./src/errors.ts"),l=n("./src/polyfills/number.js"),u=n("./src/events.js"),c=n("./src/utils/logger.js"),d={hlsEventGeneric:!0,hlsHandlerDestroying:!0,hlsHandlerDestroyed:!0},h=function(){function e(e){this.hls=void 0,this.handledEvents=void 0,this.useGenericHandler=void 0,this.hls=e,this.onEvent=this.onEvent.bind(this);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.handledEvents=n,this.useGenericHandler=!0,this.registerListeners()}var t=e.prototype;return t.destroy=function(){this.onHandlerDestroying(),this.unregisterListeners(),this.onHandlerDestroyed()},t.onHandlerDestroying=function(){},t.onHandlerDestroyed=function(){},t.isEventHandler=function(){return"object"==typeof this.handledEvents&&this.handledEvents.length&&"function"==typeof this.onEvent},t.registerListeners=function(){this.isEventHandler()&&this.handledEvents.forEach((function(e){if(d[e])throw new Error("Forbidden event-name: "+e);this.hls.on(e,this.onEvent)}),this)},t.unregisterListeners=function(){this.isEventHandler()&&this.handledEvents.forEach((function(e){this.hls.off(e,this.onEvent)}),this)},t.onEvent=function(e,t){this.onEventGeneric(e,t)},t.onEventGeneric=function(e,t){try{(function(e,t){var n="on"+e.replace("hls","");if("function"!=typeof this[n])throw new Error("Event "+e+" has no generic handler in this "+this.constructor.name+" class (tried "+n+")");return this[n].bind(this,t)}).call(this,e,t).call()}catch(t){c.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}},e}();!function(e){e.MANIFEST="manifest",e.LEVEL="level",e.AUDIO_TRACK="audioTrack",e.SUBTITLE_TRACK="subtitleTrack"}(r||(r={})),function(e){e.MAIN="main",e.AUDIO="audio",e.SUBTITLE="subtitle"}(a||(a={}));var f=n("./src/demux/mp4demuxer.js");function p(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var g,v=function(){function e(e,t){this._uri=null,this.baseuri=void 0,this.reluri=void 0,this.method=null,this.key=null,this.iv=null,this.baseuri=e,this.reluri=t}var t,n,i;return t=e,(n=[{key:"uri",get:function(){return!this._uri&&this.reluri&&(this._uri=Object(o.buildAbsoluteURL)(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri}}])&&p(t.prototype,n),i&&p(t,i),e}();function m(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}!function(e){e.AUDIO="audio",e.VIDEO="video"}(g||(g={}));var y=function(){function e(){var e;this._url=null,this._byteRange=null,this._decryptdata=null,this._elementaryStreams=((e={})[g.AUDIO]=!1,e[g.VIDEO]=!1,e),this.deltaPTS=0,this.rawProgramDateTime=null,this.programDateTime=null,this.title=null,this.tagList=[],this.cc=void 0,this.type=void 0,this.relurl=void 0,this.baseurl=void 0,this.duration=void 0,this.start=void 0,this.sn=0,this.urlId=0,this.level=0,this.levelkey=void 0,this.loader=void 0}var t,n,i,r=e.prototype;return r.setByteRange=function(e,t){var n=e.split("@",2),i=[];1===n.length?i[0]=t?t.byteRangeEndOffset:0:i[0]=parseInt(n[1]),i[1]=parseInt(n[0])+i[0],this._byteRange=i},r.addElementaryStream=function(e){this._elementaryStreams[e]=!0},r.hasElementaryStream=function(e){return!0===this._elementaryStreams[e]},r.createInitializationVector=function(e){for(var t=new Uint8Array(16),n=12;n<16;n++)t[n]=e>>8*(15-n)&255;return t},r.setDecryptDataFromLevelKey=function(e,t){var n=e;return(null==e?void 0:e.method)&&e.uri&&!e.iv&&((n=new v(e.baseuri,e.reluri)).method=e.method,n.iv=this.createInitializationVector(t)),n},t=e,(n=[{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=Object(o.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(e){this._url=e}},{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var e=this.sn;"number"!=typeof e&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&c.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)}return this._decryptdata}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(l.isFiniteNumber)(this.programDateTime))return null;var e=Object(l.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){return!(!this.decryptdata||null===this.decryptdata.uri||null!==this.decryptdata.key)}}])&&m(t.prototype,n),i&&m(t,i),e}();function A(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var b=function(){function e(e){this.endCC=0,this.endSN=0,this.fragments=[],this.initSegment=null,this.live=!0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=e,this.version=null}var t,n,i;return t=e,(n=[{key:"hasProgramDateTime",get:function(){return!(!this.fragments[0]||!Object(l.isFiniteNumber)(this.fragments[0].programDateTime))}}])&&A(t.prototype,n),i&&A(t,i),e}(),E=/^(\d+)x(\d+)$/,T=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,k=function(){function e(t){for(var n in"string"==typeof t&&(t=e.parseAttrList(t)),t)t.hasOwnProperty(n)&&(this[n]=t[n])}var t=e.prototype;return t.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var n=new Uint8Array(t.length/2),i=0;i<t.length/2;i++)n[i]=parseInt(t.slice(2*i,2*i+2),16);return n}return null},t.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.enumeratedString=function(e){return this[e]},t.decimalResolution=function(e){var t=E.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,n={};for(T.lastIndex=0;null!==(t=T.exec(e));){var i=t[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),n[t[1]]=i}return n},e}(),_={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0}};function S(e,t){return MediaSource.isTypeSupported((t||"video")+'/mp4;codecs="'+e+'"')}var C=/(?:#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)|#EXT-X-SESSION-DATA:([^\n\r]*)[\r\n]+)/g,R=/#EXT-X-MEDIA:(.*)/g,w=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/|(?!#)([\S+ ?]+)/.source,/|#EXT-X-BYTERANGE:*(.+)/.source,/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/|#.*/.source].join(""),"g"),O=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-("0.4.6"):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/,L=/\.(mp4|m4s|m4v|m4a)$/i,D=function(){function e(){}return e.findGroup=function(e,t){for(var n=0;n<e.length;n++){var i=e[n];if(i.id===t)return i}},e.convertAVC1ToAVCOTI=function(e){var t,n=e.split(".");return n.length>2?(t=n.shift()+".",t+=parseInt(n.shift()).toString(16),t+=("000"+parseInt(n.shift()).toString(16)).substr(-4)):t=e,t},e.resolve=function(e,t){return o.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.parseMasterPlaylist=function(t,n){var i,r=[],a={},o=!1;function s(e,t){["video","audio"].forEach((function(n){var i=e.filter((function(e){return function(e,t){var n=_[t];return!!n&&!0===n[e.slice(0,4)]}(e,n)}));if(i.length){var r=i.filter((function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)}));t[n+"Codec"]=r.length>0?r[0]:i[0],e=e.filter((function(e){return-1===i.indexOf(e)}))}})),t.unknownCodecs=e}for(C.lastIndex=0;null!=(i=C.exec(t));)if(i[1]){var l={},u=l.attrs=new k(i[1]);l.url=e.resolve(i[2],n);var c=u.decimalResolution("RESOLUTION");c&&(l.width=c.width,l.height=c.height),l.bitrate=u.decimalInteger("AVERAGE-BANDWIDTH")||u.decimalInteger("BANDWIDTH"),l.name=u.NAME,s([].concat((u.CODECS||"").split(/[ ,]+/)),l),l.videoCodec&&-1!==l.videoCodec.indexOf("avc1")&&(l.videoCodec=e.convertAVC1ToAVCOTI(l.videoCodec)),r.push(l)}else if(i[3]){var d=new k(i[3]);d["DATA-ID"]&&(o=!0,a[d["DATA-ID"]]=d)}return{levels:r,sessionData:o?a:null}},e.parseMasterPlaylistMedia=function(t,n,i,r){var a;void 0===r&&(r=[]);var o=[],s=0;for(R.lastIndex=0;null!==(a=R.exec(t));){var l=new k(a[1]);if(l.TYPE===i){var u={attrs:l,id:s++,groupId:l["GROUP-ID"],instreamId:l["INSTREAM-ID"],name:l.NAME||l.LANGUAGE,type:i,default:"YES"===l.DEFAULT,autoselect:"YES"===l.AUTOSELECT,forced:"YES"===l.FORCED,lang:l.LANGUAGE};if(l.URI&&(u.url=e.resolve(l.URI,n)),r.length){var c=e.findGroup(r,u.groupId);u.audioCodec=c?c.codec:r[0].codec}o.push(u)}}return o},e.parseLevelPlaylist=function(e,t,n,i,r){var a,o,s,u=0,d=0,h=new b(t),f=0,p=null,g=new y,m=null;for(w.lastIndex=0;null!==(a=w.exec(e));){var A=a[1];if(A){g.duration=parseFloat(A);var E=(" "+a[2]).slice(1);g.title=E||null,g.tagList.push(E?["INF",A,E]:["INF",A])}else if(a[3]){if(Object(l.isFiniteNumber)(g.duration)){var T=u++;g.type=i,g.start=d,s&&(g.levelkey=s),g.sn=T,g.level=n,g.cc=f,g.urlId=r,g.baseurl=t,g.relurl=(" "+a[3]).slice(1),I(g,p),h.fragments.push(g),p=g,d+=g.duration,g=new y}}else if(a[4]){var _=(" "+a[4]).slice(1);p?g.setByteRange(_,p):g.setByteRange(_)}else if(a[5])g.rawProgramDateTime=(" "+a[5]).slice(1),g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]),null===m&&(m=h.fragments.length);else{if(!(a=a[0].match(O))){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(o=1;o<a.length&&void 0===a[o];o++);var S=(" "+a[o+1]).slice(1),C=(" "+a[o+2]).slice(1);switch(a[o]){case"#":g.tagList.push(C?[S,C]:[S]);break;case"PLAYLIST-TYPE":h.type=S.toUpperCase();break;case"MEDIA-SEQUENCE":u=h.startSN=parseInt(S);break;case"TARGETDURATION":h.targetduration=parseFloat(S);break;case'"0.4.6"':h.version=parseInt(S);break;case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"DIS":f++,g.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":f=parseInt(S);break;case"KEY":var R=new k(S),D=R.enumeratedString("METHOD"),P=R.URI,x=R.hexadecimalInteger("IV");if("com.apple.streamingkeydelivery"===(R.KEYFORMAT||"identity")){c.logger.warn("Keyformat com.apple.streamingkeydelivery is not supported");continue}D&&(s=new v(t,P),P&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(D)>=0&&(s.method=D,s.key=null,s.iv=x));break;case"START":var N=new k(S).decimalFloatingPoint("TIME-OFFSET");Object(l.isFiniteNumber)(N)&&(h.startTimeOffset=N);break;case"MAP":var M=new k(S);g.relurl=M.URI,M.BYTERANGE&&g.setByteRange(M.BYTERANGE),g.baseurl=t,g.level=n,g.type=i,g.sn="initSegment",h.initSegment=g,(g=new y).rawProgramDateTime=h.initSegment.rawProgramDateTime;break;default:c.logger.warn("line parsed but not handled: "+a)}}}return(g=p)&&!g.relurl&&(h.fragments.pop(),d-=g.duration),h.totalduration=d,h.averagetargetduration=d/h.fragments.length,h.endSN=u-1,h.startCC=h.fragments[0]?h.fragments[0].cc:0,h.endCC=f,!h.initSegment&&h.fragments.length&&h.fragments.every((function(e){return L.test(e.relurl)}))&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(g=new y).relurl=h.fragments[0].relurl,g.baseurl=t,g.level=n,g.type=i,g.sn="initSegment",h.initSegment=g,h.needSidxRanges=!0),m&&function(e,t){for(var n=e[t],i=t-1;i>=0;i--){var r=e[i];r.programDateTime=n.programDateTime-1e3*r.duration,n=r}}(h.fragments,m),h},e}();function I(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):(null==t?void 0:t.programDateTime)&&(e.programDateTime=t.endProgramDateTime),Object(l.isFiniteNumber)(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}var P=window.performance,x=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MANIFEST_LOADING,u.default.LEVEL_LOADING,u.default.AUDIO_TRACK_LOADING,u.default.SUBTITLE_TRACK_LOADING)||this).loaders={},n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i.canHaveQualityLevels=function(e){return e!==r.AUDIO_TRACK&&e!==r.SUBTITLE_TRACK},i.mapContextToLevelType=function(e){switch(e.type){case r.AUDIO_TRACK:return a.AUDIO;case r.SUBTITLE_TRACK:return a.SUBTITLE;default:return a.MAIN}},i.getResponseUrl=function(e,t){var n=e.url;return void 0!==n&&0!==n.indexOf("data:")||(n=t.url),n};var o=i.prototype;return o.createInternalLoader=function(e){var t=this.hls.config,n=t.pLoader,i=t.loader,r=new(n||i)(t);return e.loader=r,this.loaders[e.type]=r,r},o.getInternalLoader=function(e){return this.loaders[e.type]},o.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},o.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},o.destroy=function(){this.destroyInternalLoaders(),e.prototype.destroy.call(this)},o.onManifestLoading=function(e){this.load({url:e.url,type:r.MANIFEST,level:0,id:null,responseType:"text"})},o.onLevelLoading=function(e){this.load({url:e.url,type:r.LEVEL,level:e.level,id:e.id,responseType:"text"})},o.onAudioTrackLoading=function(e){this.load({url:e.url,type:r.AUDIO_TRACK,level:null,id:e.id,responseType:"text"})},o.onSubtitleTrackLoading=function(e){this.load({url:e.url,type:r.SUBTITLE_TRACK,level:null,id:e.id,responseType:"text"})},o.load=function(e){var t=this.hls.config;c.logger.debug("Loading playlist of type "+e.type+", level: "+e.level+", id: "+e.id);var n,i,a,o,s=this.getInternalLoader(e);if(s){var l=s.context;if(l&&l.url===e.url)return c.logger.trace("playlist request ongoing"),!1;c.logger.warn("aborting previous loader for type: "+e.type),s.abort()}switch(e.type){case r.MANIFEST:n=t.manifestLoadingMaxRetry,i=t.manifestLoadingTimeOut,a=t.manifestLoadingRetryDelay,o=t.manifestLoadingMaxRetryTimeout;break;case r.LEVEL:n=0,o=0,a=0,i=t.levelLoadingTimeOut;break;default:n=t.levelLoadingMaxRetry,i=t.levelLoadingTimeOut,a=t.levelLoadingRetryDelay,o=t.levelLoadingMaxRetryTimeout}s=this.createInternalLoader(e);var u={timeout:i,maxRetry:n,retryDelay:a,maxRetryDelay:o},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};return c.logger.debug("Calling internal loader delegate for URL: "+e.url),s.load(e,u,d),!0},o.loadsuccess=function(e,t,n,i){if(void 0===i&&(i=null),n.isSidxRequest)return this._handleSidxRequest(e,n),void this._handlePlaylistLoaded(e,t,n,i);if(this.resetInternalLoader(n.type),"string"!=typeof e.data)throw new Error('expected responseType of "text" for PlaylistLoader');var r=e.data;t.tload=P.now(),0===r.indexOf("#EXTM3U")?r.indexOf("#EXTINF:")>0||r.indexOf("#EXT-X-TARGETDURATION:")>0?this._handleTrackOrLevelPlaylist(e,t,n,i):this._handleMasterPlaylist(e,t,n,i):this._handleManifestParsingError(e,n,"no EXTM3U delimiter",i)},o.loaderror=function(e,t,n){void 0===n&&(n=null),this._handleNetworkError(t,n,!1,e)},o.loadtimeout=function(e,t,n){void 0===n&&(n=null),this._handleNetworkError(t,n,!0)},o._handleMasterPlaylist=function(e,t,n,r){var a=this.hls,o=e.data,s=i.getResponseUrl(e,n),l=D.parseMasterPlaylist(o,s),d=l.levels,h=l.sessionData;if(d.length){var f=d.map((function(e){return{id:e.attrs.AUDIO,codec:e.audioCodec}})),p=D.parseMasterPlaylistMedia(o,s,"AUDIO",f),g=D.parseMasterPlaylistMedia(o,s,"SUBTITLES"),v=D.parseMasterPlaylistMedia(o,s,"CLOSED-CAPTIONS");if(p.length){var m=!1;p.forEach((function(e){e.url||(m=!0)})),!1===m&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(c.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:{},url:""}))}a.trigger(u.default.MANIFEST_LOADED,{levels:d,audioTracks:p,subtitles:g,captions:v,url:s,stats:t,networkDetails:r,sessionData:h})}else this._handleManifestParsingError(e,n,"no level found in manifest",r)},o._handleTrackOrLevelPlaylist=function(e,t,n,a){var o=this.hls,c=n.id,d=n.level,h=n.type,f=i.getResponseUrl(e,n),p=Object(l.isFiniteNumber)(c)?c:0,g=Object(l.isFiniteNumber)(d)?d:p,v=i.mapContextToLevelType(n),m=D.parseLevelPlaylist(e.data,f,g,v,p);if(m.tload=t.tload,m.fragments.length){if(h===r.MANIFEST){var y={url:f,details:m};o.trigger(u.default.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:f,stats:t,networkDetails:a,sessionData:null})}if(t.tparsed=P.now(),m.needSidxRanges){var A=m.initSegment.url;this.load({url:A,isSidxRequest:!0,type:h,level:d,levelDetails:m,id:c,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}else n.levelDetails=m,this._handlePlaylistLoaded(e,t,n,a)}else o.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:"number"==typeof n.level?n.level:void 0})},o._handleSidxRequest=function(e,t){if("string"==typeof e.data)throw new Error("sidx request must be made with responseType of array buffer");var n=f.default.parseSegmentIndex(new Uint8Array(e.data));if(n){var i=n.references,r=t.levelDetails;i.forEach((function(e,t){var n=e.info;if(r){var i=r.fragments[t];0===i.byteRange.length&&i.setByteRange(String(1+n.end-n.start)+"@"+String(n.start))}})),r&&r.initSegment.setByteRange(String(n.moovEndOffset)+"@0")}},o._handleManifestParsingError=function(e,t,n,i){this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:e.url,reason:n,networkDetails:i})},o._handleNetworkError=function(e,t,n,i){var a,o;void 0===n&&(n=!1),void 0===i&&(i=null),c.logger.info("A network error occured while loading a "+e.type+"-type playlist");var l=this.getInternalLoader(e);switch(e.type){case r.MANIFEST:a=n?s.ErrorDetails.MANIFEST_LOAD_TIMEOUT:s.ErrorDetails.MANIFEST_LOAD_ERROR,o=!0;break;case r.LEVEL:a=n?s.ErrorDetails.LEVEL_LOAD_TIMEOUT:s.ErrorDetails.LEVEL_LOAD_ERROR,o=!1;break;case r.AUDIO_TRACK:a=n?s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,o=!1;break;default:o=!1}l&&(l.abort(),this.resetInternalLoader(e.type));var d={type:s.ErrorTypes.NETWORK_ERROR,details:a,fatal:o,url:e.url,loader:l,context:e,networkDetails:t};i&&(d.response=i),this.hls.trigger(u.default.ERROR,d)},o._handlePlaylistLoaded=function(e,t,n,a){var o=n.type,s=n.level,l=n.id,c=n.levelDetails;if(c&&c.targetduration)if(i.canHaveQualityLevels(n.type))this.hls.trigger(u.default.LEVEL_LOADED,{details:c,level:s||0,id:l||0,stats:t,networkDetails:a});else switch(o){case r.AUDIO_TRACK:this.hls.trigger(u.default.AUDIO_TRACK_LOADED,{details:c,id:l,stats:t,networkDetails:a});break;case r.SUBTITLE_TRACK:this.hls.trigger(u.default.SUBTITLE_TRACK_LOADED,{details:c,id:l,stats:t,networkDetails:a})}else this._handleManifestParsingError(e,n,"invalid target duration",a)},i}(h),N=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.FRAG_LOADING)||this).loaders={},n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){var t=this.loaders;for(var n in t){var i=t[n];i&&i.destroy()}this.loaders={},e.prototype.destroy.call(this)},r.onFragLoading=function(e){var t=e.frag,n=t.type,i=this.loaders,r=this.hls.config,a=r.fLoader,o=r.loader;t.loaded=0;var s,u,d,h=i[n];h&&(c.logger.warn("abort previous fragment loader for type: "+n),h.abort()),h=i[n]=t.loader=r.fLoader?new a(r):new o(r),s={url:t.url,frag:t,responseType:"arraybuffer",progressData:!1};var f=t.byteRangeStartOffset,p=t.byteRangeEndOffset;Object(l.isFiniteNumber)(f)&&Object(l.isFiniteNumber)(p)&&(s.rangeStart=f,s.rangeEnd=p),u={timeout:r.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:r.fragLoadingMaxRetryTimeout},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},h.load(s,u,d)},r.loadsuccess=function(e,t,n,i){void 0===i&&(i=null);var r=e.data,a=n.frag;a.loader=void 0,this.loaders[a.type]=void 0,this.hls.trigger(u.default.FRAG_LOADED,{payload:r,frag:a,stats:t,networkDetails:i})},r.loaderror=function(e,t,n){void 0===n&&(n=null);var i=t.frag,r=i.loader;r&&r.abort(),this.loaders[i.type]=void 0,this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t.frag,response:e,networkDetails:n})},r.loadtimeout=function(e,t,n){void 0===n&&(n=null);var i=t.frag,r=i.loader;r&&r.abort(),this.loaders[i.type]=void 0,this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t.frag,networkDetails:n})},r.loadprogress=function(e,t,n,i){void 0===i&&(i=null);var r=t.frag;r.loaded=e.loaded,this.hls.trigger(u.default.FRAG_LOAD_PROGRESS,{frag:r,stats:e,networkDetails:i})},i}(h),M=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.KEY_LOADING)||this).loaders={},n.decryptkey=null,n.decrypturl=null,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){for(var t in this.loaders){var n=this.loaders[t];n&&n.destroy()}this.loaders={},e.prototype.destroy.call(this)},r.onKeyLoading=function(e){var t=e.frag,n=t.type,i=this.loaders[n];if(t.decryptdata){var r=t.decryptdata.uri;if(r!==this.decrypturl||null===this.decryptkey){var a=this.hls.config;if(i&&(c.logger.warn("abort previous key loader for type:"+n),i.abort()),!r)return void c.logger.warn("key uri is falsy");t.loader=this.loaders[n]=new a.loader(a),this.decrypturl=r,this.decryptkey=null;var o={url:r,frag:t,responseType:"arraybuffer"},s={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};t.loader.load(o,s,l)}else this.decryptkey&&(t.decryptdata.key=this.decryptkey,this.hls.trigger(u.default.KEY_LOADED,{frag:t}))}else c.logger.warn("Missing decryption data on fragment in onKeyLoading")},r.loadsuccess=function(e,t,n){var i=n.frag;i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=void 0,delete this.loaders[i.type],this.hls.trigger(u.default.KEY_LOADED,{frag:i})):c.logger.error("after key load, decryptdata unset")},r.loaderror=function(e,t){var n=t.frag,i=n.loader;i&&i.abort(),delete this.loaders[n.type],this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:n,response:e})},r.loadtimeout=function(e,t){var n=t.frag,i=n.loader;i&&i.abort(),delete this.loaders[n.type],this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:n})},i}(h),F="NOT_LOADED",B="APPENDING",U="PARTIAL",V="OK",j=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.BUFFER_APPENDED,u.default.FRAG_BUFFERED,u.default.FRAG_LOADED)||this).bufferPadding=.2,n.fragments=Object.create(null),n.timeRanges=Object.create(null),n.config=t.config,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.config=null,h.prototype.destroy.call(this),e.prototype.destroy.call(this)},r.getBufferedFrag=function(e,t){var n=this.fragments,i=Object.keys(n).filter((function(i){var r=n[i];if(r.body.type!==t)return!1;if(!r.buffered)return!1;var a=r.body;return a.startPTS<=e&&e<=a.endPTS}));if(0===i.length)return null;var r=i.pop();return n[r].body},r.detectEvictedFragments=function(e,t){var n=this;Object.keys(this.fragments).forEach((function(i){var r=n.fragments[i];if(r&&r.buffered){var a=r.range[e];if(a)for(var o=a.time,s=0;s<o.length;s++){var l=o[s];if(!n.isTimeBuffered(l.startPTS,l.endPTS,t)){n.removeFragment(r.body);break}}}}))},r.detectPartialFragments=function(e){var t=this,n=this.getFragmentKey(e),i=this.fragments[n];i&&(i.buffered=!0,Object.keys(this.timeRanges).forEach((function(n){if(e.hasElementaryStream(n)){var r=t.timeRanges[n];i.range[n]=t.getBufferedTimes(e.startPTS,e.endPTS,r)}})))},r.getBufferedTimes=function(e,t,n){for(var i,r,a=[],o=!1,s=0;s<n.length;s++){if(i=n.start(s)-this.bufferPadding,r=n.end(s)+this.bufferPadding,e>=i&&t<=r){a.push({startPTS:Math.max(e,n.start(s)),endPTS:Math.min(t,n.end(s))});break}if(e<r&&t>i)a.push({startPTS:Math.max(e,n.start(s)),endPTS:Math.min(t,n.end(s))}),o=!0;else if(t<=i)break}return{time:a,partial:o}},r.getFragmentKey=function(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn},r.getPartialFragment=function(e){var t,n,i,r=this,a=null,o=0;return Object.keys(this.fragments).forEach((function(s){var l=r.fragments[s];r.isPartial(l)&&(n=l.body.startPTS-r.bufferPadding,i=l.body.endPTS+r.bufferPadding,e>=n&&e<=i&&(t=Math.min(e-n,i-e),o<=t&&(a=l.body,o=t)))})),a},r.getState=function(e){var t=this.getFragmentKey(e),n=this.fragments[t],i=F;return void 0!==n&&(i=n.buffered?!0===this.isPartial(n)?U:V:B),i},r.isPartial=function(e){return!0===e.buffered&&(void 0!==e.range.video&&!0===e.range.video.partial||void 0!==e.range.audio&&!0===e.range.audio.partial)},r.isTimeBuffered=function(e,t,n){for(var i,r,a=0;a<n.length;a++){if(i=n.start(a)-this.bufferPadding,r=n.end(a)+this.bufferPadding,e>=i&&t<=r)return!0;if(t<=i)return!1}return!1},r.onFragLoaded=function(e){var t=e.frag;Object(l.isFiniteNumber)(t.sn)&&!t.bitrateTest&&(this.fragments[this.getFragmentKey(t)]={body:t,range:Object.create(null),buffered:!1})},r.onBufferAppended=function(e){var t=this;this.timeRanges=e.timeRanges,Object.keys(this.timeRanges).forEach((function(e){var n=t.timeRanges[e];t.detectEvictedFragments(e,n)}))},r.onFragBuffered=function(e){this.detectPartialFragments(e.frag)},r.hasFragment=function(e){var t=this.getFragmentKey(e);return void 0!==this.fragments[t]},r.removeFragment=function(e){var t=this.getFragmentKey(e);delete this.fragments[t]},r.removeAllFragments=function(){this.fragments=Object.create(null)},i}(h),K={search:function(e,t){for(var n=0,i=e.length-1,r=null,a=null;n<=i;){var o=t(a=e[r=(n+i)/2|0]);if(o>0)n=r+1;else{if(!(o<0))return a;i=r-1}}return null}},G=function(){function e(){}return e.isBuffered=function(e,t){try{if(e)for(var n=e.buffered,i=0;i<n.length;i++)if(t>=n.start(i)&&t<=n.end(i))return!0}catch(e){}return!1},e.bufferInfo=function(e,t,n){try{if(e){var i,r=e.buffered,a=[];for(i=0;i<r.length;i++)a.push({start:r.start(i),end:r.end(i)});return this.bufferedInfo(a,t,n)}}catch(e){}return{len:0,start:t,end:t,nextStart:void 0}},e.bufferedInfo=function(e,t,n){e.sort((function(e,t){var n=e.start-t.start;return n||t.end-e.end}));var i=[];if(n)for(var r=0;r<e.length;r++){var a=i.length;if(a){var o=i[a-1].end;e[r].start-o<n?e[r].end>o&&(i[a-1].end=e[r].end):i.push(e[r])}else i.push(e[r])}else i=e;for(var s,l=0,u=t,c=t,d=0;d<i.length;d++){var h=i[d].start,f=i[d].end;if(t+n>=h&&t<f)u=h,l=(c=f)-t;else if(t+n<h){s=h;break}}return{len:l,start:u,end:c,nextStart:s}},e}(),Y=n("./node_modules/eventemitter3/index.js"),H=n("./node_modules/webworkify-webpack/index.js"),$=n("./src/demux/demuxer-inline.js");function z(){return window.MediaSource||window.WebKitMediaSource}var W=n("./src/utils/get-self-scope.js"),q=function(e){var t,n;function i(){return e.apply(this,arguments)||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i.prototype.trigger=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.emit.apply(this,[e,e].concat(n))},i}(Y.EventEmitter),X=Object(W.getSelfScope)(),Z=z()||{isTypeSupported:function(){return!1}},Q=function(){function e(e,t){var n=this;this.hls=e,this.id=t;var i=this.observer=new q,r=e.config,a=function(t,i){(i=i||{}).frag=n.frag,i.id=n.id,e.trigger(t,i)};i.on(u.default.FRAG_DECRYPTED,a),i.on(u.default.FRAG_PARSING_INIT_SEGMENT,a),i.on(u.default.FRAG_PARSING_DATA,a),i.on(u.default.FRAG_PARSED,a),i.on(u.default.ERROR,a),i.on(u.default.FRAG_PARSING_METADATA,a),i.on(u.default.FRAG_PARSING_USERDATA,a),i.on(u.default.INIT_PTS_FOUND,a);var o={mp4:Z.isTypeSupported("video/mp4"),mpeg:Z.isTypeSupported("audio/mpeg"),mp3:Z.isTypeSupported('audio/mp4; codecs="mp3"')},l=navigator.vendor;if(r.enableWorker&&"undefined"!=typeof Worker){var d;c.logger.log("demuxing in webworker");try{d=this.w=H(/*! ../demux/demuxer-worker.js */"./src/demux/demuxer-worker.js"),this.onwmsg=this.onWorkerMessage.bind(this),d.addEventListener("message",this.onwmsg),d.onerror=function(t){e.trigger(u.default.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},d.postMessage({cmd:"init",typeSupported:o,vendor:l,id:t,config:JSON.stringify(r)})}catch(e){c.logger.warn("Error in worker:",e),c.logger.error("Error while initializing DemuxerWorker, fallback on DemuxerInline"),d&&X.URL.revokeObjectURL(d.objectURL),this.demuxer=new $.default(i,o,r,l),this.w=void 0}}else this.demuxer=new $.default(i,o,r,l)}var t=e.prototype;return t.destroy=function(){var e=this.w;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.w=null;else{var t=this.demuxer;t&&(t.destroy(),this.demuxer=null)}var n=this.observer;n&&(n.removeAllListeners(),this.observer=null)},t.push=function(e,t,n,i,r,a,o,s){var u=this.w,d=Object(l.isFiniteNumber)(r.startPTS)?r.startPTS:r.start,h=r.decryptdata,f=this.frag,p=!(f&&r.cc===f.cc),g=!(f&&r.level===f.level),v=f&&r.sn===f.sn+1,m=!g&&v;if(p&&c.logger.log(this.id+":discontinuity detected"),g&&c.logger.log(this.id+":switch detected"),this.frag=r,u)u.postMessage({cmd:"demux",data:e,decryptdata:h,initSegment:t,audioCodec:n,videoCodec:i,timeOffset:d,discontinuity:p,trackSwitch:g,contiguous:m,duration:a,accurateTimeOffset:o,defaultInitPTS:s},e instanceof ArrayBuffer?[e]:[]);else{var y=this.demuxer;y&&y.push(e,h,t,n,i,d,p,g,m,a,o,s)}},t.onWorkerMessage=function(e){var t=e.data,n=this.hls;switch(t.event){case"init":X.URL.revokeObjectURL(this.w.objectURL);break;case u.default.FRAG_PARSING_DATA:t.data.data1=new Uint8Array(t.data1),t.data2&&(t.data.data2=new Uint8Array(t.data2));default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,n.trigger(t.event,t.data)}},e}();function J(e,t,n){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(n);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(n)}}function ee(e,t,n){var i=e[t],r=e[n],a=r.startPTS;if(Object(l.isFiniteNumber)(a))n>t?(i.duration=a-i.start,i.duration<0&&c.logger.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(r.duration=i.start-a,r.duration<0&&c.logger.warn("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!"));else if(n>t){var o=i.cc===r.cc;r.start=i.start+(o&&i.minEndPTS?i.minEndPTS-i.start:i.duration)}else r.start=Math.max(i.start-r.duration,0)}function te(e,t,n,i,r,a){var o=n,s=i;if(Object(l.isFiniteNumber)(t.startPTS)){var u=Math.abs(t.startPTS-n);Object(l.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(u,t.deltaPTS):t.deltaPTS=u,o=Math.max(n,t.startPTS),n=Math.min(n,t.startPTS),s=Math.min(i,t.endPTS),i=Math.max(i,t.endPTS),r=Math.min(r,t.startDTS),a=Math.max(a,t.endDTS)}var c=n-t.start;t.start=t.startPTS=n,t.maxStartPTS=o,t.endPTS=i,t.minEndPTS=s,t.startDTS=r,t.endDTS=a,t.duration=i-n;var d,h,f,p=t.sn;if(!e||p<e.startSN||p>e.endSN)return 0;for(d=p-e.startSN,(h=e.fragments)[d]=t,f=d;f>0;f--)ee(h,f,f-1);for(f=d;f<h.length-1;f++)ee(h,f,f+1);return e.PTSKnown=!0,c}function ne(e,t){t.initSegment&&e.initSegment&&(t.initSegment=e.initSegment);var n,i=0;if(ie(e,t,(function(e,r){i=e.cc-r.cc,Object(l.isFiniteNumber)(e.startPTS)&&(r.start=r.startPTS=e.startPTS,r.endPTS=e.endPTS,r.duration=e.duration,r.backtracked=e.backtracked,r.dropped=e.dropped,n=r),t.PTSKnown=!0})),t.PTSKnown){if(i){c.logger.log("discontinuity sliding from playlist, take drift into account");for(var r=t.fragments,a=0;a<r.length;a++)r[a].cc+=i}n?te(t,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):function(e,t){var n=t.startSN-e.startSN,i=e.fragments,r=t.fragments;if(!(n<0||n>i.length))for(var a=0;a<r.length;a++)r[a].start+=i[n].start}(e,t),t.PTSKnown=e.PTSKnown}}function ie(e,t,n){if(e&&t)for(var i=Math.max(e.startSN,t.startSN)-t.startSN,r=Math.min(e.endSN,t.endSN)-t.startSN,a=t.startSN-e.startSN,o=i;o<=r;o++){var s=e.fragments[a+o],l=t.fragments[o];if(!s||!l)break;n(s,l,o)}}function re(e,t,n){var i=1e3*(t.averagetargetduration?t.averagetargetduration:t.targetduration),r=i/2;return e&&t.endSN===e.endSN&&(i=r),n&&(i=Math.max(r,i-(window.performance.now()-n))),Math.round(i)}var ae={toString:function(e){for(var t="",n=e.length,i=0;i<n;i++)t+="["+e.start(i).toFixed(3)+","+e.end(i).toFixed(3)+"]";return t}};function oe(e,t){t.fragments.forEach((function(t){if(t){var n=t.start+e;t.start=t.startPTS=n,t.endPTS=n+t.duration}})),t.PTSKnown=!0}function se(e,t,n){!function(e,t,n){if(function(e,t,n){var i=!1;return t&&t.details&&n&&(n.endCC>n.startCC||e&&e.cc<n.startCC)&&(i=!0),i}(e,n,t)){var i=function(e,t){var n=e.fragments,i=t.fragments;if(i.length&&n.length){var r=function(e,t){for(var n=null,i=0;i<e.length;i+=1){var r=e[i];if(r&&r.cc===t){n=r;break}}return n}(n,i[0].cc);if(r&&(!r||r.startPTS))return r;c.logger.log("No frag in previous level to align on")}else c.logger.log("No fragments to align")}(n.details,t);i&&(c.logger.log("Adjusting PTS using last level due to CC increase within current level"),oe(i.start,t))}}(e,n,t),!n.PTSKnown&&t&&function(e,t){if(t&&t.fragments.length){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;var n=t.fragments[0].programDateTime,i=(e.fragments[0].programDateTime-n)/1e3+t.fragments[0].start;Object(l.isFiniteNumber)(i)&&(c.logger.log("adjusting PTS using programDateTime delta, sliding:"+i.toFixed(3)),oe(i,e))}}(n,t.details)}function le(e,t,n){if(null===t||!Array.isArray(e)||!e.length||!Object(l.isFiniteNumber)(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;n=n||0;for(var i=0;i<e.length;++i){var r=e[i];if(de(t,n,r))return r}return null}function ue(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=0);var r=null;if(e?r=t[e.sn-t[0].sn+1]:0===n&&0===t[0].start&&(r=t[0]),r&&0===ce(n,i,r))return r;var a=K.search(t,ce.bind(null,n,i));return a||r}function ce(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0);var i=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-i<=e?1:n.start-i>e&&n.start?-1:0}function de(e,t,n){var i=1e3*Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return(n.endProgramDateTime||0)-i>e}var he=function(){function e(e,t,n,i){this.config=e,this.media=t,this.fragmentTracker=n,this.hls=i,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1}var t=e.prototype;return t.poll=function(e){var t=this.config,n=this.media,i=this.stalled,r=n.currentTime,a=n.seeking,o=this.seeking&&!a,s=!this.seeking&&a;if(this.seeking=a,r===e){if((s||o)&&(this.stalled=null),!n.paused&&!n.ended&&0!==n.playbackRate&&n.buffered.length){var l=G.bufferInfo(n,r,0),u=l.len>0,d=l.nextStart||0;if(u||d){if(a){var h=l.len>2,f=!d||d-r>2&&!this.fragmentTracker.getPartialFragment(r);if(h||f)return;this.moved=!1}if(!this.moved&&this.stalled){var p=Math.max(d,l.start||0)-r;if(p>0&&p<=2)return void this._trySkipBufferHole(null)}var g=self.performance.now();if(null!==i){var v=g-i;!a&&v>=250&&this._reportStall(l.len);var m=G.bufferInfo(n,r,t.maxBufferHole);this._tryFixBufferStall(m,v)}else this.stalled=g}}}else if(this.moved=!0,null!==i){if(this.stallReported){var y=self.performance.now()-i;c.logger.warn("playback not stuck anymore @"+r+", after "+Math.round(y)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},t._tryFixBufferStall=function(e,t){var n=this.config,i=this.fragmentTracker,r=this.media.currentTime,a=i.getPartialFragment(r);a&&this._trySkipBufferHole(a)||e.len>n.maxBufferHole&&t>1e3*n.highBufferWatchdogPeriod&&(c.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,n=this.media;this.stallReported||(this.stallReported=!0,c.logger.warn("Playback stalling at @"+n.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,n=this.hls,i=this.media,r=i.currentTime,a=0,o=0;o<i.buffered.length;o++){var l=i.buffered.start(o);if(r+t.maxBufferHole>=a&&r<l){var d=Math.max(l+.05,i.currentTime+.1);return c.logger.warn("skipping hole, adjusting currentTime from "+r+" to "+d),this.moved=!0,this.stalled=null,i.currentTime=d,e&&n.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+r+" to "+d,frag:e}),d}a=i.buffered.end(o)}return 0},t._tryNudgeBuffer=function(){var e=this.config,t=this.hls,n=this.media,i=n.currentTime,r=(this.nudgeRetry||0)+1;if(this.nudgeRetry=r,r<e.nudgeMaxRetry){var a=i+r*e.nudgeOffset;c.logger.warn("Nudging 'currentTime' from "+i+" to "+a),n.currentTime=a,t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else c.logger.error("Playhead still not moving while enough data buffered @"+i+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},e}();function fe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var pe=function(e){var t,n;function i(t){for(var n,i=arguments.length,r=new Array(i>1?i-1:0),a=1;a<i;a++)r[a-1]=arguments[a];return(n=e.call.apply(e,[this,t].concat(r))||this)._boundTick=void 0,n._tickTimer=null,n._tickInterval=null,n._tickCallCount=0,n._boundTick=n.tick.bind(fe(n)),n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},r.hasInterval=function(){return!!this._tickInterval},r.hasNextTick=function(){return!!this._tickTimer},r.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},r.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},r.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},r.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&(this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)),this._tickCallCount=0)},r.doTick=function(){},i}(h),ge="STOPPED",ve="STARTING",me="IDLE",ye="PAUSED",Ae="KEY_LOADING",be="FRAG_LOADING",Ee="FRAG_LOADING_WAITING_RETRY",Te="WAITING_TRACK",ke="PARSING",_e="PARSED",Se="BUFFER_FLUSHING",Ce="ENDED",Re="ERROR",we="WAITING_INIT_PTS",Oe="WAITING_LEVEL",Le=function(e){var t,n;function i(){return e.apply(this,arguments)||this}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.doTick=function(){},r.startLoad=function(){},r.stopLoad=function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragmentTracker.removeFragment(e)),this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=ge},r._streamEnded=function(e,t){var n=this.fragCurrent,i=this.fragmentTracker;if(!t.live&&n&&!n.backtracked&&n.sn===t.endSN&&!e.nextStart){var r=i.getState(n);return r===U||r===V}return!1},r.onMediaSeeking=function(){var e=this.config,t=this.media,n=this.mediaBuffer,i=this.state,r=t?t.currentTime:null,a=G.bufferInfo(n||t,r,this.config.maxBufferHole);if(c.logger.log("media seeking to "+(Object(l.isFiniteNumber)(r)?r.toFixed(3):r)),i===be){var o=this.fragCurrent;if(0===a.len&&o){var s=e.maxFragLookUpTolerance,u=o.start-s,d=o.start+o.duration+s;r<u||r>d?(o.loader&&(c.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),o.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=me):c.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else i===Ce&&(0===a.len&&(this.fragPrevious=null,this.fragCurrent=null),this.state=me);t&&(this.lastCurrentTime=r),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=r),this.tick()},r.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},r.onHandlerDestroying=function(){this.stopLoad(),e.prototype.onHandlerDestroying.call(this)},r.onHandlerDestroyed=function(){this.state=ge,this.fragmentTracker=null},r.computeLivePosition=function(e,t){var n=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*t.targetduration;return e+Math.max(0,t.totalduration-n)},i}(pe);function De(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ie,Pe=function(e){var t,n;function i(t,n){var i;return(i=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.MANIFEST_LOADING,u.default.MANIFEST_PARSED,u.default.LEVEL_LOADED,u.default.LEVELS_UPDATED,u.default.KEY_LOADED,u.default.FRAG_LOADED,u.default.FRAG_LOAD_EMERGENCY_ABORTED,u.default.FRAG_PARSING_INIT_SEGMENT,u.default.FRAG_PARSING_DATA,u.default.FRAG_PARSED,u.default.ERROR,u.default.AUDIO_TRACK_SWITCHING,u.default.AUDIO_TRACK_SWITCHED,u.default.BUFFER_CREATED,u.default.BUFFER_APPENDED,u.default.BUFFER_FLUSHED)||this).fragmentTracker=n,i.config=t.config,i.audioCodecSwap=!1,i._state=ge,i.stallReported=!1,i.gapController=null,i.altAudio=!1,i.audioOnly=!1,i.bitrateTest=!1,i}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,o,d,h=i.prototype;return h.startLoad=function(e){if(this.levels){var t=this.lastCurrentTime,n=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var i=n.startLevel;-1===i&&(n.config.testBandwidth?(i=0,this.bitrateTest=!0):i=n.nextAutoLevel),this.level=n.nextLoadLevel=i,this.loadedmetadata=!1}t>0&&-1===e&&(c.logger.log("override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=me,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this.forceStartLoad=!0,this.state=ge},h.stopLoad=function(){this.forceStartLoad=!1,e.prototype.stopLoad.call(this)},h.doTick=function(){switch(this.state){case Se:this.fragLoadError=0;break;case me:this._doTickIdle();break;case Oe:var e=this.levels[this.level];e&&e.details&&(this.state=me);break;case Ee:var t=window.performance.now(),n=this.retryDate;(!n||t>=n||this.media&&this.media.seeking)&&(c.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=me)}this._checkBuffer(),this._checkFragmentChanged()},h._doTickIdle=function(){var e=this.hls,t=e.config,n=this.media;if(void 0!==this.levelLastLoaded&&(n||!this.startFragRequested&&t.startFragPrefetch))if(this.altAudio&&this.audioOnly)this.demuxer.frag=null;else{var i;i=this.loadedmetadata?n.currentTime:this.nextLoadPosition;var r=e.nextLoadLevel,a=this.levels[r];if(a){var o,s=a.bitrate;o=s?Math.max(8*t.maxBufferSize/s,t.maxBufferLength):t.maxBufferLength,o=Math.min(o,t.maxMaxBufferLength);var l=i<t.maxBufferHole?Math.max(2,t.maxBufferHole):t.maxBufferHole,d=G.bufferInfo(this.mediaBuffer?this.mediaBuffer:n,i,l),h=d.len;if(!(h>=o)){c.logger.trace("buffer length of "+h.toFixed(3)+" is below max of "+o.toFixed(3)+". checking for more payload ..."),this.level=e.nextLoadLevel=r;var f=a.details;if(!f||f.live&&this.levelLastLoaded!==r)this.state=Oe;else{if(this._streamEnded(d,f)){var p={};return this.altAudio&&(p.type="video"),this.hls.trigger(u.default.BUFFER_EOS,p),void(this.state=Ce)}this._fetchPayloadOrEos(i,d,f)}}}}},h._fetchPayloadOrEos=function(e,t,n){var i=this.fragPrevious;this.level;var r=n.fragments,a=r.length;if(0!==a){var o,s=r[0].start,l=r[a-1].start+r[a-1].duration,u=t.end;if(n.initSegment&&!n.initSegment.data)o=n.initSegment;else if(n.live){var d=this.config.initialLiveManifestSize;if(a<d)return void c.logger.warn("Can not start playback of a level, reason: not enough fragments "+a+" < "+d);if(null===(o=this._ensureFragmentAtLivePoint(n,u,s,l,i,r)))return}else u<s&&(o=r[0]);o||(o=this._findFragment(s,i,a,r,u,l,n)),o&&(o.encrypted?this._loadKey(o,n):this._loadFragment(o,n,e,u))}},h._ensureFragmentAtLivePoint=function(e,t,n,i,r,a){var o,s=this.hls.config,u=this.media,d=1/0;if(void 0!==s.liveMaxLatencyDuration?d=s.liveMaxLatencyDuration:Object(l.isFiniteNumber)(s.liveMaxLatencyDurationCount)&&(d=s.liveMaxLatencyDurationCount*e.targetduration),t<Math.max(n-s.maxFragLookUpTolerance,i-d)){var h=this.liveSyncPosition=this.computeLivePosition(n,e);t=h,u&&!u.paused&&u.readyState&&u.duration>h&&h>u.currentTime&&(c.logger.log("buffer end: "+t.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+h.toFixed(3)),u.currentTime=h),this.nextLoadPosition=h}if(e.PTSKnown&&t>i&&u&&u.readyState)return null;if(this.startFragRequested&&!e.PTSKnown&&r)if(e.hasProgramDateTime)c.logger.log("live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),o=le(a,r.endProgramDateTime,s.maxFragLookUpTolerance);else{var f=r.sn+1;if(f>=e.startSN&&f<=e.endSN){var p=a[f-e.startSN];r.cc===p.cc&&(o=p,c.logger.log("live playlist, switching playlist, load frag with next SN: "+o.sn))}o||(o=K.search(a,(function(e){return r.cc-e.cc})))&&c.logger.log("live playlist, switching playlist, load frag with same CC: "+o.sn)}return o},h._findFragment=function(e,t,n,i,r,a,o){var s,l=this.hls.config;if(s=r<a?ue(t,i,r,r>a-l.maxFragLookUpTolerance?0:l.maxFragLookUpTolerance):i[n-1]){var u=s.sn-o.startSN,d=t&&s.level===t.level,h=i[u-1],f=i[u+1];if(t&&s.sn===t.sn)if(d&&!s.backtracked)if(s.sn<o.endSN){var p=t.deltaPTS;p&&p>l.maxBufferHole&&t.dropped&&u?(s=h,c.logger.warn("Previous fragment was dropped with large PTS gap between audio and video. Maybe fragment is not starting with a keyframe? Loading previous one to try to overcome this")):(s=f,this.fragmentTracker.getState(s)!==V&&c.logger.log("Re-loading fragment with SN: "+s.sn))}else s=null;else s.backtracked&&(f&&f.backtracked?(c.logger.warn("Already backtracked from fragment "+f.sn+", will not backtrack to fragment "+s.sn+". Loading fragment "+f.sn),s=f):(c.logger.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),s.dropped=0,h?(s=h).backtracked=!0:u&&(s=null)))}return s},h._loadKey=function(e,t){c.logger.log("Loading key for "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], level "+this.level),this.state=Ae,this.hls.trigger(u.default.KEY_LOADING,{frag:e})},h._loadFragment=function(e,t,n,i){var r=this.fragmentTracker.getState(e);this.fragCurrent=e,"initSegment"!==e.sn&&(this.startFragRequested=!0),Object(l.isFiniteNumber)(e.sn)&&!e.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),e.backtracked||r===F||r===U?(e.autoLevel=this.hls.autoLevelEnabled,e.bitrateTest=this.bitrateTest,c.logger.log("Loading "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], level "+this.level+", "+(this.loadedmetadata?"currentTime":"nextLoadPosition")+": "+parseFloat(n.toFixed(3))+", bufferEnd: "+parseFloat(i.toFixed(3))),this.hls.trigger(u.default.FRAG_LOADING,{frag:e}),this.demuxer||(this.demuxer=new Q(this.hls,"main")),this.state=be):r===B&&this._reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e)},h.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,a.MAIN)},h.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.endPTS+.5):null},h._checkFragmentChanged=function(){var e,t,n=this.media;if(n&&n.readyState&&!1===n.seeking&&((t=n.currentTime)>this.lastCurrentTime&&(this.lastCurrentTime=t),G.isBuffered(n,t)?e=this.getBufferedFrag(t):G.isBuffered(n,t+.1)&&(e=this.getBufferedFrag(t+.1)),e)){var i=e;if(i!==this.fragPlaying){this.hls.trigger(u.default.FRAG_CHANGED,{frag:i});var r=i.level;this.fragPlaying&&this.fragPlaying.level===r||this.hls.trigger(u.default.LEVEL_SWITCHED,{level:r}),this.fragPlaying=i}}},h.immediateLevelSwitch=function(){if(c.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var e,t=this.media;t?(e=t.paused)||t.pause():e=!0,this.previouslyPaused=e}var n=this.fragCurrent;n&&n.loader&&n.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},h.immediateLevelSwitchEnd=function(){var e=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,e.currentTime>0&&G.isBuffered(e,e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())},h.nextLevelSwitch=function(){var e=this.media;if(e&&e.readyState){var t,n=this.getBufferedFrag(e.currentTime);if(n&&n.startPTS>1&&this.flushMainBuffer(0,n.startPTS-1),e.paused)t=0;else{var i=this.hls.nextLoadLevel,r=this.levels[i],a=this.fragLastKbps;t=a&&this.fragCurrent?this.fragCurrent.duration*r.bitrate/(1e3*a)+1:0}var o=this.getBufferedFrag(e.currentTime+t);if(o){var s=this.followingBufferedFrag(o);if(s){var l=this.fragCurrent;l&&l.loader&&l.loader.abort(),this.fragCurrent=null;var u=Math.max(o.endPTS,s.maxStartPTS+Math.min(this.config.maxFragLookUpTolerance,s.duration));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}},h.flushMainBuffer=function(e,t){this.state=Se;var n={startOffset:e,endOffset:t};this.altAudio&&(n.type="video"),this.hls.trigger(u.default.BUFFER_FLUSHING,n)},h.onMediaAttached=function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended);var n=this.config;this.levels&&n.autoStartLoad&&this.hls.startLoad(n.startPosition),this.gapController=new he(n,t,this.fragmentTracker,this.hls)},h.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(c.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.levels;t&&t.forEach((function(e){e.details&&e.details.fragments.forEach((function(e){e.backtracked=void 0}))})),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.fragmentTracker.removeAllFragments(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},h.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:void 0;Object(l.isFiniteNumber)(t)&&c.logger.log("media seeked to "+t.toFixed(3)),this.tick()},h.onManifestLoading=function(){c.logger.log("trigger BUFFER_RESET"),this.hls.trigger(u.default.BUFFER_RESET),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0},h.onManifestParsed=function(e){var t,n=!1,i=!1;e.levels.forEach((function(e){(t=e.audioCodec)&&(-1!==t.indexOf("mp4a.40.2")&&(n=!0),-1!==t.indexOf("mp4a.40.5")&&(i=!0))})),this.audioCodecSwitch=n&&i,this.audioCodecSwitch&&c.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.altAudio=e.altAudio,this.levels=e.levels,this.startFragRequested=!1;var r=this.config;(r.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(r.startPosition)},h.onLevelLoaded=function(e){var t=e.details,n=e.level,i=this.levels[this.levelLastLoaded],r=this.levels[n],a=t.totalduration,o=0;if(c.logger.log("level "+n+" loaded ["+t.startSN+","+t.endSN+"],duration:"+a),t.live||r.details&&r.details.live){var s=r.details;s&&t.fragments.length>0?(ne(s,t),o=t.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,s),t.PTSKnown&&Object(l.isFiniteNumber)(o)?c.logger.log("live playlist sliding:"+o.toFixed(3)):(c.logger.log("live playlist - outdated PTS, unknown sliding"),se(this.fragPrevious,i,t))):(c.logger.log("live playlist - first load, unknown sliding"),t.PTSKnown=!1,se(this.fragPrevious,i,t))}else t.PTSKnown=!1;if(r.details=t,this.levelLastLoaded=n,this.hls.trigger(u.default.LEVEL_UPDATED,{details:t,level:n}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var d=t.startTimeOffset;Object(l.isFiniteNumber)(d)?(d<0&&(c.logger.log("negative start time offset "+d+", count from end of last fragment"),d=o+a+d),c.logger.log("start time offset found in playlist, adjust startPosition to "+d),this.startPosition=d):t.live?(this.startPosition=this.computeLivePosition(o,t),c.logger.log("configure startPosition to "+this.startPosition)):this.startPosition=0,this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===Oe&&(this.state=me),this.tick()},h.onKeyLoaded=function(){this.state===Ae&&(this.state=me,this.tick())},h.onFragLoaded=function(e){var t=this.fragCurrent,n=this.hls,i=this.levels,r=this.media,a=e.frag;if(this.state===be&&t&&"main"===a.type&&a.level===t.level&&a.sn===t.sn){var o=e.stats,s=i[t.level],l=s.details;if(this.bitrateTest=!1,this.stats=o,c.logger.log("Loaded "+t.sn+" of ["+l.startSN+" ,"+l.endSN+"],level "+t.level),a.bitrateTest&&n.nextLoadLevel)this.state=me,this.startFragRequested=!1,o.tparsed=o.tbuffered=window.performance.now(),n.trigger(u.default.FRAG_BUFFERED,{stats:o,frag:t,id:"main"}),this.tick();else if("initSegment"===a.sn)this.state=me,o.tparsed=o.tbuffered=window.performance.now(),l.initSegment.data=e.payload,n.trigger(u.default.FRAG_BUFFERED,{stats:o,frag:t,id:"main"}),this.tick();else{c.logger.log("Parsing "+t.sn+" of ["+l.startSN+" ,"+l.endSN+"],level "+t.level+", cc "+t.cc),this.state=ke,this.pendingBuffering=!0,this.appended=!1,a.bitrateTest&&(a.bitrateTest=!1,this.fragmentTracker.onFragLoaded({frag:a}));var d=!(r&&r.seeking)&&(l.PTSKnown||!l.live),h=l.initSegment?l.initSegment.data:[],f=this._getAudioCodec(s);(this.demuxer=this.demuxer||new Q(this.hls,"main")).push(e.payload,h,f,s.videoCodec,t,l.totalduration,d)}}this.fragLoadError=0},h.onFragParsingInitSegment=function(e){var t=this.fragCurrent,n=e.frag;if(t&&"main"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===ke){var i,r,a=e.tracks;if(this.audioOnly=a.audio&&!a.video,this.altAudio&&!this.audioOnly&&delete a.audio,r=a.audio){var o=this.levels[this.level].audioCodec,s=navigator.userAgent.toLowerCase();o&&this.audioCodecSwap&&(c.logger.log("swapping playlist audio codec"),o=-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==r.metadata.channelCount&&-1===s.indexOf("firefox")&&(o="mp4a.40.5"),-1!==s.indexOf("android")&&"audio/mpeg"!==r.container&&(o="mp4a.40.2",c.logger.log("Android: force audio codec to "+o)),r.levelCodec=o,r.id=e.id}for(i in(r=a.video)&&(r.levelCodec=this.levels[this.level].videoCodec,r.id=e.id),this.hls.trigger(u.default.BUFFER_CODECS,a),a){r=a[i],c.logger.log("main track:"+i+",container:"+r.container+",codecs[level/parsed]=["+r.levelCodec+"/"+r.codec+"]");var l=r.initSegment;l&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(u.default.BUFFER_APPENDING,{type:i,data:l,parent:"main",content:"initSegment"}))}this.tick()}},h.onFragParsingData=function(e){var t=this,n=this.fragCurrent,i=e.frag;if(n&&"main"===e.id&&i.sn===n.sn&&i.level===n.level&&("audio"!==e.type||!this.altAudio)&&this.state===ke){var r=this.levels[this.level],a=n;if(Object(l.isFiniteNumber)(e.endPTS)||(e.endPTS=e.startPTS+n.duration,e.endDTS=e.startDTS+n.duration),!0===e.hasAudio&&a.addElementaryStream(g.AUDIO),!0===e.hasVideo&&a.addElementaryStream(g.VIDEO),c.logger.log("Parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0)),"video"===e.type)if(a.dropped=e.dropped,a.dropped)if(a.backtracked)c.logger.warn("Already backtracked on this fragment, appending with the gap",a.sn);else{var o=r.details;if(!o||a.sn!==o.startSN)return c.logger.warn("missing video frame(s), backtracking fragment",a.sn),this.fragmentTracker.removeFragment(a),a.backtracked=!0,this.nextLoadPosition=e.startPTS,this.state=me,this.fragPrevious=a,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),void this.tick();c.logger.warn("missing video frame(s) on first frag, appending with gap",a.sn)}else a.backtracked=!1;var s=te(r.details,a,e.startPTS,e.endPTS,e.startDTS,e.endDTS),d=this.hls;d.trigger(u.default.LEVEL_PTS_UPDATED,{details:r.details,level:this.level,drift:s,type:e.type,start:e.startPTS,end:e.endPTS}),[e.data1,e.data2].forEach((function(n){n&&n.length&&t.state===ke&&(t.appended=!0,t.pendingBuffering=!0,d.trigger(u.default.BUFFER_APPENDING,{type:e.type,data:n,parent:"main",content:"data"}))})),this.tick()}},h.onFragParsed=function(e){var t=this.fragCurrent,n=e.frag;t&&"main"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===ke&&(this.stats.tparsed=window.performance.now(),this.state=_e,this._checkAppendedParsed())},h.onAudioTrackSwitching=function(e){var t=this.altAudio,n=!!e.url,i=e.id;if(!n){if(this.mediaBuffer!==this.media){c.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var r=this.fragCurrent;r.loader&&(c.logger.log("switching to main audio track, cancel main fragment load"),r.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=me}var a=this.hls;t&&a.trigger(u.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),a.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:i})}},h.onAudioTrackSwitched=function(e){var t=e.id,n=!!this.hls.audioTracks[t].url;if(n){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(c.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=n,this.tick()},h.onBufferCreated=function(e){var t,n,i=e.tracks,r=!1;for(var a in i){var o=i[a];"main"===o.id?(n=a,t=o,"video"===a&&(this.videoBuffer=i[a].buffer)):r=!0}r&&t?(c.logger.log("alternate track found, use "+n+".buffered to schedule main fragment loading"),this.mediaBuffer=t.buffer):this.mediaBuffer=this.media},h.onBufferAppended=function(e){if("main"===e.parent){var t=this.state;t!==ke&&t!==_e||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}},h._checkAppendedParsed=function(){if(!(this.state!==_e||this.appended&&this.pendingBuffering)){var e=this.fragCurrent;if(e){var t=this.mediaBuffer?this.mediaBuffer:this.media;c.logger.log("main buffered : "+ae.toString(t.buffered)),this.fragPrevious=e;var n=this.stats;n.tbuffered=window.performance.now(),this.fragLastKbps=Math.round(8*n.total/(n.tbuffered-n.tfirst)),this.hls.trigger(u.default.FRAG_BUFFERED,{stats:n,frag:e,id:"main"}),this.state=me}(this.loadedmetadata||this.startPosition<=0)&&this.tick()}},h.onError=function(e){var t=e.frag||this.fragCurrent;if(!t||"main"===t.type){var n=!!this.media&&G.isBuffered(this.media,this.media.currentTime)&&G.isBuffered(this.media,this.media.currentTime+.5);switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:if(!e.fatal)if(this.fragLoadError+1<=this.config.fragLoadingMaxRetry){var i=Math.min(Math.pow(2,this.fragLoadError)*this.config.fragLoadingRetryDelay,this.config.fragLoadingMaxRetryTimeout);c.logger.warn("mediaController: frag loading failed, retry in "+i+" ms"),this.retryDate=window.performance.now()+i,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.fragLoadError++,this.state=Ee}else c.logger.error("mediaController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=Re;break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==Re&&(e.fatal?(this.state=Re,c.logger.warn("streamController: "+e.details+",switch to "+this.state+" state ...")):e.levelRetry||this.state!==Oe||(this.state=me));break;case s.ErrorDetails.BUFFER_FULL_ERROR:"main"!==e.parent||this.state!==ke&&this.state!==_e||(n?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=me):(c.logger.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}},h._reduceMaxBufferLength=function(e){var t=this.config;return t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,c.logger.warn("main:reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},h._checkBuffer=function(){var e=this.media;if(e&&0!==e.readyState){var t=(this.mediaBuffer?this.mediaBuffer:e).buffered;!this.loadedmetadata&&t.length?(this.loadedmetadata=!0,this._seekToStartPos()):this.immediateSwitch?this.immediateLevelSwitchEnd():this.gapController.poll(this.lastCurrentTime,t)}},h.onFragLoadEmergencyAborted=function(){this.state=me,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},h.onBufferFlushed=function(){var e=this.mediaBuffer?this.mediaBuffer:this.media;if(e){var t=this.audioOnly?g.AUDIO:g.VIDEO;this.fragmentTracker.detectEvictedFragments(t,e.buffered)}this.state=me,this.fragPrevious=null},h.onLevelsUpdated=function(e){this.levels=e.levels},h.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},h._seekToStartPos=function(){var e=this.media,t=e.currentTime,n=this.startPosition;if(t!==n&&n>=0){if(e.seeking)return void c.logger.log("could not seek to "+n+", already seeking at "+t);var i=(e.buffered.length?e.buffered.start(0):0)-n;i>0&&i<this.config.maxBufferHole&&(c.logger.log("adjusting start position by "+i+" to match buffer start"),n+=i,this.startPosition=n),c.logger.log("seek to target start position "+n+" from current time "+t+". ready state "+e.readyState),e.currentTime=n}},h._getAudioCodec=function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&(c.logger.log("swapping playlist audio codec"),t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),t},r=i,(o=[{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,c.logger.log("main stream-controller: "+t+"->"+e),this.hls.trigger(u.default.STREAM_STATE_TRANSITION,{previousState:t,nextState:e})}},get:function(){return this._state}},{key:"currentLevel",get:function(){var e=this.media;if(e){var t=this.getBufferedFrag(e.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;return e?this.followingBufferedFrag(this.getBufferedFrag(e.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(e){this._liveSyncPosition=e}}])&&De(r.prototype,o),d&&De(r,d),i}(Le);function xe(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ne=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MANIFEST_LOADED,u.default.LEVEL_LOADED,u.default.AUDIO_TRACK_SWITCHED,u.default.FRAG_LOADED,u.default.ERROR)||this).canload=!1,n.currentLevelIndex=null,n.manualLevelIndex=-1,n.timer=null,Ie=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,l=i.prototype;return l.onHandlerDestroying=function(){this.clearTimer(),this.manualLevelIndex=-1},l.clearTimer=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},l.startLoad=function(){var e=this._levels;this.canload=!0,this.levelRetryCount=0,e&&e.forEach((function(e){e.loadError=0;var t=e.details;t&&t.live&&(e.details=void 0)})),null!==this.timer&&this.loadLevel()},l.stopLoad=function(){this.canload=!1},l.onManifestLoaded=function(e){var t,n=[],i=[],r={},a=null,o=!1,l=!1;if(e.levels.forEach((function(e){var t=e.attrs;e.loadError=0,e.fragmentError=!1,o=o||!!e.videoCodec,l=l||!!e.audioCodec,Ie&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0),(a=r[e.bitrate])?a.url.push(e.url):(e.url=[e.url],e.urlId=0,r[e.bitrate]=e,n.push(e)),t&&(t.AUDIO&&J(a||e,"audio",t.AUDIO),t.SUBTITLES&&J(a||e,"text",t.SUBTITLES))})),o&&l&&(n=n.filter((function(e){return!!e.videoCodec}))),n=n.filter((function(e){var t=e.audioCodec,n=e.videoCodec;return(!t||S(t,"audio"))&&(!n||S(n,"video"))})),e.audioTracks&&(i=e.audioTracks.filter((function(e){return!e.audioCodec||S(e.audioCodec,"audio")}))).forEach((function(e,t){e.id=t})),n.length>0){t=n[0].bitrate,n.sort((function(e,t){return e.bitrate-t.bitrate})),this._levels=n;for(var d=0;d<n.length;d++)if(n[d].bitrate===t){this._firstLevel=d,c.logger.log("manifest loaded,"+n.length+" level(s) found, first bitrate:"+t);break}var h=l&&!o;this.hls.trigger(u.default.MANIFEST_PARSED,{levels:n,audioTracks:i,firstLevel:this._firstLevel,stats:e.stats,audio:l,video:o,altAudio:!h&&i.some((function(e){return!!e.url}))})}else this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:this.hls.url,reason:"no level with compatible codecs found in manifest"})},l.setLevelInternal=function(e){var t=this._levels,n=this.hls;if(e>=0&&e<t.length){if(this.clearTimer(),this.currentLevelIndex!==e){c.logger.log("switching to level "+e),this.currentLevelIndex=e;var i=t[e];i.level=e,n.trigger(u.default.LEVEL_SWITCHING,i)}var r=t[e],a=r.details;if(!a||a.live){var o=r.urlId;n.trigger(u.default.LEVEL_LOADING,{url:r.url[o],level:e,id:o})}}else n.trigger(u.default.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:!1,reason:"invalid level idx"})},l.onError=function(e){if(e.fatal)e.type===s.ErrorTypes.NETWORK_ERROR&&this.clearTimer();else{var t,n=!1,i=!1;switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:t=e.frag.level,i=!0;break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:t=e.context.level,n=!0;break;case s.ErrorDetails.REMUX_ALLOC_ERROR:t=e.level,n=!0}void 0!==t&&this.recoverLevel(e,t,n,i)}},l.recoverLevel=function(e,t,n,i){var r,a,o,s=this,l=this.hls.config,u=e.details,d=this._levels[t];if(d.loadError++,d.fragmentError=i,n){if(!(this.levelRetryCount+1<=l.levelLoadingMaxRetry))return c.logger.error("level controller, cannot recover from "+u+" error"),this.currentLevelIndex=null,this.clearTimer(),void(e.fatal=!0);a=Math.min(Math.pow(2,this.levelRetryCount)*l.levelLoadingRetryDelay,l.levelLoadingMaxRetryTimeout),this.timer=setTimeout((function(){return s.loadLevel()}),a),e.levelRetry=!0,this.levelRetryCount++,c.logger.warn("level controller, "+u+", retry in "+a+" ms, current retry count is "+this.levelRetryCount)}(n||i)&&((r=d.url.length)>1&&d.loadError<r?(d.urlId=(d.urlId+1)%r,d.details=void 0,c.logger.warn("level controller, "+u+" for level "+t+": switching to redundant URL-id "+d.urlId)):-1===this.manualLevelIndex?(o=0===t?this._levels.length-1:t-1,c.logger.warn("level controller, "+u+": switch to "+o),this.hls.nextAutoLevel=this.currentLevelIndex=o):i&&(c.logger.warn("level controller, "+u+": reload a fragment"),this.currentLevelIndex=null))},l.onFragLoaded=function(e){var t=e.frag;if(void 0!==t&&"main"===t.type){var n=this._levels[t.level];void 0!==n&&(n.fragmentError=!1,n.loadError=0,this.levelRetryCount=0)}},l.onLevelLoaded=function(e){var t=this,n=e.level,i=e.details;if(n===this.currentLevelIndex){var r=this._levels[n];if(r.fragmentError||(r.loadError=0,this.levelRetryCount=0),i.live){var a=re(r.details,i,e.stats.trequest);c.logger.log("live playlist, reload in "+Math.round(a)+" ms"),this.timer=setTimeout((function(){return t.loadLevel()}),a)}else this.clearTimer()}},l.onAudioTrackSwitched=function(e){var t=this.hls.audioTracks[e.id].groupId,n=this.hls.levels[this.currentLevelIndex];if(n&&n.audioGroupIds){for(var i=-1,r=0;r<n.audioGroupIds.length;r++)if(n.audioGroupIds[r]===t){i=r;break}i!==n.urlId&&(n.urlId=i,this.startLoad())}},l.loadLevel=function(){if(c.logger.debug("call to loadLevel"),null!==this.currentLevelIndex&&this.canload){var e=this._levels[this.currentLevelIndex];if("object"==typeof e&&e.url.length>0){var t=this.currentLevelIndex,n=e.urlId,i=e.url[n];c.logger.log("Attempt loading level index "+t+" with URL-id "+n),this.hls.trigger(u.default.LEVEL_LOADING,{url:i,level:t,id:n})}}},l.removeLevel=function(e,t){var n=this.levels.filter((function(n,i){return i!==e||n.url.length>1&&void 0!==t&&(n.url=n.url.filter((function(e,n){return n!==t})),n.urlId=0,!0)})).map((function(e,t){var n=e.details;return n&&n.fragments&&n.fragments.forEach((function(e){e.level=t})),e}));this._levels=n,this.hls.trigger(u.default.LEVELS_UPDATED,{levels:n})},r=i,(a=[{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;t&&(e=Math.min(e,t.length-1),this.currentLevelIndex===e&&t[e].details||this.setLevelInternal(e))}},{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(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return 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)}}])&&xe(r.prototype,a),o&&xe(r,o),i}(h),Me=n("./src/demux/id3.js");function Fe(e,t){var n;try{n=new Event("addtrack")}catch(e){(n=document.createEvent("Event")).initEvent("addtrack",!1,!1)}n.track=e,t.dispatchEvent(n)}function Be(e){if(null==e?void 0:e.cues)for(;e.cues.length>0;)e.removeCue(e.cues[0])}var Ue=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.FRAG_PARSING_METADATA,u.default.LIVE_BACK_BUFFER_REACHED)||this).id3Track=void 0,n.media=void 0,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){h.prototype.destroy.call(this)},r.onMediaAttached=function(e){this.media=e.media,this.media},r.onMediaDetaching=function(){Be(this.id3Track),this.id3Track=void 0,this.media=void 0},r.getID3Track=function(e){for(var t=0;t<e.length;t++){var n=e[t];if("metadata"===n.kind&&"id3"===n.label)return Fe(n,this.media),n}return this.media.addTextTrack("metadata","id3")},r.onFragParsingMetadata=function(e){var t=e.frag,n=e.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var i=window.WebKitDataCue||window.VTTCue||window.TextTrackCue,r=0;r<n.length;r++){var a=Me.default.getID3Frames(n[r].data);if(a){var o=Math.max(n[r].pts,0),s=r<n.length-1?n[r+1].pts:t.endPTS;s||(s=t.start+t.duration),s-o<=0&&(s=o+.25);for(var l=0;l<a.length;l++){var u=a[l];if(!Me.default.isTimeStampFrame(u)){var c=new i(o,s,"");c.value=u,this.id3Track.addCue(c)}}}}},r.onLiveBackBufferReached=function(e){var t=e.bufferEnd,n=this.id3Track;if(n&&n.cues&&n.cues.length){var i=function(e,t){if(t<e[0].endTime)return e[0];if(t>e[e.length-1].endTime)return e[e.length-1];for(var n=0,i=e.length-1;n<=i;){var r=Math.floor((i+n)/2);if(t<e[r].endTime)i=r-1;else{if(!(t>e[r].endTime))return e[r];n=r+1}}return e[n].endTime-t<t-e[i].endTime?e[n]:e[i]}(n.cues,t);if(i)for(;n.cues[0]!==i;)n.removeCue(n.cues[0])}},i}(h),Ve=function(){function e(e){this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=0,this.totalWeight_=0}var t=e.prototype;return t.sample=function(e,t){var n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*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_);return this.estimate_/e}return this.estimate_},e}(),je=function(){function e(e,t,n,i){this.hls=void 0,this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.hls=e,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Ve(t),this.fast_=new Ve(n)}var t=e.prototype;return t.sample=function(e,t){var n=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/n;this.fast_.sample(n,i),this.slow_.sample(n,i)},t.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.destroy=function(){},e}();function Ke(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Ge=window.performance,Ye=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.FRAG_LOADING,u.default.FRAG_LOADED,u.default.FRAG_BUFFERED,u.default.ERROR)||this).lastLoadedFragLevel=0,n._nextAutoLevel=-1,n.hls=t,n.timer=null,n._bwEstimator=null,n.onCheck=n._abandonRulesCheck.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n)),n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,d=i.prototype;return d.destroy=function(){this.clearTimer(),h.prototype.destroy.call(this)},d.onFragLoading=function(e){var t=e.frag;if("main"===t.type&&(this.timer||(this.fragCurrent=t,this.timer=setInterval(this.onCheck,100)),!this._bwEstimator)){var n,i,r=this.hls,a=r.config,o=t.level;r.levels[o].details.live?(n=a.abrEwmaFastLive,i=a.abrEwmaSlowLive):(n=a.abrEwmaFastVoD,i=a.abrEwmaSlowVoD),this._bwEstimator=new je(r,i,n,a.abrEwmaDefaultEstimate)}},d._abandonRulesCheck=function(){var e=this.hls,t=e.media,n=this.fragCurrent;if(n){var i=n.loader;if(!i||i.stats&&i.stats.aborted)return c.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);var r=i.stats;if(t&&r&&(!t.paused&&0!==t.playbackRate||!t.readyState)&&n.autoLevel&&n.level){var a=Ge.now()-r.trequest,o=Math.abs(t.playbackRate);if(a>500*n.duration/o){var s=e.levels,l=Math.max(1,r.bw?r.bw/8:1e3*r.loaded/a),d=s[n.level];if(!d)return;var h=d.realBitrate?Math.max(d.realBitrate,d.bitrate):d.bitrate,f=r.total?r.total:Math.max(r.loaded,Math.round(n.duration*h/8)),p=t.currentTime,g=(f-r.loaded)/l,v=(G.bufferInfo(t,p,e.config.maxBufferHole).end-p)/o;if(v<2*n.duration/o&&g>v){var m,y,A=e.minAutoLevel;for(y=n.level-1;y>A;y--){var b=s[y].realBitrate?Math.max(s[y].realBitrate,s[y].bitrate):s[y].bitrate;if(n.duration*b/(6.4*l)<v)break}m<g&&(c.logger.warn("loading too slow, abort fragment loading and switch to level "+y+":fragLoadedDelay["+y+"]<fragLoadedDelay["+(n.level-1)+"];bufferStarvationDelay:"+m.toFixed(1)+"<"+g.toFixed(1)+":"+v.toFixed(1)),e.nextLoadLevel=y,this._bwEstimator.sample(a,r.loaded),i.abort(),this.clearTimer(),e.trigger(u.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,stats:r}))}}}}},d.onFragLoaded=function(e){var t=e.frag;if("main"===t.type&&Object(l.isFiniteNumber)(t.sn)){if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var n=this.hls.levels[t.level],i=(n.loaded?n.loaded.bytes:0)+e.stats.loaded,r=(n.loaded?n.loaded.duration:0)+e.frag.duration;n.loaded={bytes:i,duration:r},n.realBitrate=Math.round(8*i/r)}if(e.frag.bitrateTest){var a=e.stats;a.tparsed=a.tbuffered=a.tload,this.onFragBuffered(e)}}},d.onFragBuffered=function(e){var t=e.stats,n=e.frag;if(!0!==t.aborted&&"main"===n.type&&Object(l.isFiniteNumber)(n.sn)&&(!n.bitrateTest||t.tload===t.tbuffered)){var i=t.tparsed-t.trequest;c.logger.log("latency/loading/parsing/append/kbps:"+Math.round(t.tfirst-t.trequest)+"/"+Math.round(t.tload-t.tfirst)+"/"+Math.round(t.tparsed-t.tload)+"/"+Math.round(t.tbuffered-t.tparsed)+"/"+Math.round(8*t.loaded/(t.tbuffered-t.trequest))),this._bwEstimator.sample(i,t.loaded),t.bwEstimate=this._bwEstimator.getEstimate(),n.bitrateTest?this.bitrateTestDelay=i/1e3:this.bitrateTestDelay=0}},d.onError=function(e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},d.clearTimer=function(){clearInterval(this.timer),this.timer=null},d._findBestLevel=function(e,t,n,i,r,a,o,s,l){for(var u=r;u>=i;u--){var d=l[u];if(d){var h=d.details,f=h?h.totalduration/h.fragments.length:t,p=!!h&&h.live,g=void 0;g=u<=e?o*n:s*n;var v=l[u].realBitrate?Math.max(l[u].realBitrate,l[u].bitrate):l[u].bitrate,m=v*f/g;if(c.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(g)+"/"+v+"/"+f+"/"+a+"/"+m),g>v&&(!m||p&&!this.bitrateTestDelay||m<a))return u}}return-1},r=i,(a=[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this._bwEstimator;if(!(-1===e||t&&t.canEstimate()))return e;var n=this._nextABRAutoLevel;return-1!==e&&(n=Math.min(e,n)),n},set:function(e){this._nextAutoLevel=e}},{key:"_nextABRAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,n=e.levels,i=e.config,r=e.minAutoLevel,a=e.media,o=this.lastLoadedFragLevel,s=this.fragCurrent?this.fragCurrent.duration:0,l=a?a.currentTime:0,u=a&&0!==a.playbackRate?Math.abs(a.playbackRate):1,d=this._bwEstimator?this._bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,h=(G.bufferInfo(a,l,i.maxBufferHole).end-l)/u,f=this._findBestLevel(o,s,d,r,t,h,i.abrBandWidthFactor,i.abrBandWidthUpFactor,n);if(f>=0)return f;c.logger.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var p=s?Math.min(s,i.maxStarvationDelay):i.maxStarvationDelay,g=i.abrBandWidthFactor,v=i.abrBandWidthUpFactor;if(0===h){var m=this.bitrateTestDelay;m&&(p=(s?Math.min(s,i.maxLoadingDelay):i.maxLoadingDelay)-m,c.logger.trace("bitrate test took "+Math.round(1e3*m)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*p)+" ms"),g=v=1)}return f=this._findBestLevel(o,s,d,r,t,h+p,g,v,n),Math.max(f,0)}}])&&Ke(r.prototype,a),o&&Ke(r,o),i}(h),He=z(),$e=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.MANIFEST_PARSED,u.default.BUFFER_RESET,u.default.BUFFER_APPENDING,u.default.BUFFER_CODECS,u.default.BUFFER_EOS,u.default.BUFFER_FLUSHING,u.default.LEVEL_PTS_UPDATED,u.default.LEVEL_UPDATED)||this)._msDuration=null,n._levelDuration=null,n._levelTargetDuration=10,n._live=null,n._objectUrl=null,n._needsFlush=!1,n._needsEos=!1,n.config=void 0,n.audioTimestampOffset=void 0,n.bufferCodecEventsExpected=0,n._bufferCodecEventsTotal=0,n.media=null,n.mediaSource=null,n.segments=[],n.parent=void 0,n.appending=!1,n.appended=0,n.appendError=0,n.flushBufferCounter=0,n.tracks={},n.pendingTracks={},n.sourceBuffer={},n.flushRange=[],n._onMediaSourceOpen=function(){c.logger.log("media source opened"),n.hls.trigger(u.default.MEDIA_ATTACHED,{media:n.media});var e=n.mediaSource;e&&e.removeEventListener("sourceopen",n._onMediaSourceOpen),n.checkPendingTracks()},n._onMediaSourceClose=function(){c.logger.log("media source closed")},n._onMediaSourceEnded=function(){c.logger.log("media source ended")},n._onSBUpdateEnd=function(){if(n.audioTimestampOffset&&n.sourceBuffer.audio){var e=n.sourceBuffer.audio;c.logger.warn("change mpeg audio timestamp offset from "+e.timestampOffset+" to "+n.audioTimestampOffset),e.timestampOffset=n.audioTimestampOffset,delete n.audioTimestampOffset}n._needsFlush&&n.doFlush(),n._needsEos&&n.checkEos(),n.appending=!1;var t=n.parent,i=n.segments.reduce((function(e,n){return n.parent===t?e+1:e}),0),r={},a=n.sourceBuffer;for(var o in a){var s=a[o];if(!s)throw Error("handling source buffer update end error: source buffer for "+o+" uninitilized and unable to update buffered TimeRanges.");r[o]=s.buffered}n.hls.trigger(u.default.BUFFER_APPENDED,{parent:t,pending:i,timeRanges:r}),n._needsFlush||n.doAppending(),n.updateMediaElementDuration(),0===i&&n.flushLiveBackBuffer()},n._onSBUpdateError=function(e){c.logger.error("sourceBuffer error:",e),n.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})},n.config=t.config,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){h.prototype.destroy.call(this)},r.onLevelPtsUpdated=function(e){var t=e.type,n=this.tracks.audio;if("audio"===t&&n&&"audio/mpeg"===n.container){var i=this.sourceBuffer.audio;if(!i)throw Error("Level PTS Updated and source buffer for audio uninitalized");if(Math.abs(i.timestampOffset-e.start)>.1){var r=i.updating;try{i.abort()}catch(e){c.logger.warn("can not abort audio buffer: "+e)}r?this.audioTimestampOffset=e.start:(c.logger.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+e.start),i.timestampOffset=e.start)}}},r.onManifestParsed=function(e){var t=2;(e.audio&&!e.video||!e.altAudio)&&(t=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=t,c.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},r.onMediaAttaching=function(e){var t=this.media=e.media;if(t&&He){var n=this.mediaSource=new He;n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),t.src=window.URL.createObjectURL(n),this._objectUrl=t.src}},r.onMediaDetaching=function(){c.logger.log("media source detaching");var e=this.mediaSource;if(e){if("open"===e.readyState)try{e.endOfStream()}catch(e){c.logger.warn("onMediaDetaching:"+e.message+" while calling endOfStream")}e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),this.media&&(this._objectUrl&&window.URL.revokeObjectURL(this._objectUrl),this.media.src===this._objectUrl?(this.media.removeAttribute("src"),this.media.load()):c.logger.warn("media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.hls.trigger(u.default.MEDIA_DETACHED)},r.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.pendingTracks,n=Object.keys(t).length;(n&&!e||2===n)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())},r.onBufferReset=function(){var e=this.sourceBuffer;for(var t in e){var n=e[t];try{n&&(this.mediaSource&&this.mediaSource.removeSourceBuffer(n),n.removeEventListener("updateend",this._onSBUpdateEnd),n.removeEventListener("error",this._onSBUpdateError))}catch(e){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0},r.onBufferCodecs=function(e){var t=this;Object.keys(this.sourceBuffer).length||(Object.keys(e).forEach((function(n){t.pendingTracks[n]=e[n]})),this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},r.createSourceBuffers=function(e){var t=this.sourceBuffer,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");for(var i in e)if(!t[i]){var r=e[i];if(!r)throw Error("source buffer exists for track "+i+", however track does not");var a=r.levelCodec||r.codec,o=r.container+";codecs="+a;c.logger.log("creating sourceBuffer("+o+")");try{var l=t[i]=n.addSourceBuffer(o);l.addEventListener("updateend",this._onSBUpdateEnd),l.addEventListener("error",this._onSBUpdateError),this.tracks[i]={buffer:l,codec:a,id:r.id,container:r.container,levelCodec:r.levelCodec}}catch(e){c.logger.error("error while trying to add sourceBuffer:"+e.message),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:e,mimeType:o})}}this.hls.trigger(u.default.BUFFER_CREATED,{tracks:this.tracks})},r.onBufferAppending=function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())},r.onBufferEos=function(e){for(var t in this.sourceBuffer)if(!e.type||e.type===t){var n=this.sourceBuffer[t];n&&!n.ended&&(n.ended=!0,c.logger.log(t+" sourceBuffer now EOS"))}this.checkEos()},r.checkEos=function(){var e=this.sourceBuffer,t=this.mediaSource;if(t&&"open"===t.readyState){for(var n in e){var i=e[n];if(i){if(!i.ended)return;if(i.updating)return void(this._needsEos=!0)}}c.logger.log("all media data are available, signal endOfStream() to MediaSource and stop loading fragment");try{t.endOfStream()}catch(e){c.logger.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1}else this._needsEos=!1},r.onBufferFlushing=function(e){e.type?this.flushRange.push({start:e.startOffset,end:e.endOffset,type:e.type}):(this.flushRange.push({start:e.startOffset,end:e.endOffset,type:"video"}),this.flushRange.push({start:e.startOffset,end:e.endOffset,type:"audio"})),this.flushBufferCounter=0,this.doFlush()},r.flushLiveBackBuffer=function(){if(this._live){var e=this.config.liveBackBufferLength;if(isFinite(e)&&!(e<0))if(this.media)for(var t=this.media.currentTime,n=this.sourceBuffer,i=Object.keys(n),r=t-Math.max(e,this._levelTargetDuration),a=i.length-1;a>=0;a--){var o=i[a],s=n[o];if(s){var l=s.buffered;l.length>0&&r>l.start(0)&&this.removeBufferRange(o,s,0,r)&&this.hls.trigger(u.default.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r})}}else c.logger.error("flushLiveBackBuffer called without attaching media")}},r.onLevelUpdated=function(e){var t=e.details;t.fragments.length>0&&(this._levelDuration=t.totalduration+t.fragments[0].start,this._levelTargetDuration=t.averagetargetduration||t.targetduration||10,this._live=t.live,this.updateMediaElementDuration())},r.updateMediaElementDuration=function(){var e,t=this.config;if(null!==this._levelDuration&&this.media&&this.mediaSource&&this.sourceBuffer&&0!==this.media.readyState&&"open"===this.mediaSource.readyState){for(var n in this.sourceBuffer){var i=this.sourceBuffer[n];if(i&&!0===i.updating)return}e=this.media.duration,null===this._msDuration&&(this._msDuration=this.mediaSource.duration),!0===this._live&&!0===t.liveDurationInfinity?(c.logger.log("Media Source duration is set to Infinity"),this._msDuration=this.mediaSource.duration=1/0):(this._levelDuration>this._msDuration&&this._levelDuration>e||!Object(l.isFiniteNumber)(e))&&(c.logger.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},r.doFlush=function(){for(;this.flushRange.length;){var e=this.flushRange[0];if(!this.flushBuffer(e.start,e.end,e.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var t=0,n=this.sourceBuffer;try{for(var i in n){var r=n[i];r&&(t+=r.buffered.length)}}catch(e){c.logger.error("error while accessing sourceBuffer.buffered")}this.appended=t,this.hls.trigger(u.default.BUFFER_FLUSHED)}},r.doAppending=function(){var e=this.config,t=this.hls,n=this.segments,i=this.sourceBuffer;if(Object.keys(i).length){if(!this.media||this.media.error)return this.segments=[],void c.logger.error("trying to append although a media error occured, flush segment and abort");if(!this.appending){var r=n.shift();if(r)try{var a=i[r.type];if(!a)return void this._onSBUpdateEnd();if(a.updating)return void n.unshift(r);a.ended=!1,this.parent=r.parent,a.appendBuffer(r.data),this.appendError=0,this.appended++,this.appending=!0}catch(i){c.logger.error("error while trying to append buffer:"+i.message),n.unshift(r);var o={type:s.ErrorTypes.MEDIA_ERROR,parent:r.parent,details:"",fatal:!1};22===i.code?(this.segments=[],o.details=s.ErrorDetails.BUFFER_FULL_ERROR):(this.appendError++,o.details=s.ErrorDetails.BUFFER_APPEND_ERROR,this.appendError>e.appendErrorMaxRetry&&(c.logger.log("fail "+e.appendErrorMaxRetry+" times to append segment in sourceBuffer"),this.segments=[],o.fatal=!0)),t.trigger(u.default.ERROR,o)}}}},r.flushBuffer=function(e,t,n){var i=this.sourceBuffer;if(!Object.keys(i).length)return!0;var r="null";if(this.media&&(r=this.media.currentTime.toFixed(3)),c.logger.log("flushBuffer,pos/start/end: "+r+"/"+e+"/"+t),this.flushBufferCounter>=this.appended)return c.logger.warn("abort flushing too many retries"),!0;var a=i[n];if(a){if(a.ended=!1,a.updating)return c.logger.warn("cannot flush, sb updating in progress"),!1;if(this.removeBufferRange(n,a,e,t))return this.flushBufferCounter++,!1}return c.logger.log("buffer flushed"),!0},r.removeBufferRange=function(e,t,n,i){try{for(var r=0;r<t.buffered.length;r++){var a=t.buffered.start(r),o=t.buffered.end(r),s=Math.max(a,n),l=Math.min(o,i);if(Math.min(l,o)-s>.5){var u="null";return this.media&&(u=this.media.currentTime.toString()),c.logger.log("sb remove "+e+" ["+s+","+l+"], of ["+a+","+o+"], pos:"+u),t.remove(s,l),!0}}}catch(e){c.logger.warn("removeBufferRange failed",e)}return!1},i}(h);function ze(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var We=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.FPS_DROP_LEVEL_CAPPING,u.default.MEDIA_ATTACHING,u.default.MANIFEST_PARSED,u.default.LEVELS_UPDATED,u.default.BUFFER_CODECS,u.default.MEDIA_DETACHING)||this).autoLevelCapping=Number.POSITIVE_INFINITY,n.firstLevel=null,n.levels=[],n.media=null,n.restrictedLevels=[],n.timer=null,n.clientRect=null,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,s=i.prototype;return s.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=null,this.clientRect=null,this.stopCapping())},s.onFpsDropLevelCapping=function(e){i.isLevelAllowed(e.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(e.droppedLevel)},s.onMediaAttaching=function(e){this.media=e.media instanceof window.HTMLVideoElement?e.media:null},s.onManifestParsed=function(e){var t=this.hls;this.restrictedLevels=[],this.levels=e.levels,this.firstLevel=e.firstLevel,t.config.capLevelToPlayerSize&&e.video&&this.startCapping()},s.onBufferCodecs=function(e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()},s.onLevelsUpdated=function(e){this.levels=e.levels},s.onMediaDetaching=function(){this.stopCapping()},s.detectPlayerSize=function(){if(this.media){var e=this.levels?this.levels.length:0;if(e){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e-1),t.autoLevelCapping>this.autoLevelCapping&&t.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},s.getMaxLevel=function(e){var t=this;if(!this.levels)return-1;var n=this.levels.filter((function(n,r){return i.isLevelAllowed(r,t.restrictedLevels)&&r<=e}));return this.clientRect=null,i.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)},s.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},s.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer),this.timer=null)},s.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,t.width||t.height||(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.top||e.height||0)}return this.clientRect=t,t},i.isLevelAllowed=function(e,t){return void 0===t&&(t=[]),-1===t.indexOf(e)},i.getMaxLevelByMediaSize=function(e,t,n){if(!e||e&&!e.length)return-1;for(var i,r,a=e.length-1,o=0;o<e.length;o+=1){var s=e[o];if((s.width>=t||s.height>=n)&&(i=s,!(r=e[o+1])||i.width!==r.width||i.height!==r.height)){a=o;break}}return a},r=i,o=[{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e}}],(a=[{key:"mediaWidth",get:function(){return this.getDimensions().width*i.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*i.contentScaleFactor}}])&&ze(r.prototype,a),o&&ze(r,o),i}(h),qe=window.performance,Xe=function(e){var t,n;function i(t){return e.call(this,t,u.default.MEDIA_ATTACHING)||this}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},r.onMediaAttaching=function(e){var t=this.hls.config;t.capLevelOnFPSDrop&&("function"==typeof(this.video=e.media instanceof window.HTMLVideoElement?e.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),t.fpsDroppedMonitoringPeriod))},r.checkFPS=function(e,t,n){var i=qe.now();if(t){if(this.lastTime){var r=i-this.lastTime,a=n-this.lastDroppedFrames,o=t-this.lastDecodedFrames,s=1e3*a/r,l=this.hls;if(l.trigger(u.default.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:n}),s>0&&a>l.config.fpsDroppedMonitoringThreshold*o){var d=l.currentLevel;c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=d)&&(d-=1,l.trigger(u.default.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:l.currentLevel}),l.autoLevelCapping=d,l.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,this.lastDecodedFrames=t}},r.checkFPSInterval=function(){var e=this.video;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},i}(h),Ze=function(){function e(e){e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}var t=e.prototype;return t.destroy=function(){this.abort(),this.loader=null},t.abort=function(){var e=this.loader;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null},t.load=function(e,t,n){this.context=e,this.config=t,this.callbacks=n,this.stats={trequest:window.performance.now(),retry:0},this.retryDelay=t.retryDelay,this.loadInternal()},t.loadInternal=function(){var e,t=this.context;e=this.loader=new window.XMLHttpRequest;var n=this.stats;n.tfirst=0,n.loaded=0;var i=this.xhrSetup;try{if(i)try{i(e,t.url)}catch(n){e.open("GET",t.url,!0),i(e,t.url)}e.readyState||e.open("GET",t.url,!0)}catch(n){return void this.callbacks.onError({code:e.status,text:n.message},t,e)}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,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),e.send()},t.readystatechange=function(e){var t=e.currentTarget,n=t.readyState,i=this.stats,r=this.context,a=this.config;if(!i.aborted&&n>=2)if(window.clearTimeout(this.requestTimeout),0===i.tfirst&&(i.tfirst=Math.max(window.performance.now(),i.trequest)),4===n){var o=t.status;if(o>=200&&o<300){var s,l;i.tload=Math.max(i.tfirst,window.performance.now()),l="arraybuffer"===r.responseType?(s=t.response).byteLength:(s=t.responseText).length,i.loaded=i.total=l;var u={url:t.responseURL,data:s};this.callbacks.onSuccess(u,i,r,t)}else i.retry>=a.maxRetry||o>=400&&o<499?(c.logger.error(o+" while loading "+r.url),this.callbacks.onError({code:o,text:t.statusText},r,t)):(c.logger.warn(o+" while loading "+r.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),i.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),a.timeout)},t.loadtimeout=function(){c.logger.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},t.loadprogress=function(e){var t=e.currentTarget,n=this.stats;n.loaded=e.loaded,e.lengthComputable&&(n.total=e.total);var i=this.callbacks.onProgress;i&&i(n,this.context,null,t)},e}();function Qe(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Je=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MANIFEST_LOADING,u.default.MANIFEST_PARSED,u.default.AUDIO_TRACK_LOADED,u.default.AUDIO_TRACK_SWITCHED,u.default.LEVEL_LOADED,u.default.ERROR)||this)._trackId=-1,n._selectDefaultTrack=!0,n.tracks=[],n.trackIdBlacklist=Object.create(null),n.audioGroupId=null,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,l=i.prototype;return l.onManifestLoading=function(){this.tracks=[],this._trackId=-1,this._selectDefaultTrack=!0},l.onManifestParsed=function(e){var t=this.tracks=e.audioTracks||[];this.hls.trigger(u.default.AUDIO_TRACKS_UPDATED,{audioTracks:t}),this._selectAudioGroup(this.hls.nextLoadLevel)},l.onAudioTrackLoaded=function(e){if(e.id>=this.tracks.length)c.logger.warn("Invalid audio track id:",e.id);else{if(c.logger.log("audioTrack "+e.id+" loaded"),this.tracks[e.id].details=e.details,e.details.live&&!this.hasInterval()){var t=1e3*e.details.targetduration;this.setInterval(t)}!e.details.live&&this.hasInterval()&&this.clearInterval()}},l.onAudioTrackSwitched=function(e){var t=this.tracks[e.id].groupId;t&&this.audioGroupId!==t&&(this.audioGroupId=t)},l.onLevelLoaded=function(e){this._selectAudioGroup(e.level)},l.onError=function(e){e.type===s.ErrorTypes.NETWORK_ERROR&&(e.fatal&&this.clearInterval(),e.details===s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&(c.logger.warn("Network failure on audio-track id:",e.context.id),this._handleLoadError()))},l._setAudioTrack=function(e){if(this._trackId===e&&this.tracks[this._trackId].details)c.logger.debug("Same id as current audio-track passed, and track details available -> no-op");else if(e<0||e>=this.tracks.length)c.logger.warn("Invalid id passed to audio-track controller");else{var t=this.tracks[e];c.logger.log("Now switching to audio-track index "+e),this.clearInterval(),this._trackId=e;var n=t.url,i=t.type,r=t.id;this.hls.trigger(u.default.AUDIO_TRACK_SWITCHING,{id:r,type:i,url:n}),this._loadTrackDetailsIfNeeded(t)}},l.doTick=function(){this._updateTrack(this._trackId)},l._selectAudioGroup=function(e){var t=this.hls.levels[e];if(t&&t.audioGroupIds){var n=t.audioGroupIds[t.urlId];this.audioGroupId!==n&&(this.audioGroupId=n,this._selectInitialAudioTrack())}},l._selectInitialAudioTrack=function(){var e=this,t=this.tracks;if(t.length){var n=this.tracks[this._trackId],i=null;if(n&&(i=n.name),this._selectDefaultTrack){var r=t.filter((function(e){return e.default}));r.length?t=r:c.logger.warn("No default audio tracks defined")}var a=!1,o=function(){t.forEach((function(t){a||e.audioGroupId&&t.groupId!==e.audioGroupId||i&&i!==t.name||(e._setAudioTrack(t.id),a=!0)}))};o(),a||(i=null,o()),a||(c.logger.error("No track found for running audio group-ID: "+this.audioGroupId),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))}},l._needsTrackLoading=function(e){var t=e.details,n=e.url;return!(t&&!t.live||!n)},l._loadTrackDetailsIfNeeded=function(e){if(this._needsTrackLoading(e)){var t=e.url,n=e.id;c.logger.log("loading audio-track playlist for id: "+n),this.hls.trigger(u.default.AUDIO_TRACK_LOADING,{url:t,id:n})}},l._updateTrack=function(e){if(!(e<0||e>=this.tracks.length)){this.clearInterval(),this._trackId=e,c.logger.log("trying to update audio-track "+e);var t=this.tracks[e];this._loadTrackDetailsIfNeeded(t)}},l._handleLoadError=function(){this.trackIdBlacklist[this._trackId]=!0;var e=this._trackId,t=this.tracks[e],n=t.name,i=t.language,r=t.groupId;c.logger.warn("Loading failed on audio track id: "+e+", group-id: "+r+', name/language: "'+n+'" / "'+i+'"');for(var a=e,o=0;o<this.tracks.length;o++)if(!this.trackIdBlacklist[o]&&this.tracks[o].name===n){a=o;break}a!==e?(c.logger.log("Attempting audio-track fallback id:",a,"group-id:",this.tracks[a].groupId),this._setAudioTrack(a)):c.logger.warn('No fallback audio-track found for name/language: "'+n+'" / "'+i+'"')},r=i,(a=[{key:"audioTracks",get:function(){return this.tracks}},{key:"audioTrack",get:function(){return this._trackId},set:function(e){this._setAudioTrack(e),this._selectDefaultTrack=!1}}])&&Qe(r.prototype,a),o&&Qe(r,o),i}(pe);function et(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var tt=window.performance,nt=function(e){var t,n;function i(t,n){var i;return(i=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.AUDIO_TRACKS_UPDATED,u.default.AUDIO_TRACK_SWITCHING,u.default.AUDIO_TRACK_LOADED,u.default.KEY_LOADED,u.default.FRAG_LOADED,u.default.FRAG_PARSING_INIT_SEGMENT,u.default.FRAG_PARSING_DATA,u.default.FRAG_PARSED,u.default.ERROR,u.default.BUFFER_RESET,u.default.BUFFER_CREATED,u.default.BUFFER_APPENDED,u.default.BUFFER_FLUSHED,u.default.INIT_PTS_FOUND)||this).fragmentTracker=n,i.config=t.config,i.audioCodecSwap=!1,i._state=ge,i.initPTS=[],i.waitingFragment=null,i.videoTrackCC=null,i.waitingVideoCC=null,i}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,d=i.prototype;return d.onInitPtsFound=function(e){var t=e.id,n=e.frag.cc,i=e.initPTS;"main"===t&&(this.initPTS[n]=i,this.videoTrackCC=n,c.logger.log("InitPTS for cc: "+n+" found from main: "+i),this.state===we&&this.tick())},d.startLoad=function(e){if(this.tracks){var t=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,t>0&&-1===e?(c.logger.log("audio:override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=me):(this.lastCurrentTime=this.startPosition?this.startPosition:e,this.state=ve),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=e,this.state=ge},d.doTick=function(){var e,t,n,i=this.hls,r=i.config;switch(this.state){case Re:case ye:case Se:break;case ve:this.state=Te,this.loadedmetadata=!1;break;case me:var a=this.tracks;if(!a)break;if(!this.media&&(this.startFragRequested||!r.startFragPrefetch))break;if(this.loadedmetadata)e=this.media.currentTime;else if(void 0===(e=this.nextLoadPosition))break;var o=this.mediaBuffer?this.mediaBuffer:this.media,s=this.videoBuffer?this.videoBuffer:this.media,d=e<r.maxBufferHole?Math.max(2,r.maxBufferHole):r.maxBufferHole,h=G.bufferInfo(o,e,d),f=G.bufferInfo(s,e,d),p=h.len,g=h.end,v=this.fragPrevious,m=Math.min(r.maxBufferLength,r.maxMaxBufferLength),y=Math.max(m,f.len),A=this.audioSwitch,b=this.trackId;if((p<y||A)&&b<a.length){if(void 0===(n=a[b].details)){this.state=Te;break}if(!A&&this._streamEnded(h,n))return this.hls.trigger(u.default.BUFFER_EOS,{type:"audio"}),void(this.state=Ce);var E,T=n.fragments,k=T.length,_=T[0].start,S=T[k-1].start+T[k-1].duration;if(A)if(n.live&&!n.PTSKnown)c.logger.log("switching audiotrack, live stream, unknown PTS,load first fragment"),g=0;else if(g=e,n.PTSKnown&&e<_){if(!(h.end>_||h.nextStart))return;c.logger.log("alt audio track ahead of main track, seek to start of alt audio track"),this.media.currentTime=_+.05}if(n.initSegment&&!n.initSegment.data)E=n.initSegment;else if(g<=_){if(E=T[0],null!==this.videoTrackCC&&E.cc!==this.videoTrackCC&&(E=function(e,t){return K.search(e,(function(e){return e.cc<t?1:e.cc>t?-1:0}))}(T,this.videoTrackCC)),n.live&&E.loadIdx&&E.loadIdx===this.fragLoadIdx){var C=h.nextStart?h.nextStart:_;return c.logger.log("no alt audio available @currentTime:"+this.media.currentTime+", seeking @"+(C+.05)),void(this.media.currentTime=C+.05)}}else{var R,w=r.maxFragLookUpTolerance,O=v?T[v.sn-T[0].sn+1]:void 0;g<S?(g>S-w&&(w=0),R=O&&!ce(g,w,O)?O:K.search(T,(function(e){return ce(g,w,e)}))):R=T[k-1],R&&(E=R,_=R.start,v&&E.level===v.level&&E.sn===v.sn&&(E.sn<n.endSN?(E=T[E.sn+1-n.startSN],this.fragmentTracker.getState(E)!==V&&c.logger.log("SN just loaded, load next one: "+E.sn)):E=null))}E&&(E.encrypted?(c.logger.log("Loading key for "+E.sn+" of ["+n.startSN+" ,"+n.endSN+"],track "+b),this.state=Ae,i.trigger(u.default.KEY_LOADING,{frag:E})):(this.fragCurrent=E,(A||this.fragmentTracker.getState(E)===F)&&(c.logger.log("Loading "+E.sn+", cc: "+E.cc+" of ["+n.startSN+" ,"+n.endSN+"],track "+b+", "+(this.loadedmetadata?"currentTime":"nextLoadPosition")+": "+e+", bufferEnd: "+g.toFixed(3)),"initSegment"!==E.sn&&(this.startFragRequested=!0),Object(l.isFiniteNumber)(E.sn)&&(this.nextLoadPosition=E.start+E.duration),i.trigger(u.default.FRAG_LOADING,{frag:E}),this.state=be)))}break;case Te:(t=this.tracks[this.trackId])&&t.details&&(this.state=me);break;case Ee:var L=tt.now(),D=this.retryDate,I=(o=this.media)&&o.seeking;(!D||L>=D||I)&&(c.logger.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=me);break;case we:var P=this.waitingFragment;if(P){var x=P.frag.cc;if(void 0!==this.initPTS[x])this.waitingFragment=null,this.state=be,this.onFragLoaded(P);else if(this.videoTrackCC!==this.waitingVideoCC)c.logger.log("Waiting fragment cc ("+x+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var N=G.bufferInfo(this.mediaBuffer,this.media.currentTime,r.maxBufferHole);ce(N.end,r.maxFragLookUpTolerance,P.frag)<0&&(c.logger.log("Waiting fragment cc ("+x+") @ "+P.frag.start+" cancelled because another fragment at "+N.end+" is needed"),this.clearWaitingFragment())}}else this.state=me}},d.clearWaitingFragment=function(){var e=this.waitingFragment;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingFragment=null,this.waitingVideoCC=null,this.state=me)},d.onMediaAttached=function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended);var n=this.config;this.tracks&&n.autoStartLoad&&this.startLoad(n.startPosition)},d.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(c.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},d.onAudioTracksUpdated=function(e){c.logger.log("audio tracks updated"),this.tracks=e.audioTracks},d.onAudioTrackSwitching=function(e){var t=!!e.url;this.trackId=e.id,this.fragCurrent=null,this.clearWaitingFragment(),this.state=ye,t?this.setInterval(100):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),t&&(this.audioSwitch=!0,this.state=me),this.tick()},d.onAudioTrackLoaded=function(e){var t=e.details,n=e.id,i=this.tracks[n],r=i.details,a=t.totalduration,o=0;if(c.logger.log("track "+n+" loaded ["+t.startSN+","+t.endSN+"],duration:"+a),t.live||r&&r.live?r&&t.fragments.length>0?(ne(r,t),o=t.fragments[0].start,t.PTSKnown?c.logger.log("live audio playlist sliding:"+o.toFixed(3)):c.logger.log("live audio playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,c.logger.log("live audio playlist - first load, unknown sliding")):t.PTSKnown=!1,i.details=t,!this.startFragRequested){if(-1===this.startPosition){var s=t.startTimeOffset;Object(l.isFiniteNumber)(s)?(c.logger.log("start time offset found in playlist, adjust startPosition to "+s),this.startPosition=s):t.live?(this.startPosition=this.computeLivePosition(o,t),c.logger.log("compute startPosition for audio-track to "+this.startPosition)):this.startPosition=0}this.nextLoadPosition=this.startPosition}this.state===Te&&(this.state=me),this.tick()},d.onKeyLoaded=function(){this.state===Ae&&(this.state=me,this.tick())},d.onFragLoaded=function(e){var t=this.fragCurrent,n=e.frag;if(this.state===be&&t&&"audio"===n.type&&n.level===t.level&&n.sn===t.sn){var i=this.tracks[this.trackId],r=i.details,a=r.totalduration,o=t.level,s=t.sn,l=t.cc,d=this.config.defaultAudioCodec||i.audioCodec||"mp4a.40.2",h=this.stats=e.stats;if("initSegment"===s)this.state=me,h.tparsed=h.tbuffered=tt.now(),r.initSegment.data=e.payload,this.hls.trigger(u.default.FRAG_BUFFERED,{stats:h,frag:t,id:"audio"}),this.tick();else{this.state=ke,this.appended=!1,this.demuxer||(this.demuxer=new Q(this.hls,"audio"));var f=this.initPTS[l],p=r.initSegment?r.initSegment.data:[];void 0!==f?(this.pendingBuffering=!0,c.logger.log("Demuxing "+s+" of ["+r.startSN+" ,"+r.endSN+"],track "+o),this.demuxer.push(e.payload,p,d,null,t,a,!1,f)):(c.logger.log("Unknown video PTS for cc "+l+", waiting for video PTS before demuxing audio frag "+s+" of ["+r.startSN+" ,"+r.endSN+"],track "+o),this.waitingFragment=e,this.waitingVideoCC=this.videoTrackCC,this.state=we)}}this.fragLoadError=0},d.onFragParsingInitSegment=function(e){var t=this.fragCurrent,n=e.frag;if(t&&"audio"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===ke){var i,r=e.tracks;if(r.video&&delete r.video,i=r.audio){i.levelCodec=i.codec,i.id=e.id,this.hls.trigger(u.default.BUFFER_CODECS,r),c.logger.log("audio track:audio,container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var a=i.initSegment;if(a){var o={type:"audio",data:a,parent:"audio",content:"initSegment"};this.audioSwitch?this.pendingData=[o]:(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(u.default.BUFFER_APPENDING,o))}this.tick()}}},d.onFragParsingData=function(e){var t=this,n=this.fragCurrent,i=e.frag;if(n&&"audio"===e.id&&"audio"===e.type&&i.sn===n.sn&&i.level===n.level&&this.state===ke){var r=this.trackId,a=this.tracks[r],o=this.hls;Object(l.isFiniteNumber)(e.endPTS)||(e.endPTS=e.startPTS+n.duration,e.endDTS=e.startDTS+n.duration),n.addElementaryStream(g.AUDIO),c.logger.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb),te(a.details,n,e.startPTS,e.endPTS);var d=this.media,h=!1;if(this.audioSwitch)if(d&&d.readyState){var f=d.currentTime;c.logger.log("switching audio track : currentTime:"+f),f>=e.startPTS&&(c.logger.log("switching audio track : flushing all audio"),this.state=Se,o.trigger(u.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),h=!0,this.audioSwitch=!1,o.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:r}))}else this.audioSwitch=!1,o.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:r});var p=this.pendingData;if(!p)return c.logger.warn("Apparently attempt to enqueue media payload without codec initialization data upfront"),void o.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:null,fatal:!0});this.audioSwitch||([e.data1,e.data2].forEach((function(t){t&&t.length&&p.push({type:e.type,data:t,parent:"audio",content:"data"})})),!h&&p.length&&(p.forEach((function(e){t.state===ke&&(t.pendingBuffering=!0,t.hls.trigger(u.default.BUFFER_APPENDING,e))})),this.pendingData=[],this.appended=!0)),this.tick()}},d.onFragParsed=function(e){var t=this.fragCurrent,n=e.frag;t&&"audio"===e.id&&n.sn===t.sn&&n.level===t.level&&this.state===ke&&(this.stats.tparsed=tt.now(),this.state=_e,this._checkAppendedParsed())},d.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},d.onBufferCreated=function(e){var t=e.tracks.audio;t&&(this.mediaBuffer=t.buffer,this.loadedmetadata=!0),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer)},d.onBufferAppended=function(e){if("audio"===e.parent){var t=this.state;t!==ke&&t!==_e||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}},d._checkAppendedParsed=function(){if(!(this.state!==_e||this.appended&&this.pendingBuffering)){var e=this.fragCurrent,t=this.stats,n=this.hls;if(e){this.fragPrevious=e,t.tbuffered=tt.now(),n.trigger(u.default.FRAG_BUFFERED,{stats:t,frag:e,id:"audio"});var i=this.mediaBuffer?this.mediaBuffer:this.media;i&&c.logger.log("audio buffered : "+ae.toString(i.buffered)),this.audioSwitch&&this.appended&&(this.audioSwitch=!1,n.trigger(u.default.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.state=me}this.tick()}},d.onError=function(e){var t=e.frag;if(!t||"audio"===t.type)switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:var n=e.frag;if(n&&"audio"!==n.type)break;if(!e.fatal){var i=this.fragLoadError;i?i++:i=1;var r=this.config;if(i<=r.fragLoadingMaxRetry){this.fragLoadError=i;var a=Math.min(Math.pow(2,i-1)*r.fragLoadingRetryDelay,r.fragLoadingMaxRetryTimeout);c.logger.warn("AudioStreamController: frag loading failed, retry in "+a+" ms"),this.retryDate=tt.now()+a,this.state=Ee}else c.logger.error("AudioStreamController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=Re}break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==Re&&(this.state=e.fatal?Re:me,c.logger.warn("AudioStreamController: "+e.details+" while loading frag, now switching to "+this.state+" state ..."));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===e.parent&&(this.state===ke||this.state===_e)){var o=this.mediaBuffer,l=this.media.currentTime;if(o&&G.isBuffered(o,l)&&G.isBuffered(o,l+.5)){var d=this.config;d.maxMaxBufferLength>=d.maxBufferLength&&(d.maxMaxBufferLength/=2,c.logger.warn("AudioStreamController: reduce max buffer length to "+d.maxMaxBufferLength+"s")),this.state=me}else c.logger.warn("AudioStreamController: buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,this.state=Se,this.hls.trigger(u.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"})}}},d.onBufferFlushed=function(){var e=this,t=this.pendingData;t&&t.length?(c.logger.log("AudioStreamController: appending pending audio data after buffer flushed"),t.forEach((function(t){e.hls.trigger(u.default.BUFFER_APPENDING,t)})),this.appended=!0,this.pendingData=[],this.state=_e):(this.state=me,this.fragPrevious=null,this.tick())},r=i,(a=[{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,c.logger.log("audio stream:"+t+"->"+e)}},get:function(){return this._state}}])&&et(r.prototype,a),o&&et(r,o),i}(Le),it=function(){if("undefined"!=typeof window&&window.VTTCue)return window.VTTCue;var e={"":!0,lr:!0,rl:!0},t={start:!0,middle:!0,end:!0,left:!0,right:!0};function n(e){return"string"==typeof e&&!!t[e.toLowerCase()]&&e.toLowerCase()}function i(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}function r(t,r,a){var o=this,s={enumerable:!0};o.hasBeenReset=!1;var l="",u=!1,c=t,d=r,h=a,f=null,p="",g=!0,v="auto",m="start",y=50,A="middle",b=50,E="middle";Object.defineProperty(o,"id",i({},s,{get:function(){return l},set:function(e){l=""+e}})),Object.defineProperty(o,"pauseOnExit",i({},s,{get:function(){return u},set:function(e){u=!!e}})),Object.defineProperty(o,"startTime",i({},s,{get:function(){return c},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");c=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",i({},s,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",i({},s,{get:function(){return h},set:function(e){h=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",i({},s,{get:function(){return f},set:function(e){f=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",i({},s,{get:function(){return p},set:function(t){var n=function(t){return"string"==typeof t&&!!e[t.toLowerCase()]&&t.toLowerCase()}(t);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");p=n,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",i({},s,{get:function(){return g},set:function(e){g=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",i({},s,{get:function(){return v},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",i({},s,{get:function(){return m},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",i({},s,{get:function(){return y},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",i({},s,{get:function(){return A},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");A=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",i({},s,{get:function(){return b},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",i({},s,{get:function(){return E},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");E=t,this.hasBeenReset=!0}})),o.displayState=void 0}return r.prototype.getCueAsHTML=function(){return window.WebVTT.convertCueToDOMTree(window,this.text)},r}(),rt=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}};function at(){this.window=window,this.state="INITIAL",this.buffer="",this.decoder=new rt,this.regionList=[]}function ot(){this.values=Object.create(null)}function st(e,t,n,i){var r=i?e.split(i):[e];for(var a in r)if("string"==typeof r[a]){var o=r[a].split(n);2===o.length&&t(o[0],o[1])}}ot.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,n){for(var i=0;i<n.length;++i)if(t===n[i]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var lt=new it(0,0,0),ut="middle"===lt.align?"middle":"center";function ct(e,t,n){var i=e;function r(){var t=function(e){function t(e,t,n,i){return 3600*(0|e)+60*(0|t)+(0|n)+(0|i)/1e3}var n=e.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return n?n[3]?t(n[1],n[2],n[3].replace(":",""),n[4]):n[1]>59?t(n[1],n[2],0,n[4]):t(0,n[1],n[2],n[4]):null}(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.substr(3),a(),t.endTime=r(),a(),function(e,t){var i=new ot;st(e,(function(e,t){switch(e){case"region":for(var r=n.length-1;r>=0;r--)if(n[r].id===t){i.set(e,n[r].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),o=a[0];i.integer(e,o),i.percent(e,o)&&i.set("snapToLines",!1),i.alt(e,o,["auto"]),2===a.length&&i.alt("lineAlign",a[1],["start",ut,"end"]);break;case"position":a=t.split(","),i.percent(e,a[0]),2===a.length&&i.alt("positionAlign",a[1],["start",ut,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",ut,"end","left","right"])}}),/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");var r=i.get("line","auto");"auto"===r&&-1===lt.line&&(r=-1),t.line=r,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",ut);var a=i.get("position","auto");"auto"===a&&50===lt.position&&(a="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=a}(e,t)}function dt(e){return e.replace(/<br(?: \/)?>/gi,"\n")}at.prototype={parse:function(e){var t=this;function n(){var e=t.buffer,n=0;for(e=dt(e);n<e.length&&"\r"!==e[n]&&"\n"!==e[n];)++n;var i=e.substr(0,n);return"\r"===e[n]&&++n,"\n"===e[n]&&++n,t.buffer=e.substr(n),i}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var i;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var r=(i=n()).match(/^()?WEBVTT([ \t].*)?$/);if(!r||!r[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:i=n(),t.state){case"HEADER":/:/.test(i)?st(i,(function(e,t){}),/:/):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;if(t.cue=new it(0,0,""),t.state="CUE",-1===i.indexOf("--\x3e")){t.cue.id=i;continue}case"CUE":try{ct(i,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==i.indexOf("--\x3e");if(!i||o&&(a=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=i;continue;case"BADCUE":i||(t.state="ID");continue}}}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},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new Error("Malformed WebVTT signature.")}catch(e){throw e}return e.onflush&&e.onflush(),this}};var ht=at;function ft(e,t,n,i){for(var r,a,o,s,l,u=[],c=window.VTTCue||TextTrackCue,d=0;d<i.rows.length;d++)if(o=!0,s=0,l="",!(r=i.rows[d]).isEmpty()){for(var h=0;h<r.chars.length;h++)r.chars[h].uchar.match(/\s/)&&o?s++:(l+=r.chars[h].uchar,o=!1);r.cueStartTime=t,t===n&&(n+=1e-4),a=new c(t,n,dt(l.trim())),s>=16?s--:s++,navigator.userAgent.match(/Firefox\//)?a.line=d+1:a.line=d>7?d-2:d+1,a.align="left",a.position=Math.max(0,Math.min(100,s/32*100)),u.push(a),e&&e.addCue(a)}return u}var pt,gt={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},vt=function(e){var t=e;return gt.hasOwnProperty(e)&&(t=gt[e]),String.fromCharCode(t)},mt=15,yt=100,At={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},bt={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Et={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Tt={25:2,26:4,29:6,30:8,31:10,27:13,28:15},kt=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];!function(e){e[e.ERROR=0]="ERROR",e[e.TEXT=1]="TEXT",e[e.WARNING=2]="WARNING",e[e.INFO=2]="INFO",e[e.DEBUG=3]="DEBUG",e[e.DATA=3]="DATA"}(pt||(pt={}));var _t=function(){function e(){this.time=null,this.verboseLevel=pt.ERROR}return e.prototype.log=function(e,t){this.verboseLevel>=e&&c.logger.log(this.time+" ["+e+"] "+t)},e}(),St=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].toString(16));return t},Ct=function(){function e(e,t,n,i,r){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=n||!1,this.background=i||"black",this.flash=r||!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"],n=0;n<t.length;n++){var i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}},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}(),Rt=function(){function e(e,t,n,i,r,a){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new Ct(t,n,i,r,a)}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}(),wt=function(){function e(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var t=0;t<yt;t++)this.chars.push(new Rt);this.logger=e,this.pos=0,this.currPenState=new Ct}var t=e.prototype;return t.equals=function(e){for(var t=!0,n=0;n<yt;n++)if(!this.chars[n].equals(e.chars[n])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<yt;t++)this.chars[t].copy(e.chars[t])},t.isEmpty=function(){for(var e=!0,t=0;t<yt;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(pt.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>yt&&(this.logger.log(pt.DEBUG,"Too large cursor position "+this.pos),this.pos=yt)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var n=this.pos+1;n<t+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(t)},t.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},t.insertChar=function(e){e>=144&&this.backSpace();var t=vt(e);this.pos>=yt?this.logger.log(pt.ERROR,"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){var t;for(t=e;t<yt;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,n=0;n<yt;n++){var i=this.chars[n].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e}(),Ot=function(){function e(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var t=0;t<mt;t++)this.rows.push(new wt(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var t=e.prototype;return t.reset=function(){for(var e=0;e<mt;e++)this.rows[e].clear();this.currRow=14},t.equals=function(e){for(var t=!0,n=0;n<mt;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<mt;t++)this.rows[t].copy(e.rows[t])},t.isEmpty=function(){for(var e=!0,t=0;t<mt;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(pt.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},t.setPAC=function(e){this.logger.log(pt.INFO,"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 n=0;n<mt;n++)this.rows[n].clear();var i=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){var a=r.rows[i].cueStartTime,o=this.logger.time;if(a&&null!==o&&a<o)for(var s=0;s<this.nrRollUpRows;s++)this.rows[t-this.nrRollUpRows+s+1].copy(r.rows[i+s])}}this.currRow=t;var l=this.rows[this.currRow];if(null!==e.indent){var u=e.indent,c=Math.max(u-1,0);l.setCursor(e.indent),e.color=l.chars[c].penState.foreground}var d={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(d)},t.setBkgData=function(e){this.logger.log(pt.INFO,"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},t.setRollUpRows=function(e){this.nrRollUpRows=e},t.rollUp=function(){if(null!==this.nrRollUpRows){this.logger.log(pt.TEXT,this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(pt.INFO,"Rolling up")}else this.logger.log(pt.DEBUG,"roll_up but nrRollUpRows not set yet")},t.getDisplayText=function(e){e=e||!1;for(var t=[],n="",i=-1,r=0;r<mt;r++){var a=this.rows[r].getTextString();a&&(i=r+1,e?t.push("Row "+i+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(n=e?"["+t.join(" | ")+"]":t.join("\n")),n},t.getTextAndFormat=function(){return this.rows},e}(),Lt=function(){function e(e,t,n){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 Ot(n),this.nonDisplayedMemory=new Ot(n),this.lastOutputScreen=new Ot(n),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}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(pt.INFO,"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=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(pt.INFO,n+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(pt.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},t.ccRCL=function(){this.logger.log(pt.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},t.ccBS=function(){this.logger.log(pt.INFO,"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(pt.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},t.ccRU=function(e){this.logger.log(pt.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},t.ccFON=function(){this.logger.log(pt.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},t.ccRDC=function(){this.logger.log(pt.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},t.ccTR=function(){this.logger.log(pt.INFO,"TR"),this.setMode("MODE_TEXT")},t.ccRTD=function(){this.logger.log(pt.INFO,"RTD"),this.setMode("MODE_TEXT")},t.ccEDM=function(){this.logger.log(pt.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},t.ccCR=function(){this.logger.log(pt.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},t.ccENM=function(){this.logger.log(pt.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},t.ccEOC=function(){if(this.logger.log(pt.INFO,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(pt.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},t.ccTO=function(e){this.logger.log(pt.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},t.ccMIDROW=function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var n=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][n]}this.logger.log(pt.INFO,"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}();function Dt(e,t,n){n.a=e,n.b=t}function It(e,t,n){return n.a===e&&n.b===t}var Pt=function(){function e(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var i=new _t;this.channels=[null,new Lt(e,t,i),new Lt(e+1,n,i)],this.cmdHistory={a:null,b:null},this.logger=i}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 n,i,r,a=!1;this.logger.time=e;for(var o=0;o<t.length;o+=2)if(i=127&t[o],r=127&t[o+1],0!==i||0!==r){if(this.logger.log(pt.DATA,"["+St([t[o],t[o+1]])+"] -> ("+St([i,r])+")"),(n=this.parseCmd(i,r))||(n=this.parseMidrow(i,r)),n||(n=this.parsePAC(i,r)),n||(n=this.parseBackgroundAttributes(i,r)),!n&&(a=this.parseChars(i,r))){var s=this.currentChannel;s&&s>0?this.channels[s].insertChars(a):this.logger.log(pt.WARNING,"No channel found yet. TEXT-MODE?")}n||a||this.logger.log(pt.WARNING,"Couldn't parse cleaned data "+St([i,r])+" orig: "+St([t[o],t[o+1]]))}},t.parseCmd=function(e,t){var n=this.cmdHistory;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;if(It(e,t,n))return Dt(null,null,n),this.logger.log(pt.DEBUG,"Repeated command ("+St([e,t])+") is dropped"),!0;var i=20===e||21===e||23===e?1:2,r=this.channels[i];return 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),Dt(e,t,n),this.currentChannel=i,!0},t.parseMidrow=function(e,t){var n=0;if((17===e||25===e)&&t>=32&&t<=47){if((n=17===e?1:2)!==this.currentChannel)return this.logger.log(pt.ERROR,"Mismatch channel in midrow parsing"),!1;var i=this.channels[n];return!!i&&(i.ccMIDROW(t),this.logger.log(pt.DEBUG,"MIDROW ("+St([e,t])+")"),!0)}return!1},t.parsePAC=function(e,t){var n,i=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;if(It(e,t,i))return Dt(null,null,i),!0;var r=e<=23?1:2;n=t>=64&&t<=95?1===r?At[e]:Et[e]:1===r?bt[e]:Tt[e];var a=this.channels[r];return!!a&&(a.setPAC(this.interpretPAC(n,t)),Dt(e,t,i),this.currentChannel=r,!0)},t.interpretPAC=function(e,t){var n=t,i={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-64,i.underline=1==(1&n),n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((n-16)/2),i},t.parseChars=function(e,t){var n,i=null,r=null;if(e>=25?(n=2,r=e-8):(n=1,r=e),r>=17&&r<=19){var a=t;a=17===r?t+80:18===r?t+112:t+144,this.logger.log(pt.INFO,"Special char '"+vt(a)+"' in channel "+n),i=[a]}else e>=32&&e<=127&&(i=0===t?[e]:[e,t]);if(i){var o=St(i);this.logger.log(pt.DEBUG,"Char codes = "+o.join(",")),Dt(e,t,this.cmdHistory)}return i},t.parseBackgroundAttributes=function(e,t){var n;if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;var i={};16===e||24===e?(n=Math.floor((t-32)/2),i.background=kt[n],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0));var r=e<=23?1:2;return this.channels[r].setBkgData(i),Dt(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 n=this.channels[t];n&&n.cueSplitAtTime(e)}},e}(),xt=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,n){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)},t.reset=function(){this.cueRanges=[]},e}(),Nt=function(e,t,n){return e.substr(n||0,t.length)===t},Mt=function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return(t>>>0).toString()},Ft={parse:function(e,t,n,i,r,a){var o,s=Object(Me.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),u="00:00.000",c=0,d=0,h=0,f=[],p=!0,g=!1,v=new ht;v.oncue=function(e){var t=n[i],r=n.ccOffset;t&&t.new&&(void 0!==d?r=n.ccOffset=t.start:function(e,t,n){var i=e[t],r=e[i.prevCC];if(!r||!r.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;r&&r.new;)e.ccOffset+=i.start-r.start,i.new=!1,r=e[(i=r).prevCC];e.presentationOffset=n}(n,i,h)),h&&(r=h-n.presentationOffset),g&&(e.startTime+=r-d,e.endTime+=r-d),e.id=Mt(e.startTime.toString())+Mt(e.endTime.toString())+Mt(e.text),e.text=decodeURIComponent(encodeURIComponent(e.text)),e.endTime>0&&f.push(e)},v.onparsingerror=function(e){o=e},v.onflush=function(){o&&a?a(o):r(f)},s.forEach((function(e){if(p){if(Nt(e,"X-TIMESTAMP-MAP=")){p=!1,g=!0,e.substr(16).split(",").forEach((function(e){Nt(e,"LOCAL:")?u=e.substr(6):Nt(e,"MPEGTS:")&&(c=parseInt(e.substr(7)))}));try{t+(9e4*n[i].start||0)<0&&(t+=8589934592),c-=t,d=function(e){var t=parseInt(e.substr(-3)),n=parseInt(e.substr(-6,2)),i=parseInt(e.substr(-9,2)),r=e.length>9?parseInt(e.substr(0,e.indexOf(":"))):0;if(!(Object(l.isFiniteNumber)(t)&&Object(l.isFiniteNumber)(n)&&Object(l.isFiniteNumber)(i)&&Object(l.isFiniteNumber)(r)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*n,(t+=6e4*i)+36e5*r}(u)/1e3,h=c/9e4}catch(e){g=!1,o=e}return}""===e&&(p=!1)}v.parse(e+"\n")})),v.flush()}};function Bt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ut(e,t){return e&&e.label===t.name&&!(e.textTrack1||e.textTrack2)}var Vt=function(e){var t,n;function i(t){var n;if((n=e.call(this,t,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.FRAG_PARSING_USERDATA,u.default.FRAG_DECRYPTED,u.default.MANIFEST_LOADING,u.default.MANIFEST_LOADED,u.default.FRAG_LOADED,u.default.INIT_PTS_FOUND)||this).media=null,n.config=void 0,n.enabled=!0,n.Cues=void 0,n.textTracks=[],n.tracks=[],n.initPTS=[],n.unparsedVttFrags=[],n.captionsTracks={},n.nonNativeCaptionsTracks={},n.captionsProperties=void 0,n.cea608Parser1=void 0,n.cea608Parser2=void 0,n.lastSn=-1,n.prevCC=-1,n.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},n.hls=t,n.config=t.config,n.Cues=t.config.cueHandler,n.captionsProperties={textTrack1:{label:n.config.captionsTextTrack1Label,languageCode:n.config.captionsTextTrack1LanguageCode},textTrack2:{label:n.config.captionsTextTrack2Label,languageCode:n.config.captionsTextTrack2LanguageCode},textTrack3:{label:n.config.captionsTextTrack3Label,languageCode:n.config.captionsTextTrack3LanguageCode},textTrack4:{label:n.config.captionsTextTrack4Label,languageCode:n.config.captionsTextTrack4LanguageCode}},n.config.enableCEA708Captions){var i=new xt(Bt(n),"textTrack1"),r=new xt(Bt(n),"textTrack2"),a=new xt(Bt(n),"textTrack3"),o=new xt(Bt(n),"textTrack4");n.cea608Parser1=new Pt(1,i,r),n.cea608Parser2=new Pt(3,a,o)}return n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.addCues=function(e,t,n,i,r){for(var a,o,s,l,c=!1,d=r.length;d--;){var h=r[d],f=(a=h[0],o=h[1],s=t,l=n,Math.min(o,l)-Math.max(a,s));if(f>=0&&(h[0]=Math.min(h[0],t),h[1]=Math.max(h[1],n),c=!0,f/(n-t)>.5))return}if(c||r.push([t,n]),this.config.renderTextTracksNatively)this.Cues.newCue(this.captionsTracks[e],t,n,i);else{var p=this.Cues.newCue(null,t,n,i);this.hls.trigger(u.default.CUES_PARSED,{type:"captions",cues:p,track:e})}},r.onInitPtsFound=function(e){var t=this,n=e.frag,i=e.id,r=e.initPTS,a=this.unparsedVttFrags;"main"===i&&(this.initPTS[n.cc]=r),a.length&&(this.unparsedVttFrags=[],a.forEach((function(e){t.onFragLoaded(e)})))},r.getExistingTrack=function(e){var t=this.media;if(t)for(var n=0;n<t.textTracks.length;n++){var i=t.textTracks[n];if(i[e])return i}return null},r.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},r.createNativeTrack=function(e){if(!this.captionsTracks[e]){var t=this.captionsProperties,n=this.captionsTracks,i=this.media,r=t[e],a=r.label,o=r.languageCode,s=this.getExistingTrack(e);if(s)n[e]=s,Be(n[e]),Fe(n[e],i);else{var l=this.createTextTrack("captions",a,o);l&&(l[e]=!0,n[e]=l)}}},r.createNonNativeTrack=function(e){if(!this.nonNativeCaptionsTracks[e]){var t=this.captionsProperties[e];if(t){var n={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(u.default.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}}},r.createTextTrack=function(e,t,n){var i=this.media;if(i)return i.addTextTrack(e,t,n)},r.destroy=function(){e.prototype.destroy.call(this)},r.onMediaAttaching=function(e){this.media=e.media,this._cleanTracks()},r.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach((function(t){Be(e[t]),delete e[t]})),this.nonNativeCaptionsTracks={}},r.onManifestLoading=function(){this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={}},r._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var n=0;n<t.length;n++)Be(t[n])}},r.onManifestLoaded=function(e){var t=this;if(this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset()),this.config.enableWebVTT){var n=e.subtitles||[],i=this.tracks&&n&&this.tracks.length===n.length;if(this.tracks=e.subtitles||[],this.config.renderTextTracksNatively){var r=this.media?this.media.textTracks:[];this.tracks.forEach((function(e,n){var i;if(n<r.length){for(var a=null,o=0;o<r.length;o++)if(Ut(r[o],e)){a=r[o];break}a&&(i=a)}i||(i=t.createTextTrack("subtitles",e.name,e.lang)),e.default?i.mode=t.hls.subtitleDisplay?"showing":"hidden":i.mode="disabled",t.textTracks.push(i)}))}else if(!i&&this.tracks&&this.tracks.length){var a=this.tracks.map((function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}}));this.hls.trigger(u.default.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}this.config.enableCEA708Captions&&e.captions&&e.captions.forEach((function(e){var n=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(n){var i="textTrack"+n[1],r=t.captionsProperties[i];r&&(r.label=e.name,e.lang&&(r.languageCode=e.lang),r.media=e)}}))},r.onFragLoaded=function(e){var t=e.frag,n=e.payload,i=this.cea608Parser1,r=this.cea608Parser2,a=this.initPTS,o=this.lastSn,s=this.unparsedVttFrags;if("main"===t.type){var c=t.sn;t.sn!==o+1&&i&&r&&(i.reset(),r.reset()),this.lastSn=c}else if("subtitle"===t.type)if(n.byteLength){if(!Object(l.isFiniteNumber)(a[t.cc]))return s.push(e),void(a.length&&this.hls.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t}));var d=t.decryptdata;null!=d&&null!=d.key&&"AES-128"===d.method||this._parseVTTs(t,n)}else this.hls.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t})},r._parseVTTs=function(e,t){var n=this,i=this.hls,r=this.prevCC,a=this.textTracks,o=this.vttCCs;o[e.cc]||(o[e.cc]={start:e.start,prevCC:r,new:!0},this.prevCC=e.cc),Ft.parse(t,this.initPTS[e.cc],o,e.cc,(function(t){if(n.config.renderTextTracksNatively){var r=a[e.level];if("disabled"===r.mode)return void i.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e});t.forEach((function(e){if(!r.cues.getCueById(e.id))try{if(r.addCue(e),!r.cues.getCueById(e.id))throw new Error("addCue is failed for: "+e)}catch(n){c.logger.debug("Failed occurred on adding cues: "+n);var t=new window.TextTrackCue(e.startTime,e.endTime,e.text);t.id=e.id,r.addCue(t)}}))}else{var o=n.tracks[e.level].default?"default":"subtitles"+e.level;i.trigger(u.default.CUES_PARSED,{type:"subtitles",cues:t,track:o})}i.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(t){c.logger.log("Failed to parse VTT cue: "+t),i.trigger(u.default.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})}))},r.onFragDecrypted=function(e){var t=e.frag,n=e.payload;if("subtitle"===t.type){if(!Object(l.isFiniteNumber)(this.initPTS[t.cc]))return void this.unparsedVttFrags.push(e);this._parseVTTs(t,n)}},r.onFragParsingUserdata=function(e){var t=this.cea608Parser1,n=this.cea608Parser2;if(this.enabled&&t&&n)for(var i=0;i<e.samples.length;i++){var r=e.samples[i].bytes;if(r){var a=this.extractCea608Data(r);t.addData(e.samples[i].pts,a[0]),n.addData(e.samples[i].pts,a[1])}}},r.extractCea608Data=function(e){for(var t=31&e[0],n=2,i=[[],[]],r=0;r<t;r++){var a=e[n++],o=127&e[n++],s=127&e[n++],l=3&a;0===o&&0===s||0!=(4&a)&&(0!==l&&1!==l||(i[l].push(o),i[l].push(s)))}return i},i}(h);function jt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Kt(e){for(var t=[],n=0;n<e.length;n++){var i=e[n];"subtitles"===i.kind&&i.label&&t.push(e[n])}return t}var Gt,Yt=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.MANIFEST_LOADED,u.default.SUBTITLE_TRACK_LOADED)||this).tracks=[],n.trackId=-1,n.media=null,n.stopped=!0,n.subtitleDisplay=!0,n.queuedDefaultTrack=null,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,s=i.prototype;return s.destroy=function(){h.prototype.destroy.call(this)},s.onMediaAttached=function(e){var t=this;this.media=e.media,this.media&&(Object(l.isFiniteNumber)(this.queuedDefaultTrack)&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=null),this.trackChangeListener=this._onTextTracksChanged.bind(this),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.subtitlePollingInterval=setInterval((function(){t.trackChangeListener()}),500):this.media.textTracks.addEventListener("change",this.trackChangeListener))},s.onMediaDetaching=function(){this.media&&(this.useTextTrackPolling?clearInterval(this.subtitlePollingInterval):this.media.textTracks.removeEventListener("change",this.trackChangeListener),Object(l.isFiniteNumber)(this.subtitleTrack)&&(this.queuedDefaultTrack=this.subtitleTrack),Kt(this.media.textTracks).forEach((function(e){Be(e)})),this.subtitleTrack=-1,this.media=null)},s.onManifestLoaded=function(e){var t=this,n=e.subtitles||[];this.tracks=n,this.hls.trigger(u.default.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:n}),n.forEach((function(e){e.default&&(t.media?t.subtitleTrack=e.id:t.queuedDefaultTrack=e.id)}))},s.onSubtitleTrackLoaded=function(e){var t=this,n=e.id,i=e.details,r=this.trackId,a=this.tracks,o=a[r];if(n>=a.length||n!==r||!o||this.stopped)this._clearReloadTimer();else if(c.logger.log("subtitle track "+n+" loaded"),i.live){var s=re(o.details,i,e.stats.trequest);c.logger.log("Reloading live subtitle playlist in "+s+"ms"),this.timer=setTimeout((function(){t._loadCurrentTrack()}),s)}else this._clearReloadTimer()},s.startLoad=function(){this.stopped=!1,this._loadCurrentTrack()},s.stopLoad=function(){this.stopped=!0,this._clearReloadTimer()},s._clearReloadTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},s._loadCurrentTrack=function(){var e=this.trackId,t=this.tracks,n=this.hls,i=t[e];e<0||!i||i.details&&!i.details.live||(c.logger.log("Loading subtitle track "+e),n.trigger(u.default.SUBTITLE_TRACK_LOADING,{url:i.url,id:e}))},s._toggleTrackModes=function(e){var t=this.media,n=this.subtitleDisplay,i=this.trackId;if(t){var r=Kt(t.textTracks);if(-1===e)[].slice.call(r).forEach((function(e){e.mode="disabled"}));else{var a=r[i];a&&(a.mode="disabled")}var o=r[e];o&&(o.mode=n?"showing":"hidden")}},s._setSubtitleTrackInternal=function(e){var t=this.hls,n=this.tracks;!Object(l.isFiniteNumber)(e)||e<-1||e>=n.length||(this.trackId=e,c.logger.log("Switching to subtitle track "+e),t.trigger(u.default.SUBTITLE_TRACK_SWITCH,{id:e}),this._loadCurrentTrack())},s._onTextTracksChanged=function(){if(this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=Kt(this.media.textTracks),n=0;n<t.length;n++)if("hidden"===t[n].mode)e=n;else if("showing"===t[n].mode){e=n;break}this.subtitleTrack=e}},r=i,(a=[{key:"subtitleTracks",get:function(){return this.tracks}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.trackId!==e&&(this._toggleTrackModes(e),this._setSubtitleTrackInternal(e))}}])&&jt(r.prototype,a),o&&jt(r,o),i}(h),Ht=n("./src/crypt/decrypter.js"),$t=window.performance,zt=function(e){var t,n;function i(t,n){var i;return(i=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHING,u.default.ERROR,u.default.KEY_LOADED,u.default.FRAG_LOADED,u.default.SUBTITLE_TRACKS_UPDATED,u.default.SUBTITLE_TRACK_SWITCH,u.default.SUBTITLE_TRACK_LOADED,u.default.SUBTITLE_FRAG_PROCESSED,u.default.LEVEL_UPDATED)||this).fragmentTracker=n,i.config=t.config,i.state=ge,i.tracks=[],i.tracksBuffered=[],i.currentTrackId=-1,i.decrypter=new Ht.default(t,t.config),i.lastAVStart=0,i._onMediaSeeking=i.onMediaSeeking.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i)),i}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r=i.prototype;return r.startLoad=function(){this.stopLoad(),this.state=me;var e=this.tracks[this.currentTrackId];e&&e.details&&(this.setInterval(500),this.tick())},r.onSubtitleFragProcessed=function(e){var t=e.frag,n=e.success;if(this.fragPrevious=t,this.state=me,n){var i=this.tracksBuffered[this.currentTrackId];if(i){for(var r,a=t.start,o=0;o<i.length;o++)if(a>=i[o].start&&a<=i[o].end){r=i[o];break}var s=t.start+t.duration;r?r.end=s:(r={start:a,end:s},i.push(r))}}},r.onMediaAttached=function(e){var t=e.media;this.media=t,t.addEventListener("seeking",this._onMediaSeeking),this.state=me},r.onMediaDetaching=function(){var e=this;this.media&&(this.media.removeEventListener("seeking",this._onMediaSeeking),this.fragmentTracker.removeAllFragments(),this.currentTrackId=-1,this.tracks.forEach((function(t){e.tracksBuffered[t.id]=[]})),this.media=null,this.state=ge)},r.onError=function(e){var t=e.frag;t&&"subtitle"===t.type&&(this.fragCurrent&&this.fragCurrent.loader&&this.fragCurrent.loader.abort(),this.state=me)},r.onSubtitleTracksUpdated=function(e){var t=this;c.logger.log("subtitle tracks updated"),this.tracksBuffered=[],this.tracks=e.subtitleTracks,this.tracks.forEach((function(e){t.tracksBuffered[e.id]=[]}))},r.onSubtitleTrackSwitch=function(e){if(this.currentTrackId=e.id,this.tracks&&this.tracks.length&&-1!==this.currentTrackId){var t=this.tracks[this.currentTrackId];t&&t.details&&this.setInterval(500)}else this.clearInterval()},r.onSubtitleTrackLoaded=function(e){var t=e.id,n=e.details,i=this.currentTrackId,r=this.tracks,a=r[i];t>=r.length||t!==i||!a||(n.live&&function(e,t,n){void 0===n&&(n=0);var i=-1;ie(e,t,(function(e,t,n){t.start=e.start,i=n}));var r=t.fragments;if(i<0)r.forEach((function(e){e.start+=n}));else for(var a=i+1;a<r.length;a++)r[a].start=r[a-1].start+r[a-1].duration}(a.details,n,this.lastAVStart),a.details=n,this.setInterval(500))},r.onKeyLoaded=function(){this.state===Ae&&(this.state=me)},r.onFragLoaded=function(e){var t=this.fragCurrent,n=e.frag.decryptdata,i=e.frag,r=this.hls;if(this.state===be&&t&&"subtitle"===e.frag.type&&t.sn===e.frag.sn&&e.payload.byteLength>0&&n&&n.key&&"AES-128"===n.method){var a=$t.now();this.decrypter.decrypt(e.payload,n.key.buffer,n.iv.buffer,(function(e){var t=$t.now();r.trigger(u.default.FRAG_DECRYPTED,{frag:i,payload:e,stats:{tstart:a,tdecrypt:t}})}))}},r.onLevelUpdated=function(e){var t=e.details.fragments;this.lastAVStart=t.length?t[0].start:0},r.doTick=function(){if(this.media)switch(this.state){case me:var e=this.config,t=this.currentTrackId,n=this.fragmentTracker,i=this.media,r=this.tracks;if(!r||!r[t]||!r[t].details)break;var a,o=e.maxBufferHole,s=e.maxFragLookUpTolerance,l=Math.min(e.maxBufferLength,e.maxMaxBufferLength),d=G.bufferedInfo(this._getBuffered(),i.currentTime,o),h=d.end,f=d.len,p=r[t].details,g=p.fragments,v=g.length,m=g[v-1].start+g[v-1].duration;if(f>l)return;var y=this.fragPrevious;h<m?(y&&p.hasProgramDateTime&&(a=le(g,y.endProgramDateTime,s)),a||(a=ue(y,g,h,s))):a=g[v-1],a&&a.encrypted?(c.logger.log("Loading key for "+a.sn),this.state=Ae,this.hls.trigger(u.default.KEY_LOADING,{frag:a})):a&&n.getState(a)===F&&(this.fragCurrent=a,this.state=be,this.hls.trigger(u.default.FRAG_LOADING,{frag:a}))}else this.state=me},r.stopLoad=function(){this.lastAVStart=0,this.fragPrevious=null,e.prototype.stopLoad.call(this)},r._getBuffered=function(){return this.tracksBuffered[this.currentTrackId]||[]},r.onMediaSeeking=function(){if(this.fragCurrent){var e=this.media?this.media.currentTime:0,t=this.config.maxFragLookUpTolerance,n=this.fragCurrent.start-t,i=this.fragCurrent.start+this.fragCurrent.duration+t;(e<n||e>i)&&(this.fragCurrent.loader&&this.fragCurrent.loader.abort(),this.fragmentTracker.removeFragment(this.fragCurrent),this.fragCurrent=null,this.fragPrevious=null,this.state=me,this.tick())}},i}(Le);!function(e){e.WIDEVINE="com.widevine.alpha",e.PLAYREADY="com.microsoft.playready"}(Gt||(Gt={}));var Wt="undefined"!=typeof window&&window.navigator&&window.navigator.requestMediaKeySystemAccess?window.navigator.requestMediaKeySystemAccess.bind(window.navigator):null;function qt(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var Xt=function(e){var t,n;function i(t){var n;return(n=e.call(this,t,u.default.MEDIA_ATTACHED,u.default.MEDIA_DETACHED,u.default.MANIFEST_PARSED)||this)._widevineLicenseUrl=void 0,n._licenseXhrSetup=void 0,n._emeEnabled=void 0,n._requestMediaKeySystemAccess=void 0,n._drmSystemOptions=void 0,n._config=void 0,n._mediaKeysList=[],n._media=null,n._hasSetMediaKeys=!1,n._requestLicenseFailureCount=0,n.mediaKeysPromise=null,n._onMediaEncrypted=function(e){if(c.logger.log('Media is encrypted using "'+e.initDataType+'" init data type'),!n.mediaKeysPromise)return c.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),void n.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});var t=function(t){n._media&&(n._attemptSetMediaKeys(t),n._generateRequestWithPreferredKeySession(e.initDataType,e.initData))};n.mediaKeysPromise.then(t).catch(t)},n._config=t.config,n._widevineLicenseUrl=n._config.widevineLicenseUrl,n._licenseXhrSetup=n._config.licenseXhrSetup,n._emeEnabled=n._config.emeEnabled,n._requestMediaKeySystemAccess=n._config.requestMediaKeySystemAccessFunc,n._drmSystemOptions=t.config.drmSystemOptions,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var r,a,o,l=i.prototype;return l.getLicenseServerUrl=function(e){switch(e){case Gt.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+e+'"')},l._attemptKeySystemAccess=function(e,t,n){var i=this,r=function(e,t,n,i){switch(e){case Gt.WIDEVINE:return function(e,t,n){var i={audioCapabilities:[],videoCapabilities:[]};return e.forEach((function(e){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+e+'"',robustness:n.audioRobustness||""})})),t.forEach((function(e){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+e+'"',robustness:n.videoRobustness||""})})),[i]}(t,n,i);default:throw new Error("Unknown key-system: "+e)}}(e,t,n,this._drmSystemOptions);c.logger.log("Requesting encrypted media key-system access");var a=this.requestMediaKeySystemAccess(e,r);this.mediaKeysPromise=a.then((function(t){return i._onMediaKeySystemAccessObtained(e,t)})),a.catch((function(t){c.logger.error('Failed to obtain key-system "'+e+'" access:',t)}))},l._onMediaKeySystemAccessObtained=function(e,t){var n=this;c.logger.log('Access for key-system "'+e+'" obtained');var i={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e};this._mediaKeysList.push(i);var r=Promise.resolve().then((function(){return t.createMediaKeys()})).then((function(t){return i.mediaKeys=t,c.logger.log('Media-keys created for key-system "'+e+'"'),n._onMediaKeysCreated(),t}));return r.catch((function(e){c.logger.error("Failed to create media-keys:",e)})),r},l._onMediaKeysCreated=function(){var e=this;this._mediaKeysList.forEach((function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),e._onNewMediaKeySession(t.mediaKeysSession))}))},l._onNewMediaKeySession=function(e){var t=this;c.logger.log("New key-system session "+e.sessionId),e.addEventListener("message",(function(n){t._onKeySessionMessage(e,n.message)}),!1)},l._onKeySessionMessage=function(e,t){c.logger.log("Got EME message event, creating license request"),this._requestLicense(t,(function(t){c.logger.log("Received license data (length: "+(t?t.byteLength:t)+"), updating key-session"),e.update(t)}))},l._attemptSetMediaKeys=function(e){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var t=this._mediaKeysList[0];if(!t||!t.mediaKeys)return c.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});c.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},l._generateRequestWithPreferredKeySession=function(e,t){var n=this,i=this._mediaKeysList[0];if(!i)return c.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(i.mediaKeysSessionInitialized)c.logger.warn("Key-Session already initialized but requested again");else{var r=i.mediaKeysSession;if(!r)return c.logger.error("Fatal: Media is encrypted but no key-session existing"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});if(!t)return c.logger.warn("Fatal: initData required for generating a key session is null"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});c.logger.log('Generating key-session request for "'+e+'" init data type'),i.mediaKeysSessionInitialized=!0,r.generateRequest(e,t).then((function(){c.logger.debug("Key-session generation succeeded")})).catch((function(e){c.logger.error("Error generating key-session request:",e),n.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))}},l._createLicenseXhr=function(e,t,n){var i=new XMLHttpRequest,r=this._licenseXhrSetup;try{if(r)try{r(i,e)}catch(t){i.open("POST",e,!0),r(i,e)}i.readyState||i.open("POST",e,!0)}catch(e){throw new Error("issue setting up KeySystem license XHR "+e)}return i.responseType="arraybuffer",i.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,i,e,t,n),i},l._onLicenseRequestReadyStageChange=function(e,t,n,i){switch(e.readyState){case 4:if(200===e.status)this._requestLicenseFailureCount=0,c.logger.log("License request succeeded"),"arraybuffer"!==e.responseType&&c.logger.warn("xhr response type was not set to the expected arraybuffer for license request"),i(e.response);else{if(c.logger.error("License Request XHR failed ("+t+"). Status: "+e.status+" ("+e.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>3)return void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var r=3-this._requestLicenseFailureCount+1;c.logger.warn("Retrying license request, "+r+" attempts left"),this._requestLicense(n,i)}}},l._generateLicenseRequestChallenge=function(e,t){switch(e.mediaKeySystemDomain){case Gt.WIDEVINE:return t}throw new Error("unsupported key-system: "+e.mediaKeySystemDomain)},l._requestLicense=function(e,t){c.logger.log("Requesting content license for key-system");var n=this._mediaKeysList[0];if(!n)return c.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var i=this.getLicenseServerUrl(n.mediaKeySystemDomain),r=this._createLicenseXhr(i,e,t);c.logger.log("Sending license request to URL: "+i);var a=this._generateLicenseRequestChallenge(n,e);r.send(a)}catch(e){c.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(u.default.ERROR,{type:s.ErrorTypes.KEY_SYSTEM_ERROR,details:s.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},l.onMediaAttached=function(e){if(this._emeEnabled){var t=e.media;this._media=t,t.addEventListener("encrypted",this._onMediaEncrypted)}},l.onMediaDetached=function(){var e=this._media,t=this._mediaKeysList;e&&(e.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(t.map((function(e){if(e.mediaKeysSession)return e.mediaKeysSession.close().catch((function(){}))}))).then((function(){return e.setMediaKeys(null)})).catch((function(){})))},l.onManifestParsed=function(e){if(this._emeEnabled){var t=e.levels.map((function(e){return e.audioCodec})),n=e.levels.map((function(e){return e.videoCodec}));this._attemptKeySystemAccess(Gt.WIDEVINE,t,n)}},r=i,(a=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&qt(r.prototype,a),o&&qt(r,o),i}(h);function Zt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Qt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zt(Object(n),!0).forEach((function(t){Jt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Jt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var en=Qt(Qt({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,lowBufferWatchdogPeriod:.5,highBufferWatchdogPeriod:3,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,liveDurationInfinity:!1,liveBackBufferLength:1/0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Ze,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,abrController:Ye,bufferController:$e,capLevelController:We,fpsController:Xe,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:Wt,testBandwidth:!0},{cueHandler:i,enableCEA708Captions:!0,enableWebVTT:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:zt,subtitleTrackController:Yt,timelineController:Vt,audioStreamController:nt,audioTrackController:Je,emeController:Xt});function tn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function nn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tn(Object(n),!0).forEach((function(t){rn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function an(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function on(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function sn(e,t,n){return t&&on(e.prototype,t),n&&on(e,n),e}var ln=function(e){var t,n;function i(t){var n;void 0===t&&(t={}),(n=e.call(this)||this).config=void 0,n._autoLevelCapping=void 0,n.abrController=void 0,n.capLevelController=void 0,n.levelController=void 0,n.streamController=void 0,n.networkControllers=void 0,n.audioTrackController=void 0,n.subtitleTrackController=void 0,n.emeController=void 0,n.coreComponents=void 0,n.media=null,n.url=null;var r=i.DefaultConfig;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");n.config=nn(nn({},r),t);var a=an(n).config;if(void 0!==a.liveMaxLatencyDurationCount&&a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==a.liveMaxLatencyDuration&&(void 0===a.liveSyncDuration||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');Object(c.enableLogs)(a.debug),n._autoLevelCapping=-1;var o=n.abrController=new a.abrController(an(n)),s=new a.bufferController(an(n)),l=n.capLevelController=new a.capLevelController(an(n)),u=new a.fpsController(an(n)),d=new x(an(n)),h=new N(an(n)),f=new M(an(n)),p=new Ue(an(n)),g=n.levelController=new Ne(an(n)),v=new j(an(n)),m=[g,n.streamController=new Pe(an(n),v)],y=a.audioStreamController;y&&m.push(new y(an(n),v)),n.networkControllers=m;var A=[d,h,f,o,s,l,u,p,v];if(y=a.audioTrackController){var b=new y(an(n));n.audioTrackController=b,A.push(b)}if(y=a.subtitleTrackController){var E=new y(an(n));n.subtitleTrackController=E,m.push(E)}if(y=a.emeController){var T=new y(an(n));n.emeController=T,A.push(T)}return(y=a.subtitleStreamController)&&m.push(new y(an(n),v)),(y=a.timelineController)&&A.push(new y(an(n))),n.coreComponents=A,n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i.isSupported=function(){return function(){var e=z();if(!e)return!1;var t=self.SourceBuffer||self.WebKitSourceBuffer,n=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),i=!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove;return!!n&&!!i}()},sn(i,null,[{key:"version",get:function(){return"0.14.17"}},{key:"Events",get:function(){return u.default}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return i.defaultConfig?i.defaultConfig:en},set:function(e){i.defaultConfig=e}}]);var r=i.prototype;return r.destroy=function(){c.logger.log("destroy"),this.trigger(u.default.DESTROYING),this.detachMedia(),this.coreComponents.concat(this.networkControllers).forEach((function(e){e.destroy()})),this.url=null,this.removeAllListeners(),this._autoLevelCapping=-1},r.attachMedia=function(e){c.logger.log("attachMedia"),this.media=e,this.trigger(u.default.MEDIA_ATTACHING,{media:e})},r.detachMedia=function(){c.logger.log("detachMedia"),this.trigger(u.default.MEDIA_DETACHING),this.media=null},r.loadSource=function(e){e=o.buildAbsoluteURL(window.location.href,e,{alwaysNormalize:!0}),c.logger.log("loadSource:"+e),this.url=e,this.trigger(u.default.MANIFEST_LOADING,{url:e})},r.startLoad=function(e){void 0===e&&(e=-1),c.logger.log("startLoad("+e+")"),this.networkControllers.forEach((function(t){t.startLoad(e)}))},r.stopLoad=function(){c.logger.log("stopLoad"),this.networkControllers.forEach((function(e){e.stopLoad()}))},r.swapAudioCodec=function(){c.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},r.recoverMediaError=function(){c.logger.log("recoverMediaError");var e=this.media;this.detachMedia(),e&&this.attachMedia(e)},r.removeLevel=function(e,t){void 0===t&&(t=0),this.levelController.removeLevel(e,t)},sn(i,[{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){c.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){c.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){c.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){c.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){c.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){c.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e}},{key:"bandwidthEstimate",get:function(){var e=this.abrController._bwEstimator;return e?e.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){for(var e=this.levels,t=this.config.minAutoBitrate,n=e?e.length:0,i=0;i<n;i++)if((e[i].realBitrate?Math.max(e[i].realBitrate,e[i].bitrate):e[i].bitrate)>t)return i;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{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:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}},{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:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}}]),i}(q);ln.defaultConfig=void 0},"./src/polyfills/number.js":
/*!*********************************!*\
!*** ./src/polyfills/number.js ***!
\*********************************/
/*! exports provided: isFiniteNumber, MAX_SAFE_INTEGER */function(e,t,n){n.r(t),n.d(t,"isFiniteNumber",(function(){return i})),n.d(t,"MAX_SAFE_INTEGER",(function(){return r}));var i=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},r=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/utils/get-self-scope.js":
/*!*************************************!*\
!*** ./src/utils/get-self-scope.js ***!
\*************************************/
/*! exports provided: getSelfScope */function(e,t,n){function i(){return"undefined"==typeof window?self:window}n.r(t),n.d(t,"getSelfScope",(function(){return i}))},"./src/utils/logger.js":
/*!*****************************!*\
!*** ./src/utils/logger.js ***!
\*****************************/
/*! exports provided: enableLogs, logger */function(e,t,n){n.r(t),n.d(t,"enableLogs",(function(){return c})),n.d(t,"logger",(function(){return d}));var i=n(/*! ./get-self-scope */"./src/utils/get-self-scope.js");function r(){}var a={trace:r,debug:r,log:r,warn:r,info:r,error:r},o=a;function s(e,t){return t="["+e+"] > "+t}var l=Object(i.getSelfScope)();function u(e){var t=l.console[e];return t?function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];i[0]&&(i[0]=s(e,i[0])),t.apply(l.console,i)}:r}var c=function(e){if(l.console&&!0===e||"object"==typeof e){!function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];n.forEach((function(t){o[t]=e[t]?e[t].bind(e):u(t)}))}(e,"debug","log","info","warn","error");try{o.log()}catch(e){o=a}}else o=a},d=o}}).default},un.exports=cn());var hn=ln(dn.exports),fn=Q.now,pn=Q.assign,gn=Q.listContainsIgnoreCase;ue.register("PLAYBACK_FRAGMENT_CHANGED"),ue.register("PLAYBACK_FRAGMENT_PARSING_METADATA");var vn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tn(e,t)}(a,e);var t,n,i,r=rn(a);function a(){var e;Zt(this,a);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=r.call.apply(r,[this].concat(n))).options.playback=Xt(Xt({},e.options),e.options.playback),e.options.hlsPlayback=Xt(Xt({},e.defaultOptions),e.options.hlsPlayback),e._minDvrSize=void 0===e.options.hlsMinimumDvrSize?60:e.options.hlsMinimumDvrSize,e._extrapolatedWindowNumSegments=e.options.playback&&void 0!==e.options.playback.extrapolatedWindowNumSegments?e.options.playback.extrapolatedWindowNumSegments:2,e._playbackType=we.VOD,e._lastTimeUpdate={current:0,total:0},e._lastDuration=null,e._playableRegionStartTime=0,e._localStartTimeCorrelation=null,e._localEndTimeCorrelation=null,e._playableRegionDuration=0,e._programDateTime=0,e._durationExcludesAfterLiveSyncPoint=!1,e._segmentTargetDuration=null,e._playlistType=null,e._recoverAttemptsRemaining=e.options.hlsRecoverAttempts||16,e}return t=a,i=[{key:"HLSJS",get:function(){return hn}}],(n=[{key:"name",get:function(){return"hls"}},{key:"supportedVersion",get:function(){return{min:"0.4.18"}}},{key:"levels",get:function(){return this._levels||[]}},{key:"currentLevel",get:function(){return null===this._currentLevel||void 0===this._currentLevel?-1:this._currentLevel},set:function(e){this._currentLevel=e,this.trigger(ue.PLAYBACK_LEVEL_SWITCH_START),this.options.playback.hlsUseNextLevel?this._hls.nextLevel=this._currentLevel:this._hls.currentLevel=this._currentLevel}},{key:"isReady",get:function(){return this._isReadyState}},{key:"_startTime",get:function(){return this._playbackType===we.LIVE&&"EVENT"!==this._playlistType?this._extrapolatedStartTime:this._playableRegionStartTime}},{key:"_now",get:function(){return fn()}},{key:"_extrapolatedStartTime",get:function(){if(!this._localStartTimeCorrelation)return this._playableRegionStartTime;var e=this._localStartTimeCorrelation,t=this._now-e.local,n=(e.remote+t)/1e3;return Math.min(n,this._playableRegionStartTime+this._extrapolatedWindowDuration)}},{key:"_extrapolatedEndTime",get:function(){var e=this._playableRegionStartTime+this._playableRegionDuration;if(!this._localEndTimeCorrelation)return e;var t=this._localEndTimeCorrelation,n=this._now-t.local,i=(t.remote+n)/1e3;return Math.max(e-this._extrapolatedWindowDuration,Math.min(i,e))}},{key:"_duration",get:function(){return this._extrapolatedEndTime-this._startTime}},{key:"_extrapolatedWindowDuration",get:function(){return null===this._segmentTargetDuration?0:this._extrapolatedWindowNumSegments*this._segmentTargetDuration}},{key:"bandwidthEstimate",get:function(){return this._hls&&this._hls.bandwidthEstimate}},{key:"defaultOptions",get:function(){return{preload:!0}}},{key:"customListeners",get:function(){return this.options.hlsPlayback&&this.options.hlsPlayback.customListeners||[]}},{key:"_setup",value:function(){var e=this;this._manifestParsed=!1,this._ccIsSetup=!1,this._ccTracksUpdated=!1,this._hls&&this._hls.destroy(),this._hls=new hn(pn({},this.options.playback.hlsjsConfig)),this._hls.once(hn.Events.MEDIA_ATTACHED,(function(){e.options.hlsPlayback.preload&&e._hls.loadSource(e.options.src)})),this._hls.on(hn.Events.MANIFEST_PARSED,(function(){return e._manifestParsed=!0})),this._hls.on(hn.Events.LEVEL_LOADED,(function(t,n){return e._updatePlaybackType(t,n)})),this._hls.on(hn.Events.LEVEL_UPDATED,(function(t,n){return e._onLevelUpdated(t,n)})),this._hls.on(hn.Events.LEVEL_SWITCHING,(function(t,n){return e._onLevelSwitch(t,n)})),this._hls.on(hn.Events.FRAG_CHANGED,(function(t,n){return e._onFragmentChanged(t,n)})),this._hls.on(hn.Events.FRAG_LOADED,(function(t,n){return e._onFragmentLoaded(t,n)})),this._hls.on(hn.Events.FRAG_PARSING_METADATA,(function(t,n){return e._onFragmentParsingMetadata(t,n)})),this._hls.on(hn.Events.ERROR,(function(t,n){return e._onHLSJSError(t,n)})),this._hls.on(hn.Events.SUBTITLE_TRACK_LOADED,(function(t,n){return e._onSubtitleLoaded(t,n)})),this._hls.on(hn.Events.SUBTITLE_TRACKS_UPDATED,(function(){return e._ccTracksUpdated=!0})),this.bindCustomListeners(),this._hls.attachMedia(this.el)}},{key:"bindCustomListeners",value:function(){var e=this;this.customListeners.forEach((function(t){var n=t.eventName,i=t.once?"once":"on";n&&e._hls["".concat(i)](n,t.callback)}))}},{key:"unbindCustomListeners",value:function(){var e=this;this.customListeners.forEach((function(t){var n=t.eventName;n&&e._hls.off(n,t.callback)}))}},{key:"_onFragmentParsingMetadata",value:function(e,t){this.trigger(ue.Custom.PLAYBACK_FRAGMENT_PARSING_METADATA,{evt:e,data:t})}},{key:"render",value:function(){return this._ready(),an(en(a.prototype),"render",this).call(this)}},{key:"_ready",value:function(){this._isReadyState||(!this._hls&&this._setup(),this._isReadyState=!0,this.trigger(ue.PLAYBACK_READY,this.name))}},{key:"_recover",value:function(e,t,n){if(this._recoveredDecodingError)if(this._recoveredAudioCodecError){re.error("hlsjs: failed to recover",{evt:e,data:t}),n.level=_e.Levels.FATAL;var i=this.createError(n);this.trigger(ue.PLAYBACK_ERROR,i),this.stop()}else this._recoveredAudioCodecError=!0,this._hls.swapAudioCodec(),this._hls.recoverMediaError();else this._recoveredDecodingError=!0,this._hls.recoverMediaError()}},{key:"_setupSrc",value:function(e){}},{key:"_startTimeUpdateTimer",value:function(){var e=this;this._timeUpdateTimer||(this._timeUpdateTimer=setInterval((function(){e._onDurationChange(),e._onTimeUpdate()}),100))}},{key:"_stopTimeUpdateTimer",value:function(){this._timeUpdateTimer&&(clearInterval(this._timeUpdateTimer),this._timeUpdateTimer=null)}},{key:"getProgramDateTime",value:function(){return this._programDateTime}},{key:"getDuration",value:function(){return this._duration}},{key:"getCurrentTime",value:function(){return Math.max(0,this.el.currentTime-this._startTime)}},{key:"getStartTimeOffset",value:function(){return this._startTime}},{key:"seekPercentage",value:function(e){var t=this._duration;e>0&&(t=this._duration*(e/100)),this.seek(t)}},{key:"seek",value:function(e){e<0&&(re.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),e=this.getDuration()),this.dvrEnabled&&this._updateDvr(e<this.getDuration()-3),e+=this._startTime,this.el.currentTime=e}},{key:"seekToLivePoint",value:function(){this.seek(this.getDuration())}},{key:"_updateDvr",value:function(e){this.trigger(ue.PLAYBACK_DVR,e),this.trigger(ue.PLAYBACK_STATS_ADD,{dvr:e})}},{key:"_updateSettings",value:function(){this._playbackType===we.VOD?this.settings.left=["playpause","position","duration"]:this.dvrEnabled?this.settings.left=["playpause"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(ue.PLAYBACK_SETTINGSUPDATE)}},{key:"_onHLSJSError",value:function(e,t){var n,i={code:"".concat(t.type,"_").concat(t.details),description:"".concat(this.name," error: type: ").concat(t.type,", details: ").concat(t.details),raw:t};if(t.response&&(i.description+=", response: ".concat(JSON.stringify(t.response))),t.fatal)if(this._recoverAttemptsRemaining>0)switch(this._recoverAttemptsRemaining-=1,t.type){case hn.ErrorTypes.NETWORK_ERROR:switch(t.details){case hn.ErrorDetails.MANIFEST_LOAD_ERROR:case hn.ErrorDetails.MANIFEST_LOAD_TIMEOUT:case hn.ErrorDetails.MANIFEST_PARSING_ERROR:case hn.ErrorDetails.LEVEL_LOAD_ERROR:case hn.ErrorDetails.LEVEL_LOAD_TIMEOUT:re.error("hlsjs: unrecoverable network fatal error.",{evt:e,data:t}),n=this.createError(i),this.trigger(ue.PLAYBACK_ERROR,n),this.stop();break;default:re.warn("hlsjs: trying to recover from network error.",{evt:e,data:t}),i.level=_e.Levels.WARN,this._hls.startLoad()}break;case hn.ErrorTypes.MEDIA_ERROR:re.warn("hlsjs: trying to recover from media error.",{evt:e,data:t}),i.level=_e.Levels.WARN,this._recover(e,t,i);break;default:re.error("hlsjs: could not recover from error.",{evt:e,data:t}),n=this.createError(i),this.trigger(ue.PLAYBACK_ERROR,n),this.stop()}else re.error("hlsjs: could not recover from error after maximum number of attempts.",{evt:e,data:t}),n=this.createError(i),this.trigger(ue.PLAYBACK_ERROR,n),this.stop();else{if(this.options.playback.triggerFatalErrorOnResourceDenied&&this._keyIsDenied(t))return re.error("hlsjs: could not load decrypt key.",{evt:e,data:t}),n=this.createError(i),this.trigger(ue.PLAYBACK_ERROR,n),void this.stop();i.level=_e.Levels.WARN,re.warn("hlsjs: non-fatal error occurred",{evt:e,data:t})}}},{key:"_keyIsDenied",value:function(e){return e.type===hn.ErrorTypes.NETWORK_ERROR&&e.details===hn.ErrorDetails.KEY_LOAD_ERROR&&e.response&&e.response.code>=400}},{key:"_onTimeUpdate",value:function(){var e={current:this.getCurrentTime(),total:this.getDuration(),firstFragDateTime:this.getProgramDateTime()};this._lastTimeUpdate&&e.current===this._lastTimeUpdate.current&&e.total===this._lastTimeUpdate.total||(this._lastTimeUpdate=e,this.trigger(ue.PLAYBACK_TIMEUPDATE,e,this.name))}},{key:"_onDurationChange",value:function(){var e=this.getDuration();this._lastDuration!==e&&(this._lastDuration=e,an(en(a.prototype),"_onDurationChange",this).call(this))}},{key:"_onProgress",value:function(){if(this.el.buffered.length){for(var e=[],t=0,n=0;n<this.el.buffered.length;n++)e=[].concat(on(e),[{start:Math.max(0,this.el.buffered.start(n)-this._playableRegionStartTime),end:Math.max(0,this.el.buffered.end(n)-this._playableRegionStartTime)}]),this.el.currentTime>=e[n].start&&this.el.currentTime<=e[n].end&&(t=n);var i={start:e[t].start,current:e[t].end,total:this.getDuration()};this.trigger(ue.PLAYBACK_PROGRESS,i,e)}}},{key:"play",value:function(){!this._hls&&this._setup(),!this._manifestParsed&&!this.options.hlsPlayback.preload&&this._hls.loadSource(this.options.src),an(en(a.prototype),"play",this).call(this),this._startTimeUpdateTimer()}},{key:"pause",value:function(){this._hls&&(this.el.pause(),this.dvrEnabled&&this._updateDvr(!0))}},{key:"stop",value:function(){this._stopTimeUpdateTimer(),this._hls&&(an(en(a.prototype),"stop",this).call(this),this._hls.destroy(),delete this._hls)}},{key:"destroy",value:function(){this._stopTimeUpdateTimer(),this._hls&&(this._hls.destroy(),delete this._hls),an(en(a.prototype),"destroy",this).call(this)}},{key:"_updatePlaybackType",value:function(e,t){this._playbackType=t.details.live?we.LIVE:we.VOD,this._onLevelUpdated(e,t),this._ccTracksUpdated&&this._playbackType===we.LIVE&&this.hasClosedCaptionsTracks&&this._onSubtitleLoaded()}},{key:"_fillLevels",value:function(){this._levels=this._hls.levels.map((function(e,t){return{id:t,level:e,label:"".concat(e.bitrate/1e3,"Kbps")}})),this.trigger(ue.PLAYBACK_LEVELS_AVAILABLE,this._levels)}},{key:"_onLevelUpdated",value:function(e,t){this._segmentTargetDuration=t.details.targetduration,this._playlistType=t.details.type||null;var n=!1,i=!1,r=t.details.fragments,a=this._playableRegionStartTime,o=this._playableRegionDuration;if(0!==r.length){if(r[0].rawProgramDateTime&&(this._programDateTime=r[0].rawProgramDateTime),this._playableRegionStartTime!==r[0].start&&(n=!0,this._playableRegionStartTime=r[0].start),n)if(this._localStartTimeCorrelation){var s=this._localStartTimeCorrelation,l=this._now-s.local,u=(s.remote+l)/1e3;u<r[0].start?this._localStartTimeCorrelation={local:this._now,remote:1e3*r[0].start}:u>a+this._extrapolatedWindowDuration&&(this._localStartTimeCorrelation={local:this._now,remote:1e3*Math.max(r[0].start,a+this._extrapolatedWindowDuration)})}else this._localStartTimeCorrelation={local:this._now,remote:1e3*(r[0].start+this._extrapolatedWindowDuration/2)};var c=t.details.totalduration;if(this._playbackType===we.LIVE){var d=t.details.targetduration*((this.options.playback.hlsjsConfig||{}).liveSyncDurationCount||hn.DefaultConfig.liveSyncDurationCount);d<=c?(c-=d,this._durationExcludesAfterLiveSyncPoint=!0):this._durationExcludesAfterLiveSyncPoint=!1}c!==this._playableRegionDuration&&(i=!0,this._playableRegionDuration=c);var h=r[0].start+c,f=a+o;if(h!==f)if(this._localEndTimeCorrelation){var p=this._localEndTimeCorrelation,g=this._now-p.local,v=(p.remote+g)/1e3;v>h?this._localEndTimeCorrelation={local:this._now,remote:1e3*h}:v<h-this._extrapolatedWindowDuration?this._localEndTimeCorrelation={local:this._now,remote:1e3*(h-this._extrapolatedWindowDuration)}:v>f&&(this._localEndTimeCorrelation={local:this._now,remote:1e3*f})}else this._localEndTimeCorrelation={local:this._now,remote:1e3*h};i&&this._onDurationChange(),n&&this._onProgress()}}},{key:"_onFragmentChanged",value:function(e,t){this.trigger(ue.Custom.PLAYBACK_FRAGMENT_CHANGED,t)}},{key:"_onFragmentLoaded",value:function(e,t){this.trigger(ue.PLAYBACK_FRAGMENT_LOADED,t)}},{key:"_onSubtitleLoaded",value:function(){if(!this._ccIsSetup){this.trigger(ue.PLAYBACK_SUBTITLE_AVAILABLE);var e=this._playbackType===we.LIVE?-1:this.closedCaptionsTrackId;this.closedCaptionsTrackId=e,this._ccIsSetup=!0}}},{key:"_onLevelSwitch",value:function(e,t){this.levels.length||this._fillLevels(),this.trigger(ue.PLAYBACK_LEVEL_SWITCH_END),this.trigger(ue.PLAYBACK_LEVEL_SWITCH,t);var n=this._hls.levels[t.level];n&&(this.highDefinition=n.height>=720||n.bitrate/1e3>=2e3,this.trigger(ue.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(ue.PLAYBACK_BITRATE,{height:n.height,width:n.width,bandwidth:n.bitrate,bitrate:n.bitrate,level:t.level}))}},{key:"dvrEnabled",get:function(){return this._durationExcludesAfterLiveSyncPoint&&this._duration>=this._minDvrSize&&this.getPlaybackType()===we.LIVE}},{key:"getPlaybackType",value:function(){return this._playbackType}},{key:"isSeekEnabled",value:function(){return this._playbackType===we.VOD||this.dvrEnabled}}])&&Qt(t.prototype,n),i&&Qt(t,i),a}(ze);return vn.canPlay=function(e,t){var n=e.split("?")[0].match(/.*\.(.*)$/)||[],i=n.length>1&&"m3u8"===n[1].toLowerCase()||gn(t,["application/vnd.apple.mpegurl","application/x-mpegURL"]);return!(!hn.isSupported()||!i)},Wt.Loader.registerPlayback(vn),t(t({},Wt),{},{HLS:vn})}();
//# sourceMappingURL=clappr.min.js.map