qplayer-web-player.js 524 KB

1
  1. !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.QPlayer=t()}(this,function(){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function t(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return(a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function u(a,o,s,l){return new(s||(s=Promise))(function(e,t){function r(e){try{i(l.next(e))}catch(e){t(e)}}function n(e){try{i(l.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(r,n)}i((l=l.apply(a,o||[])).next())})}function f(r,n){var i,a,o,e,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,a&&(o=2&t[0]?a.return:t[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,t[1])).done)return o;switch(a=0,o&&(t=[2&t[0],o.value]),t[0]){case 0:case 1:o=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,a=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(o=0<(o=s.trys).length&&o[o.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]<o[3])){s.label=t[1];break}if(6===t[0]&&s.label<o[1]){s.label=o[1],o=t;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(t);break}o[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(r,s)}catch(e){t=[6,e],a=0}finally{i=o=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}var r={}.toString,d=function(e){return r.call(e).slice(8,-1)},i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e,t){return e(t={exports:{}},t.exports),t.exports}var g=o(function(e){var t=e.exports={version:"2.6.3"};"number"==typeof __e&&(__e=t)}),m=(g.version,o(function(e){var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)})),s=o(function(e){var t="__core-js_shared__",r=m[t]||(m[t]={});(e.exports=function(e,t){return r[e]||(r[e]=void 0!==t?t:{})})("versions",[]).push({version:g.version,mode:"global",copyright:"漏 2019 Denis Pushkarev (zloirock.ru)"})}),l=0,h=Math.random(),p=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++l+h).toString(36))},y=o(function(e){var t=s("wks"),r=m.Symbol,n="function"==typeof r;(e.exports=function(e){return t[e]||(t[e]=n&&r[e]||(n?r:p)("Symbol."+e))}).store=t}),v=y("toStringTag"),_="Arguments"==d(function(){return arguments}()),b=function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),v))?r:_?d(t):"Object"==(n=d(t))&&"function"==typeof t.callee?"Arguments":n},S=function(e){return"object"==typeof e?null!==e:"function"==typeof e},T=function(e){if(!S(e))throw TypeError(e+" is not an object!");return e},E=function(e){try{return!!e()}catch(e){return!0}},w=!E(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),A=m.document,x=S(A)&&S(A.createElement),L=function(e){return x?A.createElement(e):{}},R=!w&&!E(function(){return 7!=Object.defineProperty(L("div"),"a",{get:function(){return 7}}).a}),I=function(e,t){if(!S(e))return e;var r,n;if(t&&"function"==typeof(r=e.toString)&&!S(n=r.call(e)))return n;if("function"==typeof(r=e.valueOf)&&!S(n=r.call(e)))return n;if(!t&&"function"==typeof(r=e.toString)&&!S(n=r.call(e)))return n;throw TypeError("Can't convert object to primitive value")},C=Object.defineProperty,D={f:w?Object.defineProperty:function(e,t,r){if(T(e),t=I(t,!0),T(r),R)try{return C(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},P=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},U=w?function(e,t,r){return D.f(e,t,P(1,r))}:function(e,t,r){return e[t]=r,e},k={}.hasOwnProperty,O=function(e,t){return k.call(e,t)},M=o(function(e){var a=p("src"),t="toString",r=Function[t],o=(""+r).split(t);g.inspectSource=function(e){return r.call(e)},(e.exports=function(e,t,r,n){var i="function"==typeof r;i&&(O(r,"name")||U(r,"name",t)),e[t]!==r&&(i&&(O(r,a)||U(r,a,e[t]?""+e[t]:o.join(String(t)))),e===m?e[t]=r:n?e[t]?e[t]=r:U(e,t,r):(delete e[t],U(e,t,r)))})(Function.prototype,t,function(){return"function"==typeof this&&this[a]||r.call(this)})}),F={};F[y("toStringTag")]="z",F+""!="[object z]"&&M(Object.prototype,"toString",function(){return"[object "+b(this)+"]"},!0);var N=Math.ceil,B=Math.floor,z=function(e){return isNaN(e=+e)?0:(0<e?B:N)(e)},j=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},G=function(s){return function(e,t){var r,n,i=String(j(e)),a=z(t),o=i.length;return a<0||o<=a?s?"":void 0:(r=i.charCodeAt(a))<55296||56319<r||a+1===o||(n=i.charCodeAt(a+1))<56320||57343<n?s?i.charAt(a):r:s?i.slice(a,a+2):n-56320+(r-55296<<10)+65536}},H=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e},q=function(n,i,e){if(H(n),void 0===i)return n;switch(e){case 1:return function(e){return n.call(i,e)};case 2:return function(e,t){return n.call(i,e,t)};case 3:return function(e,t,r){return n.call(i,e,t,r)}}return function(){return n.apply(i,arguments)}},V="prototype",W=function(e,t,r){var n,i,a,o,s=e&W.F,l=e&W.G,u=e&W.S,f=e&W.P,d=e&W.B,c=l?m:u?m[t]||(m[t]={}):(m[t]||{})[V],h=l?g:g[t]||(g[t]={}),p=h[V]||(h[V]={});for(n in l&&(r=t),r)a=((i=!s&&c&&void 0!==c[n])?c:r)[n],o=d&&i?q(a,m):f&&"function"==typeof a?q(Function.call,a):a,c&&M(c,n,a,e&W.U),h[n]!=a&&U(h,n,o),f&&p[n]!=a&&(p[n]=a)};m.core=g,W.F=1,W.G=2,W.S=4,W.P=8,W.B=16,W.W=32,W.U=64,W.R=128;var Y=W,K={},X=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==d(e)?e.split(""):Object(e)},Z=function(e){return X(j(e))},Q=Math.min,J=function(e){return 0<e?Q(z(e),9007199254740991):0},$=Math.max,ee=Math.min,te=function(e,t){return(e=z(e))<0?$(e+t,0):ee(e,t)},re=function(s){return function(e,t,r){var n,i=Z(e),a=J(i.length),o=te(r,a);if(s&&t!=t){for(;o<a;)if((n=i[o++])!=n)return!0}else for(;o<a;o++)if((s||o in i)&&i[o]===t)return s||o||0;return!s&&-1}},ne=s("keys"),ie=function(e){return ne[e]||(ne[e]=p(e))},ae=re(!1),oe=ie("IE_PROTO"),se=function(e,t){var r,n=Z(e),i=0,a=[];for(r in n)r!=oe&&O(n,r)&&a.push(r);for(;t.length>i;)O(n,r=t[i++])&&(~ae(a,r)||a.push(r));return a},le="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),ue=Object.keys||function(e){return se(e,le)},fe=w?Object.defineProperties:function(e,t){T(e);for(var r,n=ue(t),i=n.length,a=0;a<i;)D.f(e,r=n[a++],t[r]);return e},de=m.document,ce=de&&de.documentElement,he=ie("IE_PROTO"),pe=function(){},ge="prototype",me=function(){var e,t=L("iframe"),r=le.length;for(t.style.display="none",ce.appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),me=e.F;r--;)delete me[ge][le[r]];return me()},ye=Object.create||function(e,t){var r;return null!==e?(pe[ge]=T(e),r=new pe,pe[ge]=null,r[he]=e):r=me(),void 0===t?r:fe(r,t)},ve=D.f,_e=y("toStringTag"),be=function(e,t,r){e&&!O(e=r?e:e.prototype,_e)&&ve(e,_e,{configurable:!0,value:t})},Se={};U(Se,y("iterator"),function(){return this});var Ee=function(e){return Object(j(e))},we=ie("IE_PROTO"),Te=Object.prototype,Ae=Object.getPrototypeOf||function(e){return e=Ee(e),O(e,we)?e[we]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?Te:null},xe=y("iterator"),Le=!([].keys&&"next"in[].keys()),Re="values",Ie=function(){return this},Ce=function(e,t,r,n,i,a,o){var s,l,u;l=t,u=n,(s=r).prototype=ye(Se,{next:P(1,u)}),be(s,l+" Iterator");var f,d,c,h=function(e){if(!Le&&e in y)return y[e];switch(e){case"keys":case Re:return function(){return new r(this,e)}}return function(){return new r(this,e)}},p=t+" Iterator",g=i==Re,m=!1,y=e.prototype,v=y[xe]||y["@@iterator"]||i&&y[i],_=v||h(i),b=i?g?h("entries"):_:void 0,S="Array"==t&&y.entries||v;if(S&&(c=Ae(S.call(new e)))!==Object.prototype&&c.next&&(be(c,p,!0),"function"!=typeof c[xe]&&U(c,xe,Ie)),g&&v&&v.name!==Re&&(m=!0,_=function(){return v.call(this)}),(Le||m||!y[xe])&&U(y,xe,_),K[t]=_,K[p]=Ie,i)if(f={values:g?_:h(Re),keys:a?_:h("keys"),entries:b},o)for(d in f)d in y||M(y,d,f[d]);else Y(Y.P+Y.F*(Le||m),t,f);return f},De=G(!0);Ce(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=De(t,r),this._i+=e.length,{value:e,done:!1})});var Pe=y("unscopables"),Ue=Array.prototype;null==Ue[Pe]&&U(Ue,Pe,{});var ke=function(e){Ue[Pe][e]=!0},Oe=function(e,t){return{value:t,done:!!e}},Me=Ce(Array,"Array",function(e,t){this._t=Z(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,Oe(1)):Oe(0,"keys"==t?r:"values"==t?e[r]:[r,e[r]])},"values");K.Arguments=K.Array,ke("keys"),ke("values"),ke("entries");for(var Fe=y("iterator"),Ne=y("toStringTag"),Be=K.Array,ze={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},je=ue(ze),Ge=0;Ge<je.length;Ge++){var He,qe=je[Ge],Ve=ze[qe],We=m[qe],Ye=We&&We.prototype;if(Ye&&(Ye[Fe]||U(Ye,Fe,Be),Ye[Ne]||U(Ye,Ne,qe),K[qe]=Be,Ve))for(He in Me)Ye[He]||M(Ye,He,Me[He],!0)}var Ke,Xe,Ze,Qe=function(t,e,r,n){try{return n?e(T(r)[0],r[1]):e(r)}catch(e){var i=t.return;throw void 0!==i&&T(i.call(t)),e}},Je=y("iterator"),$e=Array.prototype,et=function(e){return void 0!==e&&(K.Array===e||$e[Je]===e)},tt=y("iterator"),rt=g.getIteratorMethod=function(e){if(null!=e)return e[tt]||e["@@iterator"]||K[b(e)]},nt=o(function(e){var c={},h={},t=e.exports=function(e,t,r,n,i){var a,o,s,l,u=i?function(){return e}:rt(e),f=q(r,n,t?2:1),d=0;if("function"!=typeof u)throw TypeError(e+" is not iterable!");if(et(u)){for(a=J(e.length);d<a;d++)if((l=t?f(T(o=e[d])[0],o[1]):f(e[d]))===c||l===h)return l}else for(s=u.call(e);!(o=s.next()).done;)if((l=Qe(s,f,o.value,t))===c||l===h)return l};t.BREAK=c,t.RETURN=h}),it=y("species"),at=function(e,t){var r,n=T(e).constructor;return void 0===n||null==(r=T(n)[it])?t:H(r)},ot=m.process,st=m.setImmediate,lt=m.clearImmediate,ut=m.MessageChannel,ft=m.Dispatch,dt=0,ct={},ht="onreadystatechange",pt=function(){var e=+this;if(ct.hasOwnProperty(e)){var t=ct[e];delete ct[e],t()}},gt=function(e){pt.call(e.data)};st&&lt||(st=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);return ct[++dt]=function(){!function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}e.apply(r,t)}("function"==typeof e?e:Function(e),t)},Ke(dt),dt},lt=function(e){delete ct[e]},"process"==d(ot)?Ke=function(e){ot.nextTick(q(pt,e,1))}:ft&&ft.now?Ke=function(e){ft.now(q(pt,e,1))}:ut?(Ze=(Xe=new ut).port2,Xe.port1.onmessage=gt,Ke=q(Ze.postMessage,Ze,1)):m.addEventListener&&"function"==typeof postMessage&&!m.importScripts?(Ke=function(e){m.postMessage(e+"","*")},m.addEventListener("message",gt,!1)):Ke=ht in L("script")?function(e){ce.appendChild(L("script"))[ht]=function(){ce.removeChild(this),pt.call(e)}}:function(e){setTimeout(q(pt,e,1),0)});var mt={set:st,clear:lt},yt=mt.set,vt=m.MutationObserver||m.WebKitMutationObserver,_t=m.process,bt=m.Promise,St="process"==d(_t);function Et(e){var r,n;this.promise=new e(function(e,t){if(void 0!==r||void 0!==n)throw TypeError("Bad Promise constructor");r=e,n=t}),this.resolve=H(r),this.reject=H(n)}var wt={f:function(e){return new Et(e)}},Tt=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}},At=m.navigator,xt=At&&At.userAgent||"",Lt=y("species"),Rt=function(e){var t=m[e];w&&t&&!t[Lt]&&D.f(t,Lt,{configurable:!0,get:function(){return this}})},It=y("iterator"),Ct=!1;try{[7][It]().return=function(){Ct=!0}}catch(e){}var Dt,Pt,Ut,kt,Ot=function(e,t){if(!t&&!Ct)return!1;var r=!1;try{var n=[7],i=n[It]();i.next=function(){return{done:r=!0}},n[It]=function(){return i},e(n)}catch(e){}return r},Mt=mt.set,Ft=function(){var r,n,i,e=function(){var e,t;for(St&&(e=_t.domain)&&e.exit();r;){t=r.fn,r=r.next;try{t()}catch(e){throw r?i():n=void 0,e}}n=void 0,e&&e.enter()};if(St)i=function(){_t.nextTick(e)};else if(!vt||m.navigator&&m.navigator.standalone)if(bt&&bt.resolve){var t=bt.resolve(void 0);i=function(){t.then(e)}}else i=function(){yt.call(m,e)};else{var a=!0,o=document.createTextNode("");new vt(e).observe(o,{characterData:!0}),i=function(){o.data=a=!a}}return function(e){var t={fn:e,next:void 0};n&&(n.next=t),r||(r=t,i()),n=t}}(),Nt="Promise",Bt=m.TypeError,zt=m.process,jt=zt&&zt.versions,Gt=jt&&jt.v8||"",Ht=m[Nt],qt="process"==b(zt),Vt=function(){},Wt=Pt=wt.f,Yt=!!function(){try{var e=Ht.resolve(1),t=(e.constructor={})[y("species")]=function(e){e(Vt,Vt)};return(qt||"function"==typeof PromiseRejectionEvent)&&e.then(Vt)instanceof t&&0!==Gt.indexOf("6.6")&&-1===xt.indexOf("Chrome/66")}catch(e){}}(),Kt=function(e){var t;return!(!S(e)||"function"!=typeof(t=e.then))&&t},Xt=function(f,r){if(!f._n){f._n=!0;var n=f._c;Ft(function(){for(var l=f._v,u=1==f._s,e=0,t=function(e){var t,r,n,i=u?e.ok:e.fail,a=e.resolve,o=e.reject,s=e.domain;try{i?(u||(2==f._h&&Jt(f),f._h=1),!0===i?t=l:(s&&s.enter(),t=i(l),s&&(s.exit(),n=!0)),t===e.promise?o(Bt("Promise-chain cycle")):(r=Kt(t))?r.call(t,a,o):a(t)):o(l)}catch(e){s&&!n&&s.exit(),o(e)}};n.length>e;)t(n[e++]);f._c=[],f._n=!1,r&&!f._h&&Zt(f)})}},Zt=function(a){Mt.call(m,function(){var e,t,r,n=a._v,i=Qt(a);if(i&&(e=Tt(function(){qt?zt.emit("unhandledRejection",n,a):(t=m.onunhandledrejection)?t({promise:a,reason:n}):(r=m.console)&&r.error&&r.error("Unhandled promise rejection",n)}),a._h=qt||Qt(a)?2:1),a._a=void 0,i&&e.e)throw e.v})},Qt=function(e){return 1!==e._h&&0===(e._a||e._c).length},Jt=function(t){Mt.call(m,function(){var e;qt?zt.emit("rejectionHandled",t):(e=m.onrejectionhandled)&&e({promise:t,reason:t._v})})},$t=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),Xt(t,!0))},er=function(e){var r,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw Bt("Promise can't be resolved itself");(r=Kt(e))?Ft(function(){var t={_w:n,_d:!1};try{r.call(e,q(er,t,1),q($t,t,1))}catch(e){$t.call(t,e)}}):(n._v=e,n._s=1,Xt(n,!1))}catch(e){$t.call({_w:n,_d:!1},e)}}};Yt||(Ht=function(e){!function(e,t,r,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(r+": incorrect invocation!")}(this,Ht,Nt,"_h"),H(e),Dt.call(this);try{e(q(er,this,1),q($t,this,1))}catch(e){$t.call(this,e)}},(Dt=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=function(e,t,r){for(var n in t)M(e,n,t[n],r);return e}(Ht.prototype,{then:function(e,t){var r=Wt(at(this,Ht));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=qt?zt.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&Xt(this,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),Ut=function(){var e=new Dt;this.promise=e,this.resolve=q(er,e,1),this.reject=q($t,e,1)},wt.f=Wt=function(e){return e===Ht||e===kt?new Ut(e):Pt(e)}),Y(Y.G+Y.W+Y.F*!Yt,{Promise:Ht}),be(Ht,Nt),Rt(Nt),kt=g[Nt],Y(Y.S+Y.F*!Yt,Nt,{reject:function(e){var t=Wt(this);return(0,t.reject)(e),t.promise}}),Y(Y.S+Y.F*!Yt,Nt,{resolve:function(e){return function(e,t){if(T(e),S(t)&&t.constructor===e)return t;var r=wt.f(e);return(0,r.resolve)(t),r.promise}(this,e)}}),Y(Y.S+Y.F*!(Yt&&Ot(function(e){Ht.all(e).catch(Vt)})),Nt,{all:function(e){var o=this,t=Wt(o),s=t.resolve,l=t.reject,r=Tt(function(){var n=[],i=0,a=1;nt(e,!1,function(e){var t=i++,r=!1;n.push(void 0),a++,o.resolve(e).then(function(e){r||(r=!0,n[t]=e,--a||s(n))},l)}),--a||s(n)});return r.e&&l(r.v),t.promise},race:function(e){var t=this,r=Wt(t),n=r.reject,i=Tt(function(){nt(e,!1,function(e){t.resolve(e).then(r.resolve,n)})});return i.e&&n(i.v),r.promise}});g.Promise;var tr=Array.isArray||function(e){return"Array"==d(e)};Y(Y.S,"Array",{isArray:tr});var rr=function(e,t,r){t in e?D.f(e,t,P(0,r)):e[t]=r};Y(Y.S+Y.F*!Ot(function(e){}),"Array",{from:function(e){var t,r,n,i,a=Ee(e),o="function"==typeof this?this:Array,s=arguments.length,l=1<s?arguments[1]:void 0,u=void 0!==l,f=0,d=rt(a);if(u&&(l=q(l,2<s?arguments[2]:void 0,2)),null==d||o==Array&&et(d))for(r=new o(t=J(a.length));f<t;f++)rr(r,f,u?l(a[f],f):a[f]);else for(i=d.call(a),r=new o;!(n=i.next()).done;f++)rr(r,f,u?Qe(i,l,[n.value,f],!0):n.value);return r.length=f,r}}),Y(Y.S+Y.F*E(function(){function e(){}return!(Array.of.call(e)instanceof e)}),"Array",{of:function(){for(var e=0,t=arguments.length,r=new("function"==typeof this?this:Array)(t);e<t;)rr(r,e,arguments[e++]);return r.length=t,r}});var nr=function(e,t){return!!e&&E(function(){t?e.call(null,function(){},1):e.call(null)})},ir=[].join;Y(Y.P+Y.F*(X!=Object||!nr(ir)),"Array",{join:function(e){return ir.call(Z(this),void 0===e?",":e)}});var ar=[].slice;Y(Y.P+Y.F*E(function(){ce&&ar.call(ce)}),"Array",{slice:function(e,t){var r=J(this.length),n=d(this);if(t=void 0===t?r:t,"Array"==n)return ar.call(this,e,t);for(var i=te(e,r),a=te(t,r),o=J(a-i),s=new Array(o),l=0;l<o;l++)s[l]="String"==n?this.charAt(i+l):this[i+l];return s}});var or=[].sort,sr=[1,2,3];Y(Y.P+Y.F*(E(function(){sr.sort(void 0)})||!E(function(){sr.sort(null)})||!nr(or)),"Array",{sort:function(e){return void 0===e?or.call(Ee(this)):or.call(Ee(this),H(e))}});var lr=y("species"),ur=function(e,t){return tr(r=e)&&("function"!=typeof(n=r.constructor)||n!==Array&&!tr(n.prototype)||(n=void 0),S(n)&&null===(n=n[lr])&&(n=void 0)),new(void 0===n?Array:n)(t);var r,n},fr=function(d,e){var c=1==d,h=2==d,p=3==d,g=4==d,m=6==d,y=5==d||m,v=e||ur;return function(e,t,r){for(var n,i,a=Ee(e),o=X(a),s=q(t,r,3),l=J(o.length),u=0,f=c?v(e,l):h?v(e,0):void 0;u<l;u++)if((y||u in o)&&(i=s(n=o[u],u,a),d))if(c)f[u]=i;else if(i)switch(d){case 3:return!0;case 5:return n;case 6:return u;case 2:f.push(n)}else if(g)return!1;return m?-1:p||g?g:f}},dr=fr(0),cr=nr([].forEach,!0);Y(Y.P+Y.F*!cr,"Array",{forEach:function(e){return dr(this,e,arguments[1])}});var hr=fr(1);Y(Y.P+Y.F*!nr([].map,!0),"Array",{map:function(e){return hr(this,e,arguments[1])}});var pr=fr(2);Y(Y.P+Y.F*!nr([].filter,!0),"Array",{filter:function(e){return pr(this,e,arguments[1])}});var gr=fr(3);Y(Y.P+Y.F*!nr([].some,!0),"Array",{some:function(e){return gr(this,e,arguments[1])}});var mr=fr(4);Y(Y.P+Y.F*!nr([].every,!0),"Array",{every:function(e){return mr(this,e,arguments[1])}});var yr=function(e,t,r,n,i){H(t);var a=Ee(e),o=X(a),s=J(a.length),l=i?s-1:0,u=i?-1:1;if(r<2)for(;;){if(l in o){n=o[l],l+=u;break}if(l+=u,i?l<0:s<=l)throw TypeError("Reduce of empty array with no initial value")}for(;i?0<=l:l<s;l+=u)l in o&&(n=t(n,o[l],l,a));return n};Y(Y.P+Y.F*!nr([].reduce,!0),"Array",{reduce:function(e){return yr(this,e,arguments.length,arguments[1],!1)}}),Y(Y.P+Y.F*!nr([].reduceRight,!0),"Array",{reduceRight:function(e){return yr(this,e,arguments.length,arguments[1],!0)}});var vr=re(!1),_r=[].indexOf,br=!!_r&&1/[1].indexOf(1,-0)<0;Y(Y.P+Y.F*(br||!nr(_r)),"Array",{indexOf:function(e){return br?_r.apply(this,arguments)||0:vr(this,e,arguments[1])}});var Sr=[].lastIndexOf,Er=!!Sr&&1/[1].lastIndexOf(1,-0)<0;Y(Y.P+Y.F*(Er||!nr(Sr)),"Array",{lastIndexOf:function(e){if(Er)return Sr.apply(this,arguments)||0;var t=Z(this),r=J(t.length),n=r-1;for(1<arguments.length&&(n=Math.min(n,z(arguments[1]))),n<0&&(n=r+n);0<=n;n--)if(n in t&&t[n]===e)return n||0;return-1}});var wr=[].copyWithin||function(e,t){var r=Ee(this),n=J(r.length),i=te(e,n),a=te(t,n),o=2<arguments.length?arguments[2]:void 0,s=Math.min((void 0===o?n:te(o,n))-a,n-i),l=1;for(a<i&&i<a+s&&(l=-1,a+=s-1,i+=s-1);0<s--;)a in r?r[i]=r[a]:delete r[i],i+=l,a+=l;return r};Y(Y.P,"Array",{copyWithin:wr}),ke("copyWithin");Y(Y.P,"Array",{fill:function(e){for(var t=Ee(this),r=J(t.length),n=arguments.length,i=te(1<n?arguments[1]:void 0,r),a=2<n?arguments[2]:void 0,o=void 0===a?r:te(a,r);i<o;)t[i++]=e;return t}}),ke("fill");var Tr=fr(5),Ar="find",xr=!0;Ar in[]&&Array(1)[Ar](function(){xr=!1}),Y(Y.P+Y.F*xr,"Array",{find:function(e){return Tr(this,e,1<arguments.length?arguments[1]:void 0)}}),ke(Ar);var Lr=fr(6),Rr="findIndex",Ir=!0;Rr in[]&&Array(1)[Rr](function(){Ir=!1}),Y(Y.P+Y.F*Ir,"Array",{findIndex:function(e){return Lr(this,e,1<arguments.length?arguments[1]:void 0)}}),ke(Rr),Rt("Array");g.Array;var Cr,Dr,Pr=o(function(e){var r=p("meta"),t=D.f,n=0,i=Object.isExtensible||function(){return!0},a=!E(function(){return i(Object.preventExtensions({}))}),o=function(e){t(e,r,{value:{i:"O"+ ++n,w:{}}})},s=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!S(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!O(e,r)){if(!i(e))return"F";if(!t)return"E";o(e)}return e[r].i},getWeak:function(e,t){if(!O(e,r)){if(!i(e))return!0;if(!t)return!1;o(e)}return e[r].w},onFreeze:function(e){return a&&s.NEED&&i(e)&&!O(e,r)&&o(e),e}}}),Ur=(Pr.KEY,Pr.NEED,Pr.fastKey,Pr.getWeak,Pr.onFreeze,{f:y}),kr=D.f,Or={f:Object.getOwnPropertySymbols},Mr={f:{}.propertyIsEnumerable},Fr=le.concat("length","prototype"),Nr={f:Object.getOwnPropertyNames||function(e){return se(e,Fr)}},Br=Nr.f,zr={}.toString,jr="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Gr={f:function(e){return jr&&"[object Window]"==zr.call(e)?function(e){try{return Br(e)}catch(e){return jr.slice()}}(e):Br(Z(e))}},Hr=Object.getOwnPropertyDescriptor,qr={f:w?Hr:function(e,t){if(e=Z(e),t=I(t,!0),R)try{return Hr(e,t)}catch(e){}if(O(e,t))return P(!Mr.f.call(e,t),e[t])}},Vr=Pr.KEY,Wr=qr.f,Yr=D.f,Kr=Gr.f,Xr=m.Symbol,Zr=m.JSON,Qr=Zr&&Zr.stringify,Jr="prototype",$r=y("_hidden"),en=y("toPrimitive"),tn={}.propertyIsEnumerable,rn=s("symbol-registry"),nn=s("symbols"),an=s("op-symbols"),on=Object[Jr],sn="function"==typeof Xr,ln=m.QObject,un=!ln||!ln[Jr]||!ln[Jr].findChild,fn=w&&E(function(){return 7!=ye(Yr({},"a",{get:function(){return Yr(this,"a",{value:7}).a}})).a})?function(e,t,r){var n=Wr(on,t);n&&delete on[t],Yr(e,t,r),n&&e!==on&&Yr(on,t,n)}:Yr,dn=function(e){var t=nn[e]=ye(Xr[Jr]);return t._k=e,t},cn=sn&&"symbol"==typeof Xr.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof Xr},hn=function(e,t,r){return e===on&&hn(an,t,r),T(e),t=I(t,!0),T(r),O(nn,t)?(r.enumerable?(O(e,$r)&&e[$r][t]&&(e[$r][t]=!1),r=ye(r,{enumerable:P(0,!1)})):(O(e,$r)||Yr(e,$r,P(1,{})),e[$r][t]=!0),fn(e,t,r)):Yr(e,t,r)},pn=function(e,t){T(e);for(var r,n=function(e){var t=ue(e),r=Or.f;if(r)for(var n,i=r(e),a=Mr.f,o=0;i.length>o;)a.call(e,n=i[o++])&&t.push(n);return t}(t=Z(t)),i=0,a=n.length;i<a;)hn(e,r=n[i++],t[r]);return e},gn=function(e){var t=tn.call(this,e=I(e,!0));return!(this===on&&O(nn,e)&&!O(an,e))&&(!(t||!O(this,e)||!O(nn,e)||O(this,$r)&&this[$r][e])||t)},mn=function(e,t){if(e=Z(e),t=I(t,!0),e!==on||!O(nn,t)||O(an,t)){var r=Wr(e,t);return!r||!O(nn,t)||O(e,$r)&&e[$r][t]||(r.enumerable=!0),r}},yn=function(e){for(var t,r=Kr(Z(e)),n=[],i=0;r.length>i;)O(nn,t=r[i++])||t==$r||t==Vr||n.push(t);return n},vn=function(e){for(var t,r=e===on,n=Kr(r?an:Z(e)),i=[],a=0;n.length>a;)!O(nn,t=n[a++])||r&&!O(on,t)||i.push(nn[t]);return i};sn||(M((Xr=function(){if(this instanceof Xr)throw TypeError("Symbol is not a constructor!");var t=p(0<arguments.length?arguments[0]:void 0),r=function(e){this===on&&r.call(an,e),O(this,$r)&&O(this[$r],t)&&(this[$r][t]=!1),fn(this,t,P(1,e))};return w&&un&&fn(on,t,{configurable:!0,set:r}),dn(t)})[Jr],"toString",function(){return this._k}),qr.f=mn,D.f=hn,Nr.f=Gr.f=yn,Mr.f=gn,Or.f=vn,w&&M(on,"propertyIsEnumerable",gn,!0),Ur.f=function(e){return dn(y(e))}),Y(Y.G+Y.W+Y.F*!sn,{Symbol:Xr});for(var _n="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),bn=0;_n.length>bn;)y(_n[bn++]);for(var Sn=ue(y.store),En=0;Sn.length>En;)Cr=Sn[En++],void 0,Dr=g.Symbol||(g.Symbol=m.Symbol||{}),"_"==Cr.charAt(0)||Cr in Dr||kr(Dr,Cr,{value:Ur.f(Cr)});Y(Y.S+Y.F*!sn,"Symbol",{for:function(e){return O(rn,e+="")?rn[e]:rn[e]=Xr(e)},keyFor:function(e){if(!cn(e))throw TypeError(e+" is not a symbol!");for(var t in rn)if(rn[t]===e)return t},useSetter:function(){un=!0},useSimple:function(){un=!1}}),Y(Y.S+Y.F*!sn,"Object",{create:function(e,t){return void 0===t?ye(e):pn(ye(e),t)},defineProperty:hn,defineProperties:pn,getOwnPropertyDescriptor:mn,getOwnPropertyNames:yn,getOwnPropertySymbols:vn}),Zr&&Y(Y.S+Y.F*(!sn||E(function(){var e=Xr();return"[null]"!=Qr([e])||"{}"!=Qr({a:e})||"{}"!=Qr(Object(e))})),"JSON",{stringify:function(e){for(var t,r,n=[e],i=1;arguments.length>i;)n.push(arguments[i++]);if(r=t=n[1],(S(t)||void 0!==e)&&!cn(e))return tr(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!cn(t))return t}),n[1]=t,Qr.apply(Zr,n)}}),Xr[Jr][en]||U(Xr[Jr],en,Xr[Jr].valueOf),be(Xr,"Symbol"),be(Math,"Math",!0),be(m.JSON,"JSON",!0);g.Symbol;var wn=String.fromCharCode,Tn=String.fromCodePoint;Y(Y.S+Y.F*(!!Tn&&1!=Tn.length),"String",{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,i=0;i<n;){if(t=+arguments[i++],te(t,1114111)!==t)throw RangeError(t+" is not a valid code point");r.push(t<65536?wn(t):wn(55296+((t-=65536)>>10),t%1024+56320))}return r.join("")}}),Y(Y.S,"String",{raw:function(e){for(var t=Z(e.raw),r=J(t.length),n=arguments.length,i=[],a=0;a<r;)i.push(String(t[a++])),a<n&&i.push(String(arguments[a]));return i.join("")}});var An="\t\n\v\f\r 聽釟€釥庘€€鈥佲€傗€冣€勨€呪€嗏€団€堚€夆€娾€仧銆€\u2028\u2029\ufeff",xn="["+An+"]",Ln=RegExp("^"+xn+xn+"*"),Rn=RegExp(xn+xn+"*$"),In=function(e,t,r){var n={},i=E(function(){return!!An[e]()||"鈥嬄�"!="鈥嬄�"[e]()}),a=n[e]=i?t(Cn):An[e];r&&(n[r]=a),Y(Y.P+Y.F*i,"String",n)},Cn=In.trim=function(e,t){return e=String(j(e)),1&t&&(e=e.replace(Ln,"")),2&t&&(e=e.replace(Rn,"")),e};In("trim",function(e){return function(){return e(this,3)}});var Dn=G(!1);Y(Y.P,"String",{codePointAt:function(e){return Dn(this,e)}});var Pn=y("match"),Un=function(e){var t;return S(e)&&(void 0!==(t=e[Pn])?!!t:"RegExp"==d(e))},kn=function(e,t,r){if(Un(t))throw TypeError("String#"+r+" doesn't accept regex!");return String(j(e))},On=y("match"),Mn=function(t){var r=/./;try{"/./"[t](r)}catch(e){try{return r[On]=!1,!"/./"[t](r)}catch(e){}}return!0},Fn="endsWith",Nn=""[Fn];Y(Y.P+Y.F*Mn(Fn),"String",{endsWith:function(e){var t=kn(this,e,Fn),r=1<arguments.length?arguments[1]:void 0,n=J(t.length),i=void 0===r?n:Math.min(J(r),n),a=String(e);return Nn?Nn.call(t,a,i):t.slice(i-a.length,i)===a}});var Bn="includes";Y(Y.P+Y.F*Mn(Bn),"String",{includes:function(e){return!!~kn(this,e,Bn).indexOf(e,1<arguments.length?arguments[1]:void 0)}});Y(Y.P,"String",{repeat:function(e){var t=String(j(this)),r="",n=z(e);if(n<0||n==1/0)throw RangeError("Count can't be negative");for(;0<n;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r}});var zn="startsWith",jn=""[zn];Y(Y.P+Y.F*Mn(zn),"String",{startsWith:function(e){var t=kn(this,e,zn),r=J(Math.min(1<arguments.length?arguments[1]:void 0,t.length)),n=String(e);return jn?jn.call(t,n,r):t.slice(r,r+n.length)===n}});var Gn=/"/g,Hn=function(e,t,r,n){var i=String(j(e)),a="<"+t;return""!==r&&(a+=" "+r+'="'+String(n).replace(Gn,"&quot;")+'"'),a+">"+i+"</"+t+">"},qn=function(t,e){var r={};r[t]=e(Hn),Y(Y.P+Y.F*E(function(){var e=""[t]('"');return e!==e.toLowerCase()||3<e.split('"').length}),"String",r)};qn("anchor",function(t){return function(e){return t(this,"a","name",e)}}),qn("big",function(e){return function(){return e(this,"big","","")}}),qn("blink",function(e){return function(){return e(this,"blink","","")}}),qn("bold",function(e){return function(){return e(this,"b","","")}}),qn("fixed",function(e){return function(){return e(this,"tt","","")}}),qn("fontcolor",function(t){return function(e){return t(this,"font","color",e)}}),qn("fontsize",function(t){return function(e){return t(this,"font","size",e)}}),qn("italics",function(e){return function(){return e(this,"i","","")}}),qn("link",function(t){return function(e){return t(this,"a","href",e)}}),qn("small",function(e){return function(){return e(this,"small","","")}}),qn("strike",function(e){return function(){return e(this,"strike","","")}}),qn("sub",function(e){return function(){return e(this,"sub","","")}}),qn("sup",function(e){return function(){return e(this,"sup","","")}});var Vn,Wn,Yn=G(!0),Kn=function(e,t,r){return t+(r?Yn(e,t).length:1)},Xn=RegExp.prototype.exec,Zn=function(e,t){var r=e.exec;if("function"==typeof r){var n=r.call(e,t);if("object"!=typeof n)throw new TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==b(e))throw new TypeError("RegExp#exec called on incompatible receiver");return Xn.call(e,t)},Qn=RegExp.prototype.exec,Jn=String.prototype.replace,$n=Qn,ei="lastIndex",ti=(Vn=/a/,Wn=/b*/g,Qn.call(Vn,"a"),Qn.call(Wn,"a"),0!==Vn[ei]||0!==Wn[ei]),ri=void 0!==/()??/.exec("")[1];(ti||ri)&&($n=function(e){var t,r,n,i,a=this;return ri&&(r=new RegExp("^"+a.source+"$(?!\\s)",function(){var e=T(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}.call(a))),ti&&(t=a[ei]),n=Qn.call(a,e),ti&&n&&(a[ei]=a.global?n.index+n[0].length:t),ri&&n&&1<n.length&&Jn.call(n[0],r,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(n[i]=void 0)}),n});var ni=$n;Y({target:"RegExp",proto:!0,forced:ni!==/./.exec},{exec:ni});var ii=y("species"),ai=!E(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}),oi=function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2===r.length&&"a"===r[0]&&"b"===r[1]}(),si=function(r,e,t){var n=y(r),a=!E(function(){var e={};return e[n]=function(){return 7},7!=""[r](e)}),i=a?!E(function(){var e=!1,t=/a/;return t.exec=function(){return e=!0,null},"split"===r&&(t.constructor={},t.constructor[ii]=function(){return t}),t[n](""),!e}):void 0;if(!a||!i||"replace"===r&&!ai||"split"===r&&!oi){var o=/./[n],s=t(j,n,""[r],function(e,t,r,n,i){return t.exec===ni?a&&!i?{done:!0,value:o.call(t,r,n)}:{done:!0,value:e.call(r,t,n)}:{done:!1}}),l=s[0],u=s[1];M(String.prototype,r,l),U(RegExp.prototype,n,2==e?function(e,t){return u.call(e,this,t)}:function(e){return u.call(e,this)})}};si("match",1,function(n,i,u,f){return[function(e){var t=n(this),r=null==e?void 0:e[i];return void 0!==r?r.call(e,t):new RegExp(e)[i](String(t))},function(e){var t=f(u,e,this);if(t.done)return t.value;var r=T(e),n=String(this);if(!r.global)return Zn(r,n);for(var i,a=r.unicode,o=[],s=r.lastIndex=0;null!==(i=Zn(r,n));){var l=String(i[0]);""===(o[s]=l)&&(r.lastIndex=Kn(n,J(r.lastIndex),a)),s++}return 0===s?null:o}]});var li=Math.max,ui=Math.min,fi=Math.floor,di=/\$([$&`']|\d\d?|<[^>]*>)/g,ci=/\$([$&`']|\d\d?)/g;si("replace",2,function(i,a,S,E){return[function(e,t){var r=i(this),n=null==e?void 0:e[a];return void 0!==n?n.call(e,r,t):S.call(String(r),e,t)},function(e,t){var r=E(S,e,this,t);if(r.done)return r.value;var n=T(e),i=String(this),a="function"==typeof t;a||(t=String(t));var o=n.global;if(o){var s=n.unicode;n.lastIndex=0}for(var l=[];;){var u=Zn(n,i);if(null===u)break;if(l.push(u),!o)break;""===String(u[0])&&(n.lastIndex=Kn(i,J(n.lastIndex),s))}for(var f,d="",c=0,h=0;h<l.length;h++){u=l[h];for(var p=String(u[0]),g=li(ui(z(u.index),i.length),0),m=[],y=1;y<u.length;y++)m.push(void 0===(f=u[y])?f:String(f));var v=u.groups;if(a){var _=[p].concat(m,g,i);void 0!==v&&_.push(v);var b=String(t.apply(void 0,_))}else b=w(p,i,g,m,v,t);c<=g&&(d+=i.slice(c,g)+b,c=g+p.length)}return d+i.slice(c)}];function w(a,o,s,l,u,e){var f=s+a.length,d=l.length,t=ci;return void 0!==u&&(u=Ee(u),t=di),S.call(e,t,function(e,t){var r;switch(t.charAt(0)){case"$":return"$";case"&":return a;case"`":return o.slice(0,s);case"'":return o.slice(f);case"<":r=u[t.slice(1,-1)];break;default:var n=+t;if(0===n)return e;if(d<n){var i=fi(n/10);return 0===i?e:i<=d?void 0===l[i-1]?t.charAt(1):l[i-1]+t.charAt(1):e}r=l[n-1]}return void 0===r?"":r})}});var hi=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};si("search",1,function(n,i,o,s){return[function(e){var t=n(this),r=null==e?void 0:e[i];return void 0!==r?r.call(e,t):new RegExp(e)[i](String(t))},function(e){var t=s(o,e,this);if(t.done)return t.value;var r=T(e),n=String(this),i=r.lastIndex;hi(i,0)||(r.lastIndex=0);var a=Zn(r,n);return hi(r.lastIndex,i)||(r.lastIndex=i),null===a?-1:a.index}]});var pi=Math.min,gi=[].push,mi="split",yi="length",vi="lastIndex",_i=4294967295,bi=!E(function(){});si("split",2,function(i,a,m,y){var v;return v="c"=="abbc"[mi](/(b)*/)[1]||4!="test"[mi](/(?:)/,-1)[yi]||2!="ab"[mi](/(?:ab)*/)[yi]||4!="."[mi](/(.?)(.?)/)[yi]||1<"."[mi](/()()/)[yi]||""[mi](/.?/)[yi]?function(e,t){var r=String(this);if(void 0===e&&0===t)return[];if(!Un(e))return m.call(r,e,t);for(var n,i,a,o=[],s=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,u=void 0===t?_i:t>>>0,f=new RegExp(e.source,s+"g");(n=ni.call(f,r))&&!(l<(i=f[vi])&&(o.push(r.slice(l,n.index)),1<n[yi]&&n.index<r[yi]&&gi.apply(o,n.slice(1)),a=n[0][yi],l=i,o[yi]>=u));)f[vi]===n.index&&f[vi]++;return l===r[yi]?!a&&f.test("")||o.push(""):o.push(r.slice(l)),o[yi]>u?o.slice(0,u):o}:"0"[mi](void 0,0)[yi]?function(e,t){return void 0===e&&0===t?[]:m.call(this,e,t)}:m,[function(e,t){var r=i(this),n=null==e?void 0:e[a];return void 0!==n?n.call(e,r,t):v.call(String(r),e,t)},function(e,t){var r=y(v,e,this,t,v!==m);if(r.done)return r.value;var n=T(e),i=String(this),a=at(n,RegExp),o=n.unicode,s=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.unicode?"u":"")+(bi?"y":"g"),l=new a(bi?n:"^(?:"+n.source+")",s),u=void 0===t?_i:t>>>0;if(0===u)return[];if(0===i.length)return null===Zn(l,i)?[i]:[];for(var f=0,d=0,c=[];d<i.length;){l.lastIndex=bi?d:0;var h,p=Zn(l,bi?i:i.slice(d));if(null===p||(h=pi(J(l.lastIndex+(bi?0:d)),i.length))===f)d=Kn(i,d,o);else{if(c.push(i.slice(f,d)),c.length===u)return c;for(var g=1;g<=p.length-1;g++)if(c.push(p[g]),c.length===u)return c;d=f=h}}return c.push(i.slice(f)),c}]});g.String;!function(n){function t(e,t){var r=n.createEvent("Event");r.initEvent(e,!0,!1),t.dispatchEvent(r)}function r(e){return function(t,r){return e!==o.exit||n[i.element]?(n.addEventListener(i.events.change,function e(){t(),n.removeEventListener(i.events.change,e,!1)},!1),void n.addEventListener(i.events.error,function e(){r(new TypeError),n.removeEventListener(i.events.error,e,!1)},!1)):void setTimeout(function(){r(new TypeError)},1)}}var i,e,a={w3:{enabled:"fullscreenEnabled",element:"fullscreenElement",request:"requestFullscreen",exit:"exitFullscreen",events:{change:"fullscreenchange",error:"fullscreenerror"}},webkit:{enabled:"webkitFullscreenEnabled",element:"webkitCurrentFullScreenElement",request:"webkitRequestFullscreen",exit:"webkitExitFullscreen",events:{change:"webkitfullscreenchange",error:"webkitfullscreenerror"}},moz:{enabled:"mozFullScreenEnabled",element:"mozFullScreenElement",request:"mozRequestFullScreen",exit:"mozCancelFullScreen",events:{change:"mozfullscreenchange",error:"mozfullscreenerror"}},ms:{enabled:"msFullscreenEnabled",element:"msFullscreenElement",request:"msRequestFullscreen",exit:"msExitFullscreen",events:{change:"MSFullscreenChange",error:"MSFullscreenError"}}},o=a.w3;for(e in a)if(a[e].enabled in n){i=a[e];break}o.enabled in n||!i||(n.addEventListener(i.events.change,function(e){e.stopPropagation(),e.stopImmediatePropagation(),n[o.enabled]=n[i.enabled],n[o.element]=n[i.element],t(o.events.change,e.target)},!1),n.addEventListener(i.events.error,function(e){t(o.events.error,e.target)},!1),n[o.enabled]=n[i.enabled],n[o.element]=n[i.element],n[o.exit]=function(){var e=n[i.exit]();return!e&&Promise?new Promise(r(o.exit)):e},Element.prototype[o.request]=function(){var e=this[i.request].apply(this,arguments);return!e&&Promise?new Promise(r(o.request)):e})}(document),e(o(function(e,t){!function(s){var l={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(l.arrayBuffer)var t=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=ArrayBuffer.isView||function(e){return e&&-1<t.indexOf(Object.prototype.toString.call(e))};function n(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function i(e){return"string"!=typeof e&&(e=String(e)),e}function e(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return l.iterable&&(e[Symbol.iterator]=function(){return e}),e}function u(t){this.map={},t instanceof u?t.forEach(function(e,t){this.append(t,e)},this):Array.isArray(t)?t.forEach(function(e){this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function a(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function o(r){return new Promise(function(e,t){r.onload=function(){e(r.result)},r.onerror=function(){t(r.error)}})}function f(e){var t=new FileReader,r=o(t);return t.readAsArrayBuffer(e),r}function d(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function c(){return this.bodyUsed=!1,this._initBody=function(e){var t;(this._bodyInit=e)?"string"==typeof e?this._bodyText=e:l.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:l.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():l.arrayBuffer&&l.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=d(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||r(e))?this._bodyArrayBuffer=d(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var e=a(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?a(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var e,t,r,n=a(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=o(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(e,t){e=n(e),t=i(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},u.prototype.delete=function(e){delete this.map[n(e)]},u.prototype.get=function(e){return e=n(e),this.has(e)?this.map[e]:null},u.prototype.has=function(e){return this.map.hasOwnProperty(n(e))},u.prototype.set=function(e,t){this.map[n(e)]=i(t)},u.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},u.prototype.keys=function(){var r=[];return this.forEach(function(e,t){r.push(t)}),e(r)},u.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),e(t)},u.prototype.entries=function(){var r=[];return this.forEach(function(e,t){r.push([t,e])}),e(r)},l.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var h=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function p(e,t){var r,n,i=(t=t||{}).body;if(e instanceof p){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new u(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new u(t.headers)),this.method=(r=t.method||this.method||"GET",n=r.toUpperCase(),-1<h.indexOf(n)?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function g(e){var i=new FormData;return e.trim().split("&").forEach(function(e){if(e){var t=e.split("="),r=t.shift().replace(/\+/g," "),n=t.join("=").replace(/\+/g," ");i.append(decodeURIComponent(r),decodeURIComponent(n))}}),i}function m(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new u(t.headers),this.url=t.url||"",this._initBody(e)}p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},c.call(p.prototype),c.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},m.error=function(){var e=new m(null,{status:0,statusText:""});return e.type="error",e};var y=[301,302,303,307,308];m.redirect=function(e,t){if(-1===y.indexOf(t))throw new RangeError("Invalid status code");return new m(null,{status:t,headers:{location:e}})},s.DOMException=self.DOMException;try{new s.DOMException}catch(e){s.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function v(i,o){return new Promise(function(n,e){var t=new p(i,o);if(t.signal&&t.signal.aborted)return e(new s.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function r(){a.abort()}a.onload=function(){var e,i,t={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",i=new u,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var t=e.split(":"),r=t.shift().trim();if(r){var n=t.join(":").trim();i.append(r,n)}}),i)};t.url="responseURL"in a?a.responseURL:t.headers.get("X-Request-URL");var r="response"in a?a.response:a.responseText;n(new m(r,t))},a.onerror=function(){e(new TypeError("Network request failed"))},a.ontimeout=function(){e(new TypeError("Network request failed"))},a.onabort=function(){e(new s.DOMException("Aborted","AbortError"))},a.open(t.method,t.url,!0),"include"===t.credentials?a.withCredentials=!0:"omit"===t.credentials&&(a.withCredentials=!1),"responseType"in a&&l.blob&&(a.responseType="blob"),t.headers.forEach(function(e,t){a.setRequestHeader(t,e)}),t.signal&&(t.signal.addEventListener("abort",r),a.onreadystatechange=function(){4===a.readyState&&t.signal.removeEventListener("abort",r)}),a.send(void 0===t._bodyInit?null:t._bodyInit)})}v.polyfill=!0,self.fetch||(self.fetch=v,self.Headers=u,self.Request=p,self.Response=m),s.Headers=u,s.Request=p,s.Response=m,s.fetch=v,Object.defineProperty(s,"__esModule",{value:!0})}(t)}));var Si,Ei,wi,Ti,Ai=o(function(e,t){"undefined"!=typeof window&&(e.exports=function(r){var n={};function i(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}return i.m=r,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/dist/",i(i.s=24)}([function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(6);function o(){}var i={trace:o,debug:o,log:o,warn:o,info:o,error:o},s=i,l=n.getSelfScope();t.enableLogs=function(e){if(!0===e||"object"==typeof e){!function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];e.forEach(function(e){var i,a;s[e]=t[e]?t[e].bind(t):(i=e,(a=l.console[i])?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n;e[0]&&(e[0]=(r=i,n=e[0],n="["+r+"] > "+n)),a.apply(l.console,e)}:o)})}(e,"debug","log","info","warn","error");try{s.log()}catch(e){s=i}}else s=i},t.logger=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),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",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",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"}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(6).getSelfScope().Number;(t.Number=n).isFinite=n.isFinite||function(e){return"number"==typeof e&&isFinite(e)}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",KEY_SYSTEM_ERROR:"keySystemError",MUX_ERROR:"muxError",OTHER_ERROR:"otherError"},t.ErrorDetails={KEY_SYSTEM_NO_KEYS:"keySystemNoKeys",KEY_SYSTEM_NO_ACCESS:"keySystemNoAccess",KEY_SYSTEM_NO_SESSION:"keySystemNoSession",KEY_SYSTEM_LICENSE_REQUEST_FAILED:"keySystemLicenseRequestFailed",MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",AUDIO_TRACK_LOAD_ERROR:"audioTrackLoadError",AUDIO_TRACK_LOAD_TIMEOUT:"audioTrackLoadTimeOut",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",REMUX_ALLOC_ERROR:"remuxAllocError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_ADD_CODEC_ERROR:"bufferAddCodecError",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",BUFFER_NUDGE_ON_STALL:"bufferNudgeOnStall",INTERNAL_EXCEPTION:"internalException"}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),i=r(3),a=r(1),o={hlsEventGeneric:!0,hlsHandlerDestroying:!0,hlsHandlerDestroyed:!0},s=function(){function e(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.hls=e,this.onEvent=this.onEvent.bind(this),this.handledEvents=t,this.useGenericHandler=!0,this.registerListeners()}return e.prototype.destroy=function(){this.onHandlerDestroying(),this.unregisterListeners(),this.onHandlerDestroyed()},e.prototype.onHandlerDestroying=function(){},e.prototype.onHandlerDestroyed=function(){},e.prototype.isEventHandler=function(){return"object"==typeof this.handledEvents&&this.handledEvents.length&&"function"==typeof this.onEvent},e.prototype.registerListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){if(o[e])throw new Error("Forbidden event-name: "+e);this.hls.on(e,this.onEvent)},this)},e.prototype.unregisterListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){this.hls.off(e,this.onEvent)},this)},e.prototype.onEvent=function(e,t){this.onEventGeneric(e,t)},e.prototype.onEventGeneric=function(e,t){try{(function(e,t){var r="on"+e.replace("hls","");if("function"!=typeof this[r])throw new Error("Event "+e+" has no generic handler in this "+this.constructor.name+" class (tried "+r+")");return this[r].bind(this,t)}).call(this,e,t).call()}catch(t){n.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.hls.trigger(a.default.ERROR,{type:i.ErrorTypes.OTHER_ERROR,details:i.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}},e}();t.default=s},function(e,t){e.exports=void 0},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getSelfScope=function(){return"undefined"==typeof window?self:window}},function(e,t,r){var n,f,i,a,d;n=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,f=/^([^\/?#]*)(.*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,d={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var n=d.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=d.normalizePath(n.path),d.buildURLFromParts(n)}var i=d.parseURL(t);if(!i)throw new Error("Error trying to parse relative URL.");if(i.scheme)return r.alwaysNormalize?(i.path=d.normalizePath(i.path),d.buildURLFromParts(i)):t;var a=d.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var o=f.exec(a.path);a.netLoc=o[1],a.path=o[2]}a.netLoc&&!a.path&&(a.path="/");var s={scheme:a.scheme,netLoc:i.netLoc,path:null,params:i.params,query:i.query,fragment:i.fragment};if(!i.netLoc&&(s.netLoc=a.netLoc,"/"!==i.path[0]))if(i.path){var l=a.path,u=l.substring(0,l.lastIndexOf("/")+1)+i.path;s.path=d.normalizePath(u)}else s.path=a.path,i.params||(s.params=a.params,i.query||(s.query=a.query));return null===s.path&&(s.path=r.alwaysNormalize?d.normalizePath(i.path):i.path),d.buildURLFromParts(s)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(i,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=d},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.isBuffered=function(e,t){try{if(e)for(var r=e.buffered,n=0;n<r.length;n++)if(t>=r.start(n)&&t<=r.end(n))return!0}catch(e){}return!1},e.bufferInfo=function(e,t,r){try{if(e){var n=e.buffered,i=[],a=void 0;for(a=0;a<n.length;a++)i.push({start:n.start(a),end:n.end(a)});return this.bufferedInfo(i,t,r)}}catch(e){}return{len:0,start:t,end:t,nextStart:void 0}},e.bufferedInfo=function(e,t,r){var n,i,a,o,s,l=[];for(e.sort(function(e,t){var r=e.start-t.start;return r||t.end-e.end}),s=0;s<e.length;s++){var u=l.length;if(u){var f=l[u-1].end;e[s].start-f<r?e[s].end>f&&(l[u-1].end=e[s].end):l.push(e[s])}else l.push(e[s])}for(n=s=0,i=a=t;s<l.length;s++){var d=l[s].start,c=l[s].end;if(d<=t+r&&t<c)i=d,n=(a=c)-t;else if(t+r<d){o=d;break}}return{len:n,start:i,end:a,nextStart:o}},e}();t.BufferHelper=n},function(e,s,r){(function(n){var i,t=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(s,"__esModule",{value:!0});var a=r(4),o=r(1);s.FragmentState={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};var e=function(r){function e(e){var t=r.call(this,e,o.default.BUFFER_APPENDED,o.default.FRAG_BUFFERED,o.default.FRAG_LOADED)||this;return t.bufferPadding=.2,t.fragments=Object.create(null),t.timeRanges=Object.create(null),t.config=e.config,t}return t(e,r),e.prototype.destroy=function(){this.fragments=null,this.timeRanges=null,this.config=null,a.default.prototype.destroy.call(this),r.prototype.destroy.call(this)},e.prototype.getBufferedFrag=function(n,i){var a=this.fragments,e=Object.keys(a).filter(function(e){var t=a[e];if(t.body.type!==i)return!1;if(!t.buffered)return!1;var r=t.body;return r.startPTS<=n&&n<=r.endPTS});if(0===e.length)return null;var t=e.pop();return a[t].body},e.prototype.detectEvictedFragments=function(i,a){var o,s,l=this;Object.keys(this.fragments).forEach(function(e){var t=l.fragments[e];if(!0===t.buffered){var r=t.range[i];if(r){o=r.time;for(var n=0;n<o.length;n++)if(s=o[n],!1===l.isTimeBuffered(s.startPTS,s.endPTS,a)){l.removeFragment(t.body);break}}}})},e.prototype.detectPartialFragments=function(r){var n=this,e=this.getFragmentKey(r),i=this.fragments[e];i&&(i.buffered=!0,Object.keys(this.timeRanges).forEach(function(e){if(r.hasElementaryStream(e)){var t=n.timeRanges[e];i.range[e]=n.getBufferedTimes(r.startPTS,r.endPTS,t)}}))},e.prototype.getBufferedTimes=function(e,t,r){for(var n,i,a=[],o=!1,s=0;s<r.length;s++){if(n=r.start(s)-this.bufferPadding,i=r.end(s)+this.bufferPadding,n<=e&&t<=i){a.push({startPTS:Math.max(e,r.start(s)),endPTS:Math.min(t,r.end(s))});break}if(e<i&&n<t)a.push({startPTS:Math.max(e,r.start(s)),endPTS:Math.min(t,r.end(s))}),o=!0;else if(t<=n)break}return{time:a,partial:o}},e.prototype.getFragmentKey=function(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn},e.prototype.getPartialFragment=function(r){var n,i,a,o=this,s=null,l=0;return Object.keys(this.fragments).forEach(function(e){var t=o.fragments[e];o.isPartial(t)&&(i=t.body.startPTS-o.bufferPadding,a=t.body.endPTS+o.bufferPadding,i<=r&&r<=a&&(n=Math.min(r-i,a-r),l<=n&&(s=t.body,l=n)))}),s},e.prototype.getState=function(e){var t=this.getFragmentKey(e),r=this.fragments[t],n=s.FragmentState.NOT_LOADED;return void 0!==r&&(n=r.buffered?!0===this.isPartial(r)?s.FragmentState.PARTIAL:s.FragmentState.OK:s.FragmentState.APPENDING),n},e.prototype.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)},e.prototype.isTimeBuffered=function(e,t,r){for(var n,i,a=0;a<r.length;a++){if(n=r.start(a)-this.bufferPadding,i=r.end(a)+this.bufferPadding,n<=e&&t<=i)return!0;if(t<=n)return!1}return!1},e.prototype.onFragLoaded=function(e){var t=e.frag;n.isFinite(t.sn)&&!t.bitrateTest&&(this.fragments[this.getFragmentKey(t)]={body:t,range:Object.create(null),buffered:!1})},e.prototype.onBufferAppended=function(e){var r=this;this.timeRanges=e.timeRanges,Object.keys(this.timeRanges).forEach(function(e){var t=r.timeRanges[e];r.detectEvictedFragments(e,t)})},e.prototype.onFragBuffered=function(e){this.detectPartialFragments(e.frag)},e.prototype.hasFragment=function(e){var t=this.getFragmentKey(e);return void 0!==this.fragments[t]},e.prototype.removeFragment=function(e){var t=this.getFragmentKey(e);delete this.fragments[t]},e.prototype.removeAllFragments=function(){this.fragments=Object.create(null)},e}(a.default);s.FragmentTracker=e}).call(this,r(2).Number)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default={search:function(e,t){for(var r=0,n=e.length-1,i=null,a=null;r<=n;){var o=t(a=e[i=(r+n)/2|0]);if(0<o)r=i+1;else{if(!(o<0))return a;n=i-1}}return null}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function s(){}return s.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},s.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},s.getID3Data=function(e,t){for(var r=t,n=0;s.isHeader(e,t);)n+=10,n+=s._readSize(e,t+6),s.isFooter(e,t+10)&&(n+=10),t+=n;if(0<n)return e.subarray(r,r+n)},s._readSize=function(e,t){var r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,r|=(127&e[t+2])<<7,r|=127&e[t+3]},s.getTimeStamp=function(e){for(var t=s.getID3Frames(e),r=0;r<t.length;r++){var n=t[r];if(s.isTimeStampFrame(n))return s._readTimeStamp(n)}},s.isTimeStampFrame=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},s._getFrameData=function(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),r=s._readSize(e,4);return{type:t,size:r,data:e.subarray(10,10+r)}},s.getID3Frames=function(e){for(var t=0,r=[];s.isHeader(e,t);){for(var n=s._readSize(e,t+6),i=(t+=10)+n;t+8<i;){var a=s._getFrameData(e.subarray(t)),o=s._decodeFrame(a);o&&r.push(o),t+=a.size+10}s.isFooter(e,t)&&(t+=10)}return r},s._decodeFrame=function(e){return"PRIV"===e.type?s._decodePrivFrame(e):"T"===e.type[0]?s._decodeTextFrame(e):"W"===e.type[0]?s._decodeURLFrame(e):void 0},s._readTimeStamp=function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),r=1&t[3],n=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return n/=45,r&&(n+=47721858.84),Math.round(n)}},s._decodePrivFrame=function(e){if(!(e.size<2)){var t=s._utf8ArrayToStr(e.data,!0),r=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:r.buffer}}},s._decodeTextFrame=function(e){if(!(e.size<2)){if("TXXX"===e.type){var t=1,r=s._utf8ArrayToStr(e.data.subarray(t));t+=r.length+1;var n=s._utf8ArrayToStr(e.data.subarray(t));return{key:e.type,info:r,data:n}}var i=s._utf8ArrayToStr(e.data.subarray(1));return{key:e.type,data:i}}},s._decodeURLFrame=function(e){if("WXXX"===e.type){if(e.size<2)return;var t=1,r=s._utf8ArrayToStr(e.data.subarray(t));t+=r.length+1;var n=s._utf8ArrayToStr(e.data.subarray(t));return{key:e.type,info:r,data:n}}var i=s._utf8ArrayToStr(e.data);return{key:e.type,data:i}},s._utf8ArrayToStr=function(e,t){void 0===t&&(t=!1);for(var r,n,i,a=e.length,o="",s=0;s<a;){if(0===(r=e[s++])&&t)return o;if(0!==r&&3!==r)switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(r);break;case 12:case 13:n=e[s++],o+=String.fromCharCode((31&r)<<6|63&n);break;case 14:n=e[s++],i=e[s++],o+=String.fromCharCode((15&r)<<12|(63&n)<<6|(63&i)<<0)}}return o},s}(),i=n._utf8ArrayToStr;t.utf8ArrayToStr=i,t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getMediaSource=function(){if("undefined"!=typeof window)return window.MediaSource||window.WebKitMediaSource}},function(e,o,s){(function(m){var n,e=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(o,"__esModule",{value:!0});var y=s(1),t=s(4),l=s(3),c=s(0),a=s(14),v=s(25),_=window.performance,b={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},i={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"},r=function(r){function g(e){var t=r.call(this,e,y.default.MANIFEST_LOADING,y.default.LEVEL_LOADING,y.default.AUDIO_TRACK_LOADING,y.default.SUBTITLE_TRACK_LOADING)||this;return t.loaders={},t}return e(g,r),Object.defineProperty(g,"ContextType",{get:function(){return b},enumerable:!0,configurable:!0}),Object.defineProperty(g,"LevelType",{get:function(){return i},enumerable:!0,configurable:!0}),g.canHaveQualityLevels=function(e){return e!==b.AUDIO_TRACK&&e!==b.SUBTITLE_TRACK},g.mapContextToLevelType=function(e){switch(e.type){case b.AUDIO_TRACK:return i.AUDIO;case b.SUBTITLE_TRACK:return i.SUBTITLE;default:return i.MAIN}},g.getResponseUrl=function(e,t){var r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r},g.prototype.createInternalLoader=function(e){var t=this.hls.config,r=t.pLoader,n=t.loader,i=new(r||n)(t);return e.loader=i,this.loaders[e.type]=i},g.prototype.getInternalLoader=function(e){return this.loaders[e.type]},g.prototype.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},g.prototype.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},g.prototype.destroy=function(){this.destroyInternalLoaders(),r.prototype.destroy.call(this)},g.prototype.onManifestLoading=function(e){this.load(e.url,{type:b.MANIFEST,level:0,id:null})},g.prototype.onLevelLoading=function(e){this.load(e.url,{type:b.LEVEL,level:e.level,id:e.id})},g.prototype.onAudioTrackLoading=function(e){this.load(e.url,{type:b.AUDIO_TRACK,level:null,id:e.id})},g.prototype.onSubtitleTrackLoading=function(e){this.load(e.url,{type:b.SUBTITLE_TRACK,level:null,id:e.id})},g.prototype.load=function(e,t){var r=this.hls.config;c.logger.debug("Loading playlist of type "+t.type+", level: "+t.level+", id: "+t.id);var n,i,a,o,s=this.getInternalLoader(t);if(s){var l=s.context;if(l&&l.url===e)return c.logger.trace("playlist request ongoing"),!1;c.logger.warn("aborting previous loader for type: "+t.type),s.abort()}switch(t.type){case b.MANIFEST:n=r.manifestLoadingMaxRetry,i=r.manifestLoadingTimeOut,a=r.manifestLoadingRetryDelay,o=r.manifestLoadingMaxRetryTimeout;break;case b.LEVEL:n=0,i=r.levelLoadingTimeOut;break;default:n=r.levelLoadingMaxRetry,i=r.levelLoadingTimeOut,a=r.levelLoadingRetryDelay,o=r.levelLoadingMaxRetryTimeout}s=this.createInternalLoader(t),t.url=e,t.responseType=t.responseType||"";var u={timeout:i,maxRetry:n,retryDelay:a,maxRetryDelay:o},f={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),s.load(t,u,f),!0},g.prototype.loadsuccess=function(e,t,r,n){if(void 0===n&&(n=null),r.isSidxRequest)return this._handleSidxRequest(e,r),void this._handlePlaylistLoaded(e,t,r,n);this.resetInternalLoader(r.type);var i=e.data;t.tload=_.now(),0===i.indexOf("#EXTM3U")?0<i.indexOf("#EXTINF:")||0<i.indexOf("#EXT-X-TARGETDURATION:")?this._handleTrackOrLevelPlaylist(e,t,r,n):this._handleMasterPlaylist(e,t,r,n):this._handleManifestParsingError(e,r,"no EXTM3U delimiter",n)},g.prototype.loaderror=function(e,t,r){void 0===r&&(r=null),this._handleNetworkError(t,r,!1,e)},g.prototype.loadtimeout=function(e,t,r){void 0===r&&(r=null),this._handleNetworkError(t,r,!0)},g.prototype._handleMasterPlaylist=function(e,t,r,n){var i=this.hls,a=e.data,o=g.getResponseUrl(e,r),s=v.default.parseMasterPlaylist(a,o);if(s.length){var l=s.map(function(e){return{id:e.attrs.AUDIO,codec:e.audioCodec}}),u=v.default.parseMasterPlaylistMedia(a,o,"AUDIO",l),f=v.default.parseMasterPlaylistMedia(a,o,"SUBTITLES");if(u.length){var d=!1;u.forEach(function(e){e.url||(d=!0)}),!1===d&&s[0].audioCodec&&!s[0].attrs.AUDIO&&(c.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),u.unshift({type:"main",name:"main"}))}i.trigger(y.default.MANIFEST_LOADED,{levels:s,audioTracks:u,subtitles:f,url:o,stats:t,networkDetails:n})}else this._handleManifestParsingError(e,r,"no level found in manifest",n)},g.prototype._handleTrackOrLevelPlaylist=function(e,t,r,n){var i=this.hls,a=r.id,o=r.level,s=r.type,l=g.getResponseUrl(e,r),u=m.isFinite(a)?a:0,f=m.isFinite(o)?o:u,d=g.mapContextToLevelType(r),c=v.default.parseLevelPlaylist(e.data,l,f,d,u);if(c.tload=t.tload,s===b.MANIFEST){var h={url:l,details:c};i.trigger(y.default.MANIFEST_LOADED,{levels:[h],audioTracks:[],url:l,stats:t,networkDetails:n})}if(t.tparsed=_.now(),c.needSidxRanges){var p=c.initSegment.url;this.load(p,{isSidxRequest:!0,type:s,level:o,levelDetails:c,id:a,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}else r.levelDetails=c,this._handlePlaylistLoaded(e,t,r,n)},g.prototype._handleSidxRequest=function(e,t){var r=a.default.parseSegmentIndex(new Uint8Array(e.data));if(r){var n=r.references,i=t.levelDetails;n.forEach(function(e,t){var r=e.info,n=i.fragments[t];0===n.byteRange.length&&(n.rawByteRange=String(1+r.end-r.start)+"@"+String(r.start))}),i.initSegment.rawByteRange=String(r.moovEndOffset)+"@0"}},g.prototype._handleManifestParsingError=function(e,t,r,n){this.hls.trigger(y.default.ERROR,{type:l.ErrorTypes.NETWORK_ERROR,details:l.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:e.url,reason:r,networkDetails:n})},g.prototype._handleNetworkError=function(e,t,r,n){var i,a;void 0===r&&(r=!1),void 0===n&&(n=null),c.logger.info("A network error occured while loading a "+e.type+"-type playlist");var o=this.getInternalLoader(e);switch(e.type){case b.MANIFEST:i=r?l.ErrorDetails.MANIFEST_LOAD_TIMEOUT:l.ErrorDetails.MANIFEST_LOAD_ERROR,a=!0;break;case b.LEVEL:i=r?l.ErrorDetails.LEVEL_LOAD_TIMEOUT:l.ErrorDetails.LEVEL_LOAD_ERROR,a=!1;break;case b.AUDIO_TRACK:i=r?l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,a=!1;break;default:a=!1}o&&(o.abort(),this.resetInternalLoader(e.type));var s={type:l.ErrorTypes.NETWORK_ERROR,details:i,fatal:a,url:o.url,loader:o,context:e,networkDetails:t};n&&(s.response=n),this.hls.trigger(y.default.ERROR,s)},g.prototype._handlePlaylistLoaded=function(e,t,r,n){var i=r.type,a=r.level,o=r.id,s=r.levelDetails;if(s.targetduration)if(g.canHaveQualityLevels(r.type))this.hls.trigger(y.default.LEVEL_LOADED,{details:s,level:a||0,id:o||0,stats:t,networkDetails:n});else switch(i){case b.AUDIO_TRACK:this.hls.trigger(y.default.AUDIO_TRACK_LOADED,{details:s,id:o,stats:t,networkDetails:n});break;case b.SUBTITLE_TRACK:this.hls.trigger(y.default.SUBTITLE_TRACK_LOADED,{details:s,id:o,stats:t,networkDetails:n})}else this._handleManifestParsingError(e,r,"invalid target duration",n)},g}(t.default);o.default=r}).call(this,s(2).Number)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var c=r(0),l=r(1),s=Math.pow(2,32)-1,n=function(){function g(e,t){this.observer=e,this.remuxer=t}return g.prototype.resetTimeStamp=function(e){this.initPTS=e},g.prototype.resetInitSegment=function(e,t,r,n){if(e&&e.byteLength){var i=this.initData=g.parseInitSegment(e);null==t&&(t="mp4a.40.5"),null==r&&(r="avc1.42e01e");var a={};i.audio&&i.video?a.audiovideo={container:"video/mp4",codec:t+","+r,initSegment:n?e:null}:(i.audio&&(a.audio={container:"audio/mp4",codec:t,initSegment:n?e:null}),i.video&&(a.video={container:"video/mp4",codec:r,initSegment:n?e:null})),this.observer.trigger(l.default.FRAG_PARSING_INIT_SEGMENT,{tracks:a})}else t&&(this.audioCodec=t),r&&(this.videoCodec=r)},g.probe=function(e){return 0<g.findBox({data:e,start:0,end:Math.min(e.length,16384)},["moof"]).length},g.bin2str=function(e){return String.fromCharCode.apply(null,e)},g.readUint16=function(e,t){e.data&&(t+=e.start,e=e.data);var r=e[t]<<8|e[t+1];return r<0?65536+r:r},g.readUint32=function(e,t){e.data&&(t+=e.start,e=e.data);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return r<0?4294967296+r:r},g.writeUint32=function(e,t,r){e.data&&(t+=e.start,e=e.data),e[t]=r>>24,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r},g.findBox=function(e,t){var r,n,i,a,o,s,l=[];if(e.data?(o=e.start,i=e.end,e=e.data):(o=0,i=e.byteLength),!t.length)return null;for(r=o;r<i;)s=1<(n=g.readUint32(e,r))?r+n:i,g.bin2str(e.subarray(r+4,r+8))===t[0]&&(1===t.length?l.push({data:e,start:r+8,end:s}):(a=g.findBox({data:e,start:r+8,end:s},t.slice(1))).length&&(l=l.concat(a))),r=s;return l},g.parseSegmentIndex=function(e){var t,r=g.findBox(e,["moov"])[0],n=r?r.end:null,i=0,a=g.findBox(e,["sidx"]);if(!a||!a[0])return null;t=[];var o=(a=a[0]).data[0],s=g.readUint32(a,i=0===o?8:16);i+=4,i+=0===o?8:16,i+=2;var l=a.end+0,u=g.readUint16(a,i);i+=2;for(var f=0;f<u;f++){var d=i,c=g.readUint32(a,d);d+=4;var h=2147483647&c;if(1==(2147483648&c)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");var p=g.readUint32(a,d);d+=4,t.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/s,start:l,end:l+h-1}}),l+=h,i=d+=4}return{earliestPresentationTime:0,timescale:s,version:o,referencesCount:u,references:t,moovEndOffset:n}},g.parseInitSegment=function(e){var d=[];return g.findBox(e,["moov","trak"]).forEach(function(e){var t=g.findBox(e,["tkhd"])[0];if(t){var r=t.data[t.start],n=0===r?12:20,i=g.readUint32(t,n),a=g.findBox(e,["mdia","mdhd"])[0];if(a){n=0===(r=a.data[a.start])?12:20;var o=g.readUint32(a,n),s=g.findBox(e,["mdia","hdlr"])[0];if(s){var l={soun:"audio",vide:"video"}[g.bin2str(s.data.subarray(s.start+8,s.start+12))];if(l){var u=g.findBox(e,["mdia","minf","stbl","stsd"]);if(u.length){u=u[0];var f=g.bin2str(u.data.subarray(u.start+12,u.start+16));c.logger.log("MP4Demuxer:"+l+":"+f+" found")}d[i]={timescale:o,type:l},d[l]={timescale:o,id:i}}}}}}),d},g.getStartDTS=function(i,e){var t,r,n;return t=g.findBox(e,["moof","traf"]),r=[].concat.apply([],t.map(function(n){return g.findBox(n,["tfhd"]).map(function(e){var t,r;return t=g.readUint32(e,4),r=i[t].timescale||9e4,g.findBox(n,["tfdt"]).map(function(e){var t,r;return t=e.data[e.start],r=g.readUint32(e,4),1===t&&(r*=Math.pow(2,32),r+=g.readUint32(e,8)),r})[0]/r})})),n=Math.min.apply(null,r),isFinite(n)?n:0},g.offsetStartDTS=function(n,e,o){g.findBox(e,["moof","traf"]).map(function(r){return g.findBox(r,["tfhd"]).map(function(e){var t=g.readUint32(e,4),a=n[t].timescale||9e4;g.findBox(r,["tfdt"]).map(function(e){var t=e.data[e.start],r=g.readUint32(e,4);if(0===t)g.writeUint32(e,4,r-o*a);else{r*=Math.pow(2,32),r+=g.readUint32(e,8),r-=o*a,r=Math.max(r,0);var n=Math.floor(r/(s+1)),i=Math.floor(r%(s+1));g.writeUint32(e,4,n),g.writeUint32(e,8,i)}})})})},g.prototype.append=function(e,t,r,n){var i=this.initData;i||(this.resetInitSegment(e,this.audioCodec,this.videoCodec,!1),i=this.initData);var a,o=this.initPTS;if(void 0===o){var s=g.getStartDTS(i,e);this.initPTS=o=s-t,this.observer.trigger(l.default.INIT_PTS_FOUND,{initPTS:o})}g.offsetStartDTS(i,e,o),a=g.getStartDTS(i,e),this.remuxer.remux(i.audio,i.video,null,null,a,r,n,e)},g.prototype.destroy=function(){},g}();t.default=n},function(e,i,a){(function(r){Object.defineProperty(i,"__esModule",{value:!0});var e=a(7),n=a(16),t=function(){function t(){var e;this._url=null,this._byteRange=null,this._decryptdata=null,this.tagList=[],this.programDateTime=null,this.rawProgramDateTime=null,this._elementaryStreams=((e={})[t.ElementaryStreamTypes.AUDIO]=!1,e[t.ElementaryStreamTypes.VIDEO]=!1,e)}return Object.defineProperty(t,"ElementaryStreamTypes",{get:function(){return{AUDIO:"audio",VIDEO:"video"}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){return!this._url&&this.relurl&&(this._url=e.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(e){this._url=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"byteRange",{get:function(){if(!this._byteRange&&!this.rawByteRange)return[];if(this._byteRange)return this._byteRange;var e=[];if(this.rawByteRange){var t=this.rawByteRange.split("@",2);if(1===t.length){var r=this.lastByteRangeEndOffset;e[0]=r||0}else e[0]=parseInt(t[1]);e[1]=parseInt(t[0])+e[0],this._byteRange=e}return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"byteRangeStartOffset",{get:function(){return this.byteRange[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"byteRangeEndOffset",{get:function(){return this.byteRange[1]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"decryptdata",{get:function(){return this._decryptdata||(this._decryptdata=this.fragmentDecryptdataFromLevelkey(this.levelkey,this.sn)),this._decryptdata},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"endProgramDateTime",{get:function(){if(!r.isFinite(this.programDateTime))return null;var e=r.isFinite(this.duration)?this.duration:0;return this.programDateTime+1e3*e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"encrypted",{get:function(){return!(!this.decryptdata.isQiniuDRM||null!==this.decryptdata.key)||!(!this.decryptdata||null===this.decryptdata.uri||null!==this.decryptdata.key)},enumerable:!0,configurable:!0}),t.prototype.addElementaryStream=function(e){this._elementaryStreams[e]=!0},t.prototype.hasElementaryStream=function(e){return!0===this._elementaryStreams[e]},t.prototype.createInitializationVector=function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t},t.prototype.fragmentDecryptdataFromLevelkey=function(e,t){var r=e;return e&&e.method&&e.uri&&!e.iv&&((r=new n.default).method=e.method,r.baseuri=e.baseuri,r.reluri=e.reluri,r.iv=this.createInitializationVector(t)),r},t}();i.default=t}).call(this,a(2).Number)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=function(){function e(){this.method=null,this.key=null,this.iv=null,this._uri=null,this.isQiniuDRM=!1}return Object.defineProperty(e.prototype,"uri",{get:function(){return!this._uri&&this.reluri&&(this._uri=n.buildAbsoluteURL(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri},enumerable:!0,configurable:!0}),e}();t.default=i},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n={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}};t.isCodecType=function(e,t){var r=n[t];return!!r&&!0===r[e.slice(0,4)]},t.isCodecSupportedInMp4=function(e,t){return window.MediaSource.isTypeSupported((t||"video")+'/mp4;codecs="'+e+'"')}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var g,w=r(1),T=r(3),m=r(19),A=r(36),x=r(14),L=r(37),R=r(42),I=r(43),C=r(46),n=r(6),i=r(0),a=n.getSelfScope();try{g=a.performance.now.bind(a.performance)}catch(e){i.logger.debug("Unable to use Performance API on this environment"),g=a.Date.now}var o=function(){function e(e,t,r,n){this.observer=e,this.typeSupported=t,this.config=r,this.vendor=n}return e.prototype.destroy=function(){var e=this.demuxer;e&&e.destroy()},e.prototype.push=function(e,r,n,i,a,o,s,l,u,f,d,c){var h=this;if(0<e.byteLength&&null!=r&&null!=r.key&&("AES-128"===r.method||r.isQiniuDRM)){var t=this.decrypter;null==t&&(t=this.decrypter=new m.default(this.observer,this.config));var p=g();t.decrypt(e,r.key.buffer,r.iv.buffer,function(e){var t=g();h.observer.trigger(w.default.FRAG_DECRYPTED,{stats:{tstart:p,tdecrypt:t}}),h.pushDecrypted(new Uint8Array(e),r,new Uint8Array(n),i,a,o,s,l,u,f,d,c)})}else this.pushDecrypted(new Uint8Array(e),r,new Uint8Array(n),i,a,o,s,l,u,f,d,c)},e.prototype.pushDecrypted=function(e,t,r,n,i,a,o,s,l,u,f,d){var c=this.demuxer;if(!c||(o||s)&&!this.probe(e)){for(var h=this.observer,p=this.typeSupported,g=this.config,m=[{demux:L.default,remux:I.default},{demux:x.default,remux:C.default},{demux:A.default,remux:I.default},{demux:R.default,remux:I.default}],y=0,v=m.length;y<v;y++){var _=m[y],b=_.demux.probe;if(b(e)){var S=this.remuxer=new _.remux(h,g,p,this.vendor);c=new _.demux(h,S,g,p),this.probe=b;break}}if(!c)return void h.trigger(w.default.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});this.demuxer=c}var E=this.remuxer;(o||s)&&(c.resetInitSegment(r,n,i,u),E.resetInitSegment()),o&&(c.resetTimeStamp(d),E.resetTimeStamp(d)),"function"==typeof c.setDecryptData&&c.setDecryptData(t),c.append(e,a,l,f)},e}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var s=r(33),l=r(34),u=r(35),a=r(3),f=r(0),o=r(1),d=r(6).getSelfScope(),n=function(){function e(e,t,r){var n=(void 0===r?{}:r).removePKCS7Padding,i=void 0===n||n;if(this.logEnabled=!0,this.observer=e,this.config=t,this.removePKCS7Padding=i)try{var a=d.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(e){}this.disableWebCrypto=!this.subtle}return e.prototype.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},e.prototype.decrypt=function(t,r,n,i){var a=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(f.logger.log("JS AES decrypt"),this.logEnabled=!1);var e=this.decryptor;e||(this.decryptor=e=new u.default),e.expandKey(r),i(e.decrypt(t,0,n,this.removePKCS7Padding))}else{this.logEnabled&&(f.logger.log("WebCrypto AES decrypt"),this.logEnabled=!1);var o=this.subtle;this.key!==r&&(this.key=r,this.fastAesKey=new l.default(o,r)),this.fastAesKey.expandKey().then(function(e){new s.default(o,n).decrypt(t,e).catch(function(e){a.onWebCryptoError(e,t,r,n,i)}).then(function(e){i(e)})}).catch(function(e){a.onWebCryptoError(e,t,r,n,i)})}},e.prototype.onWebCryptoError=function(e,t,r,n,i){this.config.enableSoftwareAES?(f.logger.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(t,r,n,i)):(f.logger.error("decrypting error : "+e.message),this.observer.trigger(o.default.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:e.message}))},e.prototype.destroy=function(){var e=this.decryptor;e&&(e.destroy(),this.decryptor=void 0)},e}();t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var c=r(0),h=r(3),p=r(1);function o(e,t,r,n){var i,a,o,s,l,u=navigator.userAgent.toLowerCase(),f=n,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];if(i=1+((192&t[r+2])>>>6),!((a=(60&t[r+2])>>>2)>d.length-1))return s=(1&t[r+2])<<2,s|=(192&t[r+3])>>>6,c.logger.log("manifest codec:"+n+",ADTS data:type:"+i+",sampleingIndex:"+a+"["+d[a]+"Hz],channelConfig:"+s),o=/firefox/i.test(u)?6<=a?(i=5,l=new Array(4),a-3):(i=2,l=new Array(2),a):-1!==u.indexOf("android")?(i=2,l=new Array(2),a):(i=5,l=new Array(4),n&&(-1!==n.indexOf("mp4a.40.29")||-1!==n.indexOf("mp4a.40.5"))||!n&&6<=a?a-3:((n&&-1!==n.indexOf("mp4a.40.2")&&(6<=a&&1===s||/vivaldi/i.test(u))||!n&&1===s)&&(i=2,l=new Array(2)),a)),l[0]=i<<3,l[0]|=(14&a)>>1,l[1]|=(1&a)<<7,l[1]|=s<<3,5===i&&(l[1]|=(14&o)>>1,l[2]=(1&o)<<7,l[2]|=8,l[3]=0),{config:l,samplerate:d[a],channelCount:s,codec:"mp4a.40."+i,manifestCodec:f};e.trigger(p.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+a})}function i(e,t){return 255===e[t]&&240==(246&e[t+1])}function l(e,t){return 1&e[t+1]?7:9}function u(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function f(e){return 9216e4/e}function d(e,t,r,n,i){var a,o,s=e.length;if(a=l(e,t),o=u(e,t),0<(o-=a)&&t+a+o<=s)return{headerLength:a,frameLength:o,stamp:r+n*i}}t.getAudioConfig=o,t.isHeaderPattern=i,t.getHeaderLength=l,t.getFullFrameLength=u,t.isHeader=function(e,t){return!!(t+1<e.length&&i(e,t))},t.probe=function(e,t){if(t+1<e.length&&i(e,t)){var r=l(e,t);t+5<e.length&&(r=u(e,t));var n=t+r;if(n===e.length||n+1<e.length&&i(e,n))return!0}return!1},t.initTrackConfig=function(e,t,r,n,i){if(!e.samplerate){var a=o(t,r,n,i);e.config=a.config,e.samplerate=a.samplerate,e.channelCount=a.channelCount,e.codec=a.codec,e.manifestCodec=a.manifestCodec,c.logger.log("parsed codec:"+e.codec+",rate:"+a.samplerate+",nb channel:"+a.channelCount)}},t.getFrameDuration=f,t.parseFrameHeader=d,t.appendFrame=function(e,t,r,n,i){var a=d(t,r,n,i,f(e.samplerate));if(a){var o=a.stamp,s=a.headerLength,l=a.frameLength,u={unit:t.subarray(r+s,r+s+l),pts:o,dts:o};return e.samples.push(u),e.len+=l,{sample:u,length:l+s}}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var g={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,r,n,i){if(!(r+24>t.length)){var a=this.parseHeader(t,r);if(a&&r+a.frameLength<=t.length){var o=n+i*(9e4*a.samplesPerFrame/a.sampleRate),s={unit:t.subarray(r,r+a.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(s),e.len+=a.frameLength,{sample:s,length:a.frameLength}}}},parseHeader:function(e,t){var r=e[t+1]>>3&3,n=e[t+1]>>1&3,i=e[t+2]>>4&15,a=e[t+2]>>2&3,o=e[t+2]>>1&1;if(1!==r&&0!==i&&15!==i&&3!==a){var s=3===r?3-n:3===n?3:4,l=1e3*g.BitratesMap[14*s+i-1],u=3===r?0:2===r?1:2,f=g.SamplingRateMap[3*u+a],d=e[t+3]>>6==3?1:2,c=g.SamplesCoefficients[r][n],h=g.BytesInSlot[n],p=8*c*h;return{sampleRate:f,channelCount:d,frameLength:parseInt(c*l/f+o,10)*h,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 r=this.parseHeader(e,t),n=4;r&&r.frameLength&&(n=r.frameLength);var i=t+n;if(i===e.length||i+1<e.length&&this.isHeaderPattern(e,i))return!0}return!1}};t.default=g},function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.trigger=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.emit.apply(this,[e,e].concat(t))},t}(r(47).EventEmitter);t.Observer=a},function(e,t,r){(function(h){Object.defineProperty(t,"__esModule",{value:!0});var p=r(0);function g(e,t,r){var n=e[t],i=e[r],a=i.startPTS;h.isFinite(a)?t<r?(n.duration=a-n.start,n.duration<0&&p.logger.warn("negative duration computed for frag "+n.sn+",level "+n.level+", there should be some duration drift between playlist and fragment!")):(i.duration=n.start-a,i.duration<0&&p.logger.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):i.start=t<r?n.start+n.duration:Math.max(n.start-i.duration,0)}function m(e,t,r,n,i,a){var o=r;if(h.isFinite(t.startPTS)){var s=Math.abs(t.startPTS-r);h.isFinite(t.deltaPTS)?t.deltaPTS=Math.max(s,t.deltaPTS):t.deltaPTS=s,o=Math.max(r,t.startPTS),r=Math.min(r,t.startPTS),n=Math.max(n,t.endPTS),i=Math.min(i,t.startDTS),a=Math.max(a,t.endDTS)}var l=r-t.start;t.start=t.startPTS=r,t.maxStartPTS=o,t.endPTS=n,t.startDTS=i,t.endDTS=a,t.duration=n-r;var u,f,d,c=t.sn;if(!e||c<e.startSN||c>e.endSN)return 0;for(u=c-e.startSN,(f=e.fragments)[u]=t,d=u;0<d;d--)g(f,d,d-1);for(d=u;d<f.length-1;d++)g(f,d,d+1);return e.PTSKnown=!0,l}t.addGroupId=function(e,t,r){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(r);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(r)}},t.updatePTS=g,t.updateFragPTSDTS=m,t.mergeDetails=function(e,t){var r,n=Math.max(e.startSN,t.startSN)-t.startSN,i=Math.min(e.endSN,t.endSN)-t.startSN,a=t.startSN-e.startSN,o=e.fragments,s=t.fragments,l=0;if(t.initSegment&&e.initSegment&&(t.initSegment=e.initSegment),i<n)t.PTSKnown=!1;else{for(var u=n;u<=i;u++){var f=o[a+u],d=s[u];d&&f&&(l=f.cc-d.cc,h.isFinite(f.startPTS)&&(d.start=d.startPTS=f.startPTS,d.endPTS=f.endPTS,d.duration=f.duration,d.backtracked=f.backtracked,d.dropped=f.dropped,r=d))}if(l)for(p.logger.log("discontinuity sliding from playlist, take drift into account"),u=0;u<s.length;u++)s[u].cc+=l;if(r)m(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS);else if(0<=a&&a<o.length){var c=o[a].start;for(u=0;u<s.length;u++)s[u].start+=c}t.PTSKnown=e.PTSKnown}}}).call(this,r(2).Number)},function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(7),o=r(3),E=r(13),w=r(28),T=r(29),A=r(9),x=r(30),L=r(56),R=r(57),s=r(59),I=r(0),l=r(60),u=r(1),f=function(b){function S(e){void 0===e&&(e={});var t=b.call(this)||this,r=S.DefaultConfig;if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(var n in r)n in e||(e[n]=r[n]);if(void 0!==e.liveMaxLatencyDurationCount&&e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==e.liveMaxLatencyDuration&&(e.liveMaxLatencyDuration<=e.liveSyncDuration||void 0===e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');I.enableLogs(e.debug),t.config=e,t._autoLevelCapping=-1;var i=t.abrController=new e.abrController(t),a=new e.bufferController(t),o=new e.capLevelController(t),s=new e.fpsController(t),l=new E.default(t),u=new w.default(t),f=new T.default(t),d=new R.default(t),c=t.levelController=new L.default(t),h=new A.FragmentTracker(t),p=[c,t.streamController=new x.default(t,h)],g=e.audioStreamController;g&&p.push(new g(t,h)),t.networkControllers=p;var m=[l,u,f,i,a,o,s,d,h];if(g=e.audioTrackController){var y=new g(t);t.audioTrackController=y,m.push(y)}if(g=e.subtitleTrackController){var v=new g(t);t.subtitleTrackController=v,m.push(v)}if(g=e.emeController){var _=new g(t);t.emeController=_,m.push(_)}return(g=e.subtitleStreamController)&&m.push(new g(t,h)),(g=e.timelineController)&&m.push(new g(t)),t.coreComponents=m,t}return i(S,b),Object.defineProperty(S,"version",{get:function(){return"1.2.3"},enumerable:!0,configurable:!0}),S.isSupported=function(){return s.isSupported()},Object.defineProperty(S,"Events",{get:function(){return u.default},enumerable:!0,configurable:!0}),Object.defineProperty(S,"ErrorTypes",{get:function(){return o.ErrorTypes},enumerable:!0,configurable:!0}),Object.defineProperty(S,"ErrorDetails",{get:function(){return o.ErrorDetails},enumerable:!0,configurable:!0}),Object.defineProperty(S,"DefaultConfig",{get:function(){return S.defaultConfig?S.defaultConfig:l.hlsDefaultConfig},set:function(e){S.defaultConfig=e},enumerable:!0,configurable:!0}),S.prototype.destroy=function(){I.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},S.prototype.attachMedia=function(e){I.logger.log("attachMedia"),this.media=e,this.trigger(u.default.MEDIA_ATTACHING,{media:e})},S.prototype.detachMedia=function(){I.logger.log("detachMedia"),this.trigger(u.default.MEDIA_DETACHING),this.media=null},S.prototype.loadSource=function(e){e=a.buildAbsoluteURL(window.location.href,e,{alwaysNormalize:!0}),I.logger.log("loadSource:"+e),this.url=e,this.trigger(u.default.MANIFEST_LOADING,{url:e})},S.prototype.startLoad=function(t){void 0===t&&(t=-1),I.logger.log("startLoad("+t+")"),this.networkControllers.forEach(function(e){e.startLoad(t)})},S.prototype.stopLoad=function(){I.logger.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},S.prototype.swapAudioCodec=function(){I.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},S.prototype.recoverMediaError=function(){I.logger.log("recoverMediaError");var e=this.media;this.detachMedia(),this.attachMedia(e)},Object.defineProperty(S.prototype,"levels",{get:function(){return this.levelController.levels},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"currentLevel",{get:function(){return this.streamController.currentLevel},set:function(e){I.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"nextLevel",{get:function(){return this.streamController.nextLevel},set:function(e){I.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"loadLevel",{get:function(){return this.levelController.level},set:function(e){I.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"nextLoadLevel",{get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"firstLevel",{get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){I.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"startLevel",{get:function(){return this.levelController.startLevel},set:function(e){I.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"autoLevelCapping",{get:function(){return this._autoLevelCapping},set:function(e){I.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"autoLevelEnabled",{get:function(){return-1===this.levelController.manualLevel},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"manualLevel",{get:function(){return this.levelController.manualLevel},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"minAutoLevel",{get:function(){for(var e=this.levels,t=this.config.minAutoBitrate,r=e?e.length:0,n=0;n<r;n++)if((e[n].realBitrate?Math.max(e[n].realBitrate,e[n].bitrate):e[n].bitrate)>t)return n;return 0},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"maxAutoLevel",{get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"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)},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"audioTracks",{get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"audioTrack",{get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"liveSyncPosition",{get:function(){return this.streamController.liveSyncPosition},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"subtitleTracks",{get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"subtitleTrack",{get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"subtitleDisplay",{get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)},enumerable:!0,configurable:!0}),S}(r(22).Observer);t.default=f},function(e,t,n){(function(D){Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),P=n(15),U=n(26),k=n(16),O=n(27),M=n(0),l=n(17),u=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,d=/#EXT-X-MEDIA:(.*)/g,F=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/|(?!#)([\S+ ?]+)/.source,/|#EXT-X-BYTERANGE:*(.+)/.source,/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/|#.*/.source].join(""),"g"),N=/(?:(?:#(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-(VERSION):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/,B=/\.(mp4|m4s|m4v|m4a)$/i,e=function(){function f(){}return f.findGroup=function(e,t){if(!e)return null;for(var r=null,n=0;n<e.length;n++){var i=e[n];i.id===t&&(r=i)}return r},f.convertAVC1ToAVCOTI=function(e){var t,r=e.split(".");return 2<r.length?(t=r.shift()+".",t+=parseInt(r.shift()).toString(16),t+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):t=e,t},f.resolve=function(e,t){return r.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},f.parseMasterPlaylist=function(e,t){var r,n=[];function i(n,i){["video","audio"].forEach(function(t){var r=n.filter(function(e){return l.isCodecType(e,t)});if(r.length){var e=r.filter(function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)});i[t+"Codec"]=0<e.length?e[0]:r[0],n=n.filter(function(e){return-1===r.indexOf(e)})}}),i.unknownCodecs=n}for(u.lastIndex=0;null!=(r=u.exec(e));){var a={},o=a.attrs=new O.default(r[1]);a.url=f.resolve(r[2],t);var s=o.decimalResolution("RESOLUTION");s&&(a.width=s.width,a.height=s.height),a.bitrate=o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),a.name=o.NAME,i([].concat((o.CODECS||"").split(/[ ,]+/)),a),a.videoCodec&&-1!==a.videoCodec.indexOf("avc1")&&(a.videoCodec=f.convertAVC1ToAVCOTI(a.videoCodec)),n.push(a)}return n},f.parseMasterPlaylistMedia=function(e,t,r,n){var i;void 0===n&&(n=[]);var a=[],o=0;for(d.lastIndex=0;null!==(i=d.exec(e));){var s={},l=new O.default(i[1]);if(l.TYPE===r){if(s.groupId=l["GROUP-ID"],s.name=l.NAME,s.type=r,s.default="YES"===l.DEFAULT,s.autoselect="YES"===l.AUTOSELECT,s.forced="YES"===l.FORCED,l.URI&&(s.url=f.resolve(l.URI,t)),s.lang=l.LANGUAGE,s.name||(s.name=s.lang),n.length){var u=f.findGroup(n,s.groupId);s.audioCodec=u?u.codec:n[0].codec}s.id=o++,a.push(s)}}return a},f.parseLevelPlaylist=function(e,t,r,n,i){var a,o,s,l,u=0,f=0,d=new U.default(t),c=new k.default,h=0,p=null,g=new P.default,m=null;for(F.lastIndex=0;null!==(a=F.exec(e));){var y=a[1];if(y){g.duration=parseFloat(y);var v=(" "+a[2]).slice(1);g.title=v||null,g.tagList.push(v?["INF",y,v]:["INF",y])}else if(a[3]){if(D.isFinite(g.duration)){var _=u++;g.type=n,g.start=f,g.levelkey=c,g.sn=_,g.level=r,g.cc=h,g.urlId=i,g.baseurl=t,g.relurl=(" "+a[3]).slice(1),l=p,(s=g).rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):l&&l.programDateTime&&(s.programDateTime=l.endProgramDateTime),D.isFinite(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null),d.fragments.push(g),f+=(p=g).duration,g=new P.default}}else if(a[4]){if(g.rawByteRange=(" "+a[4]).slice(1),p){var b=p.byteRangeEndOffset;b&&(g.lastByteRangeEndOffset=b)}}else if(a[5])g.rawProgramDateTime=(" "+a[5]).slice(1),g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]),null===m&&(m=d.fragments.length);else{for(a=a[0].match(N),o=1;o<a.length&&void 0===a[o];o++);var S=(" "+a[o+1]).slice(1),E=(" "+a[o+2]).slice(1);switch(a[o]){case"#":g.tagList.push(E?[S,E]:[S]);break;case"PLAYLIST-TYPE":d.type=S.toUpperCase();break;case"MEDIA-SEQUENCE":u=d.startSN=parseInt(S);break;case"TARGETDURATION":d.targetduration=parseFloat(S);break;case"VERSION":d.version=parseInt(S);break;case"EXTM3U":break;case"ENDLIST":d.live=!1;break;case"DIS":h++,g.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":h=parseInt(S);break;case"KEY":var w=S,T=new O.default(w),A=T.enumeratedString("METHOD"),x=T.URI,L=T.hexadecimalInteger("IV");A&&(c=new k.default,x&&0<=["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(A)?(c.method=A,c.baseuri=t,c.reluri=x,c.key=null,c.iv=L):A.startsWith("QINIU-PROTECT")&&(c.method=A,c.iv=L,c.key=null,c.isQiniuDRM=!0));break;case"START":var R=S,I=new O.default(R).decimalFloatingPoint("TIME-OFFSET");D.isFinite(I)&&(d.startTimeOffset=I);break;case"MAP":var C=new O.default(S);g.relurl=C.URI,g.rawByteRange=C.BYTERANGE,g.baseurl=t,g.level=r,g.type=n,g.sn="initSegment",d.initSegment=g,(g=new P.default).rawProgramDateTime=d.initSegment.rawProgramDateTime;break;default:M.logger.warn("line parsed but not handled: "+a)}}}return(g=p)&&!g.relurl&&(d.fragments.pop(),f-=g.duration),d.totalduration=f,d.averagetargetduration=f/d.fragments.length,d.endSN=u-1,d.startCC=d.fragments[0]?d.fragments[0].cc:0,d.endCC=h,!d.initSegment&&d.fragments.length&&d.fragments.every(function(e){return B.test(e.relurl)})&&(M.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(g=new P.default).relurl=d.fragments[0].relurl,g.baseurl=t,g.level=r,g.type=n,g.sn="initSegment",d.initSegment=g,d.needSidxRanges=!0),m&&function(e,t){for(var r=e[t],n=t-1;0<=n;n--){var i=e[n];i.programDateTime=r.programDateTime-1e3*i.duration,r=i}}(d.fragments,m),d},f}();t.default=e}).call(this,n(2).Number)},function(e,r,t){(function(t){Object.defineProperty(r,"__esModule",{value:!0});var e=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}return Object.defineProperty(e.prototype,"hasProgramDateTime",{get:function(){return!(!this.fragments[0]||!t.isFinite(this.fragments[0].programDateTime))},enumerable:!0,configurable:!0}),e}();r.default=e}).call(this,t(2).Number)},function(e,t,r){(function(n){Object.defineProperty(t,"__esModule",{value:!0});var i=/^(\d+)x(\d+)$/,a=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,e=function(){function r(e){for(var t in"string"==typeof e&&(e=r.parseAttrList(e)),e)e.hasOwnProperty(t)&&(this[t]=e[t])}return r.prototype.decimalInteger=function(e){var t=parseInt(this[e],10);return t>n.MAX_SAFE_INTEGER?1/0:t},r.prototype.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),n=0;n<t.length/2;n++)r[n]=parseInt(t.slice(2*n,2*n+2),16);return r}return null},r.prototype.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>n.MAX_SAFE_INTEGER?1/0:t},r.prototype.decimalFloatingPoint=function(e){return parseFloat(this[e])},r.prototype.enumeratedString=function(e){return this[e]},r.prototype.decimalResolution=function(e){var t=i.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},r.parseAttrList=function(e){var t,r={};for(a.lastIndex=0;null!==(t=a.exec(e));){var n=t[2];0===n.indexOf('"')&&n.lastIndexOf('"')===n.length-1&&(n=n.slice(1,-1)),r[t[1]]=n}return r},r}();t.default=e}).call(this,r(2).Number)},function(e,i,s){(function(h){var n,t=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(i,"__esModule",{value:!0});var o=s(1),e=s(4),a=s(3),p=s(0),r=function(n){function e(e){var t=n.call(this,e,o.default.FRAG_LOADING)||this;return t.loaders={},t}return t(e,n),e.prototype.destroy=function(){var e=this.loaders;for(var t in e){var r=e[t];r&&r.destroy()}this.loaders={},n.prototype.destroy.call(this)},e.prototype.onFragLoading=function(e){var t=e.frag,r=t.type,n=this.loaders,i=this.hls.config,a=i.fLoader,o=i.loader;t.loaded=0;var s,l,u,f=n[r];f&&(p.logger.warn("abort previous fragment loader for type: "+r),f.abort()),f=n[r]=t.loader=i.fLoader?new a(i):new o(i),s={url:t.url,frag:t,responseType:"arraybuffer",progressData:!1};var d=t.byteRangeStartOffset,c=t.byteRangeEndOffset;h.isFinite(d)&&h.isFinite(c)&&(s.rangeStart=d,s.rangeEnd=c),l={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:i.fragLoadingMaxRetryTimeout},u={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},f.load(s,l,u)},e.prototype.loadsuccess=function(e,t,r,n){void 0===n&&(n=null);var i=e.data,a=r.frag;a.loader=void 0,this.loaders[a.type]=void 0,this.hls.trigger(o.default.FRAG_LOADED,{payload:i,frag:a,stats:t,networkDetails:n})},e.prototype.loaderror=function(e,t,r){void 0===r&&(r=null);var n=t.frag,i=n.loader;i&&i.abort(),this.loaders[n.type]=void 0,this.hls.trigger(o.default.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t.frag,response:e,networkDetails:r})},e.prototype.loadtimeout=function(e,t,r){void 0===r&&(r=null);var n=t.frag,i=n.loader;i&&i.abort(),this.loaders[n.type]=void 0,this.hls.trigger(o.default.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t.frag,networkDetails:r})},e.prototype.loadprogress=function(e,t,r,n){void 0===n&&(n=null);var i=t.frag;i.loaded=e.loaded,this.hls.trigger(o.default.FRAG_LOAD_PROGRESS,{frag:i,stats:e,networkDetails:n})},e}(e.default);i.default=r}).call(this,s(2).Number)},function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var f=r(1),a=r(4),o=r(3),d=r(0),s=function(r){function e(e){var t=r.call(this,e,f.default.KEY_LOADING)||this;return t.loaders={},t.decryptkey=null,t.decrypturl=null,t.qiniuDRMKey=e.config.qiniuDRMKey,t}return i(e,r),e.prototype.destroy=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={},a.default.prototype.destroy.call(this)},e.prototype.onKeyLoading=function(e){if(this.qiniuDRMKey)this.loadQiniuDRMKey(e);else{var t=e.frag,r=t.type,n=this.loaders[r],i=t.decryptdata,a=i.uri;if(a!==this.decrypturl||null===this.decryptkey){var o,s,l,u=this.hls.config;n&&(d.logger.warn("abort previous key loader for type:"+r),n.abort()),t.loader=this.loaders[r]=new u.loader(u),this.decrypturl=a,this.decryptkey=null,o={url:a,frag:t,responseType:"arraybuffer"},s={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.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&&(i.key=this.decryptkey,this.hls.trigger(f.default.KEY_LOADED,{frag:t}))}},e.prototype.loadsuccess=function(e,t,r){var n=r.frag;this.decryptkey=n.decryptdata.key=new Uint8Array(e.data),n.loader=void 0,this.loaders[n.type]=void 0,this.hls.trigger(f.default.KEY_LOADED,{frag:n})},e.prototype.loaderror=function(e,t){var r=t.frag,n=r.loader;n&&n.abort(),this.loaders[t.type]=void 0,this.hls.trigger(f.default.ERROR,{type:o.ErrorTypes.NETWORK_ERROR,details:o.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:r,response:e})},e.prototype.loadtimeout=function(e,t){var r=t.frag,n=r.loader;n&&n.abort(),this.loaders[t.type]=void 0,this.hls.trigger(f.default.ERROR,{type:o.ErrorTypes.NETWORK_ERROR,details:o.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},e.prototype.loadQiniuDRMKey=function(e){var t=e.frag;this.decryptkey=t.decryptdata.key=new Uint8Array(this.qiniuDRMKey),t.loader=void 0,this.loaders[t.type]=void 0,this.hls.trigger(f.default.KEY_LOADED,{frag:t})},e}(a.default);t.default=s},function(e,l,b){(function(u){var n,t=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(l,"__esModule",{value:!0});var p=b(10),c=b(8),h=b(31),g=b(1),r=b(9),f=b(15),i=b(13),d=b(23),a=b(50),o=b(3),m=b(0),y=b(51),v=b(52),s=b(53),_=b(54),e=function(n){function e(e,t){var r=n.call(this,e,g.default.MEDIA_ATTACHED,g.default.MEDIA_DETACHING,g.default.MANIFEST_LOADING,g.default.MANIFEST_PARSED,g.default.LEVEL_LOADED,g.default.KEY_LOADED,g.default.FRAG_LOADED,g.default.FRAG_LOAD_EMERGENCY_ABORTED,g.default.FRAG_PARSING_INIT_SEGMENT,g.default.FRAG_PARSING_DATA,g.default.FRAG_PARSED,g.default.ERROR,g.default.AUDIO_TRACK_SWITCHING,g.default.AUDIO_TRACK_SWITCHED,g.default.BUFFER_CREATED,g.default.BUFFER_APPENDED,g.default.BUFFER_FLUSHED)||this;return r.fragmentTracker=t,r.config=e.config,r.audioCodecSwap=!1,r._state=_.State.STOPPED,r.stallReported=!1,r.gapController=null,r.lastAutoLevelEnabled=r.hls.autoLevelEnabled,r}return t(e,n),e.prototype.onHandlerDestroying=function(){this.stopLoad(),n.prototype.onHandlerDestroying.call(this)},e.prototype.onHandlerDestroyed=function(){this.state=_.State.STOPPED,this.fragmentTracker=null,n.prototype.onHandlerDestroyed.call(this)},e.prototype.startLoad=function(e){if(this.levels){var t=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var n=r.startLevel;-1===n&&(n=0,this.bitrateTest=!0),this.level=r.nextLoadLevel=n,this.loadedmetadata=!1}0<t&&-1===e&&(m.logger.log("override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=_.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this.forceStartLoad=!0,this.state=_.State.STOPPED},e.prototype.stopLoad=function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragmentTracker.removeFragment(e),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.clearInterval(),this.state=_.State.STOPPED,this.forceStartLoad=!1},e.prototype.doTick=function(){switch(this.state){case _.State.BUFFER_FLUSHING:this.fragLoadError=0;break;case _.State.IDLE:this._doTickIdle();break;case _.State.WAITING_LEVEL:var e=this.levels[this.level];e&&e.details&&(this.state=_.State.IDLE);break;case _.State.FRAG_LOADING_WAITING_RETRY:var t=window.performance.now(),r=this.retryDate;(!r||r<=t||this.media&&this.media.seeking)&&(m.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=_.State.IDLE);break;case _.State.ERROR:case _.State.STOPPED:case _.State.FRAG_LOADING:case _.State.PARSING:case _.State.PARSED:case _.State.ENDED:}this._checkBuffer(),this._checkFragmentChanged()},e.prototype._doTickIdle=function(){var e=this.hls,t=e.config,r=this.media;if(void 0!==this.levelLastLoaded&&(r||!this.startFragRequested&&t.startFragPrefetch)){var n;n=this.loadedmetadata?r.currentTime:this.nextLoadPosition;var i=e.nextLoadLevel,a=this.levels[i];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=c.BufferHelper.bufferInfo(this.mediaBuffer?this.mediaBuffer:r,n,t.maxBufferHole),u=l.len;if(!(o<=u)){m.logger.trace("buffer length of "+u.toFixed(3)+" is below max of "+o.toFixed(3)+". checking for more payload ..."),this.level=e.nextLoadLevel=i;var f=a.details;if(!f||f.live&&this.levelLastLoaded!==i)this.state=_.State.WAITING_LEVEL;else{if(this._streamEnded(l,f)){var d={};return this.altAudio&&(d.type="video"),this.hls.trigger(g.default.BUFFER_EOS,d),void(this.state=_.State.ENDED)}this._fetchPayloadOrEos(n,l,f)}}}}},e.prototype._fetchPayloadOrEos=function(e,t,r){var n=this.fragPrevious,i=this.level,a=r.fragments,o=a.length;if(0!==o){var s,l=a[0].start,u=a[o-1].start+a[o-1].duration,f=t.end;if(r.initSegment&&!r.initSegment.data)s=r.initSegment;else if(r.live){var d=this.config.initialLiveManifestSize;if(o<d)return void m.logger.warn("Can not start playback of a level, reason: not enough fragments "+o+" < "+d);if(null===(s=this._ensureFragmentAtLivePoint(r,f,l,u,n,a,o)))return}else f<l&&(s=a[0]);s||(s=this._findFragment(l,n,o,a,f,u,r)),s&&(s.encrypted?(m.logger.log("Loading key for "+s.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+i),this._loadKey(s)):(m.logger.log("Loading "+s.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+i+", currentTime:"+e.toFixed(3)+",bufferEnd:"+f.toFixed(3)),this._loadFragment(s)))}},e.prototype._ensureFragmentAtLivePoint=function(e,t,r,n,i,a,o){var s,l=this.hls.config,u=this.media,f=void 0!==l.liveMaxLatencyDuration?l.liveMaxLatencyDuration:l.liveMaxLatencyDurationCount*e.targetduration;if(t<Math.max(r-l.maxFragLookUpTolerance,n-f)){var d=this.liveSyncPosition=this.computeLivePosition(r,e);m.logger.log("buffer end: "+t.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+d.toFixed(3)),t=d,u&&u.readyState&&u.duration>d&&(u.currentTime=d),this.nextLoadPosition=d}if(e.PTSKnown&&n<t&&u&&u.readyState)return null;if(this.startFragRequested&&!e.PTSKnown){if(i)if(e.hasProgramDateTime)m.logger.log("live playlist, switching playlist, load frag with same PDT: "+i.programDateTime),s=v.findFragmentByPDT(a,i.endProgramDateTime,l.maxFragLookUpTolerance);else{var c=i.sn+1;if(c>=e.startSN&&c<=e.endSN){var h=a[c-e.startSN];i.cc===h.cc&&(s=h,m.logger.log("live playlist, switching playlist, load frag with next SN: "+s.sn))}s||(s=p.default.search(a,function(e){return i.cc-e.cc}))&&m.logger.log("live playlist, switching playlist, load frag with same CC: "+s.sn)}s||(s=a[Math.min(o-1,Math.round(o/2))],m.logger.log("live playlist, switching playlist, unknown, load middle frag : "+s.sn))}return s},e.prototype._findFragment=function(e,t,r,n,i,a,o){var s,l=this.hls.config;if(i<a){var u=i>a-l.maxFragLookUpTolerance?0:l.maxFragLookUpTolerance;s=v.findFragmentByPTS(t,n,i,u)}else s=n[r-1];if(s){var f=s.sn-o.startSN,d=t&&s.level===t.level,c=n[f-1],h=n[f+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&&f?(s=c,m.logger.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this")):(s=h,m.logger.log("SN just loaded, load next one: "+s.sn,s))}else s=null;else s.backtracked&&(h&&h.backtracked?(m.logger.warn("Already backtracked from fragment "+h.sn+", will not backtrack to fragment "+s.sn+". Loading fragment "+h.sn),s=h):(m.logger.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),s.dropped=0,c?(s=c).backtracked=!0:f&&(s=null)))}return s},e.prototype._loadKey=function(e){this.state=_.State.KEY_LOADING,this.hls.trigger(g.default.KEY_LOADING,{frag:e})},e.prototype._loadFragment=function(e){var t=this.fragmentTracker.getState(e);this.fragCurrent=e,this.startFragRequested=!0,u.isFinite(e.sn)&&!e.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),e.backtracked||t===r.FragmentState.NOT_LOADED||t===r.FragmentState.PARTIAL?(e.autoLevel=this.hls.autoLevelEnabled,e.bitrateTest=this.bitrateTest,this.hls.trigger(g.default.FRAG_LOADING,{frag:e}),this.demuxer||(this.demuxer=new h.default(this.hls,"main")),this.state=_.State.FRAG_LOADING):t===r.FragmentState.APPENDING&&this._reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e)},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},set:function(e){if(this.state!==e){var t=this.state;this._state=e,m.logger.log("main stream:"+t+"->"+e),this.hls.trigger(g.default.STREAM_STATE_TRANSITION,{previousState:t,nextState:e})}},enumerable:!0,configurable:!0}),e.prototype.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,i.default.LevelType.MAIN)},Object.defineProperty(e.prototype,"currentLevel",{get:function(){var e=this.media;if(e){var t=this.getBufferedFrag(e.currentTime);if(t)return t.level}return-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextBufferedFrag",{get:function(){var e=this.media;return e?this.followingBufferedFrag(this.getBufferedFrag(e.currentTime)):null},enumerable:!0,configurable:!0}),e.prototype.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.endPTS+.5):null},Object.defineProperty(e.prototype,"nextLevel",{get:function(){var e=this.nextBufferedFrag;return e?e.level:-1},enumerable:!0,configurable:!0}),e.prototype._checkFragmentChanged=function(){var e,t,r=this.media;if(r&&r.readyState&&(!1===r.seeking||1===r.readyState)&&((t=r.currentTime)>this.lastCurrentTime&&(this.lastCurrentTime=t),c.BufferHelper.isBuffered(r,t)?e=this.getBufferedFrag(t):c.BufferHelper.isBuffered(r,t+.1)&&(e=this.getBufferedFrag(t+.1)),e)){var n=e;if(this.hls.autoLevelEnabled!==this.lastAutoLevelEnabled&&(this.hls.trigger(g.default.LEVEL_SWITCHED,{level:n.level}),this.lastAutoLevelEnabled=this.hls.autoLevelEnabled),n!==this.fragPlaying){this.hls.trigger(g.default.FRAG_CHANGED,{frag:n});var i=n.level;this.lastAutoLevelEnabled=this.hls.autoLevelEnabled,this.fragPlaying&&this.fragPlaying.level===i&&this.fragPlaying.autoLevel===n.autoLevel||this.hls.trigger(g.default.LEVEL_SWITCHED,{level:i}),this.fragPlaying=n}}},e.prototype.immediateLevelSwitch=function(){if(m.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var e=this.media,t=void 0;e?(t=e.paused,e.pause()):t=!0,this.previouslyPaused=t}var r=this.fragCurrent;r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(0,u.POSITIVE_INFINITY)},e.prototype.immediateLevelSwitchEnd=function(){var e=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,c.BufferHelper.isBuffered(e,e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())},e.prototype.nextLevelSwitch=function(){var e=this.media;if(e&&e.readyState){var t,r=void 0,n=void 0;if((t=this.getBufferedFrag(e.currentTime))&&1<t.startPTS&&this.flushMainBuffer(0,t.startPTS-1),e.paused)r=0;else{var i=this.hls.nextLoadLevel,a=this.levels[i],o=this.fragLastKbps;r=o&&this.fragCurrent?this.fragCurrent.duration*a.bitrate/(1e3*o)+1:0}if((n=this.getBufferedFrag(e.currentTime+r))&&(n=this.followingBufferedFrag(n))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(n.maxStartPTS,u.POSITIVE_INFINITY)}}},e.prototype.flushMainBuffer=function(e,t){this.state=_.State.BUFFER_FLUSHING;var r={startOffset:e,endOffset:t};this.altAudio&&(r.type="video"),this.hls.trigger(g.default.BUFFER_FLUSHING,r)},e.prototype.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 r=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition),this.gapController=new s.default(r,t,this.fragmentTracker,this.hls)},e.prototype.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(m.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.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},e.prototype.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:void 0;u.isFinite(t)&&m.logger.log("media seeked to "+t.toFixed(3)),this.tick()},e.prototype.onManifestLoading=function(){m.logger.log("trigger BUFFER_RESET"),this.hls.trigger(g.default.BUFFER_RESET),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0},e.prototype.onManifestParsed=function(e){var t,r=!1,n=!1;e.levels.forEach(function(e){(t=e.audioCodec)&&(-1!==t.indexOf("mp4a.40.2")&&(r=!0),-1!==t.indexOf("mp4a.40.5")&&(n=!0))}),this.audioCodecSwitch=r&&n,this.audioCodecSwitch&&m.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1;var i=this.config;(i.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(i.startPosition)},e.prototype.onLevelLoaded=function(e){var t=e.details,r=e.level,n=this.levels[this.levelLastLoaded],i=this.levels[r],a=t.totalduration,o=0;if(m.logger.log("level "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+a),t.live){var s=i.details;s&&0<t.fragments.length?(d.mergeDetails(s,t),o=t.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,s),t.PTSKnown&&u.isFinite(o)?m.logger.log("live playlist sliding:"+o.toFixed(3)):(m.logger.log("live playlist - outdated PTS, unknown sliding"),y.alignStream(this.fragPrevious,n,t))):(m.logger.log("live playlist - first load, unknown sliding"),t.PTSKnown=!1,y.alignStream(this.fragPrevious,n,t))}else t.PTSKnown=!1;if(i.details=t,this.levelLastLoaded=r,this.hls.trigger(g.default.LEVEL_UPDATED,{details:t,level:r}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var l=t.startTimeOffset;u.isFinite(l)?(l<0&&(m.logger.log("negative start time offset "+l+", count from end of last fragment"),l=o+a+l),m.logger.log("start time offset found in playlist, adjust startPosition to "+l),this.startPosition=l):t.live?(this.startPosition=this.computeLivePosition(o,t),m.logger.log("configure startPosition to "+this.startPosition)):this.startPosition=0,this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===_.State.WAITING_LEVEL&&(this.state=_.State.IDLE),this.tick()},e.prototype.onKeyLoaded=function(){this.state===_.State.KEY_LOADING&&(this.state=_.State.IDLE,this.tick())},e.prototype.onFragLoaded=function(e){var t=this.fragCurrent,r=this.hls,n=this.levels,i=this.media,a=e.frag;if(this.state===_.State.FRAG_LOADING&&t&&"main"===a.type&&a.level===t.level&&a.sn===t.sn){var o=e.stats,s=n[t.level],l=s.details;if(this.bitrateTest=!1,this.stats=o,m.logger.log("Loaded "+t.sn+" of ["+l.startSN+" ,"+l.endSN+"],level "+t.level),a.bitrateTest&&r.nextLoadLevel)this.state=_.State.IDLE,this.startFragRequested=!1,o.tparsed=o.tbuffered=window.performance.now(),r.trigger(g.default.FRAG_BUFFERED,{stats:o,frag:t,id:"main"}),this.tick();else if("initSegment"===a.sn)this.state=_.State.IDLE,o.tparsed=o.tbuffered=window.performance.now(),l.initSegment.data=e.payload,r.trigger(g.default.FRAG_BUFFERED,{stats:o,frag:t,id:"main"}),this.tick();else{m.logger.log("Parsing "+t.sn+" of ["+l.startSN+" ,"+l.endSN+"],level "+t.level+", cc "+t.cc),this.state=_.State.PARSING,this.pendingBuffering=!0,this.appended=!1,a.bitrateTest&&(a.bitrateTest=!1,this.fragmentTracker.onFragLoaded({frag:a}));var u=!(i&&i.seeking)&&(l.PTSKnown||!l.live),f=l.initSegment?l.initSegment.data:[],d=this._getAudioCodec(s);(this.demuxer=this.demuxer||new h.default(this.hls,"main")).push(e.payload,f,d,s.videoCodec,t,l.totalduration,u)}}this.fragLoadError=0},e.prototype.onFragParsingInitSegment=function(e){var t=this.fragCurrent,r=e.frag;if(t&&"main"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===_.State.PARSING){var n=e.tracks,i=void 0,a=void 0;if(n.audio&&this.altAudio&&delete n.audio,a=n.audio){var o=this.levels[this.level].audioCodec,s=navigator.userAgent.toLowerCase();o&&this.audioCodecSwap&&(m.logger.log("swapping playlist audio codec"),o=-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==a.metadata.channelCount&&-1===s.indexOf("firefox")&&(o="mp4a.40.5"),-1!==s.indexOf("android")&&"audio/mpeg"!==a.container&&(o="mp4a.40.2",m.logger.log("Android: force audio codec to "+o)),a.levelCodec=o,a.id=e.id}for(i in(a=n.video)&&(a.levelCodec=this.levels[this.level].videoCodec,a.id=e.id),this.hls.trigger(g.default.BUFFER_CODECS,n),n){a=n[i],m.logger.log("main track:"+i+",container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var l=a.initSegment;l&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(g.default.BUFFER_APPENDING,{type:i,data:l,parent:"main",content:"initSegment"}))}this.tick()}},e.prototype.onFragParsingData=function(t){var r=this,e=this.fragCurrent,n=t.frag;if(e&&"main"===t.id&&n.sn===e.sn&&n.level===e.level&&("audio"!==t.type||!this.altAudio)&&this.state===_.State.PARSING){var i=this.levels[this.level],a=e;if(u.isFinite(t.endPTS)||(t.endPTS=t.startPTS+e.duration,t.endDTS=t.startDTS+e.duration),!0===t.hasAudio&&a.addElementaryStream(f.default.ElementaryStreamTypes.AUDIO),!0===t.hasVideo&&a.addElementaryStream(f.default.ElementaryStreamTypes.VIDEO),m.logger.log("Parsed "+t.type+",PTS:["+t.startPTS.toFixed(3)+","+t.endPTS.toFixed(3)+"],DTS:["+t.startDTS.toFixed(3)+"/"+t.endDTS.toFixed(3)+"],nb:"+t.nb+",dropped:"+(t.dropped||0)),"video"===t.type)if(a.dropped=t.dropped,a.dropped)if(a.backtracked)m.logger.warn("Already backtracked on this fragment, appending with the gap",a.sn);else{var o=i.details;if(!o||a.sn!==o.startSN)return m.logger.warn("missing video frame(s), backtracking fragment",a.sn),this.fragmentTracker.removeFragment(a),a.backtracked=!0,this.nextLoadPosition=t.startPTS,this.state=_.State.IDLE,this.fragPrevious=a,void this.tick();m.logger.warn("missing video frame(s) on first frag, appending with gap",a.sn)}else a.backtracked=!1;var s=d.updateFragPTSDTS(i.details,a,t.startPTS,t.endPTS,t.startDTS,t.endDTS),l=this.hls;l.trigger(g.default.LEVEL_PTS_UPDATED,{details:i.details,level:this.level,drift:s,type:t.type,start:t.startPTS,end:t.endPTS}),[t.data1,t.data2].forEach(function(e){e&&e.length&&r.state===_.State.PARSING&&(r.appended=!0,r.pendingBuffering=!0,l.trigger(g.default.BUFFER_APPENDING,{type:t.type,data:e,parent:"main",content:"data"}))}),this.tick()}},e.prototype.onFragParsed=function(e){var t=this.fragCurrent,r=e.frag;t&&"main"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===_.State.PARSING&&(this.stats.tparsed=window.performance.now(),this.state=_.State.PARSED,this._checkAppendedParsed())},e.prototype.onAudioTrackSwitching=function(e){var t=!!e.url,r=e.id;if(!t){if(this.mediaBuffer!==this.media){m.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var n=this.fragCurrent;n.loader&&(m.logger.log("switching to main audio track, cancel main fragment load"),n.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=_.State.IDLE}var i=this.hls;i.trigger(g.default.BUFFER_FLUSHING,{startOffset:0,endOffset:u.POSITIVE_INFINITY,type:"audio"}),i.trigger(g.default.AUDIO_TRACK_SWITCHED,{id:r}),this.altAudio=!1}},e.prototype.onAudioTrackSwitched=function(e){var t=e.id,r=!!this.hls.audioTracks[t].url;if(r){var n=this.videoBuffer;n&&this.mediaBuffer!==n&&(m.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()},e.prototype.onBufferCreated=function(e){var t,r,n=e.tracks,i=!1;for(var a in n){var o=n[a];"main"===o.id?(t=o,"video"===(r=a)&&(this.videoBuffer=n[a].buffer)):i=!0}this.mediaBuffer=i&&t?(m.logger.log("alternate track found, use "+r+".buffered to schedule main fragment loading"),t.buffer):this.media},e.prototype.onBufferAppended=function(e){if("main"===e.parent){var t=this.state;t!==_.State.PARSING&&t!==_.State.PARSED||(this.pendingBuffering=0<e.pending,this._checkAppendedParsed())}},e.prototype._checkAppendedParsed=function(){if(!(this.state!==_.State.PARSED||this.appended&&this.pendingBuffering)){var e=this.fragCurrent;if(e){var t=this.mediaBuffer?this.mediaBuffer:this.media;m.logger.log("main buffered : "+a.default.toString(t.buffered)),this.fragPrevious=e;var r=this.stats;r.tbuffered=window.performance.now(),this.fragLastKbps=Math.round(8*r.total/(r.tbuffered-r.tfirst)),this.hls.trigger(g.default.FRAG_BUFFERED,{stats:r,frag:e,id:"main"}),this.state=_.State.IDLE}this.tick()}},e.prototype.onError=function(e){var t=e.frag||this.fragCurrent;if(!t||"main"===t.type){var r=!!this.media&&c.BufferHelper.isBuffered(this.media,this.media.currentTime)&&c.BufferHelper.isBuffered(this.media,this.media.currentTime+.5);switch(e.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:if(!e.fatal)if(this.fragLoadError+1<=this.config.fragLoadingMaxRetry){var n=Math.min(Math.pow(2,this.fragLoadError)*this.config.fragLoadingRetryDelay,this.config.fragLoadingMaxRetryTimeout);m.logger.warn("mediaController: frag loading failed, retry in "+n+" ms"),this.retryDate=window.performance.now()+n,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.fragLoadError++,this.state=_.State.FRAG_LOADING_WAITING_RETRY}else m.logger.error("mediaController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=_.State.ERROR;break;case o.ErrorDetails.LEVEL_LOAD_ERROR:case o.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==_.State.ERROR&&(e.fatal?(this.state=_.State.ERROR,m.logger.warn("streamController: "+e.details+",switch to "+this.state+" state ...")):e.levelRetry||this.state!==_.State.WAITING_LEVEL||(this.state=_.State.IDLE));break;case o.ErrorDetails.BUFFER_FULL_ERROR:"main"!==e.parent||this.state!==_.State.PARSING&&this.state!==_.State.PARSED||(r?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=_.State.IDLE):(m.logger.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,u.POSITIVE_INFINITY)))}}},e.prototype._reduceMaxBufferLength=function(e){var t=this.config;return t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,m.logger.warn("main:reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},e.prototype._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)}},e.prototype.onFragLoadEmergencyAborted=function(){this.state=_.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},e.prototype.onBufferFlushed=function(){var e=this.mediaBuffer?this.mediaBuffer:this.media;e&&this.fragmentTracker.detectEvictedFragments(f.default.ElementaryStreamTypes.VIDEO,e.buffered),this.state=_.State.IDLE,this.fragPrevious=null},e.prototype.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},e.prototype.computeLivePosition=function(e,t){var r=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*t.targetduration;return e+Math.max(0,t.totalduration-r)},e.prototype._seekToStartPos=function(){var e=this.media,t=e.currentTime,r=e.seeking?t:this.startPosition;t!==r&&(m.logger.log("target start position not buffered, seek to buffered.start(0) "+r+" from current time "+t+" "),e.currentTime=r)},e.prototype._getAudioCodec=function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&(m.logger.log("swapping playlist audio codec"),t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),t},Object.defineProperty(e.prototype,"liveSyncPosition",{get:function(){return this._liveSyncPosition},set:function(e){this._liveSyncPosition=e},enumerable:!0,configurable:!0}),e}(_.default);l.default=e}).call(this,b(2).Number)},function(e,n,i){(function(y){Object.defineProperty(n,"__esModule",{value:!0});var u=i(32),f=i(1),d=i(18),v=i(0),c=i(3),e=i(12),t=i(6),h=i(22),p=t.getSelfScope(),g=e.getMediaSource(),r=function(){function e(r,e){var n=this;this.hls=r,this.id=e;var t=this.observer=new h.Observer,i=r.config,a=function(e,t){(t=t||{}).frag=n.frag,t.id=n.id,r.trigger(e,t)};t.on(f.default.FRAG_DECRYPTED,a),t.on(f.default.FRAG_PARSING_INIT_SEGMENT,a),t.on(f.default.FRAG_PARSING_DATA,a),t.on(f.default.FRAG_PARSED,a),t.on(f.default.ERROR,a),t.on(f.default.FRAG_PARSING_METADATA,a),t.on(f.default.FRAG_PARSING_USERDATA,a),t.on(f.default.INIT_PTS_FOUND,a);var o={mp4:g.isTypeSupported("video/mp4"),mpeg:g.isTypeSupported("audio/mpeg"),mp3:g.isTypeSupported('audio/mp4; codecs="mp3"')},s=navigator.vendor;if(i.enableWorker&&"undefined"!=typeof Worker){v.logger.log("demuxing in webworker");var l=void 0;try{l=this.w=u(48),this.onwmsg=this.onWorkerMessage.bind(this),l.addEventListener("message",this.onwmsg),l.onerror=function(e){r.trigger(f.default.ERROR,{type:c.ErrorTypes.OTHER_ERROR,details:c.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:e.message+" ("+e.filename+":"+e.lineno+")"}})},l.postMessage({cmd:"init",typeSupported:o,vendor:s,id:e,config:JSON.stringify(i)})}catch(r){v.logger.warn("Error in worker:",r),v.logger.error("Error while initializing DemuxerWorker, fallback on DemuxerInline"),l&&p.URL.revokeObjectURL(l.objectURL),this.demuxer=new d.default(t,o,i,s),this.w=void 0}}else this.demuxer=new d.default(t,o,i,s)}return e.prototype.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 r=this.observer;r&&(r.removeAllListeners(),this.observer=null)},e.prototype.push=function(e,t,r,n,i,a,o,s){var l=this.w,u=y.isFinite(i.startPTS)?i.startPTS:i.start,f=i.decryptdata,d=this.frag,c=!(d&&i.cc===d.cc),h=!(d&&i.level===d.level),p=d&&i.sn===d.sn+1,g=!h&&p;if(c&&v.logger.log(this.id+":discontinuity detected"),h&&v.logger.log(this.id+":switch detected"),this.frag=i,l)l.postMessage({cmd:"demux",data:e,decryptdata:f,initSegment:t,audioCodec:r,videoCodec:n,timeOffset:u,discontinuity:c,trackSwitch:h,contiguous:g,duration:a,accurateTimeOffset:o,defaultInitPTS:s},e instanceof ArrayBuffer?[e]:[]);else{var m=this.demuxer;m&&m.push(e,f,t,r,n,u,c,h,g,a,o,s)}},e.prototype.onWorkerMessage=function(e){var t=e.data,r=this.hls;switch(t.event){case"init":p.URL.revokeObjectURL(this.w.objectURL);break;case f.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,r.trigger(t.event,t.data)}},e}();n.default=r}).call(this,i(2).Number)},function(e,t,h){function l(r){var n={};function i(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=r,i.c=n,i.i=function(e){return e},i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var e=i(i.s=ENTRY_MODULE);return e.default||e}var p="[\\.|\\-|\\+|\\w|/|@]+",g="\\((/\\*.*?\\*/)?s?.*?("+p+").*?\\)";function m(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function c(e,t,r){var n={};n[r]=[];var i=t.toString(),a=i.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return n;for(var o,s=a[1],l=new RegExp("(\\\\n|\\W)"+m(s)+g,"g");o=l.exec(i);)"dll-reference"!==o[3]&&n[r].push(o[3]);for(l=new RegExp("\\("+m(s)+'\\("(dll-reference\\s('+p+'))"\\)\\)'+g,"g");o=l.exec(i);)e[o[2]]||(n[r].push(o[1]),e[o[2]]=h(o[1]).m),n[o[2]]=n[o[2]]||[],n[o[2]].push(o[4]);for(var u,f=Object.keys(n),d=0;d<f.length;d++)for(var c=0;c<n[f[d]].length;c++)u=n[f[d]][c],isNaN(1*u)||(n[f[d]][c]=1*n[f[d]][c]);return n}function y(r){return Object.keys(r).reduce(function(e,t){return e||0<r[t].length},!1)}e.exports=function(e,t){t=t||{};var r={main:h.m},n=t.all?{main:Object.keys(r.main)}:function(e,t){for(var r={main:[t]},n={main:[]},i={main:{}};y(r);)for(var a=Object.keys(r),o=0;o<a.length;o++){var s=a[o],l=r[s].pop();if(i[s]=i[s]||{},!i[s][l]&&e[s][l]){i[s][l]=!0,n[s]=n[s]||[],n[s].push(l);for(var u=c(e,e[s][l],s),f=Object.keys(u),d=0;d<f.length;d++)r[f[d]]=r[f[d]]||[],r[f[d]]=r[f[d]].concat(u[f[d]])}}return n}(r,e),i="";Object.keys(n).filter(function(e){return"main"!==e}).forEach(function(t){for(var e=0;n[t][e];)e++;n[t].push(e),r[t][e]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",i=i+"var "+t+" = ("+l.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+n[t].map(function(e){return JSON.stringify(e)+": "+r[t][e].toString()}).join(",")+"});\n"}),i=i+"new (("+l.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+n.main.map(function(e){return JSON.stringify(e)+": "+r.main[e].toString()}).join(",")+"}))(self);";var a=new window.Blob([i],{type:"text/javascript"});if(t.bare)return a;var o=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(a),s=new window.Worker(o);return s.objectURL=o,s}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=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}();t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=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}();t.default=n},function(e,t,r){function k(e){var t=e.byteLength,r=t&&new DataView(e).getUint8(t-1);return r?e.slice(0,t-r):e}Object.defineProperty(t,"__esModule",{value:!0}),t.removePadding=k;var n=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()}return e.prototype.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),r=new Uint32Array(4),n=0;n<4;n++)r[n]=t.getUint32(4*n);return r},e.prototype.initTable=function(){var e=this.sBox,t=this.invSBox,r=this.subMix,n=r[0],i=r[1],a=r[2],o=r[3],s=this.invSubMix,l=s[0],u=s[1],f=s[2],d=s[3],c=new Uint32Array(256),h=0,p=0,g=0;for(g=0;g<256;g++)c[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var m=p^p<<1^p<<2^p<<3^p<<4;m=m>>>8^255&m^99,e[h]=m,t[m]=h;var y=c[h],v=c[y],_=c[v],b=257*c[m]^16843008*m;n[h]=b<<24|b>>>8,i[h]=b<<16|b>>>16,a[h]=b<<8|b>>>24,o[h]=b,b=16843009*_^65537*v^257*y^16843008*h,l[m]=b<<24|b>>>8,u[m]=b<<16|b>>>16,f[m]=b<<8|b>>>24,d[m]=b,h?(h=y^c[c[c[_^y]]],p^=c[c[p]]):h=p=1}},e.prototype.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,n=0;n<t.length&&r;)r=t[n]===this.key[n],n++;if(!r){this.key=t;var i=this.keySize=t.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);var a,o,s,l,u=this.ksRows=4*(i+6+1),f=this.keySchedule=new Uint32Array(u),d=this.invKeySchedule=new Uint32Array(u),c=this.sBox,h=this.rcon,p=this.invSubMix,g=p[0],m=p[1],y=p[2],v=p[3];for(a=0;a<u;a++)a<i?s=f[a]=t[a]:(l=s,a%i==0?(l=c[(l=l<<8|l>>>24)>>>24]<<24|c[l>>>16&255]<<16|c[l>>>8&255]<<8|c[255&l],l^=h[a/i|0]<<24):6<i&&a%i==4&&(l=c[l>>>24]<<24|c[l>>>16&255]<<16|c[l>>>8&255]<<8|c[255&l]),f[a]=s=(f[a-i]^l)>>>0);for(o=0;o<u;o++)a=u-o,l=3&o?f[a]:f[a-4],d[o]=o<4||a<=4?l:g[c[l>>>24]]^m[c[l>>>16&255]]^y[c[l>>>8&255]]^v[c[255&l]],d[o]=d[o]>>>0}},e.prototype.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},e.prototype.decrypt=function(e,t,r,n){for(var i,a,o,s,l,u,f,d,c,h,p,g,m,y,v=this.keySize+6,_=this.invKeySchedule,b=this.invSBox,S=this.invSubMix,E=S[0],w=S[1],T=S[2],A=S[3],x=this.uint8ArrayToUint32Array_(r),L=x[0],R=x[1],I=x[2],C=x[3],D=new Int32Array(e),P=new Int32Array(D.length),U=this.networkToHostOrderSwap;t<D.length;){for(c=U(D[t]),h=U(D[t+1]),p=U(D[t+2]),g=U(D[t+3]),l=c^_[0],u=g^_[1],f=p^_[2],d=h^_[3],m=4,y=1;y<v;y++)i=E[l>>>24]^w[u>>16&255]^T[f>>8&255]^A[255&d]^_[m],a=E[u>>>24]^w[f>>16&255]^T[d>>8&255]^A[255&l]^_[m+1],o=E[f>>>24]^w[d>>16&255]^T[l>>8&255]^A[255&u]^_[m+2],s=E[d>>>24]^w[l>>16&255]^T[u>>8&255]^A[255&f]^_[m+3],l=i,u=a,f=o,d=s,m+=4;i=b[l>>>24]<<24^b[u>>16&255]<<16^b[f>>8&255]<<8^b[255&d]^_[m],a=b[u>>>24]<<24^b[f>>16&255]<<16^b[d>>8&255]<<8^b[255&l]^_[m+1],o=b[f>>>24]<<24^b[d>>16&255]<<16^b[l>>8&255]<<8^b[255&u]^_[m+2],s=b[d>>>24]<<24^b[l>>16&255]<<16^b[u>>8&255]<<8^b[255&f]^_[m+3],m+=3,P[t]=U(i^L),P[t+1]=U(s^R),P[t+2]=U(o^I),P[t+3]=U(a^C),L=c,R=h,I=p,C=g,t+=4}return n?k(P.buffer):P.buffer},e.prototype.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}();t.default=n},function(e,t,r){(function(p){Object.defineProperty(t,"__esModule",{value:!0});var g=r(20),m=r(0),y=r(11),e=function(){function e(e,t,r){this.observer=e,this.config=r,this.remuxer=t}return e.prototype.resetInitSegment=function(e,t,r,n){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:t,duration:n,inputTimeScale:9e4}},e.prototype.resetTimeStamp=function(){},e.probe=function(e){if(!e)return!1;for(var t=(y.default.getID3Data(e,0)||[]).length,r=e.length;t<r;t++)if(g.probe(e,t))return m.logger.log("ADTS sync word found !"),!0;return!1},e.prototype.append=function(e,t,r,n){for(var i=this._audioTrack,a=y.default.getID3Data(e,0)||[],o=y.default.getTimeStamp(a),s=p.isFinite(o)?90*o:9e4*t,l=0,u=s,f=e.length,d=a.length,c=[{pts:u,dts:u,data:a}];d<f-1;)if(g.isHeader(e,d)&&d+5<f){g.initTrackConfig(i,this.observer,e,d,i.manifestCodec);var h=g.appendFrame(i,e,d,s,l);if(!h){m.logger.log("Unable to parse AAC frame");break}d+=h.length,u=h.sample.pts,l++}else y.default.isHeader(e,d)?(a=y.default.getID3Data(e,d),c.push({pts:u,dts:u,data:a}),d+=a.length):d++;this.remuxer.remux(i,{samples:[]},{samples:c,inputTimeScale:9e4},{samples:[]},t,r,n)},e.prototype.destroy=function(){},e}();t.default=e}).call(this,r(2).Number)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var m=r(20),s=r(21),U=r(1),T=r(38),n=r(39),k=r(0),O=r(3),i=r(40),a={video:1,audio:2,id3:3,text:4},o=function(){function P(e,t,r,n){this.observer=e,this.config=r,this.typeSupported=n,this.remuxer=t,this.sampleAes=null,this.g711buffer=[]}return P.prototype.setDecryptData=function(e){null!=e&&null!=e.key&&"SAMPLE-AES"===e.method?this.sampleAes=new n.default(this.observer,this.config,e,this.discardEPB):this.sampleAes=null},P.probe=function(e){var t=P._syncOffset(e);return!(t<0||(t&&k.logger.warn("MPEG2-TS detected but first sync word found @ offset "+t+", junk ahead ?"),0))},P._syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),r=0;r<t;){if(71===e[r]&&71===e[r+188]&&71===e[r+376])return r;r++}return-1},P.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:a[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0,dropped:"video"===e?0:void 0,isAAC:"audio"===e||void 0,duration:"audio"===e?t:void 0}},P.prototype.resetInitSegment=function(e,t,r,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=P.createTrack("video",n),this._audioTrack=P.createTrack("audio",n),this._id3Track=P.createTrack("id3",n),this._txtTrack=P.createTrack("text",n),this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=t,this.videoCodec=r,this._duration=n,this.g711Codec&&(this.g711Codec.needUpdateConfig=!0,this.g711Codec.overlap_pcm=void 0)},P.prototype.resetTimeStamp=function(){},P.prototype.append=function(e,t,r,n){var i,a,o,s,l,u=e.length,f=!1;this.contiguous=r;var d=this.pmtParsed,c=this._avcTrack,h=this._audioTrack,p=this._id3Track,g=c.pid,m=h.pid,y=p.pid,v=this._pmtId,_=c.pesData,b=h.pesData,S=p.pesData,E=this._parsePAT,w=this._parsePMT,T=this._parsePES,A=this._parseAVCPES.bind(this),x=this._parseAACPES.bind(this),L=this._parseG711PES.bind(this),R=this._parseMPEGPES.bind(this),I=this._parseID3PES.bind(this),C=P._syncOffset(e);for(u-=(u+C)%188,i=C;i<u;i+=188)if(71===e[i]){if(a=!!(64&e[i+1]),o=((31&e[i+1])<<8)+e[i+2],1<(48&e[i+3])>>4){if((s=i+5+e[i+4])===i+188)continue}else s=i+4;switch(o){case g:a&&(_&&(l=T(_))&&void 0!==l.pts&&A(l,!1),_={data:[],size:0}),_&&(_.data.push(e.subarray(s,i+188)),_.size+=i+188-s);break;case m:a&&(b&&(l=T(b))&&void 0!==l.pts&&(h.isAAC&&!h.g711Config?x(l):h.g711Config?L(l):R(l)),b={data:[],size:0}),b&&(b.data.push(e.subarray(s,i+188)),b.size+=i+188-s);break;case y:a&&(S&&(l=T(S))&&void 0!==l.pts&&I(l),S={data:[],size:0}),S&&(S.data.push(e.subarray(s,i+188)),S.size+=i+188-s);break;case 0:a&&(s+=e[s]+1),v=this._pmtId=E(e,s);break;case v:a&&(s+=e[s]+1);var D=w(e,s,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);0<(g=D.avc)&&(c.pid=g),0<(m=D.audio)&&(h.pid=m,h.isAAC=D.isAAC,h.g711Config=D.g711Config),0<(y=D.id3)&&(p.pid=y),f&&!d&&(k.logger.log("reparse from beginning"),f=!1,i=C-188),d=this.pmtParsed=!0;break;case 17:case 8191:break;default:f=!0}}else this.observer.trigger(U.default.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});_&&(l=T(_))&&void 0!==l.pts?(A(l,!0),c.pesData=null):c.pesData=_,b&&(l=T(b))&&void 0!==l.pts?(h.isAAC&!h.g711Config?x(l):h.g711Config?L(l,!0):R(l),h.pesData=null):(b&&b.size&&k.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=b),S&&(l=T(S))&&void 0!==l.pts?(I(l),p.pesData=null):p.pesData=S,null==this.sampleAes?this.remuxer.remux(h,c,p,this._txtTrack,t,r,n):this.decryptAndRemux(h,c,p,this._txtTrack,t,r,n)},P.prototype.decryptAndRemux=function(e,t,r,n,i,a,o){if(e.samples&&e.isAAC){var s=this;this.sampleAes.decryptAacSamples(e.samples,0,function(){s.decryptAndRemuxAvc(e,t,r,n,i,a,o)})}else this.decryptAndRemuxAvc(e,t,r,n,i,a,o)},P.prototype.decryptAndRemuxAvc=function(e,t,r,n,i,a,o){if(t.samples){var s=this;this.sampleAes.decryptAvcSamples(t.samples,0,0,function(){s.remuxer.remux(e,t,r,n,i,a,o)})}else this.remuxer.remux(e,t,r,n,i,a,o)},P.prototype.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},P.prototype._parsePAT=function(e,t){return(31&e[t+10])<<8|e[t+11]},P.prototype._parsePMT=function(e,t,r,n){var i,a,o={audio:-1,avc:-1,id3:-1,isAAC:!0};for(i=t+3+((15&e[t+1])<<8|e[t+2])-4,t+=12+((15&e[t+10])<<8|e[t+11]);t<i;){switch(a=(31&e[t+1])<<8|e[t+2],e[t]){case 207:if(!n){k.logger.log("unkown stream type:"+e[t]);break}case 15:-1===o.audio&&(o.audio=a);break;case 6:if(-1===o.audio&&(o.audio=a,o.isAAC=!1),15!==e[t+5]||4!==e[t+6]){k.logger.warn("G.711: unkonwn private data");break}if(o.g711Config={},117===e[t+7])o.g711Config.ulaw=!0;else{if(97!==e[t+7]){k.logger.warn("G.711: can not parse private data");break}o.g711Config.alaw=!0}o.g711Config.sampleRate=e[t+8]<<8|e[t+9],k.logger.log("G711 Config:"+JSON.stringify(o.g711Config));case 21:-1===o.id3&&(o.id3=a);break;case 219:if(!n){k.logger.log("unkown stream type:"+e[t]);break}case 27:-1===o.avc&&(o.avc=a);break;case 3:case 4:r?-1===o.audio&&(o.audio=a,o.isAAC=!1):k.logger.log("MPEG audio found, not supported in this browser for now");break;case 36:k.logger.warn("HEVC stream type found, not supported for now");break;default:k.logger.log("unkown stream type:"+e[t])}t+=5+((15&e[t+3])<<8|e[t+4])}return o},P.prototype._parsePES=function(e){var t,r,n,i,a,o,s,l,u=0,f=e.data;if(!e||0===e.size)return null;for(;f[0].length<19&&1<f.length;){var d=new Uint8Array(f[0].length+f[1].length);d.set(f[0]),d.set(f[1],f[0].length),f[0]=d,f.splice(1,1)}if(1!==((t=f[0])[0]<<16)+(t[1]<<8)+t[2])return null;if((n=(t[4]<<8)+t[5])&&n>e.size-6)return null;192&(r=t[7])&&(4294967295<(o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2)&&(o-=8589934592),64&r?(4294967295<(s=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)&&(s-=8589934592),54e5<o-s&&(k.logger.warn(Math.round((o-s)/9e4)+"s delta between PTS and DTS, align them"),o=s)):s=o),l=(i=t[8])+9,e.size-=l,a=new Uint8Array(e.size);for(var c=0,h=f.length;c<h;c++){var p=(t=f[c]).byteLength;if(l){if(p<l){l-=p;continue}t=t.subarray(l),p-=l,l=0}a.set(t,u),u+=p}return n&&(n-=i+3),{data:a,pts:o,dts:s,len:n}},P.prototype.pushAccesUnit=function(e,t){if(e.units.length&&e.frame){var r=t.samples,n=r.length;!this.config.forceKeyFrameOnDiscontinuity||!0===e.key||t.sps&&(n||this.contiguous)?(e.id=n,r.push(e)):t.dropped++}e.debug.length&&k.logger.log(e.pts+"/"+e.dts+":"+e.debug)},P.prototype._parseAVCPES=function(p,e){var g,m,y,v=this,_=this._avcTrack,t=this._parseAVCNALu(p.data),b=this.avcSample,S=!1,E=this.pushAccesUnit.bind(this),w=function(e,t,r,n){return{key:e,pts:t,dts:r,units:[],debug:n}};p.data=null,b&&t.length&&!_.audFound&&(E(b,_),b=this.avcSample=w(!1,p.pts,p.dts,"")),t.forEach(function(e){switch(e.type){case 1:m=!0,b||(b=v.avcSample=w(!0,p.pts,p.dts,"")),b.frame=!0;var t=e.data;if(S&&4<t.length){var r=new T.default(t).readSliceType();2!==r&&4!==r&&7!==r&&9!==r||(b.key=!0)}break;case 5:m=!0,b||(b=v.avcSample=w(!0,p.pts,p.dts,"")),b.key=!0,b.frame=!0;break;case 6:m=!0,(g=new T.default(v.discardEPB(e.data))).readUByte();for(var n=0,i=0,a=!1,o=0;!a&&1<g.bytesAvailable;){for(n=0;n+=o=g.readUByte(),255===o;);for(i=0;i+=o=g.readUByte(),255===o;);if(4===n&&0!==g.bytesAvailable){if(a=!0,181===g.readUByte()&&49===g.readUShort()&&1195456820===g.readUInt()&&3===g.readUByte()){var s=g.readUByte(),l=31&s,u=[s,g.readUByte()];for(y=0;y<l;y++)u.push(g.readUByte()),u.push(g.readUByte()),u.push(g.readUByte());v._insertSampleInOrder(v._txtTrack.samples,{type:3,pts:p.pts,bytes:u})}}else if(i<g.bytesAvailable)for(y=0;y<i;y++)g.readUByte()}break;case 7:if(S=m=!0,!_.sps){var f=(g=new T.default(e.data)).readSPS();_.width=f.width,_.height=f.height,_.pixelRatio=f.pixelRatio,_.sps=[e.data],_.duration=v._duration;var d=e.data.subarray(1,4),c="avc1.";for(y=0;y<3;y++){var h=d[y].toString(16);h.length<2&&(h="0"+h),c+=h}_.codec=c}break;case 8:m=!0,_.pps||(_.pps=[e.data]);break;case 9:m=!1,_.audFound=!0,b&&E(b,_),b=v.avcSample=w(!1,p.pts,p.dts,"");break;case 12:m=!1;break;default:m=!1,b&&(b.debug+="unknown NAL "+e.type+" ")}b&&m&&b.units.push(e)}),e&&b&&(E(b,_),this.avcSample=null)},P.prototype._insertSampleInOrder=function(e,t){var r=e.length;if(0<r){if(t.pts>=e[r-1].pts)e.push(t);else for(var n=r-1;0<=n;n--)if(t.pts<e[n].pts){e.splice(n,0,t);break}}else e.push(t)},P.prototype._getLastNalUnit=function(){var e,t=this.avcSample;if(!t||0===t.units.length){var r=this._avcTrack.samples;t=r[r.length-1]}if(t){var n=t.units;e=n[n.length-1]}return e},P.prototype._parseAVCNALu=function(e){var t,r,n,i,a=0,o=e.byteLength,s=this._avcTrack,l=s.naluState||0,u=l,f=[],d=-1;for(-1===l&&(i=31&e[d=0],l=0,a=1);a<o;)if(t=e[a++],l)if(1!==l)if(t)if(1===t){var c,h;0<=d?(n={data:e.subarray(d,a-l-1),type:i},f.push(n)):(c=this._getLastNalUnit())&&(u&&a<=4-u&&c.state&&(c.data=c.data.subarray(0,c.data.byteLength-u)),0<(r=a-l-1)&&((h=new Uint8Array(c.data.byteLength+r)).set(c.data,0),h.set(e.subarray(0,r),c.data.byteLength),c.data=h)),l=a<o?(i=31&e[d=a],0):-1}else l=0;else l=3;else l=t?0:2;else l=t?0:1;return 0<=d&&0<=l&&(n={data:e.subarray(d,o),type:i,state:l},f.push(n)),0===f.length&&(c=this._getLastNalUnit())&&((h=new Uint8Array(c.data.byteLength+e.byteLength)).set(c.data,0),h.set(e,c.data.byteLength),c.data=h),s.naluState=l,f},P.prototype.discardEPB=function(e){for(var t,r,n=e.byteLength,i=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(i.push(a+2),a+=2):a++;if(0===i.length)return e;t=n-i.length,r=new Uint8Array(t);var o=0;for(a=0;a<t;o++,a++)o===i[0]&&(o++,i.shift()),r[a]=e[o];return r},P.prototype._parseG711PES=function(e,t){if(this.g711Codec||(this.g711Codec=new i.default(this.config.g711WasmModule)),this.g711Codec.config&&!this.g711Codec.needUpdateConfig||(this.g711Codec.initTrackConfig(this._audioTrack,this.observer,this.audioCodec),this.g711Codec.needUpdateConfig=!1),this.g711Data&&t&&(this.g711Data.lastPts=e.pts),this.g711Data){var r=new Uint8Array(this.g711Data.data.length+e.data.length);r.set(this.g711Data.data,0),r.set(e.data,this.g711Data.data.length),this.g711Data.data=r,this.g711Data.g711FrameCount+=1}else this.g711Data={data:e.data,pts:e.pts,g711FrameCount:1};if(t){var n=this.g711Codec.getPCMData(this.g711Data);this.g711Codec.appendPCMSamples(this._audioTrack,n,this.g711Data.pts,this.g711Data.lastPts,this.g711Data.g711FrameCount),this.g711Data=void 0,this.g711Codec.config=void 0}},P.prototype._parseAACPES=function(e){var t,r,n,i,a,o=this._audioTrack,s=e.data,l=e.pts,u=this.aacOverFlow,f=this.aacLastPTS;if(u){var d=new Uint8Array(u.byteLength+s.byteLength);d.set(u,0),d.set(s,u.byteLength),s=d}for(n=0,a=s.length;n<a-1&&!m.isHeader(s,n);n++);if(n){var c=void 0,h=void 0;if(h=n<a-1?(c="AAC PES did not start with ADTS header,offset:"+n,!1):(c="no ADTS header found in AAC PES",!0),k.logger.warn("parsing error:"+c),this.observer.trigger(U.default.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:h,reason:c}),h)return}if(m.initTrackConfig(o,this.observer,s,n,this.audioCodec),r=0,t=m.getFrameDuration(o.samplerate),u&&f){var p=f+t;1<Math.abs(p-l)&&(k.logger.log("AAC: align PTS for overlapping frames by "+Math.round((p-l)/90)),l=p)}for(;n<a;)if(m.isHeader(s,n)&&n+5<a){var g=m.appendFrame(o,s,n,l,r);if(!g)break;n+=g.length,i=g.sample.pts,r++}else n++;u=n<a?s.subarray(n,a):null,this.aacOverFlow=u,this.aacLastPTS=i},P.prototype._parseMPEGPES=function(e){for(var t=e.data,r=t.length,n=0,i=0,a=e.pts;i<r;)if(s.default.isHeader(t,i)){var o=s.default.appendFrame(this._audioTrack,t,i,a,n);if(!o)break;i+=o.length,n++}else i++},P.prototype._parseID3PES=function(e){this._id3Track.samples.push(e)},P}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),i=function(){function e(e){this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}return e.prototype.loadWord=function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,n=new Uint8Array(4),i=Math.min(4,t);if(0===i)throw new Error("no bytes available");n.set(e.subarray(r,r+i)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i},e.prototype.skipBits=function(e){var t;this.bitsAvailable>e||(e-=this.bitsAvailable,e-=(t=e>>3)>>3,this.bytesAvailable-=t,this.loadWord()),this.word<<=e,this.bitsAvailable-=e},e.prototype.readBits=function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return 32<e&&n.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,0<this.bitsAvailable?this.word<<=t:0<this.bytesAvailable&&this.loadWord(),0<(t=e-t)&&this.bitsAvailable?r<<t|this.readBits(t):r},e.prototype.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()},e.prototype.skipUEG=function(){this.skipBits(1+this.skipLZ())},e.prototype.skipEG=function(){this.skipBits(1+this.skipLZ())},e.prototype.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},e.prototype.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},e.prototype.readBoolean=function(){return 1===this.readBits(1)},e.prototype.readUByte=function(){return this.readBits(8)},e.prototype.readUShort=function(){return this.readBits(16)},e.prototype.readUInt=function(){return this.readBits(32)},e.prototype.skipScalingList=function(e){var t,r=8,n=8;for(t=0;t<e;t++)0!==n&&(n=(r+this.readEG()+256)%256),r=0===n?r:n},e.prototype.readSPS=function(){var e,t,r,n,i,a,o,s=0,l=0,u=0,f=0,d=this.readUByte.bind(this),c=this.readBits.bind(this),h=this.readUEG.bind(this),p=this.readBoolean.bind(this),g=this.skipBits.bind(this),m=this.skipEG.bind(this),y=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);if(d(),e=d(),c(5),g(3),d(),y(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var _=h();if(3===_&&g(1),y(),y(),g(1),p())for(a=3!==_?8:12,o=0;o<a;o++)p()&&v(o<6?16:64)}y();var b=h();if(0===b)h();else if(1===b)for(g(1),m(),m(),t=h(),o=0;o<t;o++)m();y(),g(1),r=h(),n=h(),0===(i=c(1))&&g(1),g(1),p()&&(s=h(),l=h(),u=h(),f=h());var S=[1,1];if(p()&&p())switch(d()){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:S=[d()<<8|d(),d()<<8|d()]}return{width:Math.ceil(16*(r+1)-2*s-2*l),height:(2-i)*(n+1)*16-(i?2:4)*(u+f),pixelRatio:S}},e.prototype.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}();t.default=i},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(19),n=function(){function e(e,t,r,n){this.decryptdata=r,this.discardEPB=n,this.decrypter=new i.default(e,t,{removePKCS7Padding:!1})}return e.prototype.decryptBuffer=function(e,t){this.decrypter.decrypt(e,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,t)},e.prototype.decryptAacSample=function(t,r,n,i){var a=t[r].unit,e=a.subarray(16,a.length-a.length%16),o=e.buffer.slice(e.byteOffset,e.byteOffset+e.length),s=this;this.decryptBuffer(o,function(e){e=new Uint8Array(e),a.set(e,16),i||s.decryptAacSamples(t,r+1,n)})},e.prototype.decryptAacSamples=function(e,t,r){for(;;t++){if(t>=e.length)return void r();if(!(e[t].unit.length<32)){var n=this.decrypter.isSync();if(this.decryptAacSample(e,t,r,n),!n)return}}},e.prototype.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t),n=0,i=32;i<=e.length-16;i+=160,n+=16)r.set(e.subarray(i,i+16),n);return r},e.prototype.getAvcDecryptedUnit=function(e,t){t=new Uint8Array(t);for(var r=0,n=32;n<=e.length-16;n+=160,r+=16)e.set(t.subarray(r,r+16),n);return e},e.prototype.decryptAvcSample=function(t,r,n,i,a,o){var s=this.discardEPB(a.data),e=this.getAvcEncryptedData(s),l=this;this.decryptBuffer(e.buffer,function(e){a.data=l.getAvcDecryptedUnit(s,e),o||l.decryptAvcSamples(t,r,n+1,i)})},e.prototype.decryptAvcSamples=function(e,t,r,n){for(;;t++,r=0){if(t>=e.length)return void n();for(var i=e[t].units;!(r>=i.length);r++){var a=i[r];if(!(a.length<=48||1!==a.type&&5!==a.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(e,t,r,n,a,o),!o)return}}}},e}();t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),i=r(41),a=function(){function e(e){this.Module=e}return e.prototype.getPCMData=function(e){if(this.config)return this.config.ulaw?i.decodeUlaw(e.data):i.decodeAlaw(e.data);n.logger.warn("can not find g711 config")},e.prototype.appendPCMSamples=function(e,t,r,n,i){var a;this.overlap_pcm?((a=new Uint8Array(t.length+this.overlap_pcm.length)).set(this.overlap_pcm,0),a.set(t,this.overlap_pcm.length),r-=this.overlap_pcm.length/2*9e4/e.samplerate):a=t;var o=a.length%2048,s=a.subarray(0,a.length-o);this.overlap_pcm=a.subarray(a.length-o,a.length),this._encodePCMtoAAC(s,e,r)},e.prototype._encodePCMtoAAC=function(e,t,r,n,i){var a=this.Module,o=e,s=a._malloc(o.length*o.BYTES_PER_ELEMENT);a.HEAPU8.set(o,s);var l=new Uint8Array(o.length),u=a._malloc(l.length*o.BYTES_PER_ELEMENT);a.HEAPU8.set(l,u);var f=new Uint32Array(Math.round(o.length/1024)),d=a._malloc(f.length*f.BYTES_PER_ELEMENT);a.HEAPU32.set(f,d);var c=new Uint32Array(1);c[0]=this.config.sampleRate;for(var h=a.ccall("pcm2aac","number",["number","number","number","number","number"],[c[0],s,o.length,u,d]),p=0;p<h;p+=1){var g=a.HEAPU32[d/Uint32Array.BYTES_PER_ELEMENT+p];f[p]=g}for(var m=0,y=0,v=this._getFrameDuration();y<h;)if(g=f[y],0!==y){var _={unit:a.HEAPU8.subarray(m+u/Uint8Array.BYTES_PER_ELEMENT,m+g+u/Uint8Array.BYTES_PER_ELEMENT),pts:r+y*v-v,dts:r+y*v-v};t.samples.push(_),t.len+=_.unit.length,m+=g,y+=1}else y+=1,m+=g;a._free(s),a._free(u),a._free(d)},e.prototype.initTrackConfig=function(e,t,r){var n=this;this.config=e.g711Config;var i=-1;[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350].forEach(function(e,t){e===n.config.sampleRate&&(i=t)}),i<0&&t.trigger(Event.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid G711 sampling rate:"+this.config.sampleRate});var a=[];a[0]=16,a[0]|=(14&i)>>1,a[1]|=(1&i)<<7,a[1]|=8,e.config=a,e.channelCount=1,e.samplerate=this.config.sampleRate,e.codec="mp4a.40.2",e.manifestCodec=r,e.isAAC=!0},e.prototype._getFrameDuration=function(){return 9216e4/this.config.sampleRate},e}();t.default=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var a=[-5504,-5248,-6016,-5760,-4480,-4224,-4992,-4736,-7552,-7296,-8064,-7808,-6528,-6272,-7040,-6784,-2752,-2624,-3008,-2880,-2240,-2112,-2496,-2368,-3776,-3648,-4032,-3904,-3264,-3136,-3520,-3392,-22016,-20992,-24064,-23040,-17920,-16896,-19968,-18944,-30208,-29184,-32256,-31232,-26112,-25088,-28160,-27136,-11008,-10496,-12032,-11520,-8960,-8448,-9984,-9472,-15104,-14592,-16128,-15616,-13056,-12544,-14080,-13568,-344,-328,-376,-360,-280,-264,-312,-296,-472,-456,-504,-488,-408,-392,-440,-424,-88,-72,-120,-104,-24,-8,-56,-40,-216,-200,-248,-232,-152,-136,-184,-168,-1376,-1312,-1504,-1440,-1120,-1056,-1248,-1184,-1888,-1824,-2016,-1952,-1632,-1568,-1760,-1696,-688,-656,-752,-720,-560,-528,-624,-592,-944,-912,-1008,-976,-816,-784,-880,-848,5504,5248,6016,5760,4480,4224,4992,4736,7552,7296,8064,7808,6528,6272,7040,6784,2752,2624,3008,2880,2240,2112,2496,2368,3776,3648,4032,3904,3264,3136,3520,3392,22016,20992,24064,23040,17920,16896,19968,18944,30208,29184,32256,31232,26112,25088,28160,27136,11008,10496,12032,11520,8960,8448,9984,9472,15104,14592,16128,15616,13056,12544,14080,13568,344,328,376,360,280,264,312,296,472,456,504,488,408,392,440,424,88,72,120,104,24,8,56,40,216,200,248,232,152,136,184,168,1376,1312,1504,1440,1120,1056,1248,1184,1888,1824,2016,1952,1632,1568,1760,1696,688,656,752,720,560,528,624,592,944,912,1008,976,816,784,880,848],o=[-32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956,-23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764,-15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412,-11900,-11388,-10876,-10364,-9852,-9340,-8828,-8316,-7932,-7676,-7420,-7164,-6908,-6652,-6396,-6140,-5884,-5628,-5372,-5116,-4860,-4604,-4348,-4092,-3900,-3772,-3644,-3516,-3388,-3260,-3132,-3004,-2876,-2748,-2620,-2492,-2364,-2236,-2108,-1980,-1884,-1820,-1756,-1692,-1628,-1564,-1500,-1436,-1372,-1308,-1244,-1180,-1116,-1052,-988,-924,-876,-844,-812,-780,-748,-716,-684,-652,-620,-588,-556,-524,-492,-460,-428,-396,-372,-356,-340,-324,-308,-292,-276,-260,-244,-228,-212,-196,-180,-164,-148,-132,-120,-112,-104,-96,-88,-80,-72,-64,-56,-48,-40,-32,-24,-16,-8,0,32124,31100,30076,29052,28028,27004,25980,24956,23932,22908,21884,20860,19836,18812,17788,16764,15996,15484,14972,14460,13948,13436,12924,12412,11900,11388,10876,10364,9852,9340,8828,8316,7932,7676,7420,7164,6908,6652,6396,6140,5884,5628,5372,5116,4860,4604,4348,4092,3900,3772,3644,3516,3388,3260,3132,3004,2876,2748,2620,2492,2364,2236,2108,1980,1884,1820,1756,1692,1628,1564,1500,1436,1372,1308,1244,1180,1116,1052,988,924,876,844,812,780,748,716,684,652,620,588,556,524,492,460,428,396,372,356,340,324,308,292,276,260,244,228,212,196,180,164,148,132,120,112,104,96,88,80,72,64,56,48,40,32,24,16,8,0];t.decodeAlaw=function(e){for(var t=new Uint8Array(2*e.length),r=0,n=0;r<e.length;){var i=a[e[r]];if(void 0===i)throw new Error("can not decode g711 data!");t[n]=255&i,t[n+1]=i>>8,r+=1,n+=2}return t},t.decodeUlaw=function(e){for(var t=new Uint8Array(2*e.length),r=0,n=0;r<e.length;){var i=o[e[r]];if(void 0===i)throw new Error("can not decode g711 data!");t[n]=255&i,t[n+1]=i>>8,r+=1,n+=2}return t}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var p=r(11),i=r(0),g=r(21),n=function(){function e(e,t,r){this.observer=e,this.config=r,this.remuxer=t}return e.prototype.resetInitSegment=function(e,t,r,n){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:t,duration:n,inputTimeScale:9e4}},e.prototype.resetTimeStamp=function(){},e.probe=function(e){var t,r,n=p.default.getID3Data(e,0);if(n&&void 0!==p.default.getTimeStamp(n))for(t=n.length,r=Math.min(e.length-1,t+100);t<r;t++)if(g.default.probe(e,t))return i.logger.log("MPEG Audio sync word found !"),!0;return!1},e.prototype.append=function(e,t,r,n){for(var i=p.default.getID3Data(e,0),a=p.default.getTimeStamp(i),o=a?90*a:9e4*t,s=i.length,l=e.length,u=0,f=0,d=this._audioTrack,c=[{pts:o,dts:o,data:i}];s<l;)if(g.default.isHeader(e,s)){var h=g.default.appendFrame(d,e,s,o,u);if(!h)break;s+=h.length,f=h.sample.pts,u++}else p.default.isHeader(e,s)?(i=p.default.getID3Data(e,s),c.push({pts:f,dts:f,data:i}),s+=i.length):s++;this.remuxer.remux(d,{samples:[]},{samples:c,inputTimeScale:9e4},{samples:[]},t,r,n)},e.prototype.destroy=function(){},e}();t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var H=r(44),X=r(45),Z=r(1),Q=r(3),J=r(0),n=function(){function e(e,t,r,n){this.observer=e,this.config=t,this.typeSupported=r;var i=navigator.userAgent;this.isSafari=n&&-1<n.indexOf("Apple")&&i&&!i.match("CriOS"),this.ISGenerated=!1}return e.prototype.destroy=function(){},e.prototype.resetTimeStamp=function(e){this._initPTS=this._initDTS=e},e.prototype.resetInitSegment=function(){this.ISGenerated=!1},e.prototype.remux=function(e,t,r,n,i,a,o){if(this.ISGenerated||this.generateIS(e,t,i),this.ISGenerated){var s=e.samples.length,l=t.samples.length,u=i,f=i;if(s&&l){var d=(e.samples[0].pts-t.samples[0].pts)/t.inputTimeScale;u+=Math.max(0,d),f+=Math.max(0,-d)}if(s){e.timescale||(J.logger.warn("regenerate InitSegment as audio detected"),this.generateIS(e,t,i));var c=this.remuxAudio(e,u,a,o);if(l){var h=void 0;c&&(h=c.endPTS-c.startPTS),t.timescale||(J.logger.warn("regenerate InitSegment as video detected"),this.generateIS(e,t,i)),this.remuxVideo(t,f,a,h,o)}}else if(l){var p=this.remuxVideo(t,f,a,0,o);p&&e.codec&&this.remuxEmptyAudio(e,u,a,p)}}r.samples.length&&this.remuxID3(r,i),n.samples.length&&this.remuxText(n,i),this.observer.trigger(Z.default.FRAG_PARSED)},e.prototype.generateIS=function(e,t,r){var n,i,a=this.observer,o=e.samples,s=t.samples,l=this.typeSupported,u="audio/mp4",f={},d={tracks:f},c=void 0===this._initPTS;if(c&&(n=i=1/0),e.config&&o.length&&(e.timescale=e.samplerate,J.logger.log("audio sampling rate : "+e.samplerate),e.isAAC||(l.mpeg?(u="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3")),f.audio={container:u,codec:e.codec,initSegment:!e.isAAC&&l.mpeg?new Uint8Array:X.default.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(n=i=o[0].pts-e.inputTimeScale*r)),t.sps&&t.pps&&s.length){var h=t.inputTimeScale;t.timescale=h,f.video={container:"video/mp4",codec:t.codec,initSegment:X.default.initSegment([t]),metadata:{width:t.width,height:t.height}},c&&(n=Math.min(n,s[0].pts-h*r),i=Math.min(i,s[0].dts-h*r),this.observer.trigger(Z.default.INIT_PTS_FOUND,{initPTS:n}))}Object.keys(f).length?(console.log("trigger INIT Segment",d),a.trigger(Z.default.FRAG_PARSING_INIT_SEGMENT,d),this.ISGenerated=!0,c&&(this._initPTS=n,this._initDTS=i)):a.trigger(Z.default.ERROR,{type:Q.ErrorTypes.MEDIA_ERROR,details:Q.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},e.prototype.remuxVideo=function(e,t,r,n,i){var a,o,s,l,u,f,d,c=8,h=e.timescale,p=e.samples,g=[],m=p.length,y=this._PTSNormalize,v=this._initPTS,_=this.nextAvcDts,b=this.isSafari;if(0!==m){b&&(r|=p.length&&_&&(i&&Math.abs(t-_/h)<.1||Math.abs(p[0].pts-_-v)<h/5)),r||(_=t*h),p.forEach(function(e){e.pts=y(e.pts-v,_),e.dts=y(e.dts-v,_)}),p.sort(function(e,t){var r=e.dts-t.dts,n=e.pts-t.pts;return r||n||e.id-t.id});var S=p.reduce(function(e,t){return Math.max(Math.min(e,t.pts-t.dts),-18e3)},0);if(S<0){J.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(S/90)+" ms to overcome this issue");for(var E=0;E<p.length;E++)p[E].dts+=S}var w=p[0];u=Math.max(w.dts,0),l=Math.max(w.pts,0);var T=Math.round((u-_)/90);r&&T&&(1<T?J.logger.log("AVC:"+T+" ms hole between fragments detected,filling it"):T<-1&&J.logger.log("AVC:"+-T+" ms overlapping between fragments detected"),u=_,p[0].dts=u,l=Math.max(l-T,_),p[0].pts=l,J.logger.log("Video/PTS/DTS adjusted: "+Math.round(l/90)+"/"+Math.round(u/90)+",delta:"+T+" ms")),w=p[p.length-1],d=Math.max(w.dts,0),f=Math.max(w.pts,0,d),b&&(a=Math.round((d-u)/(p.length-1)));var A=0,x=0;for(E=0;E<m;E++){for(var L=p[E],R=L.units,I=R.length,C=0,D=0;D<I;D++)C+=R[D].data.length;x+=C,A+=I,L.length=C,L.dts=b?u+E*a:Math.max(L.dts,u),L.pts=Math.max(L.pts,L.dts)}var P=x+4*A+8;try{o=new Uint8Array(P)}catch(e){return void this.observer.trigger(Z.default.ERROR,{type:Q.ErrorTypes.MUX_ERROR,details:Q.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:P,reason:"fail allocating video mdat "+P})}var U=new DataView(o.buffer);for(U.setUint32(0,P),o.set(X.default.types.mdat,4),E=0;E<m;E++){var k=p[E],O=k.units,M=0,F=void 0;for(D=0,I=O.length;D<I;D++){var N=O[D],B=N.data,z=N.data.byteLength;U.setUint32(c,z),c+=4,o.set(B,c),c+=z,M+=4+z}if(b)F=Math.max(0,a*Math.round((k.pts-k.dts)/a));else{if(E<m-1)a=p[E+1].dts-k.dts;else{var j=this.config,G=k.dts-p[0<E?E-1:E].dts;if(j.stretchShortVideoTrack){var H=j.maxBufferHole,q=Math.floor(H*h),V=(n?l+n*h:this.nextAudioPts)-k.pts;q<V?((a=V-G)<0&&(a=G),J.logger.log("It is approximately "+V/90+" ms to the next segment; using duration "+a/90+" ms for the last video frame.")):a=G}else a=G}F=Math.round(k.pts-k.dts)}g.push({size:M,duration:a,cts:F,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:k.key?2:1,isNonSync:k.key?0:1}})}this.nextAvcDts=d+a;var W=e.dropped;if(e.len=0,e.nbNalu=0,e.dropped=0,g.length&&-1<navigator.userAgent.toLowerCase().indexOf("chrome")){var Y=g[0].flags;Y.dependsOn=2,Y.isNonSync=0}e.samples=g,s=X.default.moof(e.sequenceNumber++,u,e),e.samples=[];var K={data1:s,data2:o,startPTS:l/h,endPTS:(f+a)/h,startDTS:u/h,endDTS:this.nextAvcDts/h,type:"video",hasAudio:!1,hasVideo:!0,nb:g.length,dropped:W};return this.observer.trigger(Z.default.FRAG_PARSING_DATA,K),K}},e.prototype.remuxAudio=function(e,t,r,n){var i,a,o,s,l,u,f,d=e.inputTimeScale,c=e.timescale,h=d/c,p=(e.isAAC?1024:1152)*h,g=this._PTSNormalize,m=this._initPTS,y=!e.isAAC&&this.typeSupported.mpeg,v=e.samples,_=[],b=this.nextAudioPts;if(r|=v.length&&b&&(n&&Math.abs(t-b/d)<.1||Math.abs(v[0].pts-b-m)<20*p),v.forEach(function(e){e.pts=e.dts=g(e.pts-m,t*d)}),0!==(v=v.filter(function(e){return 0<=e.pts})).length){if(r||(b=n?t*d:v[0].pts),e.isAAC)for(var S=this.config.maxAudioFramesDrift,E=0,w=b;E<v.length;){var T,A=v[E];T=(U=A.pts)-w;var x=Math.abs(1e3*T/d);if(T<=-S*p)J.logger.warn("Dropping 1 audio frame @ "+(w/d).toFixed(3)+"s due to "+Math.round(x)+" ms overlap."),v.splice(E,1),e.len-=A.unit.length;else if(S*p<=T&&x<1e4&&w){var L=Math.round(T/p);J.logger.warn("Injecting "+L+" audio frame @ "+(w/d).toFixed(3)+"s due to "+Math.round(1e3*T/d)+" ms gap.");for(var R=0;R<L;R++){var I=Math.max(w,0);(o=H.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(J.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),o=A.unit.subarray()),v.splice(E,0,{unit:o,pts:I,dts:I}),e.len+=o.length,w+=p,E++}A.pts=A.dts=w,w+=p,E++}else A.pts=A.dts=w,w+=p,E++}R=0;for(var C=v.length;R<C;R++){var D=v[R],P=D.unit,U=D.pts;if(void 0!==f)a.duration=Math.round((U-f)/h);else{var k=Math.round(1e3*(U-b)/d),O=0;if(r&&e.isAAC&&k){if(0<k&&k<1e4)O=Math.round((U-b)/p),J.logger.log(k+" ms hole between AAC samples detected,filling it"),0<O&&((o=H.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(o=P.subarray()),e.len+=O*o.length);else if(k<-12){J.logger.log("drop overlapping AAC sample, expected/parsed/delta:"+(b/d).toFixed(3)+"s/"+(U/d).toFixed(3)+"s/"+-k+"ms"),e.len-=P.byteLength;continue}U=b}if(u=U,!(0<e.len))return;var M=y?e.len:e.len+8;i=y?0:8;try{s=new Uint8Array(M)}catch(e){return void this.observer.trigger(Z.default.ERROR,{type:Q.ErrorTypes.MUX_ERROR,details:Q.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:M,reason:"fail allocating audio mdat "+M})}for(y||(new DataView(s.buffer).setUint32(0,M),s.set(X.default.types.mdat,4)),E=0;E<O;E++)(o=H.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(J.logger.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),o=P.subarray()),s.set(o,i),i+=o.byteLength,a={size:o.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},_.push(a)}s.set(P,i);var F=P.byteLength;i+=F,a={size:F,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},_.push(a),f=U}var N=0,B=_.length;if(2<=B&&(N=_[B-2].duration,a.duration=N),B){this.nextAudioPts=b=f+h*N,e.len=0,e.samples=_,l=y?new Uint8Array:X.default.moof(e.sequenceNumber++,u/h,e),e.samples=[];var z=u/d,j=b/d,G={data1:l,data2:s,startPTS:z,endPTS:j,startDTS:z,endDTS:j,type:"audio",hasAudio:!0,hasVideo:!1,nb:B};return this.observer.trigger(Z.default.FRAG_PARSING_DATA,G),G}return null}},e.prototype.remuxEmptyAudio=function(e,t,r,n){var i=e.inputTimeScale,a=i/(e.samplerate?e.samplerate:i),o=this.nextAudioPts,s=(void 0!==o?o:n.startDTS*i)+this._initDTS,l=n.endDTS*i+this._initDTS,u=1024*a,f=Math.ceil((l-s)/u),d=H.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(J.logger.warn("remux empty Audio"),d){for(var c=[],h=0;h<f;h++){var p=s+h*u;c.push({unit:d,pts:p,dts:p}),e.len+=d.length}e.samples=c,this.remuxAudio(e,t,r)}else J.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!")},e.prototype.remuxID3=function(e){var t,r=e.samples.length,n=e.inputTimeScale,i=this._initPTS,a=this._initDTS;if(r){for(var o=0;o<r;o++)(t=e.samples[o]).pts=(t.pts-i)/n,t.dts=(t.dts-a)/n;this.observer.trigger(Z.default.FRAG_PARSING_METADATA,{samples:e.samples})}e.samples=[]},e.prototype.remuxText=function(e){e.samples.sort(function(e,t){return e.pts-t.pts});var t,r=e.samples.length,n=e.inputTimeScale,i=this._initPTS;if(r){for(var a=0;a<r;a++)(t=e.samples[a]).pts=(t.pts-i)/n;this.observer.trigger(Z.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[]},e.prototype._PTSNormalize=function(e,t){var r;if(void 0===t)return e;for(r=t<e?-8589934592:8589934592;4294967296<Math.abs(e-t);)e+=r;return e},e}();t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=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}();t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var s=Math.pow(2,32)-1,n=function(){function c(){}return c.init=function(){var e;for(e in c.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:[]})c.types.hasOwnProperty(e)&&(c.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);c.HDLR_TYPES={video:t,audio:r};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i=new Uint8Array([0,0,0,0,0,0,0,0]);c.STTS=c.STSC=c.STCO=i,c.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),c.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),c.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),c.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);c.FTYP=c.box(c.types.ftyp,a,s,a,o),c.DINF=c.box(c.types.dinf,c.box(c.types.dref,n))},c.box=function(e){for(var t,r=Array.prototype.slice.call(arguments,1),n=8,i=r.length,a=i;i--;)n+=r[i].byteLength;for((t=new Uint8Array(n))[0]=n>>24&255,t[1]=n>>16&255,t[2]=n>>8&255,t[3]=255&n,t.set(e,4),i=0,n=8;i<a;i++)t.set(r[i],n),n+=r[i].byteLength;return t},c.hdlr=function(e){return c.box(c.types.hdlr,c.HDLR_TYPES[e])},c.mdat=function(e){return c.box(c.types.mdat,e)},c.mdhd=function(e,t){t*=e;var r=Math.floor(t/(s+1)),n=Math.floor(t%(s+1));return c.box(c.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24,r>>16&255,r>>8&255,255&r,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))},c.mdia=function(e){return c.box(c.types.mdia,c.mdhd(e.timescale,e.duration),c.hdlr(e.type),c.minf(e))},c.mfhd=function(e){return c.box(c.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},c.minf=function(e){return"audio"===e.type?c.box(c.types.minf,c.box(c.types.smhd,c.SMHD),c.DINF,c.stbl(e)):c.box(c.types.minf,c.box(c.types.vmhd,c.VMHD),c.DINF,c.stbl(e))},c.moof=function(e,t,r){return c.box(c.types.moof,c.mfhd(e),c.traf(r,t))},c.moov=function(e){for(var t=e.length,r=[];t--;)r[t]=c.trak(e[t]);return c.box.apply(null,[c.types.moov,c.mvhd(e[0].timescale,e[0].duration)].concat(r).concat(c.mvex(e)))},c.mvex=function(e){for(var t=e.length,r=[];t--;)r[t]=c.trex(e[t]);return c.box.apply(null,[c.types.mvex].concat(r))},c.mvhd=function(e,t){t*=e;var r=Math.floor(t/(s+1)),n=Math.floor(t%(s+1)),i=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24,r>>16&255,r>>8&255,255&r,n>>24,n>>16&255,n>>8&255,255&n,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return c.box(c.types.mvhd,i)},c.sdtp=function(e){var t,r,n=e.samples||[],i=new Uint8Array(4+n.length);for(r=0;r<n.length;r++)t=n[r].flags,i[r+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return c.box(c.types.sdtp,i)},c.stbl=function(e){return c.box(c.types.stbl,c.stsd(e),c.box(c.types.stts,c.STTS),c.box(c.types.stsc,c.STSC),c.box(c.types.stsz,c.STSZ),c.box(c.types.stco,c.STCO))},c.avc1=function(e){var t,r,n,i=[],a=[];for(t=0;t<e.sps.length;t++)n=(r=e.sps[t]).byteLength,i.push(n>>>8&255),i.push(255&n),i=i.concat(Array.prototype.slice.call(r));for(t=0;t<e.pps.length;t++)n=(r=e.pps[t]).byteLength,a.push(n>>>8&255),a.push(255&n),a=a.concat(Array.prototype.slice.call(r));var o=c.box(c.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|e.sps.length].concat(i).concat([e.pps.length]).concat(a))),s=e.width,l=e.height,u=e.pixelRatio[0],f=e.pixelRatio[1];return c.box(c.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,s>>8&255,255&s,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,c.box(c.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),c.box(c.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,f>>24,f>>16&255,f>>8&255,255&f])))},c.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]))},c.mp4a=function(e){var t=e.samplerate;return c.box(c.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]),c.box(c.types.esds,c.esds(e)))},c.mp3=function(e){var t=e.samplerate;return c.box(c.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]))},c.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?c.box(c.types.stsd,c.STSD,c.mp4a(e)):c.box(c.types.stsd,c.STSD,c.mp3(e)):c.box(c.types.stsd,c.STSD,c.avc1(e))},c.tkhd=function(e){var t=e.id,r=e.duration*e.timescale,n=e.width,i=e.height,a=Math.floor(r/(s+1)),o=Math.floor(r%(s+1));return c.box(c.types.tkhd,new Uint8Array([1,0,0,7,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,0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,o>>24,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,i>>8&255,255&i,0,0]))},c.traf=function(e,t){var r=c.sdtp(e),n=e.id,i=Math.floor(t/(s+1)),a=Math.floor(t%(s+1));return c.box(c.types.traf,c.box(c.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),c.box(c.types.tfdt,new Uint8Array([1,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a])),c.trun(e,r.length+16+20+8+16+8+8),r)},c.trak=function(e){return e.duration=e.duration||4294967295,c.box(c.types.trak,c.tkhd(e),c.mdia(e))},c.trex=function(e){var t=e.id;return c.box(c.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},c.trun=function(e,t){var r,n,i,a,o,s,l=e.samples||[],u=l.length,f=12+16*u,d=new Uint8Array(f);for(t+=8+f,d.set([0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),r=0;r<u;r++)i=(n=l[r]).duration,a=n.size,o=n.flags,s=n.cts,d.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,a>>>24&255,a>>>16&255,a>>>8&255,255&a,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,s>>>24&255,s>>>16&255,s>>>8&255,255&s],12+16*r);return c.box(c.types.trun,d)},c.initSegment=function(e){c.types||c.init();var t,r=c.moov(e);return(t=new Uint8Array(c.FTYP.byteLength+r.byteLength)).set(c.FTYP),t.set(r,c.FTYP.byteLength),t},c}();t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var f=r(1),n=function(){function e(e){this.observer=e}return e.prototype.destroy=function(){},e.prototype.resetTimeStamp=function(){},e.prototype.resetInitSegment=function(){},e.prototype.remux=function(e,t,r,n,i,a,o,s){var l=this.observer,u="";e&&(u+="audio"),t&&(u+="video"),l.trigger(f.default.FRAG_PARSING_DATA,{data1:s,startPTS:i,startDTS:i,type:u,hasAudio:!!e,hasVideo:!!t,nb:1,dropped:0}),l.trigger(f.default.FRAG_PARSED)},e}();t.default=n},function(e,t,r){var n=Object.prototype.hasOwnProperty,h="~";function i(){}function s(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,r,n,i){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new s(r,n||e,i),o=h?h+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],a]:e._events[o].push(a):(e._events[o]=a,e._eventsCount++),e}function u(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(h=!1)),o.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)n.call(e,t)&&r.push(h?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},o.prototype.listeners=function(e){var t=h?h+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,i=r.length,a=new Array(i);n<i;n++)a[n]=r[n].fn;return a},o.prototype.listenerCount=function(e){var t=h?h+e:e,r=this._events[t];return r?r.fn?1:r.length:0},o.prototype.emit=function(e,t,r,n,i,a){var o=h?h+e:e;if(!this._events[o])return!1;var s,l,u=this._events[o],f=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),f){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,n),!0;case 5:return u.fn.call(u.context,t,r,n,i),!0;case 6:return u.fn.call(u.context,t,r,n,i,a),!0}for(l=1,s=new Array(f-1);l<f;l++)s[l-1]=arguments[l];u.fn.apply(u.context,s)}else{var d,c=u.length;for(l=0;l<c;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),f){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,r);break;case 4:u[l].fn.call(u[l].context,t,r,n);break;default:if(!s)for(d=1,s=new Array(f-1);d<f;d++)s[d-1]=arguments[d];u[l].fn.apply(u[l].context,s)}}return!0},o.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},o.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},o.prototype.removeListener=function(e,t,r,n){var i=h?h+e:e;if(!this._events[i])return this;if(!t)return u(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||n&&!a.once||r&&a.context!==r||u(this,i);else{for(var o=0,s=[],l=a.length;o<l;o++)(a[o].fn!==t||n&&!a[o].once||r&&a[o].context!==r)&&s.push(a[o]);s.length?this._events[i]=1===s.length?s[0]:s:u(this,i)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=h?h+e:e,this._events[t]&&u(this,t)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=h,o.EventEmitter=o,e.exports=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var o=r(18),s=r(1),l=r(0),u=r(49);t.default=function(i){var n=new u.EventEmitter;n.trigger=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];n.emit.apply(n,[e,e].concat(t))},n.off=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];n.removeListener.apply(n,[e].concat(t))};var a=function(e,t){i.postMessage({event:e,data:t})};i.addEventListener("message",function(e){var t=e.data;switch(t.cmd){case"init":var r=JSON.parse(t.config);i.demuxer=new o.default(n,t.typeSupported,r,t.vendor),l.enableLogs(r.debug),a("init",null);break;case"demux":i.demuxer.push(t.data,t.decryptdata,t.initSegment,t.audioCodec,t.videoCodec,t.timeOffset,t.discontinuity,t.trackSwitch,t.contiguous,t.duration,t.accurateTimeOffset,t.defaultInitPTS)}}),n.on(s.default.FRAG_DECRYPTED,a),n.on(s.default.FRAG_PARSING_INIT_SEGMENT,a),n.on(s.default.FRAG_PARSED,a),n.on(s.default.ERROR,a),n.on(s.default.FRAG_PARSING_METADATA,a),n.on(s.default.FRAG_PARSING_USERDATA,a),n.on(s.default.INIT_PTS_FOUND,a),n.on(s.default.FRAG_PARSING_DATA,function(e,t){var r=[],n={event:e,data:t};t.data1&&(n.data1=t.data1.buffer,r.push(t.data1.buffer),delete t.data1),t.data2&&(n.data2=t.data2.buffer,r.push(t.data2.buffer),delete t.data2),i.postMessage(n,r)})}},function(h,e,t){(function(e){var t,r="object"==typeof Reflect?Reflect:null,f=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=e.isNaN||function(e){return e!=e};function i(){i.init.call(this)}((h.exports=i).EventEmitter=i).prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function u(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function o(e,t,r,n){var i,a,o,s;if("function"!=typeof r)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r);if(void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]),void 0===o)o=a[t]=r,++e._eventsCount;else if("function"==typeof o?o=a[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),0<(i=u(e))&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,s=l,console&&console.warn&&console.warn(s)}return e}function s(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=function(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,f(this.listener,this.target,e))}.bind(n);return i.listener=r,n.wrapFn=i}function l(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):c(i,i.length)}function d(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function c(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return u(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var a;if(0<t.length&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)f(s,this,t);else{var l=s.length,u=c(s,l);for(r=0;r<l;++r)f(u[r],this,t)}return!0},i.prototype.on=i.prototype.addListener=function(e,t){return o(this,e,t,!1)},i.prototype.prependListener=function(e,t){return o(this,e,t,!0)},i.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,s(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,s(this,e,t)),this},i.prototype.off=i.prototype.removeListener=function(e,t){var r,n,i,a,o;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;0<=a;a--)if(r[a]===t||r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},i.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;0<=n;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return l(this,e,!0)},i.prototype.rawListeners=function(e){return l(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},i.prototype.listenerCount=d,i.prototype.eventNames=function(){return 0<this._eventsCount?t(this._events):[]}}).call(this,t(2).Number)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default={toString:function(e){for(var t="",r=e.length,n=0;n<r;n++)t+="["+e.start(n).toFixed(3)+","+e.end(n).toFixed(3)+"]";return t}}},function(e,t,d){(function(i){Object.defineProperty(t,"__esModule",{value:!0});var r=d(10),a=d(0);function o(e,t){for(var r=null,n=0;n<e.length;n+=1){var i=e[n];if(i&&i.cc===t){r=i;break}}return r}function s(e,t,r){var n=!1;return t&&t.details&&r&&(r.endCC>r.startCC||e&&e.cc<r.startCC)&&(n=!0),n}function l(e,t){var r=e.fragments,n=t.fragments;if(n.length&&r.length){var i=o(r,n[0].cc);if(i&&(!i||i.startPTS))return i;a.logger.log("No frag in previous level to align on")}else a.logger.log("No fragments to align")}function u(r,e){e.fragments.forEach(function(e){if(e){var t=e.start+r;e.start=e.startPTS=t,e.endPTS=t+e.duration}}),e.PTSKnown=!0}function n(e,t,r){if(s(e,r,t)){var n=l(r.details,t);n&&(a.logger.log("Adjusting PTS using last level due to CC increase within current level"),u(n.start,t))}}function f(e,t){if(t&&t.fragments.length){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;var r=t.fragments[0].programDateTime,n=(e.fragments[0].programDateTime-r)/1e3+t.fragments[0].start;i.isFinite(n)&&(a.logger.log("adjusting PTS using programDateTime delta, sliding:"+n.toFixed(3)),u(n,e))}}t.findFirstFragWithCC=o,t.findFragWithCC=function(e,t){return r.default.search(e,function(e){return e.cc<t?1:e.cc>t?-1:0})},t.shouldAlignOnDiscontinuities=s,t.findDiscontinuousReferenceFrag=l,t.adjustPts=u,t.alignStream=function(e,t,r){n(e,r,t),!r.PTSKnown&&t&&f(r,t.details)},t.alignDiscontinuities=n,t.alignPDT=f}).call(this,d(2).Number)},function(e,t,r){(function(a){Object.defineProperty(t,"__esModule",{value:!0});var o=r(10);function s(e,t,r){void 0===e&&(e=0),void 0===t&&(t=0);var n=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-n<=e?1:r.start-n>e&&r.start?-1:0}function l(e,t,r){var n=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.endProgramDateTime-n>e}t.findFragmentByPDT=function(e,t,r){if(!Array.isArray(e)||!e.length||!a.isFinite(t))return null;if(t<e[0].programDateTime)return null;if(t>=e[e.length-1].endProgramDateTime)return null;r=r||0;for(var n=0;n<e.length;++n){var i=e[n];if(l(t,r,i))return i}return null},t.findFragmentByPTS=function(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var i=e?t[e.sn-t[0].sn+1]:null;return i&&!s(r,n,i)?i:o.default.search(t,s.bind(null,r,n))},t.fragmentWithinToleranceTest=s,t.pdtWithinToleranceTest=l}).call(this,r(2).Number)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var l=r(8),s=r(3),u=r(1),f=r(0),n=function(){function e(e,t,r,n){this.config=e,this.media=t,this.fragmentTracker=r,this.hls=n,this.stallReported=!1}return e.prototype.poll=function(e,t){var r=this.config,n=this.media,i=n.currentTime,a=window.performance.now();if(i!==e)return this.stallReported&&(f.logger.warn("playback not stuck anymore @"+i+", after "+Math.round(a-this.stalled)+"ms"),this.stallReported=!1),this.stalled=null,void(this.nudgeRetry=0);if(!(n.ended||!n.buffered.length||2<n.readyState||n.seeking&&l.BufferHelper.isBuffered(n,i))){var o=a-this.stalled,s=l.BufferHelper.bufferInfo(n,i,r.maxBufferHole);this.stalled?(1e3<=o&&this._reportStall(s.len),this._tryFixBufferStall(s,o)):this.stalled=a}},e.prototype._tryFixBufferStall=function(e,t){var r=this.config,n=this.fragmentTracker,i=this.media.currentTime,a=n.getPartialFragment(i);a&&this._trySkipBufferHole(a),.5<e.len&&t>1e3*r.highBufferWatchdogPeriod&&(this.stalled=null,this._tryNudgeBuffer())},e.prototype._reportStall=function(e){var t=this.hls,r=this.media;this.stallReported||(this.stallReported=!0,f.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer"),t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},e.prototype._trySkipBufferHole=function(e){for(var t=this.hls,r=this.media,n=r.currentTime,i=0,a=0;a<r.buffered.length;a++){var o=r.buffered.start(a);if(i<=n&&n<o)return r.currentTime=Math.max(o,r.currentTime+.1),f.logger.warn("skipping hole, adjusting currentTime from "+n+" to "+r.currentTime),this.stalled=null,void t.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 "+n+" to "+r.currentTime,frag:e});i=r.buffered.end(a)}},e.prototype._tryNudgeBuffer=function(){var e=this.config,t=this.hls,r=this.media,n=r.currentTime,i=(this.nudgeRetry||0)+1;if((this.nudgeRetry=i)<e.nudgeMaxRetry){var a=n+i*e.nudgeOffset;f.logger.log("adjust currentTime from "+n+" to "+a),r.currentTime=a,t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else f.logger.error("still stuck in high buffer @"+n+" after "+e.nudgeMaxRetry+", raise fatal error"),t.trigger(u.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},e}();t.default=n},function(e,h,i){(function(f){var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(h,"__esModule",{value:!0});var e=i(55),a=i(9),d=i(8),c=i(0);h.State={STOPPED:"STOPPED",STARTING:"STARTING",IDLE:"IDLE",PAUSED:"PAUSED",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BUFFER_FLUSHING:"BUFFER_FLUSHING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.doTick=function(){},t.prototype._streamEnded=function(e,t){var r=this.fragCurrent,n=this.fragmentTracker;if(t.live||!r||r.backtracked||r.sn!==t.endSN||e.nextStart)return!1;var i=n.getState(r);return i===a.FragmentState.PARTIAL||i===a.FragmentState.OK},t.prototype.onMediaSeeking=function(){var e=this.config,t=this.media,r=this.mediaBuffer,n=this.state,i=t?t.currentTime:null,a=d.BufferHelper.bufferInfo(r||t,i,this.config.maxBufferHole);if(f.isFinite(i)&&c.logger.log("media seeking to "+i.toFixed(3)),n===h.State.FRAG_LOADING){var o=this.fragCurrent;if(0===a.len&&o){var s=e.maxFragLookUpTolerance,l=o.start-s,u=o.start+o.duration+s;i<l||u<i?(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=h.State.IDLE):c.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else n===h.State.ENDED&&(0===a.len&&(this.fragPrevious=null,this.fragCurrent=null),this.state=h.State.IDLE);t&&(this.lastCurrentTime=i),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=i),this.tick()},t.prototype.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},t}(e.default);h.default=t}).call(this,i(2).Number)},function(e,t,r){var n,a=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(i){function e(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=i.apply(this,[e].concat(t))||this;return n._tickInterval=null,n._tickTimer=null,n._tickCallCount=0,n._boundTick=n.tick.bind(n),n}return a(e,i),e.prototype.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},e.prototype.hasInterval=function(){return!!this._tickInterval},e.prototype.hasNextTick=function(){return!!this._tickTimer},e.prototype.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=setInterval(this._boundTick,e),!0)},e.prototype.clearInterval=function(){return!(!this._tickInterval||(clearInterval(this._tickInterval),this._tickInterval=null))},e.prototype.clearNextTick=function(){return!(!this._tickTimer||(clearTimeout(this._tickTimer),this._tickTimer=null))},e.prototype.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),1<this._tickCallCount&&(this.clearNextTick(),this._tickTimer=setTimeout(this._boundTick,0)),this._tickCallCount=0)},e.prototype.doTick=function(){},e}(r(4).default);t.default=i},function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var u,f=r(1),a=r(4),d=r(0),c=r(3),h=r(17),p=r(23),l=window.performance,o=function(r){function e(e){var t=r.call(this,e,f.default.MANIFEST_LOADED,f.default.LEVEL_LOADED,f.default.AUDIO_TRACK_SWITCHED,f.default.FRAG_LOADED,f.default.ERROR)||this;return t.canload=!1,t.currentLevelIndex=null,t.manualLevelIndex=-1,t.timer=null,u=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),t}return i(e,r),e.prototype.onHandlerDestroying=function(){this.clearTimer(),this.manualLevelIndex=-1},e.prototype.clearTimer=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},e.prototype.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()},e.prototype.stopLoad=function(){this.canload=!1},e.prototype.onManifestLoaded=function(e){var t,r=[],n=[],i={},a=null,o=!1,s=!1;if(e.levels.forEach(function(e){var t=e.attrs;e.loadError=0,e.fragmentError=!1,o=o||!!e.videoCodec,s=s||!!e.audioCodec,u&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0),(a=i[e.bitrate])?a.url.push(e.url):(e.url=[e.url],e.urlId=0,i[e.bitrate]=e,r.push(e)),t&&(t.AUDIO&&(s=!0,p.addGroupId(a||e,"audio",t.AUDIO)),t.SUBTITLES&&p.addGroupId(a||e,"text",t.SUBTITLES))}),o&&s&&(r=r.filter(function(e){return!!e.videoCodec})),r=r.filter(function(e){var t=e.audioCodec,r=e.videoCodec;return(!t||h.isCodecSupportedInMp4(t,"audio"))&&(!r||h.isCodecSupportedInMp4(r,"video"))}),e.audioTracks&&(n=e.audioTracks.filter(function(e){return!e.audioCodec||h.isCodecSupportedInMp4(e.audioCodec,"audio")})).forEach(function(e,t){e.id=t}),0<r.length){t=r[0].bitrate,r.sort(function(e,t){return e.bitrate-t.bitrate}),this._levels=r;for(var l=0;l<r.length;l++)if(r[l].bitrate===t){this._firstLevel=l,d.logger.log("manifest loaded,"+r.length+" level(s) found, first bitrate:"+t);break}this.hls.trigger(f.default.MANIFEST_PARSED,{levels:r,audioTracks:n,firstLevel:this._firstLevel,stats:e.stats,audio:s,video:o,altAudio:n.some(function(e){return!!e.url})})}else this.hls.trigger(f.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:this.hls.url,reason:"no level with compatible codecs found in manifest"})},Object.defineProperty(e.prototype,"levels",{get:function(){return this._levels},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"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))},enumerable:!0,configurable:!0}),e.prototype.setLevelInternal=function(e){var t=this._levels,r=this.hls;if(0<=e&&e<t.length){if(this.clearTimer(),this.currentLevelIndex!==e){d.logger.log("switching to level "+e),this.currentLevelIndex=e;var n=t[e];n.level=e,r.trigger(f.default.LEVEL_SWITCHING,n)}var i=t[e],a=i.details;if(!a||a.live){var o=i.urlId;r.trigger(f.default.LEVEL_LOADING,{url:i.url[o],level:e,id:o})}}else r.trigger(f.default.ERROR,{type:c.ErrorTypes.OTHER_ERROR,details:c.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:!1,reason:"invalid level idx"})},Object.defineProperty(e.prototype,"manualLevel",{get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstLevel",{get:function(){return this._firstLevel},set:function(e){this._firstLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startLevel",{get:function(){if(void 0!==this._startLevel)return this._startLevel;var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel},set:function(e){this._startLevel=e},enumerable:!0,configurable:!0}),e.prototype.onError=function(e){if(e.fatal)e.type===c.ErrorTypes.NETWORK_ERROR&&this.clearTimer();else{var t,r=!1,n=!1;switch(e.details){case c.ErrorDetails.FRAG_LOAD_ERROR:case c.ErrorDetails.FRAG_LOAD_TIMEOUT:case c.ErrorDetails.KEY_LOAD_ERROR:case c.ErrorDetails.KEY_LOAD_TIMEOUT:t=e.frag.level,n=!0;break;case c.ErrorDetails.LEVEL_LOAD_ERROR:case c.ErrorDetails.LEVEL_LOAD_TIMEOUT:t=e.context.level,r=!0;break;case c.ErrorDetails.REMUX_ALLOC_ERROR:t=e.level,r=!0}void 0!==t&&this.recoverLevel(e,t,r,n)}},e.prototype.recoverLevel=function(e,t,r,n){var i,a,o,s=this,l=this.hls.config,u=e.details,f=this._levels[t];if(f.loadError++,f.fragmentError=n,r){if(!(this.levelRetryCount+1<=l.levelLoadingMaxRetry))return d.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++,d.logger.warn("level controller, "+u+", retry in "+a+" ms, current retry count is "+this.levelRetryCount)}(r||n)&&(1<(i=f.url.length)&&f.loadError<i?(f.urlId=(f.urlId+1)%i,f.details=void 0,d.logger.warn("level controller, "+u+" for level "+t+": switching to redundant URL-id "+f.urlId)):-1===this.manualLevelIndex?(o=0===t?this._levels.length-1:t-1,d.logger.warn("level controller, "+u+": switch to "+o),this.hls.nextAutoLevel=this.currentLevelIndex=o):n&&(d.logger.warn("level controller, "+u+": reload a fragment"),this.currentLevelIndex=null))},e.prototype.onFragLoaded=function(e){var t=e.frag;if(void 0!==t&&"main"===t.type){var r=this._levels[t.level];void 0!==r&&(r.fragmentError=!1,r.loadError=0,this.levelRetryCount=0)}},e.prototype.onLevelLoaded=function(e){var t=this,r=e.level;if(r===this.currentLevelIndex){var n=this._levels[r];n.fragmentError||(n.loadError=0,this.levelRetryCount=0);var i=e.details;if(i.live){var a=1e3*(i.averagetargetduration?i.averagetargetduration:i.targetduration),o=a,s=n.details;s&&i.endSN===s.endSN&&(o/=2,d.logger.log("same live playlist, reload twice faster")),o-=l.now()-e.stats.trequest,o=Math.max(a/2,Math.round(o)),d.logger.log("live playlist, reload in "+Math.round(o)+" ms"),this.timer=setTimeout(function(){return t.loadLevel()},o)}else this.clearTimer()}},e.prototype.onAudioTrackSwitched=function(e){var t=this.hls.audioTracks[e.id].groupId,r=this.hls.levels[this.currentLevelIndex];if(r&&r.audioGroupIds){var n=r.audioGroupIds.findIndex(function(e){return e===t});n!==r.urlId&&(r.urlId=n,this.startLoad())}},e.prototype.loadLevel=function(){if(d.logger.debug("call to loadLevel"),null!==this.currentLevelIndex&&this.canload){var e=this._levels[this.currentLevelIndex];if("object"==typeof e&&0<e.url.length){var t=this.currentLevelIndex,r=e.urlId,n=e.url[r];d.logger.log("Attempt loading level index "+t+" with URL-id "+r),this.hls.trigger(f.default.LEVEL_LOADING,{url:n,level:t,id:r})}}},Object.defineProperty(e.prototype,"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)},enumerable:!0,configurable:!0}),e}(a.default);t.default=o},function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),o=r(4),d=r(11),s=r(58),l=function(r){function e(e){var t=r.call(this,e,a.default.MEDIA_ATTACHED,a.default.MEDIA_DETACHING,a.default.FRAG_PARSING_METADATA)||this;return t.id3Track=void 0,t.media=void 0,t}return i(e,r),e.prototype.destroy=function(){o.default.prototype.destroy.call(this)},e.prototype.onMediaAttached=function(e){this.media=e.media,this.media},e.prototype.onMediaDetaching=function(){s.clearCurrentCues(this.id3Track),this.id3Track=void 0,this.media=void 0},e.prototype.getID3Track=function(e){for(var t=0;t<e.length;t++){var r=e[t];if("metadata"===r.kind&&"id3"===r.label)return s.sendAddTrackEvent(r,this.media),r}return this.media.addTextTrack("metadata","id3")},e.prototype.onFragParsingMetadata=function(e){var t=e.frag,r=e.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var n=window.WebKitDataCue||window.VTTCue||window.TextTrackCue,i=0;i<r.length;i++){var a=d.default.getID3Frames(r[i].data);if(a){var o=r[i].pts,s=i<r.length-1?r[i+1].pts:t.endPTS;o===s&&(s+=1e-4);for(var l=0;l<a.length;l++){var u=a[l];if(!d.default.isTimeStampFrame(u)){var f=new n(o,s,"");f.value=u,this.id3Track.addCue(f)}}}}},e}(o.default);t.default=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.sendAddTrackEvent=function(e,t){var r=null;try{r=new window.Event("addtrack")}catch(e){(r=document.createEvent("Event")).initEvent("addtrack",!1,!1)}r.track=e,t.dispatchEvent(r)},t.clearCurrentCues=function(e){if(e&&e.cues)for(;0<e.cues.length;)e.removeCue(e.cues[0])}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(12);t.isSupported=function(){var e=i.getMediaSource(),t=window.SourceBuffer||window.WebKitSourceBuffer,r=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),n=!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove;return!!r&&!!n}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(61),i=r(64),a=r(65),o=r(66),s=r(67),l=(r(5),r(5),r(5),r(5),r(5),r(5),r(5),r(68));t.hlsDefaultConfig={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:s.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,abrController:n.default,bufferController:i.default,capLevelController:a.default,fpsController:o.default,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,requestMediaKeySystemAccessFunc:l.requestMediaKeySystemAccess,qiniuDRMKey:void 0,g711WasmModule:void 0}},function(e,r,l){(function(o){var n,t=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var _=l(1),i=l(4),b=l(8),a=l(3),S=l(0),s=l(62),E=window.performance,e=function(r){function e(e){var t=r.call(this,e,_.default.FRAG_LOADING,_.default.FRAG_LOADED,_.default.FRAG_BUFFERED,_.default.ERROR)||this;return t.lastLoadedFragLevel=0,t._nextAutoLevel=-1,t.hls=e,t.timer=null,t._bwEstimator=null,t.onCheck=t._abandonRulesCheck.bind(t),t}return t(e,r),e.prototype.destroy=function(){this.clearTimer(),i.default.prototype.destroy.call(this)},e.prototype.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 r=this.hls,n=r.config,i=t.level,a=void 0,o=void 0;o=r.levels[i].details.live?(a=n.abrEwmaFastLive,n.abrEwmaSlowLive):(a=n.abrEwmaFastVoD,n.abrEwmaSlowVoD),this._bwEstimator=new s.default(r,o,a,n.abrEwmaDefaultEstimate)}},e.prototype._abandonRulesCheck=function(){var e=this.hls,t=e.media,r=this.fragCurrent;if(r){var n=r.loader,i=e.minAutoLevel;if(!n||n.stats&&n.stats.aborted)return S.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);var a=n.stats;if(t&&a&&(!t.paused&&0!==t.playbackRate||!t.readyState)&&r.autoLevel&&r.level){var o=E.now()-a.trequest,s=Math.abs(t.playbackRate);if(o>500*r.duration/s){var l=e.levels,u=Math.max(1,a.bw?a.bw/8:1e3*a.loaded/o),f=l[r.level],d=f.realBitrate?Math.max(f.realBitrate,f.bitrate):f.bitrate,c=a.total?a.total:Math.max(a.loaded,Math.round(r.duration*d/8)),h=t.currentTime,p=(c-a.loaded)/u,g=(b.BufferHelper.bufferInfo(t,h,e.config.maxBufferHole).end-h)/s;if(g<2*r.duration/s&&g<p){var m=void 0,y=void 0;for(y=r.level-1;i<y;y--){var v=l[y].realBitrate?Math.max(l[y].realBitrate,l[y].bitrate):l[y].bitrate;if((m=r.duration*v/(6.4*u))<g)break}m<p&&(S.logger.warn("loading too slow, abort fragment loading and switch to level "+y+":fragLoadedDelay["+y+"]<fragLoadedDelay["+(r.level-1)+"];bufferStarvationDelay:"+m.toFixed(1)+"<"+p.toFixed(1)+":"+g.toFixed(1)),e.nextLoadLevel=y,this._bwEstimator.sample(o,a.loaded),n.abort(),this.clearTimer(),e.trigger(_.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,stats:a}))}}}}},e.prototype.onFragLoaded=function(e){var t=e.frag;if("main"===t.type&&o.isFinite(t.sn)){if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var r=this.hls.levels[t.level],n=(r.loaded?r.loaded.bytes:0)+e.stats.loaded,i=(r.loaded?r.loaded.duration:0)+e.frag.duration;r.loaded={bytes:n,duration:i},r.realBitrate=Math.round(8*n/i)}if(e.frag.bitrateTest){var a=e.stats;a.tparsed=a.tbuffered=a.tload,this.onFragBuffered(e)}}},e.prototype.onFragBuffered=function(e){var t=e.stats,r=e.frag;if(!0!==t.aborted&&"main"===r.type&&o.isFinite(r.sn)&&(!r.bitrateTest||t.tload===t.tbuffered)){var n=t.tparsed-t.trequest;S.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(n,t.loaded),t.bwEstimate=this._bwEstimator.getEstimate(),r.bitrateTest?this.bitrateTestDelay=n/1e3:this.bitrateTestDelay=0}},e.prototype.onError=function(e){switch(e.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},e.prototype.clearTimer=function(){clearInterval(this.timer),this.timer=null},Object.defineProperty(e.prototype,"nextAutoLevel",{get:function(){var e=this._nextAutoLevel,t=this._bwEstimator;if(!(-1===e||t&&t.canEstimate()))return e;var r=this._nextABRAutoLevel;return-1!==e&&(r=Math.min(e,r)),r},set:function(e){this._nextAutoLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_nextABRAutoLevel",{get:function(){var e=this.hls,t=e.maxAutoLevel,r=e.levels,n=e.config,i=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,f=this._bwEstimator?this._bwEstimator.getEstimate():n.abrEwmaDefaultEstimate,d=(b.BufferHelper.bufferInfo(a,l,n.maxBufferHole).end-l)/u,c=this._findBestLevel(o,s,f,i,t,d,n.abrBandWidthFactor,n.abrBandWidthUpFactor,r);if(0<=c)return c;S.logger.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var h=s?Math.min(s,n.maxStarvationDelay):n.maxStarvationDelay,p=n.abrBandWidthFactor,g=n.abrBandWidthUpFactor;if(0===d){var m=this.bitrateTestDelay;m&&(h=(s?Math.min(s,n.maxLoadingDelay):n.maxLoadingDelay)-m,S.logger.trace("bitrate test took "+Math.round(1e3*m)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*h)+" ms"),p=g=1)}return c=this._findBestLevel(o,s,f,i,t,d+h,p,g,r),Math.max(c,0)},enumerable:!0,configurable:!0}),e.prototype._findBestLevel=function(e,t,r,n,i,a,o,s,l){for(var u=i;n<=u;u--){var f=l[u];if(f){var d=f.details,c=d?d.totalduration/d.fragments.length:t,h=!!d&&d.live,p=void 0;p=u<=e?o*r:s*r;var g=l[u].realBitrate?Math.max(l[u].realBitrate,l[u].bitrate):l[u].bitrate,m=g*c/p;if(S.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(p)+"/"+g+"/"+c+"/"+a+"/"+m),g<p&&(!m||h&&!this.bitrateTestDelay||m<a))return u}}return-1},e}(i.default);r.default=e}).call(this,l(2).Number)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(63),n=function(){function e(e,t,r,n){this.hls=e,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new i.default(t),this.fast_=new i.default(r)}return e.prototype.sample=function(e,t){var r=8e3*t/(e=Math.max(e,this.minDelayMs_)),n=e/1e3;this.fast_.sample(n,r),this.slow_.sample(n,r)},e.prototype.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},e.prototype.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},e.prototype.destroy=function(){},e}();t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=0,this.totalWeight_=0}return e.prototype.sample=function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e},e.prototype.getTotalWeight=function(){return this.totalWeight_},e.prototype.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/e}return this.estimate_},e}();t.default=n},function(e,r,s){(function(n){var i,t=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var l=s(1),a=s(4),u=s(0),f=s(3),o=s(12).getMediaSource(),e=function(r){function e(e){var t=r.call(this,e,l.default.MEDIA_ATTACHING,l.default.MEDIA_DETACHING,l.default.MANIFEST_PARSED,l.default.BUFFER_RESET,l.default.BUFFER_APPENDING,l.default.BUFFER_CODECS,l.default.BUFFER_EOS,l.default.BUFFER_FLUSHING,l.default.LEVEL_PTS_UPDATED,l.default.LEVEL_UPDATED)||this;return t._msDuration=null,t._levelDuration=null,t._levelTargetDuration=10,t._live=null,t._objectUrl=null,t.bufferCodecEventsExpected=0,t.onsbue=t.onSBUpdateEnd.bind(t),t.onsbe=t.onSBUpdateError.bind(t),t.pendingTracks={},t.tracks={},t}return t(e,r),e.prototype.destroy=function(){a.default.prototype.destroy.call(this)},e.prototype.onLevelPtsUpdated=function(e){var t=e.type,r=this.tracks.audio;if("audio"===t&&r&&"audio/mpeg"===r.container){var n=this.sourceBuffer.audio;if(.1<Math.abs(n.timestampOffset-e.start)){var i=n.updating;try{n.abort()}catch(e){u.logger.warn("can not abort audio buffer: "+e)}i?this.audioTimestampOffset=e.start:(u.logger.warn("change mpeg audio timestamp offset from "+n.timestampOffset+" to "+e.start),n.timestampOffset=e.start)}}},e.prototype.onManifestParsed=function(e){this.bufferCodecEventsExpected=e.altAudio?2:1,u.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},e.prototype.onMediaAttaching=function(e){var t=this.media=e.media;if(t){var r=this.mediaSource=new o;this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),r.addEventListener("sourceopen",this.onmso),r.addEventListener("sourceended",this.onmse),r.addEventListener("sourceclose",this.onmsc),t.src=window.URL.createObjectURL(r),this._objectUrl=t.src}},e.prototype.onMediaDetaching=function(){u.logger.log("media source detaching");var e=this.mediaSource;if(e){if("open"===e.readyState)try{e.endOfStream()}catch(e){u.logger.warn("onMediaDetaching:"+e.message+" while calling endOfStream")}e.removeEventListener("sourceopen",this.onmso),e.removeEventListener("sourceended",this.onmse),e.removeEventListener("sourceclose",this.onmsc),this.media&&(window.URL.revokeObjectURL(this._objectUrl),this.media.src===this._objectUrl?(this.media.removeAttribute("src"),this.media.load()):u.logger.warn("media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.onmso=this.onmse=this.onmsc=null,this.hls.trigger(l.default.MEDIA_DETACHED)},e.prototype.onMediaSourceOpen=function(){u.logger.log("media source opened"),this.hls.trigger(l.default.MEDIA_ATTACHED,{media:this.media});var e=this.mediaSource;e&&e.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()},e.prototype.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.pendingTracks,r=Object.keys(t).length;(r&&!e||2===r)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())},e.prototype.onMediaSourceClose=function(){u.logger.log("media source closed")},e.prototype.onMediaSourceEnded=function(){u.logger.log("media source ended")},e.prototype.onSBUpdateEnd=function(){if(this.audioTimestampOffset){var e=this.sourceBuffer.audio;u.logger.warn("change mpeg audio timestamp offset from "+e.timestampOffset+" to "+this.audioTimestampOffset),e.timestampOffset=this.audioTimestampOffset,delete this.audioTimestampOffset}this._needsFlush&&this.doFlush(),this._needsEos&&this.checkEos(),this.appending=!1;var r=this.parent,t=this.segments.reduce(function(e,t){return t.parent===r?e+1:e},0),n={},i=this.sourceBuffer;for(var a in i)n[a]=i[a].buffered;this.hls.trigger(l.default.BUFFER_APPENDED,{parent:r,pending:t,timeRanges:n}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration(),0===t&&this.flushLiveBackBuffer()},e.prototype.onSBUpdateError=function(e){u.logger.error("sourceBuffer error:",e),this.hls.trigger(l.default.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})},e.prototype.onBufferReset=function(){var e=this.sourceBuffer;for(var t in e){var r=e[t];try{this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this.onsbue),r.removeEventListener("error",this.onsbe)}catch(e){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0},e.prototype.onBufferCodecs=function(t){var r=this;if(!Object.keys(this.sourceBuffer).length){Object.keys(t).forEach(function(e){r.pendingTracks[e]=t[e]});var e=this.mediaSource;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),e&&"open"===e.readyState&&this.checkPendingTracks()}},e.prototype.createSourceBuffers=function(e){var t=this.sourceBuffer,r=this.mediaSource;for(var n in e)if(!t[n]){var i=e[n],a=i.levelCodec||i.codec,o=i.container+";codecs="+a;u.logger.log("creating sourceBuffer("+o+")");try{var s=t[n]=r.addSourceBuffer(o);s.addEventListener("updateend",this.onsbue),s.addEventListener("error",this.onsbe),this.tracks[n]={codec:a,container:i.container},i.buffer=s}catch(e){u.logger.error("error while trying to add sourceBuffer:"+e.message),this.hls.trigger(l.default.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:e,mimeType:o})}}this.hls.trigger(l.default.BUFFER_CREATED,{tracks:e})},e.prototype.onBufferAppending=function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())},e.prototype.onBufferAppendFail=function(e){u.logger.error("sourceBuffer error:",e.event),this.hls.trigger(l.default.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})},e.prototype.onBufferEos=function(e){var t=this.sourceBuffer,r=e.type;for(var n in t)r&&n!==r||t[n].ended||(t[n].ended=!0,u.logger.log(n+" sourceBuffer now EOS"));this.checkEos()},e.prototype.checkEos=function(){var e=this.sourceBuffer,t=this.mediaSource;if(t&&"open"===t.readyState){for(var r in e){var n=e[r];if(!n.ended)return;if(n.updating)return void(this._needsEos=!0)}u.logger.log("all media data are available, signal endOfStream() to MediaSource and stop loading fragment");try{t.endOfStream()}catch(e){u.logger.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1}else this._needsEos=!1},e.prototype.onBufferFlushing=function(e){this.flushRange.push({start:e.startOffset,end:e.endOffset,type:e.type}),this.flushBufferCounter=0,this.doFlush()},e.prototype.flushLiveBackBuffer=function(){if(this._live){var e=this.hls.config.liveBackBufferLength;if(isFinite(e)&&!(e<0))for(var t=this.media.currentTime,r=this.sourceBuffer,n=Object.keys(r),i=t-Math.max(e,this._levelTargetDuration),a=n.length-1;0<=a;a--){var o=n[a],s=r[o].buffered;0<s.length&&i>s.start(0)&&this.removeBufferRange(o,r[o],0,i)}}},e.prototype.onLevelUpdated=function(e){var t=e.details;0<t.fragments.length&&(this._levelDuration=t.totalduration+t.fragments[0].start,this._levelTargetDuration=t.averagetargetduration||t.targetduration||10,this._live=t.live,this.updateMediaElementDuration())},e.prototype.updateMediaElementDuration=function(){var e,t=this.hls.config;if(null!==this._levelDuration&&this.media&&this.mediaSource&&this.sourceBuffer&&0!==this.media.readyState&&"open"===this.mediaSource.readyState){for(var r in this.sourceBuffer)if(!0===this.sourceBuffer[r].updating)return;e=this.media.duration,null===this._msDuration&&(this._msDuration=this.mediaSource.duration),!0===this._live&&!0===t.liveDurationInfinity?(u.logger.log("Media Source duration is set to Infinity"),this._msDuration=this.mediaSource.duration=1/0):(this._levelDuration>this._msDuration&&this._levelDuration>e||!n.isFinite(e))&&(u.logger.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},e.prototype.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,r=this.sourceBuffer;try{for(var n in r)t+=r[n].buffered.length}catch(e){u.logger.error("error while accessing sourceBuffer.buffered")}this.appended=t,this.hls.trigger(l.default.BUFFER_FLUSHED)}},e.prototype.doAppending=function(){var e=this.hls,t=this.segments,r=this.sourceBuffer;if(Object.keys(r).length){if(this.media.error)return this.segments=[],void u.logger.error("trying to append although a media error occured, flush segment and abort");if(this.appending)return;if(t&&t.length){var n=t.shift();try{var i=r[n.type];i?i.updating?t.unshift(n):(i.ended=!1,this.parent=n.parent,i.appendBuffer(n.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(r){u.logger.error("error while trying to append buffer:"+r.message),t.unshift(n);var a={type:f.ErrorTypes.MEDIA_ERROR,parent:n.parent};22!==r.code?(this.appendError?this.appendError++:this.appendError=1,a.details=f.ErrorDetails.BUFFER_APPEND_ERROR,this.appendError>e.config.appendErrorMaxRetry?(u.logger.log("fail "+e.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),this.segments=[],a.fatal=!0):a.fatal=!1):(this.segments=[],a.details=f.ErrorDetails.BUFFER_FULL_ERROR,a.fatal=!1),e.trigger(l.default.ERROR,a)}}}},e.prototype.flushBuffer=function(e,t,r){var n,i=this.sourceBuffer;if(Object.keys(i).length){if(u.logger.log("flushBuffer,pos/start/end: "+this.media.currentTime.toFixed(3)+"/"+e+"/"+t),this.flushBufferCounter<this.appended){for(var a in i)if(!r||a===r){if((n=i[a]).ended=!1,n.updating)return u.logger.warn("cannot flush, sb updating in progress"),!1;if(this.removeBufferRange(a,n,e,t))return this.flushBufferCounter++,!1}}else u.logger.warn("abort flushing too many retries");u.logger.log("buffer flushed")}return!0},e.prototype.removeBufferRange=function(e,t,r,n){try{for(var i=0;i<t.buffered.length;i++){var a=t.buffered.start(i),o=t.buffered.end(i),s=Math.max(a,r),l=Math.min(o,n);if(.5<Math.min(l,o)-s)return u.logger.log("sb remove "+e+" ["+s+","+l+"], of ["+a+","+o+"], pos:"+this.media.currentTime),t.remove(s,l),!0}}catch(e){u.logger.warn("removeBufferRange failed",e)}return!1},e}(a.default);r.default=e}).call(this,s(2).Number)},function(e,r,o){(function(n){var i,e=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var a=o(1),t=function(r){function i(e){var t=r.call(this,e,a.default.FPS_DROP_LEVEL_CAPPING,a.default.MEDIA_ATTACHING,a.default.MANIFEST_PARSED,a.default.BUFFER_CODECS,a.default.MEDIA_DETACHING)||this;return t.autoLevelCapping=n.POSITIVE_INFINITY,t.firstLevel=null,t.levels=[],t.media=null,t.restrictedLevels=[],t.timer=null,t}return e(i,r),i.prototype.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=null,this._stopCapping())},i.prototype.onFpsDropLevelCapping=function(e){i.isLevelAllowed(e.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(e.droppedLevel)},i.prototype.onMediaAttaching=function(e){this.media=e.media instanceof window.HTMLVideoElement?e.media:null},i.prototype.onManifestParsed=function(e){var t=this.hls;this.restrictedLevels=[],this.levels=e.levels,this.firstLevel=e.firstLevel,t.config.capLevelToPlayerSize&&e.video&&this._startCapping()},i.prototype.onBufferCodecs=function(e){this.hls.config.capLevelToPlayerSize&&e.video&&this._startCapping()},i.prototype.onLevelsUpdated=function(e){this.levels=e.levels},i.prototype.onMediaDetaching=function(){this._stopCapping()},i.prototype.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}}},i.prototype.getMaxLevel=function(r){var n=this;if(!this.levels)return-1;var e=this.levels.filter(function(e,t){return i.isLevelAllowed(t,n.restrictedLevels)&&t<=r});return i.getMaxLevelByMediaSize(e,this.mediaWidth,this.mediaHeight)},i.prototype._startCapping=function(){this.timer||(this.autoLevelCapping=n.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},i.prototype._stopCapping=function(){this.restrictedLevels=[],this.firstLevel=null,this.autoLevelCapping=n.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer),this.timer=null)},Object.defineProperty(i.prototype,"mediaWidth",{get:function(){var e,t=this.media;return t&&(e=t.width||t.clientWidth||t.offsetWidth,e*=i.contentScaleFactor),e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"mediaHeight",{get:function(){var e,t=this.media;return t&&(e=t.height||t.clientHeight||t.offsetHeight,e*=i.contentScaleFactor),e},enumerable:!0,configurable:!0}),Object.defineProperty(i,"contentScaleFactor",{get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e},enumerable:!0,configurable:!0}),i.isLevelAllowed=function(e,t){return void 0===t&&(t=[]),-1===t.indexOf(e)},i.getMaxLevelByMediaSize=function(e,t,r){if(!e||e&&!e.length)return-1;for(var n,i,a=e.length-1,o=0;o<e.length;o+=1){var s=e[o];if((s.width>=t||s.height>=r)&&(n=s,!(i=e[o+1])||n.width!==i.width||n.height!==i.height)){a=o;break}}return a},i}(o(4).default);r.default=t}).call(this,o(2).Number)},function(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var f=r(1),a=r(4),d=r(0),c=window.performance,o=function(t){function e(e){return t.call(this,e,f.default.MEDIA_ATTACHING)||this}return i(e,t),e.prototype.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},e.prototype.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))},e.prototype.checkFPS=function(e,t,r){var n=c.now();if(t){if(this.lastTime){var i=n-this.lastTime,a=r-this.lastDroppedFrames,o=t-this.lastDecodedFrames,s=1e3*a/i,l=this.hls;if(l.trigger(f.default.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:r}),0<s&&a>l.config.fpsDroppedMonitoringThreshold*o){var u=l.currentLevel;d.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),0<u&&(-1===l.autoLevelCapping||l.autoLevelCapping>=u)&&(u-=1,l.trigger(f.default.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:l.currentLevel}),l.autoLevelCapping=u,l.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=r,this.lastDecodedFrames=t}},e.prototype.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)},e}(a.default);t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var f=r(0),d=window.performance,i=window.XMLHttpRequest,n=function(){function e(e){e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}return e.prototype.destroy=function(){this.abort(),this.loader=null},e.prototype.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},e.prototype.load=function(e,t,r){this.context=e,this.config=t,this.callbacks=r,this.stats={trequest:d.now(),retry:0},this.retryDelay=t.retryDelay,this.loadInternal()},e.prototype.loadInternal=function(){var e,t=this.context;e=this.loader=new i;var r=this.stats;r.tfirst=0,r.loaded=0;var n=this.xhrSetup;try{if(n)try{n(e,t.url)}catch(r){e.open("GET",t.url,!0),n(e,t.url)}e.readyState||e.open("GET",t.url,!0)}catch(r){return void this.callbacks.onError({code:e.status,text:r.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()},e.prototype.readystatechange=function(e){var t=e.currentTarget,r=t.readyState,n=this.stats,i=this.context,a=this.config;if(!n.aborted&&2<=r)if(window.clearTimeout(this.requestTimeout),0===n.tfirst&&(n.tfirst=Math.max(d.now(),n.trequest)),4===r){var o=t.status;if(200<=o&&o<300){n.tload=Math.max(n.tfirst,d.now());var s=void 0,l=void 0;l="arraybuffer"===i.responseType?(s=t.response).byteLength:(s=t.responseText).length,n.loaded=n.total=l;var u={url:t.responseURL,data:s};this.callbacks.onSuccess(u,n,i,t)}else n.retry>=a.maxRetry||400<=o&&o<499?(f.logger.error(o+" while loading "+i.url),this.callbacks.onError({code:o,text:t.statusText},i,t)):(f.logger.warn(o+" while loading "+i.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),n.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),a.timeout)},e.prototype.loadtimeout=function(){f.logger.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},e.prototype.loadprogress=function(e){var t=e.currentTarget,r=this.stats;r.loaded=e.loaded,e.lengthComputable&&(r.total=e.total);var n=this.callbacks.onProgress;n&&n(r,this.context,null,t)},e}();t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n="undefined"!=typeof window&&window.navigator&&window.navigator.requestMediaKeySystemAccess?window.navigator.requestMediaKeySystemAccess.bind(window.navigator):null;t.requestMediaKeySystemAccess=n}]).default)}),xi=e(Ai),Li=(Ai.Hls,function(){function e(e,t,r){this.category=e,this.code=t,this.name=t.toString(),this.message=r;try{throw new Error(this.toString())}catch(e){this.stack=e.stack}}return e.prototype.toString=function(){return"QPlayError."+this.category+"."+this.code+": "+this.message},e}());(Ei=Si||(Si={})).COMMON="COMMON",Ei.HLS="HLS",Ei.NATIVE="NATIVE",Ei.MP4="MP4",(Ti=wi||(wi={}))[Ti.UNSUPPORT=1e4]="UNSUPPORT",Ti[Ti.UNKNOWN_FORMAT=10001]="UNKNOWN_FORMAT",Ti[Ti.CAN_NOT_FETCH=10002]="CAN_NOT_FETCH",Ti[Ti.FULLSCRREN_NOTSUPPORT=10003]="FULLSCRREN_NOTSUPPORT",Ti[Ti.VIDEO_SOURCE_STALLED=10004]="VIDEO_SOURCE_STALLED",Ti[Ti.VIDEO_ELEMENT_ERROR=10005]="VIDEO_ELEMENT_ERROR",Ti[Ti.VIDEO_PLAY_FAILD=10006]="VIDEO_PLAY_FAILD",Ti[Ti.INVALID_CONFIG=10007]="INVALID_CONFIG",Ti[Ti.UNEXPECTED_ERROR=10008]="UNEXPECTED_ERROR",Ti[Ti.HLS_FATAL_ERROR=10009]="HLS_FATAL_ERROR",Ti[Ti.CAN_NOT_FETCH_WASM=10010]="CAN_NOT_FETCH_WASM",Ti[Ti.MP4_DRM_KEY_ERROR=10011]="MP4_DRM_KEY_ERROR";var Ri,Ii="object"==typeof Reflect?Reflect:null,Ci=Ii&&"function"==typeof Ii.apply?Ii.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};Ri=Ii&&"function"==typeof Ii.ownKeys?Ii.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Di=Number.isNaN||function(e){return e!=e};function Pi(){Pi.init.call(this)}var Ui=Pi;(Pi.EventEmitter=Pi).prototype._events=void 0,Pi.prototype._eventsCount=0,Pi.prototype._maxListeners=void 0;var ki=10;function Oi(e){return void 0===e._maxListeners?Pi.defaultMaxListeners:e._maxListeners}function Mi(e,t,r,n){var i,a,o,s;if("function"!=typeof r)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r);if(void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]),void 0===o)o=a[t]=r,++e._eventsCount;else if("function"==typeof o?o=a[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),0<(i=Oi(e))&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,s=l,console&&console.warn&&console.warn(s)}return e}function Fi(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=function(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,Ci(this.listener,this.target,e))}.bind(n);return i.listener=r,n.wrapFn=i}function Ni(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):zi(i,i.length)}function Bi(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function zi(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(Pi,"defaultMaxListeners",{enumerable:!0,get:function(){return ki},set:function(e){if("number"!=typeof e||e<0||Di(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");ki=e}}),Pi.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Pi.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||Di(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},Pi.prototype.getMaxListeners=function(){return Oi(this)},Pi.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var a;if(0<t.length&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)Ci(s,this,t);else{var l=s.length,u=zi(s,l);for(r=0;r<l;++r)Ci(u[r],this,t)}return!0},Pi.prototype.on=Pi.prototype.addListener=function(e,t){return Mi(this,e,t,!1)},Pi.prototype.prependListener=function(e,t){return Mi(this,e,t,!0)},Pi.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,Fi(this,e,t)),this},Pi.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,Fi(this,e,t)),this},Pi.prototype.off=Pi.prototype.removeListener=function(e,t){var r,n,i,a,o;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;0<=a;a--)if(r[a]===t||r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},Pi.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;0<=n;n--)this.removeListener(e,t[n]);return this},Pi.prototype.listeners=function(e){return Ni(this,e,!0)},Pi.prototype.rawListeners=function(e){return Ni(this,e,!1)},Pi.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Bi.call(e,t)},Pi.prototype.listenerCount=Bi,Pi.prototype.eventNames=function(){return 0<this._eventsCount?Ri(this._events):[]};var ji=function(i){function e(e,t,r){var n=i.call(this)||this;return n.supportFeatures={bitrate:!1},n.eventList=[],n.config=t,n.render=e,n.eventList=n.eventList.concat(r),n}return t(e,i),Object.defineProperty(e.prototype,"video",{get:function(){return this.render.video},enumerable:!0,configurable:!0}),e.probe=function(e,t,r){return!1},e.playConfigToEngineConfig=function(e,t){},e.isSupport=function(e){return!1},e.prototype.replaceRender=function(e){this.render=e},e.prototype.handleRenderEvents=function(){var t=this;this.render.canplay?this.emit("ready",this.render.totalTime):this.render.once("canplay",function(e){t.emit("ready",e)})},e}(Ui),Gi=function(n){function e(e,t,r){return n.call(this,e,t,r)||this}return t(e,n),e}(ji),Hi={VERBOSE:0,DEBUG:1,WARNING:2,DISABLE:3},qi=new(function(){function e(e){this.name=e,this.level="VERBOSE"}return e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!(Hi[this.level]>Hi.VERBOSE)){var r="%c"+this.name+"-verbose";console.info.apply(console,[r,"color: #66ccff;"].concat(e))}},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!(Hi[this.level]>Hi.DEBUG)){var r="%c"+this.name+"-debug";console.info.apply(console,[r,"color: #A28148; font-weight: bold;"].concat(e))}},e.prototype.warning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!(Hi[this.level]>Hi.WARNING)){var r="%c"+this.name+"-WARNING";console.warn.apply(console,[r,"color: #E44F44; font-weight: bold;"].concat(e))}},e.prototype.setLevel=function(e){for(var t in Hi)if(Hi[t]===e)return void(this.level=t);this.level="DEBUG"},e}())("QPLAYER"),Vi=function(n){function i(e,t){var r=n.call(this,e,t,["#hls:mainfest-parsed"])||this;if(r.supportFeatures={bitrate:!0},r.config=t,!i.isSupport())throw new Li(Si.HLS,wi.UNSUPPORT,"not support hls");return r.initHLS(),r}return t(i,n),i.isSupport=function(e){return(!(e&&e.hls&&e.hls.isG711)||"object"==typeof window.WebAssembly&&"function"==typeof window.WebAssembly.Memory)&&xi.isSupported()},i.probe=function(e,t){return!!e.split("?")[0].endsWith("m3u8")||("application/x-mpegurl"===t||"vnd.apple.mpegURL"===t)},i.prototype.toggleAutoQualityControl=function(){this.hls.autoLevelEnabled?this.hls.nextLevel=this.hls.currentLevel:this.hls.nextLevel=-1,this.emit("@auto-quality-switch-change",this.hls.autoLevelEnabled)},Object.defineProperty(i.prototype,"currentQuality",{get:function(){var t=-1===this.hls.currentLevel?this.hls.firstLevel:this.hls.currentLevel;return{quality:this.qualityList.find(function(e){return e.id===t})||null,isAuto:this.hls.autoLevelEnabled}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"qualityList",{get:function(){var r=this;return this.hls.levels.sort().map(function(e,t){return{id:t,name:r.config.qualityName?r.config.qualityName[t]:r.getHLSLevelName(e),bitrate:e.bitrate,url:e.url[0],type:"hls"}})},enumerable:!0,configurable:!0}),i.prototype.changeQuality=function(e){this.hls.autoLevelEnabled&&-1!==e&&this.emit("@auto-quality-switch-change",!1),this.hls.currentLevel=e},i.playConfigToEngineConfig=function(e,t){return a({url:e},t.hls)},i.prototype.reload=function(){this.hls.destroy(),this.initHLS()},i.prototype.destroy=function(){this.hls.destroy(),this.removeAllListeners()},i.prototype.getHLSLevelName=function(e){return e.name?e.name:e.height?e.height+"p":e.bitrate?Math.round(e.bitrate/1e3)+"kbps":"unkonwn"},i.prototype.initHLS=function(){var r=this,e={debug:"WARNING"!==qi.level&&"DISABLE"!==qi.level,qiniuDRMKey:this.config.DRMKey?this.config.DRMKey:void 0,g711WasmModule:this.config.g711WasmModule,enableWorker:!this.config.g711WasmModule},n=!0,i=!0;this.hls=new xi(e),this.hls.loadSource(this.config.url),this.hls.attachMedia(this.render.video),this.hls.once(xi.Events.MANIFEST_PARSED,function(){qi.verbose("hls: mainfest parsed"),r.emit("#hls:mainfest-parsed"),r.emit("@get-quality-list",r.qualityList)}),this.hls.on(xi.Events.LEVEL_SWITCHING,function(e,t){r.hls.autoLevelEnabled||(r.render.isLoading=!0,r.render.setLoadingStateLock(!0)),n?n=!1:r.emit("@quality-switching",t.level)}),this.hls.on(xi.Events.LEVEL_SWITCHED,function(e,t){r.render.setLoadingStateLock(!1),r.render.isLoading=!1,i?i=!1:r.emit("@quality-switched",r.currentQuality.quality.id)}),this.hls.on(xi.Events.ERROR,function(e,t){switch(console.log("handle hls error!",t),r.render.isLoading=!1,t.type){case xi.ErrorTypes.NETWORK_ERROR:if(t.response&&400<t.response.code&&t.response.code<500)return r.emit("error",new Li(Si.COMMON,wi.CAN_NOT_FETCH,t.details)),void r.hls.destroy();if(!t.fatal)return;qi.warning("hls network fatal error, try to recovery"),r.hls.startLoad();break;case xi.ErrorTypes.MEDIA_ERROR:if(!t.fatal)return;qi.warning("hls media fatal error, try to recovery"),r.hls.recoverMediaError();break;default:if(!t.fatal)return;r.emit("error",new Li(Si.HLS,wi.HLS_FATAL_ERROR,t.details))}}),this.handleRenderEvents()},i}(Gi),Wi=function(e,t){return(Wi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function Yi(e,t){function r(){this.constructor=e}Wi(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Ki,Xi="object"==typeof Reflect?Reflect:null,Zi=Xi&&"function"==typeof Xi.apply?Xi.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};Ki=Xi&&"function"==typeof Xi.ownKeys?Xi.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Qi=Number.isNaN||function(e){return e!=e};function Ji(){Ji.init.call(this)}var $i=Ji;(Ji.EventEmitter=Ji).prototype._events=void 0,Ji.prototype._eventsCount=0,Ji.prototype._maxListeners=void 0;var ea,ta,ra,na,ia,aa,oa=10;function sa(e){return void 0===e._maxListeners?Ji.defaultMaxListeners:e._maxListeners}function la(e,t,r,n){var i,a,o,s;if("function"!=typeof r)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r);if(void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]),void 0===o)o=a[t]=r,++e._eventsCount;else if("function"==typeof o?o=a[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),0<(i=sa(e))&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,s=l,console&&console.warn&&console.warn(s)}return e}function ua(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=function(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,Zi(this.listener,this.target,e))}.bind(n);return i.listener=r,n.wrapFn=i}function fa(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):ca(i,i.length)}function da(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function ca(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function ha(e,t){var r=e[t+0]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],n=8,i=String.fromCharCode(e[t+4])+String.fromCharCode(e[t+5])+String.fromCharCode(e[t+6])+String.fromCharCode(e[t+7]);return 1===r&&(r=e[t+8]<<56|e[t+9]<<48|e[t+10]<<40|e[t+11]<<32|e[t+12]<<24|e[t+11]<<16|e[t+12]<<8|e[t+13],n=16),{size:r,type:i,headerSize:n}}function pa(e,t){for(var r=0;r<e.length;r+=1)if(t>=e.start(r)&&t<=e.end(r))return!0;return!1}function ga(e,t){if(0===e.length)return[t];for(var r=0,n=e;r<n.length;r++){var i=n[r];if(t.start>=i.start&&t.end<=i.end)return e;if(t.start>i.end||t.end<i.start)return e.push(t),e;var a=t.start<i.start?t.start:i.start,o=t.end>i.end?t.end:i.end;return i.start=a,i.end=o,e}return e}function ma(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r+=1)if(e[r]!==t[r])return!1;return!0}function ya(e,t,r){var n={type:t,message:r};console.warn("DRM MP4 ERROR: "+t+", "+r),e.emit("error",n)}Object.defineProperty(Ji,"defaultMaxListeners",{enumerable:!0,get:function(){return oa},set:function(e){if("number"!=typeof e||e<0||Qi(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");oa=e}}),Ji.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ji.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||Qi(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},Ji.prototype.getMaxListeners=function(){return sa(this)},Ji.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var a;if(0<t.length&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)Zi(s,this,t);else{var l=s.length,u=ca(s,l);for(r=0;r<l;++r)Zi(u[r],this,t)}return!0},Ji.prototype.on=Ji.prototype.addListener=function(e,t){return la(this,e,t,!1)},Ji.prototype.prependListener=function(e,t){return la(this,e,t,!0)},Ji.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,ua(this,e,t)),this},Ji.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,ua(this,e,t)),this},Ji.prototype.off=Ji.prototype.removeListener=function(e,t){var r,n,i,a,o;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;0<=a;a--)if(r[a]===t||r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},Ji.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;0<=n;n--)this.removeListener(e,t[n]);return this},Ji.prototype.listeners=function(e){return fa(this,e,!0)},Ji.prototype.rawListeners=function(e){return fa(this,e,!1)},Ji.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):da.call(e,t)},Ji.prototype.listenerCount=da,Ji.prototype.eventNames=function(){return 0<this._eventsCount?Ki(this._events):[]},(ta=ea||(ea={})).NEED_BUFFER="needbuffer",ta.BUFFER_IS_ENOUGH="bufferisenough",(na=ra||(ra={})).NETWORK="network",na.MEDIA="media",na.KEY="key",na.OTHER="other",(aa=ia||(ia={})).ON_CHUNK="fetchio:on_chunk",aa.ENDED="fetchio:end",aa.INTERNAL_BUFFER_IO_STATE_CHANGE="@bufferio_state_change";var va=function(r){function e(e){var t=r.call(this)||this;return t.url="",t.currentRange={start:0,end:-1},t.currentReaderIsFinish=!1,t.downloadedRanges=[],t.currentDownloadRange={start:0,end:0},t.currentReqId=Date.now(),t.bufferIoState=ea.NEED_BUFFER,t.seek=function(e){t.currentReader=void 0,t.start(t.url,{start:e,end:-1})},t.onBufferIoStateChange=function(e){e!==t.bufferIoState&&(t.bufferIoState=e,t.emit(ia.INTERNAL_BUFFER_IO_STATE_CHANGE))},t.drmMp4=e,t.maxIoRetry=t.drmMp4.config.maxIoRetry,t}return Yi(e,r),e.prototype.start=function(e,t,r){var n=this;void 0===r&&(r=!1),this.url=e,r||(this.maxIoRetry=this.drmMp4.config.maxIoRetry);var i=Date.now();this.currentReqId=i,0===this.currentDownloadRange.start&&0===this.currentDownloadRange.end||(this.downloadedRanges.push(this.currentDownloadRange),this.currentDownloadRange={start:0,end:0});var a,o={mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade",headers:{Range:(a=t,"bytes="+a.start.toString()+"-"+(-1===a.end?"":a.end.toString()))}};this.currentDownloadRange.start=this.currentDownloadRange.end=t.start,this.currentRange=t,fetch(e,o).then(function(e){if(e.body)return e.ok?void(i===n.currentReqId?(n.currentReader=e.body.getReader(),n.currentReaderIsFinish=!1,n.pump(n.currentReader)):e.body.getReader().cancel()):400<=e.status&&e.status<500?void ya(n.drmMp4,ra.NETWORK,"can not request"):(console.warn("response status:",e.status,"retry"),void n.retry(n.url,{start:n.currentDownloadRange.end,end:-1}));ya(n.drmMp4,ra.NETWORK,"can not find media body")}).catch(function(e){console.warn("can not fetch, retry"),n.retry(n.url,{start:n.currentDownloadRange.end,end:-1})})},e.prototype.retry=function(e,t){var r=this;return 0<this.maxIoRetry?(this.maxIoRetry-=1,void setTimeout(function(){return r.start(e,t,!0)},1e3)):void ya(this.drmMp4,ra.NETWORK,"can not get response after retry")},e.prototype.release=function(){this.currentReader&&(this.currentReader=void 0)},e.prototype.pump=function(n){var i=this;new Promise(function(e){i.bufferIoState!==ea.NEED_BUFFER?i.on(ia.INTERNAL_BUFFER_IO_STATE_CHANGE,function(){if(i.bufferIoState===ea.NEED_BUFFER)return i.removeAllListeners(ia.INTERNAL_BUFFER_IO_STATE_CHANGE),void e()}):e()}).then(function(){var e,r,t;(e=n.read(),r=5e3,t=new Promise(function(e,t){setTimeout(function(){return t("timeout")},r)}),Promise.race([e,t])).then(function(e){n===i.currentReader&&i.currentReader?e.done?-1===i.currentRange.end&&(i.currentReaderIsFinish=!0,i.emit(ia.ENDED)):(i.emit(ia.ON_CHUNK,i.currentDownloadRange.end,e.value,e.done),i.currentDownloadRange.end+=e.value.length,i.pump(n)):n.cancel()}).catch(function(e){"timeout"===e&&console.warn("request timeout"),console.warn("loading response error, retry"),i.retry(i.url,{start:i.currentDownloadRange.end,end:-1})})})},e}($i);var _a,ba,Sa,Ea=(function(e,t){var r,n,c=(r=new Date,n=4,{setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),n<=1&&console.debug("["+c.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},info:function(e,t){n<=2&&console.info("["+c.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){n<=3&&console.warn("["+c.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){n<=4&&console.error("["+c.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}});c.getDurationString=function(e,t){var r;function n(e,t){for(var r=(""+e).split(".");r[0].length<t;)r[0]="0"+r[0];return r.join(".")}e<0?(r=!0,e=-e):r=!1;var i=e/(t||1),a=Math.floor(i/3600);i-=3600*a;var o=Math.floor(i/60),s=1e3*(i-=60*o);return s-=1e3*(i=Math.floor(i)),s=Math.floor(s),(r?"-":"")+a+":"+n(o,2)+":"+n(i,2)+"."+n(s,3)},c.printRanges=function(e){var t=e.length;if(0<t){for(var r="",n=0;n<t;n++)0<n&&(r+=","),r+="["+c.getDurationString(e.start(n))+","+c.getDurationString(e.end(n))+"]";return r}return"(empty)"},t.Log=c;var i=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};i.prototype.getPosition=function(){return this.position},i.prototype.getEndPosition=function(){return this.buffer.byteLength},i.prototype.getLength=function(){return this.buffer.byteLength},i.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},i.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},i.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position)<<8,r|=this.dataview.getUint8(this.position);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},i.prototype.readUint8=function(){return this.readAnyInt(1,!1)},i.prototype.readUint16=function(){return this.readAnyInt(2,!1)},i.prototype.readUint24=function(){return this.readAnyInt(3,!1)},i.prototype.readUint32=function(){return this.readAnyInt(4,!1)},i.prototype.readUint64=function(){return this.readAnyInt(8,!1)},i.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;r<e;r++)t+=String.fromCharCode(this.readUint8());return t}throw"Not enough bytes in buffer"},i.prototype.readCString=function(){for(var e=[];;){var t=this.readUint8();if(0===t)break;e.push(t)}return String.fromCharCode.apply(null,e)},i.prototype.readInt8=function(){return this.readAnyInt(1,!0)},i.prototype.readInt16=function(){return this.readAnyInt(2,!0)},i.prototype.readInt32=function(){return this.readAnyInt(4,!0)},i.prototype.readInt64=function(){return this.readAnyInt(8,!1)},i.prototype.readUint8Array=function(e){for(var t=new Uint8Array(e),r=0;r<e;r++)t[r]=this.readUint8();return t},i.prototype.readInt16Array=function(e){for(var t=new Int16Array(e),r=0;r<e;r++)t[r]=this.readInt16();return t},i.prototype.readUint16Array=function(e){for(var t=new Int16Array(e),r=0;r<e;r++)t[r]=this.readUint16();return t},i.prototype.readUint32Array=function(e){for(var t=new Uint32Array(e),r=0;r<e;r++)t[r]=this.readUint32();return t},i.prototype.readInt32Array=function(e){for(var t=new Int32Array(e),r=0;r<e;r++)t[r]=this.readInt32();return t},t.MP4BoxStream=i;var u=function(e,t,r){this._byteOffset=t||0,e instanceof ArrayBuffer?this.buffer=e:"object"==typeof e?(this.dataView=e,t&&(this._byteOffset+=t)):this.buffer=new ArrayBuffer(e||0),this.position=0,this.endianness=null==r?u.LITTLE_ENDIAN:r};u.prototype={},u.prototype.getPosition=function(){return this.position},u.prototype._realloc=function(e){if(this._dynamicSize){var t=this._byteOffset+this.position+e,r=this._buffer.byteLength;if(t<=r)t>this._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);r<t;)r*=2;var n=new ArrayBuffer(r),i=new Uint8Array(this._buffer);new Uint8Array(n,0,i.length).set(i),this.buffer=n,this._byteLength=t}}},u.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},u.BIG_ENDIAN=!1,u.LITTLE_ENDIAN=!0,u.prototype._byteLength=0,Object.defineProperty(u.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(u.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(u.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(u.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),u.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},u.prototype.isEof=function(){return this.position>=this._byteLength},u.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},u.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return u.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),u.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},u.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return u.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),u.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},u.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return u.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},u.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return u.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),u.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},u.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return u.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),u.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},u.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return u.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},u.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return u.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),u.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},u.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return u.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),u.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},u.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},u.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},u.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},u.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},u.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},u.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},u.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},u.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},u.endianness=0<new Int8Array(new Int16Array([1]).buffer)[0],u.memcpy=function(e,t,r,n,i){var a=new Uint8Array(e,t,i),o=new Uint8Array(r,n,i);a.set(o)},u.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},u.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},u.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;r<e.byteLength;r+=e.BYTES_PER_ELEMENT)for(var n=r+e.BYTES_PER_ELEMENT-1,i=r;i<n;n--,i++){var a=t[i];t[i]=t[n],t[n]=a}return e},u.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r<e.length;r++)t[r]=e[r];return String.fromCharCode.apply(null,t)},u.prototype.readString=function(e,t){return null==t||"ASCII"==t?String.fromCharCodeUint8.apply(null,[this.mapUint8Array(null==e?this.byteLength-this.position:e)]):new TextDecoder(t).decode(this.mapUint8Array(e))},u.prototype.readCString=function(e){var t=this.byteLength-this.position,r=new Uint8Array(this._buffer,this._byteOffset+this.position),n=t;null!=e&&(n=Math.min(e,t));for(var i=0;i<n&&0!==r[i];i++);var a=String.fromCharCodeUint8.apply(null,[this.mapUint8Array(i)]);return null!=e?this.position+=n-i:i!=t&&(this.position+=1),a};var a=Math.pow(2,32);u.prototype.readInt64=function(){return this.readInt32()*a+this.readUint32()},u.prototype.readUint64=function(){return this.readUint32()*a+this.readUint32()},u.prototype.readInt64=function(){return this.readUint32()*a+this.readUint32()},u.prototype.readUint24=function(){return(this.readUint8()<<16)+(this.readUint8()<<8)+this.readUint8()},(t.DataStream=u).prototype.save=function(e){var t=new Blob([this.buffer]);if(!window.URL||!URL.createObjectURL)throw"DataStream.save: Can't create object URL.";var r=window.URL.createObjectURL(t),n=document.createElement("a");n.setAttribute("href",r),n.setAttribute("download",e),n.click(),window.URL.revokeObjectURL(r)},u.prototype._dynamicSize=!0,Object.defineProperty(u.prototype,"dynamicSize",{get:function(){return this._dynamicSize},set:function(e){e||this._trimAlloc(),this._dynamicSize=e}}),u.prototype.shift=function(e){var t=new ArrayBuffer(this._byteLength-e),r=new Uint8Array(t),n=new Uint8Array(this._buffer,e,r.length);r.set(n),this.buffer=t,this.position-=e},u.prototype.writeInt32Array=function(e,t){if(this._realloc(4*e.length),e instanceof Int32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)u.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt32Array(e.length,t);else for(var r=0;r<e.length;r++)this.writeInt32(e[r],t)},u.prototype.writeInt16Array=function(e,t){if(this._realloc(2*e.length),e instanceof Int16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)u.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt16Array(e.length,t);else for(var r=0;r<e.length;r++)this.writeInt16(e[r],t)},u.prototype.writeInt8Array=function(e){if(this._realloc(1*e.length),e instanceof Int8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)u.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt8Array(e.length);else for(var t=0;t<e.length;t++)this.writeInt8(e[t])},u.prototype.writeUint32Array=function(e,t){if(this._realloc(4*e.length),e instanceof Uint32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)u.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint32Array(e.length,t);else for(var r=0;r<e.length;r++)this.writeUint32(e[r],t)},u.prototype.writeUint16Array=function(e,t){if(this._realloc(2*e.length),e instanceof Uint16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)u.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint16Array(e.length,t);else for(var r=0;r<e.length;r++)this.writeUint16(e[r],t)},u.prototype.writeUint8Array=function(e){if(this._realloc(1*e.length),e instanceof Uint8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)u.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint8Array(e.length);else for(var t=0;t<e.length;t++)this.writeUint8(e[t])},u.prototype.writeFloat64Array=function(e,t){if(this._realloc(8*e.length),e instanceof Float64Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)u.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat64Array(e.length,t);else for(var r=0;r<e.length;r++)this.writeFloat64(e[r],t)},u.prototype.writeFloat32Array=function(e,t){if(this._realloc(4*e.length),e instanceof Float32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)u.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat32Array(e.length,t);else for(var r=0;r<e.length;r++)this.writeFloat32(e[r],t)},u.prototype.writeInt32=function(e,t){this._realloc(4),this._dataView.setInt32(this.position,e,null==t?this.endianness:t),this.position+=4},u.prototype.writeInt16=function(e,t){this._realloc(2),this._dataView.setInt16(this.position,e,null==t?this.endianness:t),this.position+=2},u.prototype.writeInt8=function(e){this._realloc(1),this._dataView.setInt8(this.position,e),this.position+=1},u.prototype.writeUint32=function(e,t){this._realloc(4),this._dataView.setUint32(this.position,e,null==t?this.endianness:t),this.position+=4},u.prototype.writeUint16=function(e,t){this._realloc(2),this._dataView.setUint16(this.position,e,null==t?this.endianness:t),this.position+=2},u.prototype.writeUint8=function(e){this._realloc(1),this._dataView.setUint8(this.position,e),this.position+=1},u.prototype.writeFloat32=function(e,t){this._realloc(4),this._dataView.setFloat32(this.position,e,null==t?this.endianness:t),this.position+=4},u.prototype.writeFloat64=function(e,t){this._realloc(8),this._dataView.setFloat64(this.position,e,null==t?this.endianness:t),this.position+=8},u.prototype.writeUCS2String=function(e,t,r){null==r&&(r=e.length);for(var n=0;n<e.length&&n<r;n++)this.writeUint16(e.charCodeAt(n),t);for(;n<r;n++)this.writeUint16(0)},u.prototype.writeString=function(e,t,r){var n=0;if(null==t||"ASCII"==t)if(null!=r){var i=Math.min(e.length,r);for(n=0;n<i;n++)this.writeUint8(e.charCodeAt(n));for(;n<r;n++)this.writeUint8(0)}else for(n=0;n<e.length;n++)this.writeUint8(e.charCodeAt(n));else this.writeUint8Array(new TextEncoder(t).encode(e.substring(0,r)))},u.prototype.writeCString=function(e,t){var r=0;if(null!=t){var n=Math.min(e.length,t);for(r=0;r<n;r++)this.writeUint8(e.charCodeAt(r));for(;r<t;r++)this.writeUint8(0)}else{for(r=0;r<e.length;r++)this.writeUint8(e.charCodeAt(r));this.writeUint8(0)}},u.prototype.writeStruct=function(e,t){for(var r=0;r<e.length;r+=2){var n=e[r+1];this.writeType(n,t[e[r]],t)}},u.prototype.writeType=function(e,t,r){var n;if("function"==typeof e)return e(this,t);if("object"==typeof e&&!(e instanceof Array))return e.set(this,t,r);var i=null,a="ASCII",o=this.position;switch("string"==typeof e&&/:/.test(e)&&(e=(n=e.split(":"))[0],i=parseInt(n[1])),"string"==typeof e&&/,/.test(e)&&(e=(n=e.split(","))[0],a=parseInt(n[1])),e){case"uint8":this.writeUint8(t);break;case"int8":this.writeInt8(t);break;case"uint16":this.writeUint16(t,this.endianness);break;case"int16":this.writeInt16(t,this.endianness);break;case"uint32":this.writeUint32(t,this.endianness);break;case"int32":this.writeInt32(t,this.endianness);break;case"float32":this.writeFloat32(t,this.endianness);break;case"float64":this.writeFloat64(t,this.endianness);break;case"uint16be":this.writeUint16(t,u.BIG_ENDIAN);break;case"int16be":this.writeInt16(t,u.BIG_ENDIAN);break;case"uint32be":this.writeUint32(t,u.BIG_ENDIAN);break;case"int32be":this.writeInt32(t,u.BIG_ENDIAN);break;case"float32be":this.writeFloat32(t,u.BIG_ENDIAN);break;case"float64be":this.writeFloat64(t,u.BIG_ENDIAN);break;case"uint16le":this.writeUint16(t,u.LITTLE_ENDIAN);break;case"int16le":this.writeInt16(t,u.LITTLE_ENDIAN);break;case"uint32le":this.writeUint32(t,u.LITTLE_ENDIAN);break;case"int32le":this.writeInt32(t,u.LITTLE_ENDIAN);break;case"float32le":this.writeFloat32(t,u.LITTLE_ENDIAN);break;case"float64le":this.writeFloat64(t,u.LITTLE_ENDIAN);break;case"cstring":this.writeCString(t,i);break;case"string":this.writeString(t,a,i);break;case"u16string":this.writeUCS2String(t,this.endianness,i);break;case"u16stringle":this.writeUCS2String(t,u.LITTLE_ENDIAN,i);break;case"u16stringbe":this.writeUCS2String(t,u.BIG_ENDIAN,i);break;default:if(3==e.length){for(var s=e[1],l=0;l<t.length;l++)this.writeType(s,t[l]);break}this.writeStruct(e,t)}null!=i&&(this.position=o,this._realloc(i),this.position=o+i)},u.prototype.writeUint64=function(e){var t=Math.floor(e/a);this.writeUint32(t),this.writeUint32(4294967295&e)},u.prototype.writeUint24=function(e){this.writeUint8((16711680&e)>>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},u.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},u.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return u.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},u.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return u.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},u.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},u.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return u.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},u.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return u.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},u.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return u.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},u.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return u.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var o=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(o.prototype=new u(new ArrayBuffer,0,u.BIG_ENDIAN)).initialized=function(){var e;return-1<this.bufferIndex||(0<this.buffers.length?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,c.debug("MultiBufferStream","Stream ready for parsing"),!0):(c.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(c.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){c.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},o.prototype.reduceBuffer=function(e,t,r){var n;return(n=new Uint8Array(r)).set(new Uint8Array(e,t,r)),n.buffer.fileStart=e.fileStart+t,n.buffer.usedBytes=0,n.buffer},o.prototype.insertBuffer=function(e){for(var t=!0,r=[],n=0;n<this.buffers.length;n++){var i=this.buffers[n];if(e.fileStart<=i.fileStart){if(e.fileStart===i.fileStart){if(e.byteLength>i.byteLength){this.buffers.splice(n,1),n--;continue}c.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e.fileStart+e.byteLength>i.fileStart+i.byteLength&&r.push(this.reduceBuffer(e,i.fileStart-e.fileStart,e.fileStart+e.byteLength-i.fileStart)),e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),c.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(n,0,e),0===n&&(this.buffer=e);t=!1;break}if(e.fileStart<i.fileStart+i.byteLength){var a=i.fileStart+i.byteLength-e.fileStart,o=e.byteLength-a;if(!(0<o)){t=!1;break}e=this.reduceBuffer(e,a,o)}}t&&(c.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===n&&(this.buffer=e));var s=[];for(n=0;n<this.buffers.length;n+=1)0<this.buffers[n].byteLength&&s.push(this.buffers[n]);for(n=0;n<r.length;n+=1)this.insertBuffer(r[n])},o.prototype.logBufferLevel=function(e){var t,r,n,i,a,o=[],s="";for(t=i=n=0;t<this.buffers.length;t++)r=this.buffers[t],0===t?(a={},o.push(a),a.start=r.fileStart,a.end=r.fileStart+r.byteLength,s+="["+a.start+"-"):a.end===r.fileStart?a.end=r.fileStart+r.byteLength:((a={}).start=r.fileStart,s+=o[o.length-1].end-1+"], ["+a.start+"-",a.end=r.fileStart+r.byteLength,o.push(a)),n+=r.usedBytes,i+=r.byteLength;0<o.length&&(s+=a.end-1+"]");var l=e?c.info:c.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+n+"/"+i+" bytes): "+s)},o.prototype.cleanBuffers=function(){},o.prototype.mergeNextBuffer=function(){var e;if(this.bufferIndex+1<this.buffers.length){if((e=this.buffers[this.bufferIndex+1]).fileStart!==this.buffer.fileStart+this.buffer.byteLength)return!1;var t=this.buffer.byteLength,r=this.buffer.usedBytes,n=this.buffer.fileStart;return this.buffers[this.bufferIndex]=ArrayBuffer.concat(this.buffer,e),this.buffer=this.buffers[this.bufferIndex],this.buffers.splice(this.bufferIndex+1,1),this.buffer.usedBytes=r,this.buffer.fileStart=n,c.debug("ISOFile","Concatenating buffer for box parsing (length: "+t+"->"+this.buffer.byteLength+")"),!0}return!1},o.prototype.cleanBufferRange=function(e,t){for(var r,n=[],i=0;i<this.buffers.length;i+=1){var a=this.buffers[i],o=(r=a).fileStart>=t?[]:e>=r.fileStart+r.byteLength?[]:r.fileStart>=e&&r.fileStart+r.byteLength<=t?[r.fileStart,r.fileStart+r.byteLength]:r.fileStart<=e&&r.fileStart+r.byteLength>=t?[e,t]:r.fileStart<=e?[e,r.fileStart+r.byteLength]:[r.fileStart,t];if(0!==o.length)if(o[0]!==a.fileStart||o[1]!==a.fileStart+a.byteLength)if(o[0]!==a.fileStart)if(o[1]!==a.fileStart+a.byteLength){var s=this.reduceBuffer(a,o[1]-a.fileStart,a.fileStart+a.byteLength-o[1]);this.buffers[i]=this.reduceBuffer(a,0,o[0]-a.fileStart),n.push(s)}else this.buffers[i]=this.reduceBuffer(a,0,o[0]-a.fileStart);else this.buffers[i]=this.reduceBuffer(a,o[1]-a.fileStart,a.fileStart+a.byteLength-o[1]);else this.buffers[i]=new Uint8Array(0).buffer}var l=[];for(i=0;i<this.buffers.length;i+=1)0<this.buffers[i].byteLength&&l.push(this.buffers[i]);for(this.buffers=l,i=0;i<n.length;i+=1)this.insertBuffer(n[i])},o.prototype.findPosition=function(e,t,r){var n,i=null,a=-1;for(n=!0===e?0:this.bufferIndex;n<this.buffers.length&&(i=this.buffers[n]).fileStart<=t;)a=n,r&&(i.fileStart+i.byteLength<=t?i.usedBytes=i.byteLength:i.usedBytes=t-i.fileStart,this.logBufferLevel()),n++;return-1!==a&&(i=this.buffers[a]).fileStart+i.byteLength>=t?(c.debug("MultiBufferStream","Found position in existing buffer #"+a),a):-1},o.prototype.findEndContiguousBuf=function(e){var t,r,n,i=void 0!==e?e:this.bufferIndex;if(r=this.buffers[i],this.buffers.length>i+1)for(t=i+1;t<this.buffers.length&&(n=this.buffers[t]).fileStart===r.fileStart+r.byteLength;t++)r=n;return r.fileStart+r.byteLength},o.prototype.getEndFilePositionAfter=function(e){var t=this.findPosition(!0,e,!1);return-1!==t?this.findEndContiguousBuf(t):e},o.prototype.addUsedBytes=function(e){this.buffer.usedBytes+=e,this.logBufferLevel()},o.prototype.setAllUsedBytes=function(){this.buffer.usedBytes=this.buffer.byteLength,this.logBufferLevel()},o.prototype.seek=function(e,t,r){var n;return-1!==(n=this.findPosition(t,e,r))?(this.buffer=this.buffers[n],this.bufferIndex=n,this.position=e-this.buffer.fileStart,c.debug("MultiBufferStream","Repositioning parser at buffer position: "+this.position),!0):(c.debug("MultiBufferStream","Position "+e+" not found in buffered data"),!1)},o.prototype.getPosition=function(){if(-1===this.bufferIndex||null===this.buffers[this.bufferIndex])throw"Error accessing position in the MultiBufferStream";return this.buffers[this.bufferIndex].fileStart+this.position},o.prototype.getLength=function(){return this.byteLength},o.prototype.getEndPosition=function(){if(-1===this.bufferIndex||null===this.buffers[this.bufferIndex])throw"Error accessing position in the MultiBufferStream";return this.buffers[this.bufferIndex].fileStart+this.byteLength},t.MultiBufferStream=o;var s=function(){var a=[];a[3]="ES_Descriptor",a[4]="DecoderConfigDescriptor",a[5]="DecoderSpecificInfo",a[6]="SLConfigDescriptor",this.getDescriptorName=function(e){return a[e]};var n=this,o={};return this.parseOneDescriptor=function(e){var t,r,n,i=0;for(t=e.readUint8(),n=e.readUint8();128&n;)i=(127&n)<<7,n=e.readUint8();return i+=127&n,c.debug("MPEG4DescriptorParser","Found "+(a[t]||"Descriptor "+t)+", size "+i+" at position "+e.getPosition()),(r=a[t]?new o[a[t]](i):new o.Descriptor(i)).parse(e),r},o.Descriptor=function(e,t){this.tag=e,this.size=t,this.descs=[]},o.Descriptor.prototype.parse=function(e){this.data=e.readUint8Array(this.size)},o.Descriptor.prototype.findDescriptor=function(e){for(var t=0;t<this.descs.length;t++)if(this.descs[t].tag==e)return this.descs[t];return null},o.Descriptor.prototype.parseRemainingDescriptors=function(e){for(var t=e.position;e.position<t+this.size;){var r=n.parseOneDescriptor(e);this.descs.push(r)}},o.ES_Descriptor=function(e){o.Descriptor.call(this,3,e)},o.ES_Descriptor.prototype=new o.Descriptor,o.ES_Descriptor.prototype.parse=function(e){if(this.ES_ID=e.readUint16(),this.flags=e.readUint8(),this.size-=3,128&this.flags?(this.dependsOn_ES_ID=e.readUint16(),this.size-=2):this.dependsOn_ES_ID=0,64&this.flags){var t=e.readUint8();this.URL=e.readString(t),this.size-=t+1}else this.URL="";32&this.flags?(this.OCR_ES_ID=e.readUint16(),this.size-=2):this.OCR_ES_ID=0,this.parseRemainingDescriptors(e)},o.ES_Descriptor.prototype.getOTI=function(e){var t=this.findDescriptor(4);return t?t.oti:0},o.ES_Descriptor.prototype.getAudioConfig=function(e){var t=this.findDescriptor(4);if(!t)return null;var r=t.findDescriptor(5);if(r&&r.data){var n=(248&r.data[0])>>3;return 31===n&&2<=r.data.length&&(n=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),n}return null},o.DecoderConfigDescriptor=function(e){o.Descriptor.call(this,4,e)},o.DecoderConfigDescriptor.prototype=new o.Descriptor,o.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},o.DecoderSpecificInfo=function(e){o.Descriptor.call(this,5,e)},o.DecoderSpecificInfo.prototype=new o.Descriptor,o.SLConfigDescriptor=function(e){o.Descriptor.call(this,6,e)},o.SLConfigDescriptor.prototype=new o.Descriptor,this};t.MPEG4DescriptorParser=s;var S={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){S.FullBox.prototype=new S.Box,S.ContainerBox.prototype=new S.Box,S.SampleEntry.prototype=new S.Box,S.TrackGroupTypeBox.prototype=new S.FullBox,S.BASIC_BOXES.forEach(function(e){S.createBoxCtor(e)}),S.FULL_BOXES.forEach(function(e){S.createFullBoxCtor(e)}),S.CONTAINER_BOXES.forEach(function(e){S.createContainerBoxCtor(e[0],null,e[1])})},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){S.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){S.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,n){S.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=n},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){S.FullBox.call(this,e,t)},createBoxCtor:function(t,e){S.boxCodes.push(t),S[t+"Box"]=function(e){S.Box.call(this,t,e)},S[t+"Box"].prototype=new S.Box,e&&(S[t+"Box"].prototype.parse=e)},createFullBoxCtor:function(t,r){S[t+"Box"]=function(e){S.FullBox.call(this,t,e)},S[t+"Box"].prototype=new S.FullBox,S[t+"Box"].prototype.parse=function(e){this.parseFullHeader(e),r&&r.call(this,e)}},addSubBoxArrays:function(e){if(e)for(var t=(this.subBoxNames=e).length,r=0;r<t;r++)this[e[r]+"s"]=[]},createContainerBoxCtor:function(t,e,r){S[t+"Box"]=function(e){S.ContainerBox.call(this,t,e),S.addSubBoxArrays.call(this,r)},S[t+"Box"].prototype=new S.ContainerBox,e&&(S[t+"Box"].prototype.parse=e)},createMediaSampleEntryCtor:function(e,t,r){S.sampleEntryCodes[e]=[],S[e+"SampleEntry"]=function(e,t){S.SampleEntry.call(this,e,t),S.addSubBoxArrays.call(this,r)},S[e+"SampleEntry"].prototype=new S.SampleEntry,t&&(S[e+"SampleEntry"].prototype.parse=t)},createSampleEntryCtor:function(t,r,e,n){S.sampleEntryCodes[t].push(r),S[r+"SampleEntry"]=function(e){S[t+"SampleEntry"].call(this,r,e),S.addSubBoxArrays.call(this,n)},S[r+"SampleEntry"].prototype=new S[t+"SampleEntry"],e&&(S[r+"SampleEntry"].prototype.parse=e)},createEncryptedSampleEntryCtor:function(e,t,r){S.createSampleEntryCtor.call(this,e,t,r,["sinf"])},createSampleGroupCtor:function(t,e){S[t+"SampleGroupEntry"]=function(e){S.SampleGroupEntry.call(this,t,e)},S[t+"SampleGroupEntry"].prototype=new S.SampleGroupEntry,e&&(S[t+"SampleGroupEntry"].prototype.parse=e)},createTrackGroupCtor:function(t,e){S[t+"TrackGroupTypeBox"]=function(e){S.TrackGroupTypeBox.call(this,t,e)},S[t+"TrackGroupTypeBox"].prototype=new S.TrackGroupTypeBox,e&&(S[t+"TrackGroupTypeBox"].prototype.parse=e)},createUUIDBox:function(t,r,n,i){S.UUIDBoxes[t]=function(e){r?S.FullBox.call(this,"uuid",e,t):n?S.ContainerBox.call(this,"uuid",e,t):S.Box.call(this,"uuid",e,t)},S.UUIDBoxes[t].prototype=r?new S.FullBox:n?new S.ContainerBox:new S.Box,i&&(S.UUIDBoxes[t].prototype.parse=r?function(e){this.parseFullHeader(e),i&&i.call(this,e)}:i)}};S.initialize(),S.TKHD_FLAG_ENABLED=1,S.TKHD_FLAG_IN_MOVIE=2,S.TKHD_FLAG_IN_PREVIEW=4,S.TFHD_FLAG_BASE_DATA_OFFSET=1,S.TFHD_FLAG_SAMPLE_DESC=2,S.TFHD_FLAG_SAMPLE_DUR=8,S.TFHD_FLAG_SAMPLE_SIZE=16,S.TFHD_FLAG_SAMPLE_FLAGS=32,S.TFHD_FLAG_DUR_EMPTY=65536,S.TFHD_FLAG_DEFAULT_BASE_IS_MOOF=131072,S.TRUN_FLAGS_DATA_OFFSET=1,S.TRUN_FLAGS_FIRST_FLAG=4,S.TRUN_FLAGS_DURATION=256,S.TRUN_FLAGS_SIZE=512,S.TRUN_FLAGS_FLAGS=1024,S.TRUN_FLAGS_CTS_OFFSET=2048,S.Box.prototype.add=function(e){return this.addBox(new S[e+"Box"])},S.Box.prototype.addBox=function(e){return this.boxes.push(e),this[e.type+"s"]?this[e.type+"s"].push(e):this[e.type]=e,e},S.Box.prototype.set=function(e,t){return this[e]=t,this},S.Box.prototype.addEntry=function(e,t){var r=t||"entries";return this[r]||(this[r]=[]),this[r].push(e),this},(t.BoxParser=S).parseUUID=function(e){return S.parseHex16(e)},S.parseHex16=function(e){for(var t="",r=0;r<16;r++){var n=e.readUint8().toString(16);t+=1===n.length?"0"+n:n}return t},S.parseOneBox=function(e,t,r){var n,i,a,o=e.getPosition(),s=0;if(e.getEndPosition()-o<8)return c.debug("BoxParser","Not enough data in stream to parse the type and size of the box"),{code:S.ERR_NOT_ENOUGH_DATA};if(r&&r<8)return c.debug("BoxParser","Not enough bytes left in the parent box to parse a new box"),{code:S.ERR_NOT_ENOUGH_DATA};var l=e.readUint32(),u=e.readString(4),f=u;if(c.debug("BoxParser","Found box of type '"+u+"' and size "+l+" at position "+o),s=8,"uuid"==u){if(e.getEndPosition()-e.getPosition()<16||r-s<16)return e.seek(o),c.debug("BoxParser","Not enough bytes left in the parent box to parse a UUID box"),{code:S.ERR_NOT_ENOUGH_DATA};s+=16,f=a=S.parseUUID(e)}if(1==l){if(e.getEndPosition()-e.getPosition()<8||r&&r-s<8)return e.seek(o),c.warn("BoxParser",'Not enough data in stream to parse the extended size of the "'+u+'" box'),{code:S.ERR_NOT_ENOUGH_DATA};l=e.readUint64(),s+=8}else if(0===l)if(r)l=r;else if("mdat"!==u)return c.error("BoxParser","Unlimited box size not supported for type: '"+u+"'"),n=new S.Box(u,l),{code:S.OK,box:n,size:n.size};return l<s?(c.error("BoxParser","Box of type "+u+" has an invalid size "+l+" (too small to be a box)"),{code:S.ERR_NOT_ENOUGH_DATA,type:u,size:l,hdr_size:s,start:o}):r&&r<l?(c.error("BoxParser","Box of type '"+u+"' has a size "+l+" greater than its container size "+r),{code:S.ERR_NOT_ENOUGH_DATA,type:u,size:l,hdr_size:s,start:o}):o+l>e.getEndPosition()?(e.seek(o),c.info("BoxParser","Not enough data in stream to parse the entire '"+u+"' box"),{code:S.ERR_NOT_ENOUGH_DATA,type:u,size:l,hdr_size:s,start:o}):t?{code:S.OK,type:u,size:l,hdr_size:s,start:o}:(S[u+"Box"]?n=new S[u+"Box"](l):"uuid"!==u?(c.warn("BoxParser","Unknown box type: '"+u+"'"),(n=new S.Box(u,l)).has_unparsed_data=!0):S.UUIDBoxes[a]?n=new S.UUIDBoxes[a](l):(c.warn("BoxParser","Unknown uuid type: '"+a+"'"),(n=new S.Box(u,l)).uuid=a,n.has_unparsed_data=!0),n.hdr_size=s,n.start=o,n.write===S.Box.prototype.write&&"mdat"!==n.type&&(c.info("BoxParser","'"+f+"' box writing not yet implemented, keeping unparsed data in memory for later write"),n.parseDataAndRewind(e)),n.parse(e),(i=e.getPosition()-(n.start+n.size))<0?(c.warn("BoxParser","Parsing of box '"+f+"' did not read the entire indicated box data size (missing "+-i+" bytes), seeking forward"),e.seek(n.start+n.size)):0<i&&(c.error("BoxParser","Parsing of box '"+f+"' read "+i+" more bytes than the indicated box data size, seeking backwards"),e.seek(n.start+n.size)),{code:S.OK,box:n,size:n.size})},S.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},S.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},S.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},S.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},S.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},S.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()<this.start+this.size;){if((t=S.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==S.OK)return;if(r=t.box,this.boxes.push(r),this.subBoxNames&&-1!=this.subBoxNames.indexOf(r.type))this[this.subBoxNames[this.subBoxNames.indexOf(r.type)]+"s"].push(r);else{var n="uuid"!==r.type?r.type:r.uuid;this[n]?c.warn("Box of type "+n+" already stored in field of this type"):this[n]=r}}},S.Box.prototype.parseLanguage=function(e){this.language=e.readUint16();var t=[];t[0]=this.language>>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},S.SAMPLE_ENTRY_TYPE_VISUAL="Visual",S.SAMPLE_ENTRY_TYPE_AUDIO="Audio",S.SAMPLE_ENTRY_TYPE_HINT="Hint",S.SAMPLE_ENTRY_TYPE_METADATA="Metadata",S.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",S.SAMPLE_ENTRY_TYPE_SYSTEM="System",S.SAMPLE_ENTRY_TYPE_TEXT="Text",S.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},S.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},S.SampleEntry.prototype.parseDataAndRewind=function(e){this.parse(e),this.hdr_size-=8,e.position-=this.size-this.hdr_size},S.SampleEntry.prototype.parseFooter=function(e){S.ContainerBox.prototype.parse.call(this,e)},S.createMediaSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_HINT),S.createMediaSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_METADATA),S.createMediaSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_SUBTITLE),S.createMediaSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_SYSTEM),S.createMediaSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_TEXT),S.createMediaSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_VISUAL,function(e){this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16();var t=Math.min(31,e.readUint8());this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)}),S.createMediaSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_AUDIO,function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)}),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),S.createEncryptedSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),S.createEncryptedSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),S.createEncryptedSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),S.createEncryptedSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),S.createEncryptedSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_TEXT,"enct"),S.createEncryptedSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_METADATA,"encm"),S.createFullBoxCtor("CoLL",function(e){this.maxCLL=e.readUint16(),this.maxFALL=e.readUint16()}),S.createFullBoxCtor("SmDm",function(e){this.primaryRChromaticity_x=e.readUint16(),this.primaryRChromaticity_y=e.readUint16(),this.primaryGChromaticity_x=e.readUint16(),this.primaryGChromaticity_y=e.readUint16(),this.primaryBChromaticity_x=e.readUint16(),this.primaryBChromaticity_y=e.readUint16(),this.whitePointChromaticity_x=e.readUint16(),this.whitePointChromaticity_y=e.readUint16(),this.luminanceMax=e.readUint32(),this.luminanceMin=e.readUint32()}),S.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},S.TrackReferenceTypeBox=function(e,t,r,n){S.Box.call(this,e,t),this.hdr_size=r,this.start=n},S.TrackReferenceTypeBox.prototype=new S.Box,S.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},S.createBoxCtor("av1C",function(e){var t=e.readUint8();if(t>>7&!1)c.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void c.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else c.error("av1C reserved_1 parsing problem");else c.error("av1C version "+this.version+" not supported")}),S.createBoxCtor("avcC",function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t<this.nb_SPS_nalus;t++)this.SPS[t]={},this.SPS[t].length=e.readUint16(),this.SPS[t].nalu=e.readUint8Array(this.SPS[t].length),r-=2+this.SPS[t].length;for(this.nb_PPS_nalus=e.readUint8(),r--,this.PPS=[],t=0;t<this.nb_PPS_nalus;t++)this.PPS[t]={},this.PPS[t].length=e.readUint16(),this.PPS[t].nalu=e.readUint8Array(this.PPS[t].length),r-=2+this.PPS[t].length;0<r&&(this.ext=e.readUint8Array(r))}),S.createBoxCtor("btrt",function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()}),S.createBoxCtor("clap",function(e){this.cleanApertureWidthN=e.readUint32(),this.cleanApertureWidthD=e.readUint32(),this.cleanApertureHeightN=e.readUint32(),this.cleanApertureHeightD=e.readUint32(),this.horizOffN=e.readUint32(),this.horizOffD=e.readUint32(),this.vertOffN=e.readUint32(),this.vertOffD=e.readUint32()}),S.createBoxCtor("clli",function(e){this.max_content_light_level=e.readUint16(),this.max_pic_average_light_level=e.readUint16()}),S.createFullBoxCtor("co64",function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r<t;r++)this.chunk_offsets.push(e.readUint64())}),S.createBoxCtor("colr",function(e){if(this.colour_type=e.readString(4),"nclx"===this.colour_type){this.colour_primaries=e.readUint16(),this.transfer_characteristics=e.readUint16(),this.matrix_coefficients=e.readUint16();var t=e.readUint8();this.full_range_flag=t>>7}else"rICC"===this.colour_type?this.ICC_profile=e.readUint8Array(this.size-4):"prof"===this.colour_type&&(this.ICC_profile=e.readUint8Array(this.size-4))}),S.createFullBoxCtor("cprt",function(e){this.parseLanguage(e),this.notice=e.readCString()}),S.createFullBoxCtor("cslg",function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())}),S.createFullBoxCtor("ctts",function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r<t;r++){this.sample_counts.push(e.readUint32());var n=e.readInt32();n<0&&c.warn("BoxParser","ctts box uses negative values without using version 1"),this.sample_offsets.push(n)}else if(1==this.version)for(r=0;r<t;r++)this.sample_counts.push(e.readUint32()),this.sample_offsets.push(e.readInt32())}),S.createBoxCtor("dac3",function(e){var t=e.readUint8(),r=e.readUint8(),n=e.readUint8();this.fscod=t>>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|n>>5&7}),S.createBoxCtor("dec3",function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r<this.num_ind_sub+1;r++){var n={};this.ind_subs.push(n);var i=e.readUint8(),a=e.readUint8(),o=e.readUint8();n.fscod=i>>6,n.bsid=i>>1&31,n.bsmod=(1&i)<<4|a>>4&15,n.acmod=a>>1&7,n.lfeon=1&a,n.num_dep_sub=o>>1&15,0<n.num_dep_sub&&(n.chan_loc=(1&o)<<8|e.readUint8())}}),S.createFullBoxCtor("dfLa",function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var n=e.readUint8(),i=Math.min(127&n,r.length-1);if(i?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[i]),128&n)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"}),S.createBoxCtor("dimm",function(e){this.bytessent=e.readUint64()}),S.createBoxCtor("dmax",function(e){this.time=e.readUint32()}),S.createBoxCtor("dmed",function(e){this.bytessent=e.readUint64()}),S.createFullBoxCtor("dref",function(e){var t,r;this.entries=[];for(var n=e.readUint32(),i=0;i<n;i++){if((t=S.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==S.OK)return;r=t.box,this.entries.push(r)}}),S.createBoxCtor("drep",function(e){this.bytessent=e.readUint64()}),S.createFullBoxCtor("elng",function(e){this.extended_language=e.readString(this.size-this.hdr_size)}),S.createFullBoxCtor("elst",function(e){this.entries=[];for(var t=e.readUint32(),r=0;r<t;r++){var n={};this.entries.push(n),1===this.version?(n.segment_duration=e.readUint64(),n.media_time=e.readInt64()):(n.segment_duration=e.readUint32(),n.media_time=e.readInt32()),n.media_rate_integer=e.readInt16(),n.media_rate_fraction=e.readInt16()}}),S.createFullBoxCtor("emsg",function(e){this.scheme_id_uri=e.readCString(),this.value=e.readCString(),this.timescale=e.readUint32(),this.presentation_time_delta=e.readUint32(),this.event_duration=e.readUint32(),this.id=e.readUint32();var t=this.size-this.hdr_size-(16+(this.scheme_id_uri.length+1)+(this.value.length+1));this.message_data=e.readUint8Array(t)}),S.createFullBoxCtor("esds",function(e){var t=e.readUint8Array(this.size-this.hdr_size),r=new s;this.esd=r.parseOneDescriptor(new u(t.buffer,0,u.BIG_ENDIAN))}),S.createBoxCtor("fiel",function(e){this.fieldCount=e.readUint8(),this.fieldOrdering=e.readUint8()}),S.createBoxCtor("frma",function(e){this.data_format=e.readString(4)}),S.createBoxCtor("ftyp",function(e){var t=this.size-this.hdr_size;this.major_brand=e.readString(4),this.minor_version=e.readUint32(),t-=8,this.compatible_brands=[];for(var r=0;4<=t;)this.compatible_brands[r]=e.readString(4),t-=4,r++}),S.createFullBoxCtor("hdlr",function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))}),S.createBoxCtor("hvcC",function(e){var t,r,n,i;this.configurationVersion=e.readUint8(),i=e.readUint8(),this.general_profile_space=i>>6,this.general_tier_flag=(32&i)>>5,this.general_profile_idc=31&i,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),i=e.readUint8(),this.constantFrameRate=i>>6,this.numTemporalLayers=(13&i)>>3,this.temporalIdNested=(4&i)>>2,this.lengthSizeMinusOne=3&i,this.nalu_arrays=[];var a=e.readUint8();for(t=0;t<a;t++){var o=[];this.nalu_arrays.push(o),i=e.readUint8(),o.completeness=(128&i)>>7,o.nalu_type=63&i;var s=e.readUint16();for(r=0;r<s;r++){var l={};o.push(l),n=e.readUint16(),l.data=e.readUint8Array(n)}}}),S.createFullBoxCtor("iinf",function(e){var t;0===this.version?this.entry_count=e.readUint16():this.entry_count=e.readUint32(),this.item_infos=[];for(var r=0;r<this.entry_count;r++){if((t=S.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==S.OK)return;"infe"!==t.box.type&&c.error("BoxParser","Expected 'infe' box, got "+t.box.type),this.item_infos[r]=t.box}}),S.createFullBoxCtor("iloc",function(e){var t;t=e.readUint8(),this.offset_size=t>>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var n=0;n<r;n++){var i={};if(this.items.push(i),this.version<2)i.item_ID=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i.item_ID=e.readUint16()}switch(1===this.version||2===this.version?i.construction_method=15&e.readUint16():i.construction_method=0,i.data_reference_index=e.readUint16(),this.base_offset_size){case 0:i.base_offset=0;break;case 4:i.base_offset=e.readUint32();break;case 8:i.base_offset=e.readUint64();break;default:throw"Error reading base offset size"}var a=e.readUint16();i.extents=[];for(var o=0;o<a;o++){var s={};if(i.extents.push(s),1===this.version||2===this.version)switch(this.index_size){case 0:s.extent_index=0;break;case 4:s.extent_index=e.readUint32();break;case 8:s.extent_index=e.readUint64();break;default:throw"Error reading extent index"}switch(this.offset_size){case 0:s.extent_offset=0;break;case 4:s.extent_offset=e.readUint32();break;case 8:s.extent_offset=e.readUint64();break;default:throw"Error reading extent index"}switch(this.length_size){case 0:s.extent_length=0;break;case 4:s.extent_length=e.readUint32();break;case 8:s.extent_length=e.readUint64();break;default:throw"Error reading extent index"}}}}),S.createFullBoxCtor("infe",function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),c.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);2<=this.version&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))}),S.createFullBoxCtor("ipma",function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t<entry_count;t++){var n={};this.associations.push(n),this.version<1?n.id=e.readUint16():n.id=e.readUint32();var i=e.readUint8();for(n.props=[],r=0;r<i;r++){var a=e.readUint8(),o={};n.props.push(o),o.essential=(128&a)>>7==1,1&this.flags?o.property_index=(127&a)<<8|e.readUint8():o.property_index=127&a}}}),S.createFullBoxCtor("iref",function(e){var t,r;for(this.references=[];e.getPosition()<this.start+this.size;){if((t=S.parseOneBox(e,!0,this.size-(e.getPosition()-this.start))).code!==S.OK)return;(r=0===this.version?new S.SingleItemTypeReferenceBox(t.type,t.size,t.hdr_size,t.start):new S.SingleItemTypeReferenceBoxLarge(t.type,t.size,t.hdr_size,t.start)).write===S.Box.prototype.write&&"mdat"!==r.type&&(c.warn("BoxParser",r.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),r.parseDataAndRewind(e)),r.parse(e),this.references.push(r)}}),S.createBoxCtor("irot",function(e){this.angle=3&e.readUint8()}),S.createFullBoxCtor("ispe",function(e){this.image_width=e.readUint32(),this.image_height=e.readUint32()}),S.createFullBoxCtor("kind",function(e){this.schemeURI=e.readCString(),this.value=e.readCString()}),S.createFullBoxCtor("leva",function(e){var t=e.readUint8();this.levels=[];for(var r=0;r<t;r++){var n={};(this.levels[r]=n).track_ID=e.readUint32();var i=e.readUint8();switch(n.padding_flag=i>>7,n.assignment_type=127&i,n.assignment_type){case 0:n.grouping_type=e.readString(4);break;case 1:n.grouping_type=e.readString(4),n.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:n.sub_track_id=e.readUint32();break;default:c.warn("BoxParser","Unknown leva assignement type")}}}),S.createBoxCtor("maxr",function(e){this.period=e.readUint32(),this.bytes=e.readUint32()}),S.createBoxCtor("mdcv",function(e){this.display_primaries=[],this.display_primaries[0]={},this.display_primaries[0].x=e.readUint16(),this.display_primaries[0].y=e.readUint16(),this.display_primaries[1]={},this.display_primaries[1].x=e.readUint16(),this.display_primaries[1].y=e.readUint16(),this.display_primaries[2]={},this.display_primaries[2].x=e.readUint16(),this.display_primaries[2].y=e.readUint16(),this.white_point={},this.white_point.x=e.readUint16(),this.white_point.y=e.readUint16(),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()}),S.createFullBoxCtor("mdhd",function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()}),S.createFullBoxCtor("mehd",function(e){1&this.flags&&(c.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()}),S.createFullBoxCtor("meta",function(e){this.boxes=[],S.ContainerBox.prototype.parse.call(this,e)}),S.createFullBoxCtor("mfhd",function(e){this.sequence_number=e.readUint32()}),S.createFullBoxCtor("mfro",function(e){this._size=e.readUint32()}),S.createFullBoxCtor("mvhd",function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()}),S.createBoxCtor("npck",function(e){this.packetssent=e.readUint32()}),S.createBoxCtor("nump",function(e){this.packetssent=e.readUint64()}),S.createFullBoxCtor("padb",function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r<Math.floor((t+1)/2);r++)this.padbits=e.readUint8()}),S.createBoxCtor("pasp",function(e){this.hSpacing=e.readUint32(),this.vSpacing=e.readUint32()}),S.createBoxCtor("payl",function(e){this.text=e.readString(this.size-this.hdr_size)}),S.createBoxCtor("payt",function(e){this.payloadID=e.readUint32();var t=e.readUint8();this.rtpmap_string=e.readString(t)}),S.createFullBoxCtor("pdin",function(e){var t=(this.size-this.hdr_size)/8;this.rate=[],this.initial_delay=[];for(var r=0;r<t;r++)this.rate[r]=e.readUint32(),this.initial_delay[r]=e.readUint32()}),S.createFullBoxCtor("pitm",function(e){0===this.version?this.item_id=e.readUint16():this.item_id=e.readUint32()}),S.createFullBoxCtor("pixi",function(e){var t;for(this.num_channels=e.readUint8(),this.bits_per_channels=[],t=0;t<this.num_channels;t++)this.bits_per_channels[t]=e.readUint8()}),S.createBoxCtor("pmax",function(e){this.bytes=e.readUint32()}),S.createFullBoxCtor("prft",function(e){this.ref_track_id=e.readUint32(),this.ntp_timestamp=e.readUint64(),0===this.version?this.media_time=e.readUint32():this.media_time=e.readUint64()}),S.createFullBoxCtor("pssh",function(e){if(this.system_id=S.parseHex16(e),0<this.version){var t=e.readUint32();this.kid=[];for(var r=0;r<t;r++)this.kid[r]=S.parseHex16(e)}var n=e.readUint32();0<n&&(this.data=e.readUint8Array(n))}),S.createFullBoxCtor("clef",function(e){this.width=e.readUint32(),this.height=e.readUint32()}),S.createFullBoxCtor("enof",function(e){this.width=e.readUint32(),this.height=e.readUint32()}),S.createFullBoxCtor("prof",function(e){this.width=e.readUint32(),this.height=e.readUint32()}),S.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),S.createBoxCtor("rtp ",function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)}),S.createFullBoxCtor("saio",function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r<t;r++)0===this.version?this.offset[r]=e.readUint32():this.offset[r]=e.readUint64()}),S.createFullBoxCtor("saiz",function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32()),this.default_sample_info_size=e.readUint8();var t=e.readUint32();if(this.sample_info_size=[],0===this.default_sample_info_size)for(var r=0;r<t;r++)this.sample_info_size[r]=e.readUint8()}),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_METADATA,"mett",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_METADATA,"metx",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.parseFooter(e)}),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_SUBTITLE,"sbtt",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_SUBTITLE,"stpp",function(e){this.parseHeader(e),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.auxiliary_mime_types=e.readCString(),this.parseFooter(e)}),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_SUBTITLE,"stxt",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_SUBTITLE,"tx3g",function(e){this.parseHeader(e),this.displayFlags=e.readUint32(),this.horizontal_justification=e.readInt8(),this.vertical_justification=e.readInt8(),this.bg_color_rgba=e.readUint8Array(4),this.box_record=e.readInt16Array(4),this.style_record=e.readUint8Array(12),this.parseFooter(e)}),S.createSampleEntryCtor(S.SAMPLE_ENTRY_TYPE_METADATA,"wvtt",function(e){this.parseHeader(e),this.parseFooter(e)}),S.createSampleGroupCtor("alst",function(e){var t,r=e.readUint16();for(this.first_output_sample=e.readUint16(),this.sample_offset=[],t=0;t<r;t++)this.sample_offset[t]=e.readUint32();var n=this.description_length-4-4*r;for(this.num_output_samples=[],this.num_total_samples=[],t=0;t<n/4;t++)this.num_output_samples[t]=e.readUint16(),this.num_total_samples[t]=e.readUint16()}),S.createSampleGroupCtor("avll",function(e){this.layerNumber=e.readUint8(),this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()}),S.createSampleGroupCtor("avss",function(e){this.subSequenceIdentifier=e.readUint16(),this.layerNumber=e.readUint8();var t=e.readUint8();this.durationFlag=t>>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),n=0;n<r;n++){var i={};this.dependency.push(i),i.subSeqDirectionFlag=e.readUint8(),i.layerNumber=e.readUint8(),i.subSequenceIdentifier=e.readUint16()}}),S.createSampleGroupCtor("dtrt",function(e){c.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),S.createSampleGroupCtor("mvif",function(e){c.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),S.createSampleGroupCtor("prol",function(e){this.roll_distance=e.readInt16()}),S.createSampleGroupCtor("rap ",function(e){var t=e.readUint8();this.num_leading_samples_known=t>>7,this.num_leading_samples=127&t}),S.createSampleGroupCtor("rash",function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)c.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t<this.operation_point_count;t++)this.available_bitrate[t]=e.readUint32(),this.target_rate_share[t]=e.readUint16()}this.maximum_bitrate=e.readUint32(),this.minimum_bitrate=e.readUint32(),this.discard_priority=e.readUint8()}}),S.createSampleGroupCtor("roll",function(e){this.roll_distance=e.readInt16()}),S.SampleGroupEntry.prototype.parse=function(e){c.warn("BoxParser","Unknown Sample Group type: "+this.grouping_type),this.data=e.readUint8Array(this.description_length)},S.createSampleGroupCtor("scif",function(e){c.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),S.createSampleGroupCtor("scnm",function(e){c.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),S.createSampleGroupCtor("seig",function(e){this.reserved=e.readUint8();var t=e.readUint8();this.crypt_byte_block=t>>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=S.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))}),S.createSampleGroupCtor("stsa",function(e){c.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),S.createSampleGroupCtor("sync",function(e){var t=e.readUint8();this.NAL_unit_type=63&t}),S.createSampleGroupCtor("tele",function(e){var t=e.readUint8();this.level_independently_decodable=t>>7}),S.createSampleGroupCtor("tsas",function(e){c.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),S.createSampleGroupCtor("tscl",function(e){c.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),S.createSampleGroupCtor("vipr",function(e){c.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),S.createFullBoxCtor("sbgp",function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r<t;r++){var n={};this.entries.push(n),n.sample_count=e.readInt32(),n.group_description_index=e.readInt32()}}),S.createFullBoxCtor("schm",function(e){this.scheme_type=e.readString(4),this.scheme_version=e.readUint32(),1&this.flags&&(this.scheme_uri=e.readString(this.size-this.hdr_size-8))}),S.createBoxCtor("sdp ",function(e){this.sdptext=e.readString(this.size-this.hdr_size)}),S.createFullBoxCtor("sdtp",function(e){var t,r=this.size-this.hdr_size;this.is_leading=[],this.sample_depends_on=[],this.sample_is_depended_on=[],this.sample_has_redundancy=[];for(var n=0;n<r;n++)t=e.readUint8(),this.is_leading[n]=t>>6,this.sample_depends_on[n]=t>>4&3,this.sample_is_depended_on[n]=t>>2&3,this.sample_has_redundancy[n]=3&t}),S.createFullBoxCtor("senc"),S.createFullBoxCtor("sgpd",function(e){this.grouping_type=e.readString(4),c.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,2<=this.version&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r<t;r++){var n;n=S[this.grouping_type+"SampleGroupEntry"]?new S[this.grouping_type+"SampleGroupEntry"](this.grouping_type):new S.SampleGroupEntry(this.grouping_type),this.entries.push(n),1===this.version&&0===this.default_length?n.description_length=e.readUint32():n.description_length=this.default_length,n.write===S.SampleGroupEntry.prototype.write&&(c.info("BoxParser","SampleGroup for type "+this.grouping_type+" writing not yet implemented, keeping unparsed data in memory for later write"),n.data=e.readUint8Array(n.description_length),e.position-=n.description_length),n.parse(e)}}),S.createFullBoxCtor("sidx",function(e){this.reference_ID=e.readUint32(),this.timescale=e.readUint32(),0===this.version?(this.earliest_presentation_time=e.readUint32(),this.first_offset=e.readUint32()):(this.earliest_presentation_time=e.readUint64(),this.first_offset=e.readUint64()),e.readUint16(),this.references=[];for(var t=e.readUint16(),r=0;r<t;r++){var n={};this.references.push(n);var i=e.readUint32();n.reference_type=i>>31&1,n.referenced_size=2147483647&i,n.subsegment_duration=e.readUint32(),i=e.readUint32(),n.starts_with_SAP=i>>31&1,n.SAP_type=i>>28&7,n.SAP_delta_time=268435455&i}this.first_offset+=e.position}),S.SingleItemTypeReferenceBox=function(e,t,r,n){S.Box.call(this,e,t),this.hdr_size=r,this.start=n},S.SingleItemTypeReferenceBox.prototype=new S.Box,S.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r<t;r++)this.references[r]=e.readUint16()},S.SingleItemTypeReferenceBoxLarge=function(e,t,r,n){S.Box.call(this,e,t),this.hdr_size=r,this.start=n},S.SingleItemTypeReferenceBoxLarge.prototype=new S.Box,S.SingleItemTypeReferenceBoxLarge.prototype.parse=function(e){this.from_item_ID=e.readUint32();var t=e.readUint16();this.references=[];for(var r=0;r<t;r++)this.references[r]=e.readUint32()},S.createFullBoxCtor("smhd",function(e){this.balance=e.readUint16(),e.readUint16()}),S.createFullBoxCtor("ssix",function(e){this.subsegments=[];for(var t=e.readUint32(),r=0;r<t;r++){var n={};this.subsegments.push(n),n.ranges=[];for(var i=e.readUint32(),a=0;a<i;a++){var o={};n.ranges.push(o),o.level=e.readUint8(),o.range_size=e.readUint24()}}}),S.createFullBoxCtor("stco",function(e){var t;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(var r=0;r<t;r++)this.chunk_offsets.push(e.readUint32())}),S.createFullBoxCtor("stdp",function(e){var t=(this.size-this.hdr_size)/2;this.priority=[];for(var r=0;r<t;r++)this.priority[r]=e.readUint16()}),S.createFullBoxCtor("sthd"),S.createFullBoxCtor("stri",function(e){this.switch_group=e.readUint16(),this.alternate_group=e.readUint16(),this.sub_track_id=e.readUint32();var t=(this.size-this.hdr_size-8)/4;this.attribute_list=[];for(var r=0;r<t;r++)this.attribute_list[r]=e.readUint32()}),S.createFullBoxCtor("stsc",function(e){var t,r;if(t=e.readUint32(),this.first_chunk=[],this.samples_per_chunk=[],this.sample_description_index=[],0===this.version)for(r=0;r<t;r++)this.first_chunk.push(e.readUint32()),this.samples_per_chunk.push(e.readUint32()),this.sample_description_index.push(e.readUint32())}),S.createFullBoxCtor("stsd",function(e){var t,r,n,i;for(this.entries=[],n=e.readUint32(),t=1;t<=n;t++){if((r=S.parseOneBox(e,!0,this.size-(e.getPosition()-this.start))).code!==S.OK)return;S[r.type+"SampleEntry"]?((i=new S[r.type+"SampleEntry"](r.size)).hdr_size=r.hdr_size,i.start=r.start):(c.warn("BoxParser","Unknown sample entry type: "+r.type),i=new S.SampleEntry(r.type,r.size,r.hdr_size,r.start)),i.write===S.SampleEntry.prototype.write&&(c.info("BoxParser","SampleEntry "+i.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),this.entries.push(i)}}),S.createFullBoxCtor("stsg",function(e){this.grouping_type=e.readUint32();var t=e.readUint16();this.group_description_index=[];for(var r=0;r<t;r++)this.group_description_index[r]=e.readUint32()}),S.createFullBoxCtor("stsh",function(e){var t,r;if(t=e.readUint32(),this.shadowed_sample_numbers=[],this.sync_sample_numbers=[],0===this.version)for(r=0;r<t;r++)this.shadowed_sample_numbers.push(e.readUint32()),this.sync_sample_numbers.push(e.readUint32())}),S.createFullBoxCtor("stss",function(e){var t,r;if(r=e.readUint32(),0===this.version)for(this.sample_numbers=[],t=0;t<r;t++)this.sample_numbers.push(e.readUint32())}),S.createFullBoxCtor("stsz",function(e){var t;if(this.sample_sizes=[],0===this.version)for(this.sample_size=e.readUint32(),this.sample_count=e.readUint32(),t=0;t<this.sample_count;t++)0===this.sample_size?this.sample_sizes.push(e.readUint32()):this.sample_sizes[t]=this.sample_size}),S.createFullBoxCtor("stts",function(e){var t,r,n;if(t=e.readUint32(),this.sample_counts=[],this.sample_deltas=[],0===this.version)for(r=0;r<t;r++)this.sample_counts.push(e.readUint32()),(n=e.readInt32())<0&&(c.warn("BoxParser","File uses negative stts sample delta, using value 1 instead, sync may be lost!"),n=1),this.sample_deltas.push(n)}),S.createFullBoxCtor("stvi",function(e){var t=e.readUint32();this.single_view_allowed=3&t,this.stereo_scheme=e.readUint32();var r,n,i=e.readUint32();for(this.stereo_indication_type=e.readString(i),this.boxes=[];e.getPosition()<this.start+this.size;){if((r=S.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==S.OK)return;n=r.box,this.boxes.push(n),this[n.type]=n}}),S.createBoxCtor("styp",function(e){S.ftypBox.prototype.parse.call(this,e)}),S.createFullBoxCtor("stz2",function(e){var t,r;if(this.sample_sizes=[],0===this.version)if(this.reserved=e.readUint24(),this.field_size=e.readUint8(),r=e.readUint32(),4===this.field_size)for(t=0;t<r;t+=2){var n=e.readUint8();this.sample_sizes[t]=n>>4&15,this.sample_sizes[t+1]=15&n}else if(8===this.field_size)for(t=0;t<r;t++)this.sample_sizes[t]=e.readUint8();else if(16===this.field_size)for(t=0;t<r;t++)this.sample_sizes[t]=e.readUint16();else c.error("BoxParser","Error in length field in stz2 box")}),S.createFullBoxCtor("subs",function(e){var t,r,n,i;for(n=e.readUint32(),this.entries=[],t=0;t<n;t++){var a={};if((this.entries[t]=a).sample_delta=e.readUint32(),a.subsamples=[],0<(i=e.readUint16()))for(r=0;r<i;r++){var o={};a.subsamples.push(o),1==this.version?o.size=e.readUint32():o.size=e.readUint16(),o.priority=e.readUint8(),o.discardable=e.readUint8(),o.codec_specific_parameters=e.readUint32()}}}),S.createFullBoxCtor("tenc",function(e){if(e.readUint8(),0===this.version)e.readUint8();else{var t=e.readUint8();this.default_crypt_byte_block=t>>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=S.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))}),S.createFullBoxCtor("tfdt",function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()}),S.createFullBoxCtor("tfhd",function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&S.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&S.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&S.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&S.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&S.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0}),S.createFullBoxCtor("tfra",function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),n=0;n<r;n++)1===this.version?(this.time=e.readUint64(),this.moof_offset=e.readUint64()):(this.time=e.readUint32(),this.moof_offset=e.readUint32()),this.traf_number=e["readUint"+8*(this.length_size_of_traf_num+1)](),this.trun_number=e["readUint"+8*(this.length_size_of_trun_num+1)](),this.sample_number=e["readUint"+8*(this.length_size_of_sample_num+1)]()}),S.createFullBoxCtor("tkhd",function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint32()),e.readUint32Array(2),this.layer=e.readInt16(),this.alternate_group=e.readInt16(),this.volume=e.readInt16()>>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()}),S.createBoxCtor("tmax",function(e){this.time=e.readUint32()}),S.createBoxCtor("tmin",function(e){this.time=e.readUint32()}),S.createBoxCtor("totl",function(e){this.bytessent=e.readUint32()}),S.createBoxCtor("tpay",function(e){this.bytessent=e.readUint32()}),S.createBoxCtor("tpyl",function(e){this.bytessent=e.readUint64()}),S.createTrackGroupCtor("msrc"),S.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()<this.start+this.size;){if((t=S.parseOneBox(e,!0,this.size-(e.getPosition()-this.start))).code!==S.OK)return;(r=new S.TrackReferenceTypeBox(t.type,t.size,t.hdr_size,t.start)).write===S.Box.prototype.write&&"mdat"!==r.type&&(c.info("BoxParser","TrackReference "+r.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),r.parseDataAndRewind(e)),r.parse(e),this.boxes.push(r)}},S.createFullBoxCtor("trep",function(e){for(this.track_ID=e.readUint32(),this.boxes=[];e.getPosition()<this.start+this.size;){if(ret=S.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),ret.code!==S.OK)return;box=ret.box,this.boxes.push(box)}}),S.createFullBoxCtor("trex",function(e){this.track_id=e.readUint32(),this.default_sample_description_index=e.readUint32(),this.default_sample_duration=e.readUint32(),this.default_sample_size=e.readUint32(),this.default_sample_flags=e.readUint32()}),S.createBoxCtor("trpy",function(e){this.bytessent=e.readUint64()}),S.createFullBoxCtor("trun",function(e){var t=0;if(this.sample_count=e.readUint32(),t+=4,this.size-this.hdr_size>t&&this.flags&S.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&S.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r<this.sample_count;r++)this.flags&S.TRUN_FLAGS_DURATION&&(this.sample_duration[r]=e.readUint32()),this.flags&S.TRUN_FLAGS_SIZE&&(this.sample_size[r]=e.readUint32()),this.flags&S.TRUN_FLAGS_FLAGS&&(this.sample_flags[r]=e.readUint32()),this.flags&S.TRUN_FLAGS_CTS_OFFSET&&(0===this.version?this.sample_composition_time_offset[r]=e.readUint32():this.sample_composition_time_offset[r]=e.readInt32())}),S.createFullBoxCtor("tsel",function(e){this.switch_group=e.readUint32();var t=(this.size-this.hdr_size-4)/4;this.attribute_list=[];for(var r=0;r<t;r++)this.attribute_list[r]=e.readUint32()}),S.createFullBoxCtor("txtC",function(e){this.config=e.readCString()}),S.createFullBoxCtor("url ",function(e){1!==this.flags&&(this.location=e.readCString())}),S.createFullBoxCtor("urn ",function(e){this.name=e.readCString(),0<this.size-this.hdr_size-this.name.length-1&&(this.location=e.readCString())}),S.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,function(e){this.system_id=S.parseHex16(e);var t=e.readUint32();0<t&&(this.data=e.readUint8Array(t))}),S.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),S.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=S.parseHex16(e)}),S.createFullBoxCtor("vmhd",function(e){this.graphicsmode=e.readUint16(),this.opcolor=e.readUint16Array(3)}),S.createFullBoxCtor("vpcC",function(e){var t;1===this.version?(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8()):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)}),S.createBoxCtor("vttC",function(e){this.text=e.readString(this.size-this.hdr_size)}),S.SampleEntry.prototype.isVideo=function(){return!1},S.SampleEntry.prototype.isAudio=function(){return!1},S.SampleEntry.prototype.isSubtitle=function(){return!1},S.SampleEntry.prototype.isMetadata=function(){return!1},S.SampleEntry.prototype.isHint=function(){return!1},S.SampleEntry.prototype.getCodec=function(){return this.type.replace(".","")},S.SampleEntry.prototype.getWidth=function(){return""},S.SampleEntry.prototype.getHeight=function(){return""},S.SampleEntry.prototype.getChannelCount=function(){return""},S.SampleEntry.prototype.getSampleRate=function(){return""},S.SampleEntry.prototype.getSampleSize=function(){return""},S.VisualSampleEntry.prototype.isVideo=function(){return!0},S.VisualSampleEntry.prototype.getWidth=function(){return this.width},S.VisualSampleEntry.prototype.getHeight=function(){return this.height},S.AudioSampleEntry.prototype.isAudio=function(){return!0},S.AudioSampleEntry.prototype.getChannelCount=function(){return this.channel_count},S.AudioSampleEntry.prototype.getSampleRate=function(){return this.samplerate},S.AudioSampleEntry.prototype.getSampleSize=function(){return this.samplesize},S.SubtitleSampleEntry.prototype.isSubtitle=function(){return!0},S.MetadataSampleEntry.prototype.isMetadata=function(){return!0},S.decimalToHex=function(e,t){var r=Number(e).toString(16);for(t=null==t?t=2:t;r.length<t;)r="0"+r;return r},S.avc1SampleEntry.prototype.getCodec=function(){var e=S.SampleEntry.prototype.getCodec.call(this);return this.avcC?e+"."+S.decimalToHex(this.avcC.AVCProfileIndication)+S.decimalToHex(this.avcC.profile_compatibility)+S.decimalToHex(this.avcC.AVCLevelIndication):e},S.hvc1SampleEntry.prototype.getCodec=function(){var e,t=S.SampleEntry.prototype.getCodec.call(this);if(this.hvcC){switch(t+=".",this.hvcC.general_profile_space){case 0:t+="";break;case 1:t+="A";break;case 2:t+="B";break;case 3:t+="C"}t+=this.hvcC.general_profile_idc,t+=".";var r=this.hvcC.general_profile_compatibility,n=0;for(e=0;e<32&&(n|=1&r,31!=e);e++)n<<=1,r>>=1;t+=S.decimalToHex(n,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var i=!1,a="";for(e=5;0<=e;e--)(this.hvcC.general_constraint_indicator[e]||i)&&(a="."+S.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+a,i=!0);t+=a}return t},S.mp4aSampleEntry.prototype.getCodec=function(){var e=S.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+S.decimalToHex(t)+(r?"."+r:"")}return e},S.stxtSampleEntry.prototype.getCodec=function(){var e=S.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},S.av01SampleEntry.prototype.getCodec=function(){var e,t=S.SampleEntry.prototype.getCodec.call(this);return 2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?12:10:this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?10:8),t+"."+this.av1C.seq_profile+"."+this.av1C.seq_level_idx_0+(this.av1C.seq_tier_0?"H":"M")+"."+e+"."+this.av1C.monochrome+"."+this.av1C.chroma_subsampling_x+this.av1C.chroma_subsampling_y+this.av1C.chroma_sample_position},S.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>a&&(this.size+=8),"uuid"===this.type&&(this.size+=16),c.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>a?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>a&&e.writeUint64(this.size)},S.FullBox.prototype.writeHeader=function(e){this.size+=4,S.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},S.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},S.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t<this.boxes.length;t++)this.boxes[t]&&(this.boxes[t].write(e),this.size+=this.boxes[t].size);c.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},S.TrackReferenceTypeBox.prototype.write=function(e){this.size=4*this.track_ids.length,this.writeHeader(e),e.writeUint32Array(this.track_ids)},S.avcCBox.prototype.write=function(e){var t;for(this.size=7,t=0;t<this.SPS.length;t++)this.size+=2+this.SPS[t].length;for(t=0;t<this.PPS.length;t++)this.size+=2+this.PPS[t].length;for(this.ext&&(this.size+=this.ext.length),this.writeHeader(e),e.writeUint8(this.configurationVersion),e.writeUint8(this.AVCProfileIndication),e.writeUint8(this.profile_compatibility),e.writeUint8(this.AVCLevelIndication),e.writeUint8(this.lengthSizeMinusOne+252),e.writeUint8(this.SPS.length+224),t=0;t<this.SPS.length;t++)e.writeUint16(this.SPS[t].length),e.writeUint8Array(this.SPS[t].nalu);for(e.writeUint8(this.PPS.length),t=0;t<this.PPS.length;t++)e.writeUint16(this.PPS[t].length),e.writeUint8Array(this.PPS[t].nalu);this.ext&&e.writeUint8Array(this.ext)},S.co64Box.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),t=0;t<this.chunk_offsets.length;t++)e.writeUint64(this.chunk_offsets[t])},S.cslgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeInt32(this.compositionToDTSShift),e.writeInt32(this.leastDecodeToDisplayDelta),e.writeInt32(this.greatestDecodeToDisplayDelta),e.writeInt32(this.compositionStartTime),e.writeInt32(this.compositionEndTime)},S.cttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),1===this.version?e.writeInt32(this.sample_offsets[t]):e.writeUint32(this.sample_offsets[t])},S.drefBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++)this.entries[t].write(e),this.size+=this.entries[t].size;c.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},S.elngBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.extended_language.length,this.writeHeader(e),e.writeString(this.extended_language)},S.elstBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+12*this.entries.length,this.writeHeader(e),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var r=this.entries[t];e.writeUint32(r.segment_duration),e.writeInt32(r.media_time),e.writeInt16(r.media_rate_integer),e.writeInt16(r.media_rate_fraction)}},S.emsgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=16+this.message_data.length+(this.scheme_id_uri.length+1)+(this.value.length+1),this.writeHeader(e),e.writeCString(this.scheme_id_uri),e.writeCString(this.value),e.writeUint32(this.timescale),e.writeUint32(this.presentation_time_delta),e.writeUint32(this.event_duration),e.writeUint32(this.id),e.writeUint8Array(this.message_data)},S.ftypBox.prototype.write=function(e){this.size=8+4*this.compatible_brands.length,this.writeHeader(e),e.writeString(this.major_brand,null,4),e.writeUint32(this.minor_version);for(var t=0;t<this.compatible_brands.length;t++)e.writeString(this.compatible_brands[t],null,4)},S.hdlrBox.prototype.write=function(e){this.size=20+this.name.length+1,this.version=0,this.flags=0,this.writeHeader(e),e.writeUint32(0),e.writeString(this.handler,null,4),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeCString(this.name)},S.kindBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.schemeURI.length+1+(this.value.length+1),this.writeHeader(e),e.writeCString(this.schemeURI),e.writeCString(this.value)},S.mdhdBox.prototype.write=function(e){this.size=20,this.flags=0,this.version=0,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint16(this.language),e.writeUint16(0)},S.mehdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.fragment_duration)},S.mfhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.sequence_number)},S.mvhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=96,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint32(this.rate),e.writeUint16(this.volume<<8),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32Array(this.matrix),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(this.next_track_id)},S.SampleEntry.prototype.writeHeader=function(e){this.size=8,S.Box.prototype.writeHeader.call(this,e),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint16(this.data_reference_index)},S.SampleEntry.prototype.writeFooter=function(e){for(var t=0;t<this.boxes.length;t++)this.boxes[t].write(e),this.size+=this.boxes[t].size;c.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},S.SampleEntry.prototype.write=function(e){this.writeHeader(e),e.writeUint8Array(this.data),this.size+=this.data.length,c.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},S.VisualSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=70,e.writeUint16(0),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.width),e.writeUint16(this.height),e.writeUint32(this.horizresolution),e.writeUint32(this.vertresolution),e.writeUint32(0),e.writeUint16(this.frame_count),e.writeUint8(Math.min(31,this.compressorname.length)),e.writeString(this.compressorname,null,31),e.writeUint16(this.depth),e.writeInt16(-1),this.writeFooter(e)},S.AudioSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=20,e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.channel_count),e.writeUint16(this.samplesize),e.writeUint16(0),e.writeUint16(0),e.writeUint32(this.samplerate<<16),this.writeFooter(e)},S.stppSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=this.namespace.length+1+this.schema_location.length+1+this.auxiliary_mime_types.length+1,e.writeCString(this.namespace),e.writeCString(this.schema_location),e.writeCString(this.auxiliary_mime_types),this.writeFooter(e)},S.SampleGroupEntry.prototype.write=function(e){e.writeUint8Array(this.data)},S.sbgpBox.prototype.write=function(e){this.version=1,this.flags=0,this.size=12+8*this.entries.length,this.writeHeader(e),e.writeString(this.grouping_type,null,4),e.writeUint32(this.grouping_type_parameter),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var r=this.entries[t];e.writeInt32(r.sample_count),e.writeInt32(r.group_description_index)}},S.sgpdBox.prototype.write=function(e){var t,r;for(this.flags=0,this.size=12,t=0;t<this.entries.length;t++)r=this.entries[t],1===this.version&&(0===this.default_length&&(this.size+=4),this.size+=r.data.length);for(this.writeHeader(e),e.writeString(this.grouping_type,null,4),1===this.version&&e.writeUint32(this.default_length),2<=this.version&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t<this.entries.length;t++)r=this.entries[t],1===this.version&&0===this.default_length&&e.writeUint32(r.description_length),r.write(e)},S.sidxBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20+12*this.references.length,this.writeHeader(e),e.writeUint32(this.reference_ID),e.writeUint32(this.timescale),e.writeUint32(this.earliest_presentation_time),e.writeUint32(this.first_offset),e.writeUint16(0),e.writeUint16(this.references.length);for(var t=0;t<this.references.length;t++){var r=this.references[t];e.writeUint32(r.reference_type<<31|r.referenced_size),e.writeUint32(r.subsegment_duration),e.writeUint32(r.starts_with_SAP<<31|r.SAP_type<<28|r.SAP_delta_time)}},S.stcoBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),e.writeUint32Array(this.chunk_offsets)},S.stscBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+12*this.first_chunk.length,this.writeHeader(e),e.writeUint32(this.first_chunk.length),t=0;t<this.first_chunk.length;t++)e.writeUint32(this.first_chunk[t]),e.writeUint32(this.samples_per_chunk[t]),e.writeUint32(this.sample_description_index[t])},S.stsdBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=0,this.writeHeader(e),e.writeUint32(this.entries.length),this.size+=4,t=0;t<this.entries.length;t++)this.entries[t].write(e),this.size+=this.entries[t].size;c.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},S.stshBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.shadowed_sample_numbers.length,this.writeHeader(e),e.writeUint32(this.shadowed_sample_numbers.length),t=0;t<this.shadowed_sample_numbers.length;t++)e.writeUint32(this.shadowed_sample_numbers[t]),e.writeUint32(this.sync_sample_numbers[t])},S.stssBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.sample_numbers.length,this.writeHeader(e),e.writeUint32(this.sample_numbers.length),e.writeUint32Array(this.sample_numbers)},S.stszBox.prototype.write=function(e){var t,r=!0;if(this.version=0,(this.flags=0)<this.sample_sizes.length)for(t=0;t+1<this.sample_sizes.length;){if(this.sample_sizes[t+1]!==this.sample_sizes[0]){r=!1;break}t++}else r=!1;this.size=8,r||(this.size+=4*this.sample_sizes.length),this.writeHeader(e),r?e.writeUint32(this.sample_sizes[0]):e.writeUint32(0),e.writeUint32(this.sample_sizes.length),r||e.writeUint32Array(this.sample_sizes)},S.sttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),e.writeUint32(this.sample_deltas[t])},S.tfdtBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},S.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&S.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&S.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&S.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&S.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&S.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&S.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&S.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&S.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&S.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&S.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},S.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},S.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},S.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&S.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&S.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&S.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&S.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&S.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&S.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&S.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&S.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t<this.sample_count;t++)this.flags&S.TRUN_FLAGS_DURATION&&e.writeUint32(this.sample_duration[t]),this.flags&S.TRUN_FLAGS_SIZE&&e.writeUint32(this.sample_size[t]),this.flags&S.TRUN_FLAGS_FLAGS&&e.writeUint32(this.sample_flags[t]),this.flags&S.TRUN_FLAGS_CTS_OFFSET&&(0===this.version?e.writeUint32(this.sample_composition_time_offset[t]):e.writeInt32(this.sample_composition_time_offset[t]))},S["url Box"].prototype.write=function(e){this.version=0,this.location?(this.flags=0,this.size=this.location.length+1):(this.flags=1,this.size=0),this.writeHeader(e),this.location&&e.writeCString(this.location)},S["urn Box"].prototype.write=function(e){this.version=0,this.flags=0,this.size=this.name.length+1+(this.location?this.location.length+1:0),this.writeHeader(e),e.writeCString(this.name),this.location&&e.writeCString(this.location)},S.vmhdBox.prototype.write=function(e){this.version=0,this.flags=1,this.size=8,this.writeHeader(e),e.writeUint16(this.graphicsmode),e.writeUint16Array(this.opcolor)},S.cttsBox.prototype.unpack=function(e){var t,r,n;for(t=n=0;t<this.sample_counts.length;t++)for(r=0;r<this.sample_counts[t];r++)e[n].pts=e[n].dts+this.sample_offsets[t],n++},S.sttsBox.prototype.unpack=function(e){var t,r,n;for(t=n=0;t<this.sample_counts.length;t++)for(r=0;r<this.sample_counts[t];r++)e[n].dts=0===n?0:e[n-1].dts+this.sample_deltas[t],n++},S.stcoBox.prototype.unpack=function(e){var t;for(t=0;t<this.chunk_offsets.length;t++)e[t].offset=this.chunk_offsets[t]},S.stscBox.prototype.unpack=function(e){var t,r,n,i,a;for(t=a=i=0;t<this.first_chunk.length;t++)for(r=0;r<(t+1<this.first_chunk.length?this.first_chunk[t+1]:1/0);r++)for(a++,n=0;n<this.samples_per_chunk[t];n++){if(!e[i])return;e[i].description_index=this.sample_description_index[t],e[i].chunk_index=a,i++}},S.stszBox.prototype.unpack=function(e){var t;for(t=0;t<this.sample_sizes.length;t++)e[t].size=this.sample_sizes[t]},S.DIFF_BOXES_PROP_NAMES=["boxes","entries","references","subsamples","items","item_infos","extents","associations","subsegments","ranges","seekLists","seekPoints","esd","levels"],S.DIFF_PRIMITIVE_ARRAY_PROP_NAMES=["compatible_brands","matrix","opcolor","sample_counts","sample_counts","sample_deltas","first_chunk","samples_per_chunk","sample_sizes","chunk_offsets","sample_offsets","sample_description_index","sample_duration"],S.boxEqualFields=function(e,t){if(e&&!t)return!1;var r;for(r in e)if(!(-1<S.DIFF_BOXES_PROP_NAMES.indexOf(r)||e[r]instanceof S.Box||t[r]instanceof S.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&-1<e.subBoxNames.indexOf(r.slice(0,4))||t.subBoxNames&&-1<t.subBoxNames.indexOf(r.slice(0,4))||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||-1<S.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)||e[r]===t[r]))return!1;return!0},S.boxEqual=function(e,t){if(!S.boxEqualFields(e,t))return!1;for(var r=0;r<S.DIFF_BOXES_PROP_NAMES.length;r++){var n=S.DIFF_BOXES_PROP_NAMES[r];if(e[n]&&t[n]&&!S.boxEqual(e[n],t[n]))return!1}return!0};var l=function(){};l.prototype.parseSample=function(e){var t,r={};r.resources=[];var n=new i(e.data.buffer);if(e.subsamples&&0!==e.subsamples.length){if(r.documentString=n.readString(e.subsamples[0].size),1<e.subsamples.length)for(t=1;t<e.subsamples.length;t++)r.resources[t]=n.readUint8Array(e.subsamples[t].size)}else r.documentString=n.readString(e.data.length);return"undefined"!=typeof DOMParser&&(r.document=(new DOMParser).parseFromString(r.documentString,"application/xml")),r};var f=function(){};f.prototype.parseSample=function(e){return new i(e.data.buffer).readString(e.data.length)},f.prototype.parseConfig=function(e){var t=new i(e.buffer);return t.readUint32(),t.readCString()},t.XMLSubtitlein4Parser=l,t.Textin4Parser=f;var x=function(e){this.stream=e||new o,this.boxes=[],this.mdats=[],this.moofs=[],this.isProgressive=!1,this.moovStartFound=!1,this.onMoovStart=null,this.moovStartSent=!1,this.onReady=null,this.readySent=!1,this.onSegment=null,this.onSamples=null,this.onError=null,this.sampleListBuilt=!1,this.fragmentedTracks=[],this.extractedTracks=[],this.isFragmentationInitialized=!1,this.sampleProcessingStarted=!1,this.nextMoofNumber=0,this.itemListBuilt=!1,this.onSidx=null,this.sidxSent=!1};x.prototype.setSegmentOptions=function(e,t,r){var n=this.getTrackById(e);if(n){var i={};this.fragmentedTracks.push(i),i.id=e,i.user=t,(i.trak=n).nextSample=0,i.segmentStream=null,i.nb_samples=1e3,i.rapAlignement=!0,r&&(r.nbSamples&&(i.nb_samples=r.nbSamples),r.rapAlignement&&(i.rapAlignement=r.rapAlignement))}},x.prototype.unsetSegmentOptions=function(e){for(var t=-1,r=0;r<this.fragmentedTracks.length;r++){this.fragmentedTracks[r].id==e&&(t=r)}-1<t&&this.fragmentedTracks.splice(t,1)},x.prototype.setExtractionOptions=function(e,t,r){var n=this.getTrackById(e);if(n){var i={};this.extractedTracks.push(i),i.id=e,i.user=t,(i.trak=n).nextSample=0,i.nb_samples=1e3,i.samples=[],r&&r.nbSamples&&(i.nb_samples=r.nbSamples)}},x.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r<this.extractedTracks.length;r++){this.extractedTracks[r].id==e&&(t=r)}-1<t&&this.extractedTracks.splice(t,1)},x.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=S.parseOneBox(this.stream,!1)).code===S.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&c.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},x.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(c.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(c.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(c.warn("ISOFile","Not ready to start parsing"),!1))},x.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(c.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),c.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},x.prototype.getInfo=function(){var e,t,r,n,i,a={},o=new Date(4,0,1,0,0,0,0).getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e<this.moov.traks.length;e++){if(i=(r=this.moov.traks[e]).mdia.minf.stbl.stsd.entries[0],n={},a.tracks.push(n),n.id=r.tkhd.track_id,n.name=r.mdia.hdlr.name,n.references=[],r.tref)for(t=0;t<r.tref.boxes.length;t++)ref={},n.references.push(ref),ref.type=r.tref.boxes[t].type,ref.track_ids=r.tref.boxes[t].track_ids;r.edts&&(n.edits=r.edts.elst.entries),n.created=new Date(o+1e3*r.tkhd.creation_time),n.modified=new Date(o+1e3*r.tkhd.modification_time),n.movie_duration=r.tkhd.duration,n.movie_timescale=a.timescale,n.layer=r.tkhd.layer,n.alternate_group=r.tkhd.alternate_group,n.volume=r.tkhd.volume,n.matrix=r.tkhd.matrix,n.track_width=r.tkhd.width/65536,n.track_height=r.tkhd.height/65536,n.timescale=r.mdia.mdhd.timescale,n.cts_shift=r.mdia.minf.stbl.cslg,n.duration=r.mdia.mdhd.duration,n.samples_duration=r.samples_duration,n.codec=i.getCodec(),n.kind=r.udta&&r.udta.kinds.length?r.udta.kinds[0]:{schemeURI:"",value:""},n.language=r.mdia.elng?r.mdia.elng.extended_language:r.mdia.mdhd.languageString,n.nb_samples=r.samples.length,n.size=r.samples_size,n.bitrate=8*n.size*n.timescale/n.samples_duration,i.isAudio()?(n.type="audio",a.audioTracks.push(n),n.audio={},n.audio.sample_rate=i.getSampleRate(),n.audio.channel_count=i.getChannelCount(),n.audio.sample_size=i.getSampleSize()):i.isVideo()?(n.type="video",a.videoTracks.push(n),n.video={},n.video.width=i.getWidth(),n.video.height=i.getHeight()):i.isSubtitle()?(n.type="subtitles",a.subtitleTracks.push(n)):i.isHint()?(n.type="metadata",a.hintTracks.push(n)):i.isMetadata()?(n.type="metadata",a.metadataTracks.push(n)):(n.type="metadata",a.otherTracks.push(n))}else a.hasMoov=!1;if(a.mime="",a.hasMoov&&a.tracks){for(a.videoTracks&&0<a.videoTracks.length?a.mime+='video/mp4; codecs="':a.audioTracks&&0<a.audioTracks.length?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e<a.tracks.length;e++)0!==e&&(a.mime+=","),a.mime+=a.tracks[e].codec;a.mime+='"; profiles="',a.mime+=this.ftyp.compatible_brands.join(),a.mime+='"'}return a},x.prototype.processSamples=function(e){var t,r;if(this.sampleProcessingStarted){if(this.isFragmentationInitialized&&null!==this.onSegment)for(t=0;t<this.fragmentedTracks.length;t++){var n=this.fragmentedTracks[t];for(r=n.trak;r.nextSample<r.samples.length&&this.sampleProcessingStarted;){c.debug("ISOFile","Creating media fragment on track #"+n.id+" for sample "+r.nextSample);var i=this.createFragment(n.id,r.nextSample,n.segmentStream);if(!i)break;n.segmentStream=i,r.nextSample++;var a=!1,o=r.samples[r.nextSample];if(n.lastSegmentSampleIndex=n.lastSegmentSampleIndex||0,e&&r.nextSample>=r.samples.length&&(a=!0),n.rapAlignement&&r.nextSample-n.lastSegmentSampleIndex>=n.nb_samples&&(!o||o.is_sync)&&(a=!0),n.rapAlignement||r.nextSample%n.nb_samples!=0||(a=!0),a&&(c.info("ISOFile","Sending fragmented data on track #"+n.id+" for samples ["+Math.max(0,r.nextSample-n.nb_samples)+","+(r.nextSample-1)+"]"),c.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),n.lastSegmentSampleIndex=r.nextSample,this.onSegment&&this.onSegment(n.id,n.user,n.segmentStream.buffer,r.nextSample,e&&r.nextSample>=r.samples.length),n.segmentStream=null,n!==this.fragmentedTracks[t]))break}e&&r.nextSample===r.samples.length&&(this.onSegment&&this.onSegment(n.id,n.user,n.segmentStream.buffer,r.nextSample,e&&r.nextSample>=r.samples.length),n.segmentStream=null)}if(null!==this.onSamples)for(t=0;t<this.extractedTracks.length;t++){var s=this.extractedTracks[t];for(r=s.trak;r.nextSample<r.samples.length&&this.sampleProcessingStarted;){c.debug("ISOFile","Exporting on track #"+s.id+" sample #"+r.nextSample);var l=this.getSample(r,r.nextSample);if(!l)break;if(r.nextSample++,s.samples.push(l),(r.nextSample%s.nb_samples==0||r.nextSample>=r.samples.length)&&(c.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},x.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},x.prototype.getBoxes=function(e,t){var r=[];return x._sweep.call(this,e,r,t),r},x._sweep=function(e,t,r){for(var n in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;x._sweep.call(this.boxes[n],e,t,r)}},x.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},x.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},x.prototype.releaseUsedSamples=function(e,t){var r=0,n=this.getTrackById(e);n.lastValidSample||(n.lastValidSample=0);for(var i=n.lastValidSample;i<t;i++)r+=this.releaseSample(n,i);c.info("ISOFile","Track #"+e+" released samples up to "+t+" (released size: "+r+", remaining: "+this.samplesDataSize+")"),n.lastValidSample=t},x.prototype.start=function(){this.sampleProcessingStarted=!0,this.processSamples(!1)},x.prototype.stop=function(){this.sampleProcessingStarted=!1},x.prototype.flush=function(){c.info("ISOFile","Flushing remaining samples"),this.updateSampleLists(),this.processSamples(!0),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0)},x.prototype.seekTrack=function(e,t,r){var n,i,a,o,s=0,l=0;if(0===r.samples.length)return c.info("ISOFile","No sample in track, cannot seek! Using time "+c.getDurationString(0,1)+" and offset: 0"),{offset:0,time:0};for(n=0;n<r.samples.length;n++){if(i=r.samples[n],0===n)l=0,o=i.timescale;else if(i.cts>e*i.timescale){l=n-1;break}t&&i.is_sync&&(s=n)}for(t&&(l=s),e=r.samples[l].cts,r.nextSample=l;l<r.samples.length&&r.samples[l].alreadyRead===r.samples[l].size;)l++;if(l===r.samples.length)return{offset:-1,time:e/o};for(a=r.samples[l].offset+r.samples[l].alreadyRead,n=0;n<this.fragmentedTracks.length;n+=1){var u=this.fragmentedTracks[n];r===u.trak&&(u.lastSegmentSampleIndex=r.nextSample,u.segmentStream=null)}return c.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+c.getDurationString(e,o)+" and offset: "+a),{offset:a,time:e/o}},x.prototype.seek=function(e,t){var r,n,i,a=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(i=0;i<a.traks.length;i++)r=a.traks[i],(n=this.seekTrack(e,t,r)).offset<o.offset&&(o.offset=n.offset),n.time<o.time&&(o.time=n.time);return c.info("ISOFile","Seeking at time "+c.getDurationString(o.time,1)+" needs a buffer with a fileStart position of "+o.offset),o.offset===1/0?o={offset:this.nextParsePosition,time:0}:o.offset=this.stream.getEndFilePositionAfter(o.offset),c.info("ISOFile","Adjusted seek position (after checking data already in buffer): "+o.offset),o}throw"Cannot seek: moov not received!"},x.prototype.equal=function(e){for(var t=0;t<this.boxes.length&&t<e.boxes.length;){var r=this.boxes[t],n=e.boxes[t];if(!S.boxEqual(r,n))return!1;t++}return!0},(t.ISOFile=x).prototype.lastBoxStartPosition=0,x.prototype.parsingMdat=null,x.prototype.nextParsePosition=0,x.prototype.discardMdatData=!1,x.prototype.processIncompleteBox=function(e){var t;return"mdat"===e.type?(t=new S[e.type+"Box"](e.size),this.parsingMdat=t,this.boxes.push(t),this.mdats.push(t),t.start=e.start,t.hdr_size=e.hdr_size,this.stream.addUsedBytes(t.hdr_size),this.lastBoxStartPosition=t.start+t.size,this.stream.seek(t.start+t.size,!1,this.discardMdatData)?!(this.parsingMdat=null):(this.moovStartFound?this.nextParsePosition=this.stream.findEndContiguousBuf():this.nextParsePosition=t.start+t.size,!1)):("moov"===e.type&&(this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0)),!!this.stream.mergeNextBuffer&&this.stream.mergeNextBuffer()?(this.nextParsePosition=this.stream.getEndPosition(),!0):(e.type?this.moovStartFound?this.nextParsePosition=this.stream.getEndPosition():this.nextParsePosition=this.stream.getPosition()+e.size:this.nextParsePosition=this.stream.getEndPosition(),!1))},x.prototype.hasIncompleteMdat=function(){return null!==this.parsingMdat},x.prototype.processIncompleteMdat=function(){var e;return e=this.parsingMdat,this.stream.seek(e.start+e.size,!1,this.discardMdatData)?(c.debug("ISOFile","Found 'mdat' end in buffered data"),!(this.parsingMdat=null)):(this.nextParsePosition=this.stream.findEndContiguousBuf(),!1)},x.prototype.restoreParsePosition=function(){return this.stream.seek(this.lastBoxStartPosition,!0,this.discardMdatData)},x.prototype.saveParsePosition=function(){this.lastBoxStartPosition=this.stream.getPosition()},x.prototype.updateUsedBytes=function(e,t){this.stream.addUsedBytes&&("mdat"===e.type?(this.stream.addUsedBytes(e.hdr_size),this.discardMdatData&&this.stream.addUsedBytes(e.size-e.hdr_size)):this.stream.addUsedBytes(e.size))},x.prototype.add=S.Box.prototype.add,x.prototype.addBox=S.Box.prototype.addBox,x.prototype.init=function(e){var t=e||{},r=(this.add("ftyp").set("major_brand",t.brands&&t.brands[0]||"iso4").set("minor_version",0).set("compatible_brands",t.brands||["iso4"]),this.add("moov"));return r.add("mvhd").set("timescale",t.timescale||600).set("rate",t.rate||1).set("creation_time",0).set("modification_time",0).set("duration",t.duration||0).set("volume",1).set("matrix",[0,0,0,0,0,0,0,0,0]).set("next_track_id",1),r.add("mvex"),this},x.prototype.addTrack=function(e){this.moov||this.init(e);var t=e||{};t.width=t.width||320,t.height=t.height||320,t.id=t.id||this.moov.mvhd.next_track_id,t.type=t.type||"avc1";var r=this.moov.add("trak");this.moov.mvhd.next_track_id=t.id+1,r.add("tkhd").set("flags",S.TKHD_FLAG_ENABLED|S.TKHD_FLAG_IN_MOVIE|S.TKHD_FLAG_IN_PREVIEW).set("creation_time",0).set("modification_time",0).set("track_id",t.id).set("duration",t.duration||0).set("layer",t.layer||0).set("alternate_group",0).set("volume",1).set("matrix",[0,0,0,0,0,0,0,0,0]).set("width",t.width).set("height",t.height);var n=r.add("mdia");n.add("mdhd").set("creation_time",0).set("modification_time",0).set("timescale",t.timescale||1).set("duration",t.media_duration||0).set("language",t.language||0),n.add("hdlr").set("handler",t.hdlr||"vide").set("name",t.name||"Track created with MP4Box.js"),n.add("elng").set("extended_language",t.language||"fr-FR");var i=n.add("minf");if(void 0!==S[t.type+"SampleEntry"]){var a=new S[t.type+"SampleEntry"];a.data_reference_index=1;for(var o="",s=0;s<S.sampleEntryCodes.length;s++){var l=S.sampleEntryCodes[s];if(-1<l.types.indexOf(t.type)){o=l.prefix;break}}switch(o){case"Visual":i.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),a.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24);break;case"Audio":i.add("smhd").set("balance",t.balance||0),a.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":i.add("hmhd");break;case"Subtitle":switch(i.add("sthd"),t.type){case"stpp":a.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"")}break;case"Metadata":case"System":default:i.add("nmhd")}t.description&&a.addBox(t.description),i.add("dinf").add("dref").addEntry((new S["url Box"]).set("flags",1));var u=i.add("stbl");return u.add("stsd").addEntry(a),u.add("stts").set("sample_counts",[]).set("sample_deltas",[]),u.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),u.add("stco").set("chunk_offsets",[]),u.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},S.Box.prototype.computeSize=function(e){var t=e||new u;t.endianness=u.BIG_ENDIAN,this.write(t)},x.prototype.addSample=function(e,t,r){var n=r||{},i={},a=this.getTrackById(e);if(null!==a){i.number=a.samples.length,i.track_id=a.tkhd.track_id,i.timescale=a.mdia.mdhd.timescale,i.description_index=n.sample_description_index?n.sample_description_index-1:0,i.description=a.mdia.minf.stbl.stsd.entries[i.description_index],i.data=t,i.size=t.length,i.alreadyRead=i.size,i.duration=n.duration||1,i.cts=n.cts||0,i.dts=n.dts||0,i.is_sync=n.is_sync||!1,i.is_leading=n.is_leading||0,i.depends_on=n.depends_on||0,i.is_depended_on=n.is_depended_on||0,i.has_redundancy=n.has_redundancy||0,i.degradation_priority=n.degradation_priority||0,i.offset=0,i.subsamples=n.subsamples,a.samples.push(i),a.samples_size+=i.size,a.samples_duration+=i.duration,this.processSamples();var o=x.createSingleSampleMoof(i);return this.addBox(o),o.computeSize(),o.trafs[0].truns[0].data_offset=o.size+8,this.add("mdat").data=t,i}},x.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new S.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var n=r.add("traf");return n.add("tfhd").set("track_id",e.track_id).set("flags",S.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),n.add("tfdt").set("baseMediaDecodeTime",e.dts),n.add("trun").set("flags",S.TRUN_FLAGS_DATA_OFFSET|S.TRUN_FLAGS_DURATION|S.TRUN_FLAGS_SIZE|S.TRUN_FLAGS_FLAGS|S.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},x.prototype.lastMoofIndex=0,x.prototype.samplesDataSize=0,x.prototype.resetTables=function(){var e,t,r,n,i,a;for(this.initial_duration=this.moov.mvhd.duration,e=this.moov.mvhd.duration=0;e<this.moov.traks.length;e++){(t=this.moov.traks[e]).tkhd.duration=0,t.mdia.mdhd.duration=0,(t.mdia.minf.stbl.stco||t.mdia.minf.stbl.co64).chunk_offsets=[],(r=t.mdia.minf.stbl.stsc).first_chunk=[],r.samples_per_chunk=[],r.sample_description_index=[],(t.mdia.minf.stbl.stsz||t.mdia.minf.stbl.stz2).sample_sizes=[],(n=t.mdia.minf.stbl.stts).sample_counts=[],n.sample_deltas=[],(i=t.mdia.minf.stbl.ctts)&&(i.sample_counts=[],i.sample_offsets=[]),a=t.mdia.minf.stbl.stss;var o=t.mdia.minf.stbl.boxes.indexOf(a);-1!=o&&(t.mdia.minf.stbl.boxes[o]=null)}},x.initSampleGroups=function(e,t,r,n,i){var a,o,s,l;function u(e,t,r){this.grouping_type=e,this.grouping_type_parameter=t,this.sbgp=r,this.last_sample_in_run=-1,this.entry_index=-1}for(t&&(t.sample_groups_info=[]),e.sample_groups_info||(e.sample_groups_info=[]),o=0;o<r.length;o++){for(l=r[o].grouping_type+"/"+r[o].grouping_type_parameter,s=new u(r[o].grouping_type,r[o].grouping_type_parameter,r[o]),t&&(t.sample_groups_info[l]=s),e.sample_groups_info[l]||(e.sample_groups_info[l]=s),a=0;a<n.length;a++)n[a].grouping_type===r[o].grouping_type&&(s.description=n[a],s.description.used=!0);if(i)for(a=0;a<i.length;a++)i[a].grouping_type===r[o].grouping_type&&(s.fragment_description=i[a],s.fragment_description.used=!0,s.is_fragment=!0)}if(t){if(i)for(o=0;o<i.length;o++)!i[o].used&&2<=i[o].version&&(l=i[o].grouping_type+"/0",(s=new u(i[o].grouping_type,0)).is_fragment=!0,t.sample_groups_info[l]||(t.sample_groups_info[l]=s))}else for(o=0;o<n.length;o++)!n[o].used&&2<=n[o].version&&(l=n[o].grouping_type+"/0",s=new u(n[o].grouping_type,0),e.sample_groups_info[l]||(e.sample_groups_info[l]=s))},x.setSampleGroupProperties=function(e,t,r,n){var i,a;for(i in t.sample_groups=[],n){var o;if(t.sample_groups[i]={},t.sample_groups[i].grouping_type=n[i].grouping_type,t.sample_groups[i].grouping_type_parameter=n[i].grouping_type_parameter,r>=n[i].last_sample_in_run&&(n[i].last_sample_in_run<0&&(n[i].last_sample_in_run=0),n[i].entry_index++,n[i].entry_index<=n[i].sbgp.entries.length-1&&(n[i].last_sample_in_run+=n[i].sbgp.entries[n[i].entry_index].sample_count)),n[i].entry_index<=n[i].sbgp.entries.length-1?t.sample_groups[i].group_description_index=n[i].sbgp.entries[n[i].entry_index].group_description_index:t.sample_groups[i].group_description_index=-1,0!==t.sample_groups[i].group_description_index)o=n[i].fragment_description?n[i].fragment_description:n[i].description,0<t.sample_groups[i].group_description_index?(a=65535<t.sample_groups[i].group_description_index?(t.sample_groups[i].group_description_index>>16)-1:t.sample_groups[i].group_description_index-1,o&&0<=a&&(t.sample_groups[i].description=o.entries[a])):o&&2<=o.version&&0<o.default_group_description_index&&(t.sample_groups[i].description=o.entries[o.default_group_description_index-1])}},x.process_sdtp=function(e,t,r){t&&(t.has_redundancy=e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0))},x.prototype.buildSampleLists=function(){var e;for(e=0;e<this.moov.traks.length;e++){var t=this.moov.traks[e];this.buildTrakSampleLists(t)}},x.prototype.buildTrakSampleLists=function(e){var t,r,n,i,a,o,s,l,u,f,d,c,h,p,g,m,y,v,_,b,S,E,w,T;if(e.samples=[],e.samples_duration=0,e.samples_size=0,r=e.mdia.minf.stbl.stco||e.mdia.minf.stbl.co64,n=e.mdia.minf.stbl.stsc,i=e.mdia.minf.stbl.stsz||e.mdia.minf.stbl.stz2,a=e.mdia.minf.stbl.stts,o=e.mdia.minf.stbl.ctts,s=e.mdia.minf.stbl.stss,l=e.mdia.minf.stbl.stsd,u=e.mdia.minf.stbl.subs,c=e.mdia.minf.stbl.stdp,f=e.mdia.minf.stbl.sbgps,d=e.mdia.minf.stbl.sgpds,S=b=_=v=-1,T=w=E=0,x.initSampleGroups(e,null,f,d),void 0!==i){for(t=0;t<i.sample_sizes.length;t++){var A={};A.number=t,A.track_id=e.tkhd.track_id,A.timescale=e.mdia.mdhd.timescale,A.alreadyRead=0,(e.samples[t]=A).size=i.sample_sizes[t],e.samples_size+=A.size,0===t?(p=1,h=0,A.chunk_index=p,A.chunk_run_index=h,y=n.samples_per_chunk[h],m=0,g=h+1<n.first_chunk.length?n.first_chunk[h+1]-1:1/0):t<y?(A.chunk_index=p,A.chunk_run_index=h):(p++,m=0,(A.chunk_index=p)<=g||(g=++h+1<n.first_chunk.length?n.first_chunk[h+1]-1:1/0),A.chunk_run_index=h,y+=n.samples_per_chunk[h]),A.description_index=n.sample_description_index[A.chunk_run_index]-1,A.description=l.entries[A.description_index],A.offset=r.chunk_offsets[A.chunk_index-1]+m,m+=A.size,v<t&&(_++,v<0&&(v=0),v+=a.sample_counts[_]),A.dts=0<t?(e.samples[t-1].duration=a.sample_deltas[_],e.samples_duration+=e.samples[t-1].duration,e.samples[t-1].dts+e.samples[t-1].duration):0,A.cts=o?(b<=t&&(S++,b<0&&(b=0),b+=o.sample_counts[S]),e.samples[t].dts+o.sample_offsets[S]):A.dts,s?(t==s.sample_numbers[E]-1?(A.is_sync=!0,E++):(A.is_sync=!1,A.degradation_priority=0),u&&u.entries[w].sample_delta+T==t+1&&(A.subsamples=u.entries[w].subsamples,T+=u.entries[w].sample_delta,w++)):A.is_sync=!0,x.process_sdtp(e.mdia.minf.stbl.sdtp,A,A.number),A.degradation_priority=c?c.priority[t]:0,u&&u.entries[w].sample_delta+T==t&&(A.subsamples=u.entries[w].subsamples,T+=u.entries[w].sample_delta),(0<f.length||0<d.length)&&x.setSampleGroupProperties(e,A,t,e.sample_groups_info)}0<t&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},x.prototype.updateSampleLists=function(){var e,t,r,n,i,a,o,s,l,u,f,d,c,h,p;if(void 0!==this.moov)for(;this.lastMoofIndex<this.moofs.length;)if(l=this.moofs[this.lastMoofIndex],this.lastMoofIndex++,"moof"==l.type)for(u=l,e=0;e<u.trafs.length;e++){for(f=u.trafs[e],d=this.getTrackById(f.tfhd.track_id),c=this.getTrexById(f.tfhd.track_id),n=f.tfhd.flags&S.TFHD_FLAG_SAMPLE_DESC?f.tfhd.default_sample_description_index:c?c.default_sample_description_index:1,i=f.tfhd.flags&S.TFHD_FLAG_SAMPLE_DUR?f.tfhd.default_sample_duration:c?c.default_sample_duration:0,a=f.tfhd.flags&S.TFHD_FLAG_SAMPLE_SIZE?f.tfhd.default_sample_size:c?c.default_sample_size:0,o=f.tfhd.flags&S.TFHD_FLAG_SAMPLE_FLAGS?f.tfhd.default_sample_flags:c?c.default_sample_flags:0,(f.sample_number=0)<f.sbgps.length&&x.initSampleGroups(d,f,f.sbgps,d.mdia.minf.stbl.sgpds,f.sgpds),t=0;t<f.truns.length;t++){var g=f.truns[t];for(r=0;r<g.sample_count;r++){(h={}).number_in_traf=f.sample_number,f.sample_number++,h.number=d.samples.length,f.first_sample_index=d.samples.length,d.samples.push(h),h.track_id=d.tkhd.track_id,h.timescale=d.mdia.mdhd.timescale,h.description_index=n-1,h.description=d.mdia.minf.stbl.stsd.entries[h.description_index],h.size=a,g.flags&S.TRUN_FLAGS_SIZE&&(h.size=g.sample_size[r]),d.samples_size+=h.size,h.duration=i,g.flags&S.TRUN_FLAGS_DURATION&&(h.duration=g.sample_duration[r]),d.samples_duration+=h.duration,d.first_traf_merged||0<r?h.dts=d.samples[d.samples.length-2].dts+d.samples[d.samples.length-2].duration:(f.tfdt?h.dts=f.tfdt.baseMediaDecodeTime:h.dts=0,d.first_traf_merged=!0),h.cts=h.dts,g.flags&S.TRUN_FLAGS_CTS_OFFSET&&(h.cts=h.dts+g.sample_composition_time_offset[r]),p=o,g.flags&S.TRUN_FLAGS_FLAGS?p=g.sample_flags[r]:0===r&&g.flags&S.TRUN_FLAGS_FIRST_FLAG&&(p=g.first_sample_flags),h.is_sync=!(p>>16&1),h.is_leading=p>>26&3,h.depends_on=p>>24&3,h.is_depended_on=p>>22&3,h.has_redundancy=p>>20&3,h.degradation_priority=65535&p;var m=!!(f.tfhd.flags&S.TFHD_FLAG_BASE_DATA_OFFSET),y=!!(f.tfhd.flags&S.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),v=!!(g.flags&S.TRUN_FLAGS_DATA_OFFSET),_=0;_=m?f.tfhd.base_data_offset:y?u.start:0===t?u.start:s,h.offset=0===t&&0===r?v?_+g.data_offset:_:s,s=h.offset+h.size,(0<f.sbgps.length||0<f.sgpds.length||0<d.mdia.minf.stbl.sbgps.length||0<d.mdia.minf.stbl.sgpds.length)&&x.setSampleGroupProperties(d,h,h.number_in_traf,f.sample_groups_info)}}if(f.subs){d.has_fragment_subsamples=!0;var b=f.first_sample_index;for(t=0;t<f.subs.entries.length;t++)b+=f.subs.entries[t].sample_delta,(h=d.samples[b-1]).subsamples=f.subs.entries[t].subsamples}}},x.prototype.getSample=function(e,t){var r,n=e.samples[t];if(!this.moov)return null;if(n.data){if(n.alreadyRead==n.size)return n}else n.data=new Uint8Array(n.size),n.alreadyRead=0,this.samplesDataSize+=n.size,c.debug("ISOFile","Allocating sample #"+t+" on track #"+e.tkhd.track_id+" of size "+n.size+" (total: "+this.samplesDataSize+")");var i=this.stream.findPosition(!0,n.offset+n.alreadyRead,!1);if(-1<i){var a=(r=this.stream.buffers[i]).byteLength-(n.offset+n.alreadyRead-r.fileStart);return n.size-n.alreadyRead<=a?(c.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-r.fileStart)+" read size: "+(n.size-n.alreadyRead)+" full size: "+n.size+")"),u.memcpy(n.data.buffer,n.alreadyRead,r,n.offset+n.alreadyRead-r.fileStart,n.size-n.alreadyRead),r.usedBytes+=n.size-n.alreadyRead,this.stream.logBufferLevel(),n.alreadyRead=n.size,n):(c.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-r.fileStart)+" read size: "+a+" full size: "+n.size+")"),u.memcpy(n.data.buffer,n.alreadyRead,r,n.offset+n.alreadyRead-r.fileStart,a),n.alreadyRead+=a,r.usedBytes+=a,this.stream.logBufferLevel(),null)}return null},x.prototype.releaseSample=function(e,t){var r=e.samples[t];return this.stream.cleanBufferRange(r.offset,r.offset+r.size),r.data?(this.samplesDataSize-=r.size,r.data=null,r.alreadyRead=0,r.size):0},x.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},x.prototype.getCodecs=function(){var e,t="";for(e=0;e<this.moov.traks.length;e++){0<e&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},x.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t<this.moov.mvex.trexs.length;t++){var r=this.moov.mvex.trexs[t];if(r.track_id==e)return r}return null},x.prototype.getTrackById=function(e){if(void 0===this.moov)return null;for(var t=0;t<this.moov.traks.length;t++){var r=this.moov.traks[t];if(r.tkhd.track_id==e)return r}return null},x.prototype.items=[],x.prototype.itemsDataSize=0,x.prototype.flattenItemInfo=function(){var e,t,r,n=this.items,i=this.meta;if(null!=i&&void 0!==i.hdlr&&void 0!==i.iinf){for(e=0;e<i.iinf.item_infos.length;e++)(r={}).id=i.iinf.item_infos[e].item_ID,(n[r.id]=r).ref_to=[],r.name=i.iinf.item_infos[e].item_name,0<i.iinf.item_infos[e].protection_index&&(r.protection=i.ipro.protections[i.iinf.item_infos[e].protection_index-1]),i.iinf.item_infos[e].item_type?r.type=i.iinf.item_infos[e].item_type:r.type="mime",r.content_type=i.iinf.item_infos[e].content_type,r.content_encoding=i.iinf.item_infos[e].content_encoding;if(i.iloc)for(e=0;e<i.iloc.items.length;e++){var a=i.iloc.items[e];switch(r=n[a.item_ID],0!==a.data_reference_index&&(c.warn("Item storage with reference to other files: not supported"),r.source=i.dinf.boxes[a.data_reference_index-1]),a.construction_method){case 0:break;case 1:case 2:c.warn("Item storage with construction_method : not supported")}for(r.extents=[],t=r.size=0;t<a.extents.length;t++)r.extents[t]={},r.extents[t].offset=a.extents[t].extent_offset+a.base_offset,r.extents[t].length=a.extents[t].extent_length,r.extents[t].alreadyRead=0,r.size+=r.extents[t].length}if(i.pitm&&(n[i.pitm.item_id].primary=!0),i.iref)for(e=0;e<i.iref.references.length;e++){var o=i.iref.references[e];for(t=0;t<o.references.length;t++)n[o.from_item_ID].ref_to.push({type:o.type,id:o.references[t]})}if(i.iprp)for(var s=0;s<i.iprp.ipmas.length;s++){var l=i.iprp.ipmas[s];for(e=0;e<l.associations.length;e++){var u=l.associations[e];for(void 0===(r=n[u.id]).properties&&(r.properties={},r.properties.boxes=[]),t=0;t<u.props.length;t++){var f=u.props[t];if(0<f.property_index){var d=i.iprp.ipco.boxes[f.property_index-1];r.properties[d.type]=d,r.properties.boxes.push(d)}}}}}},x.prototype.getItem=function(e){var t,r;if(!this.meta)return null;if(!(r=this.items[e]).data&&r.size)r.data=new Uint8Array(r.size),r.alreadyRead=0,this.itemsDataSize+=r.size,c.debug("ISOFile","Allocating item #"+e+" of size "+r.size+" (total: "+this.itemsDataSize+")");else if(r.alreadyRead===r.size)return r;for(var n=0;n<r.extents.length;n++){var i=r.extents[n];if(i.alreadyRead!==i.length){var a=this.stream.findPosition(!0,i.offset+i.alreadyRead,!1);if(!(-1<a))return null;var o=(t=this.stream.buffers[a]).byteLength-(i.offset+i.alreadyRead-t.fileStart);if(!(i.length-i.alreadyRead<=o))return c.debug("ISOFile","Getting item #"+e+" extent #"+n+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+i.length+" full item size: "+r.size+")"),u.memcpy(r.data.buffer,r.alreadyRead,t,i.offset+i.alreadyRead-t.fileStart,o),i.alreadyRead+=o,r.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;c.debug("ISOFile","Getting item #"+e+" extent #"+n+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-t.fileStart)+" read size: "+(i.length-i.alreadyRead)+" full extent size: "+i.length+" full item size: "+r.size+")"),u.memcpy(r.data.buffer,r.alreadyRead,t,i.offset+i.alreadyRead-t.fileStart,i.length-i.alreadyRead),t.usedBytes+=i.length-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.length,r.alreadyRead+=i.length}}return r.alreadyRead===r.size?r:null},x.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null;for(var r=t.alreadyRead=0;r<t.extents.length;r++){t.extents[r].alreadyRead=0}return t.size}return 0},x.prototype.processItems=function(e){for(var t in this.items){var r=this.items[t];this.getItem(r.id),e&&!r.sent&&(e(r),r.sent=!0,r.data=null)}},x.prototype.hasItem=function(e){for(var t in this.items){var r=this.items[t];if(r.name===e)return r.id}return-1},x.prototype.getMetaHandler=function(){return this.meta?this.meta.hdlr.handler:null},x.prototype.getPrimaryItem=function(){return this.meta&&this.meta.pitm?this.getItem(this.meta.pitm.item_id):null},x.prototype.write=function(e){for(var t=0;t<this.boxes.length;t++)this.boxes[t].write(e)},x.prototype.createFragment=function(e,t,r){var n=this.getTrackById(e),i=this.getSample(n,t);if(null==i)return i=n.samples[t],this.nextSeekPosition?this.nextSeekPosition=Math.min(i.offset+i.alreadyRead,this.nextSeekPosition):this.nextSeekPosition=n.samples[t].offset+i.alreadyRead,null;var a=r||new u;a.endianness=u.BIG_ENDIAN;var o=x.createSingleSampleMoof(i);o.write(a),o.trafs[0].truns[0].data_offset=o.size+8,c.debug("MP4Box","Adjusting data_offset with new value "+o.trafs[0].truns[0].data_offset),a.adjustUint32(o.trafs[0].truns[0].data_offset_position,o.trafs[0].truns[0].data_offset);var s=new S.mdatBox;return s.data=i.data,s.write(a),this.releaseSample(n,t),a},x.writeInitializationSegment=function(e,t,r,n){var i;c.debug("ISOFile","Generating initialization segment");var a=new u;a.endianness=u.BIG_ENDIAN,e.write(a);var o=t.add("mvex");for(r&&o.add("mehd").set("fragment_duration",r),i=0;i<t.traks.length;i++)o.add("trex").set("track_id",t.traks[i].tkhd.track_id).set("default_sample_description_index",1).set("default_sample_duration",n).set("default_sample_size",0).set("default_sample_flags",65536);return t.write(a),a.buffer},x.prototype.save=function(e){var t=new u;t.endianness=u.BIG_ENDIAN,this.write(t),t.save(e)},x.prototype.getBuffer=function(){var e=new u;return e.endianness=u.BIG_ENDIAN,this.write(e),e.buffer},x.prototype.initializeSegmentation=function(){var e,t,r,n;for(null===this.onSegment&&c.warn("MP4Box","No segmentation callback set!"),this.isFragmentationInitialized||(this.isFragmentationInitialized=!0,this.nextMoofNumber=0,this.resetTables()),t=[],e=0;e<this.fragmentedTracks.length;e++){var i=new S.moovBox;i.mvhd=this.moov.mvhd,i.boxes.push(i.mvhd),r=this.getTrackById(this.fragmentedTracks[e].id),i.boxes.push(r),i.traks.push(r),(n={}).id=r.tkhd.track_id,n.user=this.fragmentedTracks[e].user,n.buffer=x.writeInitializationSegment(this.ftyp,i,this.moov.mvex&&this.moov.mvex.mehd?this.moov.mvex.mehd.fragment_duration:void 0,0<this.moov.traks[e].samples.length?this.moov.traks[e].samples[0].duration:0),t.push(n)}return t},S.Box.prototype.printHeader=function(e){this.size+=8,this.size>a&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},S.FullBox.prototype.printHeader=function(e){this.size+=4,S.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},S.Box.prototype.print=function(e){this.printHeader(e)},S.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t<this.boxes.length;t++)if(this.boxes[t]){var r=e.indent;e.indent+=" ",this.boxes[t].print(e),e.indent=r}},x.prototype.print=function(e){e.indent="";for(var t=0;t<this.boxes.length;t++)this.boxes[t]&&this.boxes[t].print(e)},S.mvhdBox.prototype.print=function(e){S.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"timescale: "+this.timescale),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"rate: "+this.rate),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},S.tkhdBox.prototype.print=function(e){S.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var d={createFile:function(e,t){var r=void 0===e||e,n=new x(t);return n.discardMdatData=!r,n}};t.createFile=d.createFile}(_a={exports:{}},_a.exports),_a.exports);Ea.Log,Ea.MP4BoxStream,Ea.DataStream,Ea.MultiBufferStream,Ea.MPEG4DescriptorParser,Ea.BoxParser,Ea.XMLSubtitlein4Parser,Ea.Textin4Parser,Ea.ISOFile,Ea.createFile;(Sa=ba||(ba={})).INIT_SEGMENT="muxer:init_segment",Sa.SEGMENT="muxer:segment",Sa.DURATION_UPDATE="muxer:duration_update",Sa.SEEK="muxer:seek",Sa.ENDED="muxer:ended";var wa,Ta=function(t){function e(e){var o=t.call(this)||this;return o.lastBufferData=new Uint8Array(0),o.keyBoxSize=0,o.appendBuffer=function(e,t,r){if(0!==t.length){e=e-o.keyBoxSize-o.lastBufferData.length;var n=0<o.lastBufferData.length?new Uint8Array(t.length+o.lastBufferData.length):t;if(0<o.lastBufferData.length&&(n.set(o.lastBufferData,0),n.set(t,o.lastBufferData.length),o.lastBufferData=new Uint8Array(0)),o.fileKey&&o.compKey||0!==(n=o.processDRMKeyBox(n)).length){var i=n.buffer;o.mp4File||o.createMp4File(),i.fileStart=e,o.mp4File.appendBuffer(i)}else o.drmMp4.destroy()}},o.flushBuffer=function(){o.mp4File.flush(),o.emit(ba.ENDED)},o.seek=function(e){var t=o.mp4File.seek(e,!0);-1!==t.offset&&o.emit(ba.SEEK,t.offset)},o.handleMp4Ready=function(r){o.info=r,o.emit(ba.DURATION_UPDATE,r.duration/r.timescale),o.info.tracks.forEach(function(e){o.mp4File.setSegmentOptions(e.id,null,{nbSamples:500,useRap:!0})}),o.initSegment=o.mp4File.initializeSegmentation();for(var e=function(t){var e=r.tracks.find(function(e){return e.id===t.id});e||console.log("can not find init segment track info!"),o.emit(ba.INIT_SEGMENT,t.buffer,e)},t=0,n=o.initSegment;t<n.length;t++){e(n[t])}o.mp4File.onSegment=o.handleSegment,o.mp4File.start()},o.handleSegment=function(t,e,r,n){if(o.info){var i=o.info.tracks.find(function(e){return e.id===t});if(i){var a=o.decryptSegment(r);o.emit(ba.SEGMENT,a,i.video?"video":"audio")}}},o.drmMp4=e,o}return Yi(e,t),e.prototype.release=function(){},e.prototype.createMp4File=function(){this.mp4File=Ea.createFile(),this.mp4File.onReady=this.handleMp4Ready},e.prototype.decryptSegment=function(e){if(!this.fileKey)return e;for(var t=new Uint8Array(e),r=new Uint8Array(t.length),n=0;n<t.length;){var i=ha(t,n);if("mdat"!==i.type)r.set(t.slice(n,n+i.size),n),n+=i.size;else{var a=t.slice(n,n+i.headerSize),o=t.slice(n+i.headerSize,n+i.size);r.set(a,n);for(var s=0;s<o.length;s+=1){for(var l=o[s],u=0;u<this.fileKey.length;u+=1)l^=this.fileKey[u]+(this.fileKey.length-u);o[s]=l}r.set(o,n+i.headerSize),n+=i.size}}return r.buffer},e.prototype.processDRMKeyBox=function(e){for(var t=new Uint8Array(e.length),r=0,n=0;r<e.length;){var i=e.length-r;if(i<8){this.lastBufferData=e.slice(r,e.length);break}var a=ha(e,r);if(i<a.size){this.lastBufferData=e.slice(r,e.length);break}if("cpky"===a.type){this.keyBoxSize+=a.size,this.compKey=e.slice(r+8,r+a.size);for(var o=0;o<this.compKey.length;o++)this.compKey[o]=this.compKey[o]-(this.compKey.length-o);if(!ma(this.compKey,this.drmMp4.config.compKey))return ya(this.drmMp4,ra.KEY,"company key is error"),new Uint8Array(0)}else if("flky"===a.type)this.keyBoxSize+=a.size,this.fileKey=e.slice(r+8,r+a.size);else{var s=e.slice(r,r+a.size);t.set(s,n),n+=s.length}r+=a.size}return t.slice(0,n)},e}($i);(wa||(wa={})).BUFFER_IO_STATE_CHANGE="buffer:io_state_change";var Aa,xa,La=function(r){function e(e,t){var a=r.call(this)||this;return a.pendingInitSegments={},a.pendingSegmants={audio:[],video:[]},a.pendingRemoveRanges={audio:[],video:[]},a.sourceBuffers={},a.duration=1/0,a.updateDurationFlag=!1,a.endFlag=!1,a.isFirstSourceOpen=!0,a._bufferIoState=ea.NEED_BUFFER,a.endStreamDuration=1/0,a.updateDuration=function(e){a.duration=e,"open"!==a.mediaSource.readyState?a.updateDurationFlag=!0:a.mediaSource.duration=e},a.appendInitSegment=function(e,t){var r=t.video?"video":"audio";if("open"!==a.mediaSource.readyState)return a.pendingInitSegments[r]={segment:e,info:t},void a.pendingSegmants[r].push(e);a.createSourceBuffer(t),a.appendSegment(e,r)},a.appendSegment=function(e,t){var r=a.sourceBuffers[t];a.pendingSegmants[t].push(e),r&&!r.updating&&a.doAppend(t)},a.seek=function(){},a.endStream=function(){if(a.endFlag=!0,"open"===a.mediaSource.readyState&&!(a.sourceBuffers.audio&&a.sourceBuffers.audio.updating||a.sourceBuffers.video&&a.sourceBuffers.video.updating||0!==a.pendingSegmants.audio.length||0!==a.pendingSegmants.video.length)){a.endStreamDuration=function(e){for(var t=0,r=0;r<e.length;r+=1)e.end(r)>t&&(t=e.end(r));return t}(a.drmMp4.video.buffered);try{a.mediaSource.endOfStream()}catch(e){ya(a.drmMp4,ra.MEDIA,"can not end of stream"+e.toString())}}},a.handleSourceOpen=function(){if(a.endFlag=!1,a.updateDurationFlag&&(a.mediaSource.duration=a.duration,a.updateDurationFlag=!1),a.isFirstSourceOpen){a.isFirstSourceOpen=!1,a.pendingInitSegments.audio&&(a.createSourceBuffer(a.pendingInitSegments.audio.info),a.appendSegment(a.pendingInitSegments.audio.segment,"audio")),a.pendingInitSegments.video&&(a.createSourceBuffer(a.pendingInitSegments.video.info),a.appendSegment(a.pendingInitSegments.video.segment,"video"));for(var e=0,t=a.pendingSegmants.audio;e<t.length;e++){var r=t[e];a.appendSegment(r,"audio")}for(var n=0,i=a.pendingSegmants.video;n<i.length;n++){r=i[n];a.appendSegment(r,"video")}}},a.handleAudioBufferUpdateEnd=function(){0<a.pendingRemoveRanges.audio.length?a.doRemove("audio"):0<a.pendingSegmants.audio.length&&a.sourceBuffers.audio?a.doAppend("audio"):a.endFlag?a.endStream():pa(a.drmMp4.video.buffered,a.endStreamDuration)&&a.endStream()},a.handleVideoBufferUpdateEnd=function(){0<a.pendingRemoveRanges.video.length?a.doRemove("video"):0<a.pendingSegmants.video.length?a.doAppend("video"):a.endFlag?a.endStream():pa(a.drmMp4.video.buffered,a.endStreamDuration)&&a.endStream()},a.handleTimeUpdate=function(e){var t=a.checkBufferIsNeedClean();t&&a.sourceBuffers.audio&&!a.sourceBuffers.audio.updating&&a.doRemove("audio"),t&&a.sourceBuffers.video&&!a.sourceBuffers.video.updating&&a.doRemove("video")},a.video=e,a.drmMp4=t,a.mediaSource=new MediaSource,a.video.src=URL.createObjectURL(a.mediaSource),a.mediaSource.addEventListener("sourceopen",a.handleSourceOpen),a}return Yi(e,r),Object.defineProperty(e.prototype,"bufferIoState",{get:function(){return this._bufferIoState},set:function(e){e!==this._bufferIoState&&(this._bufferIoState=e,this.emit(wa.BUFFER_IO_STATE_CHANGE,this._bufferIoState))},enumerable:!0,configurable:!0}),e.prototype.createSourceBuffer=function(e){var t=e.video?"video":"audio";try{var r=this.mediaSource.addSourceBuffer(t+"/mp4;codecs="+e.codec);"audio"===t?r.addEventListener("updateend",this.handleAudioBufferUpdateEnd):r.addEventListener("updateend",this.handleVideoBufferUpdateEnd),"video"===t?this.sourceBuffers.video=r:this.sourceBuffers.audio=r}catch(e){ya(this.drmMp4,ra.MEDIA,"can not create source buffer"+e.toString())}},e.prototype.release=function(){this.pendingSegmants={audio:[],video:[]},this.pendingRemoveRanges={audio:[],video:[]};try{this.sourceBuffers.audio&&this.sourceBuffers.audio.abort(),this.sourceBuffers.video&&this.sourceBuffers.video.abort()}catch(e){}},e.prototype.doAppend=function(e){var t=this.pendingSegmants[e].shift();if(t){var r=this.sourceBuffers[e];if(r){if(r.updating)return console.warn("source buffer is in updating!"),void this.pendingSegmants[e].push(t);try{r.appendBuffer(t)}catch(e){ya(this.drmMp4,ra.MEDIA,"can not append buffer"+e.toString())}this.checkBufferIsNeedClean()&&!r.updating&&this.doRemove(e)}else console.warn("no target source buffer!")}},e.prototype.doRemove=function(e){var t=this.pendingRemoveRanges[e].shift();if(t){var r=this.sourceBuffers[e];if(r)if(r.updating)console.warn("can not remove, sb is updating");else try{r.remove(t.start,t.end)}catch(e){ya(this.drmMp4,ra.MEDIA,"can not remove buffer"+e.toString())}}},e.prototype.checkBufferIsNeedClean=function(){var e=this.drmMp4.video.currentTime,t=this.drmMp4.config.maxBufferTime,r=this.drmMp4.video.buffered,n=!1;if(function(e){for(var t=0,r=0;r<e.length;r+=1)t+=e.end(r)-e.start(r);return t}(r)<t)return this.bufferIoState=ea.NEED_BUFFER,n;for(var i=!1,a=0;a<r.length;a+=1){var o=r.start(a),s=r.end(a);o<=e&&e<=s?(i=!0,.2*t<=e-o&&(n=!0,this.sourceBuffers.audio&&(this.pendingRemoveRanges.audio=ga(this.pendingRemoveRanges.audio,{start:o,end:o+(e-o-.2*t)})),this.sourceBuffers.video&&(this.pendingRemoveRanges.video=ga(this.pendingRemoveRanges.video,{start:o,end:o+(e-o-.2*t)}))),.7*t<=s-e&&(this.bufferIoState=ea.BUFFER_IS_ENOUGH),s-e<=.5*t&&(this.bufferIoState=ea.NEED_BUFFER)):(n=!0,this.sourceBuffers.audio&&(this.pendingRemoveRanges.audio=ga(this.pendingRemoveRanges.audio,{start:o,end:s})),this.sourceBuffers.video&&(this.pendingRemoveRanges.video=ga(this.pendingRemoveRanges.video,{start:o,end:s})))}return i||(this.bufferIoState=ea.NEED_BUFFER),n},e}($i);(xa=Aa||(Aa={})).SEEK="media:seek",xa.TIMEUPDATE="media:timeupdate",xa.PRELOAD="media:preload";var Ra=function(t){function e(e){var r=t.call(this)||this;return r.handleMediaEvents=function(e){switch(e.type){case"seeking":if(r.lastCurrentTime&&r.lastCurrentTime===r.media.currentTime)return;var t=function(e,t,r){for(var n=0;n<e.length;n+=1)if(r>=e.start(n)&&r<=e.end(n)){if(e.end(n)===t)return;return e.end(n)}return r}(r.media.buffered,r.media.duration,r.media.currentTime);t===r.media.currentTime?(r.lastCurrentTime=r.media.currentTime,r.emit(Aa.SEEK,r.media.currentTime)):void 0!==t&&(r.nextUnbufferedTime=t);break;case"timeupdate":r.emit(Aa.TIMEUPDATE,r.media.currentTime)}},r.media=e,r.bindMediaEvents(),r}return Yi(e,t),e.prototype.release=function(){this.media.removeEventListener("seeking",this.handleMediaEvents),this.media.removeEventListener("timeupdate",this.handleMediaEvents)},e.prototype.bindMediaEvents=function(){this.media.addEventListener("seeking",this.handleMediaEvents),this.media.addEventListener("timeupdate",this.handleMediaEvents)},e}($i);var Ia=function(n){function e(e,t){var r=n.call(this)||this;return r.config=t,r.video=e,r}return Yi(e,n),e.isSupport=function(){return function(){try{return window.fetch&&window.ReadableStream}catch(e){return!1}}()&&MediaSource&&MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')&&("probably"===(e=document.createElement("video").canPlayType("video/mp4"))||"maybe"===e);var e},e.prototype.start=function(e){this.url=e,this.media=new Ra(this.video),this.io=new va(this),this.muxer=new Ta(this),this.buffer=new La(this.video,this),this.io.on(ia.ON_CHUNK,this.muxer.appendBuffer),this.io.on(ia.ENDED,this.muxer.flushBuffer),this.muxer.on(ba.INIT_SEGMENT,this.buffer.appendInitSegment),this.muxer.on(ba.SEGMENT,this.buffer.appendSegment),this.muxer.on(ba.DURATION_UPDATE,this.buffer.updateDuration),this.muxer.on(ba.ENDED,this.buffer.endStream),this.media.on(Aa.SEEK,this.muxer.seek),this.media.on(Aa.PRELOAD,this.muxer.seek),this.muxer.on(ba.SEEK,this.io.seek),this.media.on(Aa.TIMEUPDATE,this.buffer.handleTimeUpdate),this.media.on(Aa.SEEK,this.buffer.handleTimeUpdate),this.buffer.on(wa.BUFFER_IO_STATE_CHANGE,this.io.onBufferIoStateChange),this.io.start(this.url,{start:0,end:-1})},e.prototype.destroy=function(){this.io&&(this.io.removeAllListeners(),this.io.release()),this.muxer&&(this.muxer.removeAllListeners(),this.muxer.release()),this.media&&(this.media.removeAllListeners(),this.media.release()),this.buffer&&(this.buffer.removeAllListeners(),this.buffer.release())},e}($i),Ca=function(n){function e(e,t){var r=n.call(this,e,t,[])||this;if(!t.DRMCompanyKey)throw new Error("no drm key!");return r.core=new Ia(r.render.video,{maxBufferTime:600,maxIoRetry:10,compKey:new Uint8Array(t.DRMCompanyKey)}),r.initEngine(),r}return t(e,n),e.isSupport=function(e){return!!(e&&e.mp4&&e.mp4.DRMCompanyKey)&&Ia.isSupport()},e.probe=function(e,t){return"video/mp4"===t},e.playConfigToEngineConfig=function(e,t){return a({url:e},t.mp4)},e.prototype.reload=function(){this.core.destroy(),this.core.start(this.config.url)},e.prototype.destroy=function(){this.core.destroy(),this.removeAllListeners()},e.prototype.initEngine=function(){var t=this;this.core.on("error",function(e){switch(e.type){case"key":return void t.emit("error",new Li(Si.MP4,wi.MP4_DRM_KEY_ERROR,"mp4 drm key is error!"))}}),this.core.start(this.config.url),this.handleRenderEvents()},e}(ji),Da=function(n){function i(e,t){var r=n.call(this,e,t,[])||this;if(!i.isSupport())throw new Li(Si.NATIVE,wi.UNSUPPORT,"not support html5 video/audio");return r.initNative(),r}return t(i,n),i.isSupport=function(){return!!document.createElement("video").canPlayType},i.probe=function(e,t,r){if(r.hls&&r.hls.DRMKey)return!1;if(r.hls&&r.hls.isG711)return!1;if(r.mp4&&r.mp4.DRMCompanyKey)return!1;if(!t)return!1;switch(document.createElement("video").canPlayType(t)){case"maybe":return qi.verbose("can't detect if "+e+" can be played"),!0;case"probably":return!0;default:return!1}},i.playConfigToEngineConfig=function(e,t){return{url:e}},i.prototype.reload=function(){var e=this.render.video.src;this.render.video.src="",this.render.video.load(),this.render.video.src=e,this.render.play()},i.prototype.destroy=function(){this.removeAllListeners()},i.prototype.initNative=function(){this.render.video.src=this.config.url,this.handleRenderEvents()},i}(ji);function Pa(e,t){return e(t={exports:{}},t.exports),t.exports}var Ua=Pa(function(e){var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)}),ka=Pa(function(e){var t=e.exports={version:"2.6.3"};"number"==typeof __e&&(__e=t)}),Oa=(ka.version,function(e){return"object"==typeof e?null!==e:"function"==typeof e}),Ma=function(e){if(!Oa(e))throw TypeError(e+" is not an object!");return e},Fa=function(e){try{return!!e()}catch(e){return!0}},Na=!Fa(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),Ba=Ua.document,za=Oa(Ba)&&Oa(Ba.createElement),ja=!Na&&!Fa(function(){return 7!=Object.defineProperty((e="div",za?Ba.createElement(e):{}),"a",{get:function(){return 7}}).a;var e}),Ga=Object.defineProperty,Ha={f:Na?Object.defineProperty:function(e,t,r){if(Ma(e),t=function(e,t){if(!Oa(e))return e;var r,n;if(t&&"function"==typeof(r=e.toString)&&!Oa(n=r.call(e)))return n;if("function"==typeof(r=e.valueOf)&&!Oa(n=r.call(e)))return n;if(!t&&"function"==typeof(r=e.toString)&&!Oa(n=r.call(e)))return n;throw TypeError("Can't convert object to primitive value")}(t,!0),Ma(r),ja)try{return Ga(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},qa=Na?function(e,t,r){return Ha.f(e,t,{enumerable:!((n=1)&n),configurable:!(2&n),writable:!(4&n),value:r});var n}:function(e,t,r){return e[t]=r,e},Va={}.hasOwnProperty,Wa=function(e,t){return Va.call(e,t)},Ya=0,Ka=Math.random(),Xa=Pa(function(e){var t,a="Symbol(".concat(void 0===(t="src")?"":t,")_",(++Ya+Ka).toString(36)),r="toString",n=Function[r],o=(""+n).split(r);ka.inspectSource=function(e){return n.call(e)},(e.exports=function(e,t,r,n){var i="function"==typeof r;i&&(Wa(r,"name")||qa(r,"name",t)),e[t]!==r&&(i&&(Wa(r,a)||qa(r,a,e[t]?""+e[t]:o.join(String(t)))),e===Ua?e[t]=r:n?e[t]?e[t]=r:qa(e,t,r):(delete e[t],qa(e,t,r)))})(Function.prototype,r,function(){return"function"==typeof this&&this[a]||n.call(this)})}),Za=function(n,i,e){if(function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!")}(n),void 0===i)return n;switch(e){case 1:return function(e){return n.call(i,e)};case 2:return function(e,t){return n.call(i,e,t)};case 3:return function(e,t,r){return n.call(i,e,t,r)}}return function(){return n.apply(i,arguments)}},Qa="prototype",Ja=function(e,t,r){var n,i,a,o,s=e&Ja.F,l=e&Ja.G,u=e&Ja.S,f=e&Ja.P,d=e&Ja.B,c=l?Ua:u?Ua[t]||(Ua[t]={}):(Ua[t]||{})[Qa],h=l?ka:ka[t]||(ka[t]={}),p=h[Qa]||(h[Qa]={});for(n in l&&(r=t),r)a=((i=!s&&c&&void 0!==c[n])?c:r)[n],o=d&&i?Za(a,Ua):f&&"function"==typeof a?Za(Function.call,a):a,c&&Xa(c,n,a,e&Ja.U),h[n]!=a&&qa(h,n,o),f&&p[n]!=a&&(p[n]=a)};Ua.core=ka,Ja.F=1,Ja.G=2,Ja.S=4,Ja.P=8,Ja.B=16,Ja.W=32,Ja.U=64,Ja.R=128;var $a=Ja,eo=Math.ceil,to=Math.floor,ro=function(e){return isNaN(e=+e)?0:(0<e?to:eo)(e)},no=Math.min,io=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},ao=function(e,t,r,n){var i,a=String(io(e)),o=a.length,s=void 0===r?" ":String(r),l=0<(i=t)?no(ro(i),9007199254740991):0;if(l<=o||""==s)return a;var u=l-o,f=function(e){var t=String(io(this)),r="",n=ro(e);if(n<0||n==1/0)throw RangeError("Count can't be negative");for(;0<n;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r}.call(s,Math.ceil(u/s.length));return f.length>u&&(f=f.slice(0,u)),n?f+a:a+f},oo=Ua.navigator,so=oo&&oo.userAgent||"";$a($a.P+$a.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(so),"String",{padStart:function(e){return ao(this,e,1<arguments.length?arguments[1]:void 0,!0)}});ka.String.padStart;var lo=function(){},uo={},fo=[],co=[];function ho(e,t){var r,n,i,a,o=co;for(a=arguments.length;2<a--;)fo.push(arguments[a]);for(t&&null!=t.children&&(fo.length||fo.push(t.children),delete t.children);fo.length;)if((n=fo.pop())&&void 0!==n.pop)for(a=n.length;a--;)fo.push(n[a]);else"boolean"==typeof n&&(n=null),(i="function"!=typeof e)&&(null==n?n="":"number"==typeof n?n=String(n):"string"!=typeof n&&(i=!1)),i&&r?o[o.length-1]+=n:o===co?o=[n]:o.push(n),r=i;var s=new lo;return s.nodeName=e,s.children=o,s.attributes=null==t?void 0:t,s.key=null==t?void 0:t.key,s}function po(e,t){for(var r in t)e[r]=t[r];return e}function go(e,t){null!=e&&("function"==typeof e?e(t):e.current=t)}var mo="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,yo=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,vo=[];function _o(e){!e._dirty&&(e._dirty=!0)&&1==vo.push(e)&&mo(bo)}function bo(){for(var e;e=vo.pop();)e._dirty&&Bo(e)}function So(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function Eo(e){var t=po({},e.attributes);t.children=e.children;var r=e.nodeName.defaultProps;if(void 0!==r)for(var n in r)void 0===t[n]&&(t[n]=r[n]);return t}function wo(e){var t=e.parentNode;t&&t.removeChild(e)}function To(e,t,r,n,i){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)go(r,null),go(n,e);else if("class"!==t||i)if("style"===t){if(n&&"string"!=typeof n&&"string"!=typeof r||(e.style.cssText=n||""),n&&"object"==typeof n){if("string"!=typeof r)for(var a in r)a in n||(e.style[a]="");for(var a in n)e.style[a]="number"==typeof n[a]&&!1===yo.test(a)?n[a]+"px":n[a]}}else if("dangerouslySetInnerHTML"===t)n&&(e.innerHTML=n.__html||"");else if("o"==t[0]&&"n"==t[1]){var o=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),n?r||e.addEventListener(t,Ao,o):e.removeEventListener(t,Ao,o),(e._listeners||(e._listeners={}))[t]=n}else if("list"!==t&&"type"!==t&&!i&&t in e){try{e[t]=null==n?"":n}catch(e){}null!=n&&!1!==n||"spellcheck"==t||e.removeAttribute(t)}else{var s=i&&t!==(t=t.replace(/^xlink:?/,""));null==n||!1===n?s?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof n&&(s?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):e.setAttribute(t,n))}else e.className=n||""}function Ao(e){return this._listeners[e.type](e)}var xo=[],Lo=0,Ro=!1,Io=!1;function Co(){for(var e;e=xo.shift();)e.componentDidMount&&e.componentDidMount()}function Do(e,t,r,n,i,a){Lo++||(Ro=null!=i&&void 0!==i.ownerSVGElement,Io=null!=e&&!("__preactattr_"in e));var o=Po(e,t,r,n,a);return i&&o.parentNode!==i&&i.appendChild(o),--Lo||(Io=!1,a||Co()),o}function Po(e,t,r,n,i){var a=e,o=Ro;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||i)?e.nodeValue!=t&&(e.nodeValue=t):(a=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(a,e),Uo(e,!0))),a.__preactattr_=!0,a;var s,l,u=t.nodeName;if("function"==typeof u)return function(e,t,r,n){var i=e&&e._component,a=i,o=e,s=i&&e._componentConstructor===t.nodeName,l=s,u=Eo(t);for(;i&&!l&&(i=i._parentComponent);)l=i.constructor===t.nodeName;i&&l&&(!n||i._component)?(No(i,u,3,r,n),e=i.base):(a&&!s&&(zo(a),e=o=null),i=Mo(t.nodeName,u,r),e&&!i.nextBase&&(i.nextBase=e,o=null),No(i,u,1,r,n),e=i.base,o&&e!==o&&(o._component=null,Uo(o,!1)));return e}(e,t,r,n);if(Ro="svg"===u||"foreignObject"!==u&&Ro,u=String(u),(!e||!So(e,u))&&(s=u,(l=Ro?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s)).normalizedNodeName=s,a=l,e)){for(;e.firstChild;)a.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(a,e),Uo(e,!0)}var f=a.firstChild,d=a.__preactattr_,c=t.children;if(null==d){d=a.__preactattr_={};for(var h=a.attributes,p=h.length;p--;)d[h[p].name]=h[p].value}return!Io&&c&&1===c.length&&"string"==typeof c[0]&&null!=f&&void 0!==f.splitText&&null==f.nextSibling?f.nodeValue!=c[0]&&(f.nodeValue=c[0]):(c&&c.length||null!=f)&&function(e,t,r,n,i){var a,o,s,l,u,f=e.childNodes,d=[],c={},h=0,p=0,g=f.length,m=0,y=t?t.length:0;if(0!==g)for(var v=0;v<g;v++){var _=f[v],b=_.__preactattr_,S=y&&b?_._component?_._component.__key:b.key:null;null!=S?(h++,c[S]=_):(b||(void 0!==_.splitText?!i||_.nodeValue.trim():i))&&(d[m++]=_)}if(0!==y)for(var v=0;v<y;v++){l=t[v],u=null;var S=l.key;if(null!=S)h&&void 0!==c[S]&&(u=c[S],c[S]=void 0,h--);else if(p<m)for(a=p;a<m;a++)if(void 0!==d[a]&&(E=o=d[a],T=i,"string"==typeof(w=l)||"number"==typeof w?void 0!==E.splitText:"string"==typeof w.nodeName?!E._componentConstructor&&So(E,w.nodeName):T||E._componentConstructor===w.nodeName)){u=o,d[a]=void 0,a===m-1&&m--,a===p&&p++;break}u=Po(u,l,r,n),s=f[v],u&&u!==e&&u!==s&&(null==s?e.appendChild(u):u===s.nextSibling?wo(s):e.insertBefore(u,s))}var E,w,T;if(h)for(var v in c)void 0!==c[v]&&Uo(c[v],!1);for(;p<=m;)void 0!==(u=d[m--])&&Uo(u,!1)}(a,c,r,n,Io||null!=d.dangerouslySetInnerHTML),function(e,t,r){var n;for(n in r)t&&null!=t[n]||null==r[n]||To(e,n,r[n],r[n]=void 0,Ro);for(n in t)"children"===n||"innerHTML"===n||n in r&&t[n]===("value"===n||"checked"===n?e[n]:r[n])||To(e,n,r[n],r[n]=t[n],Ro)}(a,t.attributes,d),Ro=o,a}function Uo(e,t){var r=e._component;r?zo(r):(null!=e.__preactattr_&&go(e.__preactattr_.ref,null),!1!==t&&null!=e.__preactattr_||wo(e),ko(e))}function ko(e){for(e=e.lastChild;e;){var t=e.previousSibling;Uo(e,!0),e=t}}var Oo=[];function Mo(e,t,r){var n,i=Oo.length;for(e.prototype&&e.prototype.render?(n=new e(t,r),jo.call(n,t,r)):((n=new jo(t,r)).constructor=e,n.render=Fo);i--;)if(Oo[i].constructor===e)return n.nextBase=Oo[i].nextBase,Oo.splice(i,1),n;return n}function Fo(e,t,r){return this.constructor(e,r)}function No(e,t,r,n,i){e._disable||(e._disable=!0,e.__ref=t.ref,e.__key=t.key,delete t.ref,delete t.key,void 0===e.constructor.getDerivedStateFromProps&&(!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,n)),n&&n!==e.context&&(e.prevContext||(e.prevContext=e.context),e.context=n),e.prevProps||(e.prevProps=e.props),e.props=t,e._disable=!1,0!==r&&(1!==r&&!1===uo.syncComponentUpdates&&e.base?_o(e):Bo(e,1,i)),go(e.__ref,e))}function Bo(e,t,r,n){if(!e._disable){var i,a,o,s=e.props,l=e.state,u=e.context,f=e.prevProps||s,d=e.prevState||l,c=e.prevContext||u,h=e.base,p=e.nextBase,g=h||p,m=e._component,y=!1,v=c;if(e.constructor.getDerivedStateFromProps&&(l=po(po({},l),e.constructor.getDerivedStateFromProps(s,l)),e.state=l),h&&(e.props=f,e.state=d,e.context=c,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(s,l,u)?y=!0:e.componentWillUpdate&&e.componentWillUpdate(s,l,u),e.props=s,e.state=l,e.context=u),e.prevProps=e.prevState=e.prevContext=e.nextBase=null,e._dirty=!1,!y){i=e.render(s,l,u),e.getChildContext&&(u=po(po({},u),e.getChildContext())),h&&e.getSnapshotBeforeUpdate&&(v=e.getSnapshotBeforeUpdate(f,d));var _,b,S=i&&i.nodeName;if("function"==typeof S){var E=Eo(i);(a=m)&&a.constructor===S&&E.key==a.__key?No(a,E,1,u,!1):(_=a,e._component=a=Mo(S,E,u),a.nextBase=a.nextBase||p,a._parentComponent=e,No(a,E,0,u,!1),Bo(a,1,r,!0)),b=a.base}else o=g,(_=m)&&(o=e._component=null),(g||1===t)&&(o&&(o._component=null),b=Do(o,i,u,r||!h,g&&g.parentNode,!0));if(g&&b!==g&&a!==m){var w=g.parentNode;w&&b!==w&&(w.replaceChild(b,g),_||(g._component=null,Uo(g,!1)))}if(_&&zo(_),(e.base=b)&&!n){for(var T=e,A=e;A=A._parentComponent;)(T=A).base=b;b._component=T,b._componentConstructor=T.constructor}}for(!h||r?xo.push(e):y||e.componentDidUpdate&&e.componentDidUpdate(f,d,v);e._renderCallbacks.length;)e._renderCallbacks.pop().call(e);Lo||n||Co()}}function zo(e){var t=e.base;e._disable=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var r=e._component;r?zo(r):t&&(null!=t.__preactattr_&&go(t.__preactattr_.ref,null),wo(e.nextBase=t),Oo.push(e),ko(t)),go(e.__ref,null)}function jo(e,t){this._dirty=!0,this.context=t,this.props=e,this.state=this.state||{},this._renderCallbacks=[]}function Go(e,t,r){return Do(r,e,{},!1,t,!1)}po(jo.prototype,{setState:function(e,t){this.prevState||(this.prevState=this.state),this.state=po(po({},this.state),"function"==typeof e?e(this.state,this.props):e),t&&this._renderCallbacks.push(t),_o(this)},forceUpdate:function(e){e&&this._renderCallbacks.push(e),Bo(this,2)},render:function(){}});var Ho=function(e,t){return(Ho=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function qo(e,t){function r(){this.constructor=e}Ho(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Vo=Pa(function(e){!function(){var o={}.hasOwnProperty;function s(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var n=typeof r;if("string"===n||"number"===n)e.push(r);else if(Array.isArray(r)&&r.length){var i=s.apply(null,r);i&&e.push(i)}else if("object"===n)for(var a in r)o.call(r,a)&&r[a]&&e.push(a)}}return e.join(" ")}e.exports?(s.default=s,e.exports=s):window.classNames=s}()});function Wo(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===r&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}Wo(".qplayer, .qplayer * {\n box-sizing: border-box;\n -webkit-tap-highlight-color: transparent;\n margin: 0;\n padding: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.qplayer button {\n background: none;\n border: none;\n outline: none;\n border-radius: 0;\n }\n\n.qplayer, .qplayer-wrapper, .qplayer-video {\n width: 100%;\n height: 100%;\n}\n\n.qplayer {\n position: relative;\n}\n\n.qplayer-wrapper {\n position: absolute;\n cursor: pointer;\n top: 0;\n z-index: 2;\n background: #000;\n left: 0;\n}\n\n.qplayer-error {\n width: 100%;\n height: 100%;\n position: absolute;\n flex-direction: column;\n justify-content: center;\n background: #000;\n display: none\n}\n\n.qplayer-error.qplayer-active {\n display: flex;\n }\n\n.qplayer-error-title {\n color: #ff0000;\n font-size: 18px;\n text-align: center;\n margin-bottom: 10px;\n}\n\n.qplayer-error-content {\n color: rgba(255, 255, 255, .6);\n text-align: center;\n font-size: 14px;\n}\n\n.qplayer-loading {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(255, 255, 255, .4);\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0;\n z-index: -1;\n transition: opacity ease 0.2s\n}\n\n.qplayer-loading.qplayer-active {\n opacity: 1;\n z-index: 1;\n }\n\n.qplayer-controlswrapper {\n width: 100%;\n height: 100%;\n overflow: hidden;\n position: absolute;\n bottom: 0;\n left: 0;\n z-index: 2;\n}\n\n.qplayer-controls {\n width: 100%;\n height: 40px;\n position: absolute;\n bottom: 0;\n background: rgba(0, 0, 0, .5);\n transition: opacity ease 0.1s, -webkit-transform ease 0.2s;\n transition: transform ease 0.2s, opacity ease 0.1s;\n transition: transform ease 0.2s, opacity ease 0.1s, -webkit-transform ease 0.2s;\n -webkit-transform: translateY(38px);\n transform: translateY(38px);\n pointer-events: none\n}\n\n.qplayer-controls.qplayer-active {\n pointer-events: auto;\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n\n.qplayer-center-btn {\n position: absolute;\n width: 80px;\n height: 80px;\n left: calc(50% - 40px);\n top: calc(50% - 40px);\n background: rgba(0, 0, 0, .5) !important;\n border-radius: 50% !important;\n opacity: 0;\n pointer-events: none;\n transition: opacity ease 0.2s;\n cursor: pointer;\n z-index: 3\n}\n\n.qplayer-center-btn.qplayer-active {\n opacity: 1;\n pointer-events: auto;\n }\n\n.qplayer-center-btn img {\n position: absolute;\n left: calc(50% - 15px);\n top: calc(50% - 15px);\n width: 30px;\n height: 30px;\n }\n\n.qplayer-gesture-wrapper {\n width: 100%;\n height: calc(100% - 40px);\n position: absolute;\n top: 0;\n left: 0;\n\n}\n\n.qplayer-gesture-tips {\n width: 150px;\n height: 80px;\n border-radius: 4px;\n background: rgba(0, 0, 0, .5);\n position: absolute;\n left: calc(50% - 75px);\n top: calc(50% - 50px);\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n align-items: center;\n padding: 10px;\n}\n\n.qplayer-gesture-volume-wrapper {\n width: 120px;\n height: 6px;\n border-radius: 6px;\n background: rgba(255, 255, 255, .4);\n overflow: hidden;\n}\n\n.qplayer-gesture-volume-current {\n height: 100%;\n background: #fff;\n border-radius: 6px;\n}\n\n.qplayer-gesture-seek-text {\n color: #fff;\n font-size: 26px;\n}\n\n.qplayer-gesture-seek-text span {\n margin: 0 2px;\n font-size: 20px;\n color: rgba(255, 255, 255, .6);\n }\n\n.qplayer-playbtn {\n position: relative;\n width: 30px;\n height: 30px;\n cursor: pointer;\n}\n\n.qplayer-play, .qplayer-pause {\n position: absolute !important;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n opacity: 0;\n pointer-events: none;\n display: flex;\n align-items: center;\n justify-content: center;\n display: none;\n transition: opacity ease 0.2s\n}\n\n.qplayer-play.qplayer-active, .qplayer-pause.qplayer-active {\n pointer-events: auto;\n opacity: 1;\n display: block;\n }\n\n.qplayer-time {\n color: rgba(255, 255, 255, .78);\n font-size: 13px;\n width: 44px;\n text-align: center;\n}\n\n.qplayer-fullscreen {\n display: flex;\n width: 24px;\n height: 24px;\n align-items: center;\n}\n\n.qplayer-controlbtns {\n padding: 8px 12px 0px 12px;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n}\n\n.qplayer-controlbtns img {\n width: 100%;\n height: 100%;\n }\n\n.qplayer-blank {\n flex: 1;\n}\n\n.qplayer-volume {\n position: absolute;\n bottom: 0;\n z-index: 2\n}\n\n.qplayer-volume:hover .qplayer-sidewrapper {\n opacity: 1;\n pointer-events: auto;\n z-index: 3;\n height: 120px;\n margin-bottom: 10px;\n }\n\n.qplayer-volumewrapper {\n height: 100%;\n width: 24px;\n margin-right: 15px;\n position: relative;\n}\n\n.qplayer-sidewrapper {\n opacity: 0;\n height: 0;\n pointer-events: none;\n z-index: -1;\n transition: opacity ease 0.3s;\n width: 30px;\n border-radius: 4px;\n overflow: hidden;\n}\n\n.qplayer-volume_side {\n justify-content: space-around;\n display: flex;\n flex-direction: column;\n align-items: center;\n color: #fff;\n font-size: 13px;\n background: rgba(0, 0, 0, .7);\n padding: 5px;\n height: 120px;\n}\n\n.qplayer-volumebtn {\n width: 30px;\n height: 20px;\n margin-bottom: 6px;\n}\n\n.qplayer-settings-btn {\n margin-right: 10px;\n height: 20px;\n}\n\n\n.qplayer-controller-slot {\n margin-right: 10px;\n}\n\n\n.qplayer-controller-slot button {\n color: #fff;\n cursor: pointer;\n }\n");Wo("button[data-balloon] {\n overflow: visible; }\n\n[data-balloon] {\n position: relative;\n cursor: pointer; }\n [data-balloon]:after {\n filter: alpha(opacity=0);\n -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n -moz-opacity: 0;\n -khtml-opacity: 0;\n opacity: 0;\n pointer-events: none;\n transition: all 0.1s ease-out 0.1s;\n font-family: sans-serif !important;\n font-weight: normal !important;\n font-style: normal !important;\n text-shadow: none !important;\n font-size: 12px !important;\n background: rgba(17, 17, 17, 0.9);\n border-radius: 4px;\n color: #fff;\n content: attr(data-balloon);\n padding: .5em 1em;\n position: absolute;\n white-space: nowrap;\n z-index: 1; }\n [data-balloon]:before {\n background: no-repeat url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http://www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba(17, 17, 17, 0.9)%22%20transform%3D%22rotate(0)%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E\");\n background-size: 100% auto;\n width: 18px;\n height: 6px;\n filter: alpha(opacity=0);\n -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n -moz-opacity: 0;\n -khtml-opacity: 0;\n opacity: 0;\n pointer-events: none;\n transition: all 0.1s ease-out 0.1s;\n content: '';\n position: absolute;\n z-index: 1; }\n [data-balloon]:hover:before, [data-balloon]:hover:after, [data-balloon][data-balloon-visible]:before, [data-balloon][data-balloon-visible]:after {\n filter: alpha(opacity=100);\n -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)\";\n -moz-opacity: 1;\n -khtml-opacity: 1;\n opacity: 1;\n pointer-events: auto; }\n [data-balloon].font-awesome:after {\n font-family: FontAwesome; }\n [data-balloon][data-balloon-break]:after {\n white-space: pre; }\n [data-balloon][data-balloon-blunt]:before, [data-balloon][data-balloon-blunt]:after {\n transition: none; }\n [data-balloon]:after {\n bottom: 100%;\n left: 50%;\n margin-bottom: 11px;\n -webkit-transform: translate(-50%, 10px);\n transform: translate(-50%, 10px);\n -webkit-transform-origin: top;\n transform-origin: top; }\n [data-balloon]:before {\n bottom: 100%;\n left: 50%;\n margin-bottom: 5px;\n -webkit-transform: translate(-50%, 10px);\n transform: translate(-50%, 10px);\n -webkit-transform-origin: top;\n transform-origin: top; }\n [data-balloon]:hover:after, [data-balloon][data-balloon-visible]:after {\n -webkit-transform: translate(-50%, 0);\n transform: translate(-50%, 0); }\n [data-balloon]:hover:before, [data-balloon][data-balloon-visible]:before {\n -webkit-transform: translate(-50%, 0);\n transform: translate(-50%, 0); }\n [data-balloon][data-balloon-length='small']:after {\n white-space: normal;\n width: 80px; }\n [data-balloon][data-balloon-length='medium']:after {\n white-space: normal;\n width: 150px; }\n [data-balloon][data-balloon-length='fit']:after {\n white-space: normal;\n width: 100%; }\n");Wo('\n.qplayer[data-device="mobile"] [data-balloon]:after {\n display: none !important;\n }\n .qplayer[data-device="mobile"] [data-balloon]:before {\n display: none !important;\n }\n .qplayer[data-device="mobile"] .qplayer-volumewrapper {\n display: none;\n }\n .qplayer[data-device="mobile"] .qplayer-settings {\n width: 100% !important;\n height: 100% !important;\n top: 0;\n left: 0;\n background: rgba(0, 0, 0, .5);\n }\n .qplayer[data-device="mobile"] .qplayer-setting-close {\n position: absolute;\n right: 8px;\n top: 8px;\n display: block !important;\n }\n .qplayer[data-device="mobile"] .qplayer-setting-tab {\n height: 100% !important;\n background: none;\n -webkit-transform: translateX(100%) !important;\n transform: translateX(100%) !important\n }\n .qplayer[data-device="mobile"] .qplayer-setting-tab.qplayer-main-setting {\n -webkit-transform: translateX(-100%) !important;\n transform: translateX(-100%) !important;\n }\n .qplayer[data-device="mobile"] .qplayer-setting-tab.qplayer-active {\n -webkit-transform: translateX(0) !important;\n transform: translateX(0) !important;\n }\n .qplayer[data-device="mobile"] .qplayer-setting-header {\n display: block !important;\n width: 100%;\n color: #fff;\n font-size: 16px;\n padding: 8px;\n border-bottom: 1px solid #fff;\n }\n .qplayer[data-device="mobile"] .qplayer-subsetting {\n height: 100%;\n width: 100%;\n padding: 0 !important;\n display: flex;\n flex-direction: column;\n }\n .qplayer[data-device="mobile"] .qplayer-subsetting button {\n position: absolute;\n right: 8px;\n top: 8px;\n }\n .qplayer[data-device="mobile"] .qplayer-setting-list {\n flex: 1;\n overflow: auto;\n }\n .qplayer[data-device="mobile"] .qplayer-setting-listitem {\n padding: 8px !important;\n }\n');Wo(".qplayer-barwrapper {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n}\n\n.qplayer-bar{\n width: 100%;\n margin: auto;\n height: 8px;\n}\n\n.qplayer-barcurr, .qplayer-barbuff {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n}\n\n.qplayer-barbuff {\n}\n\n.qplayer-indicator {\n position: absolute;\n top: -10px;\n width: 24px;\n height: 24px;\n cursor: pointer;\n}\n\n.qplayer-timetooltip {\n width: 10px;\n height: 100%;\n position: absolute !important;\n z-index: 1;\n}\n");var Yo=function(e){function t(){var r=null!==e&&e.apply(this,arguments)||this;return r.state={buffered:void 0,timeTooltipPos:0,timeTooltipText:"0:00"},r.handleProgress=function(e){r.setState({buffered:e})},r.handleMouseUp=function(e){var t=r.getCurrentTimeFromMouseEvent(e);r.props.player.seek(t)},r.handleRef=function(e){e!==r.bar&&(r.bar=e)},r.handleHoverTooltips=function(e){if(0===r.props.totalTime)return 0;var t=r.getCurrentTimeFromMouseEvent(e);r.setState({timeTooltipText:$o(t),timeTooltipPos:100*t/r.props.totalTime})},r}return qo(t,e),t.prototype.componentDidMount=function(){this.props.player.on("progress",this.handleProgress)},t.prototype.getCurrentPersent=function(){return 0===this.props.totalTime?0:this.props.currentTime/this.props.totalTime},t.prototype.getCurrentTimeFromMouseEvent=function(e){if(!this.bar)return 0;var t=this.bar.clientWidth;return this.props.totalTime*(e.pageX-this.bar.getBoundingClientRect().left)/t},t.prototype.getBufferBars=function(){if(!this.state.buffered||0===this.props.totalTime)return[];for(var e=[],t=0;t<this.state.buffered.length;t+=1){var r=this.state.buffered.start(t),n=this.state.buffered.end(t);e.push({left:r/this.props.totalTime*100,width:(n-r)/this.props.totalTime*100})}return e},t.prototype.render=function(){var e=100*this.getCurrentPersent(),t=this.getBufferBars(),r=this.props.player.config.defaultViewConfig;return ho("div",{onClick:this.handleMouseUp,onMouseMove:this.handleHoverTooltips,ref:this.handleRef,style:"background: "+r.playerBarBackground,className:"qplayer-bar"},t.map(function(e,t){return ho("div",{className:"qplayer-barbuff",key:t,style:"background: "+r.playerBarBufferedBackground+"; width: "+e.width+"%; left: "+e.left+"%"})}),ho("div",{className:"qplayer-barcurr",style:"background: "+r.playerBarPlayedBackground+"; width: "+e+"%"}),ho("div",{style:{left:this.state.timeTooltipPos+"%"},className:"qplayer-timetooltip","data-balloon":this.state.timeTooltipText}))},t}(jo);Wo(".qplayer-volume_sliderwrapper {\n cursor: pointer;\n position: relative;\n height: 70px;\n}\n\n.qplayer-volume_slider, .qplayer-volume_slider_active {\n height: 100%;\n width: 4px;\n border-radius: 4px;\n background: rgba(255, 255, 255, .5);\n position: absolute;\n bottom: 0;\n left: calc(50% - 2px);\n}\n\n.qplayer-volume_slider_active {\n background: rgba(255, 255, 255, .9);\n height: 50%;\n}\n\n.qplayer-volume_thumb {\n width: 14px;\n height: 14px;\n border-radius: 50%;\n background: #fafafa;\n position: absolute;\n left: calc(50% - 7px);\n -webkit-transform: scale(1);\n transform: scale(1);\n transition: -webkit-transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);\n transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);\n transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), -webkit-transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);\n z-index: 3\n}\n\n.qplayer-volume_thumb:hover {\n -webkit-transform-origin: center;\n transform-origin: center;\n -webkit-transform: scale(1.3);\n transform: scale(1.3);\n }");var Ko=function(e){function t(){var r=null!==e&&e.apply(this,arguments)||this;return r.handleMouseDown=function(e){window.document.addEventListener("mousemove",r.handleMouseMove),window.document.addEventListener("mouseup",r.handleMouseUp)},r.handleMouseMove=function(e){var t=r.updateValueFromMouseEvent(e);t<0||r.props.onChange(t)},r.handleMouseUp=function(e){var t=r.updateValueFromMouseEvent(e);t<0||(r.props.onChange(t),window.document.removeEventListener("mousemove",r.handleMouseMove),window.document.removeEventListener("mouseup",r.handleMouseUp))},r.handleRef=function(e){e!==r.wrapper&&(r.wrapper=e)},r}return qo(t,e),t.prototype.updateValueFromMouseEvent=function(e){if(!this.wrapper)return-1;var t=this.wrapper.clientHeight,r=1-(e.clientY-this.wrapper.getBoundingClientRect().top)/t;return r=Math.min(r,this.props.maxValue),r=Math.max(r,this.props.minValue)},t.prototype.render=function(){return ho("div",{ref:this.handleRef,className:"qplayer-volume_sliderwrapper",onMouseDown:this.handleMouseDown},ho("div",{className:"qplayer-volume_slider"}),ho("div",{style:{bottom:"calc("+100*this.props.value+"% - 7px)"},className:"qplayer-volume_thumb"}),ho("div",{style:{height:100*this.props.value+"%"},className:"qplayer-volume_slider_active"}))},t}(jo);Wo(".qplayer-setting-wrapper {\n width: 100%;\n height: 100%;\n}\n\n.qplayer-settings {\n width: 180px;\n position: absolute;\n overflow: hidden;\n bottom: 43px;\n right: 10px;\n opacity: 0;\n z-index: 2;\n pointer-events: none;\n transition: opacity ease 0.2s\n}\n\n.qplayer-settings.qplayer-active {\n opacity: 1;\n pointer-events: auto;\n }\n\n.qplayer-settings span {\n color: #fff;\n }\n\n.qplayer-setting-close {\n display: none;\n}\n\n.qplayer-setting-tab {\n border-radius: 4px;\n width: 100%;\n background: rgba(0, 0, 0, .7);\n padding: 4px 0;\n position: absolute;\n transition: -webkit-transform ease 0.2s;\n transition: transform ease 0.2s;\n transition: transform ease 0.2s, -webkit-transform ease 0.2s;\n bottom: 0;\n left: 0;\n -webkit-transform: translateX(180px);\n transform: translateX(180px)\n}\n\n.qplayer-setting-tab.qplayer-main-setting {\n -webkit-transform: translateX(-180px);\n transform: translateX(-180px);\n }\n\n.qplayer-setting-tab.qplayer-active {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n }\n\n.qplayer-setting-header {\n display: none;\n}\n\n.qplayer-setting-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px;\n cursor: pointer;\n transition: ease background 0.2s\n}\n\n.qplayer-setting-item:hover {\n background: rgba(255, 255, 255, .2);\n }\n\n.qplayer-setting-item-title {\n color: rgba(255, 255, 255, .8);\n font-size: 14px;\n\n}\n\n.qplayer-setting-item-value {\n font-size: 14px;\n font-weight: bold;\n color: #fff;\n}\n\n\n.qplayer-subsetting {\n padding: 4px;\n}\n\n\n.qplayer-subsetting button {\n margin-left: 2px;\n cursor: pointer;\n }\n\n.qplayer-setting-list {\n list-style: none;\n}\n\n.qplayer-setting-listitem {\n cursor: pointer;\n padding: 3px;\n transition: ease background 0.2s;\n font-size: 14px;\n\n}\n\n.qplayer-setting-listitem span {\n color: rgba(255, 255, 255, .7);\n }\n\n.qplayer-setting-listitem:hover {\n background: rgba(255, 255, 255, .2);\n }\n\n.qplayer-setting-listitem .qplayer-active {\n color: #fff;\n font-weight: bold;\n }\n");var Xo,Zo,Qo=function(r){function e(e){var t=r.call(this,e)||this;return t.handleChangeLoop=function(e){t.props.player.isLoop!==e&&(t.props.player.toggleLoop(),t.setState({isLoop:e,currentSetting:null}),t.props.onClose())},t.state={currentQuality:null,isAutoQualitySwitch:!1,isSupportAutoQualitySwitch:!1,qualityList:[],currentSpeed:1,currentSetting:null,isLoop:!1},t}return qo(e,r),e.prototype.componentDidMount=function(){var r=this;this.props.player.on("get-quality-list",function(e){var t=r.props.player.qualityController;e.length<=1||r.setState({qualityList:e,currentQuality:t.currentQuality.quality,isAutoQualitySwitch:t.currentQuality.isAuto,isSupportAutoQualitySwitch:t.isSupportAutoQualitySwitch})}),this.props.player.on("quality-switching",function(t){var e=r.props.player.qualityController.qualityList.find(function(e){return e.id===t});e&&(r.state.currentQuality===e||r.state.isAutoQualitySwitch||r.props.player.sendNotification("姝e湪鍒囨崲鍒版竻鏅板害 "+r.getQualityName(e,r.state.isAutoQualitySwitch)),r.setState({currentQuality:e}))}),this.props.player.on("quality-switched",function(t){var e=r.state.qualityList.find(function(e){return e.id===t});e&&(r.state.isAutoQualitySwitch||r.props.player.sendNotification("宸茬粡鍒囨崲鍒版竻鏅板害 "+r.getQualityName(e,r.state.isAutoQualitySwitch)))}),this.props.player.on("auto-quality-switch-change",function(e){r.setState({isAutoQualitySwitch:e})}),this.props.player.on("ratechange",function(e){r.setState({currentSpeed:e})})},e.prototype.handleChangeSpeed=function(e){this.props.player.setPlaybackRate(e),this.setState({currentSetting:null}),this.props.onClose()},e.prototype.handleChangeQuality=function(e){this.setState({currentSetting:null}),this.props.onClose();var t=this.props.player.qualityController;if("auto"===e){if(t.currentQuality.isAuto)return;t.toggleAutoQualitySwitch()}else t.switchQuality(e)},e.prototype.getQualityName=function(e,t){return t?"鑷姩锛�"+e.name+"锛�":e.name},e.prototype.render=function(){var e,t=this,r="璁剧疆";switch(this.state.currentSetting){case"speed":e=8,r="鎾斁閫熷害";break;case"quality":e=this.state.qualityList?this.state.qualityList.length+1:0,r="娓呮櫚搴�";break;case"loop":e=2,r="寰幆鎾斁";default:e=this.state.qualityList?3:2}if(this.props.player.config.isLive&&(e-=2),!e)return null;var n=this.props.player.config.defaultViewConfig;return ho("div",{style:{height:45+26*e},onMouseLeave:this.props.onClose,ref:function(e){return t.element=e},className:Vo({"qplayer-settings":!0,"qplayer-active":this.props.show})},ho("div",{className:Vo({"qplayer-setting-tab":!0,"qplayer-active":null===this.state.currentSetting,"qplayer-main-setting":!0})},ho("div",{className:"qplayer-setting-header"},r),ho("button",{type:"button",className:"qplayer-setting-close",onClick:this.props.onClose},ho("img",{src:n.closeIcon})),this.state.currentQuality&&ho("div",{onClick:function(){return t.setState({currentSetting:"quality"})},className:"qplayer-setting-item"},ho("span",{className:"qplayer-setting-item-title"},"娓呮櫚搴�"),ho("span",{className:"qplayer-setting-item-value"},this.getQualityName(this.state.currentQuality,this.state.isAutoQualitySwitch))),ho("div",{className:"qplayer-setting-item",onClick:function(){return t.setState({currentSetting:"speed"})}},ho("span",{className:"qplayer-setting-item-title"},"鎾斁閫熷害"),ho("span",{className:"qplayer-setting-item-value"},this.state.currentSpeed)),ho("div",{className:"qplayer-setting-item",onClick:function(){return t.setState({currentSetting:"loop"})}},ho("span",{className:"qplayer-setting-item-title"},"寰幆鎾斁"),ho("span",{className:"qplayer-setting-item-value"},this.state.isLoop?"鎵撳紑":"鍏抽棴"))),ho("div",{className:Vo({"qplayer-setting-tab":!0,"qplayer-active":null!==this.state.currentSetting})},this.renderSubSetting(r)))},e.prototype.renderSubSetting=function(e){var t=this,r=this.props.player.config.defaultViewConfig;switch(this.state.currentSetting){case"quality":var n=this.state.currentQuality;return ho("div",{className:"qplayer-subsetting"},ho("div",{className:"qplayer-setting-header"},e),ho("button",{type:"button",onClick:function(){return t.setState({currentSetting:null})}},ho("img",{src:r.backIcon})),ho("ul",{className:"qplayer-setting-list"},this.state.isSupportAutoQualitySwitch&&ho("li",{className:"qplayer-setting-listitem",key:"auto",onClick:function(){return t.handleChangeQuality("auto")}},ho("span",{className:this.state.isAutoQualitySwitch?"qplayer-active":void 0}," ","鑷姩锛�"+n.name+"锛�"," ")),this.state.qualityList.map(function(e){return ho("li",{className:"qplayer-setting-listitem",key:e.id,onClick:function(){return t.handleChangeQuality(e.id)}},ho("span",{className:n.id!==e.id||t.state.isAutoQualitySwitch?void 0:"qplayer-active"}," ",e.name," "))})));case"speed":return ho("div",{className:"qplayer-subsetting"},ho("div",{className:"qplayer-setting-header"},e),ho("button",{type:"button",onClick:function(){return t.setState({currentSetting:null})}},ho("img",{src:r.backIcon})),ho("ul",{className:"qplayer-setting-list"},[.25,.5,.75,1,1.25,1.5,1.75,2].map(function(e){return ho("li",{className:"qplayer-setting-listitem",key:e,onClick:function(){return t.handleChangeSpeed(e)}},ho("span",{className:t.state.currentSpeed===e?"qplayer-active":void 0}," ",e," "))})));case"loop":return ho("div",{className:"qplayer-subsetting"},ho("div",{className:"qplayer-setting-header"},e),ho("button",{type:"button",onClick:function(){return t.setState({currentSetting:null})}},ho("img",{src:r.backIcon})),ho("ul",{className:"qplayer-setting-list"},ho("li",{className:"qplayer-setting-listitem",onClick:function(){return t.handleChangeLoop(!0)}},ho("span",null,"鎵撳紑")),ho("li",{className:"qplayer-setting-listitem",onClick:function(){return t.handleChangeLoop(!1)}},ho("span",null,"鍏抽棴"))))}return null},e}(jo);(Zo=Xo||(Xo={})).VOLUME_CONTROL="volume",Zo.SEEK_CONTROL="seek";var Jo=function(t){function e(e){var s=t.call(this)||this;return s.touchStartX=0,s.touchStartY=0,s.touchStartVolume=0,s.handleFullscreenChange=function(e){s.setState({isFullscreen:e})},s.handleVolumeChange=function(e,t){console.log("volume change",e,t),s.setState({isMuted:t,volume:e})},s.handlePlay=function(){s.props.player.play()},s.handlePause=function(){s.props.player.pause()},s.handleToggleFullscreen=function(){s.props.player.toggleFullscreen()},s.handleToggleMute=function(){s.props.player.toggleMute()},s.handleToggleSettings=function(){s.setState({showSettings:!s.state.showSettings})},s.handleCloseSettings=function(){s.setState({showSettings:!1})},s.handleSetVolume=function(e){s.setState({volume:e}),s.props.player.setVolume(e)},s.handleGesture=function(e,t){var r=e.touches.item(0);switch(t){case"start":s.touchStartX=r.clientX,s.touchStartY=r.clientY;break;case"move":e.preventDefault();var n=r.clientX-s.touchStartX,i=r.clientY-s.touchStartY;if(s.touchX||s.touchY)switch(s.state.gestureType){case Xo.SEEK_CONTROL:s.setState({gestureSeekTime:.3*n});break;case Xo.VOLUME_CONTROL:var a=s.touchStartVolume-.01*i;s.setState({gestureVolume:Math.max(0,Math.min(1,a))}),s.props.player.setVolume(s.state.gestureVolume)}else if(Math.abs(n)>Math.abs(i))s.setState({gestureType:Xo.SEEK_CONTROL,gestureSeekTime:0});else{if(/iPad|iPhone|iPod/.test(navigator.userAgent))break;s.setState({gestureType:Xo.VOLUME_CONTROL,gestureVolume:s.props.player.volume}),s.touchStartVolume=s.props.player.volume}s.touchX=r.clientX,s.touchY=r.clientY;break;case"end":switch(s.touchX=void 0,s.touchY=void 0,s.state.gestureType){case Xo.SEEK_CONTROL:var o=s.props.player.currentTime+s.state.gestureSeekTime;s.props.player.seek(Math.min(s.props.player.totalTime,Math.max(0,o)))}s.setState({gestureType:void 0})}},s.state={isFullscreen:!1,showSettings:!1,isMuted:e.player.isMuted,volume:e.player.volume,showControlBtn:!e.player.config.isLive,gestureSeekTime:0,gestureVolume:0},s}return qo(e,t),e.prototype.componentDidMount=function(){var t=this;this.props.player.on("fullscreenchange",this.handleFullscreenChange),this.props.player.on("volumechange",this.handleVolumeChange),this.props.player.on("get-quality-list",function(e){1<e.length&&!t.state.showControlBtn&&t.setState({showControlBtn:!0})})},e.prototype.componentWillReceiveProps=function(e){!e.show&&this.props.show&&this.handleCloseSettings()},e.prototype.render=function(){var t=this,e=this.props.player.config.defaultViewConfig;return ho("div",{className:"qplayer-controlswrapper"},ho("button",{type:"button",onClick:this.props.showPlay?this.handlePlay:this.handlePause,className:Vo({"qplayer-center-btn":!0,"qplayer-active":this.props.show&&!this.state.showSettings})},ho("img",{src:this.props.showPlay?e.playIcon:e.pauseIcon})),ho("div",{onMouseLeave:this.props.onNotKeepControls,onMouseEnter:this.props.onKeepControls,className:Vo({"qplayer-controls":!0,"qplayer-active":this.props.show||this.state.showSettings})},!this.props.isLive&&ho("div",{className:"qplayer-barwrapper"},ho(Yo,{player:this.props.player,currentTime:this.props.currentTime,totalTime:this.props.totalTime})),ho("div",{className:"qplayer-controlbtns"},ho("div",{className:"qplayer-playbtn"},ho("button",{type:"button","data-balloon":"鎾斁",onClick:this.handlePlay,className:Vo({"qplayer-active":this.props.showPlay,"qplayer-play":!0})},ho("img",{src:e.playIcon})),ho("button",{type:"button","data-balloon":"鏆傚仠",onClick:this.handlePause,className:Vo({"qplayer-active":this.props.showPause,"qplayer-pause":!0})},ho("img",{src:e.pauseIcon}))),!this.props.isLive&&ho("p",{className:"qplayer-time"},ho("span",{className:"qplayer-currtime"},$o(this.props.currentTime)),"/",ho("span",{className:"qplayer-totaltime"},$o(this.props.totalTime))),ho("div",{className:"qplayer-blank"}),ho("div",{className:"qplayer-controller-slot"}),ho("div",{className:"qplayer-volumewrapper"},ho("div",{className:"qplayer-volume",onMouseEnter:this.handleCloseSettings},ho("div",{className:"qplayer-sidewrapper"},ho("div",{className:"qplayer-volume_side"},ho("p",{className:"qplayer-volume_value"},(100*this.state.volume).toFixed(0)),ho(Ko,{maxValue:1,minValue:0,value:this.state.volume,onChange:this.handleSetVolume}))),ho("button",{type:"button",onClick:this.handleToggleMute,className:"qplayer-volumebtn"},this.state.isMuted?ho("img",{src:e.volumeOffIcon}):ho("img",{src:e.volumeIcon})))),this.state.showControlBtn&&ho("button",{type:"button",className:"qplayer-control-btn qplayer-settings-btn",onClick:this.handleToggleSettings},ho("img",{src:e.settingsIcon})),this.props.player.fullscreenController&&ho("button",{type:"button","data-balloon":this.state.isFullscreen?"閫€鍑哄叏灞�":"鍏ㄥ睆",className:"qplayer-fullscreen",onClick:this.handleToggleFullscreen},this.state.isFullscreen?ho("img",{src:e.fullscreenExitIcon}):ho("img",{src:e.fullscreenIcon})))),this.props.isMobile&&ho("div",{onTouchStart:function(e){return t.handleGesture(e,"start")},onTouchMove:function(e){return t.handleGesture(e,"move")},onTouchEnd:function(e){return t.handleGesture(e,"end")},className:"qplayer-gesture-wrapper"},this.state.gestureType===Xo.VOLUME_CONTROL&&ho("div",{className:"qplayer-gesture-tips"},ho("img",{src:e.volumeIcon}),ho("div",{className:"qplayer-gesture-volume-wrapper"},ho("div",{className:"qplayer-gesture-volume-current",style:{width:100*this.state.gestureVolume+"%"}}))),this.state.gestureType===Xo.SEEK_CONTROL&&ho("div",{className:"qplayer-gesture-tips"},ho("p",{className:"qplayer-gesture-seek-text"},ho("span",null,this.state.gestureSeekTime<0?"-":"+"),Math.abs(this.state.gestureSeekTime).toFixed(1),ho("span",null,"s")))),ho(Qo,{show:this.state.showSettings,onClose:this.handleCloseSettings,player:this.props.player}))},e}(jo);function $o(e){if(e<=0)return"0:00";var t=Math.floor(e/60),r=Math.round(e-60*t);return t.toString()+":"+r.toString().padStart(2,"0")}Wo(".sk-fading-circle {\n position: relative;\n}\n\n.sk-fading-circle .sk-circle {\n width: 100%;\n height: 100%;\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.sk-fading-circle .sk-circle:before {\n content: '';\n display: block;\n margin: 0 auto;\n width: 15%;\n height: 15%;\n background-color: #333;\n border-radius: 100%;\n -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;\n animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;\n}\n.sk-fading-circle .sk-circle2 {\n -webkit-transform: rotate(30deg);\n transform: rotate(30deg);\n}\n.sk-fading-circle .sk-circle3 {\n -webkit-transform: rotate(60deg);\n transform: rotate(60deg);\n}\n.sk-fading-circle .sk-circle4 {\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg);\n}\n.sk-fading-circle .sk-circle5 {\n -webkit-transform: rotate(120deg);\n transform: rotate(120deg);\n}\n.sk-fading-circle .sk-circle6 {\n -webkit-transform: rotate(150deg);\n transform: rotate(150deg);\n}\n.sk-fading-circle .sk-circle7 {\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n.sk-fading-circle .sk-circle8 {\n -webkit-transform: rotate(210deg);\n transform: rotate(210deg);\n}\n.sk-fading-circle .sk-circle9 {\n -webkit-transform: rotate(240deg);\n transform: rotate(240deg);\n}\n.sk-fading-circle .sk-circle10 {\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n}\n.sk-fading-circle .sk-circle11 {\n -webkit-transform: rotate(300deg);\n transform: rotate(300deg); \n}\n.sk-fading-circle .sk-circle12 {\n -webkit-transform: rotate(330deg);\n transform: rotate(330deg); \n}\n.sk-fading-circle .sk-circle2:before {\n -webkit-animation-delay: -1.1s;\n animation-delay: -1.1s; \n}\n.sk-fading-circle .sk-circle3:before {\n -webkit-animation-delay: -1s;\n animation-delay: -1s; \n}\n.sk-fading-circle .sk-circle4:before {\n -webkit-animation-delay: -0.9s;\n animation-delay: -0.9s; \n}\n.sk-fading-circle .sk-circle5:before {\n -webkit-animation-delay: -0.8s;\n animation-delay: -0.8s; \n}\n.sk-fading-circle .sk-circle6:before {\n -webkit-animation-delay: -0.7s;\n animation-delay: -0.7s; \n}\n.sk-fading-circle .sk-circle7:before {\n -webkit-animation-delay: -0.6s;\n animation-delay: -0.6s; \n}\n.sk-fading-circle .sk-circle8:before {\n -webkit-animation-delay: -0.5s;\n animation-delay: -0.5s; \n}\n.sk-fading-circle .sk-circle9:before {\n -webkit-animation-delay: -0.4s;\n animation-delay: -0.4s;\n}\n.sk-fading-circle .sk-circle10:before {\n -webkit-animation-delay: -0.3s;\n animation-delay: -0.3s;\n}\n.sk-fading-circle .sk-circle11:before {\n -webkit-animation-delay: -0.2s;\n animation-delay: -0.2s;\n}\n.sk-fading-circle .sk-circle12:before {\n -webkit-animation-delay: -0.1s;\n animation-delay: -0.1s;\n}\n\n@-webkit-keyframes sk-circleFadeDelay {\n 0%, 39%, 100% { opacity: 0; }\n 40% { opacity: 1; }\n}\n\n@keyframes sk-circleFadeDelay {\n 0%, 39%, 100% { opacity: 0; }\n 40% { opacity: 1; } \n}");var es=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qo(t,e),t.prototype.render=function(){return ho("div",{class:"sk-fading-circle",style:{width:this.props.width||40,height:this.props.height||40,margin:this.props.margin}},ho("div",{class:"sk-circle1 sk-circle"}),ho("div",{class:"sk-circle2 sk-circle"}),ho("div",{class:"sk-circle3 sk-circle"}),ho("div",{class:"sk-circle4 sk-circle"}),ho("div",{class:"sk-circle5 sk-circle"}),ho("div",{class:"sk-circle6 sk-circle"}),ho("div",{class:"sk-circle7 sk-circle"}),ho("div",{class:"sk-circle8 sk-circle"}),ho("div",{class:"sk-circle9 sk-circle"}),ho("div",{class:"sk-circle10 sk-circle"}),ho("div",{class:"sk-circle11 sk-circle"}),ho("div",{class:"sk-circle12 sk-circle"}))},t}(jo);Wo(".qplayer-toast {\n background: rgba(0, 0, 0, .7);\n border-radius: 4px;\n padding: 8px;\n max-width: 300px;\n display: flex;\n align-items: center;\n z-index: 3;\n -webkit-transform: translateY(30px);\n transform: translateY(30px);\n opacity: 0;\n pointer-events: none;\n transition: all ease 0.2s;\n position: absolute;\n bottom: 50px;\n left: 10px\n}\n\n.qplayer-toast.qplayer-active {\n -webkit-transform: translateY(0);\n transform: translateY(0);\n opacity: 1;\n pointer-events: auto;\n }\n\n.qplayer-toast-content {\n font-size: 13px;\n color: #fff;\n word-break: break-all;\n}\n");var ts=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qo(t,e),t.prototype.render=function(){return ho("div",{className:Vo({"qplayer-toast":!0,"qplayer-active":this.props.show})},ho("p",{className:"qplayer-toast-content"},this.props.message))},t}(jo),rs=function(e){function t(){var r=null!==e&&e.apply(this,arguments)||this;return r.state={isPlay:!1,isPause:!1,isCanplay:!1,isLoading:!1,currentTime:0,totalTime:0,bufferStart:0,bufferEnd:0,showControls:!0,currentToastMessage:void 0,showToast:!1},r.isCloseControlsTimeoutCancel=!1,r.handleError=function(e){switch(r.setState({showToast:!1}),e.code){case 10001:r.setState({errorMessage:"鏃犳硶鏀寔鐨勫獟浣撴牸寮忥紝鎮ㄧ殑娴忚鍣ㄥ彲鑳戒笉鏀寔姝よ棰戞簮"});break;case 10002:r.setState({errorMessage:"鏃犳硶鍔犺浇瑙嗛婧愶紝璇锋鏌ヨ棰戝湴鍧€鍜屾偍鐨勭綉缁滈厤缃�"});break;case 10007:r.setState({errorMessage:"閰嶇疆鏍煎紡涓嶆纭�"});break;case 10006:r.props.player.sendNotification("鑷姩鎾斁澶辫触锛岃鎵嬪姩鐐瑰嚮鎾斁鎸夐挳");break;case 10008:r.setState({errorMessage:"鏈煡閿欒"})}},r.handlePlay=function(){r.setState({isPlay:!0,isPause:!1})},r.handlePause=function(){r.setState({isPause:!0,isPlay:!1})},r.handleCanplay=function(e){r.setState({isCanplay:!0,totalTime:e,showToast:!1})},r.handlePlaying=function(e,t){r.setState({currentTime:e,totalTime:t})},r.handleLoading=function(e){r.setState({isLoading:e})},r.handleNotification=function(e){r.notificationTimeout&&window.clearTimeout(r.notificationTimeout),e.message?(r.setState({currentToastMessage:e.message,showToast:!0}),e.timeout<0||(r.notificationTimeout=window.setTimeout(function(){r.notificationTimeout=void 0,r.setState({showToast:!1})},e.timeout))):r.setState({showToast:!1})},r.handleVideoRef=function(e){e!==r.video&&(r.video=e)},r.handleContainerRef=function(e){e!==r.container&&(r.container=e)},r.handleCloseControls=function(){r.closeControlsTimeout&&(window.clearTimeout(r.closeControlsTimeout),r.closeControlsTimeout=void 0),r.setState({showControls:!1})},r.handleShowControls=function(){if(r.setState({showControls:!0}),!r.isCloseControlsTimeoutCancel){r.closeControlsTimeout&&(window.clearTimeout(r.closeControlsTimeout),r.closeControlsTimeout=void 0);var e=r.props.player.config.defaultViewConfig;r.closeControlsTimeout=window.setTimeout(r.handleCloseControls,e.inactiveTimeout)}},r.handleCancelCloseTimeout=function(){r.isCloseControlsTimeoutCancel=!0,r.closeControlsTimeout&&(window.clearTimeout(r.closeControlsTimeout),r.closeControlsTimeout=void 0)},r.handleStartCloseTimeout=function(){r.isCloseControlsTimeoutCancel=!1;var e=r.props.player.config.defaultViewConfig;r.closeControlsTimeout=window.setTimeout(r.handleCloseControls,e.inactiveTimeout)},r}return qo(t,e),t.prototype.componentDidMount=function(){this.props.player.on("play",this.handlePlay),this.props.player.on("pause",this.handlePause),this.props.player.on("ready",this.handleCanplay),this.props.player.on("loading",this.handleLoading),this.props.player.on("timeupdate",this.handlePlaying),this.props.player.on("notification",this.handleNotification),this.props.player.on("error",this.handleError),this.closeControlsTimeout=window.setTimeout(this.handleCloseControls,this.props.player.config.defaultViewConfig.inactiveTimeout),this.props.player.sendNotification("姝e湪鍔犺浇瑙嗛婧�...",-1),this.container&&this.container.addEventListener("contextmenu",function(e){e.preventDefault()},!0)},t.prototype.render=function(){var e=this.props.player.config.defaultViewConfig;return ho("div",{ref:this.handleContainerRef,className:"qplayer","data-device":this.props.isMobile?"mobile":"desktop"},ho("div",{onMouseMove:this.handleShowControls,onMouseEnter:this.handleShowControls,onMouseLeave:this.handleCloseControls,className:Vo({"qplayer-wrapper":!0})},ho("div",{className:Vo({"qplayer-error":!0,"qplayer-active":this.state.errorMessage})},ho("p",{className:"qplayer-error-title"},"閿欒"),ho("p",{className:"qplayer-error-content"},this.state.errorMessage)),!this.props.isNoControl&&ho("div",{className:Vo({"qplayer-loading":!0,"qplayer-active":this.state.isLoading})},ho(es,{margin:0})),ho("div",{className:"qplayer-video",ref:this.handleVideoRef}),!this.props.isNoControl&&ho(Jo,{isLive:!!this.props.player.config.isLive,show:e.showControls||this.state.showControls&&!this.state.errorMessage,onKeepControls:this.handleCancelCloseTimeout,onNotKeepControls:this.handleStartCloseTimeout,onShow:this.handleShowControls,onClose:this.handleCloseControls,player:this.props.player,showPlay:!this.state.isPlay,showPause:this.state.isPlay,currentTime:this.state.currentTime,totalTime:this.state.totalTime,isMobile:this.props.isMobile}),!this.props.isNoControl&&ho(ts,{show:!this.state.errorMessage&&this.state.showToast,message:this.state.currentToastMessage})))},t}(jo),ns=new(function(){function e(){var t=this;this.isNoControl=!1,this.handleRef=function(e){e&&e!==t.component&&(t.component=e)}}return e.prototype.init=function(e,t,r){this.player=e,this.container=r,this.isNoControl=t||this.player.config.defaultViewConfig.noControls;var n=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);Go(ho(rs,{isNoControl:this.isNoControl,player:this.player,ref:this.handleRef,isMobile:n}),r)},e.prototype.getVideoElementSlot=function(){return this.component.video},e.prototype.getContainerElementSlot=function(){return this.isNoControl?this.component.video:this.component.container},e.prototype.destroy=function(){Go(ho(function(){return null},null),this.player.config.container,this.component.container)},e}()),is={container:document.body,autoplay:!1,muted:!1,volume:1,view:ns,loggerLevel:1,defaultViewConfig:{playIcon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCA1djE0bDExLTd6IiBmaWxsPSIjZmZmZmZmIi8+PHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjwvc3ZnPg==",pauseIcon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNiAxOWg0VjVINnYxNHptOC0xNHYxNGg0VjVoLTR6IiBmaWxsPSIjZmZmZmZmIi8+PHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjwvc3ZnPg==",indicatorIcon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBmaWxsPSJub25lIiBkPSJNMjQgMjRIMFYwaDI0djI0eiIvPjxjaXJjbGUgZmlsbD0iI2ZmZmZmZiIgY3g9IjEyIiBjeT0iMTIiIHI9IjgiLz48L3N2Zz4=",fullscreenIcon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTcgMTRINXY1aDV2LTJIN3YtM3ptLTItNGgyVjdoM1Y1SDV2NXptMTIgN2gtM3YyaDV2LTVoLTJ2M3pNMTQgNXYyaDN2M2gyVjVoLTV6IiBmaWxsPSIjZmZmZmZmIi8+PC9zdmc+",fullscreenExitIcon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PHBhdGggZmlsbD0iI2ZmZmZmZiIgZD0iTTUgMTZoM3YzaDJ2LTVINXYyem0zLThINXYyaDVWNUg4djN6bTYgMTFoMnYtM2gzdi0yaC01djV6bTItMTFWNWgtMnY1aDVWOGgtM3oiLz48L3N2Zz4=",volumeIcon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMyA5djZoNGw1IDVWNEw3IDlIM3ptMTMuNSAzYzAtMS43Ny0xLjAyLTMuMjktMi41LTQuMDN2OC4wNWMxLjQ4LS43MyAyLjUtMi4yNSAyLjUtNC4wMnpNMTQgMy4yM3YyLjA2YzIuODkuODYgNSAzLjU0IDUgNi43MXMtMi4xMSA1Ljg1LTUgNi43MXYyLjA2YzQuMDEtLjkxIDctNC40OSA3LTguNzdzLTIuOTktNy44Ni03LTguNzd6IiBmaWxsPSIjZmZmZmZmIi8+PHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjwvc3ZnPg==",volumeOffIcon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTYuNSAxMmMwLTEuNzctMS4wMi0zLjI5LTIuNS00LjAzdjIuMjFsMi40NSAyLjQ1Yy4wMy0uMi4wNS0uNDEuMDUtLjYzem0yLjUgMGMwIC45NC0uMiAxLjgyLS41NCAyLjY0bDEuNTEgMS41MUMyMC42MyAxNC45MSAyMSAxMy41IDIxIDEyYzAtNC4yOC0yLjk5LTcuODYtNy04Ljc3djIuMDZjMi44OS44NiA1IDMuNTQgNSA2Ljcxek00LjI3IDNMMyA0LjI3IDcuNzMgOUgzdjZoNGw1IDV2LTYuNzNsNC4yNSA0LjI1Yy0uNjcuNTItMS40Mi45My0yLjI1IDEuMTh2Mi4wNmMxLjM4LS4zMSAyLjYzLS45NSAzLjY5LTEuODFMMTkuNzMgMjEgMjEgMTkuNzNsLTktOUw0LjI3IDN6TTEyIDRMOS45MSA2LjA5IDEyIDguMThWNHoiIGZpbGw9IiNmZmZmZmYiLz48cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PC9zdmc+",settingsIcon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj48cGF0aCBmaWxsPSJub25lIiBkPSJNMCAwaDIwdjIwSDBWMHoiLz48cGF0aCBmaWxsPSIjZmZmZmZmIiBkPSJNMTUuOTUgMTAuNzhjLjAzLS4yNS4wNS0uNTEuMDUtLjc4cy0uMDItLjUzLS4wNi0uNzhsMS42OS0xLjMyYy4xNS0uMTIuMTktLjM0LjEtLjUxbC0xLjYtMi43N2MtLjEtLjE4LS4zMS0uMjQtLjQ5LS4xOGwtMS45OS44Yy0uNDItLjMyLS44Ni0uNTgtMS4zNS0uNzhMMTIgMi4zNGMtLjAzLS4yLS4yLS4zNC0uNC0uMzRIOC40Yy0uMiAwLS4zNi4xNC0uMzkuMzRsLS4zIDIuMTJjLS40OS4yLS45NC40Ny0xLjM1Ljc4bC0xLjk5LS44Yy0uMTgtLjA3LS4zOSAwLS40OS4xOGwtMS42IDIuNzdjLS4xLjE4LS4wNi4zOS4xLjUxbDEuNjkgMS4zMmMtLjA0LjI1LS4wNy41Mi0uMDcuNzhzLjAyLjUzLjA2Ljc4TDIuMzcgMTIuMWMtLjE1LjEyLS4xOS4zNC0uMS41MWwxLjYgMi43N2MuMS4xOC4zMS4yNC40OS4xOGwxLjk5LS44Yy40Mi4zMi44Ni41OCAxLjM1Ljc4bC4zIDIuMTJjLjA0LjIuMi4zNC40LjM0aDMuMmMuMiAwIC4zNy0uMTQuMzktLjM0bC4zLTIuMTJjLjQ5LS4yLjk0LS40NyAxLjM1LS43OGwxLjk5LjhjLjE4LjA3LjM5IDAgLjQ5LS4xOGwxLjYtMi43N2MuMS0uMTguMDYtLjM5LS4xLS41MWwtMS42Ny0xLjMyek0xMCAxM2MtMS42NSAwLTMtMS4zNS0zLTNzMS4zNS0zIDMtMyAzIDEuMzUgMyAzLTEuMzUgMy0zIDN6Ii8+PC9zdmc+",backIcon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PHBhdGggZmlsbD0iI2ZmZmZmZiIgZD0iTTIwIDExSDcuODNsNS41OS01LjU5TDEyIDRsLTggOCA4IDggMS40MS0xLjQxTDcuODMgMTNIMjB2LTJ6Ii8+PC9zdmc+",closeIcon:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTkgNi40MUwxNy41OSA1IDEyIDEwLjU5IDYuNDEgNSA1IDYuNDEgMTAuNTkgMTIgNSAxNy41OSA2LjQxIDE5IDEyIDEzLjQxIDE3LjU5IDE5IDE5IDE3LjU5IDEzLjQxIDEyeiIgZmlsbD0iI2ZmZmZmZiIgLz48cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PC9zdmc+",inactiveTimeout:2e3,playerBarBackground:"rgba(255, 255, 255, .2)",playerBarBufferedBackground:"rgba(255, 255, 255, .4)",playerBarPlayedBackground:"#fafafa"}},as=function(n){function e(e,t){var r=n.call(this)||this;return r.handleFullScreenChange=function(){r.emit("fullscreenchange")},r.container=e,r.videoElement=t,document.addEventListener("fullscreenchange",r.handleFullScreenChange),r}return t(e,n),Object.defineProperty(e.prototype,"isFullScreen",{get:function(){return!!document.fullscreenElement},enumerable:!0,configurable:!0}),e.prototype.fullscreen=function(){if(this.container.requestFullscreen)this.container.requestFullscreen();else{if(!this.videoElement.webkitEnterFullScreen)throw new Li(Si.COMMON,wi.FULLSCRREN_NOTSUPPORT,"not support fullscreen api");this.videoElement.webkitEnterFullscreen()}},e.prototype.exitFullScreen=function(){if(document.exitFullscreen)document.exitFullscreen();else{if(!this.videoElement.webkitExitFullScreen)throw new Li(Si.COMMON,wi.FULLSCRREN_NOTSUPPORT,"not support fullscreen api");this.videoElement.webkitExitFullscreen()}},e.prototype.toggle=function(){this.isFullScreen?this.exitFullScreen():this.fullscreen()},e.prototype.changeContainer=function(e,t){this.container=e,this.videoElement=t},e}(Ui),os=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t,r){this.name=e,this.version=t,this.os=r};t.BrowserInfo=i;var r=function(e){this.version=e,this.name="node",this.os=process.platform};t.NodeInfo=r;var o=function(){this.bot=!0,this.name="bot",this.version=null,this.os=null};t.BotInfo=o;var s=3,l=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["vivaldi",/Vivaldi\/([0-9\.]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],a=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/],["Search Bot",/(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/]];function n(a){var e=""!==a&&l.reduce(function(e,t){var r=t[0],n=t[1];if(e)return e;var i=n.exec(a);return!!i&&[r,i]},!1);if(!e)return null;var t=e[0],r=e[1];if("searchbot"===t)return new o;var n=r[1]&&r[1].split(/[._]/).slice(0,3);return n?n.length<s&&(n=n.concat(function(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}(s-n.length))):n=[],new i(t,n.join("."),u(a))}function u(e){for(var t=0,r=a.length;t<r;t++){var n=a[t],i=n[0];if(n[1].test(e))return i}return null}function f(){return"undefined"!=typeof process&&process.version?new r(process.version.slice(1)):null}t.detect=function(){return"undefined"!=typeof navigator?n(navigator.userAgent):f()},t.parseUserAgent=n,t.detectOS=u,t.getNodeVersion=f});e(os);os.BrowserInfo,os.NodeInfo,os.BotInfo;var ss=os.detect,ls=(os.parseUserAgent,os.detectOS,os.getNodeVersion,!1);(-1<navigator.userAgent.toLowerCase().indexOf("micromessenger")||void 0!==navigator.wxuserAgent)&&(ls=!0);var us=function(){var e=ss(),t=navigator.userAgent;t.match(/MQQBrowser/)&&(e.name="qq");t.match(/UCBrowser/)&&(e.name="uc");console.log("isWeixin",ls),ls&&(e.name="wechat");return qi.verbose("browser info",e),e}(),fs={playsinline:ds(us),fakeReady:!1};function ds(e){return"iOS"!==e.os&&"Android OS"!==e.os||("playsInline"in document.createElement("video")||"webkitPlaysInline"in document.createElement("video"))}var cs=function(){if(!us)return fs;switch(us.name){case"ios":return{playsinline:(e=us.version,t=e.split("."),10<Number(t[0]))};case"android":case"ios-webview":return{playsinline:ds(us)};case"qq":case"uc":return{playsinline:!1};case"wechat":return{playsinline:ds(us),fakeReady:!0}}var e,t;return fs}();function hs(e){Promise.resolve().then(e)}function ps(t,r){for(var n in r)try{r[n].constructor===Object?t[n]=ps(a({},t[n]),a({},r[n])):t[n]=r[n]}catch(e){t[n]=r[n]}return t}qi.verbose("browser",cs);var gs=function(n){function e(e,t){var r=n.call(this,e)||this;return r.playWhenReady=!1,r.videoElementEvents=["loadedmetadata","canplay","play","playing","pause","ended","waiting","seeking","timeupdate","durationchange","progress","seeked","error","volumechange","ratechange"],r.eventList=["#autoplay-faild","#play","#pause","#ended","#timeupdate","#progress","#loading","#durationchange","#seeked","#volumechange","#ratechange","stalled","canplay"],r.handleVideoElementEvent=function(e){switch(e.type){case"loadedmetadata":qi.verbose("loadedmetadata"),r.canplay=!0,r.totalTime=r.videoElement.duration,(r.playWhenReady||r.config.autoplay)&&r.play(),hs(function(){return r.emit("canplay",r.totalTime)});break;case"canplay":r.canplay=!0,r.totalTime=r.videoElement.duration,(r.playWhenReady||r.config.autoplay)&&r.play(),hs(function(){return r.emit("canplay",r.totalTime)});break;case"play":r.isPlay=!0,r.isPause=!1,r.currentTime=r.videoElement.currentTime,r.emit("#play");break;case"playing":r.isPlay=!0,r.isPause=!1,r.emit("#play");break;case"pause":r.isPause=!0,r.isPlay=!1,r.emit("#pause");break;case"ended":r.isEnd=!0,r.isPause=!1,r.isPlay=!1,r.emit("#ended");break;case"waiting":case"seeking":r.isLoading=!0;break;case"timeupdate":if(r.videoElement.currentTime<=r.currentTime)return;r.isLoading=!1,r.currentTime=r.videoElement.currentTime,r.totalTime=r.videoElement.duration,r.emit("#timeupdate",r.currentTime,r.totalTime);break;case"durationchange":r.totalTime=r.videoElement.duration,r.emit("#durationchange",r.totalTime);break;case"progress":r.buffered=r.videoElement.buffered,r.emit("#progress",r.videoElement.buffered);break;case"seeked":r.currentTime=r.videoElement.currentTime,r.emit("#seeked",r.isPlay),r.emit("#timeupdate",r.currentTime,r.totalTime),r.isLoading=!1,r.isPlay&&r.play();break;case"error":qi.warning(r.videoElement.error),r.emit("error",new Li(Si.COMMON,wi.VIDEO_ELEMENT_ERROR,r.videoElement.error.message));break;case"volumechange":r.isMuted=r.videoElement.muted,r.volume=r.videoElement.volume,r.emit("#volumechange",r.videoElement.volume,r.videoElement.muted);break;case"ratechange":r.emit("#ratechange",r.videoElement.playbackRate),r.playbackRate=r.videoElement.playbackRate}},r.createVideoElement(t),r}return t(e,n),Object.defineProperty(e.prototype,"video",{get:function(){return this.videoElement},enumerable:!0,configurable:!0}),e.prototype.play=function(){var t=this;if(this.canplay){qi.verbose("play operation");var e=this.videoElement.play();void 0!==e&&e instanceof Promise?e.then(function(){qi.debug("play success")}).catch(function(e){qi.warning("can not play",e),t.emit("error",new Li(Si.COMMON,wi.VIDEO_PLAY_FAILD,"can not play "+e.toString()))}):(qi.debug("play success"),qi.debug("play success"))}else this.playWhenReady=!0},e.prototype.pause=function(){this.videoElement.pause()},e.prototype.toggleMute=function(){this.videoElement.muted=!this.videoElement.muted},e.prototype.toggleLoop=function(){this.videoElement.loop=!this.videoElement.loop},e.prototype.setVolume=function(e){this.videoElement.volume=e},e.prototype.seek=function(e){var t=this;if(e=Math.max(0,e),e=Math.min(this.totalTime,e),this.videoElement.ended){var r=function(){t.videoElement.play(),t.videoElement.removeEventListener("seeked",r)};this.videoElement.addEventListener("seeked",r)}this.videoElement.currentTime=e},e.prototype.setPlaybackRate=function(e){this.videoElement.playbackRate=e},e.prototype.getCurrentFrame=function(){var e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;var t=e.getContext("2d");if(!t)return"data:,";t.drawImage(this.videoElement,0,0,this.videoElement.videoWidth,this.videoElement.videoHeight);var r=e.toDataURL();return e.remove(),r},e.prototype.createVideoElement=function(e){this.externalVideoElement=e?(this.videoElement=e,!0):(this.videoElement=document.createElement("video"),!1),this.videoElement.removeAttribute("src"),cs.playsinline?(this.videoElement.setAttribute("webkit-playsinline",""),this.videoElement.setAttribute("playsinline",""),this.videoElement.setAttribute("x5-playsinline",""),this.videoElement.controls=!1):this.videoElement.controls=!0,this.config.autoplay&&(this.videoElement.autoplay=!0),this.videoElement.preload="metadata",this.config.anonymous&&(this.videoElement.crossOrigin="anonymous"),this.config.muted&&(this.videoElement.muted=!0),this.videoElement.volume=this.config.volume,this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.poster=this.config.poster||"",this.videoElement.loop=!1,console.log("add video events handler");for(var t=0,r=this.videoElementEvents;t<r.length;t++){var n=r[t];this.videoElement.addEventListener(n,this.handleVideoElementEvent)}},e.prototype.destroy=function(){this.removeAllListeners();for(var e=0,t=this.videoElementEvents;e<t.length;e++){var r=t[e];this.videoElement.removeEventListener(r,this.handleVideoElementEvent)}this.videoElement.pause(),this.videoElement.src="",this.videoElement.load(),console.log("destory video",this.videoElement,this.videoElement.parentElement,this.externalVideoElement),this.externalVideoElement||(this.videoElement.parentElement&&this.videoElement.parentElement.removeChild(this.videoElement),this.videoElement.remove&&this.videoElement.remove())},e}(function(r){function e(e){var t=r.call(this)||this;return t.eventList=[],t.canplay=!!cs.fakeReady,t.isPlay=!1,t.isPause=!1,t.isEnd=!1,t.currentTime=0,t.totalTime=0,t.playbackRate=1,t.volume=100,t._isLoading=!1,t.loadingStateLock=!1,t.config=e,t.isMuted=!!t.config.muted,t.volume=t.config.volume,t}return t(e,r),Object.defineProperty(e.prototype,"isLoading",{get:function(){return this._isLoading},set:function(e){this.loadingStateLock||(this._isLoading!==e&&this.emit("#loading",e),this._isLoading=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLoop",{get:function(){return this.video.loop},enumerable:!0,configurable:!0}),e.prototype.setContainer=function(e){this.container=e,this.video.parentNode&&this.video.parentNode.removeChild(this.video),this.container.appendChild(this.video)},e.prototype.setLoadingStateLock=function(e){this.loadingStateLock=e},e}(Ui)),ms=function(){function e(e){var t=this;if(this._currentQuality=0,this.player=e,!this.player.engine)throw new Li(Si.COMMON,wi.UNEXPECTED_ERROR,"");this.player.config.qualityList?hs(function(){return t.player.emit("get-quality-list",t.qualityList)}):this.player.engine instanceof Gi&&(this.player.engine.on("@get-quality-list",function(){t.player.emit("get-quality-list",t.qualityList)}),this.player.engine.on("@quality-switching",function(e){t.player.emit("quality-switching",e)}),this.player.engine.on("@quality-switched",function(e){t.player.emit("quality-switched",e)}),this.player.engine.on("@auto-quality-switch-change",function(e){t.player.emit("auto-quality-switch-change",e)}))}return Object.defineProperty(e.prototype,"isSupportAutoQualitySwitch",{get:function(){return!this.player.config.qualityList&&this.player.engine instanceof Gi},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"qualityList",{get:function(){return this.player.config.qualityList?this.player.config.qualityList:this.player.engine instanceof Gi?this.player.engine.qualityList:[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentQuality",{get:function(){return this.player.config.qualityList?{quality:this.qualityList[this._currentQuality],isAuto:!1}:this.player.engine instanceof Gi?this.player.engine.currentQuality:(qi.warning("can not get quality"),{quality:null,isAuto:!1})},enumerable:!0,configurable:!0}),e.prototype.toggleAutoQualitySwitch=function(){this.isSupportAutoQualitySwitch?this.player.engine instanceof Gi&&this.player.engine.toggleAutoQualityControl():qi.debug("not support auto quality switch!")},e.prototype.switchQuality=function(t){var s=this;if(this.player.config.qualityList){var l=this.qualityList.find(function(e){return e.id===t});if(l){qi.verbose("qualitu-switching",l),this.player.emit("quality-switching",l.id),this.tempRender=new gs({autoplay:!0,muted:!0,volume:this.player.volume,anonymous:this.player.config.anonymous});this.player.getEngineFromURL(l.url,this.tempRender).then(function(o){(s.tempEngine=o).once("ready",function(){return u(s,void 0,void 0,function(){var n,i,a=this;return f(this,function(e){switch(e.label){case 0:return this.tempRender?(n=0,[4,new Promise(function(t){a.tempRender.on("#timeupdate",function(e){a.tempRender.removeAllListeners(),0<e&&t()})})]):[2];case 1:e.sent(),e.label=2;case 2:return[4,(t=this.tempRender,r=n,new Promise(function(e){t.seek(s.player.render.currentTime+r),t.once("#seeked",function(){e(s.player.render.currentTime-t.currentTime)})}))];case 3:return i=e.sent(),qi.verbose("latency",i),0<=i&&i<=.3?[3,4]:(n=i/2,[3,2]);case 4:return this.player.replaceEngineAndRender(o,this.tempRender),this.tempRender=void 0,this.tempEngine=void 0,this.player.emit("quality-switched",l.id),[2]}var t,r})})})})}}else this.player.engine instanceof Gi?this.player.engine.changeQuality(t):qi.warning("not support change quality in this config")},e.prototype.destroy=function(){this.tempRender&&(this.tempRender.destroy(),this.tempRender=void 0),this.tempEngine&&(this.tempEngine.destroy(),this.tempEngine=void 0)},e}();function ys(i,a,o){return void 0===a&&(a=4),new Promise(function(r,n){var e=new XMLHttpRequest;e.withCredentials=!!o,e.onreadystatechange=function(){e.readyState===e.HEADERS_RECEIVED&&(r(e.getResponseHeader("Content-Type")),e.abort())},e.onerror=function(e){var t;0<a?(qi.warning("fetch "+i+" error,",e),(t=500,new Promise(function(e){window.setTimeout(e,t)})).then(function(){r(ys(i,a-1,!o))})):n(new Li(Si.COMMON,wi.CAN_NOT_FETCH,"get not fetch "+i))},e.open("GET",i,!0),e.send()})}var vs=o(function(e,t){e.exports=function a(o,s,l){function u(r,e){if(!s[r]){if(!o[r]){var t=c;if(!e&&t)return t(r,!0);if(f)return f(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[r]={exports:{}};o[r][0].call(i.exports,function(e){var t=o[r][1][e];return u(t||e)},i,i.exports,a,o,s,l)}return s[r].exports}for(var f=c,e=0;e<l.length;e++)u(l[e]);return u}({1:[function(e,f,t){(function(t){var r,n,e=t.MutationObserver||t.WebKitMutationObserver;if(e){var i=0,a=new e(u),o=t.document.createTextNode("");a.observe(o,{characterData:!0}),r=function(){o.data=i=++i%2}}else if(t.setImmediate||void 0===t.MessageChannel)r="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){u(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(u,0)};else{var s=new t.MessageChannel;s.port1.onmessage=u,r=function(){s.port2.postMessage(0)}}var l=[];function u(){var e,t;n=!0;for(var r=l.length;r;){for(t=l,l=[],e=-1;++e<r;)t[e]();r=l.length}n=!1}f.exports=function(e){1!==l.push(e)||n||r()}}).call(this,void 0!==i?i:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var i=e(1);function u(){}var f={},a=["REJECTED"],o=["FULFILLED"],s=["PENDING"];function n(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,e!==u&&h(this,e)}function l(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function d(t,r,n){i(function(){var e;try{e=r(n)}catch(e){return f.reject(t,e)}e===t?f.reject(t,new TypeError("Cannot resolve promise with itself")):f.resolve(t,e)})}function c(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(t,e){var r=!1;function n(e){r||(r=!0,f.reject(t,e))}function i(e){r||(r=!0,f.resolve(t,e))}var a=p(function(){e(i,n)});"error"===a.status&&n(a.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}(t.exports=n).prototype.catch=function(e){return this.then(null,e)},n.prototype.then=function(e,t){if("function"!=typeof e&&this.state===o||"function"!=typeof t&&this.state===a)return this;var r=new this.constructor(u);if(this.state!==s){var n=this.state===o?e:t;d(r,n,this.outcome)}else this.queue.push(new l(r,e,t));return r},l.prototype.callFulfilled=function(e){f.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){f.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},f.resolve=function(e,t){var r=p(c,t);if("error"===r.status)return f.reject(e,r.value);var n=r.value;if(n)h(e,n);else{e.state=o,e.outcome=t;for(var i=-1,a=e.queue.length;++i<a;)e.queue[i].callFulfilled(t)}return e},f.reject=function(e,t){e.state=a,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},n.resolve=function(e){return e instanceof this?e:f.resolve(new this(u),e)},n.reject=function(e){var t=new this(u);return f.reject(t,e)},n.all=function(e){var r=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var a=new Array(n),o=0,t=-1,s=new this(u);++t<n;)l(e[t],t);return s;function l(e,t){r.resolve(e).then(function(e){a[t]=e,++o!==n||i||(i=!0,f.resolve(s,a))},function(e){i||(i=!0,f.reject(s,e))})}},n.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var i,a=-1,o=new this(u);++a<r;)i=e[a],t.resolve(i).then(function(e){n||(n=!0,f.resolve(o,e))},function(e){n||(n=!0,f.reject(o,e))});return o}},{1:1}],3:[function(t,e,r){(function(e){"function"!=typeof e.Promise&&(e.Promise=t(2))}).call(this,void 0!==i?i:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function o(t,r){t=t||[],r=r||{};try{return new Blob(t,r)}catch(e){if("TypeError"!==e.name)throw e;for(var n="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,i=new n,a=0;a<t.length;a+=1)i.append(t[a]);return i.getBlob(r.type)}}"undefined"==typeof Promise&&e(3);var d=Promise;function c(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function u(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function a(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var s="local-forage-detect-blob-support",i=void 0,h={},p=Object.prototype.toString,g="readonly",m="readwrite";function y(e){return"boolean"==typeof i?d.resolve(i):(n=e,new d(function(r){var e=n.transaction(s,m),t=o([""]);e.objectStore(s).put(t,"key"),e.onabort=function(e){e.preventDefault(),e.stopPropagation(),r(!1)},e.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),t=navigator.userAgent.match(/Edge\//);r(t||!e||43<=parseInt(e[1],10))}}).catch(function(){return!1})).then(function(e){return i=e});var n}function v(e){var t=h[e.name],r={};r.promise=new d(function(e,t){r.resolve=e,r.reject=t}),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then(function(){return r.promise}):t.dbReady=r.promise}function _(e){var t=h[e.name],r=t.deferredOperations.pop();if(r)return r.resolve(),r.promise}function b(e,t){var r=h[e.name],n=r.deferredOperations.pop();if(n)return n.reject(t),n.promise}function S(i,a){return new d(function(e,t){if(h[i.name]=h[i.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},i.db){if(!a)return e(i.db);v(i),i.db.close()}var r=[i.name];a&&r.push(i.version);var n=l.open.apply(l,r);a&&(n.onupgradeneeded=function(t){var e=n.result;try{e.createObjectStore(i.storeName),t.oldVersion<=1&&e.createObjectStore(s)}catch(e){if("ConstraintError"!==e.name)throw e;console.warn('The database "'+i.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+i.storeName+'" already exists.')}}),n.onerror=function(e){e.preventDefault(),t(n.error)},n.onsuccess=function(){e(n.result),_(i)}})}function E(e){return S(e,!1)}function w(e){return S(e,!0)}function T(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function A(e){var t=function(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r}(atob(e.data));return o([t],{type:e.type})}function x(e){return e&&e.__local_forage_encoded_blob}function L(e){var t=this,r=t._initReady().then(function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return u(r,e,e),r}function R(t,r,n,i){void 0===i&&(i=1);try{var e=t.db.transaction(t.storeName,r);n(null,e)}catch(e){if(0<i&&(!t.db||"InvalidStateError"===e.name||"NotFoundError"===e.name))return d.resolve().then(function(){if(!t.db||"NotFoundError"===e.name&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),w(t)}).then(function(){return function(r){v(r);for(var n=h[r.name],i=n.forages,e=0;e<i.length;e++){var t=i[e];t._dbInfo.db&&(t._dbInfo.db.close(),t._dbInfo.db=null)}return r.db=null,E(r).then(function(e){return r.db=e,T(r)?w(r):e}).then(function(e){r.db=n.db=e;for(var t=0;t<i.length;t++)i[t]._dbInfo.db=e}).catch(function(e){throw b(r,e),e})}(t).then(function(){R(t,r,n,i-1)})}).catch(n);n(e)}}var I={_driver:"asyncStorage",_initStorage:function(e){var n=this,i={db:null};if(e)for(var t in e)i[t]=e[t];var a=h[i.name];a||(a={forages:[],db:null,dbReady:null,deferredOperations:[]},h[i.name]=a),a.forages.push(n),n._initReady||(n._initReady=n.ready,n.ready=L);var r=[];function o(){return d.resolve()}for(var s=0;s<a.forages.length;s++){var l=a.forages[s];l!==n&&r.push(l._initReady().catch(o))}var u=a.forages.slice(0);return d.all(r).then(function(){return i.db=a.db,E(i)}).then(function(e){return i.db=e,T(i,n._defaultConfig.version)?w(i):e}).then(function(e){i.db=a.db=e,n._dbInfo=i;for(var t=0;t<u.length;t++){var r=u[t];r!==n&&(r._dbInfo.db=i.db,r._dbInfo.version=i.version)}})},_support:function(){try{if(!l)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(s,e){var l=this,t=new d(function(a,o){l.ready().then(function(){R(l._dbInfo,g,function(e,t){if(e)return o(e);try{var r=t.objectStore(l._dbInfo.storeName),n=r.openCursor(),i=1;n.onsuccess=function(){var e=n.result;if(e){var t=e.value;x(t)&&(t=A(t));var r=s(t,e.key,i++);void 0!==r?a(r):e.continue()}else a()},n.onerror=function(){o(n.error)}}catch(e){o(e)}})}).catch(o)});return c(t,e),t},getItem:function(o,e){var s=this;o=f(o);var t=new d(function(i,a){s.ready().then(function(){R(s._dbInfo,g,function(e,t){if(e)return a(e);try{var r=t.objectStore(s._dbInfo.storeName),n=r.get(o);n.onsuccess=function(){var e=n.result;void 0===e&&(e=null),x(e)&&(e=A(e)),i(e)},n.onerror=function(){a(n.error)}}catch(e){a(e)}})}).catch(a)});return c(t,e),t},setItem:function(s,t,e){var l=this;s=f(s);var r=new d(function(a,o){var e;l.ready().then(function(){return e=l._dbInfo,"[object Blob]"===p.call(t)?y(e.db).then(function(e){return e?t:(n=t,new d(function(r,e){var t=new FileReader;t.onerror=e,t.onloadend=function(e){var t=btoa(e.target.result||"");r({__local_forage_encoded_blob:!0,data:t,type:n.type})},t.readAsBinaryString(n)}));var n}):t}).then(function(i){R(l._dbInfo,m,function(e,t){if(e)return o(e);try{var r=t.objectStore(l._dbInfo.storeName);null===i&&(i=void 0);var n=r.put(i,s);t.oncomplete=function(){void 0===i&&(i=null),a(i)},t.onabort=t.onerror=function(){var e=n.error?n.error:n.transaction.error;o(e)}}catch(e){o(e)}})}).catch(o)});return c(r,e),r},removeItem:function(o,e){var s=this;o=f(o);var t=new d(function(i,a){s.ready().then(function(){R(s._dbInfo,m,function(e,t){if(e)return a(e);try{var r=t.objectStore(s._dbInfo.storeName),n=r.delete(o);t.oncomplete=function(){i()},t.onerror=function(){a(n.error)},t.onabort=function(){var e=n.error?n.error:n.transaction.error;a(e)}}catch(e){a(e)}})}).catch(a)});return c(t,e),t},clear:function(e){var o=this,t=new d(function(i,a){o.ready().then(function(){R(o._dbInfo,m,function(e,t){if(e)return a(e);try{var r=t.objectStore(o._dbInfo.storeName),n=r.clear();t.oncomplete=function(){i()},t.onabort=t.onerror=function(){var e=n.error?n.error:n.transaction.error;a(e)}}catch(e){a(e)}})}).catch(a)});return c(t,e),t},length:function(e){var o=this,t=new d(function(i,a){o.ready().then(function(){R(o._dbInfo,g,function(e,t){if(e)return a(e);try{var r=t.objectStore(o._dbInfo.storeName),n=r.count();n.onsuccess=function(){i(n.result)},n.onerror=function(){a(n.error)}}catch(e){a(e)}})}).catch(a)});return c(t,e),t},key:function(s,e){var l=this,t=new d(function(a,o){s<0?a(null):l.ready().then(function(){R(l._dbInfo,g,function(e,t){if(e)return o(e);try{var r=t.objectStore(l._dbInfo.storeName),n=!1,i=r.openCursor();i.onsuccess=function(){var e=i.result;e?0===s?a(e.key):n?a(e.key):(n=!0,e.advance(s)):a(null)},i.onerror=function(){o(i.error)}}catch(e){o(e)}})}).catch(o)});return c(t,e),t},keys:function(e){var s=this,t=new d(function(a,o){s.ready().then(function(){R(s._dbInfo,g,function(e,t){if(e)return o(e);try{var r=t.objectStore(s._dbInfo.storeName),n=r.openCursor(),i=[];n.onsuccess=function(){var e=n.result;e?(i.push(e.key),e.continue()):a(i)},n.onerror=function(){o(n.error)}}catch(e){o(e)}})}).catch(o)});return c(t,e),t},dropInstance:function(s,e){e=a.apply(this,arguments);var t,r=this.config();if((s="function"!=typeof s&&s||{}).name||(s.name=s.name||r.name,s.storeName=s.storeName||r.storeName),s.name){var n=s.name===r.name&&this._dbInfo.db,i=n?d.resolve(this._dbInfo.db):E(s).then(function(e){var t=h[s.name],r=t.forages;t.db=e;for(var n=0;n<r.length;n++)r[n]._dbInfo.db=e;return e});t=s.storeName?i.then(function(e){if(e.objectStoreNames.contains(s.storeName)){var i=e.version+1;v(s);var n=h[s.name],a=n.forages;e.close();for(var t=0;t<a.length;t++){var r=a[t];r._dbInfo.db=null,r._dbInfo.version=i}var o=new d(function(t,r){var n=l.open(s.name,i);n.onerror=function(e){var t=n.result;t.close(),r(e)},n.onupgradeneeded=function(){var e=n.result;e.deleteObjectStore(s.storeName)},n.onsuccess=function(){var e=n.result;e.close(),t(e)}});return o.then(function(e){n.db=e;for(var t=0;t<a.length;t++){var r=a[t];r._dbInfo.db=e,_(r._dbInfo)}}).catch(function(e){throw(b(s,e)||d.resolve()).catch(function(){}),e})}}):i.then(function(e){v(s);var n=h[s.name],i=n.forages;e.close();for(var t=0;t<i.length;t++){var r=i[t];r._dbInfo.db=null}var a=new d(function(t,r){var n=l.deleteDatabase(s.name);n.onerror=n.onblocked=function(e){var t=n.result;t&&t.close(),r(e)},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}});return a.then(function(e){n.db=e;for(var t=0;t<i.length;t++){var r=i[t];_(r._dbInfo)}}).catch(function(e){throw(b(s,e)||d.resolve()).catch(function(){}),e})})}else t=d.reject("Invalid arguments");return c(t,e),t}},C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D=/^~~local_forage_type~([^~]+)~/,P="__lfsc__:",U=P.length,k=U+"arbf".length,O=Object.prototype.toString;function M(e){var t,r,n,i,a,o=.75*e.length,s=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var u=new ArrayBuffer(o),f=new Uint8Array(u);for(t=0;t<s;t+=4)r=C.indexOf(e[t]),n=C.indexOf(e[t+1]),i=C.indexOf(e[t+2]),a=C.indexOf(e[t+3]),f[l++]=r<<2|n>>4,f[l++]=(15&n)<<4|i>>2,f[l++]=(3&i)<<6|63&a;return u}function F(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=C[r[t]>>2],n+=C[(3&r[t])<<4|r[t+1]>>4],n+=C[(15&r[t+1])<<2|r[t+2]>>6],n+=C[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var N={serialize:function(t,r){var e="";if(t&&(e=O.call(t)),t&&("[object ArrayBuffer]"===e||t.buffer&&"[object ArrayBuffer]"===O.call(t.buffer))){var n,i=P;t instanceof ArrayBuffer?(n=t,i+="arbf"):(n=t.buffer,"[object Int8Array]"===e?i+="si08":"[object Uint8Array]"===e?i+="ui08":"[object Uint8ClampedArray]"===e?i+="uic8":"[object Int16Array]"===e?i+="si16":"[object Uint16Array]"===e?i+="ur16":"[object Int32Array]"===e?i+="si32":"[object Uint32Array]"===e?i+="ui32":"[object Float32Array]"===e?i+="fl32":"[object Float64Array]"===e?i+="fl64":r(new Error("Failed to get type for BinaryArray"))),r(i+F(n))}else if("[object Blob]"===e){var a=new FileReader;a.onload=function(){var e="~~local_forage_type~"+t.type+"~"+F(this.result);r(P+"blob"+e)},a.readAsArrayBuffer(t)}else try{r(JSON.stringify(t))}catch(e){console.error("Couldn't convert value into a JSON string: ",t),r(null,e)}},deserialize:function(e){if(e.substring(0,U)!==P)return JSON.parse(e);var t,r=e.substring(k),n=e.substring(U,k);if("blob"===n&&D.test(r)){var i=r.match(D);t=i[1],r=r.substring(i[0].length)}var a=M(r);switch(n){case"arbf":return a;case"blob":return o([a],{type:t});case"si08":return new Int8Array(a);case"ui08":return new Uint8Array(a);case"uic8":return new Uint8ClampedArray(a);case"si16":return new Int16Array(a);case"ur16":return new Uint16Array(a);case"si32":return new Int32Array(a);case"ui32":return new Uint32Array(a);case"fl32":return new Float32Array(a);case"fl64":return new Float64Array(a);default:throw new Error("Unkown type: "+n)}},stringToBuffer:M,bufferToString:F};function B(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function z(e,n,i,a,o,s){e.executeSql(i,a,o,function(e,r){r.code===r.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[n.storeName],function(e,t){t.rows.length?s(e,r):B(e,n,function(){e.executeSql(i,a,o,s)},s)},s):s(e,r)},s)}function j(o,e,s,l){var u=this;o=f(o);var t=new d(function(i,a){u.ready().then(function(){void 0===e&&(e=null);var r=e,n=u._dbInfo;n.serializer.serialize(e,function(t,e){e?a(e):n.db.transaction(function(e){z(e,n,"INSERT OR REPLACE INTO "+n.storeName+" (key, value) VALUES (?, ?)",[o,t],function(){i(r)},function(e,t){a(t)})},function(e){if(e.code===e.QUOTA_ERR){if(0<l)return void i(j.apply(u,[o,r,s,l-1]));a(e)}})})}).catch(a)});return c(t,s),t}var G={_driver:"webSQLStorage",_initStorage:function(e){var n=this,i={db:null};if(e)for(var t in e)i[t]="string"!=typeof e[t]?e[t].toString():e[t];var r=new d(function(t,r){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(e){return r(e)}i.db.transaction(function(e){B(e,i,function(){n._dbInfo=i,t()},function(e,t){r(t)})},r)});return i.serializer=N,r},_support:"function"==typeof openDatabase,iterate:function(u,e){var t=this,r=new d(function(l,r){t.ready().then(function(){var s=t._dbInfo;s.db.transaction(function(e){z(e,s,"SELECT * FROM "+s.storeName,[],function(e,t){for(var r=t.rows,n=r.length,i=0;i<n;i++){var a=r.item(i),o=a.value;if(o&&(o=s.serializer.deserialize(o)),void 0!==(o=u(o,a.key,i+1)))return void l(o)}l()},function(e,t){r(t)})})}).catch(r)});return c(r,e),r},getItem:function(t,e){var a=this;t=f(t);var r=new d(function(i,r){a.ready().then(function(){var n=a._dbInfo;n.db.transaction(function(e){z(e,n,"SELECT * FROM "+n.storeName+" WHERE key = ? LIMIT 1",[t],function(e,t){var r=t.rows.length?t.rows.item(0).value:null;r&&(r=n.serializer.deserialize(r)),i(r)},function(e,t){r(t)})})}).catch(r)});return c(r,e),r},setItem:function(e,t,r){return j.apply(this,[e,t,r,1])},removeItem:function(i,e){var a=this;i=f(i);var t=new d(function(r,n){a.ready().then(function(){var t=a._dbInfo;t.db.transaction(function(e){z(e,t,"DELETE FROM "+t.storeName+" WHERE key = ?",[i],function(){r()},function(e,t){n(t)})})}).catch(n)});return c(t,e),t},clear:function(e){var i=this,t=new d(function(r,n){i.ready().then(function(){var t=i._dbInfo;t.db.transaction(function(e){z(e,t,"DELETE FROM "+t.storeName,[],function(){r()},function(e,t){n(t)})})}).catch(n)});return c(t,e),t},length:function(e){var i=this,t=new d(function(n,r){i.ready().then(function(){var t=i._dbInfo;t.db.transaction(function(e){z(e,t,"SELECT COUNT(key) as c FROM "+t.storeName,[],function(e,t){var r=t.rows.item(0).c;n(r)},function(e,t){r(t)})})}).catch(r)});return c(t,e),t},key:function(i,e){var a=this,t=new d(function(n,r){a.ready().then(function(){var t=a._dbInfo;t.db.transaction(function(e){z(e,t,"SELECT key FROM "+t.storeName+" WHERE id = ? LIMIT 1",[i+1],function(e,t){var r=t.rows.length?t.rows.item(0).key:null;n(r)},function(e,t){r(t)})})}).catch(r)});return c(t,e),t},keys:function(e){var n=this,t=new d(function(i,r){n.ready().then(function(){var t=n._dbInfo;t.db.transaction(function(e){z(e,t,"SELECT key FROM "+t.storeName,[],function(e,t){for(var r=[],n=0;n<t.rows.length;n++)r.push(t.rows.item(n).key);i(r)},function(e,t){r(t)})})}).catch(r)});return c(t,e),t},dropInstance:function(r,e){e=a.apply(this,arguments);var n=this.config();(r="function"!=typeof r&&r||{}).name||(r.name=r.name||n.name,r.storeName=r.storeName||n.storeName);var t,i=this;return c(t=r.name?new d(function(e){var t,a;t=r.name===n.name?i._dbInfo.db:openDatabase(r.name,"","",0),r.storeName?e({db:t,storeNames:[r.storeName]}):e((a=t,new d(function(i,r){a.transaction(function(e){e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(e,t){for(var r=[],n=0;n<t.rows.length;n++)r.push(t.rows.item(n).name);i({db:a,storeNames:r})},function(e,t){r(t)})},function(e){r(e)})})))}).then(function(s){return new d(function(a,o){s.db.transaction(function(n){function e(t){return new d(function(e,r){n.executeSql("DROP TABLE IF EXISTS "+t,[],function(){e()},function(e,t){r(t)})})}for(var t=[],r=0,i=s.storeNames.length;r<i;r++)t.push(e(s.storeNames[r]));d.all(t).then(function(){a()}).catch(function(e){o(e)})},function(e){o(e)})})}):d.reject("Invalid arguments"),e),t}};function H(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function q(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||0<localStorage.length}var V={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=H(e,this._defaultConfig),q()?((this._dbInfo=t).serializer=N,d.resolve()):d.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(l,e){var u=this,t=u.ready().then(function(){for(var e=u._dbInfo,t=e.keyPrefix,r=t.length,n=localStorage.length,i=1,a=0;a<n;a++){var o=localStorage.key(a);if(0===o.indexOf(t)){var s=localStorage.getItem(o);if(s&&(s=e.serializer.deserialize(s)),void 0!==(s=l(s,o.substring(r),i++)))return s}}});return c(t,e),t},getItem:function(r,e){var n=this;r=f(r);var t=n.ready().then(function(){var e=n._dbInfo,t=localStorage.getItem(e.keyPrefix+r);return t&&(t=e.serializer.deserialize(t)),t});return c(t,e),t},setItem:function(o,e,t){var s=this;o=f(o);var r=s.ready().then(function(){void 0===e&&(e=null);var a=e;return new d(function(r,n){var i=s._dbInfo;i.serializer.serialize(e,function(e,t){if(t)n(t);else try{localStorage.setItem(i.keyPrefix+o,e),r(a)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||n(e),n(e)}})})});return c(r,t),r},removeItem:function(t,e){var r=this;t=f(t);var n=r.ready().then(function(){var e=r._dbInfo;localStorage.removeItem(e.keyPrefix+t)});return c(n,e),n},clear:function(e){var n=this,t=n.ready().then(function(){for(var e=n._dbInfo.keyPrefix,t=localStorage.length-1;0<=t;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}});return c(t,e),t},length:function(e){var t=this.keys().then(function(e){return e.length});return c(t,e),t},key:function(r,e){var n=this,t=n.ready().then(function(){var t,e=n._dbInfo;try{t=localStorage.key(r)}catch(e){t=null}return t&&(t=t.substring(e.keyPrefix.length)),t});return c(t,e),t},keys:function(e){var a=this,t=a.ready().then(function(){for(var e=a._dbInfo,t=localStorage.length,r=[],n=0;n<t;n++){var i=localStorage.key(n);0===i.indexOf(e.keyPrefix)&&r.push(i.substring(e.keyPrefix.length))}return r});return c(t,e),t},dropInstance:function(t,e){if(e=a.apply(this,arguments),!(t="function"!=typeof t&&t||{}).name){var r=this.config();t.name=t.name||r.name,t.storeName=t.storeName||r.storeName}var n,i=this;return c(n=t.name?new d(function(e){t.storeName?e(H(t,i._defaultConfig)):e(t.name+"/")}).then(function(e){for(var t=localStorage.length-1;0<=t;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}}):d.reject("Invalid arguments"),e),n}},W=function(e,t){for(var r=e.length,n=0;n<r;){if((i=e[n])===(a=t)||"number"==typeof i&&"number"==typeof a&&isNaN(i)&&isNaN(a))return!0;n++}var i,a;return!1},Y=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},K={},X={},Z={INDEXEDDB:I,WEBSQL:G,LOCALSTORAGE:V},Q=[Z.INDEXEDDB._driver,Z.WEBSQL._driver,Z.LOCALSTORAGE._driver],J=["dropInstance"],$=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(J),ee={description:"",driver:Q.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function te(t,r){t[r]=function(){var e=arguments;return t.ready().then(function(){return t[r].apply(t,e)})}}function re(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(Y(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var ne=function(){function i(e){for(var t in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),Z)if(Z.hasOwnProperty(t)){var r=Z[t],n=r._driver;this[t]=n,K[n]||this.defineDriver(r)}this._defaultConfig=re({},ee),this._config=re({},this._defaultConfig,e),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return i.prototype.config=function(e){if("object"!==(void 0===e?"undefined":n(e)))return"string"==typeof e?this._config[e]:this._config;if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e&&e.driver)||this.setDriver(this._config.driver)},i.prototype.defineDriver=function(f,e,t){var r=new d(function(t,r){try{var n=f._driver,e=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!f._driver)return void r(e);for(var i=$.concat("_initStorage"),a=0,o=i.length;a<o;a++){var s=i[a],l=!W(J,s);if((l||f[s])&&"function"!=typeof f[s])return void r(e)}!function(){for(var e=function(r){return function(){var e=new Error("Method "+r+" is not implemented by the current driver"),t=d.reject(e);return c(t,arguments[arguments.length-1]),t}},t=0,r=J.length;t<r;t++){var n=J[t];f[n]||(f[n]=e(n))}}();var u=function(e){K[n]&&console.info("Redefining LocalForage driver: "+n),K[n]=f,X[n]=e,t()};"_support"in f?f._support&&"function"==typeof f._support?f._support().then(u,r):u(!!f._support):u(!0)}catch(e){r(e)}});return u(r,e,t),r},i.prototype.driver=function(){return this._driver||null},i.prototype.getDriver=function(e,t,r){var n=K[e]?d.resolve(K[e]):d.reject(new Error("Driver not found."));return u(n,t,r),n},i.prototype.getSerializer=function(e){var t=d.resolve(N);return u(t,e),t},i.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return u(r,e,e),r},i.prototype.setDriver=function(e,t,r){var a=this;Y(e)||(e=[e]);var n=this._getSupportedDrivers(e);function o(){a._config.driver=a.driver()}function s(e){return a._extend(e),o(),a._ready=a._initStorage(a._config),a._ready}var i=null!==this._driverSet?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=i.then(function(){var e=n[0];return a._dbInfo=null,a._ready=null,a.getDriver(e).then(function(e){var i;a._driver=e._driver,o(),a._wrapLibraryMethodsWithReady(),a._initDriver=(i=n,function(){var r=0;function n(){for(;r<i.length;){var e=i[r];return r++,a._dbInfo=null,a._ready=null,a.getDriver(e).then(s).catch(n)}o();var t=new Error("No available storage method found.");return a._driverSet=d.reject(t),a._driverSet}return n()})})}).catch(function(){o();var e=new Error("No available storage method found.");return a._driverSet=d.reject(e),a._driverSet}),u(this._driverSet,t,r),this._driverSet},i.prototype.supports=function(e){return!!X[e]},i.prototype._extend=function(e){re(this,e)},i.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];this.supports(i)&&t.push(i)}return t},i.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=$.length;e<t;e++)te(this,$[e])},i.prototype.createInstance=function(e){return new i(e)},i}(),ie=new ne;t.exports=ie},{3:3}]},{},[4])(4)}),_s=function(je){return new Promise(function(e){var f=je,d="";f.onRuntimeInitialized=function(){e(f)};var t,r={};for(t in f)f.hasOwnProperty(t)&&(r[t]=f[t]);f.arguments=[],f.thisProgram="./this.program",f.quit=function(e,t){throw t},f.preRun=[],f.postRun=[];f.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},f.readAsync=function(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)},f.setWindowTitle=function(e){document.title=e};var c=f.print||("undefined"!=typeof console?console.log.bind(console):"undefined"!=typeof print?print:null),h=f.printErr||("undefined"!=typeof printErr?printErr:"undefined"!=typeof console&&console.warn.bind(console)||c);for(t in r)r.hasOwnProperty(t)&&(f[t]=r[t]);r=void 0;function p(e){var t=M;return M=M+e+15&-16,t}function g(e){var t=U[z>>2],r=t+e+15&-16;if((U[z>>2]=r,X<=r)&&!Y())return U[z>>2]=t,0;return t}function n(e,t){return t||(t=16),e=Math.ceil(e/t)*t}function m(e){switch(e){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:if("*"===e[e.length-1])return 4;if("i"!==e[0])return 0;var t=parseInt(e.substr(1));return y(t%8==0),t/8}}var i={"f64-rem":function(e,t){return e%t},debugger:function(){}},a=0;function y(e,t){e||ze("Assertion failed: "+t)}function v(e){var t=f["_"+e];return y(t,"Cannot call unknown function "+e+", make sure it is exported"),t}var o={stackSave:function(){Fe()},stackRestore:function(){Me()},arrayToC:function(e){var t,r,n=Oe(e.length);return t=e,r=n,C.set(t,r),n},stringToC:function(e){var t=0;if(null!=e&&0!==e){var r=1+(e.length<<2);t=Oe(r),L(e,D,t,r)}return t}},_={string:o.stringToC,array:o.arrayToC};function s(e,t,r,n,i){var a=v(e),o=[],s=0;if(n)for(var l=0;l<n.length;l++){var u=_[r[l]];o[l]=u?(0===s&&(s=Fe()),u(n[l])):n[l]}var f,d=a.apply(null,o);return f=d,d="string"===t?T(f):"boolean"===t?Boolean(f):f,0!==s&&Me(s),d}function b(e,t,r,n){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":C[e>>0]=t;break;case"i16":P[e>>1]=t;break;case"i32":U[e>>2]=t;break;case"i64":tempI64=[t>>>0,(tempDouble=t,1<=+ie(tempDouble)?0<tempDouble?(0|se(+oe(tempDouble/4294967296),4294967295))>>>0:~~+ae((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],U[e>>2]=tempI64[0],U[e+4>>2]=tempI64[1];break;case"float":k[e>>2]=t;break;case"double":O[e>>3]=t;break;default:ze("invalid type for setValue: "+r)}}var l=0,S=2,E=4;function u(e,t,r,n){var i,a;a="number"==typeof e?(i=!0,e):(i=!1,e.length);var o,s="string"==typeof t?t:null;if(o=r==E?n:["function"==typeof ke?ke:p,Oe,p,g][void 0===r?S:r](Math.max(a,s?1:t.length)),i){var l;for(y(0==(3&(n=o))),l=o+(-4&a);n<l;n+=4)U[n>>2]=0;for(l=o+a;n<l;)C[n++>>0]=0;return o}if("i8"===s)return e.subarray||e.slice?D.set(e,o):D.set(new Uint8Array(e),o),o;for(var u,f,d,c=0;c<a;){var h=e[c];0!==(u=s||t[c])?("i64"==u&&(u="i32"),b(o+c,h,u),d!==u&&(f=m(u),d=u),c+=f):c++}return o}function w(e){return F?re?ke(e):g(e):p(e)}function T(e,t){if(0===t||!e)return"";for(var r,n=0,i=0;n|=r=D[e+i>>0],(0!=r||t)&&(i++,!t||i!=t););t||(t=i);var a="";if(n<128){for(var o;0<t;)o=String.fromCharCode.apply(String,D.subarray(e,e+Math.min(t,1024))),a=a?a+o:o,e+=1024,t-=1024;return a}return x(D,e)}var A="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function x(e,t){for(var r=t;e[r];)++r;if(16<r-t&&e.subarray&&A)return A.decode(e.subarray(t,r));for(var n,i,a,o,s,l="";;){if(!(n=e[t++]))return l;if(128&n)if(i=63&e[t++],192!=(224&n))if(a=63&e[t++],(n=224==(240&n)?(15&n)<<12|i<<6|a:(o=63&e[t++],240==(248&n)?(7&n)<<18|i<<12|a<<6|o:(s=63&e[t++],248==(252&n)?(3&n)<<24|i<<18|a<<12|o<<6|s:(1&n)<<30|i<<24|a<<18|o<<12|s<<6|63&e[t++])))<65536)l+=String.fromCharCode(n);else{var u=n-65536;l+=String.fromCharCode(55296|u>>10,56320|1023&u)}else l+=String.fromCharCode((31&n)<<6|i);else l+=String.fromCharCode(n)}}function L(e,t,r,n){if(!(0<n))return 0;for(var i=r,a=r+n-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(55296<=s&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),s<=127){if(a<=r)break;t[r++]=s}else if(s<=2047){if(a<=r+1)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(a<=r+2)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else if(s<=2097151){if(a<=r+3)break;t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}else if(s<=67108863){if(a<=r+4)break;t[r++]=248|s>>24,t[r++]=128|s>>18&63,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(a<=r+5)break;t[r++]=252|s>>30,t[r++]=128|s>>24&63,t[r++]=128|s>>18&63,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-i}function R(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);55296<=n&&n<=57343&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++r)),n<=127?++t:t+=n<=2047?2:n<=65535?3:n<=2097151?4:n<=67108863?5:6}return t}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var I,C,D,P,U,k,O,M,F,N,B,z,j=65536,G=16777216,H=16777216;function q(e,t){return 0<e%t&&(e+=t-e%t),e}function V(e){f.buffer=I=e}function W(){f.HEAP8=C=new Int8Array(I),f.HEAP16=P=new Int16Array(I),f.HEAP32=U=new Int32Array(I),f.HEAPU8=D=new Uint8Array(I),f.HEAPU16=new Uint16Array(I),f.HEAPU32=new Uint32Array(I),f.HEAPF32=k=new Float32Array(I),f.HEAPF64=O=new Float64Array(I)}function Y(){var e=f.usingWasm?j:G,t=2147483648-e;if(U[z>>2]>t)return!1;var r=X;for(X=Math.max(X,H);X<U[z>>2];)X=X<=536870912?q(2*X,e):Math.min(q((3*X+2147483648)/4,e),t);var n=f.reallocBuffer(X);return n&&n.byteLength==X?(V(n),W(),!0):(X=r,!1)}M=N=z=0,F=!1,f.reallocBuffer||(f.reallocBuffer=function(e){var t;try{if(ArrayBuffer.transfer)t=ArrayBuffer.transfer(I,e);else{var r=C;t=new ArrayBuffer(e),new Int8Array(t).set(r)}}catch(e){return!1}return!!Pe(t)&&t});try{Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get)(new ArrayBuffer(4))}catch(e){(function(e){return e.byteLength})}var K=f.TOTAL_STACK||5242880,X=f.TOTAL_MEMORY||268435456;function Z(e){for(;0<e.length;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?f.dynCall_v(r):f.dynCall_vi(r,t.arg):r(void 0===t.arg?null:t.arg)}else t()}}X<K&&h("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+X+"! (TOTAL_STACK="+K+")"),f.buffer?I=f.buffer:(I="object"==typeof WebAssembly&&"function"==typeof WebAssembly.Memory?(f.wasmMemory=new WebAssembly.Memory({initial:X/j}),f.wasmMemory.buffer):new ArrayBuffer(X),f.buffer=I),W();var Q=[],J=[],$=[],ee=[],te=[],re=!1;function ne(e,t,r){for(var n=0;n<e.length;++n)C[t++>>0]=e.charCodeAt(n);r||(C[t>>0]=0)}var ie=Math.abs,ae=Math.ceil,oe=Math.floor,se=Math.min,le=Math.trunc,ue=0,fe=null,de=null;f.preloadedImages={},f.preloadedAudios={};var ce="data:application/octet-stream;base64,";function he(e){return String.prototype.startsWith?e.startsWith(ce):0===e.indexOf(ce)}!function(){"function"==typeof f.locateFile&&(he(wasmTextFile)||(wasmTextFile=f.locateFile(wasmTextFile)),he(d)||(d=f.locateFile(d)),he(asmjsCodeFile)||(asmjsCodeFile=f.locateFile(asmjsCodeFile)));var o={global:null,env:null,asm2wasm:i,parent:f},s=null;function l(){try{if(f.wasmBinary)return new Uint8Array(f.wasmBinary);if(f.readBinary)return f.readBinary(d);throw"on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)"}catch(e){ze(e)}}function u(e,t,r){if("object"!=typeof WebAssembly)return h("no native wasm support detected"),!1;if(!(f.wasmMemory instanceof WebAssembly.Memory))return h("no native wasm Memory in use"),!1;function n(e,t){(s=e.exports).memory&&function(e){var t=f.buffer;e.byteLength<t.byteLength&&h("the new buffer in mergeMemory is smaller than the previous one. in native wasm, we should grow memory here");var r=new Int8Array(t);new Int8Array(e).set(r),V(e),W()}(s.memory),f.asm=s,f.usingWasm=!0,function(e){if(ue--,f.monitorRunDependencies&&f.monitorRunDependencies(ue),0==ue&&(null!==fe&&(clearInterval(fe),fe=null),de)){var t=de;de=null,t()}}()}if(t.memory=f.wasmMemory,o.global={NaN:NaN,Infinity:1/0},o["global.Math"]=Math,o.env=t,ue++,f.monitorRunDependencies&&f.monitorRunDependencies(ue),f.instantiateWasm)try{return f.instantiateWasm(o,n)}catch(e){return h("Module.instantiateWasm callback failed with error: "+e),!1}function i(e){n(e.instance,e.module)}function a(e){(f.wasmBinary||"function"!=typeof fetch?new Promise(function(e,t){e(l())}):fetch(d,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+d+"'";return e.arrayBuffer()}).catch(function(){return l()})).then(function(e){return WebAssembly.instantiate(e,o)}).then(e).catch(function(e){h("failed to asynchronously prepare wasm: "+e),ze(e)})}return f.wasmBinary||"function"!=typeof WebAssembly.instantiateStreaming||he(d)||"function"!=typeof fetch?a(i):WebAssembly.instantiateStreaming(fetch(d,{credentials:"same-origin"}),o).then(i).catch(function(e){h("wasm streaming compile failed: "+e),h("falling back to ArrayBuffer instantiation"),a(i)}),{}}f.asmPreload=f.asm,f.reallocBuffer,f.reallocBuffer=function(e){return function(e){e=q(e,f.usingWasm?j:G);var t=f.buffer.byteLength;if(f.usingWasm)try{return-1!==f.wasmMemory.grow((e-t)/65536)?f.buffer=f.wasmMemory.buffer:null}catch(e){return null}}(e)},f.asm=function(e,t,r){var n;if(!(t=t).table){var i=f.wasmTableSize;void 0===i&&(i=1024);var a=f.wasmMaxTableSize;"object"==typeof WebAssembly&&"function"==typeof WebAssembly.Table?t.table=void 0!==a?new WebAssembly.Table({initial:i,maximum:a,element:"anyfunc"}):new WebAssembly.Table({initial:i,element:"anyfunc"}):t.table=new Array(i),f.wasmTable=t.table}return t.memoryBase||(t.memoryBase=f.STATIC_BASE),t.tableBase||(t.tableBase=0),y(n=u(0,t),"no binaryen method succeeded."),n}}(),M=749984,J.push({func:function(){Re()}});f.STATIC_BASE=1024,f.STATIC_BUMP=748960;var pe=M;M+=16;var ge={};var me={varargs:0,get:function(e){return me.varargs+=4,U[me.varargs-4>>2]},getStr:function(){return T(me.get())},get64:function(){var e=me.get(),t=me.get();return y(0<=e?0===t:-1===t),e},getZero:function(){y(0===me.get())}};function ye(e){return f.___errno_location&&(U[f.___errno_location()>>2]=e),e}function ve(e){!function(e,t){if(t&&f.noExitRuntime&&0===e)return;f.noExitRuntime||(a=!0,N=Le,Z(ee),f.onExit&&f.onExit(e));f.quit(e,new Ne(e))}(e)}var _e=ie;var be=u(Ae("GMT"),"i8",S);function Se(e){return Math.pow(2,e)}var Ee=le;function we(){if(!we.called){we.called=!0,U[Ce()>>2]=60*(new Date).getTimezoneOffset();var e=new Date(2e3,0,1),t=new Date(2e3,6,1);U[Ie()>>2]=Number(e.getTimezoneOffset()!=t.getTimezoneOffset());var r=o(e),n=o(t),i=u(Ae(r),"i8",l),a=u(Ae(n),"i8",l);t.getTimezoneOffset()<e.getTimezoneOffset()?(U[De()>>2]=i,U[De()+4>>2]=a):(U[De()>>2]=a,U[De()+4>>2]=i)}function o(e){var t=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return t?t[1]:"GMT"}}var Te=22;function Ae(e,t,r){var n=0<r?r:R(e)+1,i=new Array(n),a=L(e,i,0,i.length);return t&&(i.length=a),i}z=p(4),B=n((N=n(M))+K),U[z>>2]=B,F=!0,f.wasmTableSize=432,f.wasmMaxTableSize=432,f.asmGlobalArg={},f.asmLibraryArg={abort:ze,enlargeMemory:Y,getTotalMemory:function(){return X},abortOnCannotGrowMemory:function(){ze("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+X+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")},___buildEnvironment:function e(t){var r,n;e.called?(n=U[t>>2],r=U[n>>2]):(e.called=!0,ge.USER=ge.LOGNAME="web_user",ge.PATH="/",ge.PWD="/",ge.HOME="/home/web_user",ge.LANG="C.UTF-8",ge._=f.thisProgram,r=w(1024),n=w(256),U[n>>2]=r,U[t>>2]=n);var i=[],a=0;for(var o in ge)if("string"==typeof ge[o]){var s=o+"="+ge[o];i.push(s),a+=s.length}if(1024<a)throw new Error("Environment size exceeded TOTAL_ENV_SIZE!");for(var l=0;l<i.length;l++)ne(s=i[l],r),U[n+4*l>>2]=r,r+=s.length+1;U[n+4*i.length>>2]=0},___setErrNo:ye,___syscall140:function(e,t){me.varargs=t;try{var r=me.getStreamFromFD(),n=(me.get(),me.get()),i=me.get(),a=me.get(),o=n;return FS.llseek(r,o,a),U[i>>2]=r.position,r.getdents&&0===o&&0===a&&(r.getdents=null),0}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||ze(e),-e.errno}},___syscall146:function n(e,t){me.varargs=t;try{var r=me.get(),i=me.get(),a=me.get(),o=0;n.buffers||(n.buffers=[null,[],[]],n.printChar=function(e,t){var r=n.buffers[e];y(r),0===t||10===t?((1===e?c:h)(x(r,0)),r.length=0):r.push(t)});for(var s=0;s<a;s++){for(var l=U[i+8*s>>2],u=U[i+(8*s+4)>>2],f=0;f<u;f++)n.printChar(r,D[l+f]);o+=u}return o}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||ze(e),-e.errno}},___syscall221:function(e,t){me.varargs=t;try{return 0}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||ze(e),-e.errno}},___syscall3:function(e,t){me.varargs=t;try{var r=me.getStreamFromFD(),n=me.get(),i=me.get();return FS.read(r,C,n,i)}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||ze(e),-e.errno}},___syscall5:function(e,t){me.varargs=t;try{var r=me.getStr(),n=me.get(),i=me.get();return FS.open(r,n,i).fd}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||ze(e),-e.errno}},___syscall54:function(e,t){me.varargs=t;try{return 0}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||ze(e),-e.errno}},___syscall6:function(e,t){me.varargs=t;try{var r=me.getStreamFromFD();return FS.close(r),0}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||ze(e),-e.errno}},_abort:function(){f.abort()},_clock:function e(){return void 0===e.start&&(e.start=Date.now()),1e3*(Date.now()-e.start)|0},_emscripten_memcpy_big:function(e,t,r){return D.set(D.subarray(t,t+r),e),e},_exit:function(e){ve(e)},_fabs:_e,_getenv:function e(t){return 0===t?0:(t=T(t),ge.hasOwnProperty(t)?(e.ret&&Ue(e.ret),e.ret=(r=ge[t],n=R(r)+1,(i=ke(n))&&L(r,C,i,n),i)):0);var r,n,i},_gettimeofday:function(e){var t=Date.now();return U[e>>2]=t/1e3|0,U[e+4>>2]=t%1e3*1e3|0,0},_gmtime_r:function(e,t){var r=new Date(1e3*U[e>>2]);U[t>>2]=r.getUTCSeconds(),U[t+4>>2]=r.getUTCMinutes(),U[t+8>>2]=r.getUTCHours(),U[t+12>>2]=r.getUTCDate(),U[t+16>>2]=r.getUTCMonth(),U[t+20>>2]=r.getUTCFullYear()-1900,U[t+24>>2]=r.getUTCDay(),U[t+36>>2]=0,U[t+32>>2]=0;var n=Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0),i=(r.getTime()-n)/864e5|0;return U[t+28>>2]=i,U[t+40>>2]=be,t},_llvm_exp2_f32:Se,_llvm_exp2_f64:function(){return Se.apply(null,arguments)},_llvm_log2_f32:function(e){return Math.log(e)/Math.LN2},_llvm_trunc_f64:Ee,_localtime_r:function(e,t){we();var r=new Date(1e3*U[e>>2]);U[t>>2]=r.getSeconds(),U[t+4>>2]=r.getMinutes(),U[t+8>>2]=r.getHours(),U[t+12>>2]=r.getDate(),U[t+16>>2]=r.getMonth(),U[t+20>>2]=r.getFullYear()-1900,U[t+24>>2]=r.getDay();var n=new Date(r.getFullYear(),0,1),i=(r.getTime()-n.getTime())/864e5|0;U[t+28>>2]=i,U[t+36>>2]=-60*r.getTimezoneOffset();var a=new Date(2e3,6,1).getTimezoneOffset(),o=n.getTimezoneOffset(),s=0|(a!=o&&r.getTimezoneOffset()==Math.min(o,a));U[t+32>>2]=s;var l=U[De()+(s?4:0)>>2];return U[t+40>>2]=l,t},_mktime:function(e){we();var t=new Date(U[e+20>>2]+1900,U[e+16>>2],U[e+12>>2],U[e+8>>2],U[e+4>>2],U[e>>2],0),r=U[e+32>>2],n=t.getTimezoneOffset(),i=new Date(t.getFullYear(),0,1),a=new Date(2e3,6,1).getTimezoneOffset(),o=i.getTimezoneOffset(),s=Math.min(o,a);if(r<0)U[e+32>>2]=Number(a!=o&&s==n);else if(0<r!=(s==n)){var l=Math.max(o,a),u=0<r?s:l;t.setTime(t.getTime()+6e4*(u-n))}U[e+24>>2]=t.getDay();var f=(t.getTime()-i.getTime())/864e5|0;return U[e+28>>2]=f,t.getTime()/1e3|0},_pthread_cond_destroy:function(){return 0},_pthread_cond_init:function(){return 0},_pthread_cond_signal:function(){return 0},_pthread_cond_wait:function(){return 0},_pthread_create:function(){return 11},_pthread_join:function(){},_pthread_mutex_destroy:function(){},_pthread_mutex_init:function(){},_pthread_once:function e(t,r){e.seen||(e.seen={}),t in e.seen||(f.dynCall_v(r),e.seen[t]=1)},_sysconf:function(e){switch(e){case 30:return 16384;case 85:return 131068;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator&&navigator.hardwareConcurrency||1}return ye(Te),-1},DYNAMICTOP_PTR:z,tempDoublePtr:pe,STACKTOP:N};var xe=f.asm(f.asmGlobalArg,f.asmLibraryArg,I);f.asm=xe;var Le,Re=f.___emscripten_environ_constructor=function(){return f.asm.___emscripten_environ_constructor.apply(null,arguments)},Ie=f.__get_daylight=function(){return f.asm.__get_daylight.apply(null,arguments)},Ce=f.__get_timezone=function(){return f.asm.__get_timezone.apply(null,arguments)},De=f.__get_tzname=function(){return f.asm.__get_tzname.apply(null,arguments)},Pe=f._emscripten_replace_memory=function(){return f.asm._emscripten_replace_memory.apply(null,arguments)},Ue=f._free=function(){return f.asm._free.apply(null,arguments)},ke=f._malloc=function(){return f.asm._malloc.apply(null,arguments)},Oe=(f._pcm2aac=function(){return f.asm._pcm2aac.apply(null,arguments)},f.stackAlloc=function(){return f.asm.stackAlloc.apply(null,arguments)}),Me=f.stackRestore=function(){return f.asm.stackRestore.apply(null,arguments)},Fe=f.stackSave=function(){return f.asm.stackSave.apply(null,arguments)};f.dynCall_v=function(){return f.asm.dynCall_v.apply(null,arguments)},f.dynCall_vi=function(){return f.asm.dynCall_vi.apply(null,arguments)};function Ne(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Be(e){function t(){f.calledRun||(f.calledRun=!0,a||(re||(re=!0,Z(J)),Z($),f.onRuntimeInitialized&&f.onRuntimeInitialized(),function(){if(f.postRun)for("function"==typeof f.postRun&&(f.postRun=[f.postRun]);f.postRun.length;)e=f.postRun.shift(),te.unshift(e);var e;Z(te)}()))}e=e||f.arguments,0<ue||(!function(){if(f.preRun)for("function"==typeof f.preRun&&(f.preRun=[f.preRun]);f.preRun.length;)e=f.preRun.shift(),Q.unshift(e);var e;Z(Q)}(),0<ue||f.calledRun||(f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1),t()},1)):t()))}function ze(e){throw f.onAbort&&f.onAbort(e),e=void 0!==e?(c(e),h(e),JSON.stringify(e)):"",a=!0,"abort("+e+"). Build with -s ASSERTIONS=1 for more info."}if(f.asm=xe,f.ccall=s,f.cwrap=function(e,t,r,n){var i=(r=r||[]).every(function(e){return"number"===e});return"string"!==t&&i&&!n?v(e):function(){return s(e,t,r,arguments)}},(Ne.prototype=new Error).constructor=Ne,de=function e(){f.calledRun||Be(),f.calledRun||(de=e)},f.run=Be,f.abort=ze,f.preInit)for("function"==typeof f.preInit&&(f.preInit=[f.preInit]);0<f.preInit.length;)f.preInit.pop()();f.noExitRuntime=!0,Be()})};return function(r){function e(e){var t=r.call(this)||this;return t._isReady=!1,qi.setLevel(void 0===e.loggerLevel?is.loggerLevel:e.loggerLevel),qi.debug("browser",us),t.processConfig(e),qi.debug("final config",t.config),t.init(),t.initEngine().catch(function(e){t.emitError(e)}),t}return t(e,r),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this.engine?this.engine.render.currentTime:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"totalTime",{get:function(){return this.engine?this.engine.render.totalTime:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){if(this.engine)return this.engine.render.buffered},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this.render.volume},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isFullscreen",{get:function(){return!!this.fullscreenController&&this.fullscreenController.isFullScreen},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isPlay",{get:function(){return!!this.engine&&this.engine.render.isPlay},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isPause",{get:function(){return!!this.engine&&this.engine.render.isPause},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEnded",{get:function(){return!!this.engine&&this.engine.render.isEnd},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isMuted",{get:function(){return this.render.isMuted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLoop",{get:function(){return this.render.isLoop},enumerable:!0,configurable:!0}),e.prototype.play=function(){this._isReady&&this.engine?this.engine.render.play():qi.warning("player is not ready")},e.prototype.pause=function(){this._isReady&&this.engine?this.engine.render.pause():qi.warning("player is not ready")},e.prototype.seek=function(e){this._isReady&&this.engine?this.engine.render.seek(e):qi.warning("player is not ready")},e.prototype.toggleFullscreen=function(){this.fullscreenController&&this.fullscreenController.toggle()},e.prototype.toggleMute=function(){this.render.toggleMute()},e.prototype.toggleLoop=function(){this.render.toggleLoop()},e.prototype.setVolume=function(e){this.render.setVolume(e)},e.prototype.setPlaybackRate=function(e){this.render.setPlaybackRate(e)},e.prototype.getCurrentFrame=function(){return this.render.getCurrentFrame()},e.prototype.sendNotification=function(e,t){void 0===t&&(t=3e3),this.emit("notification",{message:e,timeout:t})},e.prototype.replaceEngineAndRender=function(e,t){if(this.engine){var r=this.render.isMuted;t.setVolume(this.render.volume),t.setPlaybackRate(this.render.playbackRate),this.engine.destroy(),this.render.destroy(),this.render=t,this.engine=e,this.view?(this.render.setContainer(this.view.getVideoElementSlot()),this.fullscreenController&&this.fullscreenController.changeContainer(this.view.getContainerElementSlot(),this.render.video)):(this.render.video.controls=!0,this.render.setContainer(this.config.container),this.fullscreenController&&this.fullscreenController.changeContainer(this.render.video,this.render.video)),r!==this.render.isMuted&&this.render.toggleMute(),this.emit("loading",this.render.isLoading),this.handleEngineEvents(e,t),this.render.play(),this.emit("play")}},e.prototype.destroy=function(){this.qualityController&&this.qualityController.destroy(),this.view&&this.view.destroy(),this.render.destroy(),this.engine&&this.engine.destroy()},e.prototype.processConfig=function(e){var t=ps({},is);if(this.config=ps(a({},t),e),!this.config.url&&!this.config.qualityList)throw new Li(Si.COMMON,wi.INVALID_CONFIG,"can not find url in config!");if(this.config.qualityList&&0===this.config.qualityList.length)throw new Li(Si.COMMON,wi.INVALID_CONFIG,"qualityList is empty!");this.config.url&&this.config.qualityList&&(qi.warning("qualityList will be ignored"),this.config.qualityList=void 0),this.config.qualityList&&(this.config.qualityList=this.config.qualityList.map(function(e,t){return e.id=t,e})),this.config.hls&&this.config.hls.DRMKey&&(this.config.hls.DRMKey=new Uint8Array(this.config.hls.DRMKey)),this.currentURL=this.config.url||this.config.qualityList[0].url},e.prototype.init=function(){var e=void 0,t=this.config.container;this.config.container instanceof HTMLVideoElement&&(t=(e=this.config.container).parentElement?e.parentElement:document.body),this.render=new gs({autoplay:this.config.autoplay,muted:this.config.muted,volume:this.config.volume,poster:this.config.poster,anonymous:this.config.anonymous},e),this.config.view?(this.view=this.config.view,this.config.view.init(this,!cs.playsinline,t),this.render.setContainer(this.view.getVideoElementSlot())):(this.render.video.controls=!0,this.render.setContainer(this.config.container)),this.view?this.fullscreenController=new as(this.view.getContainerElementSlot(),this.render.video):this.fullscreenController=new as(this.render.video,this.render.video)},e.prototype.getEngineFromURL=function(s,l){return u(this,void 0,void 0,function(){var t,r,n,i,a,o;return f(this,function(e){switch(e.label){case 0:return[4,ys(s)];case 1:for(t=e.sent(),qi.verbose("get content type",t),r=null,n=0,i=[Vi,Ca,Da];n<i.length;n++)if((a=i[n]).isSupport(this.config))try{if(a.probe(s,t||"",this.config)){r=a;break}}catch(e){qi.warning("probe engine faild",e);continue}if(!r)throw new Li(Si.COMMON,wi.UNKNOWN_FORMAT,"can not parse "+this.config.url);return this.config.hls&&this.config.hls.isG711?[4,function(o,s,l){return u(this,void 0,void 0,function(){var t,r,n,i,a;return f(this,function(e){switch(e.label){case 0:return t={},2<=s.loggerLevel&&(t.printErr=function(){}),3<=s.loggerLevel&&(t.print=function(){}),[4,vs.getItem(o+":"+l)];case 1:return(r=e.sent())?(t.wasmBinary=r,[4,_s(t)]):[3,3];case 2:return[2,e.sent()];case 3:if(!(n=s[o]))throw qi.warning("can not find wasm path in config!"),new Li(Si.COMMON,wi.CAN_NOT_FETCH_WASM,"no path");e.label=4;case 4:return e.trys.push([4,9,,10]),[4,fetch(n,{credentials:"same-origin"})];case 5:return[4,e.sent().arrayBuffer()];case 6:return i=e.sent(),t.wasmBinary=i,[4,vs.setItem(o+":"+l,i)];case 7:return e.sent(),[4,_s(t)];case 8:return[2,e.sent()];case 9:throw a=e.sent(),new Li(Si.COMMON,wi.CAN_NOT_FETCH_WASM,a.toString());case 10:return[2]}})})}("g711Wasm",this.config,"1.1.0")]:[3,3];case 2:o=e.sent(),this.config.hls.g711WasmModule=o,e.label=3;case 3:return[2,new r(l,r.playConfigToEngineConfig(s,this.config))]}})})},e.prototype.initEngine=function(){return u(this,void 0,void 0,function(){var t;return f(this,function(e){switch(e.label){case 0:return[4,(t=this).getEngineFromURL(this.currentURL,this.render)];case 1:return t.engine=e.sent(),this.qualityController=new ms(this),this.handleEngineEvents(this.engine,this.render),this.handleControllerEvents(),[2]}})})},e.prototype.handleEngineEvents=function(e,t){for(var n=this,r=t.eventList.filter(function(e){return"#"===e[0]}),i=function(r){t.on(r,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];n.emit.apply(n,[r.slice(1,r.length)].concat(e))})},a=0,o=r;a<o.length;a++){i(o[a])}for(var s=function(r){e.on(r,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];n.emit.apply(n,[r.slice(1,r.length)].concat(e)),qi.verbose.apply(qi,[r.slice(1,r.length)].concat(e))})},l=0,u=r=e.eventList.filter(function(e){return"#"===e[0]});l<u.length;l++){s(u[l])}e.once("ready",function(e){n._isReady=!0,n.emit("ready",e),qi.debug("event: player ready",e)}),cs.fakeReady&&(window.WeixinJSBridge?window.WeixinJSBridge.invoke("getNetworkType",{},function(){n._isReady=!0,n.emit("ready",0),n.config.autoplay&&(console.log("weixin auto play"),n.render.video.load(),n.render.video.play()),qi.debug("event: player ready",0)},!1):document.addEventListener("WeixinJSBridgeReady",function(){window.WeixinJSBridge.invoke("getNetworkType",{},function(){n._isReady=!0,n.emit("ready",0),n.config.autoplay&&(n.render.video.load(),n.render.video.play(),console.log("weixin auto play")),qi.debug("event: player ready",0)},!1)},!1)),e.on("error",this.emitError.bind(this)),t.on("error",this.emitError.bind(this))},e.prototype.handleControllerEvents=function(){var e=this;this.fullscreenController&&this.fullscreenController.on("fullscreenchange",function(){e.fullscreenController&&(e.emit("fullscreenchange",e.fullscreenController.isFullScreen),qi.verbose("fullscreen change",e.fullscreenController.isFullScreen))})},e.prototype.emitError=function(e){10005===e.code&&this.engine&&(qi.debug("reload engine"),this.engine.reload()),this.emit("error",e)},e}(Ui)});