qiniu-web.js 514 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 d(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,i=function(e){return r.call(e).slice(8,-1)},o="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function f(){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 s(e,t){return e(t={exports:{}},t.exports),t.exports}var l="object",c=function(e){return e&&e.Math==Math&&e},h=c(typeof globalThis==l&&globalThis)||c(typeof window==l&&window)||c(typeof self==l&&self)||c(typeof o==l&&o)||Function("return this")(),p=function(e){try{return!!e()}catch(e){return!0}},m=!p(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),g=function(e){return"object"==typeof e?null!==e:"function"==typeof e},y=h.document,v=g(y)&&g(y.createElement),_=function(e){return v?y.createElement(e):{}},b=!m&&!p(function(){return 7!=Object.defineProperty(_("div"),"a",{get:function(){return 7}}).a}),S=function(e){if(!g(e))throw TypeError(String(e)+" is not an object");return e},E=function(e,t){if(!g(e))return e;var r,n;if(t&&"function"==typeof(r=e.toString)&&!g(n=r.call(e)))return n;if("function"==typeof(r=e.valueOf)&&!g(n=r.call(e)))return n;if(!t&&"function"==typeof(r=e.toString)&&!g(n=r.call(e)))return n;throw TypeError("Can't convert object to primitive value")},w=Object.defineProperty,T={f:m?w:function(e,t,r){if(S(e),t=E(t,!0),S(r),b)try{return w(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}},A=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},x=m?function(e,t,r){return T.f(e,t,A(1,r))}:function(e,t,r){return e[t]=r,e},L=function(t,r){try{x(h,t,r)}catch(e){h[t]=r}return r},I=s(function(e){var t="__core-js_shared__",r=h[t]||L(t,{});(e.exports=function(e,t){return r[e]||(r[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.1.1",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),R=0,C=Math.random(),D=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++R+C).toString(36))},U=!!Object.getOwnPropertySymbols&&!p(function(){return!String(Symbol())}),P=I("wks"),k=h.Symbol,O=function(e){return P[e]||(P[e]=U&&k[e]||(U?k:D)("Symbol."+e))},M=O("toStringTag"),F="Arguments"==i(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),M))?r:F?i(t):"Object"==(n=i(t))&&"function"==typeof t.callee?"Arguments":n},N={};N[O("toStringTag")]="z";var z,j,G,H="[object z]"!==String(N)?function(){return"[object "+B(this)+"]"}:N.toString,q={}.hasOwnProperty,V=function(e,t){return q.call(e,t)},W=I("native-function-to-string",Function.toString),Y=h.WeakMap,K="function"==typeof Y&&/native code/.test(W.call(Y)),X=I("keys"),Z=function(e){return X[e]||(X[e]=D(e))},Q={},J=h.WeakMap;if(K){var $=new J,ee=$.get,te=$.has,re=$.set;z=function(e,t){return re.call($,e,t),t},j=function(e){return ee.call($,e)||{}},G=function(e){return te.call($,e)}}else{var ne=Z("state");Q[ne]=!0,z=function(e,t){return x(e,ne,t),t},j=function(e){return V(e,ne)?e[ne]:{}},G=function(e){return V(e,ne)}}var ie={set:z,get:j,has:G,enforce:function(e){return G(e)?j(e):z(e,{})},getterFor:function(r){return function(e){var t;if(!g(e)||(t=j(e)).type!==r)throw TypeError("Incompatible receiver, "+r+" required");return t}}},ae=s(function(e){var t=ie.get,s=ie.enforce,l=String(W).split("toString");I("inspectSource",function(e){return W.call(e)}),(e.exports=function(e,t,r,n){var i=!!n&&!!n.unsafe,a=!!n&&!!n.enumerable,o=!!n&&!!n.noTargetGet;"function"==typeof r&&("string"!=typeof t||V(r,"name")||x(r,"name",t),s(r).source=l.join("string"==typeof t?t:"")),e!==h?(i?!o&&e[t]&&(a=!0):delete e[t],a?e[t]=r:x(e,t,r)):a?e[t]=r:L(t,r)})(Function.prototype,"toString",function(){return"function"==typeof this&&t(this).source||W.call(this)})}),oe=Object.prototype;H!==oe.toString&&ae(oe,"toString",H,{unsafe:!0});var se,le,ue,de,fe=Math.ceil,ce=Math.floor,he=function(e){return isNaN(e=+e)?0:(0<e?ce:fe)(e)},pe=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},me={}.propertyIsEnumerable,ge=Object.getOwnPropertyDescriptor,ye={f:ge&&!me.call({1:2},1)?function(e){var t=ge(this,e);return!!t&&t.enumerable}:me},ve="".split,_e=p(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return"String"==i(e)?ve.call(e,""):Object(e)}:Object,be=function(e){return _e(pe(e))},Se=Object.getOwnPropertyDescriptor,Ee={f:m?Se:function(e,t){if(e=be(e),t=E(t,!0),b)try{return Se(e,t)}catch(e){}if(V(e,t))return A(!ye.f.call(e,t),e[t])}},we=Math.min,Te=function(e){return 0<e?we(he(e),9007199254740991):0},Ae=Math.max,xe=Math.min,Le=(se=!1,function(e,t,r){var n,i,a,o=be(e),s=Te(o.length),l=(n=s,(i=he(r))<0?Ae(i+n,0):xe(i,n));if(se&&t!=t){for(;l<s;)if((a=o[l++])!=a)return!0}else for(;l<s;l++)if((se||l in o)&&o[l]===t)return se||l||0;return!se&&-1}),Ie=function(e,t){var r,n=be(e),i=0,a=[];for(r in n)!V(Q,r)&&V(n,r)&&a.push(r);for(;t.length>i;)V(n,r=t[i++])&&(~Le(a,r)||a.push(r));return a},Re=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ce=Re.concat("length","prototype"),De={f:Object.getOwnPropertyNames||function(e){return Ie(e,Ce)}},Ue={f:Object.getOwnPropertySymbols},Pe=h.Reflect,ke=Pe&&Pe.ownKeys||function(e){var t=De.f(S(e)),r=Ue.f;return r?t.concat(r(e)):t},Oe=function(e,t){for(var r=ke(t),n=T.f,i=Ee.f,a=0;a<r.length;a++){var o=r[a];V(e,o)||n(e,o,i(t,o))}},Me=/#|\.prototype\./,Fe=function(e,t){var r=Ne[Be(e)];return r==je||r!=ze&&("function"==typeof t?p(t):!!t)},Be=Fe.normalize=function(e){return String(e).replace(Me,".").toLowerCase()},Ne=Fe.data={},ze=Fe.NATIVE="N",je=Fe.POLYFILL="P",Ge=Fe,He=Ee.f,qe=function(e,t){var r,n,i,a,o,s=e.target,l=e.global,u=e.stat;if(r=l?h:u?h[s]||L(s,{}):(h[s]||{}).prototype)for(n in t){if(a=t[n],i=e.noTargetGet?(o=He(r,n))&&o.value:r[n],!Ge(l?n:s+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof a==typeof i)continue;Oe(a,i)}(e.sham||i&&i.sham)&&x(a,"sham",!0),ae(r,n,a,e)}},Ve=function(e){return Object(pe(e))},We=!p(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Ye=Z("IE_PROTO"),Ke=Object.prototype,Xe=We?Object.getPrototypeOf:function(e){return e=Ve(e),V(e,Ye)?e[Ye]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?Ke:null},Ze=O("iterator"),Qe=!1;[].keys&&("next"in(de=[].keys())?(ue=Xe(Xe(de)))!==Object.prototype&&(le=ue):Qe=!0),null==le&&(le={}),V(le,Ze)||x(le,Ze,function(){return this});var Je={IteratorPrototype:le,BUGGY_SAFARI_ITERATORS:Qe},$e=Object.keys||function(e){return Ie(e,Re)},et=m?Object.defineProperties:function(e,t){S(e);for(var r,n=$e(t),i=n.length,a=0;a<i;)T.f(e,r=n[a++],t[r]);return e},tt=h.document,rt=tt&&tt.documentElement,nt=Z("IE_PROTO"),it="prototype",at=function(){},ot=function(){var e,t=_("iframe"),r=Re.length,n="script";for(t.style.display="none",rt.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write("<script>document.F=Object</"+n+">"),e.close(),ot=e.F;r--;)delete ot[it][Re[r]];return ot()},st=Object.create||function(e,t){var r;return null!==e?(at[it]=S(e),r=new at,at[it]=null,r[nt]=e):r=ot(),void 0===t?r:et(r,t)};Q[nt]=!0;var lt=T.f,ut=O("toStringTag"),dt=function(e,t,r){e&&!V(e=r?e:e.prototype,ut)&&lt(e,ut,{configurable:!0,value:t})},ft={},ct=Je.IteratorPrototype,ht=function(){return this},pt=Object.setPrototypeOf||("__proto__"in{}?function(){var r,n=!1,e={};try{(r=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(e,[]),n=e instanceof Array}catch(e){}return function(e,t){return function(e,t){if(S(e),!g(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(e,t),n?r.call(e,t):e.__proto__=t,e}}():void 0),mt=O("iterator"),gt=Je.IteratorPrototype,yt=Je.BUGGY_SAFARI_ITERATORS,vt="values",_t="entries",bt=function(){return this},St=function(e,t,r,n,i,a,o){var s,l,u;l=n,u=t+" Iterator",(s=r).prototype=st(ct,{next:A(1,l)}),dt(s,u,!1),ft[u]=ht;var d,f,c,h=function(e){if(e===i&&v)return v;if(!yt&&e in g)return g[e];switch(e){case"keys":case vt:case _t:return function(){return new r(this,e)}}return function(){return new r(this)}},p=t+" Iterator",m=!1,g=e.prototype,y=g[mt]||g["@@iterator"]||i&&g[i],v=!yt&&y||h(i),_="Array"==t&&g.entries||y;if(_&&(d=Xe(_.call(new e)),gt!==Object.prototype&&d.next&&(Xe(d)!==gt&&(pt?pt(d,gt):"function"!=typeof d[mt]&&x(d,mt,bt)),dt(d,p,!0))),i==vt&&y&&y.name!==vt&&(m=!0,v=function(){return y.call(this)}),g[mt]!==v&&x(g,mt,v),ft[t]=v,i)if(f={values:h(vt),keys:a?v:h("keys"),entries:h(_t)},o)for(c in f)!yt&&!m&&c in g||ae(g,c,f[c]);else qe({target:t,proto:!0,forced:yt||m},f);return f},Et="String Iterator",wt=ie.set,Tt=ie.getterFor(Et);St(String,"String",function(e){wt(this,{type:Et,string:String(e),index:0})},function(){var e,t,r,n,i,a,o,s,l=Tt(this),u=l.string,d=l.index;return d>=u.length?{value:void 0,done:!0}:(t=d,r=!0,a=String(pe(u)),o=he(t),s=a.length,e=o<0||s<=o?r?"":void 0:(n=a.charCodeAt(o))<55296||56319<n||o+1===s||(i=a.charCodeAt(o+1))<56320||57343<i?r?a.charAt(o):n:r?a.slice(o,o+2):i-56320+(n-55296<<10)+65536,l.index+=e.length,{value:e,done:!1})});var At={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},xt=O("unscopables"),Lt=Array.prototype;null==Lt[xt]&&x(Lt,xt,st(null));var It=function(e){Lt[xt][e]=!0},Rt="Array Iterator",Ct=ie.set,Dt=ie.getterFor(Rt),Ut=St(Array,"Array",function(e,t){Ct(this,{type:Rt,target:be(e),index:0,kind:t})},function(){var e=Dt(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?{value:e.target=void 0,done:!0}:"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}},"values");ft.Arguments=ft.Array,It("keys"),It("values"),It("entries");var Pt=O("iterator"),kt=O("toStringTag"),Ot=Ut.values;for(var Mt in At){var Ft=h[Mt],Bt=Ft&&Ft.prototype;if(Bt){if(Bt[Pt]!==Ot)try{x(Bt,Pt,Ot)}catch(e){Bt[Pt]=Ot}if(Bt[kt]||x(Bt,kt,Mt),At[Mt])for(var Nt in Ut)if(Bt[Nt]!==Ut[Nt])try{x(Bt,Nt,Ut[Nt])}catch(e){Bt[Nt]=Ut[Nt]}}}var zt,jt,Gt,Ht=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},qt=O("iterator"),Vt=Array.prototype,Wt=function(n,i,e){if(Ht(n),void 0===i)return n;switch(e){case 0:return function(){return n.call(i)};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)}},Yt=O("iterator"),Kt=function(t,e,r,n){try{return n?e(S(r)[0],r[1]):e(r)}catch(e){var i=t.return;throw void 0!==i&&S(i.call(t)),e}},Xt=s(function(e){var c={};(e.exports=function(e,t,r,n,i){var a,o,s,l,u,d,f=Wt(t,r,n?2:1);if(i)a=e;else{if("function"!=typeof(o=function(e){if(null!=e)return e[Yt]||e["@@iterator"]||ft[B(e)]}(e)))throw TypeError("Target is not iterable");if(void 0!==(d=o)&&(ft.Array===d||Vt[qt]===d)){for(s=0,l=Te(e.length);s<l;s++)if((n?f(S(u=e[s])[0],u[1]):f(e[s]))===c)return c;return}a=o.call(e)}for(;!(u=a.next()).done;)if(Kt(a,f,u.value,n)===c)return c}).BREAK=c}),Zt=O("iterator"),Qt=O("species"),Jt=function(e,t){var r,n=S(e).constructor;return void 0===n||null==(r=S(n)[Qt])?t:Ht(r)},$t=h.location,er=h.setImmediate,tr=h.clearImmediate,rr=h.process,nr=h.MessageChannel,ir=h.Dispatch,ar=0,or={},sr="onreadystatechange",lr=function(e){if(or.hasOwnProperty(e)){var t=or[e];delete or[e],t()}},ur=function(e){return function(){lr(e)}},dr=function(e){lr(e.data)},fr=function(e){h.postMessage(e+"",$t.protocol+"//"+$t.host)};er&&tr||(er=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);return or[++ar]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},zt(ar),ar},tr=function(e){delete or[e]},"process"==i(rr)?zt=function(e){rr.nextTick(ur(e))}:ir&&ir.now?zt=function(e){ir.now(ur(e))}:nr?(Gt=(jt=new nr).port2,jt.port1.onmessage=dr,zt=Wt(Gt.postMessage,Gt,1)):!h.addEventListener||"function"!=typeof postMessage||h.importScripts||p(fr)?zt=sr in _("script")?function(e){rt.appendChild(_("script"))[sr]=function(){rt.removeChild(this),lr(e)}}:function(e){setTimeout(ur(e),0)}:(zt=fr,h.addEventListener("message",dr,!1)));var cr,hr,pr,mr,gr,yr,vr,_r={set:er,clear:tr},br=h.navigator,Sr=br&&br.userAgent||"",Er=Ee.f,wr=_r.set,Tr=h.MutationObserver||h.WebKitMutationObserver,Ar=h.process,xr=h.Promise,Lr="process"==i(Ar),Ir=Er(h,"queueMicrotask"),Rr=Ir&&Ir.value;Rr||(cr=function(){var e,t;for(Lr&&(e=Ar.domain)&&e.exit();hr;){t=hr.fn,hr=hr.next;try{t()}catch(e){throw hr?mr():pr=void 0,e}}pr=void 0,e&&e.enter()},mr=Lr?function(){Ar.nextTick(cr)}:Tr&&!/(iphone|ipod|ipad).*applewebkit/i.test(Sr)?(gr=!0,yr=document.createTextNode(""),new Tr(cr).observe(yr,{characterData:!0}),function(){yr.data=gr=!gr}):xr&&xr.resolve?(vr=xr.resolve(void 0),function(){vr.then(cr)}):function(){wr.call(h,cr)});var Cr,Dr,Ur,Pr,kr,Or=Rr||function(e){var t={fn:e,next:void 0};pr&&(pr.next=t),hr||(hr=t,mr()),pr=t},Mr=function(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=Ht(r),this.reject=Ht(n)},Fr={f:function(e){return new Mr(e)}},Br=function(e,t){if(S(e),g(t)&&t.constructor===e)return t;var r=Fr.f(e);return(0,r.resolve)(t),r.promise},Nr=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},zr=h,jr=function(e){return"function"==typeof e?e:void 0},Gr=function(e,t){return arguments.length<2?jr(zr[e])||jr(h[e]):zr[e]&&zr[e][t]||h[e]&&h[e][t]},Hr=O("species"),qr="Promise",Vr=_r.set,Wr=O("species"),Yr=ie.get,Kr=ie.set,Xr=ie.getterFor(qr),Zr=h[qr],Qr=h.TypeError,Jr=h.document,$r=h.process,en=h.fetch,tn=$r&&$r.versions,rn=tn&&tn.v8||"",nn=Fr.f,an=nn,on="process"==i($r),sn=!!(Jr&&Jr.createEvent&&h.dispatchEvent),ln="unhandledrejection",un=Ge(qr,function(){var e=Zr.resolve(1),t=function(){},r=(e.constructor={})[Wr]=function(e){e(t,t)};return!((on||"function"==typeof PromiseRejectionEvent)&&e.then(t)instanceof r&&0!==rn.indexOf("6.6")&&-1===Sr.indexOf("Chrome/66"))}),dn=un||!function(e,t){if(!t)return!1;var r=!1;try{var n={};n[Zt]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r}(function(e){Zr.all(e).catch(function(){})}),fn=function(e){var t;return!(!g(e)||"function"!=typeof(t=e.then))&&t},cn=function(d,f,r){if(!f.notified){f.notified=!0;var n=f.reactions;Or(function(){for(var l=f.value,u=1==f.state,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.rejection&&gn(d,f),f.rejection=1),!0===i?t=l:(s&&s.enter(),t=i(l),s&&(s.exit(),n=!0)),t===e.promise?o(Qr("Promise-chain cycle")):(r=fn(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.reactions=[],f.notified=!1,r&&!f.rejection&&pn(d,f)})}},hn=function(e,t,r){var n,i;sn?((n=Jr.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),h.dispatchEvent(n)):n={promise:t,reason:r},(i=h["on"+e])?i(n):e===ln&&function(e,t){var r=h.console;r&&r.error&&(1===arguments.length?r.error(e):r.error(e,t))}("Unhandled promise rejection",r)},pn=function(r,n){Vr.call(h,function(){var e,t=n.value;if(mn(n)&&(e=Nr(function(){on?$r.emit("unhandledRejection",t,r):hn(ln,r,t)}),n.rejection=on||mn(n)?2:1,e.error))throw e.value})},mn=function(e){return 1!==e.rejection&&!e.parent},gn=function(e,t){Vr.call(h,function(){on?$r.emit("rejectionHandled",e):hn("rejectionhandled",e,t.value)})},yn=function(t,r,n,i){return function(e){t(r,n,e,i)}},vn=function(e,t,r,n){t.done||(t.done=!0,n&&(t=n),t.value=r,t.state=2,cn(e,t,!0))},_n=function(r,n,e,t){if(!n.done){n.done=!0,t&&(n=t);try{if(r===e)throw Qr("Promise can't be resolved itself");var i=fn(e);i?Or(function(){var t={done:!1};try{i.call(e,yn(_n,r,t,n),yn(vn,r,t,n))}catch(e){vn(r,t,e,n)}}):(n.value=e,n.state=1,cn(r,n,!1))}catch(e){vn(r,{done:!1},e,n)}}};un&&(Zr=function(e){!function(e,t,r){if(!(e instanceof t))throw TypeError("Incorrect "+(r?r+" ":"")+"invocation")}(this,Zr,qr),Ht(e),Cr.call(this);var t=Yr(this);try{e(yn(_n,this,t),yn(vn,this,t))}catch(e){vn(this,t,e)}},(Cr=function(e){Kr(this,{type:qr,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=function(e,t,r){for(var n in t)ae(e,n,t[n],r);return e}(Zr.prototype,{then:function(e,t){var r=Xr(this),n=nn(Jt(this,Zr));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=on?$r.domain:void 0,r.parent=!0,r.reactions.push(n),0!=r.state&&cn(this,r,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),Dr=function(){var e=new Cr,t=Yr(e);this.promise=e,this.resolve=yn(_n,e,t),this.reject=yn(vn,e,t)},Fr.f=nn=function(e){return e===Zr||e===Ur?new Dr(e):an(e)},"function"==typeof en&&qe({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Br(Zr,en.apply(h,arguments))}})),qe({global:!0,wrap:!0,forced:un},{Promise:Zr}),dt(Zr,qr,!1),Pr=Gr(qr),kr=T.f,m&&Pr&&!Pr[Hr]&&kr(Pr,Hr,{configurable:!0,get:function(){return this}}),Ur=zr[qr],qe({target:qr,stat:!0,forced:un},{reject:function(e){var t=nn(this);return t.reject.call(void 0,e),t.promise}}),qe({target:qr,stat:!0,forced:un},{resolve:function(e){return Br(this,e)}}),qe({target:qr,stat:!0,forced:dn},{all:function(e){var s=this,t=nn(s),l=t.resolve,u=t.reject,r=Nr(function(){var n=Ht(s.resolve),i=[],a=0,o=1;Xt(e,function(e){var t=a++,r=!1;i.push(void 0),o++,n.call(s,e).then(function(e){r||(r=!0,i[t]=e,--o||l(i))},u)}),--o||l(i)});return r.error&&u(r.value),t.promise},race:function(e){var r=this,n=nn(r),i=n.reject,t=Nr(function(){var t=Ht(r.resolve);Xt(e,function(e){t.call(r,e).then(n.resolve,i)})});return t.error&&i(t.value),n.promise}}),qe({target:"Promise",proto:!0,real:!0},{finally:function(t){var r=Jt(this,Gr("Promise")),e="function"==typeof t;return this.then(e?function(e){return Br(r,t()).then(function(){return e})}:t,e?function(e){return Br(r,t()).then(function(){throw e})}:t)}});zr.Promise;var bn=function(e,t){var r=this;if(!(r instanceof bn))return new bn(e,t);pt&&(r=pt(new Error(t),Xe(r)));var n=[];return Xt(e,n.push,n),r.errors=n,void 0!==t&&x(r,"message",String(t)),r};bn.prototype=st(Error.prototype,{constructor:{value:bn,configurable:!0,writable:!0},name:{value:"AggregateError",configurable:!0,writable:!0}}),qe({global:!0},{AggregateError:bn}),qe({target:"Promise",stat:!0},{allSettled:function(e){var s=this,t=Fr.f(s),l=t.resolve,r=t.reject,n=Nr(function(){var n=Ht(s.resolve),i=[],a=0,o=1;Xt(e,function(e){var t=a++,r=!1;i.push(void 0),o++,n.call(s,e).then(function(e){r||(r=!0,i[t]={status:"fulfilled",value:e},--o||l(i))},function(e){r||(r=!0,i[t]={status:"rejected",reason:e},--o||l(i))})}),--o||l(i)});return n.error&&r(n.value),t.promise}}),qe({target:"Promise",stat:!0},{try:function(e){var t=Fr.f(this),r=Nr(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var Sn="No one promise resolved";qe({target:"Promise",stat:!0},{any:function(e){var l=this,t=Fr.f(l),u=t.resolve,d=t.reject,r=Nr(function(){var n=Ht(l.resolve),i=[],a=0,o=1,s=!1;Xt(e,function(e){var t=a++,r=!1;i.push(void 0),o++,n.call(l,e).then(function(e){r||s||(s=!0,u(e))},function(e){r||s||(r=!0,i[t]=e,--o||d(new(Gr("AggregateError"))(i,Sn)))})}),--o||d(new(Gr("AggregateError"))(i,Sn))});return r.error&&d(r.value),t.promise}});var En,wn,Tn,An,xn,Ln,In,Rn,Cn,Dn=Array.isArray||function(e){return"Array"==i(e)},Un=O("species"),Pn=function(e,t){var r;return Dn(e)&&("function"!=typeof(r=e.constructor)||r!==Array&&!Dn(r.prototype)?g(r)&&null===(r=r[Un])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===t?0:t)},kn=(Tn=1==(En=5),An=2==En,xn=3==En,Ln=4==En,In=6==En,Rn=5==En||In,Cn=wn||Pn,function(e,t,r){for(var n,i,a=Ve(e),o=_e(a),s=Wt(t,r,3),l=Te(o.length),u=0,d=Tn?Cn(e,l):An?Cn(e,0):void 0;u<l;u++)if((Rn||u in o)&&(i=s(n=o[u],u,a),En))if(Tn)d[u]=i;else if(i)switch(En){case 3:return!0;case 5:return n;case 6:return u;case 2:d.push(n)}else if(Ln)return!1;return In?-1:xn||Ln?Ln:d}),On="find",Mn=!0;On in[]&&Array(1)[On](function(){Mn=!1}),qe({target:"Array",proto:!0,forced:Mn},{find:function(e){return kn(this,e,1<arguments.length?arguments[1]:void 0)}}),It(On);var Fn,Bn,Nn,zn=Function.call,jn=(Fn="find",Wt(zn,h["Array"].prototype[Fn],Bn),function(e,t,r){var n=E(t);n in e?T.f(e,n,A(0,r)):e[n]=r}),Gn=O("species"),Hn=O("isConcatSpreadable"),qn=9007199254740991,Vn="Maximum allowed index exceeded",Wn=!p(function(){var e=[];return e[Hn]=!1,e.concat()[0]!==e}),Yn=(Nn="concat",!p(function(){var e=[];return(e.constructor={})[Gn]=function(){return{foo:1}},1!==e[Nn](Boolean).foo})),Kn=function(e){if(!g(e))return!1;var t=e[Hn];return void 0!==t?!!t:Dn(e)};qe({target:"Array",proto:!0,forced:!Wn||!Yn},{concat:function(e){var t,r,n,i,a,o=Ve(this),s=Pn(o,0),l=0;for(t=-1,n=arguments.length;t<n;t++)if(a=-1===t?o:arguments[t],Kn(a)){if(i=Te(a.length),qn<l+i)throw TypeError(Vn);for(r=0;r<i;r++,l++)r in a&&jn(s,l,a[r])}else{if(qn<=l)throw TypeError(Vn);jn(s,l++,a)}return s.length=l,s}});var Xn={f:O},Zn=T.f,Qn=function(e){var t=zr.Symbol||(zr.Symbol={});V(t,e)||Zn(t,e,{value:Xn.f(e)})},Jn=De.f,$n={}.toString,ei="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],ti={f:function(e){return ei&&"[object Window]"==$n.call(e)?function(e){try{return Jn(e)}catch(e){return ei.slice()}}(e):Jn(be(e))}},ri=Z("hidden"),ni="Symbol",ii=ie.set,ai=ie.getterFor(ni),oi=Ee.f,si=T.f,li=ti.f,ui=h.Symbol,di=h.JSON,fi=di&&di.stringify,ci="prototype",hi=O("toPrimitive"),pi=ye.f,mi=I("symbol-registry"),gi=I("symbols"),yi=I("op-symbols"),vi=I("wks"),_i=Object[ci],bi=h.QObject,Si=!bi||!bi[ci]||!bi[ci].findChild,Ei=m&&p(function(){return 7!=st(si({},"a",{get:function(){return si(this,"a",{value:7}).a}})).a})?function(e,t,r){var n=oi(_i,t);n&&delete _i[t],si(e,t,r),n&&e!==_i&&si(_i,t,n)}:si,wi=function(e,t){var r=gi[e]=st(ui[ci]);return ii(r,{type:ni,tag:e,description:t}),m||(r.description=t),r},Ti=U&&"symbol"==typeof ui.iterator?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof ui},Ai=function(e,t,r){return e===_i&&Ai(yi,t,r),S(e),t=E(t,!0),S(r),V(gi,t)?(r.enumerable?(V(e,ri)&&e[ri][t]&&(e[ri][t]=!1),r=st(r,{enumerable:A(0,!1)})):(V(e,ri)||si(e,ri,A(1,{})),e[ri][t]=!0),Ei(e,t,r)):si(e,t,r)},xi=function(e,t){S(e);for(var r,n=function(e){var t=$e(e),r=Ue.f;if(r)for(var n,i=r(e),a=ye.f,o=0;i.length>o;)a.call(e,n=i[o++])&&t.push(n);return t}(t=be(t)),i=0,a=n.length;i<a;)Ai(e,r=n[i++],t[r]);return e},Li=function(e){var t=pi.call(this,e=E(e,!0));return!(this===_i&&V(gi,e)&&!V(yi,e))&&(!(t||!V(this,e)||!V(gi,e)||V(this,ri)&&this[ri][e])||t)},Ii=function(e,t){if(e=be(e),t=E(t,!0),e!==_i||!V(gi,t)||V(yi,t)){var r=oi(e,t);return!r||!V(gi,t)||V(e,ri)&&e[ri][t]||(r.enumerable=!0),r}},Ri=function(e){for(var t,r=li(be(e)),n=[],i=0;r.length>i;)V(gi,t=r[i++])||V(Q,t)||n.push(t);return n},Ci=function(e){for(var t,r=e===_i,n=li(r?yi:be(e)),i=[],a=0;n.length>a;)!V(gi,t=n[a++])||r&&!V(_i,t)||i.push(gi[t]);return i};U||(ae((ui=function(){if(this instanceof ui)throw TypeError("Symbol is not a constructor");var e=void 0===arguments[0]?void 0:String(arguments[0]),t=D(e),r=function(e){this===_i&&r.call(yi,e),V(this,ri)&&V(this[ri],t)&&(this[ri][t]=!1),Ei(this,t,A(1,e))};return m&&Si&&Ei(_i,t,{configurable:!0,set:r}),wi(t,e)})[ci],"toString",function(){return ai(this).tag}),ye.f=Li,T.f=Ai,Ee.f=Ii,De.f=ti.f=Ri,Ue.f=Ci,m&&(si(ui[ci],"description",{configurable:!0,get:function(){return ai(this).description}}),ae(_i,"propertyIsEnumerable",Li,{unsafe:!0})),Xn.f=function(e){return wi(O(e),e)}),qe({global:!0,wrap:!0,forced:!U,sham:!U},{Symbol:ui});for(var Di=$e(vi),Ui=0;Di.length>Ui;)Qn(Di[Ui++]);qe({target:ni,stat:!0,forced:!U},{for:function(e){return V(mi,e+="")?mi[e]:mi[e]=ui(e)},keyFor:function(e){if(!Ti(e))throw TypeError(e+" is not a symbol");for(var t in mi)if(mi[t]===e)return t},useSetter:function(){Si=!0},useSimple:function(){Si=!1}}),qe({target:"Object",stat:!0,forced:!U,sham:!m},{create:function(e,t){return void 0===t?st(e):xi(st(e),t)},defineProperty:Ai,defineProperties:xi,getOwnPropertyDescriptor:Ii}),qe({target:"Object",stat:!0,forced:!U},{getOwnPropertyNames:Ri,getOwnPropertySymbols:Ci}),qe({target:"Object",stat:!0,forced:p(function(){Ue.f(1)})},{getOwnPropertySymbols:function(e){return Ue.f(Ve(e))}}),di&&qe({target:"JSON",stat:!0,forced:!U||p(function(){var e=ui();return"[null]"!=fi([e])||"{}"!=fi({a:e})||"{}"!=fi(Object(e))})},{stringify:function(e){for(var t,r,n=[e],i=1;arguments.length>i;)n.push(arguments[i++]);if(r=t=n[1],(g(t)||void 0!==e)&&!Ti(e))return Dn(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!Ti(t))return t}),n[1]=t,fi.apply(di,n)}}),ui[ci][hi]||x(ui[ci],hi,ui[ci].valueOf),dt(ui,ni),Q[ri]=!0,Qn("asyncIterator");var Pi=T.f,ki=h.Symbol;if(m&&"function"==typeof ki&&(!("description"in ki.prototype)||void 0!==ki().description)){var Oi={},Mi=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof Mi?new ki(e):void 0===e?ki():ki(e);return""===e&&(Oi[t]=!0),t};Oe(Mi,ki);var Fi=Mi.prototype=ki.prototype;Fi.constructor=Mi;var Bi=Fi.toString,Ni="Symbol(test)"==String(ki("test")),zi=/^Symbol\((.*)\)[^)]+$/;Pi(Fi,"description",{configurable:!0,get:function(){var e=g(this)?this.valueOf():this,t=Bi.call(e);if(V(Oi,e))return"";var r=Ni?t.slice(7,-1):t.replace(zi,"$1");return""===r?void 0:r}}),qe({global:!0,forced:!0},{Symbol:Mi})}Qn("hasInstance"),Qn("isConcatSpreadable"),Qn("iterator"),Qn("match"),Qn("matchAll"),Qn("replace"),Qn("search"),Qn("species"),Qn("split"),Qn("toPrimitive"),Qn("toStringTag"),Qn("unscopables"),dt(Math,"Math",!0),dt(h.JSON,"JSON",!0);zr.Symbol;Qn("dispose"),Qn("observable"),Qn("patternMatch"),Qn("replaceAll"),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(s(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 d(e){var t=new FileReader,r=o(t);return t.readAsArrayBuffer(e),r}function f(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=f(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||r(e))?this._bodyArrayBuffer=f(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(d)}),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(m)}),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 m(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 g(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(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var y=[301,302,303,307,308];g.redirect=function(e,t){if(-1===y.indexOf(t))throw new RangeError("Invalid status code");return new g(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 g(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=g),s.Headers=u,s.Request=p,s.Response=g,s.fetch=v,Object.defineProperty(s,"__esModule",{value:!0})}(t)}));var ji,Gi,Hi,qi,Vi=s(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,d,i,a,f;n=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,d=/^([^\/?#]*)(.*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,f={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var n=f.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=f.normalizePath(n.path),f.buildURLFromParts(n)}var i=f.parseURL(t);if(!i)throw new Error("Error trying to parse relative URL.");if(i.scheme)return r.alwaysNormalize?(i.path=f.normalizePath(i.path),f.buildURLFromParts(i)):t;var a=f.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var o=d.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=f.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?f.normalizePath(i.path):i.path),f.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=f},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 d=l[u-1].end;e[s].start-d<r?e[s].end>d&&(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 f=l[s].start,c=l[s].end;if(f<=t+r&&t<c)i=f,n=(a=c)-t;else if(t+r<f){o=f;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=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])},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(g){var n,e=this&&this.__extends||(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])},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 m(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(m,r),Object.defineProperty(m,"ContextType",{get:function(){return b},enumerable:!0,configurable:!0}),Object.defineProperty(m,"LevelType",{get:function(){return i},enumerable:!0,configurable:!0}),m.canHaveQualityLevels=function(e){return e!==b.AUDIO_TRACK&&e!==b.SUBTITLE_TRACK},m.mapContextToLevelType=function(e){switch(e.type){case b.AUDIO_TRACK:return i.AUDIO;case b.SUBTITLE_TRACK:return i.SUBTITLE;default:return i.MAIN}},m.getResponseUrl=function(e,t){var r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r},m.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},m.prototype.getInternalLoader=function(e){return this.loaders[e.type]},m.prototype.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},m.prototype.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},m.prototype.destroy=function(){this.destroyInternalLoaders(),r.prototype.destroy.call(this)},m.prototype.onManifestLoading=function(e){this.load(e.url,{type:b.MANIFEST,level:0,id:null})},m.prototype.onLevelLoading=function(e){this.load(e.url,{type:b.LEVEL,level:e.level,id:e.id})},m.prototype.onAudioTrackLoading=function(e){this.load(e.url,{type:b.AUDIO_TRACK,level:null,id:e.id})},m.prototype.onSubtitleTrackLoading=function(e){this.load(e.url,{type:b.SUBTITLE_TRACK,level:null,id:e.id})},m.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},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};return c.logger.debug("Calling internal loader delegate for URL: "+e),s.load(t,u,d),!0},m.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)},m.prototype.loaderror=function(e,t,r){void 0===r&&(r=null),this._handleNetworkError(t,r,!1,e)},m.prototype.loadtimeout=function(e,t,r){void 0===r&&(r=null),this._handleNetworkError(t,r,!0)},m.prototype._handleMasterPlaylist=function(e,t,r,n){var i=this.hls,a=e.data,o=m.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),d=v.default.parseMasterPlaylistMedia(a,o,"SUBTITLES");if(u.length){var f=!1;u.forEach(function(e){e.url||(f=!0)}),!1===f&&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:d,url:o,stats:t,networkDetails:n})}else this._handleManifestParsingError(e,r,"no level found in manifest",n)},m.prototype._handleTrackOrLevelPlaylist=function(e,t,r,n){var i=this.hls,a=r.id,o=r.level,s=r.type,l=m.getResponseUrl(e,r),u=g.isFinite(a)?a:0,d=g.isFinite(o)?o:u,f=m.mapContextToLevelType(r),c=v.default.parseLevelPlaylist(e.data,l,d,f,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)},m.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"}},m.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})},m.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)},m.prototype._handlePlaylistLoaded=function(e,t,r,n){var i=r.type,a=r.level,o=r.id,s=r.levelDetails;if(s.targetduration)if(m.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)},m}(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 m(e,t){this.observer=e,this.remuxer=t}return m.prototype.resetTimeStamp=function(e){this.initPTS=e},m.prototype.resetInitSegment=function(e,t,r,n){if(e&&e.byteLength){var i=this.initData=m.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)},m.probe=function(e){return 0<m.findBox({data:e,start:0,end:Math.min(e.length,16384)},["moof"]).length},m.bin2str=function(e){return String.fromCharCode.apply(null,e)},m.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},m.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},m.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},m.findBox=function(e,t){var r,n,i,a,o,s,l,u=[];if(e.data?(s=e.start,a=e.end,e=e.data):(s=0,a=e.byteLength),!t.length)return null;for(r=s;r<a;)n=m.readUint32(e,r),i=m.bin2str(e.subarray(r+4,r+8)),l=1<n?r+n:a,i===t[0]&&(1===t.length?u.push({data:e,start:r+8,end:l}):(o=m.findBox({data:e,start:r+8,end:l},t.slice(1))).length&&(u=u.concat(o))),r=l;return u},m.parseSegmentIndex=function(e){var t,r=m.findBox(e,["moov"])[0],n=r?r.end:null,i=0,a=m.findBox(e,["sidx"]);if(!a||!a[0])return null;t=[];var o=(a=a[0]).data[0],s=m.readUint32(a,i=0===o?8:16);i+=4,i+=0===o?8:16,i+=2;var l=a.end+0,u=m.readUint16(a,i);i+=2;for(var d=0;d<u;d++){var f=i,c=m.readUint32(a,f);f+=4;var h=2147483647&c;if(1==(2147483648&c)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");var p=m.readUint32(a,f);f+=4,t.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/s,start:l,end:l+h-1}}),l+=h,i=f+=4}return{earliestPresentationTime:0,timescale:s,version:o,referencesCount:u,references:t,moovEndOffset:n}},m.parseInitSegment=function(e){var f=[];return m.findBox(e,["moov","trak"]).forEach(function(e){var t=m.findBox(e,["tkhd"])[0];if(t){var r=t.data[t.start],n=0===r?12:20,i=m.readUint32(t,n),a=m.findBox(e,["mdia","mdhd"])[0];if(a){n=0===(r=a.data[a.start])?12:20;var o=m.readUint32(a,n),s=m.findBox(e,["mdia","hdlr"])[0];if(s){var l={soun:"audio",vide:"video"}[m.bin2str(s.data.subarray(s.start+8,s.start+12))];if(l){var u=m.findBox(e,["mdia","minf","stbl","stsd"]);if(u.length){u=u[0];var d=m.bin2str(u.data.subarray(u.start+12,u.start+16));c.logger.log("MP4Demuxer:"+l+":"+d+" found")}f[i]={timescale:o,type:l},f[l]={timescale:o,id:i}}}}}}),f},m.getStartDTS=function(i,e){var t,r,n;return t=m.findBox(e,["moof","traf"]),r=[].concat.apply([],t.map(function(n){return m.findBox(n,["tfhd"]).map(function(e){var t,r;return t=m.readUint32(e,4),r=i[t].timescale||9e4,m.findBox(n,["tfdt"]).map(function(e){var t,r;return t=e.data[e.start],r=m.readUint32(e,4),1===t&&(r*=Math.pow(2,32),r+=m.readUint32(e,8)),r})[0]/r})})),n=Math.min.apply(null,r),isFinite(n)?n:0},m.offsetStartDTS=function(n,e,o){m.findBox(e,["moof","traf"]).map(function(r){return m.findBox(r,["tfhd"]).map(function(e){var t=m.readUint32(e,4),a=n[t].timescale||9e4;m.findBox(r,["tfdt"]).map(function(e){var t=e.data[e.start],r=m.readUint32(e,4);if(0===t)m.writeUint32(e,4,r-o*a);else{r*=Math.pow(2,32),r+=m.readUint32(e,8),r-=o*a,r=Math.max(r,0);var n=Math.floor(r/(s+1)),i=Math.floor(r%(s+1));m.writeUint32(e,4,n),m.writeUint32(e,8,i)}})})})},m.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=m.getStartDTS(i,e);this.initPTS=o=s-t,this.observer.trigger(l.default.INIT_PTS_FOUND,{initPTS:o})}m.offsetStartDTS(i,e,o),a=m.getStartDTS(i,e),this.remuxer.remux(i.audio,i.video,null,null,a,r,n,e)},m.prototype.destroy=function(){},m}();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 m,w=r(1),T=r(3),g=r(19),A=r(36),x=r(14),L=r(37),I=r(42),R=r(43),C=r(46),n=r(6),i=r(0),a=n.getSelfScope();try{m=a.performance.now.bind(a.performance)}catch(e){i.logger.debug("Unable to use Performance API on this environment"),m=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,d,f,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 g.default(this.observer,this.config));var p=m();t.decrypt(e,r.key.buffer,r.iv.buffer,function(e){var t=m();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,d,f,c)})}else this.pushDecrypted(new Uint8Array(e),r,new Uint8Array(n),i,a,o,s,l,u,d,f,c)},e.prototype.pushDecrypted=function(e,t,r,n,i,a,o,s,l,u,d,f){var c=this.demuxer;if(!c||(o||s)&&!this.probe(e)){for(var h=this.observer,p=this.typeSupported,m=this.config,g=[{demux:L.default,remux:R.default},{demux:x.default,remux:C.default},{demux:A.default,remux:R.default},{demux:I.default,remux:R.default}],y=0,v=g.length;y<v;y++){var _=g[y],b=_.demux.probe;if(b(e)){var S=this.remuxer=new _.remux(h,m,p,this.vendor);c=new _.demux(h,S,m,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(f),E.resetTimeStamp(f)),"function"==typeof c.setDecryptData&&c.setDecryptData(t),c.append(e,a,l,d)},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),d=r(0),o=r(1),f=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=f.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&&(d.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&&(d.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?(d.logger.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(t,r,n,i)):(d.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(),d=n,f=[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)>f.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+"["+f[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:f[a],channelCount:s,codec:"mp4a.40."+i,manifestCodec:d};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 d(e){return 9216e4/e}function f(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=d,t.parseFrameHeader=f,t.appendFrame=function(e,t,r,n,i){var a=f(t,r,n,i,d(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 m={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*m.BitratesMap[14*s+i-1],u=3===r?0:2===r?1:2,d=m.SamplingRateMap[3*u+a],f=e[t+3]>>6==3?1:2,c=m.SamplesCoefficients[r][n],h=m.BytesInSlot[n],p=8*c*h;return{sampleRate:d,channelCount:f,frameLength:parseInt(c*l/d+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=m},function(e,t,r){var n,i=this&&this.__extends||(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])},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 m(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 g(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,d,f,c=t.sn;if(!e||c<e.startSN||c>e.endSN)return 0;for(u=c-e.startSN,(d=e.fragments)[u]=t,f=u;0<f;f--)m(d,f,f-1);for(f=u;f<d.length-1;f++)m(d,f,f+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=m,t.updateFragPTSDTS=g,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 d=o[a+u],f=s[u];f&&d&&(l=d.cc-f.cc,h.isFinite(d.startPTS)&&(f.start=f.startPTS=d.startPTS,f.endPTS=d.endPTS,f.duration=d.duration,f.backtracked=d.backtracked,f.dropped=d.dropped,r=f))}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)g(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=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])},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),I=r(57),s=r(59),R=r(0),l=r(60),u=r(1),d=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"');R.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),d=new T.default(t),f=new I.default(t),c=t.levelController=new L.default(t),h=new A.FragmentTracker(t),p=[c,t.streamController=new x.default(t,h)],m=e.audioStreamController;m&&p.push(new m(t,h)),t.networkControllers=p;var g=[l,u,d,i,a,o,s,f,h];if(m=e.audioTrackController){var y=new m(t);t.audioTrackController=y,g.push(y)}if(m=e.subtitleTrackController){var v=new m(t);t.subtitleTrackController=v,g.push(v)}if(m=e.emeController){var _=new m(t);t.emeController=_,g.push(_)}return(m=e.subtitleStreamController)&&g.push(new m(t,h)),(m=e.timelineController)&&g.push(new m(t)),t.coreComponents=g,t}return i(S,b),Object.defineProperty(S,"version",{get:function(){return"1.0.0"},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(){R.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){R.logger.log("attachMedia"),this.media=e,this.trigger(u.default.MEDIA_ATTACHING,{media:e})},S.prototype.detachMedia=function(){R.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}),R.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),R.logger.log("startLoad("+t+")"),this.networkControllers.forEach(function(e){e.startLoad(t)})},S.prototype.stopLoad=function(){R.logger.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},S.prototype.swapAudioCodec=function(){R.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},S.prototype.recoverMediaError=function(){R.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){R.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){R.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){R.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){R.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){R.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){R.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=d},function(e,t,n){(function(D){Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),U=n(15),P=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,f=/#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"),B=/(?:(?:#(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?/,N=/\.(mp4|m4s|m4v|m4a)$/i,e=function(){function d(){}return d.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},d.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},d.resolve=function(e,t){return r.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},d.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=d.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=d.convertAVC1ToAVCOTI(a.videoCodec)),n.push(a)}return n},d.parseMasterPlaylistMedia=function(e,t,r,n){var i;void 0===n&&(n=[]);var a=[],o=0;for(f.lastIndex=0;null!==(i=f.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=d.resolve(l.URI,t)),s.lang=l.LANGUAGE,s.name||(s.name=s.lang),n.length){var u=d.findGroup(n,s.groupId);s.audioCodec=u?u.codec:n[0].codec}s.id=o++,a.push(s)}}return a},d.parseLevelPlaylist=function(e,t,r,n,i){var a,o,s,l,u=0,d=0,f=new P.default(t),c=new k.default,h=0,p=null,m=new U.default,g=null;for(F.lastIndex=0;null!==(a=F.exec(e));){var y=a[1];if(y){m.duration=parseFloat(y);var v=(" "+a[2]).slice(1);m.title=v||null,m.tagList.push(v?["INF",y,v]:["INF",y])}else if(a[3]){if(D.isFinite(m.duration)){var _=u++;m.type=n,m.start=d,m.levelkey=c,m.sn=_,m.level=r,m.cc=h,m.urlId=i,m.baseurl=t,m.relurl=(" "+a[3]).slice(1),l=p,(s=m).rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):l&&l.programDateTime&&(s.programDateTime=l.endProgramDateTime),D.isFinite(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null),f.fragments.push(m),d+=(p=m).duration,m=new U.default}}else if(a[4]){if(m.rawByteRange=(" "+a[4]).slice(1),p){var b=p.byteRangeEndOffset;b&&(m.lastByteRangeEndOffset=b)}}else if(a[5])m.rawProgramDateTime=(" "+a[5]).slice(1),m.tagList.push(["PROGRAM-DATE-TIME",m.rawProgramDateTime]),null===g&&(g=f.fragments.length);else{for(a=a[0].match(B),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"#":m.tagList.push(E?[S,E]:[S]);break;case"PLAYLIST-TYPE":f.type=S.toUpperCase();break;case"MEDIA-SEQUENCE":u=f.startSN=parseInt(S);break;case"TARGETDURATION":f.targetduration=parseFloat(S);break;case"VERSION":f.version=parseInt(S);break;case"EXTM3U":break;case"ENDLIST":f.live=!1;break;case"DIS":h++,m.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 I=S,R=new O.default(I).decimalFloatingPoint("TIME-OFFSET");D.isFinite(R)&&(f.startTimeOffset=R);break;case"MAP":var C=new O.default(S);m.relurl=C.URI,m.rawByteRange=C.BYTERANGE,m.baseurl=t,m.level=r,m.type=n,m.sn="initSegment",f.initSegment=m,(m=new U.default).rawProgramDateTime=f.initSegment.rawProgramDateTime;break;default:M.logger.warn("line parsed but not handled: "+a)}}}return(m=p)&&!m.relurl&&(f.fragments.pop(),d-=m.duration),f.totalduration=d,f.averagetargetduration=d/f.fragments.length,f.endSN=u-1,f.startCC=f.fragments[0]?f.fragments[0].cc:0,f.endCC=h,!f.initSegment&&f.fragments.length&&f.fragments.every(function(e){return N.test(e.relurl)})&&(M.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(m=new U.default).relurl=f.fragments[0].relurl,m.baseurl=t,m.level=r,m.type=n,m.sn="initSegment",f.initSegment=m,f.needSidxRanges=!0),g&&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}}(f.fragments,g),f},d}();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=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])},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,d=n[r];d&&(p.logger.warn("abort previous fragment loader for type: "+r),d.abort()),d=n[r]=t.loader=i.fLoader?new a(i):new o(i),s={url:t.url,frag:t,responseType:"arraybuffer",progressData:!1};var f=t.byteRangeStartOffset,c=t.byteRangeEndOffset;h.isFinite(f)&&h.isFinite(c)&&(s.rangeStart=f,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)},d.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=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])},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 d=r(1),a=r(4),o=r(3),f=r(0),s=function(r){function e(e){var t=r.call(this,e,d.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&&(f.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(d.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(d.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(d.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(d.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(d.default.KEY_LOADED,{frag:t})},e}(a.default);t.default=s},function(e,l,b){(function(u){var n,t=this&&this.__extends||(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])},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),m=b(1),r=b(9),d=b(15),i=b(13),f=b(23),a=b(50),o=b(3),g=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,m.default.MEDIA_ATTACHED,m.default.MEDIA_DETACHING,m.default.MANIFEST_LOADING,m.default.MANIFEST_PARSED,m.default.LEVEL_LOADED,m.default.KEY_LOADED,m.default.FRAG_LOADED,m.default.FRAG_LOAD_EMERGENCY_ABORTED,m.default.FRAG_PARSING_INIT_SEGMENT,m.default.FRAG_PARSING_DATA,m.default.FRAG_PARSED,m.default.ERROR,m.default.AUDIO_TRACK_SWITCHING,m.default.AUDIO_TRACK_SWITCHED,m.default.BUFFER_CREATED,m.default.BUFFER_APPENDED,m.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&&(g.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)&&(g.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)){g.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 d=a.details;if(!d||d.live&&this.levelLastLoaded!==i)this.state=_.State.WAITING_LEVEL;else{if(this._streamEnded(l,d)){var f={};return this.altAudio&&(f.type="video"),this.hls.trigger(m.default.BUFFER_EOS,f),void(this.state=_.State.ENDED)}this._fetchPayloadOrEos(n,l,d)}}}}},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,d=t.end;if(r.initSegment&&!r.initSegment.data)s=r.initSegment;else if(r.live){var f=this.config.initialLiveManifestSize;if(o<f)return void g.logger.warn("Can not start playback of a level, reason: not enough fragments "+o+" < "+f);if(null===(s=this._ensureFragmentAtLivePoint(r,d,l,u,n,a,o)))return}else d<l&&(s=a[0]);s||(s=this._findFragment(l,n,o,a,d,u,r)),s&&(s.encrypted?(g.logger.log("Loading key for "+s.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+i),this._loadKey(s)):(g.logger.log("Loading "+s.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+i+", currentTime:"+e.toFixed(3)+",bufferEnd:"+d.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,d=void 0!==l.liveMaxLatencyDuration?l.liveMaxLatencyDuration:l.liveMaxLatencyDurationCount*e.targetduration;if(t<Math.max(r-l.maxFragLookUpTolerance,n-d)){var f=this.liveSyncPosition=this.computeLivePosition(r,e);g.logger.log("buffer end: "+t.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+f.toFixed(3)),t=f,u&&u.readyState&&u.duration>f&&(u.currentTime=f),this.nextLoadPosition=f}if(e.PTSKnown&&n<t&&u&&u.readyState)return null;if(this.startFragRequested&&!e.PTSKnown){if(i)if(e.hasProgramDateTime)g.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,g.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}))&&g.logger.log("live playlist, switching playlist, load frag with same CC: "+s.sn)}s||(s=a[Math.min(o-1,Math.round(o/2))],g.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 d=s.sn-o.startSN,f=t&&s.level===t.level,c=n[d-1],h=n[d+1];if(t&&s.sn===t.sn)if(f&&!s.backtracked)if(s.sn<o.endSN){var p=t.deltaPTS;p&&p>l.maxBufferHole&&t.dropped&&d?(s=c,g.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,g.logger.log("SN just loaded, load next one: "+s.sn,s))}else s=null;else s.backtracked&&(h&&h.backtracked?(g.logger.warn("Already backtracked from fragment "+h.sn+", will not backtrack to fragment "+s.sn+". Loading fragment "+h.sn),s=h):(g.logger.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),s.dropped=0,c?(s=c).backtracked=!0:d&&(s=null)))}return s},e.prototype._loadKey=function(e){this.state=_.State.KEY_LOADING,this.hls.trigger(m.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(m.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,g.logger.log("main stream:"+t+"->"+e),this.hls.trigger(m.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(m.default.LEVEL_SWITCHED,{level:n.level}),this.lastAutoLevelEnabled=this.hls.autoLevelEnabled),n!==this.fragPlaying){this.hls.trigger(m.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(m.default.LEVEL_SWITCHED,{level:i}),this.fragPlaying=n}}},e.prototype.immediateLevelSwitch=function(){if(g.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(m.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&&(g.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)&&g.logger.log("media seeked to "+t.toFixed(3)),this.tick()},e.prototype.onManifestLoading=function(){g.logger.log("trigger BUFFER_RESET"),this.hls.trigger(m.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&&g.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(g.logger.log("level "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+a),t.live){var s=i.details;s&&0<t.fragments.length?(f.mergeDetails(s,t),o=t.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,s),t.PTSKnown&&u.isFinite(o)?g.logger.log("live playlist sliding:"+o.toFixed(3)):(g.logger.log("live playlist - outdated PTS, unknown sliding"),y.alignStream(this.fragPrevious,n,t))):(g.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(m.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&&(g.logger.log("negative start time offset "+l+", count from end of last fragment"),l=o+a+l),g.logger.log("start time offset found in playlist, adjust startPosition to "+l),this.startPosition=l):t.live?(this.startPosition=this.computeLivePosition(o,t),g.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,g.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(m.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(m.default.FRAG_BUFFERED,{stats:o,frag:t,id:"main"}),this.tick();else{g.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),d=l.initSegment?l.initSegment.data:[],f=this._getAudioCodec(s);(this.demuxer=this.demuxer||new h.default(this.hls,"main")).push(e.payload,d,f,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&&(g.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",g.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(m.default.BUFFER_CODECS,n),n){a=n[i],g.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(m.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(d.default.ElementaryStreamTypes.AUDIO),!0===t.hasVideo&&a.addElementaryStream(d.default.ElementaryStreamTypes.VIDEO),g.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)g.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 g.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();g.logger.warn("missing video frame(s) on first frag, appending with gap",a.sn)}else a.backtracked=!1;var s=f.updateFragPTSDTS(i.details,a,t.startPTS,t.endPTS,t.startDTS,t.endDTS),l=this.hls;l.trigger(m.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(m.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){g.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var n=this.fragCurrent;n.loader&&(g.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(m.default.BUFFER_FLUSHING,{startOffset:0,endOffset:u.POSITIVE_INFINITY,type:"audio"}),i.trigger(m.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&&(g.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?(g.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;g.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(m.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);g.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 g.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,g.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):(g.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,g.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(d.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&&(g.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&&(g.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),d=i(1),f=i(18),v=i(0),c=i(3),e=i(12),t=i(6),h=i(22),p=t.getSelfScope(),m=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(d.default.FRAG_DECRYPTED,a),t.on(d.default.FRAG_PARSING_INIT_SEGMENT,a),t.on(d.default.FRAG_PARSING_DATA,a),t.on(d.default.FRAG_PARSED,a),t.on(d.default.ERROR,a),t.on(d.default.FRAG_PARSING_METADATA,a),t.on(d.default.FRAG_PARSING_USERDATA,a),t.on(d.default.INIT_PTS_FOUND,a);var o={mp4:m.isTypeSupported("video/mp4"),mpeg:m.isTypeSupported("audio/mpeg"),mp3:m.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(d.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 f.default(t,o,i,s),this.w=void 0}}else this.demuxer=new f.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,d=i.decryptdata,f=this.frag,c=!(f&&i.cc===f.cc),h=!(f&&i.level===f.level),p=f&&i.sn===f.sn+1,m=!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:d,initSegment:t,audioCodec:r,videoCodec:n,timeOffset:u,discontinuity:c,trackSwitch:h,contiguous:m,duration:a,accurateTimeOffset:o,defaultInitPTS:s},e instanceof ArrayBuffer?[e]:[]);else{var g=this.demuxer;g&&g.push(e,d,t,r,n,u,c,h,m,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 d.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|/|@]+",m="\\((/\\*.*?\\*/)?s?.*?("+p+").*?\\)";function g(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function c(e,t,r){var n={};n[r]=[];var i,a=t.toString(),o=a.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return n;for(var s,l=o[1],u=new RegExp("(\\\\n|\\W)"+g(l)+m,"g");s=u.exec(a);)"dll-reference"!==s[3]&&n[r].push(s[3]);for(u=new RegExp("\\("+g(l)+'\\("(dll-reference\\s('+p+'))"\\)\\)'+m,"g");s=u.exec(a);)e[s[2]]||(n[r].push(s[1]),e[s[2]]=h(s[1]).m),n[s[2]]=n[s[2]]||[],n[s[2]].push(s[4]);for(var d=Object.keys(n),f=0;f<d.length;f++)for(var c=0;c<n[d[f]].length;c++)i=n[d[f]][c],!isNaN(1*i)&&(n[d[f]][c]=1*n[d[f]][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),d=Object.keys(u),f=0;f<d.length;f++)r[d[f]]=r[d[f]]||[],r[d[f]]=r[d[f]].concat(u[d[f]])}}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],d=s[2],f=s[3],c=new Uint32Array(256),h=0,p=0,m=0;for(m=0;m<256;m++)c[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){var g=p^p<<1^p<<2^p<<3^p<<4;g=g>>>8^255&g^99,e[h]=g,t[g]=h;var y=c[h],v=c[y],_=c[v],b=257*c[g]^16843008*g;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[g]=b<<24|b>>>8,u[g]=b<<16|b>>>16,d[g]=b<<8|b>>>24,f[g]=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),d=this.keySchedule=new Uint32Array(u),f=this.invKeySchedule=new Uint32Array(u),c=this.sBox,h=this.rcon,p=this.invSubMix,m=p[0],g=p[1],y=p[2],v=p[3];for(a=0;a<u;a++)a<i?s=d[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]),d[a]=s=(d[a-i]^l)>>>0);for(o=0;o<u;o++)a=u-o,l=3&o?d[a]:d[a-4],f[o]=o<4||a<=4?l:m[c[l>>>24]]^g[c[l>>>16&255]]^y[c[l>>>8&255]]^v[c[255&l]],f[o]=f[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,d,f,c,h,p,m,g,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],I=x[1],R=x[2],C=x[3],D=new Int32Array(e),U=new Int32Array(D.length),P=this.networkToHostOrderSwap;t<D.length;){for(c=P(D[t]),h=P(D[t+1]),p=P(D[t+2]),m=P(D[t+3]),l=c^_[0],u=m^_[1],d=p^_[2],f=h^_[3],g=4,y=1;y<v;y++)i=E[l>>>24]^w[u>>16&255]^T[d>>8&255]^A[255&f]^_[g],a=E[u>>>24]^w[d>>16&255]^T[f>>8&255]^A[255&l]^_[g+1],o=E[d>>>24]^w[f>>16&255]^T[l>>8&255]^A[255&u]^_[g+2],s=E[f>>>24]^w[l>>16&255]^T[u>>8&255]^A[255&d]^_[g+3],l=i,u=a,d=o,f=s,g+=4;i=b[l>>>24]<<24^b[u>>16&255]<<16^b[d>>8&255]<<8^b[255&f]^_[g],a=b[u>>>24]<<24^b[d>>16&255]<<16^b[f>>8&255]<<8^b[255&l]^_[g+1],o=b[d>>>24]<<24^b[f>>16&255]<<16^b[l>>8&255]<<8^b[255&u]^_[g+2],s=b[f>>>24]<<24^b[l>>16&255]<<16^b[u>>8&255]<<8^b[255&d]^_[g+3],g+=3,U[t]=P(i^L),U[t+1]=P(s^I),U[t+2]=P(o^R),U[t+3]=P(a^C),L=c,I=h,R=p,C=m,t+=4}return n?k(U.buffer):U.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 m=r(20),g=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(m.probe(e,t))return g.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,d=e.length,f=a.length,c=[{pts:u,dts:u,data:a}];f<d-1;)if(m.isHeader(e,f)&&f+5<d){m.initTrackConfig(i,this.observer,e,f,i.manifestCodec);var h=m.appendFrame(i,e,f,s,l);if(!h){g.logger.log("Unable to parse AAC frame");break}f+=h.length,u=h.sample.pts,l++}else y.default.isHeader(e,f)?(a=y.default.getID3Data(e,f),c.push({pts:u,dts:u,data:a}),f+=a.length):f++;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 g=r(20),s=r(21),P=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 U(e,t,r,n){this.observer=e,this.config=r,this.typeSupported=n,this.remuxer=t,this.sampleAes=null,this.g711buffer=[]}return U.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},U.probe=function(e){var t=U._syncOffset(e);return!(t<0||(t&&k.logger.warn("MPEG2-TS detected but first sync word found @ offset "+t+", junk ahead ?"),0))},U._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},U.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}},U.prototype.resetInitSegment=function(e,t,r,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=U.createTrack("video",n),this._audioTrack=U.createTrack("audio",n),this._id3Track=U.createTrack("id3",n),this._txtTrack=U.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)},U.prototype.resetTimeStamp=function(){},U.prototype.append=function(e,t,r,n){var i,a,o,s,l,u=e.length,d=!1;this.contiguous=r;var f=this.pmtParsed,c=this._avcTrack,h=this._audioTrack,p=this._id3Track,m=c.pid,g=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),I=this._parseMPEGPES.bind(this),R=this._parseID3PES.bind(this),C=U._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 m: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 g:a&&(b&&(l=T(b))&&void 0!==l.pts&&(h.isAAC&&!h.g711Config?x(l):h.g711Config?L(l):I(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&&R(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<(m=D.avc)&&(c.pid=m),0<(g=D.audio)&&(h.pid=g,h.isAAC=D.isAAC,h.g711Config=D.g711Config),0<(y=D.id3)&&(p.pid=y),d&&!f&&(k.logger.log("reparse from beginning"),d=!1,i=C-188),f=this.pmtParsed=!0;break;case 17:case 8191:break;default:d=!0}}else this.observer.trigger(P.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):I(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?(R(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)},U.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)},U.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)},U.prototype.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},U.prototype._parsePAT=function(e,t){return(31&e[t+10])<<8|e[t+11]},U.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},U.prototype._parsePES=function(e){var t,r,n,i,a,o,s,l,u=0,d=e.data;if(!e||0===e.size)return null;for(;d[0].length<19&&1<d.length;){var f=new Uint8Array(d[0].length+d[1].length);f.set(d[0]),f.set(d[1],d[0].length),d[0]=f,d.splice(1,1)}if(1!==((t=d[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=d.length;c<h;c++){var p=(t=d[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}},U.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)},U.prototype._parseAVCPES=function(p,e){var m,g,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:g=!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:g=!0,b||(b=v.avcSample=w(!0,p.pts,p.dts,"")),b.key=!0,b.frame=!0;break;case 6:g=!0,(m=new T.default(v.discardEPB(e.data))).readUByte();for(var n=0,i=0,a=!1,o=0;!a&&1<m.bytesAvailable;){for(n=0;n+=o=m.readUByte(),255===o;);for(i=0;i+=o=m.readUByte(),255===o;);if(4===n&&0!==m.bytesAvailable){if(a=!0,181===m.readUByte()&&49===m.readUShort()&&1195456820===m.readUInt()&&3===m.readUByte()){var s=m.readUByte(),l=31&s,u=[s,m.readUByte()];for(y=0;y<l;y++)u.push(m.readUByte()),u.push(m.readUByte()),u.push(m.readUByte());v._insertSampleInOrder(v._txtTrack.samples,{type:3,pts:p.pts,bytes:u})}}else if(i<m.bytesAvailable)for(y=0;y<i;y++)m.readUByte()}break;case 7:if(S=g=!0,!_.sps){var d=(m=new T.default(e.data)).readSPS();_.width=d.width,_.height=d.height,_.pixelRatio=d.pixelRatio,_.sps=[e.data],_.duration=v._duration;var f=e.data.subarray(1,4),c="avc1.";for(y=0;y<3;y++){var h=f[y].toString(16);h.length<2&&(h="0"+h),c+=h}_.codec=c}break;case 8:g=!0,_.pps||(_.pps=[e.data]);break;case 9:g=!1,_.audFound=!0,b&&E(b,_),b=v.avcSample=w(!1,p.pts,p.dts,"");break;case 12:g=!1;break;default:g=!1,b&&(b.debug+="unknown NAL "+e.type+" ")}b&&g&&b.units.push(e)}),e&&b&&(E(b,_),this.avcSample=null)},U.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)},U.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},U.prototype._parseAVCNALu=function(e){var t,r,n,i,a=0,o=e.byteLength,s=this._avcTrack,l=s.naluState||0,u=l,d=[],f=-1;for(-1===l&&(i=31&e[f=0],l=0,a=1);a<o;)if(t=e[a++],l)if(1!==l)if(t)if(1===t){var c,h;0<=f?(n={data:e.subarray(f,a-l-1),type:i},d.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[f=a],0):-1}else l=0;else l=3;else l=t?0:2;else l=t?0:1;return 0<=f&&0<=l&&(n={data:e.subarray(f,o),type:i,state:l},d.push(n)),0===d.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,d},U.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},U.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}},U.prototype._parseAACPES=function(e){var t,r,n,i,a,o=this._audioTrack,s=e.data,l=e.pts,u=this.aacOverFlow,d=this.aacLastPTS;if(u){var f=new Uint8Array(u.byteLength+s.byteLength);f.set(u,0),f.set(s,u.byteLength),s=f}for(n=0,a=s.length;n<a-1&&!g.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(P.default.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:h,reason:c}),h)return}if(g.initTrackConfig(o,this.observer,s,n,this.audioCodec),r=0,t=g.getFrameDuration(o.samplerate),u&&d){var p=d+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(g.isHeader(s,n)&&n+5<a){var m=g.appendFrame(o,s,n,l,r);if(!m)break;n+=m.length,i=m.sample.pts,r++}else n++;u=n<a?s.subarray(n,a):null,this.aacOverFlow=u,this.aacLastPTS=i},U.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++},U.prototype._parseID3PES=function(e){this._id3Track.samples.push(e)},U}();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,d=0,f=this.readUByte.bind(this),c=this.readBits.bind(this),h=this.readUEG.bind(this),p=this.readBoolean.bind(this),m=this.skipBits.bind(this),g=this.skipEG.bind(this),y=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);if(f(),e=f(),c(5),m(3),f(),y(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var _=h();if(3===_&&m(1),y(),y(),m(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(m(1),g(),g(),t=h(),o=0;o<t;o++)g();y(),m(1),r=h(),n=h(),0===(i=c(1))&&m(1),m(1),p()&&(s=h(),l=h(),u=h(),d=h());var S=[1,1];if(p()&&p())switch(f()){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=[f()<<8|f(),f()<<8|f()]}return{width:Math.ceil(16*(r+1)-2*s-2*l),height:(2-i)*(n+1)*16-(i?2:4)*(u+d),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 d=new Uint32Array(Math.round(o.length/1024)),f=a._malloc(d.length*d.BYTES_PER_ELEMENT);a.HEAPU32.set(d,f);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,f]),p=0;p<h;p+=1){var m=a.HEAPU32[f/Uint32Array.BYTES_PER_ELEMENT+p];d[p]=m}for(var g=0,y=0,v=this._getFrameDuration();y<h;)if(m=d[y],0!==y){var _={unit:a.HEAPU8.subarray(g+u/Uint8Array.BYTES_PER_ELEMENT,g+m+u/Uint8Array.BYTES_PER_ELEMENT),pts:r+y*v-v,dts:r+y*v-v};t.samples.push(_),t.len+=_.unit.length,g+=m,y+=1}else y+=1,g+=m;a._free(s),a._free(u),a._free(f)},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),m=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(m.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,d=0,f=this._audioTrack,c=[{pts:o,dts:o,data:i}];s<l;)if(m.default.isHeader(e,s)){var h=m.default.appendFrame(f,e,s,o,u);if(!h)break;s+=h.length,d=h.sample.pts,u++}else p.default.isHeader(e,s)?(i=p.default.getID3Data(e,s),c.push({pts:d,dts:d,data:i}),s+=i.length):s++;this.remuxer.remux(f,{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,d=i;if(s&&l){var f=(e.samples[0].pts-t.samples[0].pts)/t.inputTimeScale;u+=Math.max(0,f),d+=Math.max(0,-f)}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,d,a,h,o)}}else if(l){var p=this.remuxVideo(t,d,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",d={},f={tracks:d},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")),d.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,d.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(d).length?(console.log("trigger INIT Segment",f),a.trigger(Z.default.FRAG_PARSING_INIT_SEGMENT,f),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,d,f,c=8,h=e.timescale,p=e.samples,m=[],g=p.length,y=this._PTSNormalize,v=this._initPTS,_=this.nextAvcDts,b=this.isSafari;if(0!==g){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],f=Math.max(w.dts,0),d=Math.max(w.pts,0,f),b&&(a=Math.round((f-u)/(p.length-1)));var A=0,x=0;for(E=0;E<g;E++){for(var L=p[E],I=L.units,R=I.length,C=0,D=0;D<R;D++)C+=I[D].data.length;x+=C,A+=R,L.length=C,L.dts=b?u+E*a:Math.max(L.dts,u),L.pts=Math.max(L.pts,L.dts)}var U=x+4*A+8;try{o=new Uint8Array(U)}catch(e){return void this.observer.trigger(Z.default.ERROR,{type:Q.ErrorTypes.MUX_ERROR,details:Q.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:U,reason:"fail allocating video mdat "+U})}var P=new DataView(o.buffer);for(P.setUint32(0,U),o.set(X.default.types.mdat,4),E=0;E<g;E++){var k=p[E],O=k.units,M=0,F=void 0;for(D=0,R=O.length;D<R;D++){var B=O[D],N=B.data,z=B.data.byteLength;P.setUint32(c,z),c+=4,o.set(N,c),c+=z,M+=4+z}if(b)F=Math.max(0,a*Math.round((k.pts-k.dts)/a));else{if(E<g-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)}m.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=f+a;var W=e.dropped;if(e.len=0,e.nbNalu=0,e.dropped=0,m.length&&-1<navigator.userAgent.toLowerCase().indexOf("chrome")){var Y=m[0].flags;Y.dependsOn=2,Y.isNonSync=0}e.samples=m,s=X.default.moof(e.sequenceNumber++,u,e),e.samples=[];var K={data1:s,data2:o,startPTS:l/h,endPTS:(d+a)/h,startDTS:u/h,endDTS:this.nextAvcDts/h,type:"video",hasAudio:!1,hasVideo:!0,nb:m.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,d,f=e.inputTimeScale,c=e.timescale,h=f/c,p=(e.isAAC?1024:1152)*h,m=this._PTSNormalize,g=this._initPTS,y=!e.isAAC&&this.typeSupported.mpeg,v=e.samples,_=[],b=this.nextAudioPts;if(r|=v.length&&b&&(n&&Math.abs(t-b/f)<.1||Math.abs(v[0].pts-b-g)<20*p),v.forEach(function(e){e.pts=e.dts=m(e.pts-g,t*f)}),0!==(v=v.filter(function(e){return 0<=e.pts})).length){if(r||(b=n?t*f:v[0].pts),e.isAAC)for(var S=this.config.maxAudioFramesDrift,E=0,w=b;E<v.length;){var T,A=v[E];T=(P=A.pts)-w;var x=Math.abs(1e3*T/f);if(T<=-S*p)J.logger.warn("Dropping 1 audio frame @ "+(w/f).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/f).toFixed(3)+"s due to "+Math.round(1e3*T/f)+" ms gap.");for(var I=0;I<L;I++){var R=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:R,dts:R}),e.len+=o.length,w+=p,E++}A.pts=A.dts=w,w+=p,E++}else Math.abs(T)>.1*p&&J.logger.log("Invalid frame delta "+Math.round(T+p)+" at PTS "+Math.round(P/90)+" (should be "+Math.round(p)+")."),A.pts=A.dts=w,w+=p,E++}I=0;for(var C=v.length;I<C;I++){var D=v[I],U=D.unit,P=D.pts;if(void 0!==d)a.duration=Math.round((P-d)/h);else{var k=Math.round(1e3*(P-b)/f),O=0;if(r&&e.isAAC&&k){if(0<k&&k<1e4)O=Math.round((P-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=U.subarray()),e.len+=O*o.length);else if(k<-12){J.logger.log("drop overlapping AAC sample, expected/parsed/delta:"+(b/f).toFixed(3)+"s/"+(P/f).toFixed(3)+"s/"+-k+"ms"),e.len-=U.byteLength;continue}P=b}if(u=P,!(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=U.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(U,i);var F=U.byteLength;i+=F,a={size:F,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},_.push(a),d=P}var B=0,N=_.length;if(2<=N&&(B=_[N-2].duration,a.duration=B),N){this.nextAudioPts=b=d+h*B,e.len=0,e.samples=_,l=y?new Uint8Array:X.default.moof(e.sequenceNumber++,u/h,e),e.samples=[];var z=u/f,j=b/f,G={data1:l,data2:s,startPTS:z,endPTS:j,startDTS:z,endDTS:j,type:"audio",hasAudio:!0,hasVideo:!1,nb:N};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,d=Math.ceil((l-s)/u),f=H.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(J.logger.warn("remux empty Audio"),f){for(var c=[],h=0;h<d;h++){var p=s+h*u;c.push({unit:f,pts:p,dts:p}),e.len+=f.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],d=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,d>>24,d>>16&255,d>>8&255,255&d])))},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,d=12+16*u,f=new Uint8Array(d);for(t+=8+d,f.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,f.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,f)},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 d=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(d.default.FRAG_PARSING_DATA,{data1:s,startPTS:i,startDTS:i,type:u,hasAudio:!!e,hasVideo:!!t,nb:1,dropped:0}),l.trigger(d.default.FRAG_PARSED)},e}();t.default=n},function(e,t,r){var n=Object.prototype.hasOwnProperty,h="~";function i(){}function a(e,t,r,n,i){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new function(e,t,r){this.fn=e,this.context=t,this.once=r||!1}(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],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){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(d-1);l<d;l++)s[l-1]=arguments[l];u.fn.apply(u.context,s)}else{var f,c=u.length;for(l=0;l<c;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),d){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(f=1,s=new Array(d-1);f<d;f++)s[f-1]=arguments[f];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(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function l(e){return"function"==typeof e}function u(e){return"object"==typeof e&&null!==e}function d(e){return void 0===e}((e.exports=n).EventEmitter=n).prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,r,n,i,a,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||u(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var s=new Error('Uncaught, unspecified "error" event. ('+t+")");throw s.context=t,s}if(d(r=this._events[e]))return!1;if(l(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),r.apply(this,i)}else if(u(r))for(i=Array.prototype.slice.call(arguments,1),n=(o=r.slice()).length,a=0;a<n;a++)o[a].apply(this,i);return!0},n.prototype.on=n.prototype.addListener=function(e,t){var r;if(!l(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,l(t.listener)?t.listener:t),this._events[e]?u(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,u(this._events[e])&&!this._events[e].warned&&(r=d(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&0<r&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.once=function(e,t){if(!l(t))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var r,n,i,a;if(!l(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=(r=this._events[e]).length,n=-1,r===t||l(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(u(r)){for(a=i;0<a--;)if(r[a]===t||r[a].listener&&r[a].listener===t){n=a;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(l(r=this._events[e]))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?l(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(l(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},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,f){(function(i){Object.defineProperty(t,"__esModule",{value:!0});var r=f(10),a=f(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 d(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&&d(r,t.details)},t.alignDiscontinuities=n,t.alignPDT=d}).call(this,f(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),d=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&&(d.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,d.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),d.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;d.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 d.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(d){var n,r=this&&this.__extends||(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])},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),f=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=f.BufferHelper.bufferInfo(r||t,i,this.config.maxBufferHole);if(d.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=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])},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=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])},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,d=r(1),a=r(4),f=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,d.default.MANIFEST_LOADED,d.default.LEVEL_LOADED,d.default.AUDIO_TRACK_SWITCHED,d.default.FRAG_LOADED,d.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,f.logger.log("manifest loaded,"+r.length+" level(s) found, first bitrate:"+t);break}this.hls.trigger(d.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(d.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){f.logger.log("switching to level "+e),this.currentLevelIndex=e;var n=t[e];n.level=e,r.trigger(d.default.LEVEL_SWITCHING,n)}var i=t[e],a=i.details;if(!a||a.live){var o=i.urlId;r.trigger(d.default.LEVEL_LOADING,{url:i.url[o],level:e,id:o})}}else r.trigger(d.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,d=this._levels[t];if(d.loadError++,d.fragmentError=n,r){if(!(this.levelRetryCount+1<=l.levelLoadingMaxRetry))return f.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++,f.logger.warn("level controller, "+u+", retry in "+a+" ms, current retry count is "+this.levelRetryCount)}(r||n)&&(1<(i=d.url.length)&&d.loadError<i?(d.urlId=(d.urlId+1)%i,d.details=void 0,f.logger.warn("level controller, "+u+" for level "+t+": switching to redundant URL-id "+d.urlId)):-1===this.manualLevelIndex?(o=0===t?this._levels.length-1:t-1,f.logger.warn("level controller, "+u+": switch to "+o),this.hls.nextAutoLevel=this.currentLevelIndex=o):n&&(f.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,f.logger.log("same live playlist, reload twice faster")),o-=l.now()-e.stats.trequest,o=Math.max(a/2,Math.round(o)),f.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(f.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];f.logger.log("Attempt loading level index "+t+" with URL-id "+r),this.hls.trigger(d.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=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])},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),f=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=f.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(!f.default.isTimeStampFrame(u)){var d=new n(o,s,"");d.value=u,this.id3Track.addCue(d)}}}}},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=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])},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),d=l[r.level],f=d.realBitrate?Math.max(d.realBitrate,d.bitrate):d.bitrate,c=a.total?a.total:Math.max(a.loaded,Math.round(r.duration*f/8)),h=t.currentTime,p=(c-a.loaded)/u,m=(b.BufferHelper.bufferInfo(t,h,e.config.maxBufferHole).end-h)/s;if(m<2*r.duration/s&&m<p){var g=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((g=r.duration*v/(6.4*u))<m)break}g<p&&(S.logger.warn("loading too slow, abort fragment loading and switch to level "+y+":fragLoadedDelay["+y+"]<fragLoadedDelay["+(r.level-1)+"];bufferStarvationDelay:"+g.toFixed(1)+"<"+p.toFixed(1)+":"+m.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,d=this._bwEstimator?this._bwEstimator.getEstimate():n.abrEwmaDefaultEstimate,f=(b.BufferHelper.bufferInfo(a,l,n.maxBufferHole).end-l)/u,c=this._findBestLevel(o,s,d,i,t,f,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,m=n.abrBandWidthUpFactor;if(0===f){var g=this.bitrateTestDelay;g&&(h=(s?Math.min(s,n.maxLoadingDelay):n.maxLoadingDelay)-g,S.logger.trace("bitrate test took "+Math.round(1e3*g)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*h)+" ms"),p=m=1)}return c=this._findBestLevel(o,s,d,i,t,f+h,p,m,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 d=l[u];if(d){var f=d.details,c=f?f.totalduration/f.fragments.length:t,h=!!f&&f.live,p=void 0;p=u<=e?o*r:s*r;var m=l[u].realBitrate?Math.max(l[u].realBitrate,l[u].bitrate):l[u].bitrate,g=m*c/p;if(S.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(p)+"/"+m+"/"+c+"/"+a+"/"+g),m<p&&(!g||h&&!this.bitrateTestDelay||g<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=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])},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),d=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:d.ErrorTypes.MEDIA_ERROR,details:d.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:d.ErrorTypes.MEDIA_ERROR,details:d.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:d.ErrorTypes.MEDIA_ERROR,details:d.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:d.ErrorTypes.MEDIA_ERROR,parent:n.parent};22!==r.code?(this.appendError?this.appendError++:this.appendError=1,a.details=d.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=d.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=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])},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=e.length-1,i=0;i<e.length;i+=1){var a=e[i];if((a.width>=t||a.height>=r)&&(o=a,!(s=e[i+1])||o.width!==s.width||o.height!==s.height)){n=i;break}}var o,s;return n},i}(o(4).default);r.default=t}).call(this,o(2).Number)},function(e,t,r){var n,i=this&&this.__extends||(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])},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 d=r(1),a=r(4),f=r(0),c=window.performance,o=function(t){function e(e){return t.call(this,e,d.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(d.default.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:r}),0<s&&a>l.config.fpsDroppedMonitoringThreshold*o){var u=l.currentLevel;f.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(d.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 d=r(0),f=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:f.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(f.now(),n.trequest)),4===r){var o=t.status;if(200<=o&&o<300){n.tload=Math.max(n.tfirst,f.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?(d.logger.error(o+" while loading "+i.url),this.callbacks.onError({code:o,text:t.statusText},i,t)):(d.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(){d.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)}),Wi=e(Vi),Yi=(Vi.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}());(Gi=ji||(ji={})).COMMON="COMMON",Gi.HLS="HLS",Gi.NATIVE="NATIVE",Gi.MP4="MP4",(qi=Hi||(Hi={}))[qi.UNSUPPORT=1e4]="UNSUPPORT",qi[qi.UNKNOWN_FORMAT=10001]="UNKNOWN_FORMAT",qi[qi.CAN_NOT_FETCH=10002]="CAN_NOT_FETCH",qi[qi.FULLSCRREN_NOTSUPPORT=10003]="FULLSCRREN_NOTSUPPORT",qi[qi.VIDEO_SOURCE_STALLED=10004]="VIDEO_SOURCE_STALLED",qi[qi.VIDEO_ELEMENT_ERROR=10005]="VIDEO_ELEMENT_ERROR",qi[qi.VIDEO_PLAY_FAILD=10006]="VIDEO_PLAY_FAILD",qi[qi.INVALID_CONFIG=10007]="INVALID_CONFIG",qi[qi.UNEXPECTED_ERROR=10008]="UNEXPECTED_ERROR",qi[qi.HLS_FATAL_ERROR=10009]="HLS_FATAL_ERROR",qi[qi.CAN_NOT_FETCH_WASM=10010]="CAN_NOT_FETCH_WASM",qi[qi.MP4_DRM_KEY_ERROR=10011]="MP4_DRM_KEY_ERROR";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=10;function ta(e){return void 0===e._maxListeners?Ji.defaultMaxListeners:e._maxListeners}function ra(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=ta(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 na(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 ia(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):oa(i,i.length)}function aa(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 oa(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(Ji,"defaultMaxListeners",{enumerable:!0,get:function(){return ea},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+".");ea=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 ta(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=oa(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 ra(this,e,t,!1)},Ji.prototype.prependListener=function(e,t){return ra(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,na(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,na(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 ia(this,e,!0)},Ji.prototype.rawListeners=function(e){return ia(this,e,!1)},Ji.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):aa.call(e,t)},Ji.prototype.listenerCount=aa,Ji.prototype.eventNames=function(){return 0<this._eventsCount?Ki(this._events):[]};var sa=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}($i),la=function(n){function e(e,t,r){return n.call(this,e,t,r)||this}return t(e,n),e}(sa),ua={VERBOSE:0,DEBUG:1,WARNING:2,DISABLE:3},da=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(!(ua[this.level]>ua.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(!(ua[this.level]>ua.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(!(ua[this.level]>ua.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 ua)if(ua[t]===e)return void(this.level=t);this.level="DEBUG"},e}())("QPLAYER"),fa=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 Yi(ji.HLS,Hi.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)&&Wi.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"!==da.level&&"DISABLE"!==da.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 Wi(e),this.hls.loadSource(this.config.url),this.hls.attachMedia(this.render.video),this.hls.once(Wi.Events.MANIFEST_PARSED,function(){da.verbose("hls: mainfest parsed"),r.emit("#hls:mainfest-parsed"),r.emit("@get-quality-list",r.qualityList)}),this.hls.on(Wi.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(Wi.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(Wi.Events.ERROR,function(e,t){switch(console.log("handle hls error!",t),r.render.isLoading=!1,t.type){case Wi.ErrorTypes.NETWORK_ERROR:if(t.response&&400<t.response.code&&t.response.code<500)return r.emit("error",new Yi(ji.COMMON,Hi.CAN_NOT_FETCH,t.details)),void r.hls.destroy();if(!t.fatal)return;da.warning("hls network fatal error, try to recovery"),r.hls.startLoad();break;case Wi.ErrorTypes.MEDIA_ERROR:if(!t.fatal)return;da.warning("hls media fatal error, try to recovery"),r.hls.recoverMediaError();break;default:if(!t.fatal)return;r.emit("error",new Yi(ji.HLS,Hi.HLS_FATAL_ERROR,t.details))}}),this.handleRenderEvents()},i}(la),ca=function(e,t){return(ca=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 ha(e,t){function r(){this.constructor=e}ca(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var pa,ma="object"==typeof Reflect?Reflect:null,ga=ma&&"function"==typeof ma.apply?ma.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};pa=ma&&"function"==typeof ma.ownKeys?ma.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var ya=Number.isNaN||function(e){return e!=e};function va(){va.init.call(this)}var _a=va;(va.EventEmitter=va).prototype._events=void 0,va.prototype._eventsCount=0,va.prototype._maxListeners=void 0;var ba,Sa,Ea,wa,Ta,Aa,xa=10;function La(e){return void 0===e._maxListeners?va.defaultMaxListeners:e._maxListeners}function Ia(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=La(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 Ra(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,ga(this.listener,this.target,e))}.bind(n);return i.listener=r,n.wrapFn=i}function Ca(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):Ua(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 Ua(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function Pa(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 ka(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 Oa(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 Fa(e,t,r){var n={type:t,message:r};console.warn("DRM MP4 ERROR: "+t+", "+r),e.emit("error",n)}Object.defineProperty(va,"defaultMaxListeners",{enumerable:!0,get:function(){return xa},set:function(e){if("number"!=typeof e||e<0||ya(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");xa=e}}),va.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},va.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||ya(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},va.prototype.getMaxListeners=function(){return La(this)},va.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)ga(s,this,t);else{var l=s.length,u=Ua(s,l);for(r=0;r<l;++r)ga(u[r],this,t)}return!0},va.prototype.on=va.prototype.addListener=function(e,t){return Ia(this,e,t,!1)},va.prototype.prependListener=function(e,t){return Ia(this,e,t,!0)},va.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,Ra(this,e,t)),this},va.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,Ra(this,e,t)),this},va.prototype.off=va.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},va.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},va.prototype.listeners=function(e){return Ca(this,e,!0)},va.prototype.rawListeners=function(e){return Ca(this,e,!1)},va.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Da.call(e,t)},va.prototype.listenerCount=Da,va.prototype.eventNames=function(){return 0<this._eventsCount?pa(this._events):[]},(Sa=ba||(ba={})).NEED_BUFFER="needbuffer",Sa.BUFFER_IS_ENOUGH="bufferisenough",(wa=Ea||(Ea={})).NETWORK="network",wa.MEDIA="media",wa.KEY="key",wa.OTHER="other",(Aa=Ta||(Ta={})).ON_CHUNK="fetchio:on_chunk",Aa.ENDED="fetchio:end",Aa.INTERNAL_BUFFER_IO_STATE_CHANGE="@bufferio_state_change";var Ba=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=ba.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(Ta.INTERNAL_BUFFER_IO_STATE_CHANGE))},t.drmMp4=e,t.maxIoRetry=t.drmMp4.config.maxIoRetry,t}return ha(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 Fa(n.drmMp4,Ea.NETWORK,"can not request"):(console.warn("response status:",e.status,"retry"),void n.retry(n.url,{start:n.currentDownloadRange.end,end:-1}));Fa(n.drmMp4,Ea.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 Fa(this.drmMp4,Ea.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!==ba.NEED_BUFFER?i.on(Ta.INTERNAL_BUFFER_IO_STATE_CHANGE,function(){if(i.bufferIoState===ba.NEED_BUFFER)return i.removeAllListeners(Ta.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(Ta.ENDED)):(i.emit(Ta.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}(_a);var Na,za,ja,Ga=(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),d=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,d=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","'"+d+"' 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 '"+d+"' 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 '"+d+"' 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 d=function(){};d.prototype.parseSample=function(e){return new i(e.data.buffer).readString(e.data.length)},d.prototype.parseConfig=function(e){var t=new i(e.buffer);return t.readUint32(),t.readCString()},t.XMLSubtitlein4Parser=l,t.Textin4Parser=d;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,d,f,c,h,p,m,g,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,d=e.mdia.minf.stbl.sbgps,f=e.mdia.minf.stbl.sgpds,S=b=_=v=-1,T=w=E=0,x.initSampleGroups(e,null,d,f),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],g=0,m=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++,g=0,(A.chunk_index=p)<=m||(m=++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]+g,g+=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<d.length||0<f.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,d,f,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(d=u.trafs[e],f=this.getTrackById(d.tfhd.track_id),c=this.getTrexById(d.tfhd.track_id),n=d.tfhd.flags&S.TFHD_FLAG_SAMPLE_DESC?d.tfhd.default_sample_description_index:c?c.default_sample_description_index:1,i=d.tfhd.flags&S.TFHD_FLAG_SAMPLE_DUR?d.tfhd.default_sample_duration:c?c.default_sample_duration:0,a=d.tfhd.flags&S.TFHD_FLAG_SAMPLE_SIZE?d.tfhd.default_sample_size:c?c.default_sample_size:0,o=d.tfhd.flags&S.TFHD_FLAG_SAMPLE_FLAGS?d.tfhd.default_sample_flags:c?c.default_sample_flags:0,(d.sample_number=0)<d.sbgps.length&&x.initSampleGroups(f,d,d.sbgps,f.mdia.minf.stbl.sgpds,d.sgpds),t=0;t<d.truns.length;t++){var m=d.truns[t];for(r=0;r<m.sample_count;r++){(h={}).number_in_traf=d.sample_number,d.sample_number++,h.number=f.samples.length,d.first_sample_index=f.samples.length,f.samples.push(h),h.track_id=f.tkhd.track_id,h.timescale=f.mdia.mdhd.timescale,h.description_index=n-1,h.description=f.mdia.minf.stbl.stsd.entries[h.description_index],h.size=a,m.flags&S.TRUN_FLAGS_SIZE&&(h.size=m.sample_size[r]),f.samples_size+=h.size,h.duration=i,m.flags&S.TRUN_FLAGS_DURATION&&(h.duration=m.sample_duration[r]),f.samples_duration+=h.duration,f.first_traf_merged||0<r?h.dts=f.samples[f.samples.length-2].dts+f.samples[f.samples.length-2].duration:(d.tfdt?h.dts=d.tfdt.baseMediaDecodeTime:h.dts=0,f.first_traf_merged=!0),h.cts=h.dts,m.flags&S.TRUN_FLAGS_CTS_OFFSET&&(h.cts=h.dts+m.sample_composition_time_offset[r]),p=o,m.flags&S.TRUN_FLAGS_FLAGS?p=m.sample_flags[r]:0===r&&m.flags&S.TRUN_FLAGS_FIRST_FLAG&&(p=m.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 g=!!(d.tfhd.flags&S.TFHD_FLAG_BASE_DATA_OFFSET),y=!!(d.tfhd.flags&S.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),v=!!(m.flags&S.TRUN_FLAGS_DATA_OFFSET),_=0;_=g?d.tfhd.base_data_offset:y?u.start:0===t?u.start:s,h.offset=0===t&&0===r?v?_+m.data_offset:_:s,s=h.offset+h.size,(0<d.sbgps.length||0<d.sgpds.length||0<f.mdia.minf.stbl.sbgps.length||0<f.mdia.minf.stbl.sgpds.length)&&x.setSampleGroupProperties(f,h,h.number_in_traf,d.sample_groups_info)}}if(d.subs){f.has_fragment_subsamples=!0;var b=d.first_sample_index;for(t=0;t<d.subs.entries.length;t++)b+=d.subs.entries[t].sample_delta,(h=f.samples[b-1]).subsamples=d.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 d=u.props[t];if(0<d.property_index){var f=i.iprp.ipco.boxes[d.property_index-1];r.properties[f.type]=f,r.properties.boxes.push(f)}}}}}},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 f={createFile:function(e,t){var r=void 0===e||e,n=new x(t);return n.discardMdatData=!r,n}};t.createFile=f.createFile}(Na={exports:{}},Na.exports),Na.exports);Ga.Log,Ga.MP4BoxStream,Ga.DataStream,Ga.MultiBufferStream,Ga.MPEG4DescriptorParser,Ga.BoxParser,Ga.XMLSubtitlein4Parser,Ga.Textin4Parser,Ga.ISOFile,Ga.createFile;(ja=za||(za={})).INIT_SEGMENT="muxer:init_segment",ja.SEGMENT="muxer:segment",ja.DURATION_UPDATE="muxer:duration_update",ja.SEEK="muxer:seek",ja.ENDED="muxer:ended";var Ha,qa=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(za.ENDED)},o.seek=function(e){var t=o.mp4File.seek(e,!0);-1!==t.offset&&o.emit(za.SEEK,t.offset)},o.handleMp4Ready=function(r){o.info=r,o.emit(za.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(za.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(za.SEGMENT,a,i.video?"video":"audio")}}},o.drmMp4=e,o}return ha(e,t),e.prototype.release=function(){},e.prototype.createMp4File=function(){this.mp4File=Ga.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=Pa(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=Pa(e,r);if(i<a.size){this.lastBufferData=e.slice(r,e.length);break}if("cpky"===a.type){if(this.keyBoxSize+=a.size,this.compKey=e.slice(r+8,r+a.size),!Ma(this.compKey,this.drmMp4.config.compKey))return Fa(this.drmMp4,Ea.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 o=e.slice(r,r+a.size);t.set(o,n),n+=o.length}r+=a.size}return t.slice(0,n)},e}(_a);(Ha||(Ha={})).BUFFER_IO_STATE_CHANGE="buffer:io_state_change";var Va,Wa,Ya=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=ba.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){Fa(a.drmMp4,Ea.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():ka(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():ka(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 ha(e,r),Object.defineProperty(e.prototype,"bufferIoState",{get:function(){return this._bufferIoState},set:function(e){e!==this._bufferIoState&&(this._bufferIoState=e,this.emit(Ha.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){Fa(this.drmMp4,Ea.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){Fa(this.drmMp4,Ea.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){Fa(this.drmMp4,Ea.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=ba.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=Oa(this.pendingRemoveRanges.audio,{start:o,end:o+(e-o-.2*t)})),this.sourceBuffers.video&&(this.pendingRemoveRanges.video=Oa(this.pendingRemoveRanges.video,{start:o,end:o+(e-o-.2*t)}))),.7*t<=s-e&&(this.bufferIoState=ba.BUFFER_IS_ENOUGH),s-e<=.5*t&&(this.bufferIoState=ba.NEED_BUFFER)):(n=!0,this.sourceBuffers.audio&&(this.pendingRemoveRanges.audio=Oa(this.pendingRemoveRanges.audio,{start:o,end:s})),this.sourceBuffers.video&&(this.pendingRemoveRanges.video=Oa(this.pendingRemoveRanges.video,{start:o,end:s})))}return i||(this.bufferIoState=ba.NEED_BUFFER),n},e}(_a);(Wa=Va||(Va={})).SEEK="media:seek",Wa.TIMEUPDATE="media:timeupdate",Wa.PRELOAD="media:preload";var Ka=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(Va.SEEK,r.media.currentTime)):void 0!==t&&(r.nextUnbufferedTime=t);break;case"timeupdate":r.emit(Va.TIMEUPDATE,r.media.currentTime)}},r.media=e,r.bindMediaEvents(),r}return ha(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}(_a);var Xa=function(n){function e(e,t){var r=n.call(this)||this;return r.config=t,r.video=e,r}return ha(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 Ka(this.video),this.io=new Ba(this),this.muxer=new qa(this),this.buffer=new Ya(this.video,this),this.io.on(Ta.ON_CHUNK,this.muxer.appendBuffer),this.io.on(Ta.ENDED,this.muxer.flushBuffer),this.muxer.on(za.INIT_SEGMENT,this.buffer.appendInitSegment),this.muxer.on(za.SEGMENT,this.buffer.appendSegment),this.muxer.on(za.DURATION_UPDATE,this.buffer.updateDuration),this.muxer.on(za.ENDED,this.buffer.endStream),this.media.on(Va.SEEK,this.muxer.seek),this.media.on(Va.PRELOAD,this.muxer.seek),this.muxer.on(za.SEEK,this.io.seek),this.media.on(Va.TIMEUPDATE,this.buffer.handleTimeUpdate),this.media.on(Va.SEEK,this.buffer.handleTimeUpdate),this.buffer.on(Ha.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}(_a),Za=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 Xa(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)&&Xa.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 Yi(ji.MP4,Hi.MP4_DRM_KEY_ERROR,"mp4 drm key is error!"))}}),this.core.start(this.config.url),this.handleRenderEvents()},e}(sa),Qa=function(n){function i(e,t){var r=n.call(this,e,t,[])||this;if(!i.isSupport())throw new Yi(ji.NATIVE,Hi.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 da.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}(sa);function Ja(e,t){return e(t={exports:{}},t.exports),t.exports}var $a=Ja(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)}),eo=Ja(function(e){var t=e.exports={version:"2.6.3"};"number"==typeof __e&&(__e=t)}),to=(eo.version,function(e){return"object"==typeof e?null!==e:"function"==typeof e}),ro=function(e){if(!to(e))throw TypeError(e+" is not an object!");return e},no=function(e){try{return!!e()}catch(e){return!0}},io=!no(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),ao=$a.document,oo=to(ao)&&to(ao.createElement),so=!io&&!no(function(){return 7!=Object.defineProperty((e="div",oo?ao.createElement(e):{}),"a",{get:function(){return 7}}).a;var e}),lo=Object.defineProperty,uo={f:io?Object.defineProperty:function(e,t,r){if(ro(e),t=function(e,t){if(!to(e))return e;var r,n;if(t&&"function"==typeof(r=e.toString)&&!to(n=r.call(e)))return n;if("function"==typeof(r=e.valueOf)&&!to(n=r.call(e)))return n;if(!t&&"function"==typeof(r=e.toString)&&!to(n=r.call(e)))return n;throw TypeError("Can't convert object to primitive value")}(t,!0),ro(r),so)try{return lo(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}},fo=io?function(e,t,r){return uo.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},co={}.hasOwnProperty,ho=function(e,t){return co.call(e,t)},po=0,mo=Math.random(),go=Ja(function(e){var t,a="Symbol(".concat(void 0===(t="src")?"":t,")_",(++po+mo).toString(36)),r="toString",n=Function[r],o=(""+n).split(r);eo.inspectSource=function(e){return n.call(e)},(e.exports=function(e,t,r,n){var i="function"==typeof r;i&&(ho(r,"name")||fo(r,"name",t)),e[t]!==r&&(i&&(ho(r,a)||fo(r,a,e[t]?""+e[t]:o.join(String(t)))),e===$a?e[t]=r:n?e[t]?e[t]=r:fo(e,t,r):(delete e[t],fo(e,t,r)))})(Function.prototype,r,function(){return"function"==typeof this&&this[a]||n.call(this)})}),yo=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)}},vo="prototype",_o=function(e,t,r){var n,i,a,o,s=e&_o.F,l=e&_o.G,u=e&_o.S,d=e&_o.P,f=e&_o.B,c=l?$a:u?$a[t]||($a[t]={}):($a[t]||{})[vo],h=l?eo:eo[t]||(eo[t]={}),p=h[vo]||(h[vo]={});for(n in l&&(r=t),r)a=((i=!s&&c&&void 0!==c[n])?c:r)[n],o=f&&i?yo(a,$a):d&&"function"==typeof a?yo(Function.call,a):a,c&&go(c,n,a,e&_o.U),h[n]!=a&&fo(h,n,o),d&&p[n]!=a&&(p[n]=a)};$a.core=eo,_o.F=1,_o.G=2,_o.S=4,_o.P=8,_o.B=16,_o.W=32,_o.U=64,_o.R=128;var bo=_o,So=Math.ceil,Eo=Math.floor,wo=function(e){return isNaN(e=+e)?0:(0<e?Eo:So)(e)},To=Math.min,Ao=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},xo=function(e,t,r,n){var i,a=String(Ao(e)),o=a.length,s=void 0===r?" ":String(r),l=0<(i=t)?To(wo(i),9007199254740991):0;if(l<=o||""==s)return a;var u=l-o,d=function(e){var t=String(Ao(this)),r="",n=wo(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 d.length>u&&(d=d.slice(0,u)),n?d+a:a+d},Lo=$a.navigator,Io=Lo&&Lo.userAgent||"";bo(bo.P+bo.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(Io),"String",{padStart:function(e){return xo(this,e,1<arguments.length?arguments[1]:void 0,!0)}});eo.String.padStart;var Ro=function(){},Co={},Do=[],Uo=[];function Po(e,t){var r,n,i,a,o=Uo;for(a=arguments.length;2<a--;)Do.push(arguments[a]);for(t&&null!=t.children&&(Do.length||Do.push(t.children),delete t.children);Do.length;)if((n=Do.pop())&&void 0!==n.pop)for(a=n.length;a--;)Do.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===Uo?o=[n]:o.push(n),r=i;var s=new Ro;return s.nodeName=e,s.children=o,s.attributes=null==t?void 0:t,s.key=null==t?void 0:t.key,s}function ko(e,t){for(var r in t)e[r]=t[r];return e}function Oo(e,t){null!=e&&("function"==typeof e?e(t):e.current=t)}var Mo="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,Fo=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,Bo=[];function No(e){!e._dirty&&(e._dirty=!0)&&1==Bo.push(e)&&Mo(zo)}function zo(){for(var e;e=Bo.pop();)e._dirty&&as(e)}function jo(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function Go(e){var t=ko({},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 Ho(e){var t=e.parentNode;t&&t.removeChild(e)}function qo(e,t,r,n,i){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)Oo(r,null),Oo(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===Fo.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,Vo,o):e.removeEventListener(t,Vo,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 Vo(e){return this._listeners[e.type](e)}var Wo=[],Yo=0,Ko=!1,Xo=!1;function Zo(){for(var e;e=Wo.shift();)e.componentDidMount&&e.componentDidMount()}function Qo(e,t,r,n,i,a){Yo++||(Ko=null!=i&&void 0!==i.ownerSVGElement,Xo=null!=e&&!("__preactattr_"in e));var o=Jo(e,t,r,n,a);return i&&o.parentNode!==i&&i.appendChild(o),--Yo||(Xo=!1,a||Zo()),o}function Jo(e,t,r,n,i){var a=e,o=Ko;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),$o(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=Go(t);for(;i&&!l&&(i=i._parentComponent);)l=i.constructor===t.nodeName;i&&l&&(!n||i._component)?(is(i,u,3,r,n),e=i.base):(a&&!s&&(os(a),e=o=null),i=rs(t.nodeName,u,r),e&&!i.nextBase&&(i.nextBase=e,o=null),is(i,u,1,r,n),e=i.base,o&&e!==o&&(o._component=null,$o(o,!1)));return e}(e,t,r,n);if(Ko="svg"===u||"foreignObject"!==u&&Ko,u=String(u),(!e||!jo(e,u))&&(s=u,(l=Ko?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),$o(e,!0)}var d=a.firstChild,f=a.__preactattr_,c=t.children;if(null==f){f=a.__preactattr_={};for(var h=a.attributes,p=h.length;p--;)f[h[p].name]=h[p].value}return!Xo&&c&&1===c.length&&"string"==typeof c[0]&&null!=d&&void 0!==d.splitText&&null==d.nextSibling?d.nodeValue!=c[0]&&(d.nodeValue=c[0]):(c&&c.length||null!=d)&&function(e,t,r,n,i){var a,o,s,l,u,d=e.childNodes,f=[],c={},h=0,p=0,m=d.length,g=0,y=t?t.length:0;if(0!==m)for(var v=0;v<m;v++){var _=d[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))&&(f[g++]=_)}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<g)for(a=p;a<g;a++)if(void 0!==f[a]&&(E=o=f[a],T=i,"string"==typeof(w=l)||"number"==typeof w?void 0!==E.splitText:"string"==typeof w.nodeName?!E._componentConstructor&&jo(E,w.nodeName):T||E._componentConstructor===w.nodeName)){u=o,f[a]=void 0,a===g-1&&g--,a===p&&p++;break}u=Jo(u,l,r,n),s=d[v],u&&u!==e&&u!==s&&(null==s?e.appendChild(u):u===s.nextSibling?Ho(s):e.insertBefore(u,s))}var E,w,T;if(h)for(var v in c)void 0!==c[v]&&$o(c[v],!1);for(;p<=g;)void 0!==(u=f[g--])&&$o(u,!1)}(a,c,r,n,Xo||null!=f.dangerouslySetInnerHTML),function(e,t,r){var n;for(n in r)t&&null!=t[n]||null==r[n]||qo(e,n,r[n],r[n]=void 0,Ko);for(n in t)"children"===n||"innerHTML"===n||n in r&&t[n]===("value"===n||"checked"===n?e[n]:r[n])||qo(e,n,r[n],r[n]=t[n],Ko)}(a,t.attributes,f),Ko=o,a}function $o(e,t){var r=e._component;r?os(r):(null!=e.__preactattr_&&Oo(e.__preactattr_.ref,null),!1!==t&&null!=e.__preactattr_||Ho(e),es(e))}function es(e){for(e=e.lastChild;e;){var t=e.previousSibling;$o(e,!0),e=t}}var ts=[];function rs(e,t,r){var n,i=ts.length;for(e.prototype&&e.prototype.render?(n=new e(t,r),ss.call(n,t,r)):((n=new ss(t,r)).constructor=e,n.render=ns);i--;)if(ts[i].constructor===e)return n.nextBase=ts[i].nextBase,ts.splice(i,1),n;return n}function ns(e,t,r){return this.constructor(e,r)}function is(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===Co.syncComponentUpdates&&e.base?No(e):as(e,1,i)),Oo(e.__ref,e))}function as(e,t,r,n){if(!e._disable){var i,a,o,s=e.props,l=e.state,u=e.context,d=e.prevProps||s,f=e.prevState||l,c=e.prevContext||u,h=e.base,p=e.nextBase,m=h||p,g=e._component,y=!1,v=c;if(e.constructor.getDerivedStateFromProps&&(l=ko(ko({},l),e.constructor.getDerivedStateFromProps(s,l)),e.state=l),h&&(e.props=d,e.state=f,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=ko(ko({},u),e.getChildContext())),h&&e.getSnapshotBeforeUpdate&&(v=e.getSnapshotBeforeUpdate(d,f));var _,b,S=i&&i.nodeName;if("function"==typeof S){var E=Go(i);(a=g)&&a.constructor===S&&E.key==a.__key?is(a,E,1,u,!1):(_=a,e._component=a=rs(S,E,u),a.nextBase=a.nextBase||p,a._parentComponent=e,is(a,E,0,u,!1),as(a,1,r,!0)),b=a.base}else o=m,(_=g)&&(o=e._component=null),(m||1===t)&&(o&&(o._component=null),b=Qo(o,i,u,r||!h,m&&m.parentNode,!0));if(m&&b!==m&&a!==g){var w=m.parentNode;w&&b!==w&&(w.replaceChild(b,m),_||(m._component=null,$o(m,!1)))}if(_&&os(_),(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?Wo.push(e):y||e.componentDidUpdate&&e.componentDidUpdate(d,f,v);e._renderCallbacks.length;)e._renderCallbacks.pop().call(e);Yo||n||Zo()}}function os(e){var t=e.base;e._disable=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var r=e._component;r?os(r):t&&(null!=t.__preactattr_&&Oo(t.__preactattr_.ref,null),Ho(e.nextBase=t),ts.push(e),es(t)),Oo(e.__ref,null)}function ss(e,t){this._dirty=!0,this.context=t,this.props=e,this.state=this.state||{},this._renderCallbacks=[]}function ls(e,t,r){return Qo(r,e,{},!1,t,!1)}ko(ss.prototype,{setState:function(e,t){this.prevState||(this.prevState=this.state),this.state=ko(ko({},this.state),"function"==typeof e?e(this.state,this.props):e),t&&this._renderCallbacks.push(t),No(this)},forceUpdate:function(e){e&&this._renderCallbacks.push(e),as(this,2)},render:function(){}});var us=function(e,t){return(us=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 ds(e,t){function r(){this.constructor=e}us(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var fs=Ja(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 cs(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))}}cs(".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");cs("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");cs('\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');cs(".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 hs=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:_s(t),timeTooltipPos:100*t/r.props.totalTime})},r}return ds(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 Po("div",{onClick:this.handleMouseUp,onMouseMove:this.handleHoverTooltips,ref:this.handleRef,style:"background: "+r.playerBarBackground,className:"qplayer-bar"},t.map(function(e,t){return Po("div",{className:"qplayer-barbuff",key:t,style:"background: "+r.playerBarBufferedBackground+"; width: "+e.width+"%; left: "+e.left+"%"})}),Po("div",{className:"qplayer-barcurr",style:"background: "+r.playerBarPlayedBackground+"; width: "+e+"%"}),Po("div",{style:{left:this.state.timeTooltipPos+"%"},className:"qplayer-timetooltip","data-balloon":this.state.timeTooltipText}))},t}(ss);cs(".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 ps=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 ds(t,e),t.prototype.updateValueFromMouseEvent=function(e){if(!this.wrapper)return-1;var t=this.wrapper.clientHeight,r=(this.wrapper.getBoundingClientRect().bottom-e.pageY)/t;return r=Math.min(r,this.props.maxValue),r=Math.max(r,this.props.minValue)},t.prototype.render=function(){return Po("div",{ref:this.handleRef,className:"qplayer-volume_sliderwrapper",onMouseDown:this.handleMouseDown},Po("div",{className:"qplayer-volume_slider"}),Po("div",{style:{bottom:"calc("+100*this.props.value+"% - 7px)"},className:"qplayer-volume_thumb"}),Po("div",{style:{height:100*this.props.value+"%"},className:"qplayer-volume_slider_active"}))},t}(ss);cs(".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 ms,gs,ys=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 ds(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("正在切换到清晰度 "+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 Po("div",{style:{height:45+26*e},onMouseLeave:this.props.onClose,ref:function(e){return t.element=e},className:fs({"qplayer-settings":!0,"qplayer-active":this.props.show})},Po("div",{className:fs({"qplayer-setting-tab":!0,"qplayer-active":null===this.state.currentSetting,"qplayer-main-setting":!0})},Po("div",{className:"qplayer-setting-header"},r),Po("button",{className:"qplayer-setting-close",onClick:this.props.onClose},Po("img",{src:n.closeIcon})),this.state.currentQuality&&Po("div",{onClick:function(){return t.setState({currentSetting:"quality"})},className:"qplayer-setting-item"},Po("span",{className:"qplayer-setting-item-title"},"清晰度"),Po("span",{className:"qplayer-setting-item-value"},this.getQualityName(this.state.currentQuality,this.state.isAutoQualitySwitch))),Po("div",{className:"qplayer-setting-item",onClick:function(){return t.setState({currentSetting:"speed"})}},Po("span",{className:"qplayer-setting-item-title"},"播放速度"),Po("span",{className:"qplayer-setting-item-value"},this.state.currentSpeed)),Po("div",{className:"qplayer-setting-item",onClick:function(){return t.setState({currentSetting:"loop"})}},Po("span",{className:"qplayer-setting-item-title"},"循环播放"),Po("span",{className:"qplayer-setting-item-value"},this.state.isLoop?"打开":"关闭"))),Po("div",{className:fs({"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 Po("div",{className:"qplayer-subsetting"},Po("div",{className:"qplayer-setting-header"},e),Po("button",{onClick:function(){return t.setState({currentSetting:null})}},Po("img",{src:r.backIcon})),Po("ul",{className:"qplayer-setting-list"},this.state.isSupportAutoQualitySwitch&&Po("li",{className:"qplayer-setting-listitem",key:"auto",onClick:function(){return t.handleChangeQuality("auto")}},Po("span",{className:this.state.isAutoQualitySwitch?"qplayer-active":void 0}," ","自动("+n.name+")"," ")),this.state.qualityList.map(function(e){return Po("li",{className:"qplayer-setting-listitem",key:e.id,onClick:function(){return t.handleChangeQuality(e.id)}},Po("span",{className:n.id!==e.id||t.state.isAutoQualitySwitch?void 0:"qplayer-active"}," ",e.name," "))})));case"speed":return Po("div",{className:"qplayer-subsetting"},Po("div",{className:"qplayer-setting-header"},e),Po("button",{onClick:function(){return t.setState({currentSetting:null})}},Po("img",{src:r.backIcon})),Po("ul",{className:"qplayer-setting-list"},[.25,.5,.75,1,1.25,1.5,1.75,2].map(function(e){return Po("li",{className:"qplayer-setting-listitem",key:e,onClick:function(){return t.handleChangeSpeed(e)}},Po("span",{className:t.state.currentSpeed===e?"qplayer-active":void 0}," ",e," "))})));case"loop":return Po("div",{className:"qplayer-subsetting"},Po("div",{className:"qplayer-setting-header"},e),Po("button",{onClick:function(){return t.setState({currentSetting:null})}},Po("img",{src:r.backIcon})),Po("ul",{className:"qplayer-setting-list"},Po("li",{className:"qplayer-setting-listitem",onClick:function(){return t.handleChangeLoop(!0)}},Po("span",null,"打开")),Po("li",{className:"qplayer-setting-listitem",onClick:function(){return t.handleChangeLoop(!1)}},Po("span",null,"关闭"))))}return null},e}(ss);(gs=ms||(ms={})).VOLUME_CONTROL="volume",gs.SEEK_CONTROL="seek";var vs=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){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.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 ms.SEEK_CONTROL:s.setState({gestureSeekTime:.3*n});break;case ms.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:ms.SEEK_CONTROL,gestureSeekTime:0});else{if(/iPad|iPhone|iPod/.test(navigator.userAgent))break;s.setState({gestureType:ms.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 ms.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 ds(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 Po("div",{className:"qplayer-controlswrapper"},Po("button",{onClick:this.props.showPlay?this.handlePlay:this.handlePause,className:fs({"qplayer-center-btn":!0,"qplayer-active":this.props.show&&!this.state.showSettings})},Po("img",{src:this.props.showPlay?e.playIcon:e.pauseIcon})),Po("div",{onMouseLeave:this.props.onNotKeepControls,onMouseEnter:this.props.onKeepControls,className:fs({"qplayer-controls":!0,"qplayer-active":this.props.show||this.state.showSettings})},!this.props.isLive&&Po("div",{className:"qplayer-barwrapper"},Po(hs,{player:this.props.player,currentTime:this.props.currentTime,totalTime:this.props.totalTime})),Po("div",{className:"qplayer-controlbtns"},Po("div",{className:"qplayer-playbtn"},Po("button",{"data-balloon":"播放",onClick:this.handlePlay,className:fs({"qplayer-active":this.props.showPlay,"qplayer-play":!0})},Po("img",{src:e.playIcon})),Po("button",{"data-balloon":"暂停",onClick:this.handlePause,className:fs({"qplayer-active":this.props.showPause,"qplayer-pause":!0})},Po("img",{src:e.pauseIcon}))),!this.props.isLive&&Po("p",{className:"qplayer-time"},Po("span",{className:"qplayer-currtime"},_s(this.props.currentTime)),"/",Po("span",{className:"qplayer-totaltime"},_s(this.props.totalTime))),Po("div",{className:"qplayer-blank"}),Po("div",{className:"qplayer-controller-slot"}),Po("div",{className:"qplayer-volumewrapper"},Po("div",{className:"qplayer-volume",onMouseEnter:this.handleCloseSettings},Po("div",{className:"qplayer-sidewrapper"},Po("div",{className:"qplayer-volume_side"},Po("p",{className:"qplayer-volume_value"},(100*this.state.volume).toFixed(0)),Po(ps,{maxValue:1,minValue:0,value:this.state.volume,onChange:this.handleSetVolume}))),Po("button",{onClick:this.handleToggleMute,className:"qplayer-volumebtn"},this.state.isMuted?Po("img",{src:e.volumeOffIcon}):Po("img",{src:e.volumeIcon})))),this.state.showControlBtn&&Po("button",{className:"qplayer-control-btn qplayer-settings-btn",onClick:this.handleToggleSettings},Po("img",{src:e.settingsIcon})),this.props.player.fullscreenController&&Po("button",{"data-balloon":this.state.isFullscreen?"退出全屏":"全屏",className:"qplayer-fullscreen",onClick:this.handleToggleFullscreen},this.state.isFullscreen?Po("img",{src:e.fullscreenExitIcon}):Po("img",{src:e.fullscreenIcon})))),this.props.isMobile&&Po("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===ms.VOLUME_CONTROL&&Po("div",{className:"qplayer-gesture-tips"},Po("img",{src:e.volumeIcon}),Po("div",{className:"qplayer-gesture-volume-wrapper"},Po("div",{className:"qplayer-gesture-volume-current",style:{width:100*this.state.gestureVolume+"%"}}))),this.state.gestureType===ms.SEEK_CONTROL&&Po("div",{className:"qplayer-gesture-tips"},Po("p",{className:"qplayer-gesture-seek-text"},Po("span",null,this.state.gestureSeekTime<0?"-":"+"),Math.abs(this.state.gestureSeekTime).toFixed(1),Po("span",null,"s")))),Po(ys,{show:this.state.showSettings,onClose:this.handleCloseSettings,player:this.props.player}))},e}(ss);function _s(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")}cs(".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 bs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ds(t,e),t.prototype.render=function(){return Po("div",{class:"sk-fading-circle",style:{width:this.props.width||40,height:this.props.height||40,margin:this.props.margin}},Po("div",{class:"sk-circle1 sk-circle"}),Po("div",{class:"sk-circle2 sk-circle"}),Po("div",{class:"sk-circle3 sk-circle"}),Po("div",{class:"sk-circle4 sk-circle"}),Po("div",{class:"sk-circle5 sk-circle"}),Po("div",{class:"sk-circle6 sk-circle"}),Po("div",{class:"sk-circle7 sk-circle"}),Po("div",{class:"sk-circle8 sk-circle"}),Po("div",{class:"sk-circle9 sk-circle"}),Po("div",{class:"sk-circle10 sk-circle"}),Po("div",{class:"sk-circle11 sk-circle"}),Po("div",{class:"sk-circle12 sk-circle"}))},t}(ss);cs(".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 Ss=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ds(t,e),t.prototype.render=function(){return Po("div",{className:fs({"qplayer-toast":!0,"qplayer-active":this.props.show})},Po("p",{className:"qplayer-toast-content"},this.props.message))},t}(ss),Es=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 ds(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("正在加载视频源...",-1),this.container&&this.container.addEventListener("contextmenu",function(e){e.preventDefault()},!0)},t.prototype.render=function(){var e=this.props.player.config.defaultViewConfig;return Po("div",{ref:this.handleContainerRef,className:"qplayer","data-device":this.props.isMobile?"mobile":"desktop"},Po("div",{onMouseMove:this.handleShowControls,onMouseEnter:this.handleShowControls,onMouseLeave:this.handleCloseControls,className:fs({"qplayer-wrapper":!0})},Po("div",{className:fs({"qplayer-error":!0,"qplayer-active":this.state.errorMessage})},Po("p",{className:"qplayer-error-title"},"错误"),Po("p",{className:"qplayer-error-content"},this.state.errorMessage)),!this.props.isNoControl&&Po("div",{className:fs({"qplayer-loading":!0,"qplayer-active":this.state.isLoading})},Po(bs,{margin:0})),Po("div",{className:"qplayer-video",ref:this.handleVideoRef}),!this.props.isNoControl&&Po(vs,{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&&Po(Ss,{show:!this.state.errorMessage&&this.state.showToast,message:this.state.currentToastMessage})))},t}(ss),ws=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);ls(Po(Es,{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(){ls(Po(function(){return null},null),this.player.config.container,this.component.container)},e}()),Ts={container:document.body,autoplay:!1,muted:!1,volume:1,view:ws,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 Yi(ji.COMMON,Hi.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 Yi(ji.COMMON,Hi.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}($i),xs=s(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 d(){return"undefined"!=typeof process&&process.version?new r(process.version.slice(1)):null}t.detect=function(){return"undefined"!=typeof navigator?n(navigator.userAgent):d()},t.parseUserAgent=n,t.detectOS=u,t.getNodeVersion=d});e(xs);xs.BrowserInfo,xs.NodeInfo,xs.BotInfo;var Ls=xs.detect,Is=(xs.parseUserAgent,xs.detectOS,xs.getNodeVersion,!1);(-1<navigator.userAgent.toLowerCase().indexOf("micromessenger")||void 0!==navigator.wxuserAgent)&&(Is=!0);var Rs=function(){var e=Ls(),t=navigator.userAgent;t.match(/MQQBrowser/)&&(e.name="qq");t.match(/UCBrowser/)&&(e.name="uc");Is&&(e.name="wechat");return da.verbose("browser info",e),e}(),Cs={playsinline:Ds(Rs),fakeReady:!1};function Ds(e){return"iOS"!==e.os&&"Android OS"!==e.os||("playsInline"in document.createElement("video")||"webkitPlaysInline"in document.createElement("video"))}var Us=function(){if(!Rs)return Cs;switch(Rs.name){case"ios":return{playsinline:(e=Rs.version,t=e.split("."),10<Number(t[0]))};case"android":case"ios-webview":return{playsinline:Ds(Rs)};case"qq":case"uc":return{playsinline:!1};case"wechat":return{playsinline:Ds(Rs),fakeReady:!0}}var e,t;return Cs}();function Ps(e){Promise.resolve().then(e)}function ks(t,r){for(var n in r)try{r[n].constructor===Object?t[n]=ks(a({},t[n]),a({},r[n])):t[n]=r[n]}catch(e){t[n]=r[n]}return t}da.verbose("browser",Us);var Os=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":da.verbose("loadedmetadata"),r.canplay=!0,r.totalTime=r.videoElement.duration,(r.playWhenReady||r.config.autoplay)&&r.play(),Ps(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(),Ps(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":da.warning(r.videoElement.error),r.emit("error",new Yi(ji.COMMON,Hi.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){da.verbose("play operation");var e=this.videoElement.play();void 0!==e&&e instanceof Promise?e.then(function(){da.debug("play success")}).catch(function(e){da.warning("can not play",e),t.emit("error",new Yi(ji.COMMON,Hi.VIDEO_PLAY_FAILD,"can not play "+e.toString()))}):(da.debug("play success"),da.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"),Us.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;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(),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=!!Us.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}($i)),Ms=function(){function e(e){var t=this;if(this._currentQuality=0,this.player=e,!this.player.engine)throw new Yi(ji.COMMON,Hi.UNEXPECTED_ERROR,"");this.player.config.qualityList?Ps(function(){return t.player.emit("get-quality-list",t.qualityList)}):this.player.engine instanceof la&&(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 la},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"qualityList",{get:function(){return this.player.config.qualityList?this.player.config.qualityList:this.player.engine instanceof la?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 la?this.player.engine.currentQuality:(da.warning("can not get quality"),{quality:null,isAuto:!1})},enumerable:!0,configurable:!0}),e.prototype.toggleAutoQualitySwitch=function(){this.isSupportAutoQualitySwitch?this.player.engine instanceof la&&this.player.engine.toggleAutoQualityControl():da.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){da.verbose("qualitu-switching",l),this.player.emit("quality-switching",l.id),this.tempRender=new Os({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 d(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(),da.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 la?this.player.engine.changeQuality(t):da.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 Fs(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?(da.warning("fetch "+i+" error,",e),(t=500,new Promise(function(e){window.setTimeout(e,t)})).then(function(){r(Fs(i,a-1,!o))})):n(new Yi(ji.COMMON,Hi.CAN_NOT_FETCH,"get not fetch "+i))},e.open("GET",i,!0),e.send()})}var Bs=s(function(e,t){e.exports=function a(o,s,l){function u(r,e){if(!s[r]){if(!o[r]){var t=f;if(!e&&t)return t(r,!0);if(d)return d(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 d=f,e=0;e<l.length;e++)u(l[e]);return u}({1:[function(e,d,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}d.exports=function(e){1!==l.push(e)||n||r()}}).call(this,void 0!==o?o:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var i=e(1);function u(){}var d={},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 f(t,r,n){i(function(){var e;try{e=r(n)}catch(e){return d.reject(t,e)}e===t?d.reject(t,new TypeError("Cannot resolve promise with itself")):d.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,d.reject(t,e))}function i(e){r||(r=!0,d.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;f(r,n,this.outcome)}else this.queue.push(new l(r,e,t));return r},l.prototype.callFulfilled=function(e){d.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){f(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){d.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){f(this.promise,this.onRejected,e)},d.resolve=function(e,t){var r=p(c,t);if("error"===r.status)return d.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},d.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:d.resolve(new this(u),e)},n.reject=function(e){var t=new this(u);return d.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,d.resolve(s,a))},function(e){i||(i=!0,d.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,d.resolve(o,e))},function(e){n||(n=!0,d.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!==o?o:"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 f=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 d(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,m="readonly",g="readwrite";function y(e){return"boolean"==typeof i?f.resolve(i):(n=e,new f(function(r){var e=n.transaction(s,g),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 f(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 f(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 I(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 f.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(){I(t,r,n,i-1)})}).catch(n);n(e)}}var R={_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 f.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 f.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 f(function(a,o){l.ready().then(function(){I(l._dbInfo,m,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=d(o);var t=new f(function(i,a){s.ready().then(function(){I(s._dbInfo,m,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=d(s);var r=new f(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 f(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){I(l._dbInfo,g,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=d(o);var t=new f(function(i,a){s.ready().then(function(){I(s._dbInfo,g,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 f(function(i,a){o.ready().then(function(){I(o._dbInfo,g,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 f(function(i,a){o.ready().then(function(){I(o._dbInfo,m,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 f(function(a,o){s<0?a(null):l.ready().then(function(){I(l._dbInfo,m,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 f(function(a,o){s.ready().then(function(){I(s._dbInfo,m,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?f.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 f(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)||f.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 f(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)||f.resolve()).catch(function(){}),e})})}else t=f.reject("Invalid arguments");return c(t,e),t}},C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D=/^~~local_forage_type~([^~]+)~/,U="__lfsc__:",P=U.length,k=P+"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),d=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]),d[l++]=r<<2|n>>4,d[l++]=(15&n)<<4|i>>2,d[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 B={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=U;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(U+"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,P)!==U)return JSON.parse(e);var t,r=e.substring(k),n=e.substring(P,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 N(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):N(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=d(o);var t=new f(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 f(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){N(e,i,function(){n._dbInfo=i,t()},function(e,t){r(t)})},r)});return i.serializer=B,r},_support:"function"==typeof openDatabase,iterate:function(u,e){var t=this,r=new f(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=d(t);var r=new f(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=d(i);var t=new f(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 f(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 f(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 f(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 f(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 f(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 f(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 f(function(a,o){s.db.transaction(function(n){function e(t){return new f(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]));f.all(t).then(function(){a()}).catch(function(e){o(e)})},function(e){o(e)})})}):f.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=B,f.resolve()):f.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=d(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=d(o);var r=s.ready().then(function(){void 0===e&&(e=null);var a=e;return new f(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=d(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 f(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)}}):f.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:R,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(d,e,t){var r=new f(function(t,r){try{var n=d._driver,e=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!d._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||d[s])&&"function"!=typeof d[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=f.reject(e);return c(t,arguments[arguments.length-1]),t}},t=0,r=J.length;t<r;t++){var n=J[t];d[n]||(d[n]=e(n))}}();var u=function(e){K[n]&&console.info("Redefining LocalForage driver: "+n),K[n]=d,X[n]=e,t()};"_support"in d?d._support&&"function"==typeof d._support?d._support().then(u,r):u(!!d._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]?f.resolve(K[e]):f.reject(new Error("Driver not found."));return u(n,t,r),n},i.prototype.getSerializer=function(e){var t=f.resolve(B);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 f.resolve()}):f.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=f.reject(t),a._driverSet}return n()})})}).catch(function(){o();var e=new Error("No available storage method found.");return a._driverSet=f.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)}),Ns=function(je){return new Promise(function(e){var d=je,f="";d.onRuntimeInitialized=function(){e(d)};var t,r={};for(t in d)d.hasOwnProperty(t)&&(r[t]=d[t]);d.arguments=[],d.thisProgram="./this.program",d.quit=function(e,t){throw t},d.preRun=[],d.postRun=[];d.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},d.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)},d.setWindowTitle=function(e){document.title=e};var c=d.print||("undefined"!=typeof console?console.log.bind(console):"undefined"!=typeof print?print:null),h=d.printErr||("undefined"!=typeof printErr?printErr:"undefined"!=typeof console&&console.warn.bind(console)||c);for(t in r)r.hasOwnProperty(t)&&(d[t]=r[t]);r=void 0;function p(e){var t=M;return M=M+e+15&-16,t}function m(e){var t=P[z>>2],r=t+e+15&-16;if((P[z>>2]=r,X<=r)&&!Y())return P[z>>2]=t,0;return t}function n(e,t){return t||(t=16),e=Math.ceil(e/t)*t}function g(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=d["_"+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 d,f=a.apply(null,o);return d=f,f="string"===t?T(d):"boolean"===t?Boolean(d):d,0!==s&&Me(s),f}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":U[e>>1]=t;break;case"i32":P[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)],P[e>>2]=tempI64[0],P[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,m][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)P[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,d,f,c=0;c<a;){var h=e[c];0!==(u=s||t[c])?("i64"==u&&(u="i32"),b(o+c,h,u),f!==u&&(d=g(u),f=u),c+=d):c++}return o}function w(e){return F?re?ke(e):m(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 I(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 R,C,D,U,P,k,O,M,F,B,N,z,j=65536,G=16777216,H=16777216;function q(e,t){return 0<e%t&&(e+=t-e%t),e}function V(e){d.buffer=R=e}function W(){d.HEAP8=C=new Int8Array(R),d.HEAP16=U=new Int16Array(R),d.HEAP32=P=new Int32Array(R),d.HEAPU8=D=new Uint8Array(R),d.HEAPU16=new Uint16Array(R),d.HEAPU32=new Uint32Array(R),d.HEAPF32=k=new Float32Array(R),d.HEAPF64=O=new Float64Array(R)}function Y(){var e=d.usingWasm?j:G,t=2147483648-e;if(P[z>>2]>t)return!1;var r=X;for(X=Math.max(X,H);X<P[z>>2];)X=X<=536870912?q(2*X,e):Math.min(q((3*X+2147483648)/4,e),t);var n=d.reallocBuffer(X);return n&&n.byteLength==X?(V(n),W(),!0):(X=r,!1)}M=B=z=0,F=!1,d.reallocBuffer||(d.reallocBuffer=function(e){var t;try{if(ArrayBuffer.transfer)t=ArrayBuffer.transfer(R,e);else{var r=C;t=new ArrayBuffer(e),new Int8Array(t).set(r)}}catch(e){return!1}return!!Ue(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=d.TOTAL_STACK||5242880,X=d.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?d.dynCall_v(r):d.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+")"),d.buffer?R=d.buffer:(R="object"==typeof WebAssembly&&"function"==typeof WebAssembly.Memory?(d.wasmMemory=new WebAssembly.Memory({initial:X/j}),d.wasmMemory.buffer):new ArrayBuffer(X),d.buffer=R),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,de=null,fe=null;d.preloadedImages={},d.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 d.locateFile&&(he(wasmTextFile)||(wasmTextFile=d.locateFile(wasmTextFile)),he(f)||(f=d.locateFile(f)),he(asmjsCodeFile)||(asmjsCodeFile=d.locateFile(asmjsCodeFile)));var o={global:null,env:null,asm2wasm:i,parent:d},s=null;function l(){try{if(d.wasmBinary)return new Uint8Array(d.wasmBinary);if(d.readBinary)return d.readBinary(f);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(!(d.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=d.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),d.asm=s,d.usingWasm=!0,function(e){if(ue--,d.monitorRunDependencies&&d.monitorRunDependencies(ue),0==ue&&(null!==de&&(clearInterval(de),de=null),fe)){var t=fe;fe=null,t()}}()}if(t.memory=d.wasmMemory,o.global={NaN:NaN,Infinity:1/0},o["global.Math"]=Math,o.env=t,ue++,d.monitorRunDependencies&&d.monitorRunDependencies(ue),d.instantiateWasm)try{return d.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){(d.wasmBinary||"function"!=typeof fetch?new Promise(function(e,t){e(l())}):fetch(f,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+f+"'";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 d.wasmBinary||"function"!=typeof WebAssembly.instantiateStreaming||he(f)||"function"!=typeof fetch?a(i):WebAssembly.instantiateStreaming(fetch(f,{credentials:"same-origin"}),o).then(i).catch(function(e){h("wasm streaming compile failed: "+e),h("falling back to ArrayBuffer instantiation"),a(i)}),{}}d.asmPreload=d.asm,d.reallocBuffer,d.reallocBuffer=function(e){return function(e){e=q(e,d.usingWasm?j:G);var t=d.buffer.byteLength;if(d.usingWasm)try{return-1!==d.wasmMemory.grow((e-t)/65536)?d.buffer=d.wasmMemory.buffer:null}catch(e){return null}}(e)},d.asm=function(e,t,r){var n;if(!(t=t).table){var i=d.wasmTableSize;void 0===i&&(i=1024);var a=d.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),d.wasmTable=t.table}return t.memoryBase||(t.memoryBase=d.STATIC_BASE),t.tableBase||(t.tableBase=0),y(n=u(0,t),"no binaryen method succeeded."),n}}(),M=749984,J.push({func:function(){Ie()}});d.STATIC_BASE=1024,d.STATIC_BUMP=748960;var pe=M;M+=16;var me={};var ge={varargs:0,get:function(e){return ge.varargs+=4,P[ge.varargs-4>>2]},getStr:function(){return T(ge.get())},get64:function(){var e=ge.get(),t=ge.get();return y(0<=e?0===t:-1===t),e},getZero:function(){y(0===ge.get())}};function ye(e){return d.___errno_location&&(P[d.___errno_location()>>2]=e),e}function ve(e){!function(e,t){if(t&&d.noExitRuntime&&0===e)return;d.noExitRuntime||(a=!0,B=Le,Z(ee),d.onExit&&d.onExit(e));d.quit(e,new Be(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,P[Ce()>>2]=60*(new Date).getTimezoneOffset();var e=new Date(2e3,0,1),t=new Date(2e3,6,1);P[Re()>>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()?(P[De()>>2]=i,P[De()+4>>2]=a):(P[De()>>2]=a,P[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:I(e)+1,i=new Array(n),a=L(e,i,0,i.length);return t&&(i.length=a),i}z=p(4),N=n((B=n(M))+K),P[z>>2]=N,F=!0,d.wasmTableSize=432,d.wasmMaxTableSize=432,d.asmGlobalArg={},d.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=P[t>>2],r=P[n>>2]):(e.called=!0,me.USER=me.LOGNAME="web_user",me.PATH="/",me.PWD="/",me.HOME="/home/web_user",me.LANG="C.UTF-8",me._=d.thisProgram,r=w(1024),n=w(256),P[n>>2]=r,P[t>>2]=n);var i=[],a=0;for(var o in me)if("string"==typeof me[o]){var s=o+"="+me[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),P[n+4*l>>2]=r,r+=s.length+1;P[n+4*i.length>>2]=0},___setErrNo:ye,___syscall140:function(e,t){ge.varargs=t;try{var r=ge.getStreamFromFD(),n=(ge.get(),ge.get()),i=ge.get(),a=ge.get(),o=n;return FS.llseek(r,o,a),P[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){ge.varargs=t;try{var r=ge.get(),i=ge.get(),a=ge.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=P[i+8*s>>2],u=P[i+(8*s+4)>>2],d=0;d<u;d++)n.printChar(r,D[l+d]);o+=u}return o}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||ze(e),-e.errno}},___syscall221:function(e,t){ge.varargs=t;try{return 0}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||ze(e),-e.errno}},___syscall3:function(e,t){ge.varargs=t;try{var r=ge.getStreamFromFD(),n=ge.get(),i=ge.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){ge.varargs=t;try{var r=ge.getStr(),n=ge.get(),i=ge.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){ge.varargs=t;try{return 0}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||ze(e),-e.errno}},___syscall6:function(e,t){ge.varargs=t;try{var r=ge.getStreamFromFD();return FS.close(r),0}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||ze(e),-e.errno}},_abort:function(){d.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),me.hasOwnProperty(t)?(e.ret&&Pe(e.ret),e.ret=(r=me[t],n=I(r)+1,(i=ke(n))&&L(r,C,i,n),i)):0);var r,n,i},_gettimeofday:function(e){var t=Date.now();return P[e>>2]=t/1e3|0,P[e+4>>2]=t%1e3*1e3|0,0},_gmtime_r:function(e,t){var r=new Date(1e3*P[e>>2]);P[t>>2]=r.getUTCSeconds(),P[t+4>>2]=r.getUTCMinutes(),P[t+8>>2]=r.getUTCHours(),P[t+12>>2]=r.getUTCDate(),P[t+16>>2]=r.getUTCMonth(),P[t+20>>2]=r.getUTCFullYear()-1900,P[t+24>>2]=r.getUTCDay(),P[t+36>>2]=0,P[t+32>>2]=0;var n=Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0),i=(r.getTime()-n)/864e5|0;return P[t+28>>2]=i,P[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*P[e>>2]);P[t>>2]=r.getSeconds(),P[t+4>>2]=r.getMinutes(),P[t+8>>2]=r.getHours(),P[t+12>>2]=r.getDate(),P[t+16>>2]=r.getMonth(),P[t+20>>2]=r.getFullYear()-1900,P[t+24>>2]=r.getDay();var n=new Date(r.getFullYear(),0,1),i=(r.getTime()-n.getTime())/864e5|0;P[t+28>>2]=i,P[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));P[t+32>>2]=s;var l=P[De()+(s?4:0)>>2];return P[t+40>>2]=l,t},_mktime:function(e){we();var t=new Date(P[e+20>>2]+1900,P[e+16>>2],P[e+12>>2],P[e+8>>2],P[e+4>>2],P[e>>2],0),r=P[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)P[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))}P[e+24>>2]=t.getDay();var d=(t.getTime()-i.getTime())/864e5|0;return P[e+28>>2]=d,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||(d.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:B};var xe=d.asm(d.asmGlobalArg,d.asmLibraryArg,R);d.asm=xe;var Le,Ie=d.___emscripten_environ_constructor=function(){return d.asm.___emscripten_environ_constructor.apply(null,arguments)},Re=d.__get_daylight=function(){return d.asm.__get_daylight.apply(null,arguments)},Ce=d.__get_timezone=function(){return d.asm.__get_timezone.apply(null,arguments)},De=d.__get_tzname=function(){return d.asm.__get_tzname.apply(null,arguments)},Ue=d._emscripten_replace_memory=function(){return d.asm._emscripten_replace_memory.apply(null,arguments)},Pe=d._free=function(){return d.asm._free.apply(null,arguments)},ke=d._malloc=function(){return d.asm._malloc.apply(null,arguments)},Oe=(d._pcm2aac=function(){return d.asm._pcm2aac.apply(null,arguments)},d.stackAlloc=function(){return d.asm.stackAlloc.apply(null,arguments)}),Me=d.stackRestore=function(){return d.asm.stackRestore.apply(null,arguments)},Fe=d.stackSave=function(){return d.asm.stackSave.apply(null,arguments)};d.dynCall_v=function(){return d.asm.dynCall_v.apply(null,arguments)},d.dynCall_vi=function(){return d.asm.dynCall_vi.apply(null,arguments)};function Be(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Ne(e){function t(){d.calledRun||(d.calledRun=!0,a||(re||(re=!0,Z(J)),Z($),d.onRuntimeInitialized&&d.onRuntimeInitialized(),function(){if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;)e=d.postRun.shift(),te.unshift(e);var e;Z(te)}()))}e=e||d.arguments,0<ue||(!function(){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)e=d.preRun.shift(),Q.unshift(e);var e;Z(Q)}(),0<ue||d.calledRun||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1),t()},1)):t()))}function ze(e){throw d.onAbort&&d.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(d.asm=xe,d.ccall=s,d.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)}},(Be.prototype=new Error).constructor=Be,fe=function e(){d.calledRun||Ne(),d.calledRun||(fe=e)},d.run=Ne,d.abort=ze,d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();d.noExitRuntime=!0,Ne()})};return function(r){function e(e){var t=r.call(this)||this;return t._isReady=!1,da.setLevel(void 0===e.loggerLevel?Ts.loggerLevel:e.loggerLevel),da.debug("browser",Rs),t.processConfig(e),da.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():da.warning("player is not ready")},e.prototype.pause=function(){this._isReady&&this.engine?this.engine.render.pause():da.warning("player is not ready")},e.prototype.seek=function(e){this._isReady&&this.engine?this.engine.render.seek(e):da.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=ks({},Ts);if(this.config=ks(a({},t),e),!this.config.url&&!this.config.qualityList)throw new Yi(ji.COMMON,Hi.INVALID_CONFIG,"can not find url in config!");if(this.config.qualityList&&0===this.config.qualityList.length)throw new Yi(ji.COMMON,Hi.INVALID_CONFIG,"qualityList is empty!");this.config.url&&this.config.qualityList&&(da.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 Os({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,!Us.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 d(this,function(e){switch(e.label){case 0:return[4,Fs(s)];case 1:for(t=e.sent(),da.verbose("get content type",t),r=null,n=0,i=[fa,Za,Qa];n<i.length;n++)if((a=i[n]).isSupport(this.config))try{a.probe(s,t||"",this.config)&&(r=a)}catch(e){da.warning("probe engine faild",e);continue}if(!r)throw new Yi(ji.COMMON,Hi.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 d(this,function(e){switch(e.label){case 0:return t={},2<=s.loggerLevel&&(t.printErr=function(){}),3<=s.loggerLevel&&(t.print=function(){}),[4,Bs.getItem(o+":"+l)];case 1:return(r=e.sent())?(t.wasmBinary=r,[4,Ns(t)]):[3,3];case 2:return[2,e.sent()];case 3:if(!(n=s[o]))throw da.warning("can not find wasm path in config!"),new Yi(ji.COMMON,Hi.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,Bs.setItem(o+":"+l,i)];case 7:return e.sent(),[4,Ns(t)];case 8:return[2,e.sent()];case 9:throw a=e.sent(),new Yi(ji.COMMON,Hi.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 d(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)),da.verbose.apply(da,[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),da.debug("event: player ready",e)}),Us.fakeReady&&(window.WeixinJSBridge?window.WeixinJSBridge.invoke("getNetworkType",{},function(){n._isReady=!0,n.emit("ready",0),n.config.autoplay&&(n.render.video.load(),n.render.video.play()),da.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()),da.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),da.verbose("fullscreen change",e.fullscreenController.isFullScreen))})},e.prototype.emitError=function(e){10005===e.code&&this.engine&&(da.debug("reload engine"),this.engine.reload()),this.emit("error",e)},e}($i)});