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

199 lines
540 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[25,9,15],{"1Sn+":function(He,We,V){},"1XHU":function(He,We,V){"use strict";var ae=V("2qtc"),k=V("kLXV"),b=V("q1tI"),O=V.n(b),C=V("9kvl"),E=V("3wET"),M=V.n(E),w=V("bUJZ"),A=V.n(w),_=V("Ct/S"),g=V.n(_),x=function(v){var y=v.visible,p=v.occupationValue,s=v.onCancel,e=s===void 0?function(){}:s,a=function(){return O.a.createElement("div",{className:g.a.flexColumn},O.a.createElement("img",{className:g.a.img,src:A.a}),O.a.createElement("span",{className:g.a.content},"\u672A\u804C\u4E1A\u8BA4\u8BC1"))},n=function(){return O.a.createElement("div",{className:g.a.flexColumn},O.a.createElement("img",{className:g.a.img,src:M.a}),O.a.createElement("span",{className:g.a.content},"\u672A\u5B9E\u540D\u8BA4\u8BC1"))},c=function(){return p===3?O.a.createElement(O.a.Fragment,null,n(),a()):p===2?a():n()};return O.a.createElement(k.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:y,title:"\u56E0\u4E3A\u4EE5\u4E0B\u539F\u56E0\uFF0C\u60A8\u6682\u65F6\u4E0D\u80FD\u8FDB\u884C\u64CD\u4F5C",okText:"\u7ACB\u5373\u8BA4\u8BC1",cancelText:"\u53D6\u6D88",width:"600px",onOk:function(){e(),C.d.push("/account/certification")},onCancel:function(){e()}},O.a.createElement("div",{className:g.a.tilte},"\u8BF7\u5728\u5B8C\u6210\u6761\u4EF6\u540E\u91CD\u8BD5"),O.a.createElement("div",{className:g.a.flexRow},c()))};We.a=Object(C.a)(function(S){var v=S.paperlibrary,y=S.loading,p=S.globalSetting;return{paperlibrary:v,globalSetting:p,loading:y.effects}})(x)},"2tKv":function(He,We,V){He.exports=V.p+"static/Code.584c4f34.png"},"3wET":function(He,We){He.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAACE5JREFUWAmtWH1snVUZ/533tuvYVreyjGy3Y6srTBo2srI4XbtKgFQxIrKYzeAfk8AfCzHbCkPMjPjBP0aCsjr1D01USCQ6oosyiLF8xMGqc2BHauUj1I2Ntghs7dqytuu99/j7nfOee9/73js+jKd53+d5n3Oe5/zO8zznOafX4EO2ta/bhqlJfM4adFJ1hQWyxiIrM5QNG2CY7EnKei5agMf7V5pR9X3QRv0P1pr77WaO3AGLDoKokZYlY2hBtFqLDHLse9ZE2De41hyoNiYte19AzX22nfPdT8NtnJr6UgkIAl/dTLKXwHupeM9gqzmcBpH8rm6JI7ZYm3nhBfyAQHYlFcr4NL6yTn4kEamPxkxkutevx+5Hjcmnh+u7KqB1fXbR+Az2U195UmyWnjH8E1ULvGgsKDlRghTg8MnhPQvrsPVYqxnziqV3BSCBGZuUe21LMUGUKGx6F42K14rZJ6oWeFG19+w3eGnhPLSlQUVOM34pTGfHsR95tCBPozlOFCh5q++YOj7uqyfUxhqDbAYQjxzB8JFuoJ739qRrZ22L5tKcSQx+KbFk1VN2b8Fa5ky8QvojhEVDAh9C1DAH2NYIdFwMNM3TCIsT5wwOnbH45SlgIufDG8arv+RnsQb0SPe/rzdd0lYrAmr+s23PWzznxdXfyRzK1gEPrgU+cbHBa5MWr07KmsHq+RaXLTAYGAe29wFDMyVb6RC62YmxJjKbBj/td5+rJ1LJzeL+ihWUbHkuzpe5GYM9lwsM8MSbwLcGDMZmqc1cWlhrsOsyi20rgTubDb45YDGl0MZNPio1yS1yec2NdsldDq18jEUvzzqjjVj2UMF9i/JRDpFeMc/ihqUWT71p8fU+i3fO0eisRZ4hOjNl8f1/MWxvG3wha/GxedKVntct0SB3tM1hCIAwix0+YZWEVKRhPYF3SRjLxa+tN6hlGX56hHky7RNXyevHAe/OWPxpyCoUuKpem0F9frGBaqGBd5QYOAI1Kw7aBjuFDuWbckQt0DQfYr5srhuGkXdJ5cG4JZP+P+pjWzIn9gR5Vx746ajrLc3Fc7BDWCJM4EZu0xoXkmJ4OLqMl9HYY6Svj3vgrQ00SI9Z5Y+ewJOua/BjBrjj5IEybzjbmkN2YyoMxBJR0OmF5UreSDAmygmoLHqY5/kb3FlfWgWsJygdAu4giOnVlG39KHCcO63/HfXRd/HkgQZbgcquKaAz85GbvrMTBduEApFqUYGKTz2mIH8D4zMGs+Q/swK4Zhkno+w8vbCEpeCLBPmNq4HFDOuP+4G/vBHblN3UIz1LmajnzShD5e8yHO4BcE4HxAnKX/STE0TUPsyJjjUBG5YC937ccE2hz+DEWYs9PNN/N0hjBc0mo2waIz4ey7xxcznq+pGtYf5wc/oW95eqZcjiosRiOYvebWssNrMOLb7IYHSaRXEUGGMBHJ0G/j5icZS16QTDZQjcY/AzsHw54MKoFrAFvBRla2xeFz3fUgugMED1dDUT9YFrgdalBi++Rf6IxaFTrENTCiHcExblLIYP0lpWvFuvZLjPA799+QLzcd8oZCMEUu+HlCCE70DXLAEeuN5g1SLgJ89b/PwYcPoce90yw6hy/RCSWh6fX+Ex87UNwKkJ4DfMLdcI1EVPwH0bUciGWRdW6ztZR+IBjlzCg/NHvBk1EvZ9h4BH+lmV6bQwXkUyp4RNeMQpckwdD6fbrgJ2f5IX7bME1cMebfVqLcJwZHK8kMfb0m098qJ6pDiHS7j3U8Dliw26/0Yw9EyBVVw6GjOHbtjUaFGrpbp646n4OoZ8+zrgbl5+jzPPup4AnmeIHSDaZrr4UhLzZrZwMioU8GSpcGkSDeJS4wlX8zTvbAaO0NCv/0Exz6zk+C0twE8/b3B7qyE4r6t+VgB8dYNBF8G8+jaw6zHgRR4nwa5bcGoBNh/11GQKOJjPubXRueU+l/0tTMT5LP8PHy1gbJKAKSuGnEw/i+QwQ3F3h/4VsfjZEYMMd9fOjcAdGw3+yR131x+BV1ggK1rZdCYXZfC4s738u/Zp5tG1aYV6LvNXtwDLmcg3/4ITaytzkEC5pjAxqdfw5P/hTbwLXcLb1iGL+XUG2wmoj7Xqrj8Ag6fD8PIrb3Lf89r7zNC3zXX0Clse+1gxCSis30+5gMnc1GDwylvAmQkaUxgJItyZg68Ghgx2/p4Xtpt5B7qGt0CiPnqSYA4wd04HmzEoT/w7rI6U69onIasDz6X7zAEeC71lhx0nj5iw2rITU8AMjwuf6J6K97nk6ctDwM79zBN65a/HPX+ctcrbFE3yRED7ShRRLrRXGIRFGF3L7rHtVHou6QHxlzKpx3gBm2AVDttcVI1QijIn4KuZ9WqaJ//QmDdOGKVJXM2iRJStOFfGbBr+nr/CFgFpQOOd+b08M3cVk0S9CYvvB6iyvwRK9uNzxFMncCHqHnow0xV/+pCFj7aN0W7DrRfqhLs5qlZc8AZJ26pXcn1iC/twSq5weuqvvxrH77j+mELUoznD/KJlHpKgqcsumjlve2mqJeWg0nIrtKSpVqHhxcU3wZTGvFRXa9pO7C3/77WqaYE6P23380rRGaaQzcqQVOZQce73YLhLe+rmmq1pMFJxuyytq4Ht15nP8ljpdpX7QiFRyU+EIIQiUJUJ8aKOp51MIereRNvVwAhHVQ8lAWZv588xBf0cY6v8HJMcSXCxQVG14F1ReqWXpeWe4Yf+x59jnMXEa9k2u5mgdrASdHBqV1BTu7hiExGEfPss6b6Rh/9PP1glMDl2xZdtA8vMjRaFTl7tLqVQN86sOukJnmx8jD3FstpTCxw8+ciH+0nvv4gFlb/v9tJbAAAAAElFTkSuQmCC"},"55Ip":function(He,We,V){"use strict";V.d(We,"a",function(){return a});var ae=V("Ty5D"),k=V("dI71"),b=V("q1tI"),O=V.n(b),C=V("YS25"),E=V("17x9"),M=V.n(E),w=V("wx14"),A=V("zLVn"),_=V("9R94"),g=function(i){Object(k.a)(t,i);function t(){for(var h,f=arguments.length,T=new Array(f),R=0;R<f;R++)T[R]=arguments[R];return h=i.call.apply(i,[this].concat(T))||this,h.history=Object(C.a)(h.props),h}var r=t.prototype;return r.render=function(){return O.a.createElement(ae.c,{history:this.history,children:this.props.children})},t}(O.a.Component),x=function(i){Object(k.a)(t,i);function t(){for(var h,f=arguments.length,T=new Array(f),R=0;R<f;R++)T[R]=arguments[R];return h=i.call.apply(i,[this].concat(T))||this,h.history=Object(C.b)(h.props),h}var r=t.prototype;return r.render=function(){return O.a.createElement(ae.c,{history:this.history,children:this.props.children})},t}(O.a.Component),S=function(t,r){return typeof t=="function"?t(r):t},v=function(t,r){return typeof t=="string"?Object(C.c)(t,null,null,r):t},y=function(t){return t},p=O.a.forwardRef;typeof p=="undefined"&&(p=y);function s(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}var e=p(function(i,t){var r=i.innerRef,h=i.navigate,f=i.onClick,T=Object(A.a)(i,["innerRef","navigate","onClick"]),R=T.target,L=Object(w.a)({},T,{onClick:function(H){try{f&&f(H)}catch(K){throw H.preventDefault(),K}!H.defaultPrevented&&H.button===0&&(!R||R==="_self")&&!s(H)&&(H.preventDefault(),h())}});return y!==p?L.ref=t||r:L.ref=r,O.a.createElement("a",L)}),a=p(function(i,t){var r=i.component,h=r===void 0?e:r,f=i.replace,T=i.to,R=i.innerRef,L=Object(A.a)(i,["component","replace","to","innerRef"]);return O.a.createElement(ae.e.Consumer,null,function(N){N||Object(_.a)(!1);var H=N.history,K=v(S(T,N.location),N.location),X=K?H.createHref(K):"",z=Object(w.a)({},L,{href:X,navigate:function(){var te=S(T,N.location),ee=f?H.replace:H.push;ee(te)}});return y!==p?z.ref=t||R:z.innerRef=R,O.a.createElement(h,z)})});if(!1)var n,c;var l=function(t){return t},u=O.a.forwardRef;typeof u=="undefined"&&(u=l);function m(){for(var i=arguments.length,t=new Array(i),r=0;r<i;r++)t[r]=arguments[r];return t.filter(function(h){return h}).join(" ")}var d=u(function(i,t){var r=i["aria-current"],h=r===void 0?"page":r,f=i.activeClassName,T=f===void 0?"active":f,R=i.activeStyle,L=i.className,N=i.exact,H=i.isActive,K=i.location,X=i.sensitive,z=i.strict,J=i.style,te=i.to,ee=i.innerRef,ve=Object(A.a)(i,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return O.a.createElement(ae.e.Consumer,null,function(re){re||Object(_.a)(!1);var de=K||re.location,ie=v(S(te,de),de),le=ie.pathname,Q=le&&le.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),Z=Q?Object(ae.f)(de.pathname,{path:Q,exact:N,sensitive:X,strict:z}):null,ne=!!(H?H(Z,de):Z),Te=ne?m(L,T):L,Ee=ne?Object(w.a)({},J,{},R):J,Ce=Object(w.a)({"aria-current":ne&&h||null,className:Te,style:Ee,to:ie},ve);return l!==u?Ce.ref=t||ee:Ce.innerRef=ee,O.a.createElement(a,Ce)})});if(!1)var o},"6Fuo":function(He,We,V){He.exports={flex_box_center:"flex_box_center___3p8A0",flex_space_between:"flex_space_between___2wMwo",flex_box_vertical_center:"flex_box_vertical_center___2fKhV",flex_box_center_end:"flex_box_center_end___27Yk8",flex_box_column:"flex_box_column___3Khbo",rightMenu:"rightMenu___20Eel",joinMenu:"joinMenu___2blJt",joinBoard:"joinBoard___2XUXK",joinCol:"joinCol___3o5gp"}},"6cGi":function(He,We,V){"use strict";V.d(We,"a",function(){return O});var ae=V("ODXe"),k=V("q1tI"),b=V.n(k);function O(C,E){var M=E||{},w=M.defaultValue,A=M.value,_=M.onChange,g=M.postState,x=k.useState(function(){return A!==void 0?A:w!==void 0?typeof w=="function"?w():w:typeof C=="function"?C():C}),S=Object(ae.a)(x,2),v=S[0],y=S[1],p=A!==void 0?A:v;g&&(p=g(p));var s=k.useRef(_);s.current=_;var e=k.useCallback(function(n){y(n),p!==n&&s.current&&s.current(n,p)},[p,s]),a=k.useRef(!0);return k.useEffect(function(){if(a.current){a.current=!1;return}A===void 0&&y(A)},[A]),[p,e]}},"8hTe":function(He,We,V){He.exports={button:"button___1wy9m"}},"9Bee":function(He,We,V){"use strict";var ae=V("DYRE"),k=V("zeV3"),b=V("+L6B"),O=V("2/Rp"),C=V("k1fw"),E=V("9og8"),M=V("tJVT"),w=V("WmNS"),A=V.n(w),_=V("q1tI"),g=V.n(_),x=V("vg9a"),S=V("DlQD"),v=V.n(S),y=V("rUJ1");function p(B,D){var P=B.match(/^(\s+)(?:```)/);if(P===null)return D;var F=P[1];return D.split(`
`).map(function(W){var I=W.match(/^\s+/);if(I===null)return W;var U=Object(M.a)(I,1),j=U[0];return j.length>=F.length?W.slice(F.length):W}).join(`
`)}var s=[],e=["<ul>"],a=new v.a.Renderer,n=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function c(){s.length=0,e=["<ul>"]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function u(B,D,P,F){if(D>=B.length||B[D].level<=P)return D;var W=B[D];F.push("<li><a href='#"+W.anchor+"'>"+W.text+"</a>"),D++;var I=[];return D=u(B,D,W.level,I),I.length>0&&(F.push("<ul>"),I.forEach(function(U){F.push(U)}),F.push("</ul>")),F.push("</li>"),D=u(B,D,P,F),D}function m(){return u(s,0,0,e),e.push("</ul>"),e.join("")}var d={heading:function(D){var P=n.exec(D);if(P)return{type:"heading",raw:P[0],depth:P[1].length,text:P[2]}},fences:function(D){var P=this.rules.block.fences.exec(D);if(P){var F=P[0],W=p(F,P[3]||""),I=P[2]?P[2].trim():P[2];if(["latex","katex","math"].indexOf(I)>=0){var U=t(),j=W;W=U,r[U]={type:"block",expression:j}}return{type:"code",raw:F,lang:I,text:W}}}},o=/(?:\${2})([^\n`]+?)(?:\${2})/gi,i=0,t=function(){return"__special_katext_id_".concat(i++,"__")},r={};function h(){return r}function f(){i=0,r={}}function T(B){return B=B.replace(o,function(D,P){var F=t();return r[F]={type:"inline",expression:P},F}),B}var R=a.listitem;a.listitem=function(B){return R(T(B))};var L=a.paragraph;a.paragraph=function(B){return L(T(B))};var N=a.tablecell;a.tablecell=function(B,D){return N(T(B),D)},a.code=function(B,D,P){var F=(D||"").match(/\S*/)[0];return F?["latex","katex","math"].indexOf(F)>=0?"<p class='editormd-tex'>".concat(B,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(D,'">').concat(P?B:Object(y.escape)(B,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(P?B:Object(y.escape)(B,!0))+"</code></pre>"},a.heading=function(B,D,P){var F=this.options.headerPrefix+P.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return s.push({anchor:F,level:D,text:B}),"<h"+D+' id="'+F+'">'+B+"</h"+D+">"},v.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),v.a.use({tokenizer:d,renderer:a});var H=v.a,K=V("SJMd"),X=V("ulZh"),z=V.n(X),J=V("m3rI"),te=V("Oy/b"),ee=V("p5ED"),ve=V("ErOA"),re=V("STEk");/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var de=function(B,D){return(de=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,F){P.__proto__=F}||function(P,F){for(var W in F)Object.prototype.hasOwnProperty.call(F,W)&&(P[W]=F[W])})(B,D)};function ie(B,D){if(typeof D!="function"&&D!==null)throw new TypeError("Class extends value "+String(D)+" is not a constructor or null");function P(){this.constructor=B}de(B,D),B.prototype=D===null?Object.create(D):(P.prototype=D.prototype,new P)}function le(B,D,P,F){return new(P||(P=Promise))(function(W,I){function U($){try{G(F.next($))}catch(Y){I(Y)}}function j($){try{G(F.throw($))}catch(Y){I(Y)}}function G($){var Y;$.done?W($.value):(Y=$.value,Y instanceof P?Y:new P(function(q){q(Y)})).then(U,j)}G((F=F.apply(B,D||[])).next())})}function Q(B,D){var P,F,W,I,U={label:0,sent:function(){if(1&W[0])throw W[1];return W[1]},trys:[],ops:[]};return I={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function j(G){return function($){return function(Y){if(P)throw new TypeError("Generator is already executing.");for(;U;)try{if(P=1,F&&(W=2&Y[0]?F.return:Y[0]?F.throw||((W=F.return)&&W.call(F),0):F.next)&&!(W=W.call(F,Y[1])).done)return W;switch(F=0,W&&(Y=[2&Y[0],W.value]),Y[0]){case 0:case 1:W=Y;break;case 4:return U.label++,{value:Y[1],done:!1};case 5:U.label++,F=Y[1],Y=[0];continue;case 7:Y=U.ops.pop(),U.trys.pop();continue;default:if(!(W=U.trys,(W=W.length>0&&W[W.length-1])||Y[0]!==6&&Y[0]!==2)){U=0;continue}if(Y[0]===3&&(!W||Y[1]>W[0]&&Y[1]<W[3])){U.label=Y[1];break}if(Y[0]===6&&U.label<W[1]){U.label=W[1],W=Y;break}if(W&&U.label<W[2]){U.label=W[2],U.ops.push(Y);break}W[2]&&U.ops.pop(),U.trys.pop();continue}Y=D.call(B,U)}catch(q){Y=[6,q],F=0}finally{P=W=0}if(5&Y[0])throw Y[1];return{value:Y[0]?Y[1]:void 0,done:!0}}([G,$])}}}var Z=function(){function B(){}return B.addKey=function(D){B.key=D},Object.defineProperty(B,"isLicensed",{get:function(){return!!B.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(B.key)},enumerable:!1,configurable:!0}),B}(),ne=function(){function B(){}return B.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},B.setAttributes=function(D,P){for(var F=0,W=P;F<W.length;F++){var I=W[F],U=I[0],j=I[1];D.setAttribute(U,j)}},B.createRect=function(D,P,F){var W=document.createElementNS("http://www.w3.org/2000/svg","rect");return W.setAttribute("width",D.toString()),W.setAttribute("height",P.toString()),F&&B.setAttributes(W,F),W},B.createLine=function(D,P,F,W,I){var U=document.createElementNS("http://www.w3.org/2000/svg","line");return U.setAttribute("x1",D.toString()),U.setAttribute("y1",P.toString()),U.setAttribute("x2",F.toString()),U.setAttribute("y2",W.toString()),I&&B.setAttributes(U,I),U},B.createPolygon=function(D,P){var F=document.createElementNS("http://www.w3.org/2000/svg","polygon");return F.setAttribute("points",D),P&&B.setAttributes(F,P),F},B.createCircle=function(D,P){var F=document.createElementNS("http://www.w3.org/2000/svg","circle");return F.setAttribute("cx",(D/2).toString()),F.setAttribute("cy",(D/2).toString()),F.setAttribute("r",D.toString()),P&&B.setAttributes(F,P),F},B.createEllipse=function(D,P,F){var W=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return W.setAttribute("cx",(D/2).toString()),W.setAttribute("cy",(P/2).toString()),W.setAttribute("rx",(D/2).toString()),W.setAttribute("ry",(P/2).toString()),F&&B.setAttributes(W,F),W},B.createGroup=function(D){var P=document.createElementNS("http://www.w3.org/2000/svg","g");return D&&B.setAttributes(P,D),P},B.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},B.createMarker=function(D,P,F,W,I,U,j){var G=document.createElementNS("http://www.w3.org/2000/svg","marker");return B.setAttributes(G,[["id",D],["orient",P],["markerWidth",F.toString()],["markerHeight",W.toString()],["refX",I.toString()],["refY",U.toString()]]),G.appendChild(j),G},B.createText=function(D){var P=document.createElementNS("http://www.w3.org/2000/svg","text");return P.setAttribute("x","0"),P.setAttribute("y","0"),D&&B.setAttributes(P,D),P},B.createTSpan=function(D,P){var F=document.createElementNS("http://www.w3.org/2000/svg","tspan");return F.textContent=D,P&&B.setAttributes(F,P),F},B.createImage=function(D){var P=document.createElementNS("http://www.w3.org/2000/svg","image");return D&&B.setAttributes(P,D),P},B.createPoint=function(D,P){var F=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return F.x=D,F.y=P,F},B.createPath=function(D,P){var F=document.createElementNS("http://www.w3.org/2000/svg","path");return F.setAttribute("d",D),P&&B.setAttributes(F,P),F},B.createElement=function(D,P){var F=document.createElementNS("http://www.w3.org/2000/svg",D);return P&&B.setAttributes(F,P),F},B.getHollowRectanglePath=function(D,P,F,W,I,U,j,G){return"M"+D+","+P+"V"+(P+W)+"H"+(D+F)+"V"+P+"H"+I+"V"+U+"H"+(I+j)+"V"+(U+G)+"H"+I+"V"+P+"Z"},B}(),Te=function(){function B(D){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+D+"_"}return Object.defineProperty(B.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),B.prototype.addClass=function(D){return this.styleSheet===void 0&&this.addStyleSheet(),D.name=""+this.classNamePrefix+D.localName,this.classes.push(D),this.styleSheet.sheet.insertRule("."+D.name+" {"+D.style+"}",this.styleSheet.sheet.cssRules.length),D},B.prototype.addRule=function(D){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(D),this.styleSheet.sheet.insertRule(D.selector+" {"+D.style+"}",this.styleSheet.sheet.cssRules.length)},B.prototype.addStyleSheet=function(){var D;this.styleSheet=document.createElement("style"),((D=this.styleSheetRoot)!==null&&D!==void 0?D:document.head).appendChild(this.styleSheet),this.addRule(new Ee("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Ee("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Ee("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Ce("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Ce("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},B.prototype.removeStyleSheet=function(){var D;this.styleSheet&&(((D=this.styleSheetRoot)!==null&&D!==void 0?D:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},B}(),Ee=function(B,D){this.selector=B,this.style=D},Ce=function(B,D){this.localName=B,this.style=D},Ae=function(){function B(){this.blocks=[],this.display=""}return B.prototype.addButtonBlock=function(D){D.className=this.blockClassName,D.buttonClassName=this.buttonClassName,D.buttonColorsClassName=this.buttonColorsClassName,D.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(D)},B.prototype.addElementBlock=function(D){D.className===void 0&&(D.className=this.blockClassName),this.blocks.push(D)},B.prototype.getUI=function(){var D=document.createElement("div");return D.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,D.style.display=this.display,this.blocks.forEach(function(P){return D.appendChild(P.getUI())}),D},B}(),oe=function(){function B(){}return B.prototype.getUI=function(){var D=document.createElement("div");if(D.className=this.className,this.minWidth!==void 0&&(D.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":D.style.justifyContent="flex-start";break;case"center":D.style.justifyContent="center";break;case"end":D.style.justifyContent="flex-end"}return D.style.whiteSpace="nowrap",D},B}(),se=function(B){function D(){var P=B!==null&&B.apply(this,arguments)||this;return P.buttons=[],P}return ie(D,B),D.prototype.addButton=function(P){P.className=this.buttonClassName,P.colorsClassName=this.buttonColorsClassName,P.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(P)},D.prototype.getUI=function(){var P=B.prototype.getUI.call(this);return this.buttons.forEach(function(F){return P.appendChild(F.getUI())}),P},D}(oe),he=function(){function B(D,P){this._isActive=!1,this._isHidden=!1,this._icon=D,this.title=P,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(B.prototype,"icon",{get:function(){return this._icon},set:function(D){this._icon=D,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isActive",{get:function(){return this._isActive},set:function(D){this._isActive=D,this.adjustClassName()},enumerable:!1,configurable:!0}),B.prototype.getUI=function(){var D=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return D.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},B.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},B.prototype.hide=function(){this._isHidden=!0},B}(),ge=function(B){function D(){var P=B!==null&&B.apply(this,arguments)||this;return P.elements=[],P}return ie(D,B),D.prototype.addElement=function(P){this.elements.push(P)},D.prototype.getUI=function(){var P=B.prototype.getUI.call(this);return this.elements.forEach(function(F){return P.appendChild(F)}),P},D}(oe),ye=function(){function B(D,P){this.horizontal=D,this.vertical=P}return Object.defineProperty(B.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),B.prototype.getVerticalLength=function(D){return D/this.ratio},B.prototype.getHorizontalLength=function(D){return D*this.ratio},B}(),me=function(){function B(){}return B.getIcon=function(D,P){if(D>0&&P>0){var F=new ye(D,P),W=F.ratio>=1?20:F.getHorizontalLength(20),I=F.ratio<1?20:F.getVerticalLength(20),U=document.createElementNS("http://www.w3.org/2000/svg","svg");U.setAttribute("xmlns","http://www.w3.org/2000/svg"),U.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(U);var j=ne.createDefs();U.appendChild(j);var G=ne.createElement("clipPath",[["id","text-bg-clip"]]);j.appendChild(G);var $=ne.createPath(ne.getHollowRectanglePath((24-W)/2,(24-I)/2,W,I,(24-W)/2+2,(24-I)/2+2,W-4,I-4));U.appendChild($);var Y=ne.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Y.appendChild(ne.createTSpan(D+":"+P)),U.appendChild(Y);var q=Y.getBBox();ne.setAttributes(Y,[["x",((24-q.width)/2).toString()],["y",((24-q.height)/2-q.y).toString()]]);var Se=ne.createPath(ne.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(q.width))/2,(24-Math.ceil(q.height))/2,Math.ceil(q.width),Math.ceil(q.height)));return G.appendChild(Se),ne.setAttributes($,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(U),U.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},B}(),ue=function(B){function D(P,F,W){var I=B.call(this,P,F)||this;return I.isDropdownOpen=!1,I.onClick=I.dropdownButtonClicked,I.dropdownButtons=W,I}return ie(D,B),D.prototype.setupDropdown=function(){var P=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(F){F.className=P.className,F.colorsClassName=P.colorsClassName,P.dropdownBlock.appendChild(F.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},D.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},D.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},D.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},D.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},D.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},D}(he),Oe=function(){function B(D,P){this.GRIP_SIZE=10,this.color=D,this.fillColor=P,this.visual=ne.createGroup(),this.visual.appendChild(ne.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ne.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return B.prototype.ownsTarget=function(D){return D===this.visual||D===this.visual.childNodes[0]||D===this.visual.childNodes[1]},B.prototype.setCenter=function(D,P){this.visual.childNodes.forEach(function(F){return ne.setAttributes(F,[["cx",D.toString()],["cy",P.toString()]])})},B}(),Re=function(){function B(D,P,F,W){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=D,this.canvasHeight=P,this.margin=F,this.container=W,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(B.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(D){this._aspectRatio=D,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(D){this._isGridVisible=D,this.gridContainer&&ne.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(D){this._zoomFactor=D,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),B.prototype.open=function(){var D=this;this.cropShadeElement=ne.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=ne.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var P=0;P<this.numberOfGridLines;P++)this.horizontalGridLines.push(ne.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(ne.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(F){return D.gridContainer.appendChild(F)}),this.verticalGridLines.forEach(function(F){return D.gridContainer.appendChild(F)}),this.cropRectElement=ne.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Oe(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Oe(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Oe(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Oe(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},B.prototype.setCropRectangle=function(D){this.cropRect=D;var P=Object.assign({},this.cropRect);this.zoomFactor!==1&&(P.width=this.cropRect.width*this.zoomFactor,P.height=this.cropRect.height*this.zoomFactor,P.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-P.width/2,P.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-P.height/2),ne.setAttributes(this.cropRectElement,[["x",P.x.toString()],["y",P.y.toString()],["width",P.width.toString()],["height",P.height.toString()]]);var F=P.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(I,U){var j=P.y+F*(U+1);ne.setAttributes(I,[["x1",""+P.x],["y1",""+j],["x2",""+(P.x+P.width)],["y2",""+j]])});var W=P.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(I,U){var j=P.x+W*(U+1);ne.setAttributes(I,[["x1",""+j],["y1",""+P.y],["x2",""+j],["y2",""+(P.y+P.height)]])}),ne.setAttributes(this.cropShadeElement,[["d",ne.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,P.x,P.y,P.width,P.height)]]),this.topLeftGrip.setCenter(P.x,P.y),this.topRightGrip.setCenter(P.x+P.width,P.y),this.bottomLeftGrip.setCenter(P.x,P.y+P.height),this.bottomRightGrip.setCenter(P.x+P.width,P.y+P.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},B.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},B.prototype.clientToLocalCoordinates=function(D,P){var F=this.container.getBoundingClientRect();return{x:D-F.left+this.margin,y:P-F.top+this.margin}},B.prototype.onPointerDown=function(D){this.container.setPointerCapture(D.pointerId),this.previousPoint=this.clientToLocalCoordinates(D.clientX,D.clientY),this.cropRectElement===D.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(D.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(D.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(D.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(D.target)&&(this.activeGrip=this.bottomRightGrip)},B.prototype.onPointerMove=function(D){if(this.isMoving)this.move(this.clientToLocalCoordinates(D.clientX,D.clientY));else if(this.activeGrip){var P=this.clientToLocalCoordinates(D.clientX,D.clientY);this.resize(P)}D.preventDefault()},B.prototype.onPointerUp=function(D){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(D.pointerId)},B.prototype.move=function(D){var P=D.x-this.previousPoint.x,F=D.y-this.previousPoint.y;this.zoomFactor!==1&&(P=-P/this.zoomFactor,F=-F/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+P),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+F),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=D},B.prototype.resize=function(D){var P=Object.assign({},this.cropRect),F=D.x-this.previousPoint.x,W=D.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:P.x+F<this.margin&&(F=this.margin-P.x),P.x+=F,P.width=this.cropRect.x+this.cropRect.width-P.x;break;case this.bottomRightGrip:case this.topRightGrip:P.width+F>this.canvasWidth*this.zoomFactor&&(F=this.canvasWidth*this.zoomFactor-P.width),P.width+=F}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(P.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(F),P.height=this.aspectRatio.getVerticalLength(P.width)):(P.y+=W,P.height=this.cropRect.y+this.cropRect.height-P.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?P.height=this.aspectRatio.getVerticalLength(P.width):P.height+=W}P.width<10&&(P.x=this.cropRect.x,P.width=10),P.height<10&&(P.y=this.cropRect.y,P.height=10),this.previousPoint=D,P.x>=this.margin&&P.y>=this.margin&&P.x-this.margin+P.width<=this.canvasWidth&&P.y-this.margin+P.height<=this.canvasHeight&&(this.cropRect=P,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},B.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var D=this.cropRect.x+this.cropRect.width/2,P=this.cropRect.y+this.cropRect.height/2,F=this.aspectRatio.getHorizontalLength(this.cropRect.height),W=this.aspectRatio.getVerticalLength(this.cropRect.width);F/this.canvasWidth<W/this.canvasHeight?this.cropRect.width=F:this.cropRect.height=W,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=D-this.cropRect.width/2,this.cropRect.y=P-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},B.prototype.getRescaledRect=function(D,P,F,W,I,U){var j=F/D,G=W/P;return{x:(I.x-U)*j+U,y:(I.y-U)*G+U,width:I.width*j,height:I.height*G}},B.prototype.scaleCanvas=function(D,P){var F=this.getRescaledRect(this.canvasWidth,this.canvasHeight,D,P,this.cropRect,this.margin);this.canvasWidth=D,this.canvasHeight=P,this.onCropChange&&this.onCropChange(F),this.setCropRectangle(F)},B}(),fe=function(){function B(D){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=D,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(B.prototype,"angle",{get:function(){return this._angle},set:function(D){this._angle=D,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),B.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},B.prototype.onPointerDown=function(D){this.controlContainer.setPointerCapture(D.pointerId),this.isDragging=!0,this.previousPoint={x:D.clientX,y:D.clientY}},B.prototype.onPointerMove=function(D){this.isDragging&&(this.onAngleChange&&this.onAngleChange((D.clientX-this.previousPoint.x)/5),this.previousPoint.x=D.clientX)},B.prototype.onPointerUp=function(D){this.isDragging&&this.onAngleChange&&this.onAngleChange((D.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(D.pointerId)},B.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var D=this.angleLabelText.getBBox();ne.setAttributes(this.angleLabelElement,[["x",((this.width-D.width)/2).toString()],["y",(this.height/2).toString()]])}},B.prototype.positionScaleShape=function(){if(this.scaleShape){var D=this.scaleShape.transform.baseVal.getItem(0);D.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(D,0)}},B.prototype.getVisual=function(){var D=document.createElementNS("http://www.w3.org/2000/svg","svg");D.setAttribute("xmlns","http://www.w3.org/2000/svg"),D.setAttribute("width",this.width+"px"),D.setAttribute("height",this.height+"px"),D.setAttribute("viewBox","0 0 "+this.width+" "+this.height),D.style.flexShrink="0",document.body.appendChild(D);for(var P="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,F=1;F<=this.width/5+10;F++){var W=F%5==0?this.height/3:this.height/6;P+="h4v"+-W+"h1v"+W}P+="v1H0Z",this.scaleShape=ne.createPath(P);var I=ne.createTransform();this.scaleShape.transform.baseVal.appendItem(I),D.appendChild(this.scaleShape),this.angleLabelElement=ne.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=ne.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var U=ne.createTSpan("");return U.innerHTML="&deg;",this.angleLabelElement.appendChild(U),D.appendChild(this.angleLabelElement),document.body.removeChild(D),D},B}(),_e=function(){function B(){this.naturalSize=!1,this.imageType="image/png"}return B.prototype.rasterize=function(D,P,F,W,I,U,j){var G=this;return new Promise(function($){var Y=document.createElement("canvas");Y.width=D.width.baseVal.value-2*W,Y.height=D.height.baseVal.value-2*W;var q=1,Se=1;G.naturalSize===!0?(q=P.naturalWidth/(D.width.baseVal.value-2*W)/U,Se=P.naturalHeight/(D.height.baseVal.value-2*W)/j,Y.width=P.naturalWidth/U,Y.height=P.naturalHeight/j):G.width!==void 0&&G.height!==void 0&&(q=G.width/F.width,Se=G.height/F.height,Y.width*=q,Y.height*=Se);var we=Y.getContext("2d");we.translate(Y.width/2,Y.height/2),we.rotate(I*Math.PI/180),we.scale(U,j),we.translate(-Y.width/2,-Y.height/2),we.drawImage(P,0,0,Y.width,Y.height);var xe=document.createElement("canvas");xe.width=F.width*q,xe.height=F.height*Se,xe.getContext("2d").putImageData(we.getImageData((F.x-W)*q,(F.y-W)*Se,F.width*q,F.height*Se),0,0),$(xe.toDataURL(G.imageType,G.imageQuality))})},B}(),je=function(){function B(D){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=B.instanceCounter++,this.styles=new Te(this.instanceNo),this.target=D,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(B.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(D){this._zoomToCropEnabled=D,D?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(D){this._isGridVisible=D,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"gridLines",{get:function(){return this._gridLines},set:function(D){this._gridLines=D,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(D){this._rotationAngle=D,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"aspectRatio",{get:function(){var D;return(D=this._aspectRatio)!==null&&D!==void 0?D:this.aspectRatios[0]},set:function(D){this._aspectRatio=D},enumerable:!1,configurable:!0}),B.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},B.prototype.show=function(){this.showUI(),this.open()},B.prototype.close=function(D){D===void 0&&(D=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),D||this.closeEventListeners.forEach(function(P){return P()}),this._isOpen=!1)},B.prototype.addRenderEventListener=function(D){this.renderEventListeners.push(D)},B.prototype.removeRenderEventListener=function(D){this.renderEventListeners.indexOf(D)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(D),1)},B.prototype.addCloseEventListener=function(D){this.closeEventListeners.push(D)},B.prototype.removeCloseEventListener=function(D){this.closeEventListeners.indexOf(D)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(D),1)},B.prototype.setupResizeObserver=function(){var D=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){D.resize(D.target.clientWidth,D.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},B.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var D=1*this.target.clientWidth/this.target.clientHeight,P=this.contentDiv.clientWidth/D>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*D:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,F=P+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/D;this.resize(P,F)}},B.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},B.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",ne.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},B.prototype.resize=function(D,P){this.imageWidth=Math.round(D),this.imageHeight=Math.round(P),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},B.prototype.setEditingTarget=function(){var D=document.createElement("canvas");D.width=this.target.naturalWidth,D.height=this.target.naturalHeight,D.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var P=D.toDataURL();ne.setAttributes(this.editingTarget,[["href",P]]),this.setEditingTargetSize()},B.prototype.setTopLeft=function(){var D=this.target.getBoundingClientRect(),P=this.editorCanvas.getBoundingClientRect();this.left=D.left-P.left-this.CANVAS_MARGIN,this.top=D.top-P.top-this.CANVAS_MARGIN},B.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=ne.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=ne.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=ne.createGroup(),this.editingTargetRotationScaleContainer=ne.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var D=ne.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(D);var P=ne.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(P),this.editingTargetContainer=ne.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},B.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},B.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=ne.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Re(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},B.prototype.zoomToCrop=function(){if(this.cropRect){var D=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,P=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=D+"px "+P+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-D+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-P+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},B.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},B.prototype.cropRectChanged=function(D){this.cropRect=D,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},B.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},B.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},B.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},B.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var D=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,P=this.target.offsetTop>D+this.CANVAS_MARGIN?this.target.offsetTop-(D+this.CANVAS_MARGIN):0;this.coverDiv.style.top=P+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},B.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},B.prototype.addTopToolbar=function(){var D=this;this.topToolbar=new Ae,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var P=new se;P.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(P);var F=[];this.aspectRatios.forEach(function(Se){var we=new he(me.getIcon(Se.horizontal,Se.vertical),Se.horizontal===0&&Se.vertical===0?"FREE":Se.horizontal+":"+Se.vertical);we.onClick=function(){return D.ratioButtonClicked(Se)},F.push(we)}),this.aspectRatioButton=new ue(me.getIcon(0,0),"Aspect ratio",F),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,P.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var W=new he('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");W.isActive=this.isGridVisible,W.onClick=function(){D.isGridVisible=!D.isGridVisible,W.isActive=D.isGridVisible},P.addButton(W);var I=new he('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(I.isActive=this.zoomToCropEnabled,I.onClick=function(){D.zoomToCropEnabled=!D.zoomToCropEnabled,I.isActive=D.zoomToCropEnabled},P.addButton(I),!Z.isLicensed){var U=new ge;this.topToolbar.addElementBlock(U);var j=document.createElement("div");j.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var G=document.createElement("a");G.style.color="currentColor",G.href="https://markerjs.com/products/cropro",G.target="_blank",G.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',j.appendChild(G),U.addElement(j)}var $=new se;$.minWidth=3*this.toolbarHeight+"px",$.contentAlign="end",this.topToolbar.addButtonBlock($);var Y=new he('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Y.onClick=this.startRenderAndClose,$.addButton(Y),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Y.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var q=new he('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");q.onClick=this.close,$.addButton(q),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(q.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},B.prototype.addBottomToolbar=function(){var D=this;this.bottomToolbar=new Ae,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var P=new se;P.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(P);var F=new he('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");F.onClick=this.rotateLeftButtonClicked,P.addButton(F);var W=new he('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");W.onClick=this.rotateRightButtonClicked,P.addButton(W);var I=new ge;I.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(I),this.straightener=new fe("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function($){D.rotateBy($),D.straightener.angle=D.rotationAngle},I.addElement(this.straightener.getUI());var U=new se;U.minWidth=2*this.toolbarHeight+"px",U.contentAlign="end",this.bottomToolbar.addButtonBlock(U);var j=new he('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");j.onClick=this.flipHorizontallyButtonClicked,U.addButton(j);var G=new he('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");G.onClick=this.flipVerticallyButtonClicked,U.addButton(G)},B.prototype.ratioButtonClicked=function(D){this.aspectRatio=D,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},B.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=me.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},B.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new ye(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},B.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},B.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},B.prototype.restoreState=function(D){if(D){var P=this.cropLayer.getRescaledRect(D.width,D.height,this.imageWidth,this.imageHeight,D.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(P),this.cropRectChanged(P),this.flippedHorizontally=D.flippedHorizontally,this.flippedVertically=D.flippedVertically,this.applyFlip(),this.rotationAngle=D.rotationAngle,this.applyRotation()}},B.prototype.clientToLocalCoordinates=function(D,P){var F=this.cropImage.getBoundingClientRect();return{x:D-F.left,y:P-F.top}},B.prototype.onWindowResize=function(){this.positionUI()},B.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var D=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=D+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},B.prototype.rotateLeftButtonClicked=function(){var D=this.rotationAngle-90;this.rotationAngle%90!=0&&(D+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(D)},B.prototype.rotateRightButtonClicked=function(){var D=this.rotationAngle+90;this.rotationAngle%90!=0&&(D-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(D)},B.prototype.rotateTo=function(D){D=(D=D>180?D-360:D)<=-180?D+360:D,this.rotationAngle=D,this.applyRotation()},B.prototype.rotateBy=function(D){this.rotateTo((this.rotationAngle+D)%360)},B.prototype.applyRotation=function(){var D=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var P=this.editingTargetRotationContainer.transform.baseVal.getItem(0);P.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(P,0);var F=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/F.width,this.imageHeight/F.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=D},B.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},B.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},B.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},B.prototype.startRenderAndClose=function(){return le(this,void 0,void 0,function(){var D,P;return Q(this,function(F){switch(F.label){case 0:return[4,this.render()];case 1:return D=F.sent(),P=this.getState(),this.renderEventListeners.forEach(function(W){return W(D,P)}),this.close(!0),[2]}})})},B.prototype.render=function(){return le(this,void 0,void 0,function(){var D;return Q(this,function(P){switch(P.label){case 0:return(D=new _e).naturalSize=this.renderAtNaturalSize,D.imageType=this.renderImageType,D.imageQuality=this.renderImageQuality,D.width=this.renderWidth,D.height=this.renderHeight,this.unzoomFromCrop(),ne.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,D.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return P.sent(),[4,D.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,P.sent()]}})})},B.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ce("toolbar",`
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.toolbarHeight+`px;
box-sizing: content-box;
overflow: hidden;
line-height: 0px;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Ce("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ce("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var D=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ce("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*D)+`px;
height: `+(this.toolbarHeight-2*D)+`px;
padding: `+D+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ce("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ce("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new Ee("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new Ee("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Ce("toolbar_dropdown",`
position: absolute;
max-width: `+4*this.toolbarHeight+`px;
z-index: 20;
white-space: normal;
box-sizing: content-box;
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
line-height: 0px;
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Ce("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ce("toolbar_straightener_block",`
display: flex;
overflow: hidden;
justify-content: center;
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new Ce("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*D)+`px;
padding: `+D+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ce("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},B.instanceCounter=0,B}(),Ie=V("8hTe"),De=V.n(Ie),ce=/<pre[^>]*>/g;function Me(B){var D=document.createElement("div");return D.innerHTML=B,D.childNodes.length===0?"":D.childNodes[0].nodeValue}var Be=We.a=function(B){var D=B.value,P=D===void 0?"":D,F=B.edit,W=F===void 0?!1:F,I=B.className,U=B.showTextOnly,j=B.showLines,G=B.replaces,$=B.zoomImg,Y=B.hasMask,q=B.style,Se=q===void 0?{}:q,we=B.stylesPrev,xe=we===void 0?{}:we,Ke=String(P),Fe=Object(_.useRef)(),ke=Object(_.useRef)(),ze=Object(_.useState)(""),pe=Object(M.a)(ze,2),Le=pe[0],be=pe[1],Ue=Object(_.useState)("office"),Je=Object(M.a)(Ue,2),Ge=Je[0],et=Je[1],rt=function(){var Xe=new je(ke.current);Xe.displayMode="popup",Xe.addRenderEventListener(function(){var nt=Object(E.a)(A.a.mark(function Ye(Pe){var Ne;return A.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:return Fe.current.style.display="none",Ze.next=3,Object(ve.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Pe}});case 3:Ne=Ze.sent,Ne!=null&&Ne.id&&G(ke.current.getAttribute("src").replace(J.a.API_SERVER,""),"/api/attachments/".concat(Ne==null?void 0:Ne.id,"?type=").concat(Ne.content_type));case 5:case"end":return Ze.stop()}},Ye)}));return function(Ye){return nt.apply(this,arguments)}}()),Xe.show()},it=function(){var Xe=new re.a(ke.current);Xe.settings.displayMode="popup",Xe.addEventListener("render",function(){var nt=Object(E.a)(A.a.mark(function Ye(Pe){var Ne;return A.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:if(Fe.current.style.display="none",!ke.current){Ze.next=6;break}return Ze.next=4,Object(ve.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Pe.dataUrl}});case 4:Ne=Ze.sent,Ne!=null&&Ne.id&&G(ke.current.getAttribute("src").replace(J.a.API_SERVER,""),"/api/attachments/".concat(Ne==null?void 0:Ne.id,"?type=").concat(Ne.content_type));case 6:case"end":return Ze.stop()}},Ye)}));return function(Ye){return nt.apply(this,arguments)}}()),Xe.show(),window.markerArea=Xe},ot=Object(_.useMemo)(function(){Fe.current&&(Fe.current.style.zIndex=-1);try{var qe=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Xe=/\"\/api\/attachments\/|\"\/attachments\/download\//g,nt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ke=Ke.replace(qe,"("+J.a.API_SERVER+"/api/attachments/").replace(Xe,'"'+J.a.API_SERVER+"/api/attachments/").replace(nt,'"'+J.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch($e){}var Ye=H(Ke),Pe=h();if(Ke.match(/\[TOC\]/)&&(Ye=Ye.replace("<p>[TOC]</p>",m()),c()),Ye=Ye.replace(/(__special_katext_id_\d+__)/g,function($e,Ze){var ut=Pe[Ze],dt=ut.type,tt=ut.expression;return Object(te.renderToString)(Me(tt)||"",{displayMode:dt==="block",throwOnError:!1,output:"html"})}),Ye=Ye.replace(/▁/g,"\u2581\u2581\u2581"),f(),U){var Ne=document.createElement("div");return Ne.innerHTML=Ye,Ne.innerText}return setTimeout(function(){return st()},500),Ye},[Ke]),at=Object(_.useRef)();l.WebkitLineClamp=j,j&&(Se=Object(C.a)(Object(C.a)({},Se),l));function lt(qe){var Xe=qe.target;if(Xe.tagName.toUpperCase()==="IMG"){if($){var nt=Xe.getAttribute("src");be(nt),et("image")}}else if(Xe.tagName.toUpperCase()==="A"){var Ye=Xe.getAttribute("href");if(Ye.indexOf("office")>-1)qe.preventDefault(),be(Ye),et("office");else if(Ye.indexOf("application/pdf")>-1)qe.preventDefault(),be(Ye),et("pdf");else if(Ye.indexOf("text/html")>-1)qe.preventDefault(),be(Ye),et("html");else if(Ye.startsWith("#")){qe.preventDefault();var Pe=document.getElementById(Ye.replace("#",""));Pe&&Pe.scrollIntoView(!0)}}}var st=function(){var Xe,nt=(Xe=at.current)===null||Xe===void 0?void 0:Xe.querySelectorAll("video");nt==null||nt.forEach(function(Ye){if(Ye.oncontextmenu=function(){return!1},Ye.src.indexOf(".m3u8")>-1&&!Ye.canPlayType("application/vnd.apple.mpegurl")){if(z.a.isSupported()){var Pe=new z.a;Pe.loadSource(Ye.src),Pe.attachMedia(Ye)}}})};Object(_.useEffect)(function(){if(at.current&&ot&&(ot.match(ce)&&window.PR.prettyPrint()),at.current)return at.current.addEventListener("click",lt),function(){at.current.removeEventListener("click",lt),f(),c()}},[ot,at.current,lt]);var Qe=function(Xe){if(!W)return;Xe.target.nodeName==="IMG"?(Fe.current.style.zIndex=1,Fe.current.style.display="flex",Fe.current.style.width=Xe.target.clientWidth+"px",Fe.current.style.height=Xe.target.clientHeight+"px",Fe.current.style.top=Xe.target.offsetTop+"px",Fe.current.style.left=Xe.target.offsetLeft+"px",ke.current.src=Xe.target.getAttribute("src")):Fe.current.style.display="none"};return g.a.createElement("div",{style:{position:"relative"}},g.a.createElement("div",{ref:at,style:Object(C.a)({},Se),className:"".concat(I||""," markdown-body ").concat(De.a.mdBody),onMouseOver:Qe,dangerouslySetInnerHTML:{__html:ot}}),g.a.createElement("div",{ref:Fe,className:De.a.button},g.a.createElement(k.a,null,g.a.createElement(O.a,{onClick:function(){return rt()}},"\u88C1\u526A"),g.a.createElement(O.a,{onClick:function(){return it()}},"\u7F16\u8F91"))),g.a.createElement("img",{ref:ke,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),g.a.createElement(ee.a,{close:!0,data:Le,type:Le!=null&&Le.length?Ge:"",style:Object(C.a)({},xe),onClose:function(){return be("")}}))}},BJfS:function(He,We){var V=function(ae){return ae.replace(/[A-Z]/g,function(k){return"-"+k.toLowerCase()}).toLowerCase()};He.exports=V},CAjq:function(He,We,V){He.exports=V.p+"static/qqCode.a1502573.png"},"Cs+z":function(He,We,V){He.exports=V.p+"static/jqr.b801d45b.png"},"Ct/S":function(He,We,V){He.exports={tilte:"tilte___1Tz7i",flexRow:"flexRow___3w9_D",flexColumn:"flexColumn___2HzC_",footerWrap:"footerWrap___12F5M",img:"img___3ED9Z",content:"content___rqPDY",modalContent:"modalContent___2h4ne"}},DlQD:function(He,We,V){(function(ae,k){He.exports=k()})(this,function(){"use strict";function ae(P,F){for(var W=0;W<F.length;W++){var I=F[W];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(P,I.key,I)}}function k(P,F,W){return F&&ae(P.prototype,F),W&&ae(P,W),P}function b(P,F){if(!P)return;if(typeof P=="string")return O(P,F);var W=Object.prototype.toString.call(P).slice(8,-1);if(W==="Object"&&P.constructor&&(W=P.constructor.name),W==="Map"||W==="Set")return Array.from(P);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return O(P,F)}function O(P,F){(F==null||F>P.length)&&(F=P.length);for(var W=0,I=new Array(F);W<F;W++)I[W]=P[W];return I}function C(P,F){var W;if(typeof Symbol=="undefined"||P[Symbol.iterator]==null){if(Array.isArray(P)||(W=b(P))||F&&P&&typeof P.length=="number"){W&&(P=W);var I=0;return function(){return I>=P.length?{done:!0}:{done:!1,value:P[I++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return W=P[Symbol.iterator](),W.next.bind(W)}function E(P,F){return F={exports:{}},P(F,F.exports),F.exports}var M=E(function(P){function F(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function W(I){P.exports.defaults=I}P.exports={defaults:F(),getDefaults:F,changeDefaults:W}}),w=M.defaults,A=M.getDefaults,_=M.changeDefaults,g=/[&<>"']/,x=/[&<>"']/g,S=/[<>"']|&(?!#?\w+;)/,v=/[<>"']|&(?!#?\w+;)/g,y={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},p=function(F){return y[F]};function s(P,F){if(F){if(g.test(P))return P.replace(x,p)}else if(S.test(P))return P.replace(v,p);return P}var e=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function a(P){return P.replace(e,function(F,W){return W=W.toLowerCase(),W==="colon"?":":W.charAt(0)==="#"?W.charAt(1)==="x"?String.fromCharCode(parseInt(W.substring(2),16)):String.fromCharCode(+W.substring(1)):""})}var n=/(^|[^\[])\^/g;function c(P,F){P=P.source||P,F=F||"";var W={replace:function(U,j){return j=j.source||j,j=j.replace(n,"$1"),P=P.replace(U,j),W},getRegex:function(){return new RegExp(P,F)}};return W}var l=/[^\w:]/g,u=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function m(P,F,W){if(P){var I;try{I=decodeURIComponent(a(W)).replace(l,"").toLowerCase()}catch(U){return null}if(I.indexOf("javascript:")===0||I.indexOf("vbscript:")===0||I.indexOf("data:")===0)return null}F&&!u.test(W)&&(W=r(F,W));try{W=encodeURI(W).replace(/%25/g,"%")}catch(U){return null}return W}var d={},o=/^[^:]+:\/*[^/]*$/,i=/^([^:]+:)[\s\S]*$/,t=/^([^:]+:\/*[^/]*)[\s\S]*$/;function r(P,F){d[" "+P]||(o.test(P)?d[" "+P]=P+"/":d[" "+P]=R(P,"/",!0)),P=d[" "+P];var W=P.indexOf(":")===-1;return F.substring(0,2)==="//"?W?F:P.replace(i,"$1")+F:F.charAt(0)==="/"?W?F:P.replace(t,"$1")+F:P+F}var h={exec:function(){}};function f(P){for(var F=1,W,I;F<arguments.length;F++){W=arguments[F];for(I in W)Object.prototype.hasOwnProperty.call(W,I)&&(P[I]=W[I])}return P}function T(P,F){var W=P.replace(/\|/g,function(j,G,$){for(var Y=!1,q=G;--q>=0&&$[q]==="\\";)Y=!Y;return Y?"|":" |"}),I=W.split(/ \|/),U=0;if(I.length>F)I.splice(F);else for(;I.length<F;)I.push("");for(;U<I.length;U++)I[U]=I[U].trim().replace(/\\\|/g,"|");return I}function R(P,F,W){var I=P.length;if(I===0)return"";for(var U=0;U<I;){var j=P.charAt(I-U-1);if(j===F&&!W)U++;else if(j!==F&&W)U++;else break}return P.substr(0,I-U)}function L(P,F){if(P.indexOf(F[1])===-1)return-1;for(var W=P.length,I=0,U=0;U<W;U++)if(P[U]==="\\")U++;else if(P[U]===F[0])I++;else if(P[U]===F[1]&&(I--,I<0))return U;return-1}function N(P){P&&P.sanitize&&!P.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var H={escape:s,unescape:a,edit:c,cleanUrl:m,resolveUrl:r,noopTest:h,merge:f,splitCells:T,rtrim:R,findClosingBracket:L,checkSanitizeDeprecation:N},K=M.defaults,X=H.rtrim,z=H.splitCells,J=H.escape,te=H.findClosingBracket;function ee(P,F,W){var I=F.href,U=F.title?J(F.title):null,j=P[1].replace(/\\([\[\]])/g,"$1");return P[0].charAt(0)!=="!"?{type:"link",raw:W,href:I,title:U,text:j}:{type:"image",raw:W,href:I,title:U,text:J(j)}}function ve(P,F){var W=P.match(/^(\s+)(?:```)/);if(W===null)return F;var I=W[1];return F.split(`
`).map(function(U){var j=U.match(/^\s+/);if(j===null)return U;var G=j[0];return G.length>=I.length?U.slice(I.length):U}).join(`
`)}var re=function(){function P(W){this.options=W||K}var F=P.prototype;return F.space=function(I){var U=this.rules.block.newline.exec(I);if(U)return U[0].length>1?{type:"space",raw:U[0]}:{raw:`
`}},F.code=function(I,U){var j=this.rules.block.code.exec(I);if(j){var G=U[U.length-1];if(G&&G.type==="paragraph")return{raw:j[0],text:j[0].trimRight()};var $=j[0].replace(/^ {4}/gm,"");return{type:"code",raw:j[0],codeBlockStyle:"indented",text:this.options.pedantic?$:X($,`
`)}}},F.fences=function(I){var U=this.rules.block.fences.exec(I);if(U){var j=U[0],G=ve(j,U[3]||"");return{type:"code",raw:j,lang:U[2]?U[2].trim():U[2],text:G}}},F.heading=function(I){var U=this.rules.block.heading.exec(I);if(U)return{type:"heading",raw:U[0],depth:U[1].length,text:U[2]}},F.nptable=function(I){var U=this.rules.block.nptable.exec(I);if(U){var j={type:"table",header:z(U[1].replace(/^ *| *\| *$/g,"")),align:U[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:U[3]?U[3].replace(/\n$/,"").split(`
`):[],raw:U[0]};if(j.header.length===j.align.length){var G=j.align.length,$;for($=0;$<G;$++)/^ *-+: *$/.test(j.align[$])?j.align[$]="right":/^ *:-+: *$/.test(j.align[$])?j.align[$]="center":/^ *:-+ *$/.test(j.align[$])?j.align[$]="left":j.align[$]=null;for(G=j.cells.length,$=0;$<G;$++)j.cells[$]=z(j.cells[$],j.header.length);return j}}},F.hr=function(I){var U=this.rules.block.hr.exec(I);if(U)return{type:"hr",raw:U[0]}},F.blockquote=function(I){var U=this.rules.block.blockquote.exec(I);if(U){var j=U[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:U[0],text:j}}},F.list=function(I){var U=this.rules.block.list.exec(I);if(U){for(var j=U[0],G=U[2],$=G.length>1,Y=G[G.length-1]===")",q={type:"list",raw:j,ordered:$,start:$?+G.slice(0,-1):"",loose:!1,items:[]},Se=U[0].match(this.rules.block.item),we=!1,xe,Ke,Fe,ke,ze,pe,Le,be=Se.length,Ue=0;Ue<be;Ue++)xe=Se[Ue],j=xe,Ke=xe.length,xe=xe.replace(/^ *([*+-]|\d+[.)]) */,""),~xe.indexOf(`
`)&&(Ke-=xe.length,xe=this.options.pedantic?xe.replace(/^ {1,4}/gm,""):xe.replace(new RegExp("^ {1,"+Ke+"}","gm"),"")),Ue!==be-1&&(Fe=this.rules.block.bullet.exec(Se[Ue+1])[0],($?Fe.length===1||!Y&&Fe[Fe.length-1]===")":Fe.length>1||this.options.smartLists&&Fe!==G)&&(ke=Se.slice(Ue+1).join(`
`),q.raw=q.raw.substring(0,q.raw.length-ke.length),Ue=be-1)),ze=we||/\n\n(?!\s*$)/.test(xe),Ue!==be-1&&(we=xe.charAt(xe.length-1)===`
`,ze||(ze=we)),ze&&(q.loose=!0),pe=/^\[[ xX]\] /.test(xe),Le=void 0,pe&&(Le=xe[1]!==" ",xe=xe.replace(/^\[[ xX]\] +/,"")),q.items.push({type:"list_item",raw:j,task:pe,checked:Le,loose:ze,text:xe});return q}},F.html=function(I){var U=this.rules.block.html.exec(I);if(U)return{type:this.options.sanitize?"paragraph":"html",raw:U[0],pre:!this.options.sanitizer&&(U[1]==="pre"||U[1]==="script"||U[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(U[0]):J(U[0]):U[0]}},F.def=function(I){var U=this.rules.block.def.exec(I);if(U){U[3]&&(U[3]=U[3].substring(1,U[3].length-1));var j=U[1].toLowerCase().replace(/\s+/g," ");return{tag:j,raw:U[0],href:U[2],title:U[3]}}},F.table=function(I){var U=this.rules.block.table.exec(I);if(U){var j={type:"table",header:z(U[1].replace(/^ *| *\| *$/g,"")),align:U[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:U[3]?U[3].replace(/\n$/,"").split(`
`):[]};if(j.header.length===j.align.length){j.raw=U[0];var G=j.align.length,$;for($=0;$<G;$++)/^ *-+: *$/.test(j.align[$])?j.align[$]="right":/^ *:-+: *$/.test(j.align[$])?j.align[$]="center":/^ *:-+ *$/.test(j.align[$])?j.align[$]="left":j.align[$]=null;for(G=j.cells.length,$=0;$<G;$++)j.cells[$]=z(j.cells[$].replace(/^ *\| *| *\| *$/g,""),j.header.length);return j}}},F.lheading=function(I){var U=this.rules.block.lheading.exec(I);if(U)return{type:"heading",raw:U[0],depth:U[2].charAt(0)==="="?1:2,text:U[1]}},F.paragraph=function(I){var U=this.rules.block.paragraph.exec(I);if(U)return{type:"paragraph",raw:U[0],text:U[1].charAt(U[1].length-1)===`
`?U[1].slice(0,-1):U[1]}},F.text=function(I,U){var j=this.rules.block.text.exec(I);if(j){var G=U[U.length-1];return G&&G.type==="text"?{raw:j[0],text:j[0]}:{type:"text",raw:j[0],text:j[0]}}},F.escape=function(I){var U=this.rules.inline.escape.exec(I);if(U)return{type:"escape",raw:U[0],text:J(U[1])}},F.tag=function(I,U,j){var G=this.rules.inline.tag.exec(I);if(G)return!U&&/^<a /i.test(G[0])?U=!0:U&&/^<\/a>/i.test(G[0])&&(U=!1),!j&&/^<(pre|code|kbd|script)(\s|>)/i.test(G[0])?j=!0:j&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(G[0])&&(j=!1),{type:this.options.sanitize?"text":"html",raw:G[0],inLink:U,inRawBlock:j,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(G[0]):J(G[0]):G[0]}},F.link=function(I){var U=this.rules.inline.link.exec(I);if(U){var j=te(U[2],"()");if(j>-1){var G=U[0].indexOf("!")===0?5:4,$=G+U[1].length+j;U[2]=U[2].substring(0,j),U[0]=U[0].substring(0,$).trim(),U[3]=""}var Y=U[2],q="";if(this.options.pedantic){var Se=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Y);Se?(Y=Se[1],q=Se[3]):q=""}else q=U[3]?U[3].slice(1,-1):"";Y=Y.trim().replace(/^<([\s\S]*)>$/,"$1");var we=ee(U,{href:Y&&Y.replace(this.rules.inline._escapes,"$1"),title:q&&q.replace(this.rules.inline._escapes,"$1")},U[0]);return we}},F.reflink=function(I,U){var j;if((j=this.rules.inline.reflink.exec(I))||(j=this.rules.inline.nolink.exec(I))){var G=(j[2]||j[1]).replace(/\s+/g," ");if(G=U[G.toLowerCase()],!G||!G.href){var $=j[0].charAt(0);return{type:"text",raw:$,text:$}}var Y=ee(j,G,j[0]);return Y}},F.strong=function(I,U,j){j===void 0&&(j="");var G=this.rules.inline.strong.start.exec(I);if(G&&(!G[1]||G[1]&&(j===""||this.rules.inline.punctuation.exec(j)))){U=U.slice(-1*I.length);var $=G[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;$.lastIndex=0;for(var Y;(G=$.exec(U))!=null;)if(Y=this.rules.inline.strong.middle.exec(U.slice(0,G.index+3)),Y)return{type:"strong",raw:I.slice(0,Y[0].length),text:I.slice(2,Y[0].length-2)}}},F.em=function(I,U,j){j===void 0&&(j="");var G=this.rules.inline.em.start.exec(I);if(G&&(!G[1]||G[1]&&(j===""||this.rules.inline.punctuation.exec(j)))){U=U.slice(-1*I.length);var $=G[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;$.lastIndex=0;for(var Y;(G=$.exec(U))!=null;)if(Y=this.rules.inline.em.middle.exec(U.slice(0,G.index+2)),Y)return{type:"em",raw:I.slice(0,Y[0].length),text:I.slice(1,Y[0].length-1)}}},F.codespan=function(I){var U=this.rules.inline.code.exec(I);if(U){var j=U[2].replace(/\n/g," "),G=/[^ ]/.test(j),$=j.startsWith(" ")&&j.endsWith(" ");return G&&$&&(j=j.substring(1,j.length-1)),j=J(j,!0),{type:"codespan",raw:U[0],text:j}}},F.br=function(I){var U=this.rules.inline.br.exec(I);if(U)return{type:"br",raw:U[0]}},F.del=function(I){var U=this.rules.inline.del.exec(I);if(U)return{type:"del",raw:U[0],text:U[1]}},F.autolink=function(I,U){var j=this.rules.inline.autolink.exec(I);if(j){var G,$;return j[2]==="@"?(G=J(this.options.mangle?U(j[1]):j[1]),$="mailto:"+G):(G=J(j[1]),$=G),{type:"link",raw:j[0],text:G,href:$,tokens:[{type:"text",raw:G,text:G}]}}},F.url=function(I,U){var j;if(j=this.rules.inline.url.exec(I)){var G,$;if(j[2]==="@")G=J(this.options.mangle?U(j[0]):j[0]),$="mailto:"+G;else{var Y;do Y=j[0],j[0]=this.rules.inline._backpedal.exec(j[0])[0];while(Y!==j[0]);G=J(j[0]),j[1]==="www."?$="http://"+G:$=G}return{type:"link",raw:j[0],text:G,href:$,tokens:[{type:"text",raw:G,text:G}]}}},F.inlineText=function(I,U,j){var G=this.rules.inline.text.exec(I);if(G){var $;return U?$=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(G[0]):J(G[0]):G[0]:$=J(this.options.smartypants?j(G[0]):G[0]),{type:"text",raw:G[0],text:$}}},P}(),de=H.noopTest,ie=H.edit,le=H.merge,Q={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:de,table:de,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};Q._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Q._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Q.def=ie(Q.def).replace("label",Q._label).replace("title",Q._title).getRegex(),Q.bullet=/(?:[*+-]|\d{1,9}[.)])/,Q.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,Q.item=ie(Q.item,"gm").replace(/bull/g,Q.bullet).getRegex(),Q.list=ie(Q.list).replace(/bull/g,Q.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Q.def.source+")").getRegex(),Q._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Q._comment=/<!--(?!-?>)[\s\S]*?-->/,Q.html=ie(Q.html,"i").replace("comment",Q._comment).replace("tag",Q._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Q.paragraph=ie(Q._paragraph).replace("hr",Q.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Q._tag).getRegex(),Q.blockquote=ie(Q.blockquote).replace("paragraph",Q.paragraph).getRegex(),Q.normal=le({},Q),Q.gfm=le({},Q.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Q.gfm.nptable=ie(Q.gfm.nptable).replace("hr",Q.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Q._tag).getRegex(),Q.gfm.table=ie(Q.gfm.table).replace("hr",Q.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Q._tag).getRegex(),Q.pedantic=le({},Q.normal,{html:ie(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Q._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:de,paragraph:ie(Q.normal._paragraph).replace("hr",Q.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Q.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:de,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:de,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};Z._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Z.punctuation=ie(Z.punctuation).replace(/punctuation/g,Z._punctuation).getRegex(),Z._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",Z._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",Z.em.start=ie(Z.em.start).replace(/punctuation/g,Z._punctuation).getRegex(),Z.em.middle=ie(Z.em.middle).replace(/punctuation/g,Z._punctuation).replace(/overlapSkip/g,Z._overlapSkip).getRegex(),Z.em.endAst=ie(Z.em.endAst,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.em.endUnd=ie(Z.em.endUnd,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.start=ie(Z.strong.start).replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.middle=ie(Z.strong.middle).replace(/punctuation/g,Z._punctuation).replace(/blockSkip/g,Z._blockSkip).getRegex(),Z.strong.endAst=ie(Z.strong.endAst,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.endUnd=ie(Z.strong.endUnd,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.blockSkip=ie(Z._blockSkip,"g").getRegex(),Z.overlapSkip=ie(Z._overlapSkip,"g").getRegex(),Z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Z._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,Z.autolink=ie(Z.autolink).replace("scheme",Z._scheme).replace("email",Z._email).getRegex(),Z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Z.tag=ie(Z.tag).replace("comment",Q._comment).replace("attribute",Z._attribute).getRegex(),Z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Z._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,Z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Z.link=ie(Z.link).replace("label",Z._label).replace("href",Z._href).replace("title",Z._title).getRegex(),Z.reflink=ie(Z.reflink).replace("label",Z._label).getRegex(),Z.reflinkSearch=ie(Z.reflinkSearch,"g").replace("reflink",Z.reflink).replace("nolink",Z.nolink).getRegex(),Z.normal=le({},Z),Z.pedantic=le({},Z.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ie(/^!?\[(label)\]\((.*?)\)/).replace("label",Z._label).getRegex(),reflink:ie(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Z._label).getRegex()}),Z.gfm=le({},Z.normal,{escape:ie(Z.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),Z.gfm.url=ie(Z.gfm.url,"i").replace("email",Z.gfm._extended_email).getRegex(),Z.breaks=le({},Z.gfm,{br:ie(Z.br).replace("{2,}","*").getRegex(),text:ie(Z.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var ne={block:Q,inline:Z},Te=M.defaults,Ee=ne.block,Ce=ne.inline;function Ae(P){return P.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function oe(P){var F="",W,I,U=P.length;for(W=0;W<U;W++)I=P.charCodeAt(W),Math.random()>.5&&(I="x"+I.toString(16)),F+="&#"+I+";";return F}var se=function(){function P(W){this.tokens=[],this.tokens.links=Object.create(null),this.options=W||Te,this.options.tokenizer=this.options.tokenizer||new re,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var I={block:Ee.normal,inline:Ce.normal};this.options.pedantic?(I.block=Ee.pedantic,I.inline=Ce.pedantic):this.options.gfm&&(I.block=Ee.gfm,this.options.breaks?I.inline=Ce.breaks:I.inline=Ce.gfm),this.tokenizer.rules=I}P.lex=function(I,U){var j=new P(U);return j.lex(I)};var F=P.prototype;return F.lex=function(I){return I=I.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(I,this.tokens,!0),this.inline(this.tokens),this.tokens},F.blockTokens=function(I,U,j){U===void 0&&(U=[]),j===void 0&&(j=!0),I=I.replace(/^ +$/gm,"");for(var G,$,Y,q;I;){if(G=this.tokenizer.space(I)){I=I.substring(G.raw.length),G.type&&U.push(G);continue}if(G=this.tokenizer.code(I,U)){I=I.substring(G.raw.length),G.type?U.push(G):(q=U[U.length-1],q.raw+=`
`+G.raw,q.text+=`
`+G.text);continue}if(G=this.tokenizer.fences(I)){I=I.substring(G.raw.length),U.push(G);continue}if(G=this.tokenizer.heading(I)){I=I.substring(G.raw.length),U.push(G);continue}if(G=this.tokenizer.nptable(I)){I=I.substring(G.raw.length),U.push(G);continue}if(G=this.tokenizer.hr(I)){I=I.substring(G.raw.length),U.push(G);continue}if(G=this.tokenizer.blockquote(I)){I=I.substring(G.raw.length),G.tokens=this.blockTokens(G.text,[],j),U.push(G);continue}if(G=this.tokenizer.list(I)){for(I=I.substring(G.raw.length),Y=G.items.length,$=0;$<Y;$++)G.items[$].tokens=this.blockTokens(G.items[$].text,[],!1);U.push(G);continue}if(G=this.tokenizer.html(I)){I=I.substring(G.raw.length),U.push(G);continue}if(j&&(G=this.tokenizer.def(I))){I=I.substring(G.raw.length),this.tokens.links[G.tag]||(this.tokens.links[G.tag]={href:G.href,title:G.title});continue}if(G=this.tokenizer.table(I)){I=I.substring(G.raw.length),U.push(G);continue}if(G=this.tokenizer.lheading(I)){I=I.substring(G.raw.length),U.push(G);continue}if(j&&(G=this.tokenizer.paragraph(I))){I=I.substring(G.raw.length),U.push(G);continue}if(G=this.tokenizer.text(I,U)){I=I.substring(G.raw.length),G.type?U.push(G):(q=U[U.length-1],q.raw+=`
`+G.raw,q.text+=`
`+G.text);continue}if(I){var Se="Infinite loop on byte: "+I.charCodeAt(0);if(this.options.silent){console.error(Se);break}else throw new Error(Se)}}return U},F.inline=function(I){var U,j,G,$,Y,q,Se=I.length;for(U=0;U<Se;U++){q=I[U];switch(q.type){case"paragraph":case"text":case"heading":{q.tokens=[],this.inlineTokens(q.text,q.tokens);break}case"table":{for(q.tokens={header:[],cells:[]},$=q.header.length,j=0;j<$;j++)q.tokens.header[j]=[],this.inlineTokens(q.header[j],q.tokens.header[j]);for($=q.cells.length,j=0;j<$;j++)for(Y=q.cells[j],q.tokens.cells[j]=[],G=0;G<Y.length;G++)q.tokens.cells[j][G]=[],this.inlineTokens(Y[G],q.tokens.cells[j][G]);break}case"blockquote":{this.inline(q.tokens);break}case"list":{for($=q.items.length,j=0;j<$;j++)this.inline(q.items[j].tokens);break}}}return I},F.inlineTokens=function(I,U,j,G,$){U===void 0&&(U=[]),j===void 0&&(j=!1),G===void 0&&(G=!1),$===void 0&&($="");var Y,q=I,Se;if(this.tokens.links){var we=Object.keys(this.tokens.links);if(we.length>0)for(;(Se=this.tokenizer.rules.inline.reflinkSearch.exec(q))!=null;)we.includes(Se[0].slice(Se[0].lastIndexOf("[")+1,-1))&&(q=q.slice(0,Se.index)+"["+"a".repeat(Se[0].length-2)+"]"+q.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Se=this.tokenizer.rules.inline.blockSkip.exec(q))!=null;)q=q.slice(0,Se.index)+"["+"a".repeat(Se[0].length-2)+"]"+q.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;I;){if(Y=this.tokenizer.escape(I)){I=I.substring(Y.raw.length),U.push(Y);continue}if(Y=this.tokenizer.tag(I,j,G)){I=I.substring(Y.raw.length),j=Y.inLink,G=Y.inRawBlock,U.push(Y);continue}if(Y=this.tokenizer.link(I)){I=I.substring(Y.raw.length),Y.type==="link"&&(Y.tokens=this.inlineTokens(Y.text,[],!0,G)),U.push(Y);continue}if(Y=this.tokenizer.reflink(I,this.tokens.links)){I=I.substring(Y.raw.length),Y.type==="link"&&(Y.tokens=this.inlineTokens(Y.text,[],!0,G)),U.push(Y);continue}if(Y=this.tokenizer.strong(I,q,$)){I=I.substring(Y.raw.length),Y.tokens=this.inlineTokens(Y.text,[],j,G),U.push(Y);continue}if(Y=this.tokenizer.em(I,q,$)){I=I.substring(Y.raw.length),Y.tokens=this.inlineTokens(Y.text,[],j,G),U.push(Y);continue}if(Y=this.tokenizer.codespan(I)){I=I.substring(Y.raw.length),U.push(Y);continue}if(Y=this.tokenizer.br(I)){I=I.substring(Y.raw.length),U.push(Y);continue}if(Y=this.tokenizer.del(I)){I=I.substring(Y.raw.length),Y.tokens=this.inlineTokens(Y.text,[],j,G),U.push(Y);continue}if(Y=this.tokenizer.autolink(I,oe)){I=I.substring(Y.raw.length),U.push(Y);continue}if(!j&&(Y=this.tokenizer.url(I,oe))){I=I.substring(Y.raw.length),U.push(Y);continue}if(Y=this.tokenizer.inlineText(I,G,Ae)){I=I.substring(Y.raw.length),$=Y.raw.slice(-1),U.push(Y);continue}if(I){var xe="Infinite loop on byte: "+I.charCodeAt(0);if(this.options.silent){console.error(xe);break}else throw new Error(xe)}}return U},k(P,null,[{key:"rules",get:function(){return{block:Ee,inline:Ce}}}]),P}(),he=M.defaults,ge=H.cleanUrl,ye=H.escape,me=function(){function P(W){this.options=W||he}var F=P.prototype;return F.code=function(I,U,j){var G=(U||"").match(/\S*/)[0];if(this.options.highlight){var $=this.options.highlight(I,G);$!=null&&$!==I&&(j=!0,I=$)}return G?'<pre><code class="'+this.options.langPrefix+ye(G,!0)+'">'+(j?I:ye(I,!0))+`</code></pre>
`:"<pre><code>"+(j?I:ye(I,!0))+`</code></pre>
`},F.blockquote=function(I){return`<blockquote>
`+I+`</blockquote>
`},F.html=function(I){return I},F.heading=function(I,U,j,G){return this.options.headerIds?"<h"+U+' id="'+this.options.headerPrefix+G.slug(j)+'">'+I+"</h"+U+`>
`:"<h"+U+">"+I+"</h"+U+`>
`},F.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},F.list=function(I,U,j){var G=U?"ol":"ul",$=U&&j!==1?' start="'+j+'"':"";return"<"+G+$+`>
`+I+"</"+G+`>
`},F.listitem=function(I){return"<li>"+I+`</li>
`},F.checkbox=function(I){return"<input "+(I?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},F.paragraph=function(I){return"<p>"+I+`</p>
`},F.table=function(I,U){return U&&(U="<tbody>"+U+"</tbody>"),`<table>
<thead>
`+I+`</thead>
`+U+`</table>
`},F.tablerow=function(I){return`<tr>
`+I+`</tr>
`},F.tablecell=function(I,U){var j=U.header?"th":"td",G=U.align?"<"+j+' align="'+U.align+'">':"<"+j+">";return G+I+"</"+j+`>
`},F.strong=function(I){return"<strong>"+I+"</strong>"},F.em=function(I){return"<em>"+I+"</em>"},F.codespan=function(I){return"<code>"+I+"</code>"},F.br=function(){return this.options.xhtml?"<br/>":"<br>"},F.del=function(I){return"<del>"+I+"</del>"},F.link=function(I,U,j){if(I=ge(this.options.sanitize,this.options.baseUrl,I),I===null)return j;var G='<a href="'+ye(I)+'"';return U&&(G+=' title="'+U+'"'),G+=">"+j+"</a>",G},F.image=function(I,U,j){if(I=ge(this.options.sanitize,this.options.baseUrl,I),I===null)return j;var G='<img src="'+I+'" alt="'+j+'"';return U&&(G+=' title="'+U+'"'),G+=this.options.xhtml?"/>":">",G},F.text=function(I){return I},P}(),ue=function(){function P(){}var F=P.prototype;return F.strong=function(I){return I},F.em=function(I){return I},F.codespan=function(I){return I},F.del=function(I){return I},F.html=function(I){return I},F.text=function(I){return I},F.link=function(I,U,j){return""+j},F.image=function(I,U,j){return""+j},F.br=function(){return""},P}(),Oe=function(){function P(){this.seen={}}var F=P.prototype;return F.slug=function(I){var U=I.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(U)){var j=U;do this.seen[j]++,U=j+"-"+this.seen[j];while(this.seen.hasOwnProperty(U))}return this.seen[U]=0,U},P}(),Re=M.defaults,fe=H.unescape,_e=function(){function P(W){this.options=W||Re,this.options.renderer=this.options.renderer||new me,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ue,this.slugger=new Oe}P.parse=function(I,U){var j=new P(U);return j.parse(I)};var F=P.prototype;return F.parse=function(I,U){U===void 0&&(U=!0);var j="",G,$,Y,q,Se,we,xe,Ke,Fe,ke,ze,pe,Le,be,Ue,Je,Ge,et,rt=I.length;for(G=0;G<rt;G++){ke=I[G];switch(ke.type){case"space":continue;case"hr":{j+=this.renderer.hr();continue}case"heading":{j+=this.renderer.heading(this.parseInline(ke.tokens),ke.depth,fe(this.parseInline(ke.tokens,this.textRenderer)),this.slugger);continue}case"code":{j+=this.renderer.code(ke.text,ke.lang,ke.escaped);continue}case"table":{for(Ke="",xe="",q=ke.header.length,$=0;$<q;$++)xe+=this.renderer.tablecell(this.parseInline(ke.tokens.header[$]),{header:!0,align:ke.align[$]});for(Ke+=this.renderer.tablerow(xe),Fe="",q=ke.cells.length,$=0;$<q;$++){for(we=ke.tokens.cells[$],xe="",Se=we.length,Y=0;Y<Se;Y++)xe+=this.renderer.tablecell(this.parseInline(we[Y]),{header:!1,align:ke.align[Y]});Fe+=this.renderer.tablerow(xe)}j+=this.renderer.table(Ke,Fe);continue}case"blockquote":{Fe=this.parse(ke.tokens),j+=this.renderer.blockquote(Fe);continue}case"list":{for(ze=ke.ordered,pe=ke.start,Le=ke.loose,q=ke.items.length,Fe="",$=0;$<q;$++)Ue=ke.items[$],Je=Ue.checked,Ge=Ue.task,be="",Ue.task&&(et=this.renderer.checkbox(Je),Le?Ue.tokens.length>0&&Ue.tokens[0].type==="text"?(Ue.tokens[0].text=et+" "+Ue.tokens[0].text,Ue.tokens[0].tokens&&Ue.tokens[0].tokens.length>0&&Ue.tokens[0].tokens[0].type==="text"&&(Ue.tokens[0].tokens[0].text=et+" "+Ue.tokens[0].tokens[0].text)):Ue.tokens.unshift({type:"text",text:et}):be+=et),be+=this.parse(Ue.tokens,Le),Fe+=this.renderer.listitem(be,Ge,Je);j+=this.renderer.list(Fe,ze,pe);continue}case"html":{j+=this.renderer.html(ke.text);continue}case"paragraph":{j+=this.renderer.paragraph(this.parseInline(ke.tokens));continue}case"text":{for(Fe=ke.tokens?this.parseInline(ke.tokens):ke.text;G+1<rt&&I[G+1].type==="text";)ke=I[++G],Fe+=`
`+(ke.tokens?this.parseInline(ke.tokens):ke.text);j+=U?this.renderer.paragraph(Fe):Fe;continue}default:{var it='Token with "'+ke.type+'" type was not found.';if(this.options.silent){console.error(it);return}else throw new Error(it)}}}return j},F.parseInline=function(I,U){U=U||this.renderer;var j="",G,$,Y=I.length;for(G=0;G<Y;G++){$=I[G];switch($.type){case"escape":{j+=U.text($.text);break}case"html":{j+=U.html($.text);break}case"link":{j+=U.link($.href,$.title,this.parseInline($.tokens,U));break}case"image":{j+=U.image($.href,$.title,$.text);break}case"strong":{j+=U.strong(this.parseInline($.tokens,U));break}case"em":{j+=U.em(this.parseInline($.tokens,U));break}case"codespan":{j+=U.codespan($.text);break}case"br":{j+=U.br();break}case"del":{j+=U.del(this.parseInline($.tokens,U));break}case"text":{j+=U.text($.text);break}default:{var q='Token with "'+$.type+'" type was not found.';if(this.options.silent){console.error(q);return}else throw new Error(q)}}}return j},P}(),je=H.merge,Ie=H.checkSanitizeDeprecation,De=H.escape,ce=M.getDefaults,Me=M.changeDefaults,Be=M.defaults;function B(P,F,W){if(typeof P=="undefined"||P===null)throw new Error("marked(): input parameter is undefined or null");if(typeof P!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(P)+", string expected");if(typeof F=="function"&&(W=F,F=null),F=je({},B.defaults,F||{}),Ie(F),W){var I=F.highlight,U;try{U=se.lex(P,F)}catch(Y){return W(Y)}var j=function(q){var Se;if(!q)try{Se=_e.parse(U,F)}catch(we){q=we}return F.highlight=I,q?W(q):W(null,Se)};if(!I||I.length<3)return j();if(delete F.highlight,!U.length)return j();var G=0;B.walkTokens(U,function(Y){Y.type==="code"&&(G++,setTimeout(function(){I(Y.text,Y.lang,function(q,Se){if(q)return j(q);Se!=null&&Se!==Y.text&&(Y.text=Se,Y.escaped=!0),G--,G===0&&j()})},0))}),G===0&&j();return}try{var $=se.lex(P,F);return F.walkTokens&&B.walkTokens($,F.walkTokens),_e.parse($,F)}catch(Y){if(Y.message+=`
Please report this to https://github.com/markedjs/marked.`,F.silent)return"<p>An error occurred:</p><pre>"+De(Y.message+"",!0)+"</pre>";throw Y}}B.options=B.setOptions=function(P){return je(B.defaults,P),Me(B.defaults),B},B.getDefaults=ce,B.defaults=Be,B.use=function(P){var F=je({},P);if(P.renderer&&function(){var I=B.defaults.renderer||new me,U=function($){var Y=I[$];I[$]=function(){for(var q=arguments.length,Se=new Array(q),we=0;we<q;we++)Se[we]=arguments[we];var xe=P.renderer[$].apply(I,Se);return xe===!1&&(xe=Y.apply(I,Se)),xe}};for(var j in P.renderer)U(j);F.renderer=I}(),P.tokenizer&&function(){var I=B.defaults.tokenizer||new re,U=function($){var Y=I[$];I[$]=function(){for(var q=arguments.length,Se=new Array(q),we=0;we<q;we++)Se[we]=arguments[we];var xe=P.tokenizer[$].apply(I,Se);return xe===!1&&(xe=Y.apply(I,Se)),xe}};for(var j in P.tokenizer)U(j);F.tokenizer=I}(),P.walkTokens){var W=B.defaults.walkTokens;F.walkTokens=function(I){P.walkTokens(I),W&&W(I)}}B.setOptions(F)},B.walkTokens=function(P,F){for(var W=C(P),I;!(I=W()).done;){var U=I.value;F(U);switch(U.type){case"table":{for(var j=C(U.tokens.header),G;!(G=j()).done;){var $=G.value;B.walkTokens($,F)}for(var Y=C(U.tokens.cells),q;!(q=Y()).done;)for(var Se=q.value,we=C(Se),xe;!(xe=we()).done;){var Ke=xe.value;B.walkTokens(Ke,F)}break}case"list":{B.walkTokens(U.items,F);break}default:U.tokens&&B.walkTokens(U.tokens,F)}}},B.Parser=_e,B.parser=_e.parse,B.Renderer=me,B.TextRenderer=ue,B.Lexer=se,B.lexer=se.lex,B.Tokenizer=re,B.Slugger=Oe,B.parse=B;var D=B;return D})},H8y1:function(He,We,V){"use strict";V.r(We);var ae=V("GNNt"),k=V("wEI+"),b=V("tJVT"),O=V("PpiC"),C=V("q1tI"),E=V.n(C),M=V("+Gva"),w=V("ruvs"),A=V("2qtc"),_=V("kLXV"),g=V("5Dmo"),x=V("3S7+"),S=V("Ty5D"),v=V("9kvl"),y=V("iHkK"),p=V.n(y),s=V("CAjq"),e=V.n(s),a=V("1vsH"),n=function(se){var he,ge=se.globalSetting,ye=se.loading,me=se.shixunHomeworks,ue=se.user,Oe=se.dispatch,Re=Object(C.useState)(!1),fe=Object(b.a)(Re,2),_e=fe[0],je=fe[1],Ie=Object(C.useState)(!1),De=Object(b.a)(Ie,2),ce=De[0],Me=De[1],Be=Object(C.useState)(localStorage.hideCustom?JSON.parse(localStorage.hideCustom):[]),B=Object(b.a)(Be,1),D=B[0],P=Object(C.useState)(((he=localStorage)===null||he===void 0?void 0:he.hidesidebar)!="1"),F=Object(b.a)(P,2),W=F[0],I=F[1],U=Object(C.useState)(!1),j=Object(b.a)(U,2),G=j[0],$=j[1],Y=Object(C.useRef)(),q=Object(S.h)();Object(C.useEffect)(function(){return window.addEventListener("scroll",Se),function(){return window.removeEventListener("scroll",Se)}},[]),Object(C.useEffect)(function(){setTimeout(function(){localStorage.setItem("hidesidebar","1"),I(!1)},5e3)},[]),Object(C.useEffect)(function(){me.actionTabs.type===99&&($(!0),setTimeout(function(){$(!1)},5e3))},[me.actionTabs]),Object(C.useEffect)(function(){var xe;if(ue!=null&&(xe=ue.userInfo)!==null&&xe!==void 0&&xe.login){var Ke,Fe;!D.includes(ue==null||((Ke=ue.userInfo)===null||Ke===void 0)?void 0:Ke.login)&&!(ge!=null&&(Fe=ge.setting)!==null&&Fe!==void 0&&Fe.is_local)&&setTimeout(function(){var ke,ze=document.createEvent("Events");if(ze.initEvent("mouseout",!0,!1),Y){var pe;(pe=Y.current)===null||pe===void 0||pe.dispatchEvent(ze)}D.push(ue==null||((ke=ue.userInfo)===null||ke===void 0)?void 0:ke.login),localStorage.hideCustom=JSON.stringify(D)},5e3)}},[ue]);var Se=function(){var Ke,Fe;if(q.pathname==="/Activities"){je(!1);return}je(((Ke=document)===null||Ke===void 0||((Fe=Ke.documentElement)===null||Fe===void 0)?void 0:Fe.scrollTop)>0)},we=function(){var Ke=function(){return/macintosh|mac os x/i.test(navigator.userAgent)}();if(console.log(Ke),Ke){Me(!0);return}var Fe="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd";Object(a.S)(Fe)};return E.a.createElement("div",{className:p.a.sideBar},E.a.createElement("div",{id:"wechat_QR_code_ids"},!ge.onlyShowBackTop&&(ge==null?void 0:ge.onlyShowBackTopIcons)&&W&&E.a.createElement(E.a.Fragment,null,E.a.createElement(x.a,{placement:"left",getPopupContainer:function(){return document.getElementById("wechat_QR_code_ids")},title:E.a.createElement("div",{style:{display:"flex",justifyContent:"center",flexWrap:"wrap",width:130,padding:"5px 0"}},E.a.createElement("img",{src:V("kywy"),width:"100px",height:"100px"}),E.a.createElement("div",{className:"tc font12",style:{width:"auto"}},E.a.createElement("div",null,"\u5FAE\u4FE1\u626B\u4E00\u626B"),E.a.createElement("div",null,"\u54A8\u8BE2\u6848\u4F8B\u66F4\u65B0\u3001\u6DFB\u52A0")))},E.a.createElement("div",{className:p.a.wrap,style:{display:"flex",justifyContent:"center",paddingTop:10}},E.a.createElement("i",{className:"iconfont icon-erweima1 c-light-primary font22"}))),E.a.createElement("div",{onClick:function(){I(!1),localStorage.setItem("hidesidebar","1")},style:{textAlign:"center",fontSize:"14px",color:"#0152d9",margin:"10px 0px",cursor:"pointer"}},"\u6536\u8D77")),!ge.onlyShowBackTop&&(ge==null?void 0:ge.onlyShowBackTopIcons)&&!W&&E.a.createElement("div",{onClick:function(){I(!0),localStorage.setItem("hidesidebar","2")},style:{textAlign:"center",fontSize:"16px",color:"#0152d9",background:"#fff",margin:"10px 0px",cursor:"pointer",position:"absolute",left:"80px",top:"-150px",boxShadow:"0px 0px 8px 0px #f1f1f1",width:"30px",writingMode:"vertical-lr",height:"100px",paddingLeft:"3px"}},"\u8054\u7CFB\u6211\u4EEC")),E.a.createElement(_.a,{centered:!0,destroyOnClose:!0,open:ce,title:"\u5934\u6B4C\u6559\u5E08\u4EA4\u6D41\u793E\u533A",width:"500px",footer:null,onCancel:function(){return Me(!1)}},E.a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},E.a.createElement("p",null,"\u626B\u7801\u6216\u641C\u7D22\u52A0\u5165\u5934\u6B4C\u6559\u5E08\u4EA4\u6D41QQ\u7FA4\uFF1A612934990 "),E.a.createElement("img",{src:e.a,width:200,height:200}))))},c=Object(v.a)(function(oe){var se=oe.loading,he=oe.globalSetting,ge=oe.user,ye=oe.shixunHomeworks;return{globalSetting:he,user:ge,loading:se.models.index,shixunHomeworks:ye}})(n),l=V("+L6B"),u=V("2/Rp"),m=V("9og8"),d=V("WmNS"),o=V.n(d),i=function(se){var he=se.user,ge=se.dispatch,ye=se.classroomList;return E.a.createElement(_.a,{title:"\u6E29\u99A8\u63D0\u793A",zIndex:9999,footer:null,visible:ye.actionTabs.key==="\u5BFC\u51FA\u63D0\u9192",onCancel:function(){ge({type:"classroomList/setActionTabs",payload:{}})}},E.a.createElement("div",null,E.a.createElement("span",null,"\u60A8\u5728\u5F53\u524D\u680F\u76EE\u4E2D\u6709\u5DF2\u5BFC\u51FA\u7684\u8868\u683C\u672A\u4E0B\u8F7D\uFF0C\u8BF7\u5148\u4E0B\u8F7D\u5DF2\u6709\u8868\u683C\uFF0C\u7136\u540E\u518D\u5BFC\u51FA\u65B0\u7684\u8868\u683C\u3002"),E.a.createElement("br",null),E.a.createElement("div",{style:{textAlign:"end"}},E.a.createElement(u.a,{type:"primary",onClick:Object(m.a)(o.a.mark(function me(){return o.a.wrap(function(Oe){for(;;)switch(Oe.prev=Oe.next){case 0:ge({type:"classroomList/setActionTabs",payload:{}});case 1:case"end":return Oe.stop()}},me)}))},"\u77E5\u9053\u4E86"))))},t=Object(v.a)(function(oe){var se=oe.user,he=oe.classroomList;return{user:se,classroomList:he}})(i),r=V("14J3"),h=V("BMrR"),f=V("sRBo"),T=V("kaz8"),R=V("wd/R"),L=V.n(R),N=V("2tKv"),H=V.n(N),K=V("O9QN"),X=V.n(K),z=function(se){var he,ge,ye=se.user,me=Object(C.useState)(!1),ue=Object(b.a)(me,2),Oe=ue[0],Re=ue[1],fe=Object(C.useState)(""),_e=Object(b.a)(fe,2),je=_e[0],Ie=_e[1];Object(C.useEffect)(function(){var ce,Me,Be=localStorage.getItem("extension-modal");if(!(ye!=null&&(ce=ye.userInfo)!==null&&ce!==void 0&&ce.login)||!Be)return;var B=L()(),D="".concat(ye==null||((Me=ye.userInfo)===null||Me===void 0)?void 0:Me.login,"-extend-date"),P=localStorage.getItem(D);if(P)if(B<=L()(P))Re(!1);else{Re(!0),localStorage.removeItem(D),localStorage.removeItem("extension-modal");var F=L()(localStorage.getItem("extension-date")).format("YYYY\u5E74MM\u6708DD\u65E5");Ie(F)}else{Re(!0),localStorage.removeItem("extension-modal");var W=L()(localStorage.getItem("extension-date")).format("YYYY\u5E74MM\u6708DD\u65E5");Ie(W)}return function(){Re(!1)}},[ye==null||((he=ye.userInfo)===null||he===void 0)?void 0:he.login]);var De=function(Me){var Be,B="".concat(ye==null||((Be=ye.userInfo)===null||Be===void 0)?void 0:Be.login,"-extend-date"),D=L()().endOf("day").format("YYYY-MM-DD HH:mm:ss");Me.target.checked?localStorage.setItem(B,D):localStorage.removeItem(B)};return E.a.createElement(_.a,{title:"\u6E29\u99A8\u63D0\u793A",visible:Oe,zIndex:9999,centered:!0,width:594,onCancel:function(){Re(!1)},footer:E.a.createElement(h.a,{align:"middle",justify:"space-between"},E.a.createElement(T.a,{onChange:De},"\u4ECA\u65E5\u4E0D\u518D\u63D0\u9192"),E.a.createElement(u.a,{onClick:function(){Re(!1)},style:{borderRadius:4},type:"primary"}," ","\u5173\u95ED"))},E.a.createElement("div",{className:"font14",style:{paddingLeft:16}},E.a.createElement("div",null,"\u8001\u5E08\u60A8\u597D\uFF01"),E.a.createElement("div",{style:{textIndent:28}},"\u611F\u8C22\u60A8\u5BF9\u5E73\u53F0\u7684\u8BA4\u53EF\u4E0E\u652F\u6301\uFF01\u6839\u636E\u5E73\u53F0",E.a.createElement("a",{href:"https://www.educoder.net/help/agreement",target:"_blank"},"\u670D\u52A1\u534F\u8BAE"),"\uFF0C\u8D35\u5355\u4F4D\u514D\u8D39\u8BD5\u7528\u671F\u5DF2\u7ED3\u675F\uFF0C\u5C06\u9650\u5236\u5BF9\u76F8\u5173\u529F\u80FD\u548C\u8D44\u6E90\u7684\u4F7F\u7528\u3002"),E.a.createElement("div",{style:{textIndent:28}},"\u8BF7\u60A8\u6DFB\u52A0\u4EE5\u4E0B\u5FAE\u4FE1\u5BA2\u670D\uFF0C\u534F\u52A9\u60A8\u5B8C\u6210\u540E\u7EED\u4F7F\u7528\u53CA\u7533\u8BF7\u6D41\u7A0B\uFF0C\u611F\u8C22\u652F\u6301\u4E0E\u7406\u89E3\u3002"),E.a.createElement("img",{style:{margin:"8px auto",display:"block"},width:160,src:((ge=ye.userInfo)===null||ge===void 0?void 0:ge.school_province)==="\u5B89\u5FBD"?X.a:H.a,alt:"\u4E8C\u7EF4\u7801"}),E.a.createElement("div",{style:{textAlign:"right"}},"\u8FD0\u8425\u4E2D\u5FC3"),E.a.createElement("div",{style:{textAlign:"right"}},je)))},J=Object(v.a)(function(oe){var se=oe.user;return{user:se}})(z),te=V("fV52"),ee=V("3I+P"),ve=V("xnZT"),re=V.n(ve),de=V("9Bee"),ie=V("ErOA"),le=V("LvDl"),Q=V.n(le),Z=function(se){var he,ge,ye=se.dispatch,me=se.user,ue=se.globalSetting,Oe=Object(C.useState)({}),Re=Object(b.a)(Oe,2),fe=Re[0],_e=Re[1],je=Object(C.useState)([]),Ie=Object(b.a)(je,2),De=Ie[0],ce=Ie[1],Me=Object(C.useState)(0),Be=Object(b.a)(Me,2),B=Be[0],D=Be[1],P=Object(C.useState)(!1),F=Object(b.a)(P,2),W=F[0],I=F[1],U=Object(C.useRef)(null),j=Object(S.h)(),G=function(pe,Le){var be=null;return pe===0&&(be=L()().add(100,"month").unix()),pe===1&&(be=L()().add(Le,"hour").unix()),pe===2&&(be=L()().add(Le,"days").unix()),pe===3&&(be=L()().add(Le*7,"days").unix()),pe===4&&(be=L()().add(Le,"month").unix()),pe===5&&(be=L()().add(Le*3,"month").unix()),be},$=function(pe){var Le,be,Ue,Je="".concat(me==null||((Le=me.userInfo)===null||Le===void 0)?void 0:Le.login,"-deadline-operate"),Ge=localStorage.getItem(Je)?JSON.parse(localStorage.getItem(Je)):[];Ge=(be=Ge)===null||be===void 0?void 0:be.filter(function(it){return it.id!==(pe==null?void 0:pe.id)});var et=G(pe==null?void 0:pe.show_type,pe==null?void 0:pe.show_count),rt={id:pe==null?void 0:pe.id,deadline:et,type:pe==null?void 0:pe.show_type};(Ue=Ge)===null||Ue===void 0||Ue.push(rt),localStorage.setItem(Je,JSON.stringify(Ge))},Y=function(){xe(fe==null?void 0:fe.id,"close");var pe=De[B+1];pe?($(pe),_e(pe),D(B+1),xe(pe==null?void 0:pe.id,"popup")):I(!1)},q=[{name:"\u9996\u9875",key:0,path:"/"},{name:"\u5B9E\u8DF5\u8BFE\u7A0B",key:1,path:"/paths"},{name:"\u5B9E\u8DF5\u9879\u76EE",key:2,path:"/shixuns"},{name:"\u6559\u5B66\u8BFE\u5802",key:3,path:"/classrooms"},{name:"\u5728\u7EBF\u7ADE\u8D5B",key:4,path:"/competitions"},{name:"\u6559\u5B66\u6848\u4F8B",key:5,path:"/moop_cases"},{name:"\u4EA4\u6D41\u95EE\u7B54",key:6,path:"/forums/categories"},{name:"\u4E2A\u4EBA\u4E2D\u5FC3",key:7,path:"/users"}];Object(C.useEffect)(function(){var ze,pe,Le;console.log(ue==null?void 0:ue.operateModelPath,me==null||((ze=me.userInfo)===null||ze===void 0)?void 0:ze.login,11444),!!(ue!=null&&ue.operateModelPath)&&!!(ue!=null&&(pe=ue.setting)!==null&&pe!==void 0&&pe.main_site)&&me!==null&&me!==void 0&&(Le=me.userInfo)!==null&&Le!==void 0&&Le.login&&Ke()},[ue==null?void 0:ue.operateModelPath,me==null||((he=me.userInfo)===null||he===void 0)?void 0:he.login,ue==null||((ge=ue.setting)===null||ge===void 0)?void 0:ge.main_site]),Object(C.useEffect)(function(){return function(){ye({type:"globalSetting/setOperateModelPath",payload:""})}},[]),Object(C.useEffect)(function(){var ze,pe,Le,be;if(j!=null&&(ze=j.pathname)!==null&&ze!==void 0&&ze.includes("/users")&&(j==null||((pe=j.pathname)===null||pe===void 0||((Le=pe.split("/"))===null||Le===void 0))?void 0:Le.length)===4){ye({type:"globalSetting/setOperateModelPath",payload:"/users"});return}if(j!=null&&(be=j.pathname)!==null&&be!==void 0&&be.includes("/forums/categories")){ye({type:"globalSetting/setOperateModelPath",payload:"/forums/categories"});return}for(var Ue=0;Ue<q.length;Ue++){var Je;if((q==null||((Je=q[Ue])===null||Je===void 0)?void 0:Je.path)===(j==null?void 0:j.pathname)){var Ge;ye({type:"globalSetting/setOperateModelPath",payload:q==null||((Ge=q[Ue])===null||Ge===void 0)?void 0:Ge.path});return}}},[j==null?void 0:j.pathname]),Object(C.useEffect)(function(){return window.addEventListener("click",we),function(){window.removeEventListener("click",we)}},[fe]);var Se=function(pe){if(pe!=null&&pe.getAttribute("data-operate-type"))return pe;for(var Le=0,be=pe;be=be.parentNode;Le++){var Ue;if((Ue=be)!==null&&Ue!==void 0&&Ue.getAttribute("data-operate-type"))return be;if(be==document.documentElement)return!1}},we=function(){var ze=Object(m.a)(o.a.mark(function pe(Le){var be,Ue,Je,Ge,et;return o.a.wrap(function(it){for(;;)switch(it.prev=it.next){case 0:if(be=Se(Le.target),!be){it.next=11;break}if(Ue=be==null?void 0:be.getAttribute("data-operate-type"),!(Ue==="click")){it.next=11;break}return Le.preventDefault(),Je=be==null?void 0:be.getAttribute("href"),Ge=be==null?void 0:be.getAttribute("target"),it.next=9,xe(fe==null?void 0:fe.id,"enter");case 9:be!=null&&be.getAttribute("data-operate-data")&&(Je=Je+"?login="+(me==null||((et=me.userInfo)===null||et===void 0)?void 0:et.login)),Ge==="_blank"?Object(a.S)(Je):(I(!1),window.location.href=Je);case 11:case"end":return it.stop()}},pe)}));return function(Le){return ze.apply(this,arguments)}}(),xe=function(){var ze=Object(m.a)(o.a.mark(function pe(Le,be){var Ue;return o.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:return Ge.next=2,Object(ie.a)("/api/popup_windows/popup_windows_counts.json",{method:"get",params:{id:Le,count_type:be}});case 2:return Ue=Ge.sent,Ge.abrupt("return",Ue);case 4:case"end":return Ge.stop()}},pe)}));return function(Le,be){return ze.apply(this,arguments)}}(),Ke=function(){var ze=Object(m.a)(o.a.mark(function pe(){var Le,be,Ue,Je,Ge,et,rt,it,ot,at,lt,st,Qe,qe;return o.a.wrap(function(nt){for(;;)switch(nt.prev=nt.next){case 0:return nt.next=2,Object(ie.a)("/api/popup_windows/get_popup_windows.json",{method:"get"});case 2:be=nt.sent,(be==null?void 0:be.status)===0&&(be==null||((Le=be.data)===null||Le===void 0)?void 0:Le.length)!==0&&(et=q==null?void 0:q.findIndex(function(Ye){return Ye.path===(ue==null?void 0:ue.operateModelPath)}),rt=Q.a.cloneDeep(be==null?void 0:be.data),rt=(Ue=rt)===null||Ue===void 0?void 0:Ue.filter(function(Ye){var Pe;return(Pe=Ye.show_page)===null||Pe===void 0?void 0:Pe.includes(et)}),it="".concat(me==null||((Je=me.userInfo)===null||Je===void 0)?void 0:Je.login,"-deadline-operate"),ot=localStorage.getItem(it)?JSON.parse(localStorage.getItem(it)):[],console.log(ot,"record"),(ot==null?void 0:ot.length)!==0&&(rt=(at=rt)===null||at===void 0?void 0:at.filter(function(Ye){var Pe=!0,Ne=ot==null?void 0:ot.find(function(Ze){return Ze.id===Ye.id});if(Ne){var $e=L()().unix();$e<=(Ne==null?void 0:Ne.deadline)&&(Pe=!1),(Ne==null?void 0:Ne.type)===0&&(Ye.show_type===0?Pe=!1:Pe=!0)}return Pe})),(Ge=rt)!==null&&Ge!==void 0&&Ge.length&&(_e((lt=rt)===null||lt===void 0?void 0:lt[B]),$((st=rt)===null||st===void 0?void 0:st[B]),xe((Qe=rt)===null||Qe===void 0||((qe=Qe[B])===null||qe===void 0)?void 0:qe.id,"popup"),I(!0),ce(rt)));case 4:case"end":return nt.stop()}},pe)}));return function(){return ze.apply(this,arguments)}}(),Fe=function(){var pe;return E.a.createElement("div",{className:re.a.modalityModal},E.a.createElement("div",{className:re.a.modal,style:{width:fe==null?void 0:fe.width,height:fe==null?void 0:fe.height}},E.a.createElement("div",{className:re.a.close,onClick:Y},E.a.createElement("i",{className:"iconfont icon-guanbi1"})),E.a.createElement(ee.a,{ref:U,dots:!0,autoplay:!0,pauseOnDotsHover:!0},fe==null||((pe=fe.content)===null||pe===void 0)?void 0:pe.map(function(Le,be){return E.a.createElement("aside",{key:be,className:re.a.itemWarp},E.a.createElement(de.a,{style:{height:fe==null?void 0:fe.height},value:Le}))}))))},ke=function(){var pe;return E.a.createElement("div",{className:re.a.selfdomModal},E.a.createElement("div",{className:re.a.modal,style:{width:fe==null?void 0:fe.width,height:fe==null?void 0:fe.height}},E.a.createElement("div",{className:re.a.close,onClick:Y},E.a.createElement("i",{className:"iconfont icon-htmal5icon19"})),E.a.createElement(ee.a,{ref:U,dots:!0,autoplay:!0,pauseOnDotsHover:!0},fe==null||((pe=fe.content)===null||pe===void 0)?void 0:pe.map(function(Le,be){return E.a.createElement("aside",{key:be,className:re.a.itemWarp},E.a.createElement(de.a,{style:{height:fe==null?void 0:fe.height},value:Le}))}))))};return E.a.createElement(C.Fragment,null,W&&((fe==null?void 0:fe.windows_style)===0?Fe():ke()))},ne=Object(v.a)(function(oe){var se=oe.user,he=oe.globalSetting;return{user:se,globalSetting:he}})(Z),Te=V("H4Hi"),Ee=V.n(Te),Ce=function(se){var he,ge=se.loading,ye=se.children,me=se.globalSetting,ue=se.user,Oe=Object(O.a)(se,["loading","children","globalSetting","user"]),Re=Object(S.h)(),fe=Object(C.useState)(!1),_e=Object(b.a)(fe,2),je=_e[0],Ie=_e[1];return Object(C.useEffect)(function(){},[(he=ue.userInfo)===null||he===void 0?void 0:he.now_time,Re.pathname]),Object(C.useEffect)(function(){var De=L()().add(0,"days").unix(),ce=localStorage.getItem("mainclose");if(!ce){Ie(!0);return}De>parseInt(ce)&&Ie(!0)},[]),E.a.createElement(k.b,{locale:M.default},document.domain!=="kepukehuan.educoder.net"&&E.a.createElement(w.a,Oe),E.a.createElement("section",{className:Ee.a.layoutMainClass},ye),E.a.createElement(c,null),E.a.createElement(t,null),E.a.createElement(J,null),!Object(a.r)()&&E.a.createElement(ne,null))},Ae=We.default=Object(v.a)(function(oe){var se=oe.loading,he=oe.globalSetting,ge=oe.user;return{loading:se,user:ge,globalSetting:he}})(Ce)},Jky8:function(He,We,V){"use strict";var ae=V("sRBo"),k=V("kaz8"),b=V("5NDa"),O=V("5rEg"),C=V("miYZ"),E=V("tsqr"),M=V("9og8"),w=V("2qtc"),A=V("kLXV"),_=V("tJVT"),g=V("WmNS"),x=V.n(g),S=V("q1tI"),v=V.n(S),y=V("9kvl"),p=V("6CvP"),s=V("1XHU"),e=V("1vsH"),a;(function(c){c[c.Professor=1]="Professor",c[c.AssistantProfessor=2]="AssistantProfessor",c[c.Student=3]="Student"})(a||(a={}));var n=function(l){var u=l.visible,m=l.user,d=l.onCancel,o=d===void 0?function(){}:d,i=Object(S.useState)(),t=Object(_.a)(i,2),r=t[0],h=t[1],f=Object(S.useState)([]),T=Object(_.a)(f,2),R=T[0],L=T[1],N=Object(S.useState)(!1),H=Object(_.a)(N,2),K=H[0],X=H[1],z=Object(S.useState)(!1),J=Object(_.a)(z,2),te=J[0],ee=J[1],ve=Object(S.useState)(),re=Object(_.a)(ve,2),de=re[0],ie=re[1];Object(S.useEffect)(function(){var ne;if(m!=null&&(ne=m.userInfo)!==null&&ne!==void 0&&ne.identity){var Te;L([(m==null||((Te=m.userInfo)===null||Te===void 0)?void 0:Te.identity)==="student"?3:1])}},[m]);var le=function(Te,Ee){if(R.includes(a.Professor)){A.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:v.a.createElement("div",{className:"tc"},Ee||"\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u8BF7\u7B49\u5F85\u5BA1\u6838"),onOk:function(){y.d.push("/classrooms/".concat(Te,"/students"))}});return}y.d.push("/classrooms/".concat(Te,"/students"))},Q=function(){var ne=Object(M.a)(x.a.mark(function Te(){var Ee;return x.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:if(r){Ae.next=3;break}return E.b.info("\u9080\u8BF7\u7801\u4E0D\u80FD\u4E3A\u7A7A"),Ae.abrupt("return");case 3:return X(!0),Ae.next=6,Object(p.c)({invite_code:r,professor:R.includes(a.Professor)?1:null,assistant_professor:R.includes(a.AssistantProfessor)?1:null,student:R.includes(a.Student)?1:null});case 6:if(Ee=Ae.sent,X(!1),!((Ee==null?void 0:Ee.status)===-2)){Ae.next=22;break}if(Z(),!(Ee.message==="\u8BE5\u8BFE\u5802\u8981\u6C42\u6210\u5458\u5B8C\u6210\u5B9E\u540D\u8BA4\u8BC1")){Ae.next=14;break}return ee(!0),ie(1),Ae.abrupt("return");case 14:if(!(Ee.message==="\u8BE5\u8BFE\u5802\u8981\u6C42\u6210\u5458\u5B8C\u6210\u804C\u4E1A\u8BA4\u8BC1")){Ae.next=18;break}return ee(!0),ie(2),Ae.abrupt("return");case 18:if(!(Ee.message==="\u8BE5\u8BFE\u5802\u8981\u6C42\u6210\u5458\u5B8C\u6210\u5B9E\u540D\u548C\u804C\u4E1A\u8BA4\u8BC1")){Ae.next=22;break}return ee(!0),ie(3),Ae.abrupt("return");case 22:if(!((Ee==null?void 0:Ee.status)===0)){Ae.next=27;break}return Object(e.db)(["\u6559\u5B66\u8BFE\u5802","\u9996\u9875","\u52A0\u5165\u8BFE\u5802"]),Z(),(Ee==null?void 0:Ee.course_id)&&le(Ee.course_id,Ee.message),Ae.abrupt("return");case 27:case"end":return Ae.stop()}},Te)}));return function(){return ne.apply(this,arguments)}}(),Z=function(){var ne=Object(M.a)(x.a.mark(function Te(){return x.a.wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:o();case 1:case"end":return Ce.stop()}},Te)}));return function(){return ne.apply(this,arguments)}}();return v.a.createElement(v.a.Fragment,null,v.a.createElement(A.a,{centered:!0,keyboard:!1,closable:!1,title:"\u52A0\u5165\u8BFE\u5802",visible:u,confirmLoading:K,onOk:Q,onCancel:Z},v.a.createElement("div",{className:"tc"},v.a.createElement("div",null,v.a.createElement("span",null,"\u8BFE\u5802\u9080\u8BF7\u7801\uFF1A"),v.a.createElement(O.a,{placeholder:"\u8BF7\u8F93\u51655\u4F4D\u8BFE\u5802\u9080\u8BF7\u7801\u62166\u4F4D\u5206\u73ED\u9080\u8BF7\u7801",style:{width:270},value:r,onChange:function(Te){if(Te.target.value.length>=7){E.b.info("\u8BF7\u8F93\u51655\u4F4D\u8BFE\u5802\u9080\u8BF7\u7801\u62166\u4F4D\u5206\u73ED\u9080\u8BF7\u7801\uFF01");return}h(Te.target.value)}})),v.a.createElement("div",{className:"mt10 font14"},v.a.createElement("span",null,"\u8EAB\u4EFD\uFF1A"),v.a.createElement(k.a.Group,{value:R,onChange:function(Te){return L(Te)}},v.a.createElement(k.a,{value:a.Professor,disabled:R.includes(2)||R.includes(3)},"\u6559\u5E08"),v.a.createElement(k.a,{value:a.AssistantProfessor,disabled:R.includes(1)},"\u52A9\u6559"),v.a.createElement(k.a,{value:a.Student,disabled:R.includes(1)},"\u5B66\u751F/\u53C2\u8D5B\u8005"))))),v.a.createElement(s.a,{visible:te,onCancel:function(){return ee(!1)},occupationValue:de}))};We.a=Object(y.a)(function(c){var l=c.user;return{user:l}})(n)},NLgs:function(He,We,V){"use strict";V.d(We,"e",function(){return s}),V.d(We,"f",function(){return e}),V.d(We,"d",function(){return n}),V.d(We,"c",function(){return c}),V.d(We,"a",function(){return l}),V.d(We,"b",function(){return u});var ae=V("miYZ"),k=V("tsqr"),b=V("9og8"),O=V("2qtc"),C=V("kLXV"),E=V("WmNS"),M=V.n(E),w=V("q1tI"),A=V.n(w),_=V("9kvl"),g=V("xKgJ"),x=V("1vsH"),S=V("RCxd"),v=V("yTi+"),y=V.n(v),p=V("m3rI"),s=function(d){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!!(e(d)&&a(o))},e=function(d){return Object(g.p)()?!0:(d({type:"user/showPopLogin",payload:{showPopLogin:!0,showClosable:!0}}),!1)},a=function(){var d,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=Object(_.c)()._store.getState(),t=i.user;return(d=t.userInfo)!==null&&d!==void 0&&d.profile_completed?!0:(C.a.confirm({title:"\u63D0\u793A",width:530,centered:!0,content:o?"\u6309\u7167\u6709\u5173\u653F\u7B56\u89C4\u5B9A\uFF0C\u7279\u6B8A\u5B9E\u9A8C\u9700\u8981\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u624D\u80FD\u4F7F\u7528\uFF0C\u8BF7\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u7801":"\u60A8\u9700\u8981\u53BB\u5B8C\u5584\u60A8\u7684\u4E2A\u4EBA\u8D44\u6599\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD",okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){_.d.push("/account/profile/edit")}}),!1)},n=function(){var d,o=Object(_.c)()._store.getState(),i=o.user;return(d=i.userInfo)!==null&&d!==void 0&&d.professional_certification?!0:(C.a.confirm({title:"\u63D0\u793A",centered:!0,content:A.a.createElement("div",{className:"tc"},"\u60A8\u9700\u8981\u53BB\u5B8C\u6210\u60A8\u7684\u804C\u4E1A\u8BA4\u8BC1\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD"),okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){Object(x.S)("/account/certification")}}),!1)},c=function(){var d;if(Object(g.a)())return!0;var o=Object(_.c)()._store.getState(),i=o.user,t=o.globalSetting;return C.a.warning({centered:!0,width:530,title:"\u63D0\u793A",content:A.a.createElement("div",{className:"tc",style:{marginLeft:-38}},A.a.createElement("p",null,"\u626B\u7801\u6DFB\u52A0\uFF0C\u7533\u8BF7\u64CD\u4F5C\u6743\u9650"),A.a.createElement("img",{src:p.a.IMG_SERVER+(t==null||((d=t.setting)===null||d===void 0)?void 0:d.authority_qrcode_url),width:200})),okText:"\u6211\u77E5\u9053\u4E86",maskClosable:!0}),!1},l=function(d,o){var i;if(d)return!0;var t=Object(_.c)()._store.getState(),r=t.user,h=t.globalSetting;return C.a.confirm({centered:!0,zIndex:1e4,width:530,title:"\u63D0\u793A",content:A.a.createElement("div",null,A.a.createElement("p",null,o||"\u8BE5\u5B9E\u8DF5\u8D44\u6E90\u9700\u6388\u6743\u540E\u624D\u53EF\u4F7F\u7528\u3002 \u60A8\u53EF\u4EE5\u5728QQ\u670D\u52A1\u7FA4\u5411\u7BA1\u7406\u5458\u7533\u8BF7\uFF0C\u83B7\u5F97\u7EE7\u7EED\u64CD\u4F5C\u7684\u6743\u9650\u3002"),A.a.createElement("div",{style:{marginLeft:"110px"}},A.a.createElement("img",{src:p.a.IMG_SERVER+(h==null||((i=h.setting)===null||i===void 0)?void 0:i.authority_qrcode_url),width:200}),A.a.createElement("div",{style:{marginLeft:"35px"}},"\u7FA4\u53F7\uFF1A","714336072"))),okText:"\u7ACB\u5373\u8054\u7CFB",cancelText:"\u53D6\u6D88",onOk:function(){Object(x.S)("https://qm.qq.com/cgi-bin/qm/qr?k=tIyDPXUtE0yEk-MOJxhH55lTUJS-nYAM&jump_from=webapi")}}),!1},u=function(d){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",i=Object(_.c)()._store.getState(),t=i.shixunsDetail.detail;return(t==null?void 0:t.public)===2||(t==null?void 0:t.public)===1||(t==null?void 0:t.shixun_status)===3?(C.a.info({centered:!0,icon:A.a.createElement(S.a,{style:{color:"#faad14"}}),width:460,title:"\u63D0\u793A",content:A.a.createElement("div",{className:"tc",style:{marginLeft:-38}},A.a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",paddingLeft:38,margin:"12px 0"}},A.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u7684\u72B6\u6001\u4E3A",(t==null?void 0:t.public)===2?"\u5DF2\u516C\u5F00":(t==null?void 0:t.public)===1?"\u5F85\u5BA1\u6838":"\u5DF2\u5173\u95ED","\uFF0C",o,"\u3002"),A.a.createElement("p",null,"\u5982\u6709\u9700\u8981\uFF0C\u8BF7\u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u8FDB\u884C\u6280\u672F\u652F\u6301\u3002")),A.a.createElement("img",{style:{border:"4px solid #0152d9",borderRadius:"4px"},src:y.a,alt:"\u4E8C\u7EF4\u7801",width:160})),okText:"\u6211\u77E5\u9053\u4E86"}),!0):(t==null?void 0:t.shixun_status)===2?(C.a.confirm({centered:!0,icon:A.a.createElement(S.a,null),title:"\u63D0\u793A",content:A.a.createElement("div",null,A.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5DF2\u53D1\u5E03\uFF0C",o,"\u3002"),A.a.createElement("br",null),A.a.createElement("span",null,"\u5982\u6709\u9700\u8981\uFF0C\u60A8\u53EF\u4EE5\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u518D\u8FDB\u884C\u64CD\u4F5C\u3002")),okText:"\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){C.a.confirm({width:440,centered:!0,icon:A.a.createElement(S.a,{style:{color:"#faad14"}}),title:"\u63D0\u793A",content:"\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u5B66\u5458\u5C06\u65E0\u6CD5\u8FDB\u884C\u7EC3\u4E60\u3002\u662F\u5426\u786E\u8BA4\u64A4\u9500\u53D1\u5E03\uFF1F",okText:"\u786E\u5B9A\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){var h=Object(b.a)(M.a.mark(function T(){var R;return M.a.wrap(function(N){for(;;)switch(N.prev=N.next){case 0:return N.next=2,d({type:"shixunsDetail/cancelRelease",payload:{id:t==null?void 0:t.identifier}});case 2:R=N.sent,R.status!==401&&(k.b.success("\u64A4\u9500\u53D1\u5E03\u6210\u529F\u3002\u5B9E\u8BAD\u56DE\u5230\u672A\u53D1\u5E03\u7684\u72B6\u6001\u3002"),d({type:"shixunsDetail/getShixunsDetail",payload:{id:t==null?void 0:t.identifier}}),d({type:"practiceSetting/getCommonData",payload:{id:t==null?void 0:t.identifier}}));case 4:case"end":return N.stop()}},T)}));function f(){return h.apply(this,arguments)}return f}()})}}),!0):!1}},O9QN:function(He,We,V){He.exports=V.p+"static/AnhuiContact.80900438.jpg"},SJMd:function(He,We){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var V,ae,k,b=!1,O,C;window.PR_SHOULD_USE_CONTINUATION=!0;var E,M;(function(){var w=window,A=["break,continue,do,else,for,if,return,while"],_=[A,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],g=[_,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],x=[g,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],S=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],v=[g,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],y="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",p=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",e=[A,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],a=[A,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],n=[A,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],c=[x,v,S,p,s,e,a,n],l=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,u="str",m="kwd",d="com",o="typ",i="lit",t="pun",r="pln",h="tag",f="dec",T="src",R="atn",L="atv",N="nocode",H="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function K(oe){for(var se=0,he=!1,ge=!1,ye=0,me=oe.length;ye<me;++ye){var ue=oe[ye];if(ue.ignoreCase)ge=!0;else if(/[a-z]/i.test(ue.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){he=!0,ge=!1;break}}var Oe={b:8,t:9,n:10,v:11,f:12,r:13};function Re(De){var ce=De.charCodeAt(0);if(ce!==92)return ce;var Me=De.charAt(1);return ce=Oe[Me],ce||("0"<=Me&&Me<="7"?parseInt(De.substring(1),8):Me==="u"||Me==="x"?parseInt(De.substring(2),16):De.charCodeAt(1))}function fe(De){if(De<32)return(De<16?"\\x0":"\\x")+De.toString(16);var ce=String.fromCharCode(De);return ce==="\\"||ce==="-"||ce==="]"||ce==="^"?"\\"+ce:ce}function _e(De){var ce=De.substring(1,De.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Me=[],Be=ce[0]==="^",B=["["];Be&&B.push("^");for(var D=Be?1:0,P=ce.length;D<P;++D){var F=ce[D];if(/\\[bdsw]/i.test(F))B.push(F);else{var W=Re(F),I;D+2<P&&ce[D+1]==="-"?(I=Re(ce[D+2]),D+=2):I=W,Me.push([W,I]),I<65||W>122||(I<65||W>90||Me.push([Math.max(65,W)|32,Math.min(I,90)|32]),I<97||W>122||Me.push([Math.max(97,W)&~32,Math.min(I,122)&~32]))}}Me.sort(function($,Y){return $[0]-Y[0]||Y[1]-$[1]});for(var U=[],j=[],D=0;D<Me.length;++D){var G=Me[D];G[0]<=j[1]+1?j[1]=Math.max(j[1],G[1]):U.push(j=G)}for(var D=0;D<U.length;++D){var G=U[D];B.push(fe(G[0])),G[1]>G[0]&&(G[1]+1>G[0]&&B.push("-"),B.push(fe(G[1])))}return B.push("]"),B.join("")}function je(De){for(var ce=De.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Me=ce.length,Be=[],B=0,D=0;B<Me;++B){var P=ce[B];if(P==="(")++D;else if(P.charAt(0)==="\\"){var F=+P.substring(1);F&&(F<=D?Be[F]=-1:ce[B]=fe(F))}}for(var B=1;B<Be.length;++B)Be[B]===-1&&(Be[B]=++se);for(var B=0,D=0;B<Me;++B){var P=ce[B];if(P==="(")++D,Be[D]||(ce[B]="(?:");else if(P.charAt(0)==="\\"){var F=+P.substring(1);F&&F<=D&&(ce[B]="\\"+Be[F])}}for(var B=0;B<Me;++B)ce[B]==="^"&&ce[B+1]!=="^"&&(ce[B]="");if(De.ignoreCase&&he)for(var B=0;B<Me;++B){var P=ce[B],W=P.charAt(0);P.length>=2&&W==="["?ce[B]=_e(P):W!=="\\"&&(ce[B]=P.replace(/[a-zA-Z]/g,function(j){var G=j.charCodeAt(0);return"["+String.fromCharCode(G&~32,G|32)+"]"}))}return ce.join("")}for(var Ie=[],ye=0,me=oe.length;ye<me;++ye){var ue=oe[ye];if(ue.global||ue.multiline)throw new Error(""+ue);Ie.push("(?:"+je(ue)+")")}return new RegExp(Ie.join("|"),ge?"gi":"g")}function X(oe,se){var he=/(?:^|\s)nocode(?:\s|$)/,ge=[],ye=0,me=[],ue=0;function Oe(Re){var fe=Re.nodeType;if(fe==1){if(he.test(Re.className))return;for(var _e=Re.firstChild;_e;_e=_e.nextSibling)Oe(_e);var je=Re.nodeName.toLowerCase();(je==="br"||je==="li")&&(ge[ue]=`
`,me[ue<<1]=ye++,me[ue++<<1|1]=Re)}else if(fe==3||fe==4){var Ie=Re.nodeValue;Ie.length&&(se?Ie=Ie.replace(/\r\n?/g,`
`):Ie=Ie.replace(/[ \t\r\n]+/g," "),ge[ue]=Ie,me[ue<<1]=ye,ye+=Ie.length,me[ue++<<1|1]=Re)}}return Oe(oe),{sourceCode:ge.join("").replace(/\n$/,""),spans:me}}function z(oe,se,he,ge,ye){if(!he)return;var me={sourceNode:oe,pre:1,langExtension:null,numberLines:null,sourceCode:he,spans:null,basePos:se,decorations:null};ge(me),ye.push.apply(ye,me.decorations)}var J=/\S/;function te(oe){for(var se=void 0,he=oe.firstChild;he;he=he.nextSibling){var ge=he.nodeType;se=ge===1?se?oe:he:ge===3&&J.test(he.nodeValue)?oe:se}return se===oe?void 0:se}function ee(oe,se){var he={},ge;(function(){for(var ue=oe.concat(se),Oe=[],Re={},fe=0,_e=ue.length;fe<_e;++fe){var je=ue[fe],Ie=je[3];if(Ie)for(var De=Ie.length;--De>=0;)he[Ie.charAt(De)]=je;var ce=je[1],Me=""+ce;Re.hasOwnProperty(Me)||(Oe.push(ce),Re[Me]=null)}Oe.push(/[\0-\uffff]/),ge=K(Oe)})();var ye=se.length,me=function(ue){for(var Oe=ue.sourceCode,Re=ue.basePos,fe=ue.sourceNode,_e=[Re,r],je=0,Ie=Oe.match(ge)||[],De={},ce=0,Me=Ie.length;ce<Me;++ce){var Be=Ie[ce],B=De[Be],D=void 0,P;if(typeof B=="string")P=!1;else{var F=he[Be.charAt(0)];if(F)D=Be.match(F[1]),B=F[0];else{for(var W=0;W<ye;++W)if(F=se[W],D=Be.match(F[1]),D){B=F[0];break}D||(B=r)}P=B.length>=5&&B.substring(0,5)==="lang-",P&&!(D&&typeof D[1]=="string")&&(P=!1,B=T),P||(De[Be]=B)}var I=je;if(je+=Be.length,!P)_e.push(Re+I,B);else{var U=D[1],j=Be.indexOf(U),G=j+U.length;D[2]&&(G=Be.length-D[2].length,j=G-U.length);var $=B.substring(5);z(fe,Re+I,Be.substring(0,j),me,_e),z(fe,Re+I+j,U,Z($,U),_e),z(fe,Re+I+G,Be.substring(G),me,_e)}}ue.decorations=_e};return me}function ve(oe){var se=[],he=[];oe.tripleQuotedStrings?se.push([u,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):oe.multiLineStrings?se.push([u,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):se.push([u,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),oe.verbatimStrings&&he.push([u,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ge=oe.hashComments;ge&&(oe.cStyleComments?(ge>1?se.push([d,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):se.push([d,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),he.push([u,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):se.push([d,/^#[^\r\n]*/,null,"#"])),oe.cStyleComments&&(he.push([d,/^\/\/[^\r\n]*/,null]),he.push([d,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ye=oe.regexLiterals;if(ye){var me=ye>1?"":`
\r`,ue=me?".":"[\\S\\s]",Oe="/(?=[^/*"+me+"])(?:[^/\\x5B\\x5C"+me+"]|\\x5C"+ue+"|\\x5B(?:[^\\x5C\\x5D"+me+"]|\\x5C"+ue+")*(?:\\x5D|$))+/";he.push(["lang-regex",RegExp("^"+H+"("+Oe+")")])}var Re=oe.types;Re&&he.push([o,Re]);var fe=(""+oe.keywords).replace(/^ | $/g,"");fe.length&&he.push([m,new RegExp("^(?:"+fe.replace(/[\s,]+/g,"|")+")\\b"),null]),se.push([r,/^\s+/,null,` \r
\xA0`]);var _e="^.[^\\s\\w.$@'\"`/\\\\]*";return oe.regexLiterals&&(_e+="(?!s*/)"),he.push([i,/^@[a-z_$][a-z_$@0-9]*/i,null],[o,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[r,/^[a-z_$][a-z_$@0-9]*/i,null],[i,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[r,/^\\[\s\S]?/,null],[t,new RegExp(_e),null]),ee(se,he)}var re=ve({keywords:c,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function de(oe,se,he){for(var ge=/(?:^|\s)nocode(?:\s|$)/,ye=/\r\n?|\n/,me=oe.ownerDocument,ue=me.createElement("li");oe.firstChild;)ue.appendChild(oe.firstChild);var Oe=[ue];function Re(ce){var Me=ce.nodeType;if(Me==1&&!ge.test(ce.className))if(ce.nodeName==="br")fe(ce),ce.parentNode&&ce.parentNode.removeChild(ce);else for(var Be=ce.firstChild;Be;Be=Be.nextSibling)Re(Be);else if((Me==3||Me==4)&&he){var B=ce.nodeValue,D=B.match(ye);if(D){var P=B.substring(0,D.index);ce.nodeValue=P;var F=B.substring(D.index+D[0].length);if(F){var W=ce.parentNode;W.insertBefore(me.createTextNode(F),ce.nextSibling)}fe(ce),P||ce.parentNode.removeChild(ce)}}}function fe(ce){for(;!ce.nextSibling;)if(ce=ce.parentNode,!ce)return;function Me(D,P){var F=P?D.cloneNode(!1):D,W=D.parentNode;if(W){var I=Me(W,1),U=D.nextSibling;I.appendChild(F);for(var j=U;j;j=U)U=j.nextSibling,I.appendChild(j)}return F}for(var Be=Me(ce.nextSibling,0),B;(B=Be.parentNode)&&B.nodeType===1;)Be=B;Oe.push(Be)}for(var _e=0;_e<Oe.length;++_e)Re(Oe[_e]);se===(se|0)&&Oe[0].setAttribute("value",se);var je=me.createElement("ol");je.className="linenums";for(var Ie=Math.max(0,se-1|0)||0,_e=0,De=Oe.length;_e<De;++_e)ue=Oe[_e],ue.className="L"+(_e+Ie)%10,ue.firstChild||ue.appendChild(me.createTextNode("\xA0")),je.appendChild(ue);oe.appendChild(je)}function ie(oe){var se=/\bMSIE\s(\d+)/.exec(navigator.userAgent);se=se&&+se[1]<=8;var he=/\n/g,ge=oe.sourceCode,ye=ge.length,me=0,ue=oe.spans,Oe=ue.length,Re=0,fe=oe.decorations,_e=fe.length,je=0;fe[_e]=ye;var Ie,De;for(De=Ie=0;De<_e;)fe[De]!==fe[De+2]?(fe[Ie++]=fe[De++],fe[Ie++]=fe[De++]):De+=2;for(_e=Ie,De=Ie=0;De<_e;){for(var ce=fe[De],Me=fe[De+1],Be=De+2;Be+2<=_e&&fe[Be+1]===Me;)Be+=2;fe[Ie++]=ce,fe[Ie++]=Me,De=Be}_e=fe.length=Ie;var B=oe.sourceNode,D="";B&&(D=B.style.display,B.style.display="none");try{for(var P=null;Re<Oe;){var F=ue[Re],W=ue[Re+2]||ye,I=fe[je+2]||ye,Be=Math.min(W,I),U=ue[Re+1],j;if(U.nodeType!==1&&(j=ge.substring(me,Be))){se&&(j=j.replace(he,"\r")),U.nodeValue=j;var G=U.ownerDocument,$=G.createElement("span");$.className=fe[je+1];var Y=U.parentNode;Y.replaceChild($,U),$.appendChild(U),me<W&&(ue[Re+1]=U=G.createTextNode(ge.substring(Be,W)),Y.insertBefore(U,$.nextSibling))}me=Be,me>=W&&(Re+=2),me>=I&&(je+=2)}}finally{B&&(B.style.display=D)}}var le={};function Q(oe,se){for(var he=se.length;--he>=0;){var ge=se[he];le.hasOwnProperty(ge)?w.console&&console.warn("cannot override language handler %s",ge):le[ge]=oe}}function Z(oe,se){return oe&&le.hasOwnProperty(oe)||(oe=/^\s*</.test(se)?"default-markup":"default-code"),le[oe]}Q(re,["default-code"]),Q(ee([],[[r,/^[^<?]+/],[f,/^<!\w[^>]*(?:>|$)/],[d,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[t,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),Q(ee([[r,/^[\s]+/,null,` \r
`],[L,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[h,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[t,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),Q(ee([],[[L,/^[\s\S]+/]]),["uq.val"]),Q(ve({keywords:x,hashComments:!0,cStyleComments:!0,types:l}),["c","cc","cpp","cxx","cyc","m"]),Q(ve({keywords:"null,true,false"}),["json"]),Q(ve({keywords:v,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:l}),["cs"]),Q(ve({keywords:S,cStyleComments:!0}),["java"]),Q(ve({keywords:n,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Q(ve({keywords:e,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Q(ve({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Q(ve({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Q(ve({keywords:p,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Q(ve({keywords:y,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Q(ee([],[[u,/^[\s\S]+/]]),["regex"]);function ne(oe){var se=oe.langExtension;try{var he=X(oe.sourceNode,oe.pre),ge=he.sourceCode;oe.sourceCode=ge,oe.spans=he.spans,oe.basePos=0,Z(se,ge)(oe),ie(oe)}catch(ye){w.console&&console.log(ye&&ye.stack||ye)}}function Te(oe,se,he){var ge=he||!1,ye=se||null,me=document.createElement("div");me.innerHTML="<pre>"+oe+"</pre>",me=me.firstChild,ge&&de(me,ge,!0);var ue={langExtension:ye,numberLines:ge,sourceNode:me,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ne(ue),me.innerHTML}function Ee(oe,se){var he=se||document.body,ge=he.ownerDocument||document;function ye(F){return he.getElementsByTagName(F)}for(var me=[ye("pre"),ye("code"),ye("xmp")],ue=[],Oe=0;Oe<me.length;++Oe)for(var Re=0,fe=me[Oe].length;Re<fe;++Re)ue.push(me[Oe][Re]);me=null;var _e=Date;_e.now||(_e={now:function(){return+new Date}});var je=0,Ie=/\blang(?:uage)?-([\w.]+)(?!\S)/,De=/\bprettyprint\b/,ce=/\bprettyprinted\b/,Me=/pre|xmp/i,Be=/^code$/i,B=/^(?:pre|code|xmp)$/i,D={};function P(){for(var F=w.PR_SHOULD_USE_CONTINUATION?_e.now()+250:Infinity;je<ue.length&&_e.now()<F;je++){for(var W=ue[je],I=D,U=W;U=U.previousSibling;){var j=U.nodeType,G=(j===7||j===8)&&U.nodeValue;if(G?!/^\??prettify\b/.test(G):j!==3||/\S/.test(U.nodeValue))break;if(G){I={},G.replace(/\b(\w+)=([\w:.%+-]+)/g,function(be,Ue,Je){I[Ue]=Je});break}}var $=W.className;if((I!==D||De.test($))&&!ce.test($)){for(var Y=!1,q=W.parentNode;q;q=q.parentNode){var Se=q.tagName;if(B.test(Se)&&q.className&&De.test(q.className)){Y=!0;break}}if(!Y){W.className+=" prettyprinted";var we=I.lang;if(!we){we=$.match(Ie);var xe;!we&&(xe=te(W))&&Be.test(xe.tagName)&&(we=xe.className.match(Ie)),we&&(we=we[1])}var Ke;if(Me.test(W.tagName))Ke=1;else{var Fe=W.currentStyle,ke=ge.defaultView,ze=Fe?Fe.whiteSpace:ke&&ke.getComputedStyle?ke.getComputedStyle(W,null).getPropertyValue("white-space"):0;Ke=ze&&ze.substring(0,3)==="pre"}var pe=I.linenums;(pe=pe==="true"||+pe)||(pe=$.match(/\blinenums\b(?::(\d+))?/),pe=pe?pe[1]&&pe[1].length?+pe[1]:!0:!1),pe&&de(W,pe,Ke);var Le={langExtension:we,sourceNode:W,numberLines:pe,pre:Ke,sourceCode:null,basePos:null,spans:null,decorations:null};ne(Le)}}}je<ue.length?w.setTimeout(P,250):typeof oe=="function"&&oe()}P()}var Ce=w.PR={createSimpleLexer:ee,registerLangHandler:Q,sourceDecorator:ve,PR_ATTRIB_NAME:R,PR_ATTRIB_VALUE:L,PR_COMMENT:d,PR_DECLARATION:f,PR_KEYWORD:m,PR_LITERAL:i,PR_NOCODE:N,PR_PLAIN:r,PR_PUNCTUATION:t,PR_SOURCE:T,PR_STRING:u,PR_TAG:h,PR_TYPE:o,prettyPrintOne:b?w.prettyPrintOne=Te:E=Te,prettyPrint:M=b?w.prettyPrint=Ee:M=Ee},Ae=w.define;typeof Ae=="function"&&Ae.amd&&Ae("google-code-prettify",[],function(){return Ce})})()},Y1PL:function(He,We,V){"use strict";V.r(We),V.d(We,"ResizableTextArea",function(){return te});var ae=V("wx14"),k=V("1OyB"),b=V("vuIU"),O=V("Ji7U"),C=V("LK+K"),E=V("q1tI"),M=V("VTBJ"),w=V("rePB"),A=V("Zm9Q"),_=V("Kwbf"),g=V("c+Xe"),x=V("m+aA"),S=V("bdgK"),v=new Map;function y(re){re.forEach(function(de){var ie,le=de.target;(ie=v.get(le))===null||ie===void 0||ie.forEach(function(Q){return Q(le)})})}var p=new S.default(y),s=null,e=null;function a(re,de){v.has(re)||(v.set(re,new Set),p.observe(re)),v.get(re).add(de)}function n(re,de){v.has(re)&&(v.get(re).delete(de),v.get(re).size||(p.unobserve(re),v.delete(re)))}var c=function(re){Object(O.a)(ie,re);var de=Object(C.a)(ie);function ie(){return Object(k.a)(this,ie),de.apply(this,arguments)}return Object(b.a)(ie,[{key:"render",value:function(){return this.props.children}}]),ie}(E.Component),l=E.createContext(null);function u(re){var de=re.children,ie=re.onBatchResize,le=E.useRef(0),Q=E.useRef([]),Z=E.useContext(l),ne=E.useCallback(function(Te,Ee,Ce){le.current+=1;var Ae=le.current;Q.current.push({size:Te,element:Ee,data:Ce}),Promise.resolve().then(function(){Ae===le.current&&(ie==null||ie(Q.current),Q.current=[])}),Z==null||Z(Te,Ee,Ce)},[ie,Z]);return E.createElement(l.Provider,{value:ne},de)}function m(re){var de=re.children,ie=re.disabled,le=E.useRef(null),Q=E.useRef(null),Z=E.useContext(l),ne=E.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Te=E.isValidElement(de)&&Object(g.c)(de),Ee=Te?de.ref:null,Ce=E.useMemo(function(){return Object(g.a)(Ee,le)},[Ee,le]),Ae=E.useRef(re);Ae.current=re;var oe=E.useCallback(function(se){var he=Ae.current,ge=he.onResize,ye=he.data,me=se.getBoundingClientRect(),ue=me.width,Oe=me.height,Re=se.offsetWidth,fe=se.offsetHeight,_e=Math.floor(ue),je=Math.floor(Oe);if(ne.current.width!==_e||ne.current.height!==je||ne.current.offsetWidth!==Re||ne.current.offsetHeight!==fe){var Ie={width:_e,height:je,offsetWidth:Re,offsetHeight:fe};ne.current=Ie;var De=Re===Math.round(ue)?ue:Re,ce=fe===Math.round(Oe)?Oe:fe,Me=Object(M.a)(Object(M.a)({},Ie),{},{offsetWidth:De,offsetHeight:ce});Z==null||Z(Me,se,ye),ge&&Promise.resolve().then(function(){ge(Me,se)})}},[]);return E.useEffect(function(){var se=Object(x.a)(le.current)||Object(x.a)(Q.current);return se&&!ie&&a(se,oe),function(){return n(se,oe)}},[le.current,ie]),E.createElement(c,{ref:Q},Te?E.cloneElement(de,{ref:Ce}):de)}var d="rc-observer-key";function o(re){var de=re.children,ie=Object(A.a)(de);return ie.map(function(le,Q){var Z=(le==null?void 0:le.key)||"".concat(d,"-").concat(Q);return E.createElement(m,Object(ae.a)({},re,{key:Z}),le)})}o.Collection=u;var i=o,t=V("bT9E"),r=V("TSYQ"),h=V.n(r),f=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,T=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],R={},L;function N(re){var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ie=re.getAttribute("id")||re.getAttribute("data-reactid")||re.getAttribute("name");if(de&&R[ie])return R[ie];var le=window.getComputedStyle(re),Q=le.getPropertyValue("box-sizing")||le.getPropertyValue("-moz-box-sizing")||le.getPropertyValue("-webkit-box-sizing"),Z=parseFloat(le.getPropertyValue("padding-bottom"))+parseFloat(le.getPropertyValue("padding-top")),ne=parseFloat(le.getPropertyValue("border-bottom-width"))+parseFloat(le.getPropertyValue("border-top-width")),Te=T.map(function(Ce){return"".concat(Ce,":").concat(le.getPropertyValue(Ce))}).join(";"),Ee={sizingStyle:Te,paddingSize:Z,borderSize:ne,boxSizing:Q};return de&&ie&&(R[ie]=Ee),Ee}function H(re){var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ie=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,le=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;L||(L=document.createElement("textarea"),L.setAttribute("tab-index","-1"),L.setAttribute("aria-hidden","true"),document.body.appendChild(L)),re.getAttribute("wrap")?L.setAttribute("wrap",re.getAttribute("wrap")):L.removeAttribute("wrap");var Q=N(re,de),Z=Q.paddingSize,ne=Q.borderSize,Te=Q.boxSizing,Ee=Q.sizingStyle;L.setAttribute("style","".concat(Ee,";").concat(f)),L.value=re.value||re.placeholder||"";var Ce=Number.MIN_SAFE_INTEGER,Ae=Number.MAX_SAFE_INTEGER,oe=L.scrollHeight,se;if(Te==="border-box"?oe+=ne:Te==="content-box"&&(oe-=Z),ie!==null||le!==null){L.value=" ";var he=L.scrollHeight-Z;ie!==null&&(Ce=he*ie,Te==="border-box"&&(Ce=Ce+Z+ne),oe=Math.max(Ce,oe)),le!==null&&(Ae=he*le,Te==="border-box"&&(Ae=Ae+Z+ne),se=oe>Ae?"":"hidden",oe=Math.min(Ae,oe))}return{height:oe,minHeight:Ce,maxHeight:Ae,overflowY:se,resize:"none"}}var K=V("Gytx"),X=V.n(K),z;(function(re){re[re.NONE=0]="NONE",re[re.RESIZING=1]="RESIZING",re[re.RESIZED=2]="RESIZED"})(z||(z={}));var J=function(re){Object(O.a)(ie,re);var de=Object(C.a)(ie);function ie(le){var Q;return Object(k.a)(this,ie),Q=de.call(this,le),Q.nextFrameActionId=void 0,Q.resizeFrameId=void 0,Q.textArea=void 0,Q.saveTextArea=function(Z){Q.textArea=Z},Q.handleResize=function(Z){var ne=Q.state.resizeStatus,Te=Q.props,Ee=Te.autoSize,Ce=Te.onResize;if(ne!==z.NONE)return;typeof Ce=="function"&&Ce(Z),Ee&&Q.resizeOnNextFrame()},Q.resizeOnNextFrame=function(){cancelAnimationFrame(Q.nextFrameActionId),Q.nextFrameActionId=requestAnimationFrame(Q.resizeTextarea)},Q.resizeTextarea=function(){var Z=Q.props.autoSize;if(!Z||!Q.textArea)return;var ne=Z.minRows,Te=Z.maxRows,Ee=H(Q.textArea,!1,ne,Te);Q.setState({textareaStyles:Ee,resizeStatus:z.RESIZING},function(){cancelAnimationFrame(Q.resizeFrameId),Q.resizeFrameId=requestAnimationFrame(function(){Q.setState({resizeStatus:z.RESIZED},function(){Q.resizeFrameId=requestAnimationFrame(function(){Q.setState({resizeStatus:z.NONE}),Q.fixFirefoxAutoScroll()})})})})},Q.renderTextArea=function(){var Z=Q.props,ne=Z.prefixCls,Te=ne===void 0?"rc-textarea":ne,Ee=Z.autoSize,Ce=Z.onResize,Ae=Z.className,oe=Z.disabled,se=Q.state,he=se.textareaStyles,ge=se.resizeStatus,ye=Object(t.a)(Q.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),me=h()(Te,Ae,Object(w.a)({},"".concat(Te,"-disabled"),oe));"value"in ye&&(ye.value=ye.value||"");var ue=Object(M.a)(Object(M.a)(Object(M.a)({},Q.props.style),he),ge===z.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return E.createElement(i,{onResize:Q.handleResize,disabled:!(Ee||Ce)},E.createElement("textarea",Object(ae.a)({},ye,{className:me,style:ue,ref:Q.saveTextArea})))},Q.state={textareaStyles:{},resizeStatus:z.NONE},Q}return Object(b.a)(ie,[{key:"componentDidUpdate",value:function(Q){(Q.value!==this.props.value||!X()(Q.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var Q=this.textArea.selectionStart,Z=this.textArea.selectionEnd;this.textArea.setSelectionRange(Q,Z)}}catch(ne){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ie}(E.Component),te=J,ee=function(re){Object(O.a)(ie,re);var de=Object(C.a)(ie);function ie(le){var Q;Object(k.a)(this,ie),Q=de.call(this,le),Q.resizableTextArea=void 0,Q.focus=function(){Q.resizableTextArea.textArea.focus()},Q.saveTextArea=function(ne){Q.resizableTextArea=ne},Q.handleChange=function(ne){var Te=Q.props.onChange;Q.setValue(ne.target.value,function(){Q.resizableTextArea.resizeTextarea()}),Te&&Te(ne)},Q.handleKeyDown=function(ne){var Te=Q.props,Ee=Te.onPressEnter,Ce=Te.onKeyDown;ne.keyCode===13&&Ee&&Ee(ne),Ce&&Ce(ne)};var Z=typeof le.value=="undefined"||le.value===null?le.defaultValue:le.value;return Q.state={value:Z},Q}return Object(b.a)(ie,[{key:"setValue",value:function(Q,Z){"value"in this.props||this.setState({value:Q},Z)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return E.createElement(te,Object(ae.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(Q){return"value"in Q?{value:Q.value}:null}}]),ie}(E.Component),ve=We.default=ee},bT9E:function(He,We,V){"use strict";V.d(We,"a",function(){return k});var ae=V("VTBJ");function k(b,O){var C=Object(ae.a)({},b);return Array.isArray(O)&&O.forEach(function(E){delete C[E]}),C}},bUJZ:function(He,We){He.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAABq1JREFUWAmVWGuIVVUU/vaZ2zjjOC9TwzFtwAjKHlJBNj4IYgJp/hghIWEE/ahAlCypqB8JoSiRJljQw6KoEGz6oQmNvxqdoB9hailZoZbj2xlndHzMvWf3rX3OOnefc888XLDv2nvttdda+1tr73PONbhJsnZdM64NPsll7YCZBYQtQMAmFPayz2ZPcNCFmvpdxrzR56bG+WPGqQc79PoShOEKGLMQ1hbcOstfsSA8j4wpcrIbQbDFTFzfmaeSlY0ZkB14bT5suIFBtGUXMzj6YzTChbQvXMifN+ghemtMw8Z90WT+74gBWbu9Cv0979HJyvyllI6JkKcjRkQ/MJvR1LbamKUlEWUpNyDbt6oJpeJ2GmCdeDQaAp7ayN14B4b1VVVYapo39Wd1KwJywVy/Tnjt3VnlcsHosixEIleZrNa+cCF/3hzGhOq2bFBq2am7NJ3q2l1GZgSDQTMw9U2gqsmty/0pXQTOrmVMQ950xp4xXZjevthPX3RadMl/u1kzmTTpnM/Dy9xsDZ2FwBXWqG7L+aPJukepHQBF6oE6I5Ex7RCfwCpVUVOwx5/jabJ7dSKX+xucvBxoeBw4vRG4djBSl1M1kcFMfRHo5ym/9H3aTLYGNYVBsMDc8YU7fdxGTMXiBhR5bZTYhOe1kAdD5MIv/RgtrH+MY6IgTebqGaQl799DW7G+8LwmdpxOaYOG4RCyfz3DS89+p8Jx8xlvEZF7GcyN8pKgGhjkmTj9QVk2nl5gnjJ3ftsZ1VBxeIU7EAqhFkUWYv+iEydnPgcmd7BTJaOIBJ0LOyKkVZZw2b/mXbrsJzaxgpJOY48va8bg0FkO0gVOQQUli+PS8w1WKN+0oIj6idMKGBjsYNBRMBq8cKHMhlI7ijSAFhZwze06Aq6fBE5+FI/HMJi2z1iGOgoYLrVrhnIdll1VBjihFZjCB39xgCm6yszVAZMeAM7/AFz9hyvTHsvpinecjTcotRd4Yma6QMRxxXqu0DS5eSpommRc/6D8Akff5n10GGheBMxmodc9xMI+yomsx4yDzJAHa6YE1JIEpM6EC2UXRNLyb8PDRGeQzhmMXID9vzAGHuVGBtT7VY6BMQJkARR4d7REOyn7GVcvqGV6eOQv/sR0xce+xNQN/k7k7qEJ3uSlK2lTFRvOIA7DgMJhCytQCGV3EElzfxtZKwHPwsWf6ZioOOJ6GTfcz6Dm8vgz2MRmrJJiGX/G2IDGTrnbWW5od3PGXG9R5dmbtukR+qLBCxIQ17jGwM67JwAg8ypL5lVPOfUTHdc/VWBAvTR8VypwHWhBCxfyIW+eB1z+k6fpDCfieWEDR3j0z/HC5LxsQmQChKMKRMo2Zd6glwgVTyTPIjEgz6QEDdmJ7oJ9N0deMwuonR6hoTIfBUFpwjTqtMYIxIiornBp7rkY8+jZeSLgK8SeCDZxGDsXLs0tiLn0xalw2b3Que5IpvpuQ9QXuZCipPPF4dguud/XeRt2FXAj3IkgLDIdlY+ODMIJ/LfOB4b5rnPhV0LOADVlWsBn99Ix5VOo9/enLrb8H80nuXyh1Jldgek42Me0dJfTxB1qyiRy3bXfb+JxL/JIy9F3utxxSZrok+MWzjPgxjmxTG0ySKcjvKJ1m4UH+6L3oVK4JUehcpELioYOrWcdsUbmfRY9LrQmxEmBr7XztgHV5KKXciyBSSAaoM8ZA0kwc2R3tO4j4m1JWkTqIRopebLZy4G57/De2Q90PxshVt0ILPqGyPD74MBaPlIYmNoY3V6PefoY8+tefIUJhWtShSxoZIval4mz395l4fICbCNS1VOABV/GwRCZIx9HaOhhSJDxEYr7hr5jShCSsf16xiaYcGVyb+juEq2sgFU/5xXgvlfp/BrTV8M0vc+2Ue2nOdVTiLnZYLNZdnKVKkY1pKNC22reD10OKb+Ik5x7hSvFK7s/wNfhQ5uiYP7YCuxfV64Rh06MtI+22JbGYw7x6VGyd5XZztYmDPKl2OZ9KKpWDq+9Lb61/bkcRBUiww/F+vo2s+RYf3aFP3Z9u62pieHzU9q2pzAe7VHiVo4SgD8vH4gwS83z/algRCWdMreIqqJY98Ripm9z6phWpCC+9v1jL3096tr350GbtJ0XjLivSFkcU8LsJ7Xz+e6V/3dMRZFmBD6ixvRw+2vMC1f5oBuZxgxIl9oPq5ewCOVzaSFl0WPGd+gUMwEh/sPK8A+rl250qq3R+LgDUiN2a2Mzwsv8GJP6sjMp5xuna6LSGzXzL8HvQjBpp3n5Up9MjJf+B5WVB7lfjXHfAAAAAElFTkSuQmCC"},iHkK:function(He,We,V){He.exports={sideBar:"sideBar___DNWGT",wrap:"wrap___2rWVP",backTop:"backTop___3cAkP",ul:"ul___Bsaot",tooltipclass:"tooltipclass___1I8Rx"}},kywy:function(He,We,V){He.exports=V.p+"static/101_erweima.d7cd470e.jpg"},pIsd:function(He,We,V){var ae=V("BJfS"),k=function(C){var E=/[height|width]$/;return E.test(C)},b=function(C){var E="",M=Object.keys(C);return M.forEach(function(w,A){var _=C[w];w=ae(w),k(w)&&typeof _=="number"&&(_=_+"px"),_===!0?E+=w:_===!1?E+="not "+w:E+="("+w+": "+_+")",A<M.length-1&&(E+=" and ")}),E},O=function(C){var E="";return typeof C=="string"?C:C instanceof Array?(C.forEach(function(M,w){E+=b(M),w<C.length-1&&(E+=", ")}),E):b(C)};He.exports=O},rUJ1:function(He,We){const V=/[&<>"']/,ae=/[&<>"']/g,k=/[<>"']|&(?!#?\w+;)/,b=/[<>"']|&(?!#?\w+;)/g,O={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},C=d=>O[d];function E(d,o){if(o){if(V.test(d))return d.replace(ae,C)}else if(k.test(d))return d.replace(b,C);return d}const M=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function w(d){return d.replace(M,(o,i)=>(i=i.toLowerCase(),i==="colon"?":":i.charAt(0)==="#"?i.charAt(1)==="x"?String.fromCharCode(parseInt(i.substring(2),16)):String.fromCharCode(+i.substring(1)):""))}const A=/(^|[^\[])\^/g;function _(d,o){d=d.source||d,o=o||"";const i={replace:(t,r)=>(r=r.source||r,r=r.replace(A,"$1"),d=d.replace(t,r),i),getRegex:()=>new RegExp(d,o)};return i}const g=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function S(d,o,i){if(d){let t;try{t=decodeURIComponent(w(i)).replace(g,"").toLowerCase()}catch(r){return null}if(t.indexOf("javascript:")===0||t.indexOf("vbscript:")===0||t.indexOf("data:")===0)return null}o&&!x.test(i)&&(i=e(o,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(t){return null}return i}const v={},y=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function e(d,o){v[" "+d]||(y.test(d)?v[" "+d]=d+"/":v[" "+d]=l(d,"/",!0)),d=v[" "+d];const i=d.indexOf(":")===-1;return o.substring(0,2)==="//"?i?o:d.replace(p,"$1")+o:o.charAt(0)==="/"?i?o:d.replace(s,"$1")+o:d+o}const a={exec:function(){}};function n(d){let o=1,i,t;for(;o<arguments.length;o++){i=arguments[o];for(t in i)Object.prototype.hasOwnProperty.call(i,t)&&(d[t]=i[t])}return d}function c(d,o){const i=d.replace(/\|/g,(h,f,T)=>{let R=!1,L=f;for(;--L>=0&&T[L]==="\\";)R=!R;return R?"|":" |"}),t=i.split(/ \|/);let r=0;if(t.length>o)t.splice(o);else for(;t.length<o;)t.push("");for(;r<t.length;r++)t[r]=t[r].trim().replace(/\\\|/g,"|");return t}function l(d,o,i){const t=d.length;if(t===0)return"";let r=0;for(;r<t;){const h=d.charAt(t-r-1);if(h===o&&!i)r++;else if(h!==o&&i)r++;else break}return d.substr(0,t-r)}function u(d,o){if(d.indexOf(o[1])===-1)return-1;const i=d.length;let t=0,r=0;for(;r<i;r++)if(d[r]==="\\")r++;else if(d[r]===o[0])t++;else if(d[r]===o[1]&&(t--,t<0))return r;return-1}function m(d){d&&d.sanitize&&!d.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}He.exports={escape:E,unescape:w,edit:_,cleanUrl:S,resolveUrl:e,noopTest:a,merge:n,splitCells:c,rtrim:l,findClosingBracket:u,checkSanitizeDeprecation:m}},ruvs:function(He,We,V){"use strict";V.d(We,"b",function(){return De});var ae=V("2qtc"),k=V("kLXV"),b=V("14J3"),O=V("BMrR"),C=V("9og8"),E=V("rAM+"),M=V("tJVT"),w=V("PpiC"),A=V("k1fw"),_=V("5NDa"),g=V("5rEg"),x=V("B9cy"),S=V("Ol7k"),v=V("WmNS"),y=V.n(v),p=V("q1tI"),s=V.n(p),e=V("Ty5D"),a=V("55Ip"),n=V("9kvl"),c=V("xrsn"),l=V.n(c),u=V("1Sn+"),m=V("qVdP"),d=V("jsC+"),o=V("jCWc"),i=V("kPKH"),t=V("lUTK"),r=V("BvKs"),h=V("miYZ"),f=V("tsqr"),T=V("7Kak"),R=V("9yH6"),L=V("6CvP"),N=V("1vsH"),H;(function(B){B.Manager="manager",B.Developer="developer",B.Reporter="reporter"})(H||(H={}));var K=function(D){var P=D.visible,F=D.onCancel,W=F===void 0?function(){}:F,I=Object(p.useState)(),U=Object(M.a)(I,2),j=U[0],G=U[1],$=Object(p.useState)(),Y=Object(M.a)($,2),q=Y[0],Se=Y[1],we=Object(p.useState)(!1),xe=Object(M.a)(we,2),Ke=xe[0],Fe=xe[1],ke=function(){var pe=Object(C.a)(y.a.mark(function Le(){var be,Ue;return y.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:if(j){Ge.next=3;break}return f.b.info("\u8BF7\u8F93\u5165\u5F00\u53D1\u9879\u76EE\u9080\u8BF7\u7801\uFF01"),Ge.abrupt("return");case 3:if(!(j.length!==6)){Ge.next=6;break}return f.b.info("\u8BF7\u8F93\u51656\u4F4D\u9879\u76EE\u9080\u8BF7\u7801\uFF01"),Ge.abrupt("return");case 6:if(q){Ge.next=9;break}return f.b.info("\u8BF7\u9009\u62E9\u4E00\u4E2A\u8EAB\u4EFD\uFF01"),Ge.abrupt("return");case 9:return Fe(!0),Ge.next=12,Object(L.s)({code:j,role:q});case 12:if(be=Ge.sent,Fe(!1),ze(),Ue={1:"\u60A8\u8F93\u5165\u7684\u9080\u8BF7\u7801\u9519\u8BEF",2:"\u60A8\u5DF2\u7ECF\u662F\u8BE5\u9879\u76EE\u6210\u5458",3:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u89D2\u8272",4:"\u60A8\u7684\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u8BF7\u7B49\u5F85\u9879\u76EE\u7BA1\u7406\u5458\u5BA1\u6279",5:"\u60A8\u5DF2\u7ECF\u7533\u8BF7\u52A0\u5165\u8BE5\u9879\u76EE\u4E86\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85",6:"\u60A8\u5DF2\u6210\u529F\u52A0\u5165\u9879\u76EE"},!Ue[be.status]){Ge.next=19;break}return f.b.info(Ue[be.status]),Ge.abrupt("return");case 19:if(!(be.status===0)){Ge.next=22;break}return q==="reporter"?(f.b.success("\u60A8\u52A0\u5165\u9879\u76EE\u6210\u529F\uFF01"),Object(N.db)(["\u5F00\u53D1\u9879\u76EE","\u52A0\u5165\u9879\u76EE\u6210\u529F"]),n.d.push("/projects/".concat(be==null?void 0:be.project_id))):(Object(N.db)(["\u5F00\u53D1\u9879\u76EE","\u52A0\u5165\u9879\u76EE\u7B49\u5F85\u5BA1\u6279"]),f.b.success("\u60A8\u7684\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u8BF7\u7B49\u5F85\u9879\u76EE\u7BA1\u7406\u5458\u5BA1\u6279\uFF01")),Ge.abrupt("return");case 22:case"end":return Ge.stop()}},Le)}));return function(){return pe.apply(this,arguments)}}(),ze=function(){var pe=Object(C.a)(y.a.mark(function Le(){return y.a.wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:W();case 1:case"end":return Ue.stop()}},Le)}));return function(){return pe.apply(this,arguments)}}();return s.a.createElement(s.a.Fragment,null,s.a.createElement(k.a,{centered:!0,keyboard:!1,closable:!1,title:"\u52A0\u5165\u9879\u76EE",visible:P,confirmLoading:Ke,onOk:ke,onCancel:ze},s.a.createElement("div",{className:"tc"},s.a.createElement("div",null,s.a.createElement("span",null,"\u9879\u76EE\u9080\u8BF7\u7801\uFF1A"),s.a.createElement(g.a,{placeholder:"\u8BF7\u8F93\u51656\u4F4D\u5F00\u53D1\u9879\u76EE\u9080\u8BF7\u7801",style:{width:270},value:j,onChange:function(Le){if(Le.target.value.length>=7){f.b.info("\u8BF7\u8F93\u51656\u4F4D\u5F00\u53D1\u9879\u76EE\u9080\u8BF7\u7801\uFF01");return}G(Le.target.value)}})),s.a.createElement("div",{className:"mt10 font14"},s.a.createElement("span",null,"\u8EAB\u4EFD\uFF1A"),s.a.createElement(R.a.Group,{value:q,onChange:function(Le){return Se(Le.target.value)}},s.a.createElement(R.a,{value:H.Manager},"\u7BA1\u7406\u4EBA\u5458"),s.a.createElement(R.a,{value:H.Developer},"\u5F00\u53D1\u4EBA\u5458"),s.a.createElement(R.a,{value:H.Reporter},"\u62A5\u544A\u4EBA\u5458"))))))},X=K,z=V("Jky8"),J=V("6Fuo"),te=V.n(J),ee=V("NLgs"),ve=V("xKgJ"),re;(function(B){B.Projects="projects",B.Shixuns="shixuns",B.Classrooms="classrooms"})(re||(re={}));var de;(function(B){B.Classrooms="classrooms",B.Shixuns="shixuns",B.Paths="paths",B.Projects="projects",B.Videos="videos",B.Topics="topics"})(de||(de={}));var ie=function(D){var P,F,W,I,U,j,G,$=D.homePage,Y=D.user,q=D.globalSetting,Se=D.loading,we=D.dispatch,xe=D.location,Ke=Object(w.a)(D,["homePage","user","globalSetting","loading","dispatch","location"]),Fe=Object(p.useState)(),ke=Object(M.a)(Fe,2),ze=ke[0],pe=ke[1],Le=Object(p.useState)(),be=Object(M.a)(Le,2),Ue=be[0],Je=be[1],Ge=function(Qe){var qe;if(!Object(ee.e)(we))return;if(Qe===re.Projects&&!((qe=Y.userInfo)!==null&&qe!==void 0&&qe.email)){f.b.info("\u8BF7\u5148\u7ED1\u5B9A\u90AE\u7BB1\uFF0C\u8C22\u8C22");return}Qe===re.Classrooms?pe(!0):Qe===re.Projects&&Je(!0)},et=function(Qe,qe){var Xe;if(!Object(ee.e)(we))return;if(qe===re.Projects&&!((Xe=Y.userInfo)!==null&&Xe!==void 0&&Xe.email)){f.b.info("\u8BF7\u5148\u7ED1\u5B9A\u90AE\u7BB1\uFF0C\u8C22\u8C22");return}if(qe===re.Shixuns&&!Object(ee.c)())return;Qe&&(window.location.href=Qe)},rt=(P=(((F=q.setting)===null||F===void 0?void 0:F.navbar)||[]).find(function(st){return st.link==="/".concat(de.Classrooms)}))===null||P===void 0?void 0:P.hidden,it=(W=(((I=q.setting)===null||I===void 0?void 0:I.navbar)||[]).find(function(st){return st.link==="/".concat(de.Shixuns)}))===null||W===void 0?void 0:W.hidden,ot=(U=(((j=q.setting)===null||j===void 0?void 0:j.navbar)||[]).find(function(st){return st.link==="/".concat(de.Paths)}))===null||U===void 0?void 0:U.hidden;if(q!=null&&(G=q.setting)!==null&&G!==void 0&&G.is_local){var at;Y!=null&&(at=Y.userInfo)!==null&&at!==void 0&&at.is_shixun_marker||(it=!0)}var lt=function(Qe){var qe,Xe,nt,Ye,Pe;return s.a.createElement(s.a.Fragment,null,s.a.createElement(O.a,{justify:"space-around",className:"pt5 pb5"},s.a.createElement(i.a,{className:te.a.joinCol},!(q!=null&&q.setting.hide_course)&&((qe=Y.userInfo)===null||qe===void 0?void 0:qe.user_identity)!=="\u5B66\u751F"&&!rt&&s.a.createElement(r.a.Item,Qe,s.a.createElement("a",{onClick:function(){return et("/classrooms/new")}},(Xe=Y.userInfo)!==null&&Xe!==void 0&&Xe.main_site?"\u65B0\u5EFA\u6559\u5B66\u8BFE\u5802":"\u65B0\u5EFA\u8BFE\u5802")),!(q!=null&&(nt=q.setting)!==null&&nt!==void 0&&nt.hide_subject&&Object(ve.m)())&&!(q!=null&&q.setting.hide_course)&&s.a.createElement(r.a.Item,Qe,s.a.createElement("a",{onClick:function(){return et("/paths/new")}},"\u65B0\u5EFA\u5B9E\u9A8C\u9879\u76EE")),!(q!=null&&q.setting.hide_shixun&&Object(ve.m)())&&!(q!=null&&q.setting.hide_course)&&s.a.createElement(r.a.Item,Qe,s.a.createElement("a",{onClick:function(){return et("/shixuns/new",re.Shixuns)}},"\u65B0\u5EFA\u5B9E\u8DF5\u5E73\u53F0")),!(q!=null&&(Ye=q.setting)!==null&&Ye!==void 0&&Ye.is_local)&&((Pe=Y.userInfo)===null||Pe===void 0?void 0:Pe.main_site)&&s.a.createElement(r.a.Item,Qe,s.a.createElement("a",{onClick:function(){var $e,Ze;return et("".concat(($e=Y.navigationInfo)===null||$e===void 0||((Ze=$e.top)===null||Ze===void 0)?void 0:Ze.old_url,"/projects/deposit/new"),re.Projects)}},"\u65B0\u5EFA\u5F00\u53D1\u9879\u76EE"))),s.a.createElement(i.a,null,s.a.createElement("div",{className:te.a.joinBoard})),s.a.createElement(i.a,{className:te.a.joinCol},s.a.createElement(r.a.Item,Qe,s.a.createElement("a",{onClick:function(){return Ge(re.Projects)}},"banner\u56FE\u7BA1\u7406")),s.a.createElement(r.a.Item,Qe,s.a.createElement("a",null,"\u9879\u76EE\u7C7B\u578B\u7BA1\u7406")),s.a.createElement(r.a.Item,Qe,s.a.createElement("a",null,"\u5DE5\u4F5C\u5355\u4F4D\u7BA1\u7406")),s.a.createElement(r.a.Item,Qe,s.a.createElement("a",null,"\u7814\u53D1\u673A\u6784\u7BA1\u7406")),s.a.createElement(r.a.Item,Qe,s.a.createElement("a",null,"\u5B9E\u9A8C\u5E73\u53F0\u7BA1\u7406")))))};return s.a.createElement("section",null,s.a.createElement(d.a,{overlay:s.a.createElement(r.a,{className:"".concat(te.a.rightMenu," ").concat(te.a.joinMenu," mt10")},s.a.createElement(lt,null)),placement:"bottomRight"},s.a.createElement("span",{style:{lineHeight:"inherit",color:"#666"},className:"iconfont icon-tianjiafangda c-white font18 current ml15 mr15"})),s.a.createElement(z.a,{visible:ze,onCancel:function(){return pe(!1)}}),s.a.createElement(X,{visible:Ue,onCancel:function(){return Je(!1)}}))},le=Object(n.a)(function(B){var D=B.homePage,P=B.loading,F=B.user,W=B.globalSetting;return{homePage:D,user:F,globalSetting:W,loading:P.models.index}})(ie),Q=V("vToQ"),Z=V.n(Q),ne=V("jb+D"),Te=V("m3rI"),Ee=function(D){var P,F=RegExp("(^| )"+D+"=([^;]+)(;|$)");return(P=document.cookie.match(F))?decodeURIComponent(P[2]):null},Ce=function(D){var P=new Date;P.setTime(P.getTime()-1);var F=Ee(D);F!=null&&(document.cookie=D+"="+F+";expires="+P.toGMTString())},Ae;(function(B){B.Classrooms="classrooms",B.Shixuns="shixuns",B.Paths="paths",B.Projects="projects",B.Videos="videos",B.Topics="topics"})(Ae||(Ae={}));var oe=function(D){var P,F,W,I,U,j,G,$,Y,q,Se,we=D.homePage,xe=D.user,Ke=D.globalSetting,Fe=D.loading,ke=D.dispatch,ze=D.shixunHomeworks,pe=D.location,Le=D.payload,be=Le===void 0?{}:Le,Ue=Object(w.a)(D,["homePage","user","globalSetting","loading","dispatch","shixunHomeworks","location","payload"]),Je=(P=(((F=Ke.setting)===null||F===void 0?void 0:F.navbar)||[]).find(function(lt){return lt.link==="/".concat(Ae.Classrooms)}))===null||P===void 0?void 0:P.hidden,Ge=(W=(((I=Ke.setting)===null||I===void 0?void 0:I.navbar)||[]).find(function(lt){return lt.link==="/".concat(Ae.Shixuns)}))===null||W===void 0?void 0:W.hidden,et=(U=(((j=Ke.setting)===null||j===void 0?void 0:j.navbar)||[]).find(function(lt){return lt.link==="/".concat(Ae.Paths)}))===null||U===void 0?void 0:U.hidden,rt=((G=xe.userInfo)===null||G===void 0?void 0:G.admin)||(($=xe.userInfo)===null||$===void 0?void 0:$.business)||((Y=xe.userInfo)===null||Y===void 0?void 0:Y.is_shixun_marker)||((q=xe.userInfo)===null||q===void 0?void 0:q.is_teacher)||((Se=xe.userInfo)===null||Se===void 0?void 0:Se.user_identity)!=="\u5B66\u751F",it=function(){return Object(N.r)()?s.a.createElement(r.a,{className:"".concat(Z.a.rightMenu," ").concat(Z.a.menuWrap)},s.a.createElement(r.a.Item,null,s.a.createElement(a.a,{to:"/account/profile"},"\u8D26\u53F7\u7BA1\u7406"))):s.a.createElement(r.a,{className:"".concat(Z.a.rightMenu," ").concat(Z.a.menuWrap)},s.a.createElement(r.a.Item,{className:Z.a.exit},s.a.createElement("a",{onClick:Object(C.a)(y.a.mark(function st(){var Qe;return y.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return Xe.next=2,Object(ne.c)({});case 2:Qe=Xe.sent,(Qe==null?void 0:Qe.status)===1&&(ke({type:"user/getUserInfo",payload:Object(A.a)({},be)}),ke({type:"user/getNavigationInfo",payload:Object(A.a)({},be)}),Ce("autologin_trustie"),Ce("_educoder_session"),localStorage.removeItem("isfirst"),localStorage.removeItem("SystemUpdateadvtime"),localStorage.removeItem("item"),localStorage.removeItem("iscreate"),f.b.success(Qe==null?void 0:Qe.message),n.d.replace("/"));case 4:case"end":return Xe.stop()}},st)}))},"\u9000\u51FA")))};if(Object(ve.p)()){var ot,at;return s.a.createElement(d.a,{className:"".concat(Z.a.height67),overlay:it,placement:"bottomRight"},s.a.createElement("section",null,s.a.createElement("aside",null,s.a.createElement("div",{className:ze.actionTabs.type===1?Z.a.classromediv:""},s.a.createElement("img",{className:"".concat(Z.a.userPic," current ml15"),src:"".concat(Te.a===null||Te.a===void 0?void 0:Te.a.IMG_SERVER,"/images/").concat((ot=xe.userInfo)===null||ot===void 0?void 0:ot.image_url),alt:""}),Object(N.r)()&&s.a.createElement("span",{className:"ml10 font16"},(at=xe.userInfo)===null||at===void 0?void 0:at.username)))))}else return s.a.createElement("div",{style:{color:"#2958D4"},className:"font15 ".concat(Ke.isIlearning?Z.a.login:"")},s.a.createElement("span",{className:"ml10 mr5 current",onClick:function(){ke({type:"user/showPopLogin",payload:{showPopLogin:!0,showClosable:!0}})}},"\u767B\u5F55"))},se=Object(n.a)(function(B){var D=B.homePage,P=B.loading,F=B.user,W=B.globalSetting,I=B.shixunHomeworks;return{homePage:D,user:F,globalSetting:W,shixunHomeworks:I,loading:P.models.index}})(oe),he=V("+L6B"),ge=V("2/Rp"),ye=V("Cs+z"),me=V.n(ye),ue=["/","/classrooms","/account/profile","/account/profile/edit","/classrooms/new"],Oe=function(D){var P=D.homePage,F=D.user,W=D.globalSetting,I=D.loading,U=D.dispatch,j=D.location,G=D.text,$=D.shixunHomeworks,Y=D.payload,q=Y===void 0?{}:Y,Se=Object(w.a)(D,["homePage","user","globalSetting","loading","dispatch","location","text","shixunHomeworks","payload"]),we=Object(p.useState)("none"),xe=Object(M.a)(we,2),Ke=xe[0],Fe=xe[1];return Object(p.useEffect)(function(){$.actionTabs.key==="\u5E95\u90E8\u5F39\u7A97"&&Fe("flex")},[$.actionTabs.key]),Object(p.useEffect)(function(){$.actionTabs.key==="\u9690\u85CF"&&(Fe("none"),localStorage.setItem("Noviceguide","0"))},[$.actionTabs.key]),s.a.createElement("div",{style:{display:Ke,background:"#fff",width:"100%",height:"200px",position:"fixed",bottom:"0px",boxShadow:"0px -4px 6px 0px rgba(204, 204, 204, 0.2)",zIndex:"999"}},s.a.createElement("div",{style:{margin:"0 auto",width:"1200px"}},s.a.createElement("img",{src:me.a,style:{position:"absolute",top:"-32px"}}),s.a.createElement("div",{style:{marginLeft:"151px",marginTop:"40px",fontSize:"18px",color:"#333333"}},$.actionTabs.text),$.actionTabs.type===9?s.a.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},s.a.createElement(ge.a,{type:"primary",onClick:function(){localStorage.setItem("Noviceguide","0"),Fe("none"),U({type:"shixunHomeworks/setActionTabs",payload:{key:""}})},ghost:!0,style:{marginTop:"30px",width:"138px",height:"40px",position:"absolute",top:"124px"}},"\u5446\u4F1A\u89C1\uFF0C\u6709\u4E8B\u547C\u6211")):s.a.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},s.a.createElement(ge.a,{type:"primary",onClick:function(){localStorage.setItem("Noviceguide","0"),U({type:"shixunHomeworks/setActionTabs",payload:{key:""}}),Fe("none")},ghost:!0,style:{marginTop:"30px",width:"138px",height:"40px",position:"absolute",top:"124px"}},"\u8DF3\u8FC7\uFF0C\u6211\u81EA\u5DF1\u6765"))))},Re=Object(n.a)(function(B){var D=B.homePage,P=B.loading,F=B.user,W=B.globalSetting,I=B.shixunHomeworks;return{homePage:D,user:F,globalSetting:W,loading:P.models.index,shixunHomeworks:I}})(Oe),fe=V("vix7"),_e=V.n(fe),je=S.a.Header,Ie=g.a.Search;function De(){var B,D,P=window.location.pathname,F=P.split("/"),W={};return F[1]=="classrooms"&&F.length>3&&!((B=F[4])!==null&&B!==void 0&&B.includes("newgold"))&&!((D=F[5])!==null&&D!==void 0&&D.includes("newgold"))&&F[2]!=="coursesId"&&(W.course_id=F[2]),Object(A.a)(Object(A.a)({},W),{school:1})}var ce=["/","/classrooms","/account/profile","/account/profile/edit","/classrooms/new"],Me=function(D){var P,F,W,I=D.homePage,U=D.user,j=D.globalSetting,G=D.loading,$=D.dispatch,Y=D.location,q=D.shixunHomeworks,Se=Object(w.a)(D,["homePage","user","globalSetting","loading","dispatch","location","shixunHomeworks"]),we=Object(e.g)(),xe=Object(p.useState)(!1),Ke=Object(M.a)(xe,2),Fe=Ke[0],ke=Ke[1],ze=Object(p.useState)(""),pe=Object(M.a)(ze,2),Le=pe[0],be=pe[1],Ue=Object(p.useState)(!1),Je=Object(M.a)(Ue,2),Ge=Je[0],et=Je[1],rt=De(),it=Object(p.useRef)({id:0});Object(p.useEffect)(function(){$({type:"user/getNavigationInfo",payload:Object(A.a)({},rt)})},[j.name]),Object(p.useEffect)(function(){q.actionTabs.key==="\u5E95\u90E8\u5F39\u7A97"&&(ce!=null&&ce.includes(Y==null?void 0:Y.pathname)||(Y==null?void 0:Y.pathname.indexOf("/classrooms"))===0||$({type:"shixunHomeworks/setActionTabs",payload:{key:"\u9690\u85CF"}}))},[Y.pathname]),Object(p.useEffect)(function(){q.actionTabs.key==="\u5E95\u90E8\u5F39\u7A97"||(q.actionTabs.key||localStorage.setItem("Noviceguide","0"))},[q.actionTabs.key]),Object(p.useEffect)(function(){if(j!=null&&j.setting){var Pe,Ne,$e=j==null||((Pe=j.setting)===null||Pe===void 0||((Ne=Pe.navbar)===null||Ne===void 0))?void 0:Ne.filter(function(Ve){return!(Ve!=null&&Ve.hidden)&&!(Object(ve.m)()&&Ve.link==="/paperlibrary")}),Ze=Object(E.a)($e),ut;try{for(Ze.s();!(ut=Ze.n()).done;){var dt=ut.value;dt.subitem&&(dt.subitem=dt.subitem.filter(function(Ve){return!(Ve!=null&&Ve.hidden)&&!(Object(ve.m)()&&Ve.link==="/paperlibrary")}))}}catch(Ve){Ze.e(Ve)}finally{Ze.f()}var tt=!1;$e==null||$e.map(function(Ve,ct){var ft,pt,gt,vt="/"+((ft=Y.pathname)===null||ft===void 0||((pt=ft.split("/"))===null||pt===void 0)?void 0:pt[1]);if(Ve.link===vt&&(be(Ve==null?void 0:Ve.link),Object(N.X)(Ve==null?void 0:Ve.name),Xe(Ye(ct,{name:Ve==null?void 0:Ve.name,link:Ve==null?void 0:Ve.link},$e)),tt=!0),Ve!=null&&(gt=Ve.subitem)!==null&&gt!==void 0&&gt.length){var mt;Ve==null||((mt=Ve.subitem)===null||mt===void 0)||mt.map(function(ht){ht.link===vt&&(be(ht==null?void 0:ht.link),Object(N.X)(ht==null?void 0:ht.name),Xe(Ye(ct,{name:ht==null?void 0:ht.name,link:ht==null?void 0:ht.link},$e)),tt=!0)})}}),tt||Xe($e)}},[j==null?void 0:j.setting,U]);var ot=Object(p.useMemo)(function(){var Pe;if(j!=null&&(Pe=j.setting)!==null&&Pe!==void 0&&Pe.nav_logo_url){var Ne;return"".concat(Te.a.IMG_SERVER,"/").concat(j==null||((Ne=j.setting)===null||Ne===void 0)?void 0:Ne.nav_logo_url)}else return"".concat(Te.a.IMG_SERVER,"/images/avatars/LaboratorySetting/1nav?t=").concat(new Date().getTime())},[j==null||((P=j.setting)===null||P===void 0)?void 0:P.nav_logo_url]);function at(Pe){we.push("/search?value="+Pe)}var lt=function(){return Fe?s.a.createElement("div",{onBlur:function(){setTimeout(function(){ke(!1)},300)}},s.a.createElement(Ie,{placeholder:"\u5B9E\u8DF5\u8BFE\u7A0B/\u6559\u5B66\u8BFE\u5802/\u5B9E\u8DF5\u9879\u76EE/\u4EA4\u6D41\u95EE\u7B54",className:"search-input mr20",onSearch:at,autoFocus:!0})):s.a.createElement("span",{style:{color:"#666"},className:"iconfont icon-sousuo font18 current ml15 mr15",onClick:function(){we.push("/search?value=")}})},st=Object(p.useState)([]),Qe=Object(M.a)(st,2),qe=Qe[0],Xe=Qe[1],nt=function(){var Pe=Object(C.a)(y.a.mark(function Ne($e,Ze){var ut,dt,tt,Ve,ct,ft,pt,gt;return y.a.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:if(!(($e==null?void 0:$e.name)==="\u5DE5\u7A0B\u8BA4\u8BC1")){mt.next=6;break}return mt.next=3,Object(ne.j)();case 3:return tt=mt.sent,tt!=null&&(dt=tt.data)!==null&&dt!==void 0&&dt.engineer_url?tt!=null&&(Ve=tt.data)!==null&&Ve!==void 0&&(ct=Ve.engineer_url)!==null&&ct!==void 0&&ct.includes("http")?Object(N.S)(tt==null||((ft=tt.data)===null||ft===void 0)?void 0:ft.engineer_url):we.push(tt==null||((pt=tt.data)===null||pt===void 0)?void 0:pt.engineer_url):(tt==null?void 0:tt.status)!=401&&(j!=null&&(gt=j.setting)!==null&&gt!==void 0&&gt.authority_qrcode_url?et(!0):et(!1)),mt.abrupt("return");case 6:$e!=null&&(ut=$e.link)!==null&&ut!==void 0&&ut.includes("http")?Object(N.S)($e==null?void 0:$e.link):we.push($e==null?void 0:$e.link),($e==null?void 0:$e.name)==="\u6559\u5B66\u8BFE\u5802"&&localStorage.getItem("Noviceguide")!=="0"&&$({type:"shixunHomeworks/setActionTabs",payload:{key:"\u5E95\u90E8\u5F39\u7A97",type:5,text:s.a.createElement("div",null,"\u975E\u5E38\u68D2\uFF0C\u54B1\u4EEC\u5DF2\u7ECF\u5230\u8FBE\u3010\u6559\u5B66\u8BFE\u5802\u3011\uFF0C\u5E73\u53F0\u4E0A\u5DF2\u7ECF\u6709\u51E0\u5343\u4F4D\u8001\u5E08\u521B\u5EFA\u4E86\u81EA\u5DF1\u7684\u6559\u5B66\u8BFE\u5802\uFF0C\u4F60\u4E5F\u53EF\u4EE5\u8F7B\u677E\u5B8C\u6210\u54DF\uFF01\u73B0\u5728\u8BF7\u60A8\u70B9\u51FB\u9875\u9762\u4E0A \u201C\u65B0\u5EFA\u8BFE\u5802\u201D\u6309\u94AE\u5F00\u59CB\u65B0\u5EFA\u81EA\u5DF1\u7684\u8BFE\u5802~")}});case 8:case"end":return mt.stop()}},Ne)}));return function($e,Ze){return Pe.apply(this,arguments)}}(),Ye=function(Ne,$e,Ze){var ut=Ze.slice();return ut[Ne]&&(ut[Ne].name=$e.name,ut[Ne].link=$e.link),ut||[]};return s.a.createElement(S.a,{className:"".concat(j.isIlearning?l.a["header-iearning"]:l.a.header,`
`).concat(j.showHeaderFixed?l.a.headerFixed:"")},s.a.createElement(je,{className:"header"},s.a.createElement("section",{className:l.a["edu-menu"]},s.a.createElement(a.a,{to:"/",style:{display:"flex",alignItems:"center"},onClick:function(){$({type:"shixunHomeworks/setActionTabs",payload:{key:""}})}},s.a.createElement("img",{src:_e.a,className:l.a.logo,title:(F=j.setting)===null||F===void 0?void 0:F.name})),s.a.createElement(O.a,{style:{marginLeft:"auto"}},s.a.createElement("ul",{className:"".concat(l.a.menu)},j.setting&&qe.map(function(Pe,Ne){var $e,Ze,ut,dt,tt;return s.a.createElement("li",{key:Ne,className:!(Pe!=null&&($e=Pe.subitem)!==null&&$e!==void 0&&$e.length)&&Le===(Pe==null?void 0:Pe.link)||Pe!=null&&(Ze=Pe.subitem)!==null&&Ze!==void 0&&Ze.some(function(Ve){return Le===(Ve==null?void 0:Ve.link)})?l.a.actived:""},s.a.createElement("div",{onClick:function(){return nt(Pe,Ne)},className:q.actionTabs.type===4?"".concat(l.a.name," ").concat(l.a.classromediv):l.a.name},s.a.createElement("span",null,function(){var Ve=Pe==null?void 0:Pe.name;{var ct;Pe==null||((ct=Pe.subitem)===null||ct===void 0)||ct.map(function(ft,pt){return ft.link===Y.pathname&&(Ve=ft.name),ft})}return Ve}()),(Pe==null||((ut=Pe.subitem)===null||ut===void 0)?void 0:ut.length)>0&&s.a.createElement("i",{className:"iconfont icon-zhankai4"})),(Pe==null||((dt=Pe.subitem)===null||dt===void 0)?void 0:dt.length)>0&&s.a.createElement("div",{className:l.a.dropDown},Pe==null||((tt=Pe.subitem)===null||tt===void 0)?void 0:tt.map(function(Ve,ct){return s.a.createElement("div",{className:l.a.subName,key:Ne+"-"+ct,onClick:function(){return nt(Ve,Ne)}},!!ct&&s.a.createElement("div",{className:l.a.line}),s.a.createElement("aside",{className:"font16 c-black",style:{whiteSpace:"nowrap"}}," ",Ve.name," "),s.a.createElement("div",{className:"font14",style:{color:"#9FA7B3",whiteSpace:"nowrap"}}," ",Ve.content," "))})))})),s.a.createElement("div",{className:"search-bar",style:{flex:j.isIlearning?"initial":"1 0 auto"}},s.a.createElement(s.a.Fragment,null,s.a.createElement(lt,null),Object(ve.p)()&&s.a.createElement(le,null)),s.a.createElement(se,{payload:rt})))),s.a.createElement(k.a,{centered:!0,destroyOnClose:!0,visible:Ge,title:"\u63D0\u793A",width:"500px",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){et(!1)},onCancel:function(){return et(!1)}},s.a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},s.a.createElement("p",null,"\u60A8\u53EF\u4EE5\u5728QQ\u670D\u52A1\u7FA4\u5411\u7BA1\u7406\u5458\u7533\u8BF7\uFF0C\u83B7\u5F97\u7EE7\u7EED\u64CD\u4F5C\u7684\u6743\u9650"),s.a.createElement("img",{src:Te.a.IMG_SERVER+(j==null||((W=j.setting)===null||W===void 0)?void 0:W.authority_qrcode_url),width:200,height:200})))),s.a.createElement(Re,null))},Be=We.a=Object(n.a)(function(B){var D=B.homePage,P=B.loading,F=B.user,W=B.globalSetting,I=B.shixunHomeworks;return{homePage:D,user:F,globalSetting:W,loading:P.models.index,shixunHomeworks:I}})(Me)},ulZh:function(He,We,V){typeof window!="undefined"&&function(k,b){He.exports=b()}(this,function(){return function(ae){var k={};function b(O){if(k[O])return k[O].exports;var C=k[O]={i:O,l:!1,exports:{}};return ae[O].call(C.exports,C,C.exports,b),C.l=!0,C.exports}return b.m=ae,b.c=k,b.d=function(O,C,E){b.o(O,C)||Object.defineProperty(O,C,{enumerable:!0,get:E})},b.r=function(O){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(O,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(O,"__esModule",{value:!0})},b.t=function(O,C){if(C&1&&(O=b(O)),C&8)return O;if(C&4&&typeof O=="object"&&O&&O.__esModule)return O;var E=Object.create(null);if(b.r(E),Object.defineProperty(E,"default",{enumerable:!0,value:O}),C&2&&typeof O!="string")for(var M in O)b.d(E,M,function(w){return O[w]}.bind(null,M));return E},b.n=function(O){var C=O&&O.__esModule?function(){return O.default}:function(){return O};return b.d(C,"a",C),C},b.o=function(O,C){return Object.prototype.hasOwnProperty.call(O,C)},b.p="/dist/",b(b.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ae,k,b){"use strict";var O=Object.prototype.hasOwnProperty,C="~";function E(){}Object.create&&(E.prototype=Object.create(null),new E().__proto__||(C=!1));function M(g,x,S){this.fn=g,this.context=x,this.once=S||!1}function w(g,x,S,v,y){if(typeof S!="function")throw new TypeError("The listener must be a function");var p=new M(S,v||g,y),s=C?C+x:x;return g._events[s]?g._events[s].fn?g._events[s]=[g._events[s],p]:g._events[s].push(p):(g._events[s]=p,g._eventsCount++),g}function A(g,x){--g._eventsCount===0?g._events=new E:delete g._events[x]}function _(){this._events=new E,this._eventsCount=0}_.prototype.eventNames=function(){var x=[],S,v;if(this._eventsCount===0)return x;for(v in S=this._events)O.call(S,v)&&x.push(C?v.slice(1):v);return Object.getOwnPropertySymbols?x.concat(Object.getOwnPropertySymbols(S)):x},_.prototype.listeners=function(x){var S=C?C+x:x,v=this._events[S];if(!v)return[];if(v.fn)return[v.fn];for(var y=0,p=v.length,s=new Array(p);y<p;y++)s[y]=v[y].fn;return s},_.prototype.listenerCount=function(x){var S=C?C+x:x,v=this._events[S];return v?v.fn?1:v.length:0},_.prototype.emit=function(x,S,v,y,p,s){var e=C?C+x:x;if(!this._events[e])return!1;var a=this._events[e],n=arguments.length,c,l;if(a.fn){a.once&&this.removeListener(x,a.fn,void 0,!0);switch(n){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,S),!0;case 3:return a.fn.call(a.context,S,v),!0;case 4:return a.fn.call(a.context,S,v,y),!0;case 5:return a.fn.call(a.context,S,v,y,p),!0;case 6:return a.fn.call(a.context,S,v,y,p,s),!0}for(l=1,c=new Array(n-1);l<n;l++)c[l-1]=arguments[l];a.fn.apply(a.context,c)}else{var u=a.length,m;for(l=0;l<u;l++){a[l].once&&this.removeListener(x,a[l].fn,void 0,!0);switch(n){case 1:a[l].fn.call(a[l].context);break;case 2:a[l].fn.call(a[l].context,S);break;case 3:a[l].fn.call(a[l].context,S,v);break;case 4:a[l].fn.call(a[l].context,S,v,y);break;default:if(!c)for(m=1,c=new Array(n-1);m<n;m++)c[m-1]=arguments[m];a[l].fn.apply(a[l].context,c)}}}return!0},_.prototype.on=function(x,S,v){return w(this,x,S,v,!1)},_.prototype.once=function(x,S,v){return w(this,x,S,v,!0)},_.prototype.removeListener=function(x,S,v,y){var p=C?C+x:x;if(!this._events[p])return this;if(!S)return A(this,p),this;var s=this._events[p];if(s.fn)s.fn===S&&(!y||s.once)&&(!v||s.context===v)&&A(this,p);else{for(var e=0,a=[],n=s.length;e<n;e++)(s[e].fn!==S||y&&!s[e].once||v&&s[e].context!==v)&&a.push(s[e]);a.length?this._events[p]=a.length===1?a[0]:a:A(this,p)}return this},_.prototype.removeAllListeners=function(x){var S;return x?(S=C?C+x:x,this._events[S]&&A(this,S)):(this._events=new E,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=C,_.EventEmitter=_,ae.exports=_},"./node_modules/url-toolkit/src/url-toolkit.js":function(ae,k,b){(function(O){var C=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,E=/^([^\/?#]*)([^]*)$/,M=/(?:\/|^)\.(?=\/)/g,w=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,A={buildAbsoluteURL:function(_,g,x){if(x=x||{},_=_.trim(),g=g.trim(),!g){if(!x.alwaysNormalize)return _;var S=A.parseURL(_);if(!S)throw new Error("Error trying to parse base URL.");return S.path=A.normalizePath(S.path),A.buildURLFromParts(S)}var v=A.parseURL(g);if(!v)throw new Error("Error trying to parse relative URL.");if(v.scheme)return x.alwaysNormalize?(v.path=A.normalizePath(v.path),A.buildURLFromParts(v)):g;var y=A.parseURL(_);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var p=E.exec(y.path);y.netLoc=p[1],y.path=p[2]}y.netLoc&&!y.path&&(y.path="/");var s={scheme:y.scheme,netLoc:v.netLoc,path:null,params:v.params,query:v.query,fragment:v.fragment};if(!v.netLoc&&(s.netLoc=y.netLoc,v.path[0]!=="/"))if(!v.path)s.path=y.path,v.params||(s.params=y.params,v.query||(s.query=y.query));else{var e=y.path,a=e.substring(0,e.lastIndexOf("/")+1)+v.path;s.path=A.normalizePath(a)}return s.path===null&&(s.path=x.alwaysNormalize?A.normalizePath(v.path):v.path),A.buildURLFromParts(s)},parseURL:function(_){var g=C.exec(_);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(M,"");_.length!==(_=_.replace(w,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};ae.exports=A})(this)},"./node_modules/webworkify-webpack/index.js":function(ae,k,b){function O(x){var S={};function v(p){if(S[p])return S[p].exports;var s=S[p]={i:p,l:!1,exports:{}};return x[p].call(s.exports,s,s.exports,v),s.l=!0,s.exports}v.m=x,v.c=S,v.i=function(p){return p},v.d=function(p,s,e){v.o(p,s)||Object.defineProperty(p,s,{configurable:!1,enumerable:!0,get:e})},v.r=function(p){Object.defineProperty(p,"__esModule",{value:!0})},v.n=function(p){var s=p&&p.__esModule?function(){return p.default}:function(){return p};return v.d(s,"a",s),s},v.o=function(p,s){return Object.prototype.hasOwnProperty.call(p,s)},v.p="/",v.oe=function(p){throw console.error(p),p};var y=v(v.s=ENTRY_MODULE);return y.default||y}var C="[\\.|\\-|\\+|\\w|/|@]+",E="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+C+").*?\\)";function M(x){return(x+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function w(x){return!isNaN(1*x)}function A(x,S,v){var y={};y[v]=[];var p=S.toString(),s=p.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return y;for(var e=s[1],a=new RegExp("(\\\\n|\\W)"+M(e)+E,"g"),n;n=a.exec(p);){if(n[3]==="dll-reference")continue;y[v].push(n[3])}for(a=new RegExp("\\("+M(e)+'\\("(dll-reference\\s('+C+'))"\\)\\)'+E,"g");n=a.exec(p);)x[n[2]]||(y[v].push(n[1]),x[n[2]]=b(n[1]).m),y[n[2]]=y[n[2]]||[],y[n[2]].push(n[4]);for(var c=Object.keys(y),l=0;l<c.length;l++)for(var u=0;u<y[c[l]].length;u++)w(y[c[l]][u])&&(y[c[l]][u]=1*y[c[l]][u]);return y}function _(x){var S=Object.keys(x);return S.reduce(function(v,y){return v||x[y].length>0},!1)}function g(x,S){for(var v={main:[S]},y={main:[]},p={main:{}};_(v);)for(var s=Object.keys(v),e=0;e<s.length;e++){var a=s[e],n=v[a],c=n.pop();if(p[a]=p[a]||{},p[a][c]||!x[a][c])continue;p[a][c]=!0,y[a]=y[a]||[],y[a].push(c);for(var l=A(x,x[a][c],a),u=Object.keys(l),m=0;m<u.length;m++)v[u[m]]=v[u[m]]||[],v[u[m]]=v[u[m]].concat(l[u[m]])}return y}ae.exports=function(x,S){S=S||{};var v={main:b.m},y=S.all?{main:Object.keys(v.main)}:g(v,x),p="";Object.keys(y).filter(function(c){return c!=="main"}).forEach(function(c){for(var l=0;y[c][l];)l++;y[c].push(l),v[c][l]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",p=p+"var "+c+" = ("+O.toString().replace("ENTRY_MODULE",JSON.stringify(l))+")({"+y[c].map(function(u){return""+JSON.stringify(u)+": "+v[c][u].toString()}).join(",")+`});
`}),p=p+"new (("+O.toString().replace("ENTRY_MODULE",JSON.stringify(x))+")({"+y.main.map(function(c){return""+JSON.stringify(c)+": "+v.main[c].toString()}).join(",")+"}))(self);";var s=new window.Blob([p],{type:"text/javascript"});if(S.bare)return s;var e=window.URL||window.webkitURL||window.mozURL||window.msURL,a=e.createObjectURL(s),n=new window.Worker(a);return n.objectURL=a,n}},"./src/config.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"hlsDefaultConfig",function(){return m}),b.d(k,"mergeConfig",function(){return o}),b.d(k,"enableStreamingMode",function(){return i});var O=b("./src/controller/abr-controller.ts"),C=b("./src/controller/audio-stream-controller.ts"),E=b("./src/controller/audio-track-controller.ts"),M=b("./src/controller/subtitle-stream-controller.ts"),w=b("./src/controller/subtitle-track-controller.ts"),A=b("./src/controller/buffer-controller.ts"),_=b("./src/controller/timeline-controller.ts"),g=b("./src/controller/cap-level-controller.ts"),x=b("./src/controller/fps-controller.ts"),S=b("./src/controller/eme-controller.ts"),v=b("./src/controller/cmcd-controller.ts"),y=b("./src/utils/xhr-loader.ts"),p=b("./src/utils/fetch-loader.ts"),s=b("./src/utils/cues.ts"),e=b("./src/utils/mediakeys-helper.ts"),a=b("./src/utils/logger.ts");function n(){return n=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var h=arguments[r];for(var f in h)Object.prototype.hasOwnProperty.call(h,f)&&(t[f]=h[f])}return t},n.apply(this,arguments)}function c(t,r){var h=Object.keys(t);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(t);r&&(f=f.filter(function(T){return Object.getOwnPropertyDescriptor(t,T).enumerable})),h.push.apply(h,f)}return h}function l(t){for(var r=1;r<arguments.length;r++){var h=arguments[r]!=null?arguments[r]:{};r%2?c(Object(h),!0).forEach(function(f){u(t,f,h[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(h)):c(Object(h)).forEach(function(f){Object.defineProperty(t,f,Object.getOwnPropertyDescriptor(h,f))})}return t}function u(t,r,h){return r in t?Object.defineProperty(t,r,{value:h,enumerable:!0,configurable:!0,writable:!0}):t[r]=h,t}var m=l(l({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,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:y.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:O.default,bufferController:A.default,capLevelController:g.default,fpsController:x.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,drmSystemOptions:{},requestMediaKeySystemAccessFunc:e.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},d()),{},{subtitleStreamController:M.SubtitleStreamController,subtitleTrackController:w.default,timelineController:_.TimelineController,audioStreamController:C.default,audioTrackController:E.default,emeController:S.default,cmcdController:v.default});function d(){return{cueHandler:s.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function o(t,r){if((r.liveSyncDurationCount||r.liveMaxLatencyDurationCount)&&(r.liveSyncDuration||r.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(r.liveMaxLatencyDurationCount!==void 0&&(r.liveSyncDurationCount===void 0||r.liveMaxLatencyDurationCount<=r.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(r.liveMaxLatencyDuration!==void 0&&(r.liveSyncDuration===void 0||r.liveMaxLatencyDuration<=r.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return n({},t,r)}function i(t){var r=t.loader;if(r!==p.default&&r!==y.default)a.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1;else{var h=Object(p.fetchSupported)();h&&(t.loader=p.default,t.progressive=!0,t.enableSoftwareAES=!0,a.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/polyfills/number.ts"),C=b("./src/utils/ewma-bandwidth-estimator.ts"),E=b("./src/events.ts"),M=b("./src/utils/buffer-helper.ts"),w=b("./src/errors.ts"),A=b("./src/types/loader.ts"),_=b("./src/utils/logger.ts");function g(v,y){for(var p=0;p<y.length;p++){var s=y[p];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(v,s.key,s)}}function x(v,y,p){return y&&g(v.prototype,y),p&&g(v,p),v}var S=function(){function v(p){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=p;var s=p.config;this.bwEstimator=new C.default(s.abrEwmaSlowVoD,s.abrEwmaFastVoD,s.abrEwmaDefaultEstimate),this.registerListeners()}var y=v.prototype;return y.registerListeners=function(){var s=this.hls;s.on(E.Events.FRAG_LOADING,this.onFragLoading,this),s.on(E.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(E.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(E.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var s=this.hls;s.off(E.Events.FRAG_LOADING,this.onFragLoading,this),s.off(E.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(E.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(E.Events.ERROR,this.onError,this)},y.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},y.onFragLoading=function(s,e){var a=e.frag;if(a.type===A.PlaylistLevelType.MAIN&&!this.timer){var n;this.fragCurrent=a,this.partCurrent=(n=e.part)!=null?n:null,this.timer=self.setInterval(this.onCheck,100)}},y.onLevelLoaded=function(s,e){var a=this.hls.config;e.details.live?this.bwEstimator.update(a.abrEwmaSlowLive,a.abrEwmaFastLive):this.bwEstimator.update(a.abrEwmaSlowVoD,a.abrEwmaFastVoD)},y._abandonRulesCheck=function(){var s=this.fragCurrent,e=this.partCurrent,a=this.hls,n=a.autoLevelEnabled,c=a.config,l=a.media;if(!s||!l)return;var u=e?e.stats:s.stats,m=e?e.duration:s.duration;if(u.aborted){_.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||l.paused||!l.playbackRate||!l.readyState)return;var d=performance.now()-u.loading.start,o=Math.abs(l.playbackRate);if(d<=500*m/o)return;var i=a.levels,t=a.minAutoLevel,r=i[s.level],h=u.total||Math.max(u.loaded,Math.round(m*r.maxBitrate/8)),f=Math.max(1,u.bwEstimate?u.bwEstimate/8:u.loaded*1e3/d),T=(h-u.loaded)/f,R=l.currentTime,L=(M.BufferHelper.bufferInfo(l,R,c.maxBufferHole).end-R)/o;if(L>=2*m/o||T<=L)return;var N=Number.POSITIVE_INFINITY,H;for(H=s.level-1;H>t;H--){var K=i[H].maxBitrate;if(N=m*K/(8*.8*f),N<L)break}if(N>=T)return;var X=this.bwEstimator.getEstimate();_.logger.warn("Fragment "+s.sn+(e?" part "+e.index:"")+" of level "+s.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+H+`
Current BW estimate: `+(Object(O.isFiniteNumber)(X)?(X/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+T.toFixed(3)+` s
Estimated load time for the next fragment: `+N.toFixed(3)+` s
Time to underbuffer: `+L.toFixed(3)+" s"),a.nextLoadLevel=H,this.bwEstimator.sample(d,u.loaded),this.clearTimer(),s.loader&&(this.fragCurrent=this.partCurrent=null,s.loader.abort()),a.trigger(E.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:e,stats:u})},y.onFragLoaded=function(s,e){var a=e.frag,n=e.part;if(a.type===A.PlaylistLevelType.MAIN&&Object(O.isFiniteNumber)(a.sn)){var c=n?n.stats:a.stats,l=n?n.duration:a.duration;if(this.clearTimer(),this.lastLoadedFragLevel=a.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var u=this.hls.levels[a.level],m=(u.loaded?u.loaded.bytes:0)+c.loaded,d=(u.loaded?u.loaded.duration:0)+l;u.loaded={bytes:m,duration:d},u.realBitrate=Math.round(8*m/d)}if(a.bitrateTest){var o={stats:c,frag:a,part:n,id:a.type};this.onFragBuffered(E.Events.FRAG_BUFFERED,o),a.bitrateTest=!1}}},y.onFragBuffered=function(s,e){var a=e.frag,n=e.part,c=n?n.stats:a.stats;if(c.aborted)return;if(a.type!==A.PlaylistLevelType.MAIN||a.sn==="initSegment")return;var l=c.parsing.end-c.loading.start;this.bwEstimator.sample(l,c.loaded),c.bwEstimate=this.bwEstimator.getEstimate(),a.bitrateTest?this.bitrateTestDelay=l/1e3:this.bitrateTestDelay=0},y.onError=function(s,e){switch(e.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},y.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},y.getNextABRAutoLevel=function(){var s=this.fragCurrent,e=this.partCurrent,a=this.hls,n=a.maxAutoLevel,c=a.config,l=a.minAutoLevel,u=a.media,m=e?e.duration:s?s.duration:0,d=u?u.currentTime:0,o=u&&u.playbackRate!==0?Math.abs(u.playbackRate):1,i=this.bwEstimator?this.bwEstimator.getEstimate():c.abrEwmaDefaultEstimate,t=(M.BufferHelper.bufferInfo(u,d,c.maxBufferHole).end-d)/o,r=this.findBestLevel(i,l,n,t,c.abrBandWidthFactor,c.abrBandWidthUpFactor);if(r>=0)return r;_.logger.trace((t?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var h=m?Math.min(m,c.maxStarvationDelay):c.maxStarvationDelay,f=c.abrBandWidthFactor,T=c.abrBandWidthUpFactor;if(!t){var R=this.bitrateTestDelay;if(R){var L=m?Math.min(m,c.maxLoadingDelay):c.maxLoadingDelay;h=L-R,_.logger.trace("bitrate test took "+Math.round(1e3*R)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*h)+" ms"),f=T=1}}return r=this.findBestLevel(i,l,n,t+h,f,T),Math.max(r,0)},y.findBestLevel=function(s,e,a,n,c,l){for(var u,m=this.fragCurrent,d=this.partCurrent,o=this.lastLoadedFragLevel,i=this.hls.levels,t=i[o],r=!!(t!=null&&(u=t.details)!==null&&u!==void 0&&u.live),h=t==null?void 0:t.codecSet,f=d?d.duration:m?m.duration:0,T=a;T>=e;T--){var R=i[T];if(!R||h&&R.codecSet!==h)continue;var L=R.details,N=(d?L==null?void 0:L.partTarget:L==null?void 0:L.averagetargetduration)||f,H=void 0;T<=o?H=c*s:H=l*s;var K=i[T].maxBitrate,X=K*N/H;if(_.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+T+"/"+Math.round(H)+"/"+K+"/"+N+"/"+n+"/"+X),H>K&&(!X||r&&!this.bitrateTestDelay||X<n))return T}return-1},x(v,[{key:"nextAutoLevel",get:function(){var s=this._nextAutoLevel,e=this.bwEstimator;if(s!==-1&&(!e||!e.canEstimate()))return s;var a=this.getNextABRAutoLevel();return s!==-1&&(a=Math.min(s,a)),a},set:function(s){this._nextAutoLevel=s}}]),v}();k.default=S},"./src/controller/audio-stream-controller.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/polyfills/number.ts"),C=b("./src/controller/base-stream-controller.ts"),E=b("./src/events.ts"),M=b("./src/utils/buffer-helper.ts"),w=b("./src/controller/fragment-tracker.ts"),A=b("./src/types/level.ts"),_=b("./src/types/loader.ts"),g=b("./src/loader/fragment.ts"),x=b("./src/demux/chunk-cache.ts"),S=b("./src/demux/transmuxer-interface.ts"),v=b("./src/types/transmuxer.ts"),y=b("./src/controller/fragment-finders.ts"),p=b("./src/utils/discontinuities.ts"),s=b("./src/errors.ts"),e=b("./src/utils/logger.ts");function a(){return a=Object.assign||function(m){for(var d=1;d<arguments.length;d++){var o=arguments[d];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(m[i]=o[i])}return m},a.apply(this,arguments)}function n(m,d){m.prototype=Object.create(d.prototype),m.prototype.constructor=m,c(m,d)}function c(m,d){return c=Object.setPrototypeOf||function(i,t){return i.__proto__=t,i},c(m,d)}var l=100,u=function(m){n(d,m);function d(i,t){var r;return r=m.call(this,i,t,"[audio-stream-controller]")||this,r.videoBuffer=null,r.videoTrackCC=-1,r.waitingVideoCC=-1,r.audioSwitch=!1,r.trackId=-1,r.waitingData=null,r.mainDetails=null,r.bufferFlushed=!1,r._registerListeners(),r}var o=d.prototype;return o.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},o._registerListeners=function(){var t=this.hls;t.on(E.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(E.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(E.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(E.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(E.Events.ERROR,this.onError,this),t.on(E.Events.BUFFER_RESET,this.onBufferReset,this),t.on(E.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(E.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(E.Events.FRAG_BUFFERED,this.onFragBuffered,this)},o._unregisterListeners=function(){var t=this.hls;t.off(E.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(E.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(E.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(E.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(E.Events.ERROR,this.onError,this),t.off(E.Events.BUFFER_RESET,this.onBufferReset,this),t.off(E.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(E.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(E.Events.FRAG_BUFFERED,this.onFragBuffered,this)},o.onInitPtsFound=function(t,r){var h=r.frag,f=r.id,T=r.initPTS;if(f==="main"){var R=h.cc;this.initPTS[h.cc]=T,this.log("InitPTS for cc: "+R+" found from main: "+T),this.videoTrackCC=R,this.state===C.State.WAITING_INIT_PTS&&this.tick()}},o.startLoad=function(t){if(!this.levels){this.startPosition=t,this.state=C.State.STOPPED;return}var r=this.lastCurrentTime;this.stopLoad(),this.setInterval(l),this.fragLoadError=0,r>0&&t===-1?(this.log("Override startPosition with lastCurrentTime @"+r.toFixed(3)),this.state=C.State.IDLE):(this.loadedmetadata=!1,this.state=C.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},o.doTick=function(){switch(this.state){case C.State.IDLE:this.doTickIdle();break;case C.State.WAITING_TRACK:{var t,r=this.levels,h=this.trackId,f=r==null||((t=r[h])===null||t===void 0)?void 0:t.details;if(f){if(this.waitForCdnTuneIn(f))break;this.state=C.State.WAITING_INIT_PTS}break}case C.State.FRAG_LOADING_WAITING_RETRY:{var T,R=performance.now(),L=this.retryDate;(!L||R>=L||(T=this.media)!==null&&T!==void 0&&T.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=C.State.IDLE);break}case C.State.WAITING_INIT_PTS:{var N=this.waitingData;if(N){var H=N.frag,K=N.part,X=N.cache,z=N.complete;if(this.initPTS[H.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=C.State.FRAG_LOADING;var J=X.flush(),te={frag:H,part:K,payload:J,networkDetails:null};this._handleFragmentLoadProgress(te),z&&m.prototype._handleFragmentLoadComplete.call(this,te)}else if(this.videoTrackCC!==this.waitingVideoCC)e.logger.log("Waiting fragment cc ("+H.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ee=this.getLoadPosition(),ve=M.BufferHelper.bufferInfo(this.mediaBuffer,ee,this.config.maxBufferHole),re=Object(y.fragmentWithinToleranceTest)(ve.end,this.config.maxFragLookUpTolerance,H);re<0&&(e.logger.log("Waiting fragment cc ("+H.cc+") @ "+H.start+" cancelled because another fragment at "+ve.end+" is needed"),this.clearWaitingFragment())}}else this.state=C.State.IDLE}}this.onTickEnd()},o.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=C.State.IDLE)},o.onTickEnd=function(){var t=this.media;if(!t||!t.readyState)return;var r=this.mediaBuffer?this.mediaBuffer:t,h=r.buffered;!this.loadedmetadata&&h.length&&(this.loadedmetadata=!0),this.lastCurrentTime=t.currentTime},o.doTickIdle=function(){var t,r,h=this.hls,f=this.levels,T=this.media,R=this.trackId,L=h.config;if(!f||!f[R])return;if(!T&&(this.startFragRequested||!L.startFragPrefetch))return;var N=f[R],H=N.details;if(!H||H.live&&this.levelLastLoaded!==R||this.waitForCdnTuneIn(H)){this.state=C.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,_.PlaylistLevelType.AUDIO));var K=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,_.PlaylistLevelType.AUDIO);if(K===null)return;var X=K.len,z=this.getMaxBufferLength(),J=this.audioSwitch;if(X>=z&&!J)return;if(!J&&this._streamEnded(K,H)){h.trigger(E.Events.BUFFER_EOS,{type:"audio"}),this.state=C.State.ENDED;return}var te=H.fragments,ee=te[0].start,ve=K.end;if(J){var re=this.getLoadPosition();ve=re,H.PTSKnown&&re<ee&&((K.end>ee||K.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),T.currentTime=ee+.05))}var de=this.getNextFragment(ve,H);if(!de){this.bufferFlushed=!0;return}((t=de.decryptdata)===null||t===void 0?void 0:t.keyFormat)==="identity"&&!((r=de.decryptdata)!==null&&r!==void 0&&r.key)?this.loadKey(de,H):this.loadFragment(de,H,ve)},o.getMaxBufferLength=function(){var t=m.prototype.getMaxBufferLength.call(this),r=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,_.PlaylistLevelType.MAIN);return r===null?t:Math.max(t,r.len)},o.onMediaDetaching=function(){this.videoBuffer=null,m.prototype.onMediaDetaching.call(this)},o.onAudioTracksUpdated=function(t,r){var h=r.audioTracks;this.resetTransmuxer(),this.levels=h.map(function(f){return new A.Level(f)})},o.onAudioTrackSwitching=function(t,r){var h=!!r.url;this.trackId=r.id;var f=this.fragCurrent;f!=null&&f.loader&&f.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),h?this.setInterval(l):this.resetTransmuxer(),h?(this.audioSwitch=!0,this.state=C.State.IDLE):this.state=C.State.STOPPED,this.tick()},o.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},o.onLevelLoaded=function(t,r){this.mainDetails=r.details},o.onAudioTrackLoaded=function(t,r){var h,f=this.levels,T=r.details,R=r.id;if(!f){this.warn("Audio tracks were reset while loading level "+R);return}this.log("Track "+R+" loaded ["+T.startSN+","+T.endSN+"],duration:"+T.totalduration);var L=f[R],N=0;if(T.live||(h=L.details)!==null&&h!==void 0&&h.live){var H=this.mainDetails;if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed||!H)return;!L.details&&T.hasProgramDateTime&&H.hasProgramDateTime?(Object(p.alignMediaPlaylistByPDT)(T,H),N=T.fragments[0].start):N=this.alignPlaylists(T,L.details)}L.details=T,this.levelLastLoaded=R,!this.startFragRequested&&(this.mainDetails||!T.live)&&this.setStartPosition(L.details,N),this.state===C.State.WAITING_TRACK&&!this.waitForCdnTuneIn(T)&&(this.state=C.State.IDLE),this.tick()},o._handleFragmentLoadProgress=function(t){var r,h=t.frag,f=t.part,T=t.payload,R=this.config,L=this.trackId,N=this.levels;if(!N){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+h.sn+" of level "+h.level+" will not be buffered");return}var H=N[L];console.assert(H,"Audio track is defined on fragment load progress");var K=H.details;console.assert(K,"Audio track details are defined on fragment load progress");var X=R.defaultAudioCodec||H.audioCodec||"mp4a.40.2",z=this.transmuxer;z||(z=this.transmuxer=new S.default(this.hls,_.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var J=this.initPTS[h.cc],te=(r=h.initSegment)===null||r===void 0?void 0:r.data;if(J!==void 0){var ee=!1,ve=f?f.index:-1,re=ve!==-1,de=new v.ChunkMetadata(h.level,h.sn,h.stats.chunkCount,T.byteLength,ve,re);z.push(T,te,X,"",h,f,K.totalduration,ee,de,J)}else{e.logger.log("Unknown video PTS for cc "+h.cc+", waiting for video PTS before demuxing audio frag "+h.sn+" of ["+K.startSN+" ,"+K.endSN+"],track "+L);var ie=this.waitingData=this.waitingData||{frag:h,part:f,cache:new x.default,complete:!1},le=ie.cache;le.push(new Uint8Array(T)),this.waitingVideoCC=this.videoTrackCC,this.state=C.State.WAITING_INIT_PTS}},o._handleFragmentLoadComplete=function(t){if(this.waitingData){this.waitingData.complete=!0;return}m.prototype._handleFragmentLoadComplete.call(this,t)},o.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},o.onBufferCreated=function(t,r){var h=r.tracks.audio;h&&(this.mediaBuffer=h.buffer),r.tracks.video&&(this.videoBuffer=r.tracks.video.buffer)},o.onFragBuffered=function(t,r){var h=r.frag,f=r.part;if(h.type!==_.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(h)){this.warn("Fragment "+h.sn+(f?" p: "+f.index:"")+" of level "+h.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}h.sn!=="initSegment"&&(this.fragPrevious=h,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(E.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(h,f)},o.onError=function(t,r){switch(r.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.AUDIO,r);break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==C.State.ERROR&&this.state!==C.State.STOPPED&&(this.state=r.fatal?C.State.ERROR:C.State.IDLE,this.warn(r.details+" while loading frag, switching to "+this.state+" state"));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(r.parent==="audio"&&(this.state===C.State.PARSING||this.state===C.State.PARSED)){var h=!0,f=this.getFwdBufferInfo(this.mediaBuffer,_.PlaylistLevelType.AUDIO);f&&f.len>.5&&(h=!this.reduceMaxBufferLength(f.len)),h&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},o.onBufferFlushed=function(t,r){var h=r.type;h===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},o._handleTransmuxComplete=function(t){var r,h="audio",f=this.hls,T=t.remuxResult,R=t.chunkMeta,L=this.getCurrentContext(R);if(!L){this.warn("The loading context changed while buffering fragment "+R.sn+" of level "+R.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(R.level);return}var N=L.frag,H=L.part,K=T.audio,X=T.text,z=T.id3,J=T.initSegment;if(this.fragContextChanged(N))return;if(this.state=C.State.PARSING,this.audioSwitch&&K&&this.completeAudioSwitch(),J!=null&&J.tracks&&(this._bufferInitSegment(J.tracks,N,R),f.trigger(E.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:h,tracks:J.tracks})),K){var te=K.startPTS,ee=K.endPTS,ve=K.startDTS,re=K.endDTS;H&&(H.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:te,endPTS:ee,startDTS:ve,endDTS:re}),N.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,te,ee,ve,re),this.bufferFragmentData(K,N,H,R)}if(z!=null&&(r=z.samples)!==null&&r!==void 0&&r.length){var de=a({frag:N,id:h},z);f.trigger(E.Events.FRAG_PARSING_METADATA,de)}if(X){var ie=a({frag:N,id:h},X);f.trigger(E.Events.FRAG_PARSING_USERDATA,ie)}},o._bufferInitSegment=function(t,r,h){if(this.state!==C.State.PARSING)return;t.video&&delete t.video;var f=t.audio;if(!f)return;f.levelCodec=f.codec,f.id="audio",this.log("Init audio buffer, container:"+f.container+", codecs[parsed]=["+f.codec+"]"),this.hls.trigger(E.Events.BUFFER_CODECS,t);var T=f.initSegment;if(T!=null&&T.byteLength){var R={type:"audio",frag:r,part:null,chunkMeta:h,parent:r.type,data:T};this.hls.trigger(E.Events.BUFFER_APPENDING,R)}this.tick()},o.loadFragment=function(t,r,h){var f=this.fragmentTracker.getState(t);this.fragCurrent=t,(this.audioSwitch||f===w.FragmentState.NOT_LOADED||f===w.FragmentState.PARTIAL)&&(t.sn==="initSegment"?this._loadInitSegment(t):r.live&&!Object(O.isFiniteNumber)(this.initPTS[t.cc])?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=C.State.WAITING_INIT_PTS):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,t,r,h)))},o.completeAudioSwitch=function(){var t=this.hls,r=this.media,h=this.trackId;r&&(this.log("Switching audio track : flushing all audio"),m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,t.trigger(E.Events.AUDIO_TRACK_SWITCHED,{id:h})},d}(C.default);k.default=u},"./src/controller/audio-track-controller.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/events.ts"),C=b("./src/errors.ts"),E=b("./src/controller/base-playlist-controller.ts"),M=b("./src/types/loader.ts");function w(S,v){for(var y=0;y<v.length;y++){var p=v[y];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(S,p.key,p)}}function A(S,v,y){return v&&w(S.prototype,v),y&&w(S,y),S}function _(S,v){S.prototype=Object.create(v.prototype),S.prototype.constructor=S,g(S,v)}function g(S,v){return g=Object.setPrototypeOf||function(p,s){return p.__proto__=s,p},g(S,v)}var x=function(S){_(v,S);function v(p){var s;return s=S.call(this,p,"[audio-track-controller]")||this,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.trackName="",s.selectDefaultTrack=!0,s.registerListeners(),s}var y=v.prototype;return y.registerListeners=function(){var s=this.hls;s.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(O.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(O.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(O.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var s=this.hls;s.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(O.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(O.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(O.Events.ERROR,this.onError,this)},y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,S.prototype.destroy.call(this)},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},y.onManifestParsed=function(s,e){this.tracks=e.audioTracks||[]},y.onAudioTrackLoaded=function(s,e){var a=e.id,n=e.details,c=this.tracksInGroup[a];if(!c){this.warn("Invalid audio track id "+a);return}var l=c.details;c.details=e.details,this.log("audioTrack "+a+" loaded ["+n.startSN+"-"+n.endSN+"]"),a===this.trackId&&(this.retryCount=0,this.playlistLoaded(a,e,l))},y.onLevelLoading=function(s,e){this.switchLevel(e.level)},y.onLevelSwitching=function(s,e){this.switchLevel(e.level)},y.switchLevel=function(s){var e=this.hls.levels[s];if(!(e!=null&&e.audioGroupIds))return;var a=e.audioGroupIds[e.urlId];if(this.groupId!==a){this.groupId=a;var n=this.tracks.filter(function(l){return!a||l.groupId===a});this.selectDefaultTrack&&!n.some(function(l){return l.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=n;var c={audioTracks:n};this.log("Updating audio tracks, "+n.length+' track(s) found in "'+a+'" group-id'),this.hls.trigger(O.Events.AUDIO_TRACKS_UPDATED,c),this.selectInitialTrack()}},y.onError=function(s,e){if(S.prototype.onError.call(this,s,e),e.fatal||!e.context)return;e.context.type===M.PlaylistContextType.AUDIO_TRACK&&e.context.id===this.trackId&&e.context.groupId===this.groupId&&this.retryLoadingOrFail(e)},y.setAudioTrack=function(s){var e=this.tracksInGroup;if(s<0||s>=e.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var a=e[this.trackId];this.log("Now switching to audio-track index "+s);var n=e[s],c=n.id,l=n.groupId,u=l===void 0?"":l,m=n.name,d=n.type,o=n.url;if(this.trackId=s,this.trackName=m,this.selectDefaultTrack=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHING,{id:c,groupId:u,name:m,type:d,url:o}),n.details&&!n.details.live)return;var i=this.switchParams(n.url,a==null?void 0:a.details);this.loadPlaylist(i)},y.selectInitialTrack=function(){var s=this.tracksInGroup;console.assert(s.length,"Initial audio track should be selected when tracks are known");var e=this.trackName,a=this.findTrackId(e)||this.findTrackId();a!==-1?this.setAudioTrack(a):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},y.findTrackId=function(s){for(var e=this.tracksInGroup,a=0;a<e.length;a++){var n=e[a];if((!this.selectDefaultTrack||n.default)&&(!s||s===n.name))return n.id}return-1},y.loadPlaylist=function(s){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var a=e.id,n=e.groupId,c=e.url;if(s)try{c=s.addDirectives(c)}catch(l){this.warn("Could not construct new URL with HLS Delivery Directives: "+l)}this.log("loading audio-track playlist for id: "+a),this.clearTimer(),this.hls.trigger(O.Events.AUDIO_TRACK_LOADING,{url:c,id:a,groupId:n,deliveryDirectives:s||null})}},A(v,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1,this.setAudioTrack(s)}}]),v}(E.default);k.default=x},"./src/controller/base-playlist-controller.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return A});var O=b("./src/polyfills/number.ts"),C=b("./src/types/level.ts"),E=b("./src/controller/level-helper.ts"),M=b("./src/utils/logger.ts"),w=b("./src/errors.ts"),A=function(){function _(x,S){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=M.logger.log.bind(M.logger,S+":"),this.warn=M.logger.warn.bind(M.logger,S+":"),this.hls=x}var g=_.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(S,v){v.fatal&&v.type===w.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(S,v){var y=v==null?void 0:v.renditionReports;if(y)for(var p=0;p<y.length;p++){var s=y[p],e=""+s.URI;if(e===S.substr(-e.length)){var a=parseInt(s["LAST-MSN"]),n=parseInt(s["LAST-PART"]);if(v&&this.hls.config.lowLatencyMode){var c=Math.min(v.age-v.partTarget,v.targetduration);n!==void 0&&c>v.partTarget&&(n+=1)}if(Object(O.isFiniteNumber)(a))return new C.HlsUrlParameters(a,Object(O.isFiniteNumber)(n)?n:void 0,C.HlsSkip.No)}}},g.loadPlaylist=function(S){},g.shouldLoadTrack=function(S){return this.canLoad&&S&&!!S.url&&(!S.details||S.details.live)},g.playlistLoaded=function(S,v,y){var p=this,s=v.details,e=v.stats,a=e.loading.end?Math.max(0,self.performance.now()-e.loading.end):0;if(s.advancedDateTime=Date.now()-a,s.live||y!=null&&y.live){if(s.reloaded(y),y&&this.log("live playlist "+S+" "+(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:"MISSED")),y&&s.fragments.length>0&&Object(E.mergeDetails)(y,s),!this.canLoad||!s.live)return;var n,c=void 0,l=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var u=this.hls.config.lowLatencyMode,m=s.lastPartSn,d=s.endSN,o=s.lastPartIndex,i=o!==-1,t=m===d,r=u?0:o;i?(c=t?d+1:m,l=t?r:o+1):c=d+1;var h=s.age,f=h+s.ageHeader,T=Math.min(f-s.partTarget,s.targetduration*1.5);if(T>0){if(y&&T>y.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+y.tuneInGoal+" to: "+T+" with playlist age: "+s.age),T=0;else{var R=Math.floor(T/s.targetduration);if(c+=R,l!==void 0){var L=Math.round(T%s.targetduration/s.partTarget);l+=L}this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+h.toFixed(2)+"s goal: "+T+" skip sn "+R+" to part "+l)}s.tuneInGoal=T}if(n=this.getDeliveryDirectives(s,v.deliveryDirectives,c,l),u||!t){this.loadPlaylist(n);return}}else n=this.getDeliveryDirectives(s,v.deliveryDirectives,c,l);var N=Object(E.computeReloadInterval)(s,e);c!==void 0&&s.canBlockReload&&(N-=s.partTarget||1),this.log("reload live playlist "+S+" in "+Math.round(N)+" ms"),this.timer=self.setTimeout(function(){return p.loadPlaylist(n)},N)}else this.clearTimer()},g.getDeliveryDirectives=function(S,v,y,p){var s=Object(C.getSkipValue)(S,y);return v!=null&&v.skip&&S.deltaUpdateFailed&&(y=v.msn,p=v.part,s=C.HlsSkip.No),new C.HlsUrlParameters(y,p,s)},g.retryLoadingOrFail=function(S){var v=this,y=this.hls.config,p=this.retryCount<y.levelLoadingMaxRetry;if(p){var s;if(this.retryCount++,S.details.indexOf("LoadTimeOut")>-1&&(s=S.context)!==null&&s!==void 0&&s.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+S.details+'"'),this.loadPlaylist();else{var e=Math.min(Math.pow(2,this.retryCount)*y.levelLoadingRetryDelay,y.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return v.loadPlaylist()},e),this.warn("retry playlist loading #"+this.retryCount+" in "+e+' ms after "'+S.details+'"')}}else this.warn('cannot recover from error "'+S.details+'"'),this.clearTimer(),S.fatal=!0;return p},_}()},"./src/controller/base-stream-controller.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"State",function(){return d}),b.d(k,"default",function(){return o});var O=b("./src/polyfills/number.ts"),C=b("./src/task-loop.ts"),E=b("./src/controller/fragment-tracker.ts"),M=b("./src/utils/buffer-helper.ts"),w=b("./src/utils/logger.ts"),A=b("./src/events.ts"),_=b("./src/errors.ts"),g=b("./src/types/transmuxer.ts"),x=b("./src/utils/mp4-tools.ts"),S=b("./src/utils/discontinuities.ts"),v=b("./src/controller/fragment-finders.ts"),y=b("./src/controller/level-helper.ts"),p=b("./src/loader/fragment-loader.ts"),s=b("./src/crypt/decrypter.ts"),e=b("./src/utils/time-ranges.ts"),a=b("./src/types/loader.ts");function n(i,t){for(var r=0;r<t.length;r++){var h=t[r];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(i,h.key,h)}}function c(i,t,r){return t&&n(i.prototype,t),r&&n(i,r),i}function l(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function u(i,t){i.prototype=Object.create(t.prototype),i.prototype.constructor=i,m(i,t)}function m(i,t){return m=Object.setPrototypeOf||function(h,f){return h.__proto__=f,h},m(i,t)}var d={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},o=function(i){u(t,i);function t(h,f,T){var R;return R=i.call(this)||this,R.hls=void 0,R.fragPrevious=null,R.fragCurrent=null,R.fragmentTracker=void 0,R.transmuxer=null,R._state=d.STOPPED,R.media=void 0,R.mediaBuffer=void 0,R.config=void 0,R.bitrateTest=!1,R.lastCurrentTime=0,R.nextLoadPosition=0,R.startPosition=0,R.loadedmetadata=!1,R.fragLoadError=0,R.retryDate=0,R.levels=null,R.fragmentLoader=void 0,R.levelLastLoaded=null,R.startFragRequested=!1,R.decrypter=void 0,R.initPTS=[],R.onvseeking=null,R.onvended=null,R.logPrefix="",R.log=void 0,R.warn=void 0,R.logPrefix=T,R.log=w.logger.log.bind(w.logger,T+":"),R.warn=w.logger.warn.bind(w.logger,T+":"),R.hls=h,R.fragmentLoader=new p.default(h.config),R.fragmentTracker=f,R.config=h.config,R.decrypter=new s.default(h,h.config),h.on(A.Events.KEY_LOADED,R.onKeyLoaded,l(R)),R}var r=t.prototype;return r.doTick=function(){this.onTickEnd()},r.onTickEnd=function(){},r.startLoad=function(f){},r.stopLoad=function(){this.fragmentLoader.abort();var f=this.fragCurrent;f&&this.fragmentTracker.removeFragment(f),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=d.STOPPED},r._streamEnded=function(f,T){var R=this.fragCurrent,L=this.fragmentTracker;if(!T.live&&R&&R.sn===T.endSN&&!f.nextStart){var N=L.getState(R);return N===E.FragmentState.PARTIAL||N===E.FragmentState.OK}return!1},r.onMediaAttached=function(f,T){var R=this.media=this.mediaBuffer=T.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),R.addEventListener("seeking",this.onvseeking),R.addEventListener("ended",this.onvended);var L=this.config;this.levels&&L.autoStartLoad&&this.state===d.STOPPED&&this.startLoad(L.startPosition)},r.onMediaDetaching=function(){var f=this.media;f!=null&&f.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),f&&(f.removeEventListener("seeking",this.onvseeking),f.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},r.onMediaSeeking=function(){var f=this.config,T=this.fragCurrent,R=this.media,L=this.mediaBuffer,N=this.state,H=R?R.currentTime:0,K=M.BufferHelper.bufferInfo(L||R,H,f.maxBufferHole);if(this.log("media seeking to "+(Object(O.isFiniteNumber)(H)?H.toFixed(3):H)+", state: "+N),N===d.ENDED)this.resetLoadingState();else if(T&&!K.len){var X=f.maxFragLookUpTolerance,z=T.start-X,J=T.start+T.duration+X,te=H>J;(H<z||te)&&(te&&T.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),T.loader.abort()),this.resetLoadingState())}R&&(this.lastCurrentTime=H),!this.loadedmetadata&&!K.len&&(this.nextLoadPosition=this.startPosition=H),this.tickImmediate()},r.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},r.onKeyLoaded=function(f,T){if(this.state!==d.KEY_LOADING||T.frag!==this.fragCurrent||!this.levels)return;this.state=d.IDLE;var R=this.levels[T.frag.level].details;R&&this.loadFragment(T.frag,R,T.frag.start)},r.onHandlerDestroying=function(){this.stopLoad(),i.prototype.onHandlerDestroying.call(this)},r.onHandlerDestroyed=function(){this.state=d.STOPPED,this.hls.off(A.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,i.prototype.onHandlerDestroyed.call(this)},r.loadKey=function(f,T){this.log("Loading key for "+f.sn+" of ["+T.startSN+"-"+T.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+f.level),this.state=d.KEY_LOADING,this.fragCurrent=f,this.hls.trigger(A.Events.KEY_LOADING,{frag:f})},r.loadFragment=function(f,T,R){this._loadFragForPlayback(f,T,R)},r._loadFragForPlayback=function(f,T,R){var L=this,N=function(K){if(L.fragContextChanged(f)){L.warn("Fragment "+f.sn+(K.part?" p: "+K.part.index:"")+" of level "+f.level+" was dropped during download."),L.fragmentTracker.removeFragment(f);return}f.stats.chunkCount++,L._handleFragmentLoadProgress(K)};this._doFragLoad(f,T,R,N).then(function(H){if(!H)return;L.fragLoadError=0;var K=L.state;if(L.fragContextChanged(f)){(K===d.FRAG_LOADING||K===d.BACKTRACKING||!L.fragCurrent&&K===d.PARSING)&&(L.fragmentTracker.removeFragment(f),L.state=d.IDLE);return}if("payload"in H&&(L.log("Loaded fragment "+f.sn+" of level "+f.level),L.hls.trigger(A.Events.FRAG_LOADED,H),L.state===d.BACKTRACKING)){L.fragmentTracker.backtrack(f,H),L.resetFragmentLoading(f);return}L._handleFragmentLoadComplete(H)}).catch(function(H){L.warn(H),L.resetFragmentLoading(f)})},r.flushMainBuffer=function(f,T,R){if(R===void 0&&(R=null),!(f-T))return;var L={startOffset:f,endOffset:T,type:R};this.fragLoadError=0,this.hls.trigger(A.Events.BUFFER_FLUSHING,L)},r._loadInitSegment=function(f){var T=this;this._doFragLoad(f).then(function(R){if(!R||T.fragContextChanged(f)||!T.levels)throw new Error("init load aborted");return R}).then(function(R){var L=T.hls,N=R.payload,H=f.decryptdata;if(N&&N.byteLength>0&&H&&H.key&&H.iv&&H.method==="AES-128"){var K=self.performance.now();return T.decrypter.webCryptoDecrypt(new Uint8Array(N),H.key.buffer,H.iv.buffer).then(function(X){var z=self.performance.now();return L.trigger(A.Events.FRAG_DECRYPTED,{frag:f,payload:X,stats:{tstart:K,tdecrypt:z}}),R.payload=X,R})}return R}).then(function(R){var L=T.fragCurrent,N=T.hls,H=T.levels;if(!H)throw new Error("init load aborted, missing levels");var K=H[f.level].details;console.assert(K,"Level details are defined when init segment is loaded");var X=f.stats;T.state=d.IDLE,T.fragLoadError=0,f.data=new Uint8Array(R.payload),X.parsing.start=X.buffering.start=self.performance.now(),X.parsing.end=X.buffering.end=self.performance.now(),R.frag===L&&N.trigger(A.Events.FRAG_BUFFERED,{stats:X,frag:L,part:null,id:f.type}),T.tick()}).catch(function(R){T.warn(R),T.resetFragmentLoading(f)})},r.fragContextChanged=function(f){var T=this.fragCurrent;return!f||!T||f.level!==T.level||f.sn!==T.sn||f.urlId!==T.urlId},r.fragBufferedComplete=function(f,T){var R=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+f.type+" sn: "+f.sn+(T?" part: "+T.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+f.level+" "+e.default.toString(M.BufferHelper.getBuffered(R))),this.state=d.IDLE,this.tick()},r._handleFragmentLoadComplete=function(f){var T=this.transmuxer;if(!T)return;var R=f.frag,L=f.part,N=f.partsLoaded,H=!N||N.length===0||N.some(function(X){return!X}),K=new g.ChunkMetadata(R.level,R.sn,R.stats.chunkCount+1,0,L?L.index:-1,!H);T.flush(K)},r._handleFragmentLoadProgress=function(f){},r._doFragLoad=function(f,T,R,L){var N=this;if(R===void 0&&(R=null),!this.levels)throw new Error("frag load aborted, missing levels");if(R=Math.max(f.start,R||0),this.config.lowLatencyMode&&T){var H=T.partList;if(H&&L){R>f.end&&T.fragmentHint&&(f=T.fragmentHint);var K=this.getNextPart(H,f,R);if(K>-1){var X=H[K];return this.log("Loading part sn: "+f.sn+" p: "+X.index+" cc: "+f.cc+" of playlist ["+T.startSN+"-"+T.endSN+"] parts [0-"+K+"-"+(H.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(R.toFixed(3))),this.nextLoadPosition=X.start+X.duration,this.state=d.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:f,part:H[K],targetBufferTime:R}),this.doFragPartsLoad(f,H,K,L).catch(function(z){return N.handleFragLoadError(z)})}else if(!f.url||this.loadedEndOfParts(H,R))return Promise.resolve(null)}}return this.log("Loading fragment "+f.sn+" cc: "+f.cc+" "+(T?"of ["+T.startSN+"-"+T.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(R.toFixed(3))),Object(O.isFiniteNumber)(f.sn)&&!this.bitrateTest&&(this.nextLoadPosition=f.start+f.duration),this.state=d.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:f,targetBufferTime:R}),this.fragmentLoader.load(f,L).catch(function(z){return N.handleFragLoadError(z)})},r.doFragPartsLoad=function(f,T,R,L){var N=this;return new Promise(function(H,K){var X=[],z=function J(te){var ee=T[te];N.fragmentLoader.loadPart(f,ee,L).then(function(ve){X[ee.index]=ve;var re=ve.part;N.hls.trigger(A.Events.FRAG_LOADED,ve);var de=T[te+1];if(de&&de.fragment===f)J(te+1);else return H({frag:f,part:re,partsLoaded:X})}).catch(K)};z(R)})},r.handleFragLoadError=function(f){var T=f.data;return T&&T.details===_.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(T.frag,T.part):this.hls.trigger(A.Events.ERROR,T),null},r._handleTransmuxerFlush=function(f){var T=this.getCurrentContext(f);if(!T||this.state!==d.PARSING){this.fragCurrent||(this.state=d.IDLE);return}var R=T.frag,L=T.part,N=T.level,H=self.performance.now();R.stats.parsing.end=H,L&&(L.stats.parsing.end=H),this.updateLevelTiming(R,L,N,f.partial)},r.getCurrentContext=function(f){var T=this.levels,R=f.level,L=f.sn,N=f.part;if(!T||!T[R])return this.warn("Levels object was unset while buffering fragment "+L+" of level "+R+". The current chunk will not be buffered."),null;var H=T[R],K=N>-1?Object(y.getPartWith)(H,L,N):null,X=K?K.fragment:Object(y.getFragmentWithSN)(H,L,this.fragCurrent);return X?{frag:X,part:K,level:H}:null},r.bufferFragmentData=function(f,T,R,L){if(!f||this.state!==d.PARSING)return;var N=f.data1,H=f.data2,K=N;if(N&&H&&(K=Object(x.appendUint8Array)(N,H)),!K||!K.length)return;var X={type:f.type,frag:T,part:R,chunkMeta:L,parent:T.type,data:K};this.hls.trigger(A.Events.BUFFER_APPENDING,X),f.dropped&&f.independent&&!R&&this.flushBufferGap(T)},r.flushBufferGap=function(f){var T=this.media;if(!T)return;if(!M.BufferHelper.isBuffered(T,T.currentTime)){this.flushMainBuffer(0,f.start);return}var R=T.currentTime,L=M.BufferHelper.bufferInfo(T,R,0),N=f.duration,H=Math.min(this.config.maxFragLookUpTolerance*2,N*.25),K=Math.max(Math.min(f.start-H,L.end-H),R+H);f.start-K>H&&this.flushMainBuffer(K,f.start)},r.getFwdBufferInfo=function(f,T){var R=this.config,L=this.getLoadPosition();if(!Object(O.isFiniteNumber)(L))return null;var N=M.BufferHelper.bufferInfo(f,L,R.maxBufferHole);if(N.len===0&&N.nextStart!==void 0){var H=this.fragmentTracker.getBufferedFrag(L,T);if(H&&N.nextStart<H.end)return M.BufferHelper.bufferInfo(f,L,Math.max(N.nextStart,R.maxBufferHole))}return N},r.getMaxBufferLength=function(f){var T=this.config,R;return f?R=Math.max(8*T.maxBufferSize/f,T.maxBufferLength):R=T.maxBufferLength,Math.min(R,T.maxMaxBufferLength)},r.reduceMaxBufferLength=function(f){var T=this.config,R=f||T.maxBufferLength;return T.maxMaxBufferLength>=R?(T.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+T.maxMaxBufferLength+"s"),!0):!1},r.getNextFragment=function(f,T){var R,L,N=T.fragments,H=N.length;if(!H)return null;var K=this.config,X=N[0].start,z;if(T.live){var J=K.initialLiveManifestSize;if(H<J)return this.warn("Not enough fragments to start playback (have: "+H+", need: "+J+")"),null;!T.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(z=this.getInitialLiveFragment(T,N),this.startPosition=z?this.hls.liveSyncPosition||z.start:f)}else f<=X&&(z=N[0]);if(!z){var te=K.lowLatencyMode?T.partEnd:T.fragmentEnd;z=this.getFragmentAtPosition(f,te,T)}return(R=z)!==null&&R!==void 0&&R.initSegment&&!((L=z)!==null&&L!==void 0&&L.initSegment.data)&&!this.bitrateTest&&(z=z.initSegment),z},r.getNextPart=function(f,T,R){for(var L=-1,N=!1,H=!0,K=0,X=f.length;K<X;K++){var z=f[K];if(H=H&&!z.independent,L>-1&&R<z.start)break;var J=z.loaded;!J&&(N||z.independent||H)&&z.fragment===T&&(L=K),N=J}return L},r.loadedEndOfParts=function(f,T){var R=f[f.length-1];return R&&T>R.start&&R.loaded},r.getInitialLiveFragment=function(f,T){var R=this.fragPrevious,L=null;if(R){if(f.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+R.programDateTime),L=Object(v.findFragmentByPDT)(T,R.endProgramDateTime,this.config.maxFragLookUpTolerance)),!L){var N=R.sn+1;if(N>=f.startSN&&N<=f.endSN){var H=T[N-f.startSN];R.cc===H.cc&&(L=H,this.log("Live playlist, switching playlist, load frag with next SN: "+L.sn))}L||(L=Object(v.findFragWithCC)(T,R.cc),L&&this.log("Live playlist, switching playlist, load frag with same CC: "+L.sn))}}else{var K=this.hls.liveSyncPosition;K!==null&&(L=this.getFragmentAtPosition(K,this.bitrateTest?f.fragmentEnd:f.edge,f))}return L},r.getFragmentAtPosition=function(f,T,R){var L=this.config,N=this.fragPrevious,H=R.fragments,K=R.endSN,X=R.fragmentHint,z=L.maxFragLookUpTolerance,J=!!(L.lowLatencyMode&&R.partList&&X);J&&X&&!this.bitrateTest&&(H=H.concat(X),K=X.sn);var te;if(f<T){var ee=f>T-z?0:z;te=Object(v.findFragmentByPTS)(N,H,f,ee)}else te=H[H.length-1];if(te){var ve=te.sn-R.startSN,re=N&&te.level===N.level,de=H[ve+1],ie=this.fragmentTracker.getState(te);if(ie===E.FragmentState.BACKTRACKED){te=null;for(var le=ve;H[le]&&this.fragmentTracker.getState(H[le])===E.FragmentState.BACKTRACKED;)N?te=H[le--]:te=H[--le];te||(te=de)}else N&&te.sn===N.sn&&!J&&(re&&(te.sn<K&&this.fragmentTracker.getState(de)!==E.FragmentState.OK?(this.log("SN "+te.sn+" just loaded, load next one: "+de.sn),te=de):te=null))}return te},r.synchronizeToLiveEdge=function(f){var T=this.config,R=this.media;if(!R)return;var L=this.hls.liveSyncPosition,N=R.currentTime,H=f.fragments[0].start,K=f.edge,X=N>=H-T.maxFragLookUpTolerance&&N<=K;if(L!==null&&R.duration>L&&(N<L||!X)){var z=T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:T.liveMaxLatencyDurationCount*f.targetduration;(!X&&R.readyState<4||N<K-z)&&(this.loadedmetadata||(this.nextLoadPosition=L),R.readyState&&(this.warn("Playback: "+N.toFixed(3)+" is located too far from the end of live sliding playlist: "+K+", reset currentTime to : "+L.toFixed(3)),R.currentTime=L))}},r.alignPlaylists=function(f,T){var R=this.levels,L=this.levelLastLoaded,N=this.fragPrevious,H=L!==null?R[L]:null,K=f.fragments.length;if(!K)return this.warn("No fragments in live playlist"),0;var X=f.fragments[0].start,z=!T,J=f.alignedSliding&&Object(O.isFiniteNumber)(X);if(z||!J&&!X){Object(S.alignStream)(N,H,f);var te=f.fragments[0].start;return this.log("Live playlist sliding: "+te.toFixed(2)+" start-sn: "+(T?T.startSN:"na")+"->"+f.startSN+" prev-sn: "+(N?N.sn:"na")+" fragments: "+K),te}return X},r.waitForCdnTuneIn=function(f){var T=3;return f.live&&f.canBlockReload&&f.tuneInGoal>Math.max(f.partHoldBack,f.partTarget*T)},r.setStartPosition=function(f,T){var R=this.startPosition;if(R<T&&(R=-1),R===-1||this.lastCurrentTime===-1){var L=f.startTimeOffset;Object(O.isFiniteNumber)(L)?(R=T+L,L<0&&(R+=f.totalduration),R=Math.min(Math.max(T,R),T+f.totalduration),this.log("Start time offset "+L+" found in playlist, adjust startPosition to "+R),this.startPosition=R):f.live?R=this.hls.liveSyncPosition||T:this.startPosition=R=0,this.lastCurrentTime=R}this.nextLoadPosition=R},r.getLoadPosition=function(){var f=this.media,T=0;return this.loadedmetadata&&f?T=f.currentTime:this.nextLoadPosition&&(T=this.nextLoadPosition),T},r.handleFragLoadAborted=function(f,T){this.transmuxer&&f.sn!=="initSegment"&&f.stats.aborted&&(this.warn("Fragment "+f.sn+(T?" part"+T.index:"")+" of level "+f.level+" was aborted"),this.resetFragmentLoading(f))},r.resetFragmentLoading=function(f){(!this.fragCurrent||!this.fragContextChanged(f))&&(this.state=d.IDLE)},r.onFragmentOrKeyLoadError=function(f,T){if(T.fatal)return;var R=T.frag;if(!R||R.type!==f)return;var L=this.fragCurrent;console.assert(L&&R.sn===L.sn&&R.level===L.level&&R.urlId===L.urlId,"Frag load error must match current frag to retry");var N=this.config;if(this.fragLoadError+1<=N.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(R.level))return;var H=Math.min(Math.pow(2,this.fragLoadError)*N.fragLoadingRetryDelay,N.fragLoadingMaxRetryTimeout);this.warn("Fragment "+R.sn+" of "+f+" "+R.level+" failed to load, retrying in "+H+"ms"),this.retryDate=self.performance.now()+H,this.fragLoadError++,this.state=d.FRAG_LOADING_WAITING_RETRY}else T.levelRetry?(f===a.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=d.IDLE):(w.logger.error(T.details+" reaches max retry, redispatch as fatal ..."),T.fatal=!0,this.hls.stopLoad(),this.state=d.ERROR)},r.afterBufferFlushed=function(f,T,R){if(!f)return;var L=M.BufferHelper.getBuffered(f);this.fragmentTracker.detectEvictedFragments(T,L,R),this.state===d.ENDED&&this.resetLoadingState()},r.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=d.IDLE},r.resetLiveStartWhenNotLoaded=function(f){if(!this.loadedmetadata){this.startFragRequested=!1;var T=this.levels?this.levels[f].details:null;if(T!=null&&T.live)return this.startPosition=-1,this.setStartPosition(T,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},r.updateLevelTiming=function(f,T,R,L){var N=this,H=R.details;console.assert(!!H,"level.details must be defined");var K=Object.keys(f.elementaryStreams).reduce(function(X,z){var J=f.elementaryStreams[z];if(J){var te=J.endPTS-J.startPTS;if(te<=0)return N.warn("Could not parse fragment "+f.sn+" "+z+" duration reliably ("+te+") resetting transmuxer to fallback to playlist timing"),N.resetTransmuxer(),X||!1;var ee=L?0:Object(y.updateFragPTSDTS)(H,f,J.startPTS,J.endPTS,J.startDTS,J.endDTS);return N.hls.trigger(A.Events.LEVEL_PTS_UPDATED,{details:H,level:R,drift:ee,type:z,frag:f,start:J.startPTS,end:J.endPTS}),!0}return X},!1);K?(this.state=d.PARSED,this.hls.trigger(A.Events.FRAG_PARSED,{frag:f,part:T})):this.resetLoadingState()},r.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},c(t,[{key:"state",get:function(){return this._state},set:function(f){var T=this._state;T!==f&&(this._state=f,this.log(T+"->"+f))}}]),t}(C.default)},"./src/controller/buffer-controller.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return v});var O=b("./src/polyfills/number.ts"),C=b("./src/events.ts"),E=b("./src/utils/logger.ts"),M=b("./src/errors.ts"),w=b("./src/utils/buffer-helper.ts"),A=b("./src/utils/mediasource-helper.ts"),_=b("./src/loader/fragment.ts"),g=b("./src/controller/buffer-operation-queue.ts"),x=Object(A.getMediaSource)(),S=/([ha]vc.)(?:\.[^.,]+)+/,v=function(){function y(s){var e=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var a=e.hls,n=e.media,c=e.mediaSource;E.logger.log("[buffer-controller]: Media source opened"),n&&(e.updateMediaElementDuration(),a.trigger(C.Events.MEDIA_ATTACHED,{media:n})),c&&c.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){E.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){E.logger.log("[buffer-controller]: Media source ended")},this.hls=s,this._initSourceBuffer(),this.registerListeners()}var p=y.prototype;return p.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},p.destroy=function(){this.unregisterListeners(),this.details=null},p.registerListeners=function(){var e=this.hls;e.on(C.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(C.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(C.Events.BUFFER_RESET,this.onBufferReset,this),e.on(C.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(C.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(C.Events.BUFFER_EOS,this.onBufferEos,this),e.on(C.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(C.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(C.Events.FRAG_PARSED,this.onFragParsed,this),e.on(C.Events.FRAG_CHANGED,this.onFragChanged,this)},p.unregisterListeners=function(){var e=this.hls;e.off(C.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(C.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(C.Events.BUFFER_RESET,this.onBufferReset,this),e.off(C.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(C.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(C.Events.BUFFER_EOS,this.onBufferEos,this),e.off(C.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(C.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(C.Events.FRAG_PARSED,this.onFragParsed,this),e.off(C.Events.FRAG_CHANGED,this.onFragChanged,this)},p._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},p.onManifestParsed=function(e,a){var n=2;(a.audio&&!a.video||!a.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.details=null,E.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},p.onMediaAttaching=function(e,a){var n=this.media=a.media;if(n&&x){var c=this.mediaSource=new x;c.addEventListener("sourceopen",this._onMediaSourceOpen),c.addEventListener("sourceended",this._onMediaSourceEnded),c.addEventListener("sourceclose",this._onMediaSourceClose),n.src=self.URL.createObjectURL(c),this._objectUrl=n.src}},p.onMediaDetaching=function(){var e=this.media,a=this.mediaSource,n=this._objectUrl;if(a){if(E.logger.log("[buffer-controller]: media source detaching"),a.readyState==="open")try{a.endOfStream()}catch(c){E.logger.warn("[buffer-controller]: onMediaDetaching: "+c.message+" while calling endOfStream")}this.onBufferReset(),a.removeEventListener("sourceopen",this._onMediaSourceOpen),a.removeEventListener("sourceended",this._onMediaSourceEnded),a.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(n&&self.URL.revokeObjectURL(n),e.src===n?(e.removeAttribute("src"),e.load()):E.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(C.Events.MEDIA_DETACHED,void 0)},p.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(a){var n=e.sourceBuffer[a];try{n&&(e.removeBufferListeners(a),e.mediaSource&&e.mediaSource.removeSourceBuffer(n),e.sourceBuffer[a]=void 0)}catch(c){E.logger.warn("[buffer-controller]: Failed to reset the "+a+" buffer",c)}}),this._initSourceBuffer()},p.onBufferCodecs=function(e,a){var n=this,c=this.getSourceBufferTypes().length;if(Object.keys(a).forEach(function(l){if(c){var u=n.tracks[l];if(u&&typeof u.buffer.changeType=="function"){var m=a[l],d=m.codec,o=m.levelCodec,i=m.container,t=(u.levelCodec||u.codec).replace(S,"$1"),r=(o||d).replace(S,"$1");if(t!==r){var h=i+";codecs="+(o||d);n.appendChangeType(l,h)}}}else n.pendingTracks[l]=a[l]}),c)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},p.appendChangeType=function(e,a){var n=this,c=this.operationQueue,l={execute:function(){var m=n.sourceBuffer[e];m&&(E.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+a),m.changeType(a)),c.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(m){E.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",m)}};c.append(l,e)},p.onBufferAppending=function(e,a){var n=this,c=this.hls,l=this.operationQueue,u=this.tracks,m=a.data,d=a.type,o=a.frag,i=a.part,t=a.chunkMeta,r=t.buffering[d],h=self.performance.now();r.start=h;var f=o.stats.buffering,T=i?i.stats.buffering:null;f.start===0&&(f.start=h),T&&T.start===0&&(T.start=h);var R=u.audio,L=d==="audio"&&t.id===1&&(R==null?void 0:R.container)==="audio/mpeg",N={execute:function(){if(r.executeStart=self.performance.now(),L){var K=n.sourceBuffer[d];if(K){var X=o.start-K.timestampOffset;Math.abs(X)>=.1&&(E.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+o.start+" (delta: "+X+") sn: "+o.sn+")"),K.timestampOffset=o.start)}}n.appendExecutor(m,d)},onStart:function(){},onComplete:function(){var K=self.performance.now();r.executeEnd=r.end=K,f.first===0&&(f.first=K),T&&T.first===0&&(T.first=K);var X=n.sourceBuffer,z={};for(var J in X)z[J]=w.BufferHelper.getBuffered(X[J]);n.appendError=0,n.hls.trigger(C.Events.BUFFER_APPENDED,{type:d,frag:o,part:i,chunkMeta:t,parent:o.type,timeRanges:z})},onError:function(K){E.logger.error("[buffer-controller]: Error encountered while trying to append to the "+d+" SourceBuffer",K);var X={type:M.ErrorTypes.MEDIA_ERROR,parent:o.type,details:M.ErrorDetails.BUFFER_APPEND_ERROR,err:K,fatal:!1};K.code===DOMException.QUOTA_EXCEEDED_ERR?X.details=M.ErrorDetails.BUFFER_FULL_ERROR:(n.appendError++,X.details=M.ErrorDetails.BUFFER_APPEND_ERROR,n.appendError>c.config.appendErrorMaxRetry&&(E.logger.error("[buffer-controller]: Failed "+c.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),X.fatal=!0)),c.trigger(C.Events.ERROR,X)}};l.append(N,d)},p.onBufferFlushing=function(e,a){var n=this,c=this.operationQueue,l=function(m){return{execute:n.removeExecutor.bind(n,m,a.startOffset,a.endOffset),onStart:function(){},onComplete:function(){n.hls.trigger(C.Events.BUFFER_FLUSHED,{type:m})},onError:function(o){E.logger.warn("[buffer-controller]: Failed to remove from "+m+" SourceBuffer",o)}}};a.type?c.append(l(a.type),a.type):this.getSourceBufferTypes().forEach(function(u){c.append(l(u),u)})},p.onFragParsed=function(e,a){var n=this,c=a.frag,l=a.part,u=[],m=l?l.elementaryStreams:c.elementaryStreams;m[_.ElementaryStreamTypes.AUDIOVIDEO]?u.push("audiovideo"):(m[_.ElementaryStreamTypes.AUDIO]&&u.push("audio"),m[_.ElementaryStreamTypes.VIDEO]&&u.push("video"));var d=function(){var i=self.performance.now();c.stats.buffering.end=i,l&&(l.stats.buffering.end=i);var t=l?l.stats:c.stats;n.hls.trigger(C.Events.FRAG_BUFFERED,{frag:c,part:l,stats:t,id:c.type})};u.length===0&&E.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+c.type+" level: "+c.level+" sn: "+c.sn),this.blockBuffers(d,u)},p.onFragChanged=function(e,a){this.flushBackBuffer()},p.onBufferEos=function(e,a){var n=this,c=this.getSourceBufferTypes().reduce(function(l,u){var m=n.sourceBuffer[u];return(!a.type||a.type===u)&&(m&&!m.ended&&(m.ended=!0,E.logger.log("[buffer-controller]: "+u+" sourceBuffer now EOS"))),l&&!!(!m||m.ended)},!0);c&&this.blockBuffers(function(){var l=n.mediaSource;if(!l||l.readyState!=="open")return;l.endOfStream()})},p.onLevelUpdated=function(e,a){var n=a.details;if(!n.fragments.length)return;this.details=n,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},p.flushBackBuffer=function(){var e=this.hls,a=this.details,n=this.media,c=this.sourceBuffer;if(!n||a===null)return;var l=this.getSourceBufferTypes();if(!l.length)return;var u=a.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!Object(O.isFiniteNumber)(u)||u<0)return;var m=n.currentTime,d=a.levelTargetDuration,o=Math.max(u,d),i=Math.floor(m/d)*d-o;l.forEach(function(t){var r=c[t];if(r){var h=w.BufferHelper.getBuffered(r);h.length>0&&i>h.start(0)&&(e.trigger(C.Events.BACK_BUFFER_REACHED,{bufferEnd:i}),a.live&&e.trigger(C.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i}),e.trigger(C.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:t}))}})},p.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var e=this.details,a=this.hls,n=this.media,c=this.mediaSource,l=e.fragments[0].start+e.totalduration,u=n.duration,m=Object(O.isFiniteNumber)(c.duration)?c.duration:0;e.live&&a.config.liveDurationInfinity?(E.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),c.duration=Infinity,this.updateSeekableRange(e)):(l>m&&l>u||!Object(O.isFiniteNumber)(u))&&(E.logger.log("[buffer-controller]: Updating Media Source duration to "+l.toFixed(3)),c.duration=l)},p.updateSeekableRange=function(e){var a=this.mediaSource,n=e.fragments,c=n.length;if(c&&e.live&&a!==null&&a!==void 0&&a.setLiveSeekableRange){var l=Math.max(0,n[0].start),u=Math.max(l,l+e.totalduration);a.setLiveSeekableRange(l,u)}},p.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,a=this.operationQueue,n=this.pendingTracks,c=Object.keys(n).length;if(c&&!e||c===2){this.createSourceBuffers(n),this.pendingTracks={};var l=this.getSourceBufferTypes();if(l.length===0){this.hls.trigger(C.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}l.forEach(function(u){a.executeNext(u)})}},p.createSourceBuffers=function(e){var a=this.sourceBuffer,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");var c=0;for(var l in e)if(!a[l]){var u=e[l];if(!u)throw Error("source buffer exists for track "+l+", however track does not");var m=u.levelCodec||u.codec,d=u.container+";codecs="+m;E.logger.log("[buffer-controller]: creating sourceBuffer("+d+")");try{var o=a[l]=n.addSourceBuffer(d),i=l;this.addBufferListener(i,"updatestart",this._onSBUpdateStart),this.addBufferListener(i,"updateend",this._onSBUpdateEnd),this.addBufferListener(i,"error",this._onSBUpdateError),this.tracks[l]={buffer:o,codec:m,container:u.container,levelCodec:u.levelCodec,id:u.id},c++}catch(t){E.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+t.message),this.hls.trigger(C.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,mimeType:d})}}c&&this.hls.trigger(C.Events.BUFFER_CREATED,{tracks:this.tracks})},p._onSBUpdateStart=function(e){var a=this.operationQueue,n=a.current(e);n.onStart()},p._onSBUpdateEnd=function(e){var a=this.operationQueue,n=a.current(e);n.onComplete(),a.shiftAndExecuteNext(e)},p._onSBUpdateError=function(e,a){E.logger.error("[buffer-controller]: "+e+" SourceBuffer error",a),this.hls.trigger(C.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var n=this.operationQueue.current(e);n&&n.onError(a)},p.removeExecutor=function(e,a,n){var c=this.media,l=this.mediaSource,u=this.operationQueue,m=this.sourceBuffer,d=m[e];if(!c||!l||!d){E.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(e);return}var o=Object(O.isFiniteNumber)(c.duration)?c.duration:Infinity,i=Object(O.isFiniteNumber)(l.duration)?l.duration:Infinity,t=Math.max(0,a),r=Math.min(n,o,i);r>t?(E.logger.log("[buffer-controller]: Removing ["+t+","+r+"] from the "+e+" SourceBuffer"),console.assert(!d.updating,e+" sourceBuffer must not be updating"),d.remove(t,r)):u.shiftAndExecuteNext(e)},p.appendExecutor=function(e,a){var n=this.operationQueue,c=this.sourceBuffer,l=c[a];if(!l){E.logger.warn("[buffer-controller]: Attempting to append to the "+a+" SourceBuffer, but it does not exist"),n.shiftAndExecuteNext(a);return}l.ended=!1,console.assert(!l.updating,a+" sourceBuffer must not be updating"),l.appendBuffer(e)},p.blockBuffers=function(e,a){var n=this;if(a===void 0&&(a=this.getSourceBufferTypes()),!a.length){E.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(e);return}var c=this.operationQueue,l=a.map(function(u){return c.appendBlocker(u)});Promise.all(l).then(function(){e(),a.forEach(function(u){var m=n.sourceBuffer[u];(!m||!m.updating)&&c.shiftAndExecuteNext(u)})})},p.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},p.addBufferListener=function(e,a,n){var c=this.sourceBuffer[e];if(!c)return;var l=n.bind(this,e);this.listeners[e].push({event:a,listener:l}),c.addEventListener(a,l)},p.removeBufferListeners=function(e){var a=this.sourceBuffer[e];if(!a)return;this.listeners[e].forEach(function(n){a.removeEventListener(n.event,n.listener)})},y}()},"./src/controller/buffer-operation-queue.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return C});var O=b("./src/utils/logger.ts"),C=function(){function E(w){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=w}var M=E.prototype;return M.append=function(A,_){var g=this.queues[_];g.push(A),g.length===1&&this.buffers[_]&&this.executeNext(_)},M.insertAbort=function(A,_){var g=this.queues[_];g.unshift(A),this.executeNext(_)},M.appendBlocker=function(A){var _,g=new Promise(function(S){_=S}),x={execute:_,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(x,A),g},M.executeNext=function(A){var _=this.buffers,g=this.queues,x=_[A],S=g[A];if(S.length){var v=S[0];try{v.execute()}catch(y){O.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),v.onError(y),(!x||!x.updating)&&(S.shift(),this.executeNext(A))}}},M.shiftAndExecuteNext=function(A){this.queues[A].shift(),this.executeNext(A)},M.current=function(A){return this.queues[A][0]},E}()},"./src/controller/cap-level-controller.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/events.ts");function C(w,A){for(var _=0;_<A.length;_++){var g=A[_];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(w,g.key,g)}}function E(w,A,_){return A&&C(w.prototype,A),_&&C(w,_),w}var M=function(){function w(_){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=_,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var A=w.prototype;return A.setStreamController=function(g){this.streamController=g},A.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},A.registerListeners=function(){var g=this.hls;g.on(O.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.unregisterListener=function(){var g=this.hls;g.off(O.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.onFpsDropLevelCapping=function(g,x){w.isLevelAllowed(x.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(x.droppedLevel)},A.onMediaAttaching=function(g,x){this.media=x.media instanceof HTMLVideoElement?x.media:null},A.onManifestParsed=function(g,x){var S=this.hls;this.restrictedLevels=[],this.firstLevel=x.firstLevel,S.config.capLevelToPlayerSize&&x.video&&this.startCapping()},A.onBufferCodecs=function(g,x){var S=this.hls;S.config.capLevelToPlayerSize&&x.video&&this.startCapping()},A.onMediaDetaching=function(){this.stopCapping()},A.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var x=this.hls;x.autoLevelCapping=this.getMaxLevel(g.length-1),x.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=x.autoLevelCapping}}},A.getMaxLevel=function(g){var x=this,S=this.hls.levels;if(!S.length)return-1;var v=S.filter(function(y,p){return w.isLevelAllowed(p,x.restrictedLevels)&&p<=g});return this.clientRect=null,w.getMaxLevelByMediaSize(v,this.mediaWidth,this.mediaHeight)},A.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},A.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},A.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,x={width:0,height:0};if(g){var S=g.getBoundingClientRect();x.width=S.width,x.height=S.height,!x.width&&!x.height&&(x.width=S.right-S.left||g.width||0,x.height=S.bottom-S.top||g.height||0)}return this.clientRect=x,x},w.isLevelAllowed=function(g,x){return x===void 0&&(x=[]),x.indexOf(g)===-1},w.getMaxLevelByMediaSize=function(g,x,S){if(!g||!g.length)return-1;for(var v=function(a,n){return n?a.width!==n.width||a.height!==n.height:!0},y=g.length-1,p=0;p<g.length;p+=1){var s=g[p];if((s.width>=x||s.height>=S)&&v(s,g[p+1])){y=p;break}}return y},E(w,[{key:"mediaWidth",get:function(){return this.getDimensions().width*w.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*w.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(x){}return g}}]),w}();k.default=M},"./src/controller/cmcd-controller.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return v});var O=b("./src/events.ts"),C=b("./src/types/cmcd.ts"),E=b("./src/utils/buffer-helper.ts"),M=b("./src/utils/logger.ts");function w(y,p){for(var s=0;s<p.length;s++){var e=p[s];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(y,e.key,e)}}function A(y,p,s){return p&&w(y.prototype,p),s&&w(y,s),y}function _(y,p){var s=typeof Symbol!="undefined"&&y[Symbol.iterator]||y["@@iterator"];if(s)return(s=s.call(y)).next.bind(s);if(Array.isArray(y)||(s=g(y))||p&&y&&typeof y.length=="number"){s&&(y=s);var e=0;return function(){return e>=y.length?{done:!0}:{done:!1,value:y[e++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g(y,p){if(!y)return;if(typeof y=="string")return x(y,p);var s=Object.prototype.toString.call(y).slice(8,-1);if(s==="Object"&&y.constructor&&(s=y.constructor.name),s==="Map"||s==="Set")return Array.from(y);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return x(y,p)}function x(y,p){(p==null||p>y.length)&&(p=y.length);for(var s=0,e=new Array(p);s<p;s++)e[s]=y[s];return e}function S(){return S=Object.assign||function(y){for(var p=1;p<arguments.length;p++){var s=arguments[p];for(var e in s)Object.prototype.hasOwnProperty.call(s,e)&&(y[e]=s[e])}return y},S.apply(this,arguments)}var v=function(){function y(s){var e=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){e.initialized&&(e.starved=!0),e.buffering=!0},this.onPlaying=function(){e.initialized||(e.initialized=!0),e.buffering=!1},this.applyPlaylistData=function(c){try{e.apply(c,{ot:C.CMCDObjectType.MANIFEST,su:!e.initialized})}catch(l){M.logger.warn("Could not generate manifest CMCD data.",l)}},this.applyFragmentData=function(c){try{var l=c.frag,u=e.hls.levels[l.level],m=e.getObjectType(l),d={d:l.duration*1e3,ot:m};(m===C.CMCDObjectType.VIDEO||m===C.CMCDObjectType.AUDIO||m==C.CMCDObjectType.MUXED)&&(d.br=u.bitrate/1e3,d.tb=e.getTopBandwidth(m),d.bl=e.getBufferLength(m)),e.apply(c,d)}catch(o){M.logger.warn("Could not generate segment CMCD data.",o)}},this.hls=s;var a=this.config=s.config,n=a.cmcd;n!=null&&(a.pLoader=this.createPlaylistLoader(),a.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||y.uuid(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.registerListeners())}var p=y.prototype;return p.registerListeners=function(){var e=this.hls;e.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(O.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this)},p.unregisterListeners=function(){var e=this.hls;e.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(O.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},p.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},p.onMediaAttached=function(e,a){this.media=a.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},p.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},p.onBufferCreated=function(e,a){var n,c;this.audioBuffer=(n=a.tracks.audio)===null||n===void 0?void 0:n.buffer,this.videoBuffer=(c=a.tracks.video)===null||c===void 0?void 0:c.buffer},p.createData=function(){var e;return{v:C.CMCDVersion,sf:C.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)===null||e===void 0?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},p.apply=function(e,a){a===void 0&&(a={}),S(a,this.createData());var n=a.ot===C.CMCDObjectType.INIT||a.ot===C.CMCDObjectType.VIDEO||a.ot===C.CMCDObjectType.MUXED;if(this.starved&&n&&(a.bs=!0,a.su=!0,this.starved=!1),a.su==null&&(a.su=this.buffering),this.useHeaders){var c=y.toHeaders(a);if(!Object.keys(c).length)return;e.headers||(e.headers={}),S(e.headers,c)}else{var l=y.toQuery(a);if(!l)return;e.url=y.appendQueryToUri(e.url,l)}},p.getObjectType=function(e){var a=e.type;return a==="subtitle"?C.CMCDObjectType.TIMED_TEXT:e.sn==="initSegment"?C.CMCDObjectType.INIT:a==="audio"?C.CMCDObjectType.AUDIO:a==="main"?this.hls.audioTracks.length?C.CMCDObjectType.VIDEO:C.CMCDObjectType.MUXED:void 0},p.getTopBandwidth=function(e){for(var a=0,n=e===C.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,c=_(n),l;!(l=c()).done;){var u=l.value;u.bitrate>a&&(a=u.bitrate)}return a>0?a:NaN},p.getBufferLength=function(e){var a=this.hls.media,n=e===C.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!n||!a)return NaN;var c=E.BufferHelper.bufferInfo(n,a.currentTime,this.config.maxBufferHole);return c.len*1e3},p.createPlaylistLoader=function(){var e=this.config.pLoader,a=this.applyPlaylistData,n=e||this.config.loader;return function(){function c(u){this.loader=void 0,this.loader=new n(u)}var l=c.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(m,d,o){a(m),this.loader.load(m,d,o)},A(c,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),c}()},p.createFragmentLoader=function(){var e=this.config.fLoader,a=this.applyFragmentData,n=e||this.config.loader;return function(){function c(u){this.loader=void 0,this.loader=new n(u)}var l=c.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(m,d,o){a(m),this.loader.load(m,d,o)},A(c,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),c}()},y.uuid=function(){var e=URL.createObjectURL(new Blob),a=e.toString();return URL.revokeObjectURL(e),a.substr(a.lastIndexOf("/")+1)},y.serialize=function(e){for(var a=[],n=function(L){return!Number.isNaN(L)&&L!=null&&L!==""&&L!==!1},c=function(L){return Math.round(L)},l=function(L){return c(L/100)*100},u=function(L){return encodeURIComponent(L)},m={br:c,d:c,bl:l,dl:l,mtp:l,nor:u,rtp:l,tb:c},d=Object.keys(e||{}).sort(),o=_(d),i;!(i=o()).done;){var t=i.value,r=e[t];if(!n(r))continue;if(t==="v"&&r===1)continue;if(t=="pr"&&r===1)continue;var h=m[t];h&&(r=h(r));var f=typeof r,T=void 0;t==="ot"||t==="sf"||t==="st"?T=t+"="+r:f==="boolean"?T=t:f==="number"?T=t+"="+r:T=t+"="+JSON.stringify(r),a.push(T)}return a.join(",")},y.toHeaders=function(e){for(var a=Object.keys(e),n={},c=["Object","Request","Session","Status"],l=[{},{},{},{}],u={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},m=0,d=a;m<d.length;m++){var o=d[m],i=u[o]!=null?u[o]:1;l[i][o]=e[o]}for(var t=0;t<l.length;t++){var r=y.serialize(l[t]);r&&(n["CMCD-"+c[t]]=r)}return n},y.toQuery=function(e){return"CMCD="+encodeURIComponent(y.serialize(e))},y.appendQueryToUri=function(e,a){if(!a)return e;var n=e.includes("?")?"&":"?";return""+e+n+a},y}()},"./src/controller/eme-controller.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/events.ts"),C=b("./src/errors.ts"),E=b("./src/utils/logger.ts"),M=b("./src/utils/mediakeys-helper.ts");function w(v,y){for(var p=0;p<y.length;p++){var s=y[p];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(v,s.key,s)}}function A(v,y,p){return y&&w(v.prototype,y),p&&w(v,p),v}var _=3,g=function(y,p,s){var e={audioCapabilities:[],videoCapabilities:[]};return y.forEach(function(a){e.audioCapabilities.push({contentType:'audio/mp4; codecs="'+a+'"',robustness:s.audioRobustness||""})}),p.forEach(function(a){e.videoCapabilities.push({contentType:'video/mp4; codecs="'+a+'"',robustness:s.videoRobustness||""})}),[e]},x=function(y,p,s,e){switch(y){case M.KeySystems.WIDEVINE:return g(p,s,e);default:throw new Error("Unknown key-system: "+y)}},S=function(){function v(p){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=p,this._config=p.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var y=v.prototype;return y.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},y._registerListeners=function(){this.hls.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(O.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(O.Events.MANIFEST_PARSED,this.onManifestParsed,this)},y._unregisterListeners=function(){this.hls.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(O.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(O.Events.MANIFEST_PARSED,this.onManifestParsed,this)},y.getLicenseServerUrl=function(s){switch(s){case M.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+s+'"')},y._attemptKeySystemAccess=function(s,e,a){var n=this,c=x(s,e,a,this._drmSystemOptions);E.logger.log("Requesting encrypted media key-system access");var l=this.requestMediaKeySystemAccess(s,c);this.mediaKeysPromise=l.then(function(u){return n._onMediaKeySystemAccessObtained(s,u)}),l.catch(function(u){E.logger.error('Failed to obtain key-system "'+s+'" access:',u)})},y._onMediaKeySystemAccessObtained=function(s,e){var a=this;E.logger.log('Access for key-system "'+s+'" obtained');var n={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:s};this._mediaKeysList.push(n);var c=Promise.resolve().then(function(){return e.createMediaKeys()}).then(function(l){return n.mediaKeys=l,E.logger.log('Media-keys created for key-system "'+s+'"'),a._onMediaKeysCreated(),l});return c.catch(function(l){E.logger.error("Failed to create media-keys:",l)}),c},y._onMediaKeysCreated=function(){var s=this;this._mediaKeysList.forEach(function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),s._onNewMediaKeySession(e.mediaKeysSession))})},y._onNewMediaKeySession=function(s){var e=this;E.logger.log("New key-system session "+s.sessionId),s.addEventListener("message",function(a){e._onKeySessionMessage(s,a.message)},!1)},y._onKeySessionMessage=function(s,e){E.logger.log("Got EME message event, creating license request"),this._requestLicense(e,function(a){E.logger.log("Received license data (length: "+(a&&a.byteLength)+"), updating key-session"),s.update(a)})},y.onMediaEncrypted=function(s){var e=this;if(E.logger.log('Media is encrypted using "'+s.initDataType+'" init data type'),!this.mediaKeysPromise){E.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var a=function(c){if(!e._media)return;e._attemptSetMediaKeys(c),e._generateRequestWithPreferredKeySession(s.initDataType,s.initData)};this.mediaKeysPromise.then(a).catch(a)},y._attemptSetMediaKeys=function(s){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var e=this._mediaKeysList[0];if(!e||!e.mediaKeys){E.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}E.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},y._generateRequestWithPreferredKeySession=function(s,e){var a=this,n=this._mediaKeysList[0];if(!n){E.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(n.mediaKeysSessionInitialized){E.logger.warn("Key-Session already initialized but requested again");return}var c=n.mediaKeysSession;if(!c){E.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!e){E.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}E.logger.log('Generating key-session request for "'+s+'" init data type'),n.mediaKeysSessionInitialized=!0,c.generateRequest(s,e).then(function(){E.logger.debug("Key-session generation succeeded")}).catch(function(l){E.logger.error("Error generating key-session request:",l),a.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},y._createLicenseXhr=function(s,e,a){var n=new XMLHttpRequest;n.responseType="arraybuffer",n.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,n,s,e,a);var c=this._licenseXhrSetup;if(c)try{c.call(this.hls,n,s),c=void 0}catch(l){E.logger.error(l)}try{n.readyState||n.open("POST",s,!0),c&&c.call(this.hls,n,s)}catch(l){throw new Error("issue setting up KeySystem license XHR "+l)}return n},y._onLicenseRequestReadyStageChange=function(s,e,a,n){switch(s.readyState){case 4:if(s.status===200){this._requestLicenseFailureCount=0,E.logger.log("License request succeeded");var c=s.response,l=this._licenseResponseCallback;if(l)try{c=l.call(this.hls,s,e)}catch(m){E.logger.error(m)}n(c)}else{if(E.logger.error("License Request XHR failed ("+e+"). Status: "+s.status+" ("+s.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>_){this.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var u=_-this._requestLicenseFailureCount+1;E.logger.warn("Retrying license request, "+u+" attempts left"),this._requestLicense(a,n)}break}},y._generateLicenseRequestChallenge=function(s,e){switch(s.mediaKeySystemDomain){case M.KeySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+s.mediaKeySystemDomain)},y._requestLicense=function(s,e){E.logger.log("Requesting content license for key-system");var a=this._mediaKeysList[0];if(!a){E.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var n=this.getLicenseServerUrl(a.mediaKeySystemDomain),c=this._createLicenseXhr(n,s,e);E.logger.log("Sending license request to URL: "+n);var l=this._generateLicenseRequestChallenge(a,s);c.send(l)}catch(u){E.logger.error("Failure requesting DRM license: "+u),this.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},y.onMediaAttached=function(s,e){if(!this._emeEnabled)return;var a=e.media;this._media=a,a.addEventListener("encrypted",this._onMediaEncrypted)},y.onMediaDetached=function(){var s=this._media,e=this._mediaKeysList;if(!s)return;s.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(e.map(function(a){if(a.mediaKeysSession)return a.mediaKeysSession.close().catch(function(){})})).then(function(){return s.setMediaKeys(null)}).catch(function(){})},y.onManifestParsed=function(s,e){if(!this._emeEnabled)return;var a=e.levels.map(function(c){return c.audioCodec}).filter(function(c){return!!c}),n=e.levels.map(function(c){return c.videoCodec}).filter(function(c){return!!c});this._attemptKeySystemAccess(M.KeySystems.WIDEVINE,a,n)},A(v,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),v}();k.default=S},"./src/controller/fps-controller.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/events.ts"),C=b("./src/utils/logger.ts"),E=function(){function M(A){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=A,this.registerListeners()}var w=M.prototype;return w.setStreamController=function(_){this.streamController=_},w.registerListeners=function(){this.hls.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},w.unregisterListeners=function(){this.hls.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching)},w.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},w.onMediaAttaching=function(_,g){var x=this.hls.config;if(x.capLevelOnFPSDrop){var S=g.media instanceof self.HTMLVideoElement?g.media:null;this.media=S,S&&typeof S.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),x.fpsDroppedMonitoringPeriod)}},w.checkFPS=function(_,g,x){var S=performance.now();if(g){if(this.lastTime){var v=S-this.lastTime,y=x-this.lastDroppedFrames,p=g-this.lastDecodedFrames,s=1e3*y/v,e=this.hls;if(e.trigger(O.Events.FPS_DROP,{currentDropped:y,currentDecoded:p,totalDroppedFrames:x}),s>0&&y>e.config.fpsDroppedMonitoringThreshold*p){var a=e.currentLevel;C.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+a),a>0&&(e.autoLevelCapping===-1||e.autoLevelCapping>=a)&&(a=a-1,e.trigger(O.Events.FPS_DROP_LEVEL_CAPPING,{level:a,droppedLevel:e.currentLevel}),e.autoLevelCapping=a,this.streamController.nextLevelSwitch())}}this.lastTime=S,this.lastDroppedFrames=x,this.lastDecodedFrames=g}},w.checkFPSInterval=function(){var _=this.media;if(_)if(this.isVideoPlaybackQualityAvailable){var g=_.getVideoPlaybackQuality();this.checkFPS(_,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(_,_.webkitDecodedFrameCount,_.webkitDroppedFrameCount)},M}();k.default=E},"./src/controller/fragment-finders.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"findFragmentByPDT",function(){return E}),b.d(k,"findFragmentByPTS",function(){return M}),b.d(k,"fragmentWithinToleranceTest",function(){return w}),b.d(k,"pdtWithinToleranceTest",function(){return A}),b.d(k,"findFragWithCC",function(){return _});var O=b("./src/polyfills/number.ts"),C=b("./src/utils/binary-search.ts");function E(g,x,S){if(x===null||!Array.isArray(g)||!g.length||!Object(O.isFiniteNumber)(x))return null;var v=g[0].programDateTime;if(x<(v||0))return null;var y=g[g.length-1].endProgramDateTime;if(x>=(y||0))return null;S=S||0;for(var p=0;p<g.length;++p){var s=g[p];if(A(x,S,s))return s}return null}function M(g,x,S,v){S===void 0&&(S=0),v===void 0&&(v=0);var y=null;if(g?y=x[g.sn-x[0].sn+1]||null:S===0&&x[0].start===0&&(y=x[0]),y&&w(S,v,y)===0)return y;var p=C.default.search(x,w.bind(null,S,v));return p||y}function w(g,x,S){g===void 0&&(g=0),x===void 0&&(x=0);var v=Math.min(x,S.duration+(S.deltaPTS?S.deltaPTS:0));return S.start+S.duration-v<=g?1:S.start-v>g&&S.start?-1:0}function A(g,x,S){var v=Math.min(x,S.duration+(S.deltaPTS?S.deltaPTS:0))*1e3,y=S.endProgramDateTime||0;return y-v>g}function _(g,x){return C.default.search(g,function(S){return S.cc<x?1:S.cc>x?-1:0})}},"./src/controller/fragment-tracker.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"FragmentState",function(){return E}),b.d(k,"FragmentTracker",function(){return M});var O=b("./src/events.ts"),C=b("./src/types/loader.ts"),E;(function(_){_.NOT_LOADED="NOT_LOADED",_.BACKTRACKED="BACKTRACKED",_.APPENDING="APPENDING",_.PARTIAL="PARTIAL",_.OK="OK"})(E||(E={}));var M=function(){function _(x){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=x,this._registerListeners()}var g=_.prototype;return g._registerListeners=function(){var S=this.hls;S.on(O.Events.BUFFER_APPENDED,this.onBufferAppended,this),S.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),S.on(O.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var S=this.hls;S.off(O.Events.BUFFER_APPENDED,this.onBufferAppended,this),S.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),S.off(O.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(S,v){if(v===C.PlaylistLevelType.MAIN){var y=this.activeFragment,p=this.activeParts;if(!y)return null;if(p)for(var s=p.length;s--;){var e=p[s],a=e?e.end:y.appendedPTS;if(e.start<=S&&a!==void 0&&S<=a)return s>9&&(this.activeParts=p.slice(s-9)),e}else if(y.start<=S&&y.appendedPTS!==void 0&&S<=y.appendedPTS)return y}return this.getBufferedFrag(S,v)},g.getBufferedFrag=function(S,v){for(var y=this.fragments,p=Object.keys(y),s=p.length;s--;){var e=y[p[s]];if((e==null?void 0:e.body.type)===v&&e.buffered){var a=e.body;if(a.start<=S&&S<=a.end)return a}}return null},g.detectEvictedFragments=function(S,v,y){var p=this;Object.keys(this.fragments).forEach(function(s){var e=p.fragments[s];if(!e)return;if(!e.buffered){e.body.type===y&&p.removeFragment(e.body);return}var a=e.range[S];if(!a)return;a.time.some(function(n){var c=!p.isTimeBuffered(n.startPTS,n.endPTS,v);return c&&p.removeFragment(e.body),c})})},g.detectPartialFragments=function(S){var v=this,y=this.timeRanges,p=S.frag,s=S.part;if(!y||p.sn==="initSegment")return;var e=A(p),a=this.fragments[e];if(!a)return;Object.keys(y).forEach(function(n){var c=p.elementaryStreams[n];if(!c)return;var l=y[n],u=s!==null||c.partial===!0;a.range[n]=v.getBufferedTimes(p,s,u,l)}),a.backtrack=a.loaded=null,Object.keys(a.range).length?a.buffered=!0:this.removeFragment(a.body)},g.fragBuffered=function(S){var v=A(S),y=this.fragments[v];y&&(y.backtrack=y.loaded=null,y.buffered=!0)},g.getBufferedTimes=function(S,v,y,p){for(var s={time:[],partial:y},e=v?v.start:S.start,a=v?v.end:S.end,n=S.minEndPTS||a,c=S.maxStartPTS||e,l=0;l<p.length;l++){var u=p.start(l)-this.bufferPadding,m=p.end(l)+this.bufferPadding;if(c>=u&&n<=m){s.time.push({startPTS:Math.max(e,p.start(l)),endPTS:Math.min(a,p.end(l))});break}else if(e<m&&a>u)s.partial=!0,s.time.push({startPTS:Math.max(e,p.start(l)),endPTS:Math.min(a,p.end(l))});else if(a<=u)break}return s},g.getPartialFragment=function(S){var v=null,y,p,s,e=0,a=this.bufferPadding,n=this.fragments;return Object.keys(n).forEach(function(c){var l=n[c];if(!l)return;w(l)&&(p=l.body.start-a,s=l.body.end+a,S>=p&&S<=s&&(y=Math.min(S-p,s-S),e<=y&&(v=l.body,e=y)))}),v},g.getState=function(S){var v=A(S),y=this.fragments[v];return y?y.buffered?w(y)?E.PARTIAL:E.OK:y.backtrack?E.BACKTRACKED:E.APPENDING:E.NOT_LOADED},g.backtrack=function(S,v){var y=A(S),p=this.fragments[y];if(!p||p.backtrack)return null;var s=p.backtrack=v||p.loaded;return p.loaded=null,s},g.getBacktrackData=function(S){var v=A(S),y=this.fragments[v];if(y){var p,s=y.backtrack;if(s!=null&&(p=s.payload)!==null&&p!==void 0&&p.byteLength)return s;this.removeFragment(S)}return null},g.isTimeBuffered=function(S,v,y){for(var p,s,e=0;e<y.length;e++){if(p=y.start(e)-this.bufferPadding,s=y.end(e)+this.bufferPadding,S>=p&&v<=s)return!0;if(v<=p)return!1}return!1},g.onFragLoaded=function(S,v){var y=v.frag,p=v.part;if(y.sn==="initSegment"||y.bitrateTest||p)return;var s=A(y);this.fragments[s]={body:y,loaded:v,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(S,v){var y=this,p=v.frag,s=v.part,e=v.timeRanges;if(p.type===C.PlaylistLevelType.MAIN)if(this.activeFragment=p,s){var a=this.activeParts;a||(this.activeParts=a=[]),a.push(s)}else this.activeParts=null;this.timeRanges=e,Object.keys(e).forEach(function(n){var c=e[n];if(y.detectEvictedFragments(n,c),!s)for(var l=0;l<c.length;l++)p.appendedPTS=Math.max(c.end(l),p.appendedPTS||0)})},g.onFragBuffered=function(S,v){this.detectPartialFragments(v)},g.hasFragment=function(S){var v=A(S);return!!this.fragments[v]},g.removeFragmentsInRange=function(S,v,y){var p=this;Object.keys(this.fragments).forEach(function(s){var e=p.fragments[s];if(!e)return;if(e.buffered){var a=e.body;a.type===y&&a.start<v&&a.end>S&&p.removeFragment(a)}})},g.removeFragment=function(S){var v=A(S);S.stats.loaded=0,S.clearElementaryStreamInfo(),delete this.fragments[v]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},_}();function w(_){var g,x;return _.buffered&&(((g=_.range.video)===null||g===void 0?void 0:g.partial)||((x=_.range.audio)===null||x===void 0?void 0:x.partial))}function A(_){return _.type+"_"+_.level+"_"+_.urlId+"_"+_.sn}},"./src/controller/gap-controller.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"STALL_MINIMUM_DURATION_MS",function(){return w}),b.d(k,"MAX_START_GAP_JUMP",function(){return A}),b.d(k,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return _}),b.d(k,"SKIP_BUFFER_RANGE_START",function(){return g}),b.d(k,"default",function(){return x});var O=b("./src/utils/buffer-helper.ts"),C=b("./src/errors.ts"),E=b("./src/events.ts"),M=b("./src/utils/logger.ts"),w=250,A=2,_=.1,g=.05,x=function(){function S(y,p,s,e){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=y,this.media=p,this.fragmentTracker=s,this.hls=e}var v=S.prototype;return v.destroy=function(){this.hls=this.fragmentTracker=this.media=null},v.poll=function(p){var s=this.config,e=this.media,a=this.stalled,n=e.currentTime,c=e.seeking,l=this.seeking&&!c,u=!this.seeking&&c;if(this.seeking=c,n!==p){if(this.moved=!0,a!==null){if(this.stallReported){var m=self.performance.now()-a;M.logger.warn("playback not stuck anymore @"+n+", after "+Math.round(m)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((u||l)&&(this.stalled=null),e.paused||e.ended||e.playbackRate===0||!O.BufferHelper.getBuffered(e).length)return;var d=O.BufferHelper.bufferInfo(e,n,0),o=d.len>0,i=d.nextStart||0;if(!o&&!i)return;if(c){var t=d.len>A,r=!i||i-n>A&&!this.fragmentTracker.getPartialFragment(n);if(t||r)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var h,f=Math.max(i,d.start||0)-n,T=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,R=T==null||((h=T.details)===null||h===void 0)?void 0:h.live,L=R?T.details.targetduration*2:A;if(f>0&&f<=L){this._trySkipBufferHole(null);return}}var N=self.performance.now();if(a===null){this.stalled=N;return}var H=N-a;!c&&H>=w&&this._reportStall(d.len);var K=O.BufferHelper.bufferInfo(e,n,s.maxBufferHole);this._tryFixBufferStall(K,H)},v._tryFixBufferStall=function(p,s){var e=this.config,a=this.fragmentTracker,n=this.media,c=n.currentTime,l=a.getPartialFragment(c);if(l){var u=this._trySkipBufferHole(l);if(u)return}p.len>e.maxBufferHole&&s>e.highBufferWatchdogPeriod*1e3&&(M.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},v._reportStall=function(p){var s=this.hls,e=this.media,a=this.stallReported;a||(this.stallReported=!0,M.logger.warn("Playback stalling at @"+e.currentTime+" due to low buffer (buffer="+p+")"),s.trigger(E.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:p}))},v._trySkipBufferHole=function(p){for(var s=this.config,e=this.hls,a=this.media,n=a.currentTime,c=0,l=O.BufferHelper.getBuffered(a),u=0;u<l.length;u++){var m=l.start(u);if(n+s.maxBufferHole>=c&&n<m){var d=Math.max(m+g,a.currentTime+_);return M.logger.warn("skipping hole, adjusting currentTime from "+n+" to "+d),this.moved=!0,this.stalled=null,a.currentTime=d,p&&e.trigger(E.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+n+" to "+d,frag:p}),d}c=l.end(u)}return 0},v._tryNudgeBuffer=function(){var p=this.config,s=this.hls,e=this.media,a=e.currentTime,n=(this.nudgeRetry||0)+1;if(this.nudgeRetry=n,n<p.nudgeMaxRetry){var c=a+n*p.nudgeOffset;M.logger.warn("Nudging 'currentTime' from "+a+" to "+c),e.currentTime=c,s.trigger(E.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else M.logger.error("Playhead still not moving while enough data buffered @"+a+" after "+p.nudgeMaxRetry+" nudges"),s.trigger(E.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},S}()},"./src/controller/id3-track-controller.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/events.ts"),C=b("./src/utils/texttrack-utils.ts"),E=b("./src/demux/id3.ts"),M=.25,w=function(){function A(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var _=A.prototype;return _.destroy=function(){this._unregisterListeners()},_._registerListeners=function(){var x=this.hls;x.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.on(O.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),x.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_._unregisterListeners=function(){var x=this.hls;x.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.off(O.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),x.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_.onMediaAttached=function(x,S){this.media=S.media},_.onMediaDetaching=function(){if(!this.id3Track)return;Object(C.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},_.getID3Track=function(x){if(!this.media)return;for(var S=0;S<x.length;S++){var v=x[S];if(v.kind==="metadata"&&v.label==="id3")return Object(C.sendAddTrackEvent)(v,this.media),v}return this.media.addTextTrack("metadata","id3")},_.onFragParsingMetadata=function(x,S){if(!this.media)return;var v=S.frag,y=S.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var p=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<y.length;s++){var e=E.getID3Frames(y[s].data);if(e){var a=y[s].pts,n=s<y.length-1?y[s+1].pts:v.end,c=n-a;c<=0&&(n=a+M);for(var l=0;l<e.length;l++){var u=e[l];if(!E.isTimeStampFrame(u)){var m=new p(a,n,"");m.value=u,this.id3Track.addCue(m)}}}}},_.onBufferFlushing=function(x,S){var v=S.startOffset,y=S.endOffset,p=S.type;if(!p||p==="audio"){var s=this.id3Track;s&&Object(C.removeCuesInRange)(s,v,y)}},A}();k.default=w},"./src/controller/latency-controller.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return A});var O=b("./src/errors.ts"),C=b("./src/events.ts"),E=b("./src/utils/logger.ts");function M(_,g){for(var x=0;x<g.length;x++){var S=g[x];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(_,S.key,S)}}function w(_,g,x){return g&&M(_.prototype,g),x&&M(_,x),_}var A=function(){function _(x){var S=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return S.timeupdate()},this.hls=x,this.config=x.config,this.registerListeners()}var g=_.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(C.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(C.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(C.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(C.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(C.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(C.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(C.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(C.Events.ERROR,this.onError)},g.onMediaAttached=function(S,v){this.media=v.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(S,v){var y=v.details;this.levelDetails=y,y.advanced&&this.timeupdate(),!y.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(S,v){if(v.details!==O.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,E.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var S=this.media,v=this.levelDetails;if(!S||!v)return;this.currentTime=S.currentTime;var y=this.computeLatency();if(y===null)return;this._latency=y;var p=this.config,s=p.lowLatencyMode,e=p.maxLiveSyncPlaybackRate;if(!s||e===1)return;var a=this.targetLatency;if(a===null)return;var n=y-a,c=Math.min(this.maxLatency,a+v.targetduration),l=n<c;if(v.live&&l&&n>.05&&this.forwardBufferLength>1){var u=Math.min(2,Math.max(1,e)),m=Math.round(2/(1+Math.exp(-.75*n-this.edgeStalled))*20)/20;S.playbackRate=Math.min(u,Math.max(1,m))}else S.playbackRate!==1&&S.playbackRate!==0&&(S.playbackRate=1)},g.estimateLiveEdge=function(){var S=this.levelDetails;return S===null?null:S.edge+S.age},g.computeLatency=function(){var S=this.estimateLiveEdge();return S===null?null:S-this.currentTime},w(_,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var S=this.config,v=this.levelDetails;return S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:v?S.liveMaxLatencyDurationCount*v.targetduration:0}},{key:"targetLatency",get:function(){var S=this.levelDetails;if(S===null)return null;var v=S.holdBack,y=S.partHoldBack,p=S.targetduration,s=this.config,e=s.liveSyncDuration,a=s.liveSyncDurationCount,n=s.lowLatencyMode,c=this.hls.userConfig,l=n&&y||v;(c.liveSyncDuration||c.liveSyncDurationCount||l===0)&&(l=e!==void 0?e:a*p);var u=p,m=1;return l+Math.min(this.stallCount*m,u)}},{key:"liveSyncPosition",get:function(){var S=this.estimateLiveEdge(),v=this.targetLatency,y=this.levelDetails;if(S===null||v===null||y===null)return null;var p=y.edge,s=S-v-this.edgeStalled,e=p-y.totalduration,a=p-(this.config.lowLatencyMode&&y.partTarget||y.targetduration);return Math.min(Math.max(e,s),a)}},{key:"drift",get:function(){var S=this.levelDetails;return S===null?1:S.drift}},{key:"edgeStalled",get:function(){var S=this.levelDetails;if(S===null)return 0;var v=(this.config.lowLatencyMode&&S.partTarget||S.targetduration)*3;return Math.max(S.age-v,0)}},{key:"forwardBufferLength",get:function(){var S=this.media,v=this.levelDetails;if(!S||!v)return 0;var y=S.buffered.length;return y?S.buffered.end(y-1):v.edge-this.currentTime}}]),_}()},"./src/controller/level-controller.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return s});var O=b("./src/types/level.ts"),C=b("./src/events.ts"),E=b("./src/errors.ts"),M=b("./src/utils/codecs.ts"),w=b("./src/controller/level-helper.ts"),A=b("./src/controller/base-playlist-controller.ts"),_=b("./src/types/loader.ts");function g(){return g=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(e[c]=n[c])}return e},g.apply(this,arguments)}function x(e,a){for(var n=0;n<a.length;n++){var c=a[n];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(e,c.key,c)}}function S(e,a,n){return a&&x(e.prototype,a),n&&x(e,n),e}function v(e,a){e.prototype=Object.create(a.prototype),e.prototype.constructor=e,y(e,a)}function y(e,a){return y=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},y(e,a)}var p=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),s=function(e){v(a,e);function a(c){var l;return l=e.call(this,c,"[level-controller]")||this,l._levels=[],l._firstLevel=-1,l._startLevel=void 0,l.currentLevelIndex=-1,l.manualLevelIndex=-1,l.onParsedComplete=void 0,l._registerListeners(),l}var n=a.prototype;return n._registerListeners=function(){var l=this.hls;l.on(C.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(C.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),l.on(C.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(C.Events.ERROR,this.onError,this)},n._unregisterListeners=function(){var l=this.hls;l.off(C.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(C.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),l.off(C.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(C.Events.ERROR,this.onError,this)},n.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,e.prototype.destroy.call(this)},n.startLoad=function(){var l=this._levels;l.forEach(function(u){u.loadError=0}),e.prototype.startLoad.call(this)},n.onManifestLoaded=function(l,u){var m=[],d=[],o=[],i,t={},r,h=!1,f=!1,T=!1;if(u.levels.forEach(function(H){var K=H.attrs;h=h||!!(H.width&&H.height),f=f||!!H.videoCodec,T=T||!!H.audioCodec,p&&H.audioCodec&&H.audioCodec.indexOf("mp4a.40.34")!==-1&&(H.audioCodec=void 0);var X=H.bitrate+"-"+H.attrs.RESOLUTION+"-"+H.attrs.CODECS;r=t[X],r?r.url.push(H.url):(r=new O.Level(H),t[X]=r,m.push(r)),K&&(K.AUDIO&&Object(w.addGroupId)(r,"audio",K.AUDIO),K.SUBTITLES&&Object(w.addGroupId)(r,"text",K.SUBTITLES))}),(h||f)&&T&&(m=m.filter(function(H){var K=H.videoCodec,X=H.width,z=H.height;return!!K||!!(X&&z)})),m=m.filter(function(H){var K=H.audioCodec,X=H.videoCodec;return(!K||Object(M.isCodecSupportedInMp4)(K,"audio"))&&(!X||Object(M.isCodecSupportedInMp4)(X,"video"))}),u.audioTracks&&(d=u.audioTracks.filter(function(H){return!H.audioCodec||Object(M.isCodecSupportedInMp4)(H.audioCodec,"audio")}),Object(w.assignTrackIdsByGroup)(d)),u.subtitles&&(o=u.subtitles,Object(w.assignTrackIdsByGroup)(o)),m.length>0){i=m[0].bitrate,m.sort(function(H,K){return H.bitrate-K.bitrate}),this._levels=m;for(var R=0;R<m.length;R++)if(m[R].bitrate===i){this._firstLevel=R,this.log("manifest loaded, "+m.length+" level(s) found, first bitrate: "+i);break}var L=T&&!f,N={levels:m,audioTracks:d,subtitleTracks:o,firstLevel:this._firstLevel,stats:u.stats,audio:T,video:f,altAudio:!L&&d.some(function(H){return!!H.url})};this.hls.trigger(C.Events.MANIFEST_PARSED,N),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(C.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:u.url,reason:"no level with compatible codecs found in manifest"})},n.onError=function(l,u){if(e.prototype.onError.call(this,l,u),u.fatal)return;var m=u.context,d=this._levels[this.currentLevelIndex];if(m&&(m.type===_.PlaylistContextType.AUDIO_TRACK&&d.audioGroupIds&&m.groupId===d.audioGroupIds[d.urlId]||m.type===_.PlaylistContextType.SUBTITLE_TRACK&&d.textGroupIds&&m.groupId===d.textGroupIds[d.urlId])){this.redundantFailover(this.currentLevelIndex);return}var o=!1,i=!0,t;switch(u.details){case E.ErrorDetails.FRAG_LOAD_ERROR:case E.ErrorDetails.FRAG_LOAD_TIMEOUT:case E.ErrorDetails.KEY_LOAD_ERROR:case E.ErrorDetails.KEY_LOAD_TIMEOUT:if(u.frag){var r=this._levels[u.frag.level];r?(r.fragmentError++,r.fragmentError>this.hls.config.fragLoadingMaxRetry&&(t=u.frag.level)):t=u.frag.level}break;case E.ErrorDetails.LEVEL_LOAD_ERROR:case E.ErrorDetails.LEVEL_LOAD_TIMEOUT:m&&(m.deliveryDirectives&&(i=!1),t=m.level),o=!0;break;case E.ErrorDetails.REMUX_ALLOC_ERROR:t=u.level,o=!0;break}t!==void 0&&this.recoverLevel(u,t,o,i)},n.recoverLevel=function(l,u,m,d){var o=l.details,i=this._levels[u];if(i.loadError++,m){var t=this.retryLoadingOrFail(l);if(t)l.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(d){var r=i.url.length;if(r>1&&i.loadError<r)l.levelRetry=!0,this.redundantFailover(u);else if(this.manualLevelIndex===-1){var h=u===0?this._levels.length-1:u-1;this.currentLevelIndex!==h&&this._levels[h].loadError===0&&(this.warn(o+": switch to "+h),l.levelRetry=!0,this.hls.nextAutoLevel=h)}}},n.redundantFailover=function(l){var u=this._levels[l],m=u.url.length;if(m>1){var d=(u.urlId+1)%m;this.warn("Switching to redundant URL-id "+d),this._levels.forEach(function(o){o.urlId=d}),this.level=l}},n.onFragLoaded=function(l,u){var m=u.frag;if(m!==void 0&&m.type===_.PlaylistLevelType.MAIN){var d=this._levels[m.level];d!==void 0&&(d.fragmentError=0,d.loadError=0)}},n.onLevelLoaded=function(l,u){var m,d=u.level,o=u.details,i=this._levels[d];if(!i){var t;this.warn("Invalid level index "+d),(t=u.deliveryDirectives)!==null&&t!==void 0&&t.skip&&(o.deltaUpdateFailed=!0);return}d===this.currentLevelIndex?(i.fragmentError===0&&(i.loadError=0,this.retryCount=0),this.playlistLoaded(d,u,i.details)):(m=u.deliveryDirectives)!==null&&m!==void 0&&m.skip&&(o.deltaUpdateFailed=!0)},n.onAudioTrackSwitched=function(l,u){var m=this.hls.levels[this.currentLevelIndex];if(!m)return;if(m.audioGroupIds){for(var d=-1,o=this.hls.audioTracks[u.id].groupId,i=0;i<m.audioGroupIds.length;i++)if(m.audioGroupIds[i]===o){d=i;break}d!==m.urlId&&(m.urlId=d,this.startLoad())}},n.loadPlaylist=function(l){var u=this.currentLevelIndex,m=this._levels[u];if(this.canLoad&&m&&m.url.length>0){var d=m.urlId,o=m.url[d];if(l)try{o=l.addDirectives(o)}catch(i){this.warn("Could not construct new URL with HLS Delivery Directives: "+i)}this.log("Attempt loading level index "+u+(l?" at sn "+l.msn+" part "+l.part:"")+" with URL-id "+d+" "+o),this.clearTimer(),this.hls.trigger(C.Events.LEVEL_LOADING,{url:o,level:u,id:d,deliveryDirectives:l||null})}},n.removeLevel=function(l,u){var m=function(i,t){return t!==u},d=this._levels.filter(function(o,i){return i!==l?!0:o.url.length>1&&u!==void 0?(o.url=o.url.filter(m),o.audioGroupIds&&(o.audioGroupIds=o.audioGroupIds.filter(m)),o.textGroupIds&&(o.textGroupIds=o.textGroupIds.filter(m)),o.urlId=0,!0):!1}).map(function(o,i){var t=o.details;return t!=null&&t.fragments&&t.fragments.forEach(function(r){r.level=i}),o});this._levels=d,this.hls.trigger(C.Events.LEVELS_UPDATED,{levels:d})},S(a,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(l){var u,m=this._levels;if(m.length===0)return;if(this.currentLevelIndex===l&&(u=m[l])!==null&&u!==void 0&&u.details)return;if(l<0||l>=m.length){var d=l<0;if(this.hls.trigger(C.Events.ERROR,{type:E.ErrorTypes.OTHER_ERROR,details:E.ErrorDetails.LEVEL_SWITCH_ERROR,level:l,fatal:d,reason:"invalid level idx"}),d)return;l=Math.min(l,m.length-1)}this.clearTimer();var o=this.currentLevelIndex,i=m[o],t=m[l];this.log("switching to level "+l+" from "+o),this.currentLevelIndex=l;var r=g({},t,{level:l,maxBitrate:t.maxBitrate,uri:t.uri,urlId:t.urlId});delete r._urlId,this.hls.trigger(C.Events.LEVEL_SWITCHING,r);var h=t.details;if(!h||h.live){var f=this.switchParams(t.uri,i==null?void 0:i.details);this.loadPlaylist(f)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(l){this.manualLevelIndex=l,this._startLevel===void 0&&(this._startLevel=l),l!==-1&&(this.level=l)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(l){this._firstLevel=l}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var l=this.hls.config.startLevel;return l!==void 0?l:this._firstLevel}else return this._startLevel},set:function(l){this._startLevel=l}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(l){this.level=l,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=l)}}]),a}(A.default)},"./src/controller/level-helper.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"addGroupId",function(){return E}),b.d(k,"assignTrackIdsByGroup",function(){return M}),b.d(k,"updatePTS",function(){return w}),b.d(k,"updateFragPTSDTS",function(){return _}),b.d(k,"mergeDetails",function(){return g}),b.d(k,"mapPartIntersection",function(){return x}),b.d(k,"mapFragmentIntersection",function(){return S}),b.d(k,"adjustSliding",function(){return v}),b.d(k,"addSliding",function(){return y}),b.d(k,"computeReloadInterval",function(){return p}),b.d(k,"getFragmentWithSN",function(){return s}),b.d(k,"getPartWith",function(){return e});var O=b("./src/polyfills/number.ts"),C=b("./src/utils/logger.ts");function E(a,n,c){switch(n){case"audio":a.audioGroupIds||(a.audioGroupIds=[]),a.audioGroupIds.push(c);break;case"text":a.textGroupIds||(a.textGroupIds=[]),a.textGroupIds.push(c);break}}function M(a){var n={};a.forEach(function(c){var l=c.groupId||"";c.id=n[l]=n[l]||0,n[l]++})}function w(a,n,c){var l=a[n],u=a[c];A(l,u)}function A(a,n){var c=n.startPTS;if(Object(O.isFiniteNumber)(c)){var l=0,u;n.sn>a.sn?(l=c-a.start,u=a):(l=a.start-c,u=n),u.duration!==l&&(u.duration=l)}else if(n.sn>a.sn){var m=a.cc===n.cc;m&&a.minEndPTS?n.start=a.start+(a.minEndPTS-a.start):n.start=a.start+a.duration}else n.start=Math.max(a.start-n.duration,0)}function _(a,n,c,l,u,m){var d=l-c;d<=0&&(C.logger.warn("Fragment should have a positive duration",n),l=c+n.duration,m=u+n.duration);var o=c,i=l,t=n.startPTS,r=n.endPTS;if(Object(O.isFiniteNumber)(t)){var h=Math.abs(t-c);Object(O.isFiniteNumber)(n.deltaPTS)?n.deltaPTS=Math.max(h,n.deltaPTS):n.deltaPTS=h,o=Math.max(c,t),c=Math.min(c,t),u=Math.min(u,n.startDTS),i=Math.min(l,r),l=Math.max(l,r),m=Math.max(m,n.endDTS)}n.duration=l-c;var f=c-n.start;n.appendedPTS=l,n.start=n.startPTS=c,n.maxStartPTS=o,n.startDTS=u,n.endPTS=l,n.minEndPTS=i,n.endDTS=m;var T=n.sn;if(!a||T<a.startSN||T>a.endSN)return 0;var R,L=T-a.startSN,N=a.fragments;for(N[L]=n,R=L;R>0;R--)A(N[R],N[R-1]);for(R=L;R<N.length-1;R++)A(N[R],N[R+1]);return a.fragmentHint&&A(N[N.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,f}function g(a,n){for(var c=null,l=a.fragments,u=l.length-1;u>=0;u--){var m=l[u].initSegment;if(m){c=m;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;var d=0,o;if(S(a,n,function(R,L){R.relurl&&(d=R.cc-L.cc),Object(O.isFiniteNumber)(R.startPTS)&&Object(O.isFiniteNumber)(R.endPTS)&&(L.start=L.startPTS=R.startPTS,L.startDTS=R.startDTS,L.appendedPTS=R.appendedPTS,L.maxStartPTS=R.maxStartPTS,L.endPTS=R.endPTS,L.endDTS=R.endDTS,L.minEndPTS=R.minEndPTS,L.duration=R.endPTS-R.startPTS,L.duration&&(o=L),n.PTSKnown=n.alignedSliding=!0),L.elementaryStreams=R.elementaryStreams,L.loader=R.loader,L.stats=R.stats,L.urlId=R.urlId,R.initSegment&&(L.initSegment=R.initSegment,c=R.initSegment)}),c){var i=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments;i.forEach(function(R){var L;(!R.initSegment||R.initSegment.relurl===((L=c)===null||L===void 0?void 0:L.relurl))&&(R.initSegment=c)})}if(n.skippedSegments&&(n.deltaUpdateFailed=n.fragments.some(function(R){return!R}),n.deltaUpdateFailed)){C.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var t=n.skippedSegments;t--;)n.fragments.shift();n.startSN=n.fragments[0].sn,n.startCC=n.fragments[0].cc}var r=n.fragments;if(d){C.logger.warn("discontinuity sliding from playlist, take drift into account");for(var h=0;h<r.length;h++)r[h].cc+=d}n.skippedSegments&&(n.startCC=n.fragments[0].cc),x(a.partList,n.partList,function(R,L){L.elementaryStreams=R.elementaryStreams,L.stats=R.stats}),o?_(n,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS):v(a,n),r.length&&(n.totalduration=n.edge-r[0].start),n.driftStartTime=a.driftStartTime,n.driftStart=a.driftStart;var f=n.advancedDateTime;if(n.advanced&&f){var T=n.edge;n.driftStart||(n.driftStartTime=f,n.driftStart=T),n.driftEndTime=f,n.driftEnd=T}else n.driftEndTime=a.driftEndTime,n.driftEnd=a.driftEnd,n.advancedDateTime=a.advancedDateTime}function x(a,n,c){if(a&&n)for(var l=0,u=0,m=a.length;u<=m;u++){var d=a[u],o=n[u+l];d&&o&&d.index===o.index&&d.fragment.sn===o.fragment.sn?c(d,o):l--}}function S(a,n,c){for(var l=n.skippedSegments,u=Math.max(a.startSN,n.startSN)-n.startSN,m=(a.fragmentHint?1:0)+(l?n.endSN:Math.min(a.endSN,n.endSN))-n.startSN,d=n.startSN-a.startSN,o=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments,i=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments,t=u;t<=m;t++){var r=i[d+t],h=o[t];l&&!h&&t<l&&(h=n.fragments[t]=r),r&&h&&c(r,h)}}function v(a,n){var c=n.startSN+n.skippedSegments-a.startSN,l=a.fragments;if(c<0||c>=l.length)return;y(n,l[c].start)}function y(a,n){if(n){for(var c=a.fragments,l=a.skippedSegments;l<c.length;l++)c[l].start+=n;a.fragmentHint&&(a.fragmentHint.start+=n)}}function p(a,n){var c=1e3*a.levelTargetDuration,l=c/2,u=a.age,m=u>0&&u<c*3,d=n.loading.end-n.loading.start,o,i=a.availabilityDelay;if(a.updated===!1)if(m){var t=333*a.misses;o=Math.max(Math.min(l,d*2),t),a.availabilityDelay=(a.availabilityDelay||0)+o}else o=l;else m?(i=Math.min(i||c/2,u),a.availabilityDelay=i,o=i+c-u):o=c-d;return Math.round(o)}function s(a,n,c){if(!a||!a.details)return null;var l=a.details,u=l.fragments[n-l.startSN];return u||(u=l.fragmentHint,u&&u.sn===n?u:n<l.startSN&&c&&c.sn===n?c:null)}function e(a,n,c){if(!a||!a.details)return null;var l=a.details.partList;if(l)for(var u=l.length;u--;){var m=l[u];if(m.index===c&&m.fragment.sn===n)return m}return null}},"./src/controller/stream-controller.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return l});var O=b("./src/polyfills/number.ts"),C=b("./src/controller/base-stream-controller.ts"),E=b("./src/is-supported.ts"),M=b("./src/events.ts"),w=b("./src/utils/buffer-helper.ts"),A=b("./src/controller/fragment-tracker.ts"),_=b("./src/types/loader.ts"),g=b("./src/loader/fragment.ts"),x=b("./src/demux/transmuxer-interface.ts"),S=b("./src/types/transmuxer.ts"),v=b("./src/controller/gap-controller.ts"),y=b("./src/errors.ts"),p=b("./src/utils/logger.ts");function s(u,m){for(var d=0;d<m.length;d++){var o=m[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(u,o.key,o)}}function e(u,m,d){return m&&s(u.prototype,m),d&&s(u,d),u}function a(u,m){u.prototype=Object.create(m.prototype),u.prototype.constructor=u,n(u,m)}function n(u,m){return n=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},n(u,m)}var c=100,l=function(u){a(m,u);function m(o,i){var t;return t=u.call(this,o,i,"[stream-controller]")||this,t.audioCodecSwap=!1,t.gapController=null,t.level=-1,t._forceStartLoad=!1,t.altAudio=!1,t.audioOnly=!1,t.fragPlaying=null,t.onvplaying=null,t.onvseeked=null,t.fragLastKbps=0,t.stalled=!1,t.couldBacktrack=!1,t.audioCodecSwitch=!1,t.videoBuffer=null,t._registerListeners(),t}var d=m.prototype;return d._registerListeners=function(){var i=this.hls;i.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(M.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.on(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),i.on(M.Events.ERROR,this.onError,this),i.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),i.on(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),i.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),i.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),i.on(M.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),i.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d._unregisterListeners=function(){var i=this.hls;i.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.off(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),i.off(M.Events.ERROR,this.onError,this),i.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),i.off(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),i.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),i.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),i.off(M.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),i.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},d.startLoad=function(i){if(this.levels){var t=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(c),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var h=r.startLevel;h===-1&&(r.config.testBandwidth?(h=0,this.bitrateTest=!0):h=r.nextAutoLevel),this.level=r.nextLoadLevel=h,this.loadedmetadata=!1}t>0&&i===-1&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),i=t),this.state=C.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=i,this.tick()}else this._forceStartLoad=!0,this.state=C.State.STOPPED},d.stopLoad=function(){this._forceStartLoad=!1,u.prototype.stopLoad.call(this)},d.doTick=function(){switch(this.state){case C.State.IDLE:this.doTickIdle();break;case C.State.WAITING_LEVEL:{var i,t=this.levels,r=this.level,h=t==null||((i=t[r])===null||i===void 0)?void 0:i.details;if(h&&(!h.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(h))break;this.state=C.State.IDLE;break}break}case C.State.FRAG_LOADING_WAITING_RETRY:{var f,T=self.performance.now(),R=this.retryDate;(!R||T>=R||(f=this.media)!==null&&f!==void 0&&f.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=C.State.IDLE)}break;default:break}this.onTickEnd()},d.onTickEnd=function(){u.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},d.doTickIdle=function(){var i,t,r=this.hls,h=this.levelLastLoaded,f=this.levels,T=this.media,R=r.config,L=r.nextLoadLevel;if(h===null||!T&&(this.startFragRequested||!R.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!f||!f[L])return;var N=f[L];this.level=r.nextLoadLevel=L;var H=N.details;if(!H||this.state===C.State.WAITING_LEVEL||H.live&&this.levelLastLoaded!==L){this.state=C.State.WAITING_LEVEL;return}var K=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:T,_.PlaylistLevelType.MAIN);if(K===null)return;var X=K.len,z=this.getMaxBufferLength(N.maxBitrate);if(X>=z)return;if(this._streamEnded(K,H)){var J={};this.altAudio&&(J.type="video"),this.hls.trigger(M.Events.BUFFER_EOS,J),this.state=C.State.ENDED;return}var te=K.end,ee=this.getNextFragment(te,H);if(this.couldBacktrack&&!this.fragPrevious&&ee&&ee.sn!=="initSegment"){var ve=ee.sn-H.startSN;ve>1&&(ee=H.fragments[ve-1],this.fragmentTracker.removeFragment(ee))}if(ee&&this.fragmentTracker.getState(ee)===A.FragmentState.OK&&this.nextLoadPosition>te){var re=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(T,re,_.PlaylistLevelType.MAIN),ee=this.getNextFragment(this.nextLoadPosition,H)}if(!ee)return;ee.initSegment&&!ee.initSegment.data&&!this.bitrateTest&&(ee=ee.initSegment),((i=ee.decryptdata)===null||i===void 0?void 0:i.keyFormat)==="identity"&&!((t=ee.decryptdata)!==null&&t!==void 0&&t.key)?this.loadKey(ee,H):this.loadFragment(ee,H,te)},d.loadFragment=function(i,t,r){var h,f=this.fragmentTracker.getState(i);if(this.fragCurrent=i,f===A.FragmentState.BACKTRACKED){var T=this.fragmentTracker.getBacktrackData(i);if(T){this._handleFragmentLoadProgress(T),this._handleFragmentLoadComplete(T);return}else f=A.FragmentState.NOT_LOADED}f===A.FragmentState.NOT_LOADED||f===A.FragmentState.PARTIAL?i.sn==="initSegment"?this._loadInitSegment(i):this.bitrateTest?(i.bitrateTest=!0,this.log("Fragment "+i.sn+" of level "+i.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(i)):(this.startFragRequested=!0,u.prototype.loadFragment.call(this,i,t,r)):f===A.FragmentState.APPENDING?this.reduceMaxBufferLength(i.duration)&&this.fragmentTracker.removeFragment(i):((h=this.media)===null||h===void 0?void 0:h.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},d.getAppendedFrag=function(i){var t=this.fragmentTracker.getAppendedFrag(i,_.PlaylistLevelType.MAIN);return t&&"fragment"in t?t.fragment:t},d.getBufferedFrag=function(i){return this.fragmentTracker.getBufferedFrag(i,_.PlaylistLevelType.MAIN)},d.followingBufferedFrag=function(i){return i?this.getBufferedFrag(i.end+.5):null},d.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},d.nextLevelSwitch=function(){var i=this.levels,t=this.media;if(t!=null&&t.readyState){var r,h=this.getAppendedFrag(t.currentTime);if(h&&h.start>1&&this.flushMainBuffer(0,h.start-1),!t.paused&&i){var f=this.hls.nextLoadLevel,T=i[f],R=this.fragLastKbps;R&&this.fragCurrent?r=this.fragCurrent.duration*T.maxBitrate/(1e3*R)+1:r=0}else r=0;var L=this.getBufferedFrag(t.currentTime+r);if(L){var N=this.followingBufferedFrag(L);if(N){this.abortCurrentFrag();var H=N.maxStartPTS?N.maxStartPTS:N.start,K=N.duration,X=Math.max(L.end,H+Math.min(Math.max(K-this.config.maxFragLookUpTolerance,K*.5),K*.75));this.flushMainBuffer(X,Number.POSITIVE_INFINITY)}}}},d.abortCurrentFrag=function(){var i=this.fragCurrent;this.fragCurrent=null,i!=null&&i.loader&&i.loader.abort(),this.state===C.State.KEY_LOADING&&(this.state=C.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},d.flushMainBuffer=function(i,t){u.prototype.flushMainBuffer.call(this,i,t,this.altAudio?"video":null)},d.onMediaAttached=function(i,t){u.prototype.onMediaAttached.call(this,i,t);var r=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new v.default(this.config,r,this.fragmentTracker,this.hls)},d.onMediaDetaching=function(){var i=this.media;i&&(i.removeEventListener("playing",this.onvplaying),i.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),u.prototype.onMediaDetaching.call(this)},d.onMediaPlaying=function(){this.tick()},d.onMediaSeeked=function(){var i=this.media,t=i?i.currentTime:null;Object(O.isFiniteNumber)(t)&&this.log("Media seeked to "+t.toFixed(3)),this.tick()},d.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(M.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},d.onManifestParsed=function(i,t){var r=!1,h=!1,f;t.levels.forEach(function(T){f=T.audioCodec,f&&(f.indexOf("mp4a.40.2")!==-1&&(r=!0),f.indexOf("mp4a.40.5")!==-1&&(h=!0))}),this.audioCodecSwitch=r&&h&&!Object(E.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},d.onLevelLoading=function(i,t){var r=this.levels;if(!r||this.state!==C.State.IDLE)return;var h=r[t.level];(!h.details||h.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(h.details))&&(this.state=C.State.WAITING_LEVEL)},d.onLevelLoaded=function(i,t){var r,h=this.levels,f=t.level,T=t.details,R=T.totalduration;if(!h){this.warn("Levels were reset while loading level "+f);return}this.log("Level "+f+" loaded ["+T.startSN+","+T.endSN+"], cc ["+T.startCC+", "+T.endCC+"] duration:"+R);var L=this.fragCurrent;L&&(this.state===C.State.FRAG_LOADING||this.state===C.State.FRAG_LOADING_WAITING_RETRY)&&(L.level!==t.level&&L.loader&&(this.state=C.State.IDLE,L.loader.abort()));var N=h[f],H=0;if(T.live||(r=N.details)!==null&&r!==void 0&&r.live){if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed)return;H=this.alignPlaylists(T,N.details)}if(N.details=T,this.levelLastLoaded=f,this.hls.trigger(M.Events.LEVEL_UPDATED,{details:T,level:f}),this.state===C.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(T))return;this.state=C.State.IDLE}this.startFragRequested?T.live&&this.synchronizeToLiveEdge(T):this.setStartPosition(T,H),this.tick()},d._handleFragmentLoadProgress=function(i){var t,r=i.frag,h=i.part,f=i.payload,T=this.levels;if(!T){this.warn("Levels were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered");return}var R=T[r.level],L=R.details;if(!L){this.warn("Dropping fragment "+r.sn+" of level "+r.level+" after level details were reset");return}var N=R.videoCodec,H=L.PTSKnown||!L.live,K=(t=r.initSegment)===null||t===void 0?void 0:t.data,X=this._getAudioCodec(R),z=this.transmuxer=this.transmuxer||new x.default(this.hls,_.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),J=h?h.index:-1,te=J!==-1,ee=new S.ChunkMetadata(r.level,r.sn,r.stats.chunkCount,f.byteLength,J,te),ve=this.initPTS[r.cc];z.push(f,K,X,N,r,h,L.totalduration,H,ee,ve)},d.onAudioTrackSwitching=function(i,t){var r=this.altAudio,h=!!t.url,f=t.id;if(!h){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var T=this.fragCurrent;T!=null&&T.loader&&(this.log("Switching to main audio track, cancel main fragment load"),T.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var R=this.hls;r&&R.trigger(M.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),R.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:f})}},d.onAudioTrackSwitched=function(i,t){var r=t.id,h=!!this.hls.audioTracks[r].url;if(h){var f=this.videoBuffer;f&&this.mediaBuffer!==f&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=f)}this.altAudio=h,this.tick()},d.onBufferCreated=function(i,t){var r=t.tracks,h,f,T=!1;for(var R in r){var L=r[R];if(L.id==="main"){if(f=R,h=L,R==="video"){var N=r[R];N&&(this.videoBuffer=N.buffer)}}else T=!0}T&&h?(this.log("Alternate track found, use "+f+".buffered to schedule main fragment loading"),this.mediaBuffer=h.buffer):this.mediaBuffer=this.media},d.onFragBuffered=function(i,t){var r=t.frag,h=t.part;if(r&&r.type!==_.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(r)){this.warn("Fragment "+r.sn+(h?" p: "+h.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),this.state===C.State.PARSED&&(this.state=C.State.IDLE);return}var f=h?h.stats:r.stats;this.fragLastKbps=Math.round(8*f.total/(f.buffering.end-f.loading.first)),r.sn!=="initSegment"&&(this.fragPrevious=r),this.fragBufferedComplete(r,h)},d.onError=function(i,t){switch(t.details){case y.ErrorDetails.FRAG_LOAD_ERROR:case y.ErrorDetails.FRAG_LOAD_TIMEOUT:case y.ErrorDetails.KEY_LOAD_ERROR:case y.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.MAIN,t);break;case y.ErrorDetails.LEVEL_LOAD_ERROR:case y.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==C.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=C.State.ERROR):!t.levelRetry&&this.state===C.State.WAITING_LEVEL&&(this.state=C.State.IDLE));break;case y.ErrorDetails.BUFFER_FULL_ERROR:if(t.parent==="main"&&(this.state===C.State.PARSING||this.state===C.State.PARSED)){var r=!0,h=this.getFwdBufferInfo(this.media,_.PlaylistLevelType.MAIN);h&&h.len>.5&&(r=!this.reduceMaxBufferLength(h.len)),r&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},d.checkBuffer=function(){var i=this.media,t=this.gapController;if(!i||!t||!i.readyState)return;var r=w.BufferHelper.getBuffered(i);!this.loadedmetadata&&r.length?(this.loadedmetadata=!0,this.seekToStartPos()):t.poll(this.lastCurrentTime),this.lastCurrentTime=i.currentTime},d.onFragLoadEmergencyAborted=function(){this.state=C.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},d.onBufferFlushed=function(i,t){var r=t.type;if(r!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var h=(r===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(h,r,_.PlaylistLevelType.MAIN)}},d.onLevelsUpdated=function(i,t){this.levels=t.levels},d.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},d.seekToStartPos=function(){var i=this.media,t=i.currentTime,r=this.startPosition;if(r>=0&&t<r){if(i.seeking){p.logger.log("could not seek to "+r+", already seeking at "+t);return}var h=w.BufferHelper.getBuffered(i),f=h.length?h.start(0):0,T=f-r;T>0&&(T<this.config.maxBufferHole||T<this.config.maxFragLookUpTolerance)&&(p.logger.log("adjusting start position by "+T+" to match buffer start"),r+=T,this.startPosition=r),this.log("seek to target start position "+r+" from current time "+t),i.currentTime=r}},d._getAudioCodec=function(i){var t=this.config.defaultAudioCodec||i.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t},d._loadBitrateTestFrag=function(i){var t=this;this._doFragLoad(i).then(function(r){var h=t.hls;if(!r||h.nextLoadLevel||t.fragContextChanged(i))return;t.fragLoadError=0,t.state=C.State.IDLE,t.startFragRequested=!1,t.bitrateTest=!1;var f=i.stats;f.parsing.start=f.parsing.end=f.buffering.start=f.buffering.end=self.performance.now(),h.trigger(M.Events.FRAG_LOADED,r)})},d._handleTransmuxComplete=function(i){var t,r="main",h=this.hls,f=i.remuxResult,T=i.chunkMeta,R=this.getCurrentContext(T);if(!R){this.warn("The loading context changed while buffering fragment "+T.sn+" of level "+T.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(T.level);return}var L=R.frag,N=R.part,H=R.level,K=f.video,X=f.text,z=f.id3,J=f.initSegment,te=this.altAudio?void 0:f.audio;if(this.fragContextChanged(L))return;if(this.state=C.State.PARSING,J){J.tracks&&(this._bufferInitSegment(H,J.tracks,L,T),h.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:L,id:r,tracks:J.tracks}));var ee=J.initPTS,ve=J.timescale;Object(O.isFiniteNumber)(ee)&&(this.initPTS[L.cc]=ee,h.trigger(M.Events.INIT_PTS_FOUND,{frag:L,id:r,initPTS:ee,timescale:ve}))}if(K&&f.independent!==!1){if(H.details){var re=K.startPTS,de=K.endPTS,ie=K.startDTS,le=K.endDTS;if(N)N.elementaryStreams[K.type]={startPTS:re,endPTS:de,startDTS:ie,endDTS:le};else if(K.firstKeyFrame&&K.independent&&(this.couldBacktrack=!0),K.dropped&&K.independent){var Q=this.getLoadPosition()+this.config.maxBufferHole;if(Q<re){this.backtrack(L);return}L.setElementaryStreamInfo(K.type,L.start,de,L.start,le,!0)}L.setElementaryStreamInfo(K.type,re,de,ie,le),this.bufferFragmentData(K,L,N,T)}}else if(f.independent===!1){this.backtrack(L);return}if(te){var Z=te.startPTS,ne=te.endPTS,Te=te.startDTS,Ee=te.endDTS;N&&(N.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:Z,endPTS:ne,startDTS:Te,endDTS:Ee}),L.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,Z,ne,Te,Ee),this.bufferFragmentData(te,L,N,T)}if(z!=null&&(t=z.samples)!==null&&t!==void 0&&t.length){var Ce={frag:L,id:r,samples:z.samples};h.trigger(M.Events.FRAG_PARSING_METADATA,Ce)}if(X){var Ae={frag:L,id:r,samples:X.samples};h.trigger(M.Events.FRAG_PARSING_USERDATA,Ae)}},d._bufferInitSegment=function(i,t,r,h){var f=this;if(this.state!==C.State.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var T=t.audio,R=t.video,L=t.audiovideo;if(T){var N=i.audioCodec,H=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(N&&(N.indexOf("mp4a.40.5")!==-1?N="mp4a.40.2":N="mp4a.40.5"),T.metadata.channelCount!==1&&H.indexOf("firefox")===-1&&(N="mp4a.40.5")),H.indexOf("android")!==-1&&T.container!=="audio/mpeg"&&(N="mp4a.40.2",this.log("Android: force audio codec to "+N)),i.audioCodec&&i.audioCodec!==N&&this.log('Swapping manifest audio codec "'+i.audioCodec+'" for "'+N+'"'),T.levelCodec=N,T.id="main",this.log("Init audio buffer, container:"+T.container+", codecs[selected/level/parsed]=["+(N||"")+"/"+(i.audioCodec||"")+"/"+T.codec+"]")}R&&(R.levelCodec=i.videoCodec,R.id="main",this.log("Init video buffer, container:"+R.container+", codecs[level/parsed]=["+(i.videoCodec||"")+"/"+R.codec+"]")),L&&this.log("Init audiovideo buffer, container:"+L.container+", codecs[level/parsed]=["+(i.attrs.CODECS||"")+"/"+L.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,t),Object.keys(t).forEach(function(K){var X=t[K],z=X.initSegment;z!=null&&z.byteLength&&f.hls.trigger(M.Events.BUFFER_APPENDING,{type:K,data:z,frag:r,part:null,chunkMeta:h,parent:r.type})}),this.tick()},d.backtrack=function(i){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(i);var t=this.fragmentTracker.backtrack(i);this.fragPrevious=null,this.nextLoadPosition=i.start,t?this.resetFragmentLoading(i):this.state=C.State.BACKTRACKING},d.checkFragmentChanged=function(){var i=this.media,t=null;if(i&&i.readyState>1&&i.seeking===!1){var r=i.currentTime;if(w.BufferHelper.isBuffered(i,r)?t=this.getAppendedFrag(r):w.BufferHelper.isBuffered(i,r+.1)&&(t=this.getAppendedFrag(r+.1)),t){var h=this.fragPlaying,f=t.level;(!h||t.sn!==h.sn||h.level!==f||t.urlId!==h.urlId)&&(this.hls.trigger(M.Events.FRAG_CHANGED,{frag:t}),(!h||h.level!==f)&&this.hls.trigger(M.Events.LEVEL_SWITCHED,{level:f}),this.fragPlaying=t)}}},e(m,[{key:"nextLevel",get:function(){var i=this.nextBufferedFrag;return i?i.level:-1}},{key:"currentLevel",get:function(){var i=this.media;if(i){var t=this.getAppendedFrag(i.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var i=this.media;if(i){var t=this.getAppendedFrag(i.currentTime);return this.followingBufferedFrag(t)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),m}(C.default)},"./src/controller/subtitle-stream-controller.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"SubtitleStreamController",function(){return a});var O=b("./src/events.ts"),C=b("./src/utils/logger.ts"),E=b("./src/utils/buffer-helper.ts"),M=b("./src/controller/fragment-finders.ts"),w=b("./src/utils/discontinuities.ts"),A=b("./src/controller/level-helper.ts"),_=b("./src/controller/fragment-tracker.ts"),g=b("./src/controller/base-stream-controller.ts"),x=b("./src/types/loader.ts"),S=b("./src/types/level.ts");function v(n,c){for(var l=0;l<c.length;l++){var u=c[l];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(n,u.key,u)}}function y(n,c,l){return c&&v(n.prototype,c),l&&v(n,l),n}function p(n,c){n.prototype=Object.create(c.prototype),n.prototype.constructor=n,s(n,c)}function s(n,c){return s=Object.setPrototypeOf||function(u,m){return u.__proto__=m,u},s(n,c)}var e=500,a=function(n){p(c,n);function c(u,m){var d;return d=n.call(this,u,m,"[subtitle-stream-controller]")||this,d.levels=[],d.currentTrackId=-1,d.tracksBuffered=[],d.mainDetails=null,d._registerListeners(),d}var l=c.prototype;return l.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},l._registerListeners=function(){var m=this.hls;m.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(O.Events.ERROR,this.onError,this),m.on(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),m.on(O.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),m.on(O.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),m.on(O.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),m.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},l._unregisterListeners=function(){var m=this.hls;m.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(O.Events.ERROR,this.onError,this),m.off(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),m.off(O.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),m.off(O.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),m.off(O.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),m.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},l.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(e),this.tick()},l.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},l.onLevelLoaded=function(m,d){this.mainDetails=d.details},l.onSubtitleFragProcessed=function(m,d){var o=d.frag,i=d.success;if(this.fragPrevious=o,this.state=g.State.IDLE,!i)return;var t=this.tracksBuffered[this.currentTrackId];if(!t)return;for(var r,h=o.start,f=0;f<t.length;f++)if(h>=t[f].start&&h<=t[f].end){r=t[f];break}var T=o.start+o.duration;r?r.end=T:(r={start:h,end:T},t.push(r)),this.fragmentTracker.fragBuffered(o)},l.onBufferFlushing=function(m,d){var o=d.startOffset,i=d.endOffset;if(o===0&&i!==Number.POSITIVE_INFINITY){var t=this.currentTrackId,r=this.levels;if(!r.length||!r[t]||!r[t].details)return;var h=r[t].details,f=h.targetduration,T=i-f;if(T<=0)return;d.endOffsetSubtitles=Math.max(0,T),this.tracksBuffered.forEach(function(R){for(var L=0;L<R.length;){if(R[L].end<=T){R.shift();continue}else if(R[L].start<T)R[L].start=T;else break;L++}}),this.fragmentTracker.removeFragmentsInRange(o,T,x.PlaylistLevelType.SUBTITLE)}},l.onError=function(m,d){var o,i=d.frag;if(!i||i.type!==x.PlaylistLevelType.SUBTITLE)return;(o=this.fragCurrent)!==null&&o!==void 0&&o.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},l.onSubtitleTracksUpdated=function(m,d){var o=this,i=d.subtitleTracks;this.tracksBuffered=[],this.levels=i.map(function(t){return new S.Level(t)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(t){o.tracksBuffered[t.id]=[]}),this.mediaBuffer=null},l.onSubtitleTrackSwitch=function(m,d){if(this.currentTrackId=d.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var o=this.levels[this.currentTrackId];o!=null&&o.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,o&&this.setInterval(e)},l.onSubtitleTrackLoaded=function(m,d){var o,i=d.details,t=d.id,r=this.currentTrackId,h=this.levels;if(!h.length)return;var f=h[r];if(t>=h.length||t!==r||!f)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,i.live||(o=f.details)!==null&&o!==void 0&&o.live){var T=this.mainDetails;if(i.deltaUpdateFailed||!T)return;var R=T.fragments[0];if(!f.details)i.hasProgramDateTime&&T.hasProgramDateTime?Object(w.alignMediaPlaylistByPDT)(i,T):R&&Object(A.addSliding)(i,R.start);else{var L=this.alignPlaylists(i,f.details);L===0&&R&&Object(A.addSliding)(i,R.start)}}if(f.details=i,this.levelLastLoaded=t,this.tick(),i.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var N=Object(M.findFragmentByPTS)(null,i.fragments,this.media.currentTime,0);N||(this.warn("Subtitle playlist not aligned with playback"),f.details=void 0)}},l._handleFragmentLoadComplete=function(m){var d=m.frag,o=m.payload,i=d.decryptdata,t=this.hls;if(this.fragContextChanged(d))return;if(o&&o.byteLength>0&&i&&i.key&&i.iv&&i.method==="AES-128"){var r=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(o),i.key.buffer,i.iv.buffer).then(function(h){var f=performance.now();t.trigger(O.Events.FRAG_DECRYPTED,{frag:d,payload:h,stats:{tstart:r,tdecrypt:f}})})}},l.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var m,d=this.currentTrackId,o=this.levels;if(!o.length||!o[d]||!o[d].details)return;var i=o[d].details,t=i.targetduration,r=this.config,h=this.media,f=E.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,h.currentTime-t,r.maxBufferHole),T=f.end,R=f.len,L=this.getMaxBufferLength()+t;if(R>L)return;console.assert(i,"Subtitle track details are defined on idle subtitle stream controller tick");var N=i.fragments,H=N.length,K=i.edge,X,z=this.fragPrevious;if(T<K){var J=r.maxFragLookUpTolerance;z&&i.hasProgramDateTime&&(X=Object(M.findFragmentByPDT)(N,z.endProgramDateTime,J)),X||(X=Object(M.findFragmentByPTS)(z,N,T,J),!X&&z&&z.start<N[0].start&&(X=N[0]))}else X=N[H-1];(m=X)!==null&&m!==void 0&&m.encrypted?(C.logger.log("Loading key for "+X.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(O.Events.KEY_LOADING,{frag:X})):X&&this.fragmentTracker.getState(X)===_.FragmentState.NOT_LOADED&&this.loadFragment(X,i,T)}},l.loadFragment=function(m,d,o){this.fragCurrent=m,n.prototype.loadFragment.call(this,m,d,o)},y(c,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),c}(g.default)},"./src/controller/subtitle-track-controller.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/events.ts"),C=b("./src/utils/texttrack-utils.ts"),E=b("./src/controller/base-playlist-controller.ts"),M=b("./src/types/loader.ts");function w(v,y){for(var p=0;p<y.length;p++){var s=y[p];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(v,s.key,s)}}function A(v,y,p){return y&&w(v.prototype,y),p&&w(v,p),v}function _(v,y){v.prototype=Object.create(y.prototype),v.prototype.constructor=v,g(v,y)}function g(v,y){return g=Object.setPrototypeOf||function(s,e){return s.__proto__=e,s},g(v,y)}var x=function(v){_(y,v);function y(s){var e;return e=v.call(this,s,"[subtitle-track-controller]")||this,e.media=null,e.tracks=[],e.groupId=null,e.tracksInGroup=[],e.trackId=-1,e.selectDefaultTrack=!0,e.queuedDefaultTrack=-1,e.trackChangeListener=function(){return e.onTextTracksChanged()},e.asyncPollTrackChange=function(){return e.pollTrackChange(0)},e.useTextTrackPolling=!1,e.subtitlePollingInterval=-1,e.subtitleDisplay=!0,e.registerListeners(),e}var p=y.prototype;return p.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,v.prototype.destroy.call(this)},p.registerListeners=function(){var e=this.hls;e.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(O.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(O.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(O.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(O.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var e=this.hls;e.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(O.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(O.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(O.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(O.Events.ERROR,this.onError,this)},p.onMediaAttached=function(e,a){if(this.media=a.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},p.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},p.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var e=S(this.media.textTracks);e.forEach(function(a){Object(C.clearCurrentCues)(a)}),this.subtitleTrack=-1,this.media=null},p.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},p.onManifestParsed=function(e,a){this.tracks=a.subtitleTracks},p.onSubtitleTrackLoaded=function(e,a){var n=a.id,c=a.details,l=this.trackId,u=this.tracksInGroup[l];if(!u){this.warn("Invalid subtitle track id "+n);return}var m=u.details;u.details=a.details,this.log("subtitle track "+n+" loaded ["+c.startSN+"-"+c.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,a,m))},p.onLevelLoading=function(e,a){this.switchLevel(a.level)},p.onLevelSwitching=function(e,a){this.switchLevel(a.level)},p.switchLevel=function(e){var a=this.hls.levels[e];if(!(a!=null&&a.textGroupIds))return;var n=a.textGroupIds[a.urlId];if(this.groupId!==n){var c=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,l=this.tracks.filter(function(d){return!n||d.groupId===n});this.tracksInGroup=l;var u=this.findTrackId(c==null?void 0:c.name)||this.findTrackId();this.groupId=n;var m={subtitleTracks:l};this.log("Updating subtitle tracks, "+l.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(O.Events.SUBTITLE_TRACKS_UPDATED,m),u!==-1&&this.setSubtitleTrack(u,c)}},p.findTrackId=function(e){for(var a=this.tracksInGroup,n=0;n<a.length;n++){var c=a[n];if((!this.selectDefaultTrack||c.default)&&(!e||e===c.name))return c.id}return-1},p.onError=function(e,a){if(v.prototype.onError.call(this,e,a),a.fatal||!a.context)return;a.context.type===M.PlaylistContextType.SUBTITLE_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},p.loadPlaylist=function(e){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var n=a.id,c=a.groupId,l=a.url;if(e)try{l=e.addDirectives(l)}catch(u){this.warn("Could not construct new URL with HLS Delivery Directives: "+u)}this.log("Loading subtitle playlist for id "+n),this.hls.trigger(O.Events.SUBTITLE_TRACK_LOADING,{url:l,id:n,groupId:c,deliveryDirectives:e||null})}},p.toggleTrackModes=function(e){var a=this,n=this.media,c=this.subtitleDisplay,l=this.trackId;if(!n)return;var u=S(n.textTracks),m=u.filter(function(i){return i.groupId===a.groupId});if(e===-1)[].slice.call(u).forEach(function(i){i.mode="disabled"});else{var d=m[l];d&&(d.mode="disabled")}var o=m[e];o&&(o.mode=c?"showing":"hidden")},p.setSubtitleTrack=function(e,a){var n,c=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(e===-1||(n=c[e])!==null&&n!==void 0&&n.details)||e<-1||e>=c.length)return;this.clearTimer();var l=c[e];if(this.log("Switching to subtitle track "+e),this.trackId=e,l){var u=l.id,m=l.groupId,d=m===void 0?"":m,o=l.name,i=l.type,t=l.url;this.hls.trigger(O.Events.SUBTITLE_TRACK_SWITCH,{id:u,groupId:d,name:o,type:i,url:t});var r=this.switchParams(l.url,a==null?void 0:a.details);this.loadPlaylist(r)}else this.hls.trigger(O.Events.SUBTITLE_TRACK_SWITCH,{id:e})},p.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var e=-1,a=S(this.media.textTracks),n=0;n<a.length;n++)if(a[n].mode==="hidden")e=n;else if(a[n].mode==="showing"){e=n;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)},A(y,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1;var a=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,a)}}]),y}(E.default);function S(v){for(var y=[],p=0;p<v.length;p++){var s=v[p];s.kind==="subtitles"&&s.label&&y.push(v[p])}return y}k.default=x},"./src/controller/timeline-controller.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"TimelineController",function(){return S});var O=b("./src/polyfills/number.ts"),C=b("./src/events.ts"),E=b("./src/utils/cea-608-parser.ts"),M=b("./src/utils/output-filter.ts"),w=b("./src/utils/webvtt-parser.ts"),A=b("./src/utils/texttrack-utils.ts"),_=b("./src/utils/imsc1-ttml-parser.ts"),g=b("./src/types/loader.ts"),x=b("./src/utils/logger.ts"),S=function(){function s(a){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=p(),this.captionsProperties=void 0,this.hls=a,this.config=a.config,this.Cues=a.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var n=new M.default(this,"textTrack1"),c=new M.default(this,"textTrack2"),l=new M.default(this,"textTrack3"),u=new M.default(this,"textTrack4");this.cea608Parser1=new E.default(1,n,c),this.cea608Parser2=new E.default(3,l,u)}a.on(C.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(C.Events.MANIFEST_LOADED,this.onManifestLoaded,this),a.on(C.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),a.on(C.Events.FRAG_LOADING,this.onFragLoading,this),a.on(C.Events.FRAG_LOADED,this.onFragLoaded,this),a.on(C.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),a.on(C.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),a.on(C.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),a.on(C.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),a.on(C.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=s.prototype;return e.destroy=function(){var n=this.hls;n.off(C.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(C.Events.MANIFEST_LOADED,this.onManifestLoaded,this),n.off(C.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.off(C.Events.FRAG_LOADING,this.onFragLoading,this),n.off(C.Events.FRAG_LOADED,this.onFragLoaded,this),n.off(C.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),n.off(C.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),n.off(C.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),n.off(C.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),n.off(C.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(n,c,l,u,m){for(var d=!1,o=m.length;o--;){var i=m[o],t=y(i[0],i[1],c,l);if(t>=0&&(i[0]=Math.min(i[0],c),i[1]=Math.max(i[1],l),d=!0,t/(l-c)>.5))return}if(d||m.push([c,l]),this.config.renderTextTracksNatively){var r=this.captionsTracks[n];this.Cues.newCue(r,c,l,u)}else{var h=this.Cues.newCue(null,c,l,u);this.hls.trigger(C.Events.CUES_PARSED,{type:"captions",cues:h,track:n})}},e.onInitPtsFound=function(n,c){var l=this,u=c.frag,m=c.id,d=c.initPTS,o=c.timescale,i=this.unparsedVttFrags;m==="main"&&(this.initPTS[u.cc]=d,this.timescale[u.cc]=o),i.length&&(this.unparsedVttFrags=[],i.forEach(function(t){l.onFragLoaded(C.Events.FRAG_LOADED,t)}))},e.getExistingTrack=function(n){var c=this.media;if(c)for(var l=0;l<c.textTracks.length;l++){var u=c.textTracks[l];if(u[n])return u}return null},e.createCaptionsTrack=function(n){this.config.renderTextTracksNatively?this.createNativeTrack(n):this.createNonNativeTrack(n)},e.createNativeTrack=function(n){if(this.captionsTracks[n])return;var c=this.captionsProperties,l=this.captionsTracks,u=this.media,m=c[n],d=m.label,o=m.languageCode,i=this.getExistingTrack(n);if(i)l[n]=i,Object(A.clearCurrentCues)(l[n]),Object(A.sendAddTrackEvent)(l[n],u);else{var t=this.createTextTrack("captions",d,o);t&&(t[n]=!0,l[n]=t)}},e.createNonNativeTrack=function(n){if(this.nonNativeCaptionsTracks[n])return;var c=this.captionsProperties[n];if(!c)return;var l=c.label,u={_id:n,label:l,kind:"captions",default:c.media?!!c.media.default:!1,closedCaptions:c.media};this.nonNativeCaptionsTracks[n]=u,this.hls.trigger(C.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[u]})},e.createTextTrack=function(n,c,l){var u=this.media;return u?u.addTextTrack(n,c,l):void 0},e.onMediaAttaching=function(n,c){this.media=c.media,this._cleanTracks()},e.onMediaDetaching=function(){var n=this.captionsTracks;Object.keys(n).forEach(function(c){Object(A.clearCurrentCues)(n[c]),delete n[c]}),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=p(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},e._cleanTracks=function(){var n=this.media;if(!n)return;var c=n.textTracks;if(c)for(var l=0;l<c.length;l++)Object(A.clearCurrentCues)(c[l])},e.onSubtitleTracksUpdated=function(n,c){var l=this;this.textTracks=[];var u=c.subtitleTracks||[],m=u.some(function(t){return t.textCodec===_.IMSC1_CODEC});if(this.config.enableWebVTT||m&&this.config.enableIMSC1){var d=this.tracks&&u&&this.tracks.length===u.length;if(this.tracks=u||[],this.config.renderTextTracksNatively){var o=this.media?this.media.textTracks:[];this.tracks.forEach(function(t,r){var h;if(r<o.length){for(var f=null,T=0;T<o.length;T++)if(v(o[T],t)){f=o[T];break}f&&(h=f)}h?Object(A.clearCurrentCues)(h):(h=l.createTextTrack("subtitles",t.name,t.lang),h&&(h.mode="disabled")),h&&(h.groupId=t.groupId,l.textTracks.push(h))})}else if(!d&&this.tracks&&this.tracks.length){var i=this.tracks.map(function(t){return{label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}});this.hls.trigger(C.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:i})}}},e.onManifestLoaded=function(n,c){var l=this;this.config.enableCEA708Captions&&c.captions&&c.captions.forEach(function(u){var m=/(?:CC|SERVICE)([1-4])/.exec(u.instreamId);if(!m)return;var d="textTrack"+m[1],o=l.captionsProperties[d];if(!o)return;o.label=u.name,u.lang&&(o.languageCode=u.lang),o.media=u})},e.onFragLoading=function(n,c){var l=this.cea608Parser1,u=this.cea608Parser2,m=this.lastSn,d=this.lastPartIndex;if(!this.enabled||!(l&&u))return;if(c.frag.type===g.PlaylistLevelType.MAIN){var o,i,t=c.frag.sn,r=(o=c==null||((i=c.part)===null||i===void 0)?void 0:i.index)!=null?o:-1;t===m+1||t===m&&r===d+1||(l.reset(),u.reset()),this.lastSn=t,this.lastPartIndex=r}},e.onFragLoaded=function(n,c){var l=c.frag,u=c.payload,m=this.initPTS,d=this.unparsedVttFrags;if(l.type===g.PlaylistLevelType.SUBTITLE)if(u.byteLength){if(!Object(O.isFiniteNumber)(m[l.cc])){d.push(c),m.length&&this.hls.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:new Error("Missing initial subtitle PTS")});return}var o=l.decryptdata;if(o==null||o.key==null||o.method!=="AES-128"){var i=this.tracks[l.level],t=this.vttCCs;t[l.cc]||(t[l.cc]={start:l.start,prevCC:this.prevCC,new:!0},this.prevCC=l.cc),i&&i.textCodec===_.IMSC1_CODEC?this._parseIMSC1(l,u):this._parseVTTs(l,u,t)}}else this.hls.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(n,c){var l=this,u=this.hls;Object(_.parseIMSC1)(c,this.initPTS[n.cc],this.timescale[n.cc],function(m){l._appendCues(m,n.level),u.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},function(m){x.logger.log("Failed to parse IMSC1: "+m),u.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:m})})},e._parseVTTs=function(n,c,l){var u=this,m=this.hls;Object(w.parseWebVTT)(c,this.initPTS[n.cc],this.timescale[n.cc],l,n.cc,n.start,function(d){u._appendCues(d,n.level),m.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},function(d){u._fallbackToIMSC1(n,c),x.logger.log("Failed to parse VTT cue: "+d),m.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:d})})},e._fallbackToIMSC1=function(n,c){var l=this,u=this.tracks[n.level];u.textCodec||Object(_.parseIMSC1)(c,this.initPTS[n.cc],this.timescale[n.cc],function(){u.textCodec=_.IMSC1_CODEC,l._parseIMSC1(n,c)},function(){u.textCodec="wvtt"})},e._appendCues=function(n,c){var l=this.hls;if(this.config.renderTextTracksNatively){var u=this.textTracks[c];if(u.mode==="disabled")return;n.forEach(function(o){return Object(A.addCueToTrack)(u,o)})}else{var m=this.tracks[c],d=m.default?"default":"subtitles"+c;l.trigger(C.Events.CUES_PARSED,{type:"subtitles",cues:n,track:d})}},e.onFragDecrypted=function(n,c){var l=c.frag;if(l.type===g.PlaylistLevelType.SUBTITLE){if(!Object(O.isFiniteNumber)(this.initPTS[l.cc])){this.unparsedVttFrags.push(c);return}this.onFragLoaded(C.Events.FRAG_LOADED,c)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(n,c){var l=this.cea608Parser1,u=this.cea608Parser2;if(!this.enabled||!(l&&u))return;for(var m=0;m<c.samples.length;m++){var d=c.samples[m].bytes;if(d){var o=this.extractCea608Data(d);l.addData(c.samples[m].pts,o[0]),u.addData(c.samples[m].pts,o[1])}}},e.onBufferFlushing=function(n,c){var l=c.startOffset,u=c.endOffset,m=c.endOffsetSubtitles,d=c.type,o=this.media;if(!o||o.currentTime<u)return;if(!d||d==="video"){var i=this.captionsTracks;Object.keys(i).forEach(function(r){return Object(A.removeCuesInRange)(i[r],l,u)})}if(this.config.renderTextTracksNatively&&(l===0&&m!==void 0)){var t=this.textTracks;Object.keys(t).forEach(function(r){return Object(A.removeCuesInRange)(t[r],l,m)})}},e.extractCea608Data=function(n){for(var c=n[0]&31,l=2,u=[[],[]],m=0;m<c;m++){var d=n[l++],o=127&n[l++],i=127&n[l++],t=(4&d)!==0,r=3&d;if(o===0&&i===0)continue;t&&((r===0||r===1)&&(u[r].push(o),u[r].push(i)))}return u},s}();function v(s,e){return s&&s.label===e.name&&!(s.textTrack1||s.textTrack2)}function y(s,e,a,n){return Math.min(e,n)-Math.max(s,a)}function p(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return O});var O=function(){function C(M,w){this.subtle=void 0,this.aesIV=void 0,this.subtle=M,this.aesIV=w}var E=C.prototype;return E.decrypt=function(w,A){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},A,w)},C}()},"./src/crypt/aes-decryptor.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"removePadding",function(){return C}),b.d(k,"default",function(){return E});var O=b("./src/utils/typed-array.ts");function C(M){var w=M.byteLength,A=w&&new DataView(M.buffer).getUint8(w-1);return A?Object(O.sliceUint8)(M,0,w-A):M}var E=function(){function M(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var w=M.prototype;return w.uint8ArrayToUint32Array_=function(_){for(var g=new DataView(_),x=new Uint32Array(4),S=0;S<4;S++)x[S]=g.getUint32(S*4);return x},w.initTable=function(){var _=this.sBox,g=this.invSBox,x=this.subMix,S=x[0],v=x[1],y=x[2],p=x[3],s=this.invSubMix,e=s[0],a=s[1],n=s[2],c=s[3],l=new Uint32Array(256),u=0,m=0,d=0;for(d=0;d<256;d++)d<128?l[d]=d<<1:l[d]=d<<1^283;for(d=0;d<256;d++){var o=m^m<<1^m<<2^m<<3^m<<4;o=o>>>8^o&255^99,_[u]=o,g[o]=u;var i=l[u],t=l[i],r=l[t],h=l[o]*257^o*16843008;S[u]=h<<24|h>>>8,v[u]=h<<16|h>>>16,y[u]=h<<8|h>>>24,p[u]=h,h=r*16843009^t*65537^i*257^u*16843008,e[o]=h<<24|h>>>8,a[o]=h<<16|h>>>16,n[o]=h<<8|h>>>24,c[o]=h,u?(u=i^l[l[l[r^i]]],m^=l[l[m]]):u=m=1}},w.expandKey=function(_){for(var g=this.uint8ArrayToUint32Array_(_),x=!0,S=0;S<g.length&&x;)x=g[S]===this.key[S],S++;if(x)return;this.key=g;var v=this.keySize=g.length;if(v!==4&&v!==6&&v!==8)throw new Error("Invalid aes key size="+v);var y=this.ksRows=(v+6+1)*4,p,s,e=this.keySchedule=new Uint32Array(y),a=this.invKeySchedule=new Uint32Array(y),n=this.sBox,c=this.rcon,l=this.invSubMix,u=l[0],m=l[1],d=l[2],o=l[3],i,t;for(p=0;p<y;p++){if(p<v){i=e[p]=g[p];continue}t=i,p%v===0?(t=t<<8|t>>>24,t=n[t>>>24]<<24|n[t>>>16&255]<<16|n[t>>>8&255]<<8|n[t&255],t^=c[p/v|0]<<24):v>6&&p%v===4&&(t=n[t>>>24]<<24|n[t>>>16&255]<<16|n[t>>>8&255]<<8|n[t&255]),e[p]=i=(e[p-v]^t)>>>0}for(s=0;s<y;s++)p=y-s,s&3?t=e[p]:t=e[p-4],s<4||p<=4?a[s]=t:a[s]=u[n[t>>>24]]^m[n[t>>>16&255]]^d[n[t>>>8&255]]^o[n[t&255]],a[s]=a[s]>>>0},w.networkToHostOrderSwap=function(_){return _<<24|(_&65280)<<8|(_&16711680)>>8|_>>>24},w.decrypt=function(_,g,x){for(var S=this.keySize+6,v=this.invKeySchedule,y=this.invSBox,p=this.invSubMix,s=p[0],e=p[1],a=p[2],n=p[3],c=this.uint8ArrayToUint32Array_(x),l=c[0],u=c[1],m=c[2],d=c[3],o=new Int32Array(_),i=new Int32Array(o.length),t,r,h,f,T,R,L,N,H,K,X,z,J,te,ee=this.networkToHostOrderSwap;g<o.length;){for(H=ee(o[g]),K=ee(o[g+1]),X=ee(o[g+2]),z=ee(o[g+3]),T=H^v[0],R=z^v[1],L=X^v[2],N=K^v[3],J=4,te=1;te<S;te++)t=s[T>>>24]^e[R>>16&255]^a[L>>8&255]^n[N&255]^v[J],r=s[R>>>24]^e[L>>16&255]^a[N>>8&255]^n[T&255]^v[J+1],h=s[L>>>24]^e[N>>16&255]^a[T>>8&255]^n[R&255]^v[J+2],f=s[N>>>24]^e[T>>16&255]^a[R>>8&255]^n[L&255]^v[J+3],T=t,R=r,L=h,N=f,J=J+4;t=y[T>>>24]<<24^y[R>>16&255]<<16^y[L>>8&255]<<8^y[N&255]^v[J],r=y[R>>>24]<<24^y[L>>16&255]<<16^y[N>>8&255]<<8^y[T&255]^v[J+1],h=y[L>>>24]<<24^y[N>>16&255]<<16^y[T>>8&255]<<8^y[R&255]^v[J+2],f=y[N>>>24]<<24^y[T>>16&255]<<16^y[R>>8&255]<<8^y[L&255]^v[J+3],i[g]=ee(t^l),i[g+1]=ee(f^u),i[g+2]=ee(h^m),i[g+3]=ee(r^d),l=H,u=K,m=X,d=z,g=g+4}return i.buffer},M}()},"./src/crypt/decrypter.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return g});var O=b("./src/crypt/aes-crypto.ts"),C=b("./src/crypt/fast-aes-key.ts"),E=b("./src/crypt/aes-decryptor.ts"),M=b("./src/utils/logger.ts"),w=b("./src/utils/mp4-tools.ts"),A=b("./src/utils/typed-array.ts"),_=16,g=function(){function x(v,y,p){var s=p===void 0?{}:p,e=s.removePKCS7Padding,a=e===void 0?!0:e;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=v,this.config=y,this.removePKCS7Padding=a,a)try{var n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(c){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var S=x.prototype;return S.destroy=function(){this.observer=null},S.isSync=function(){return this.config.enableSoftwareAES},S.flush=function(){var y=this.currentResult;if(!y){this.reset();return}var p=new Uint8Array(y);return this.reset(),this.removePKCS7Padding?Object(E.removePadding)(p):p},S.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},S.decrypt=function(y,p,s,e){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(y),p,s);var a=this.flush();a&&e(a.buffer)}else this.webCryptoDecrypt(new Uint8Array(y),p,s).then(e)},S.softwareDecrypt=function(y,p,s){var e=this.currentIV,a=this.currentResult,n=this.remainderData;this.logOnce("JS AES decrypt"),n&&(y=Object(w.appendUint8Array)(n,y),this.remainderData=null);var c=this.getValidChunk(y);if(!c.length)return null;e&&(s=e);var l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new E.default),l.expandKey(p);var u=a;return this.currentResult=l.decrypt(c.buffer,0,s),this.currentIV=Object(A.sliceUint8)(c,-16).buffer,u||null},S.webCryptoDecrypt=function(y,p,s){var e=this,a=this.subtle;return(this.key!==p||!this.fastAesKey)&&(this.key=p,this.fastAesKey=new C.default(a,p)),this.fastAesKey.expandKey().then(function(n){if(!a)return Promise.reject(new Error("web crypto not initialized"));var c=new O.default(a,s);return c.decrypt(y.buffer,n)}).catch(function(n){return e.onWebCryptoError(n,y,p,s)})},S.onWebCryptoError=function(y,p,s,e){return M.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",y),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(p,s,e)},S.getValidChunk=function(y){var p=y,s=y.length-y.length%_;return s!==y.length&&(p=Object(A.sliceUint8)(y,0,s),this.remainderData=Object(A.sliceUint8)(y,s)),p},S.logOnce=function(y){if(!this.logEnabled)return;M.logger.log("[decrypter.ts]: "+y),this.logEnabled=!1},x}()},"./src/crypt/fast-aes-key.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return O});var O=function(){function C(M,w){this.subtle=void 0,this.key=void 0,this.subtle=M,this.key=w}var E=C.prototype;return E.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},C}()},"./src/demux/aacdemuxer.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/demux/base-audio-demuxer.ts"),C=b("./src/demux/adts.ts"),E=b("./src/utils/logger.ts"),M=b("./src/demux/id3.ts");function w(g,x){g.prototype=Object.create(x.prototype),g.prototype.constructor=g,A(g,x)}function A(g,x){return A=Object.setPrototypeOf||function(v,y){return v.__proto__=y,v},A(g,x)}var _=function(g){w(x,g);function x(v,y){var p;return p=g.call(this)||this,p.observer=void 0,p.config=void 0,p.observer=v,p.config=y,p}var S=x.prototype;return S.resetInitSegment=function(y,p,s){g.prototype.resetInitSegment.call(this,y,p,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:y,duration:s,inputTimeScale:9e4,dropped:0}},x.probe=function(y){if(!y)return!1;for(var p=M.getID3Data(y,0)||[],s=p.length,e=y.length;s<e;s++)if(C.probe(y,s))return E.logger.log("ADTS sync word found !"),!0;return!1},S.canParse=function(y,p){return C.canParse(y,p)},S.appendFrame=function(y,p,s){C.initTrackConfig(y,this.observer,p,s,y.manifestCodec);var e=C.appendFrame(y,p,s,this.initPTS,this.frameIndex);if(e&&e.missing===0)return e},x}(O.default);_.minProbeByteLength=9,k.default=_},"./src/demux/adts.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"getAudioConfig",function(){return M}),b.d(k,"isHeaderPattern",function(){return w}),b.d(k,"getHeaderLength",function(){return A}),b.d(k,"getFullFrameLength",function(){return _}),b.d(k,"canGetFrameLength",function(){return g}),b.d(k,"isHeader",function(){return x}),b.d(k,"canParse",function(){return S}),b.d(k,"probe",function(){return v}),b.d(k,"initTrackConfig",function(){return y}),b.d(k,"getFrameDuration",function(){return p}),b.d(k,"parseFrameHeader",function(){return s}),b.d(k,"appendFrame",function(){return e});var O=b("./src/utils/logger.ts"),C=b("./src/errors.ts"),E=b("./src/events.ts");function M(a,n,c,l){var u,m,d,o,i=navigator.userAgent.toLowerCase(),t=l,r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];u=((n[c+2]&192)>>>6)+1;var h=(n[c+2]&60)>>>2;if(h>r.length-1){a.trigger(E.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+h});return}return d=(n[c+2]&1)<<2,d|=(n[c+3]&192)>>>6,O.logger.log("manifest codec:"+l+", ADTS type:"+u+", samplingIndex:"+h),/firefox/i.test(i)?h>=6?(u=5,o=new Array(4),m=h-3):(u=2,o=new Array(2),m=h):i.indexOf("android")!==-1?(u=2,o=new Array(2),m=h):(u=5,o=new Array(4),l&&(l.indexOf("mp4a.40.29")!==-1||l.indexOf("mp4a.40.5")!==-1)||!l&&h>=6?m=h-3:((l&&l.indexOf("mp4a.40.2")!==-1&&(h>=6&&d===1||/vivaldi/i.test(i))||!l&&d===1)&&(u=2,o=new Array(2)),m=h)),o[0]=u<<3,o[0]|=(h&14)>>1,o[1]|=(h&1)<<7,o[1]|=d<<3,u===5&&(o[1]|=(m&14)>>1,o[2]=(m&1)<<7,o[2]|=2<<2,o[3]=0),{config:o,samplerate:r[h],channelCount:d,codec:"mp4a.40."+u,manifestCodec:t}}function w(a,n){return a[n]===255&&(a[n+1]&246)===240}function A(a,n){return a[n+1]&1?7:9}function _(a,n){return(a[n+3]&3)<<11|a[n+4]<<3|(a[n+5]&224)>>>5}function g(a,n){return n+5<a.length}function x(a,n){return n+1<a.length&&w(a,n)}function S(a,n){return g(a,n)&&w(a,n)&&_(a,n)<=a.length-n}function v(a,n){if(x(a,n)){var c=A(a,n);if(n+c>=a.length)return!1;var l=_(a,n);if(l<=c)return!1;var u=n+l;return u===a.length||x(a,u)}return!1}function y(a,n,c,l,u){if(!a.samplerate){var m=M(n,c,l,u);if(!m)return;a.config=m.config,a.samplerate=m.samplerate,a.channelCount=m.channelCount,a.codec=m.codec,a.manifestCodec=m.manifestCodec,O.logger.log("parsed codec:"+a.codec+", rate:"+m.samplerate+", channels:"+m.channelCount)}}function p(a){return 1024*9e4/a}function s(a,n,c,l,u){var m=A(a,n),d=_(a,n);if(d-=m,d>0){var o=c+l*u;return{headerLength:m,frameLength:d,stamp:o}}}function e(a,n,c,l,u){var m=p(a.samplerate),d=s(n,c,l,u,m);if(d){var o=d.frameLength,i=d.headerLength,t=d.stamp,r=i+o,h=Math.max(0,c+r-n.length),f;h?(f=new Uint8Array(r-i),f.set(n.subarray(c+i,n.length),0)):f=n.subarray(c+i,c+r);var T={unit:f,pts:t};return h||a.samples.push(T),{sample:T,length:r,missing:h}}}},"./src/demux/base-audio-demuxer.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"initPTSFn",function(){return _});var O=b("./src/polyfills/number.ts"),C=b("./src/demux/id3.ts"),E=b("./src/demux/dummy-demuxed-track.ts"),M=b("./src/utils/mp4-tools.ts"),w=b("./src/utils/typed-array.ts"),A=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var x=g.prototype;return x.resetInitSegment=function(v,y,p){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},x.resetTimeStamp=function(){},x.resetContiguity=function(){},x.canParse=function(v,y){return!1},x.appendFrame=function(v,y,p){},x.demux=function(v,y){this.cachedData&&(v=Object(M.appendUint8Array)(this.cachedData,v),this.cachedData=null);var p=C.getID3Data(v,0),s=p?p.length:0,e,a,n=this._audioTrack,c=this._id3Track,l=p?C.getTimeStamp(p):void 0,u=v.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=_(l,y)),p&&p.length>0&&c.samples.push({pts:this.initPTS,dts:this.initPTS,data:p}),a=this.initPTS;s<u;){if(this.canParse(v,s)){var m=this.appendFrame(n,v,s);m?(this.frameIndex++,a=m.sample.pts,s+=m.length,e=s):s=u}else C.canParse(v,s)?(p=C.getID3Data(v,s),c.samples.push({pts:a,dts:a,data:p}),s+=p.length,e=s):s++;if(s===u&&e!==u){var d=Object(w.sliceUint8)(v,e);this.cachedData?this.cachedData=Object(M.appendUint8Array)(this.cachedData,d):this.cachedData=d}}return{audioTrack:n,avcTrack:Object(E.dummyTrack)(),id3Track:c,textTrack:Object(E.dummyTrack)()}},x.demuxSampleAes=function(v,y,p){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},x.flush=function(v){var y=this.cachedData;return y&&(this.cachedData=null,this.demux(y,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(E.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(E.dummyTrack)()}},x.destroy=function(){},g}(),_=function(x,S){return Object(O.isFiniteNumber)(x)?x*90:S*9e4};k.default=A},"./src/demux/chunk-cache.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return O});var O=function(){function E(){this.chunks=[],this.dataLength=0}var M=E.prototype;return M.push=function(A){this.chunks.push(A),this.dataLength+=A.length},M.flush=function(){var A=this.chunks,_=this.dataLength,g;if(A.length)A.length===1?g=A[0]:g=C(A,_);else return new Uint8Array(0);return this.reset(),g},M.reset=function(){this.chunks.length=0,this.dataLength=0},E}();function C(E,M){for(var w=new Uint8Array(M),A=0,_=0;_<E.length;_++){var g=E[_];w.set(g,A),A+=g.length}return w}},"./src/demux/dummy-demuxed-track.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"dummyTrack",function(){return O});function O(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/utils/logger.ts"),C=function(){function E(w){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=w,this.bytesAvailable=w.byteLength,this.word=0,this.bitsAvailable=0}var M=E.prototype;return M.loadWord=function(){var A=this.data,_=this.bytesAvailable,g=A.byteLength-_,x=new Uint8Array(4),S=Math.min(4,_);if(S===0)throw new Error("no bytes available");x.set(A.subarray(g,g+S)),this.word=new DataView(x.buffer).getUint32(0),this.bitsAvailable=S*8,this.bytesAvailable-=S},M.skipBits=function(A){var _;this.bitsAvailable>A?(this.word<<=A,this.bitsAvailable-=A):(A-=this.bitsAvailable,_=A>>3,A-=_>>3,this.bytesAvailable-=_,this.loadWord(),this.word<<=A,this.bitsAvailable-=A)},M.readBits=function(A){var _=Math.min(this.bitsAvailable,A),g=this.word>>>32-_;return A>32&&O.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=_,this.bitsAvailable>0?this.word<<=_:this.bytesAvailable>0&&this.loadWord(),_=A-_,_>0&&this.bitsAvailable?g<<_|this.readBits(_):g},M.skipLZ=function(){var A;for(A=0;A<this.bitsAvailable;++A)if((this.word&2147483648>>>A)!==0)return this.word<<=A,this.bitsAvailable-=A,A;return this.loadWord(),A+this.skipLZ()},M.skipUEG=function(){this.skipBits(1+this.skipLZ())},M.skipEG=function(){this.skipBits(1+this.skipLZ())},M.readUEG=function(){var A=this.skipLZ();return this.readBits(A+1)-1},M.readEG=function(){var A=this.readUEG();return 1&A?1+A>>>1:-1*(A>>>1)},M.readBoolean=function(){return this.readBits(1)===1},M.readUByte=function(){return this.readBits(8)},M.readUShort=function(){return this.readBits(16)},M.readUInt=function(){return this.readBits(32)},M.skipScalingList=function(A){for(var _=8,g=8,x,S=0;S<A;S++)g!==0&&(x=this.readEG(),g=(_+x+256)%256),_=g===0?_:g},M.readSPS=function(){var A=0,_=0,g=0,x=0,S,v,y,p=this.readUByte.bind(this),s=this.readBits.bind(this),e=this.readUEG.bind(this),a=this.readBoolean.bind(this),n=this.skipBits.bind(this),c=this.skipEG.bind(this),l=this.skipUEG.bind(this),u=this.skipScalingList.bind(this);p();var m=p();if(s(5),n(3),p(),l(),m===100||m===110||m===122||m===244||m===44||m===83||m===86||m===118||m===128){var d=e();if(d===3&&n(1),l(),l(),n(1),a())for(v=d!==3?8:12,y=0;y<v;y++)a()&&(y<6?u(16):u(64))}l();var o=e();if(o===0)e();else if(o===1)for(n(1),c(),c(),S=e(),y=0;y<S;y++)c();l(),n(1);var i=e(),t=e(),r=s(1);r===0&&n(1),n(1),a()&&(A=e(),_=e(),g=e(),x=e());var h=[1,1];if(a()&&a()){var f=p();switch(f){case 1:h=[1,1];break;case 2:h=[12,11];break;case 3:h=[10,11];break;case 4:h=[16,11];break;case 5:h=[40,33];break;case 6:h=[24,11];break;case 7:h=[20,11];break;case 8:h=[32,11];break;case 9:h=[80,33];break;case 10:h=[18,11];break;case 11:h=[15,11];break;case 12:h=[64,33];break;case 13:h=[160,99];break;case 14:h=[4,3];break;case 15:h=[3,2];break;case 16:h=[2,1];break;case 255:{h=[p()<<8|p(),p()<<8|p()];break}}}return{width:Math.ceil((i+1)*16-A*2-_*2),height:(2-r)*(t+1)*16-(r?2:4)*(g+x),pixelRatio:h}},M.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},E}();k.default=C},"./src/demux/id3.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"isHeader",function(){return O}),b.d(k,"isFooter",function(){return C}),b.d(k,"getID3Data",function(){return E}),b.d(k,"canParse",function(){return w}),b.d(k,"getTimeStamp",function(){return A}),b.d(k,"isTimeStampFrame",function(){return _}),b.d(k,"getID3Frames",function(){return x}),b.d(k,"decodeFrame",function(){return S}),b.d(k,"utf8ArrayToStr",function(){return e}),b.d(k,"testables",function(){return a});var O=function(u,m){return m+10<=u.length&&(u[m]===73&&u[m+1]===68&&u[m+2]===51&&(u[m+3]<255&&u[m+4]<255&&(u[m+6]<128&&u[m+7]<128&&u[m+8]<128&&u[m+9]<128)))},C=function(u,m){return m+10<=u.length&&(u[m]===51&&u[m+1]===68&&u[m+2]===73&&(u[m+3]<255&&u[m+4]<255&&(u[m+6]<128&&u[m+7]<128&&u[m+8]<128&&u[m+9]<128)))},E=function(u,m){for(var d=m,o=0;O(u,m);){o+=10;var i=M(u,m+6);o+=i,C(u,m+10)&&(o+=10),m+=o}return o>0?u.subarray(d,d+o):void 0},M=function(u,m){var d=0;return d=(u[m]&127)<<21,d|=(u[m+1]&127)<<14,d|=(u[m+2]&127)<<7,d|=u[m+3]&127,d},w=function(u,m){return O(u,m)&&M(u,m+6)+10<=u.length-m},A=function(u){for(var m=x(u),d=0;d<m.length;d++){var o=m[d];if(_(o))return s(o)}return},_=function(u){return u&&u.key==="PRIV"&&u.info==="com.apple.streaming.transportStreamTimestamp"},g=function(u){var m=String.fromCharCode(u[0],u[1],u[2],u[3]),d=M(u,4),o=10;return{type:m,size:d,data:u.subarray(o,o+d)}},x=function(u){for(var m=0,d=[];O(u,m);){var o=M(u,m+6);m+=10;for(var i=m+o;m+8<i;){var t=g(u.subarray(m)),r=S(t);r&&d.push(r),m+=t.size+10}C(u,m)&&(m+=10)}return d},S=function(u){return u.type==="PRIV"?v(u):u.type[0]==="W"?p(u):y(u)},v=function(u){if(u.size<2)return;var m=e(u.data,!0),d=new Uint8Array(u.data.subarray(m.length+1));return{key:u.type,info:m,data:d.buffer}},y=function(u){if(u.size<2)return;if(u.type==="TXXX"){var m=1,d=e(u.data.subarray(m),!0);m+=d.length+1;var o=e(u.data.subarray(m));return{key:u.type,info:d,data:o}}var i=e(u.data.subarray(1));return{key:u.type,data:i}},p=function(u){if(u.type==="WXXX"){if(u.size<2)return;var m=1,d=e(u.data.subarray(m),!0);m+=d.length+1;var o=e(u.data.subarray(m));return{key:u.type,info:d,data:o}}var i=e(u.data);return{key:u.type,data:i}},s=function(u){if(u.data.byteLength===8){var m=new Uint8Array(u.data),d=m[3]&1,o=(m[4]<<23)+(m[5]<<15)+(m[6]<<7)+m[7];return o/=45,d&&(o+=4772185884e-2),Math.round(o)}return},e=function(u,m){m===void 0&&(m=!1);var d=c();if(d){var o=d.decode(u);if(m){var i=o.indexOf("\0");return i!==-1?o.substring(0,i):o}return o.replace(/\0/g,"")}for(var t=u.length,r,h,f,T="",R=0;R<t;){if(r=u[R++],r===0&&m)return T;if(r===0||r===3)continue;switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:T+=String.fromCharCode(r);break;case 12:case 13:h=u[R++],T+=String.fromCharCode((r&31)<<6|h&63);break;case 14:h=u[R++],f=u[R++],T+=String.fromCharCode((r&15)<<12|(h&63)<<6|(f&63)<<0);break;default:}}return T},a={decodeTextFrame:y},n;function c(){return!n&&typeof self.TextDecoder!="undefined"&&(n=new self.TextDecoder("utf-8")),n}},"./src/demux/mp3demuxer.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/demux/base-audio-demuxer.ts"),C=b("./src/demux/id3.ts"),E=b("./src/utils/logger.ts"),M=b("./src/demux/mpegaudio.ts");function w(g,x){g.prototype=Object.create(x.prototype),g.prototype.constructor=g,A(g,x)}function A(g,x){return A=Object.setPrototypeOf||function(v,y){return v.__proto__=y,v},A(g,x)}var _=function(g){w(x,g);function x(){return g.apply(this,arguments)||this}var S=x.prototype;return S.resetInitSegment=function(y,p,s){g.prototype.resetInitSegment.call(this,y,p,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:y,duration:s,inputTimeScale:9e4,dropped:0}},x.probe=function(y){if(!y)return!1;for(var p=C.getID3Data(y,0)||[],s=p.length,e=y.length;s<e;s++)if(M.probe(y,s))return E.logger.log("MPEG Audio sync word found !"),!0;return!1},S.canParse=function(y,p){return M.canParse(y,p)},S.appendFrame=function(y,p,s){return this.initPTS===null?void 0:M.appendFrame(y,p,s,this.initPTS,this.frameIndex)},x}(O.default);_.minProbeByteLength=4,k.default=_},"./src/demux/mp4demuxer.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/utils/mp4-tools.ts"),C=b("./src/demux/dummy-demuxed-track.ts"),E=function(){function M(A,_){this.remainderData=null,this.config=void 0,this.config=_}var w=M.prototype;return w.resetTimeStamp=function(){},w.resetInitSegment=function(){},w.resetContiguity=function(){},M.probe=function(_){return Object(O.findBox)({data:_,start:0,end:Math.min(_.length,16384)},["moof"]).length>0},w.demux=function(_){var g=_,x=Object(C.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(O.appendUint8Array)(this.remainderData,_));var S=Object(O.segmentValidRange)(g);this.remainderData=S.remainder,x.samples=S.valid||new Uint8Array}else x.samples=g;return{audioTrack:Object(C.dummyTrack)(),avcTrack:x,id3Track:Object(C.dummyTrack)(),textTrack:Object(C.dummyTrack)()}},w.flush=function(){var _=Object(C.dummyTrack)();return _.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(C.dummyTrack)(),avcTrack:_,id3Track:Object(C.dummyTrack)(),textTrack:Object(C.dummyTrack)()}},w.demuxSampleAes=function(_,g,x){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},w.destroy=function(){},M}();E.minProbeByteLength=1024,k.default=E},"./src/demux/mpegaudio.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"appendFrame",function(){return A}),b.d(k,"parseHeader",function(){return _}),b.d(k,"isHeaderPattern",function(){return g}),b.d(k,"isHeader",function(){return x}),b.d(k,"canParse",function(){return S}),b.d(k,"probe",function(){return v});var O=null,C=[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],E=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],M=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],w=[0,1,1,4];function A(y,p,s,e,a){if(s+24>p.length)return;var n=_(p,s);if(n&&s+n.frameLength<=p.length){var c=n.samplesPerFrame*9e4/n.sampleRate,l=e+a*c,u={unit:p.subarray(s,s+n.frameLength),pts:l,dts:l};return y.config=[],y.channelCount=n.channelCount,y.samplerate=n.sampleRate,y.samples.push(u),{sample:u,length:n.frameLength,missing:0}}}function _(y,p){var s=y[p+1]>>3&3,e=y[p+1]>>1&3,a=y[p+2]>>4&15,n=y[p+2]>>2&3;if(s!==1&&a!==0&&a!==15&&n!==3){var c=y[p+2]>>1&1,l=y[p+3]>>6,u=s===3?3-e:e===3?3:4,m=C[u*14+a-1]*1e3,d=s===3?0:s===2?1:2,o=E[d*3+n],i=l===3?1:2,t=M[s][e],r=w[e],h=t*8*r,f=Math.floor(t*m/o+c)*r;if(O===null){var T=navigator.userAgent||"",R=T.match(/Chrome\/(\d+)/i);O=R?parseInt(R[1]):0}var L=!!O&&O<=87;return L&&e===2&&m>=224e3&&l===0&&(y[p+3]=y[p+3]|128),{sampleRate:o,channelCount:i,frameLength:f,samplesPerFrame:h}}}function g(y,p){return y[p]===255&&(y[p+1]&224)===224&&(y[p+1]&6)!==0}function x(y,p){return p+1<y.length&&g(y,p)}function S(y,p){var s=4;return g(y,p)&&s<=y.length-p}function v(y,p){if(p+1<y.length&&g(y,p)){var s=4,e=_(y,p),a=s;e!=null&&e.frameLength&&(a=e.frameLength);var n=p+a;return n===y.length||x(y,n)}return!1}},"./src/demux/sample-aes.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/crypt/decrypter.ts"),C=b("./src/demux/tsdemuxer.ts"),E=function(){function M(A,_,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new O.default(A,_,{removePKCS7Padding:!1})}var w=M.prototype;return w.decryptBuffer=function(_,g){this.decrypter.decrypt(_,this.keyData.key.buffer,this.keyData.iv.buffer,g)},w.decryptAacSample=function(_,g,x,S){var v=_[g].unit,y=v.subarray(16,v.length-v.length%16),p=y.buffer.slice(y.byteOffset,y.byteOffset+y.length),s=this;this.decryptBuffer(p,function(e){var a=new Uint8Array(e);v.set(a,16),S||s.decryptAacSamples(_,g+1,x)})},w.decryptAacSamples=function(_,g,x){for(;;g++){if(g>=_.length){x();return}if(_[g].unit.length<32)continue;var S=this.decrypter.isSync();if(this.decryptAacSample(_,g,x,S),!S)return}},w.getAvcEncryptedData=function(_){for(var g=Math.floor((_.length-48)/160)*16+16,x=new Int8Array(g),S=0,v=32;v<=_.length-16;v+=160,S+=16)x.set(_.subarray(v,v+16),S);return x},w.getAvcDecryptedUnit=function(_,g){for(var x=new Uint8Array(g),S=0,v=32;v<=_.length-16;v+=160,S+=16)_.set(x.subarray(S,S+16),v);return _},w.decryptAvcSample=function(_,g,x,S,v,y){var p=Object(C.discardEPB)(v.data),s=this.getAvcEncryptedData(p),e=this;this.decryptBuffer(s.buffer,function(a){v.data=e.getAvcDecryptedUnit(p,a),y||e.decryptAvcSamples(_,g,x+1,S)})},w.decryptAvcSamples=function(_,g,x,S){if(_ instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,x=0){if(g>=_.length){S();return}for(var v=_[g].units;!(x>=v.length);x++){var y=v[x];if(y.data.length<=48||y.type!==1&&y.type!==5)continue;var p=this.decrypter.isSync();if(this.decryptAvcSample(_,g,x,S,y,p),!p)return}}},M}();k.default=E},"./src/demux/transmuxer-interface.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return v});var O=b("./node_modules/webworkify-webpack/index.js"),C=b.n(O),E=b("./src/events.ts"),M=b("./src/demux/transmuxer.ts"),w=b("./src/utils/logger.ts"),A=b("./src/errors.ts"),_=b("./src/utils/mediasource-helper.ts"),g=b("./node_modules/eventemitter3/index.js"),x=b.n(g),S=Object(_.getMediaSource)()||{isTypeSupported:function(){return!1}},v=function(){function y(s,e,a,n){var c=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=s,this.id=e,this.onTransmuxComplete=a,this.onFlush=n;var l=s.config,u=function(t,r){r=r||{},r.frag=c.frag,r.id=c.id,s.trigger(t,r)};this.observer=new g.EventEmitter,this.observer.on(E.Events.FRAG_DECRYPTED,u),this.observer.on(E.Events.ERROR,u);var m={mp4:S.isTypeSupported("video/mp4"),mpeg:S.isTypeSupported("audio/mpeg"),mp3:S.isTypeSupported('audio/mp4; codecs="mp3"')},d=navigator.vendor;if(l.enableWorker&&typeof Worker!="undefined"){w.logger.log("demuxing in webworker");var o;try{o=this.worker=O("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),o.addEventListener("message",this.onwmsg),o.onerror=function(i){s.trigger(E.Events.ERROR,{type:A.ErrorTypes.OTHER_ERROR,details:A.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(i.message+" ("+i.filename+":"+i.lineno+")")})},o.postMessage({cmd:"init",typeSupported:m,vendor:d,id:e,config:JSON.stringify(l)})}catch(i){w.logger.warn("Error in worker:",i),w.logger.error("Error while initializing DemuxerWorker, fallback to inline"),o&&self.URL.revokeObjectURL(o.objectURL),this.transmuxer=new M.default(this.observer,m,l,d,e),this.worker=null}}else this.transmuxer=new M.default(this.observer,m,l,d,e)}var p=y.prototype;return p.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null;else{var a=this.transmuxer;a&&(a.destroy(),this.transmuxer=null)}var n=this.observer;n&&n.removeAllListeners(),this.observer=null},p.push=function(e,a,n,c,l,u,m,d,o,i){var t=this;o.transmuxing.start=self.performance.now();var r=this.transmuxer,h=this.worker,f=u?u.start:l.start,T=l.decryptdata,R=this.frag,L=!(R&&l.cc===R.cc),N=!(R&&o.level===R.level),H=R?o.sn-R.sn:-1,K=this.part?o.part-this.part.index:1,X=!N&&(H===1||H===0&&K===1),z=self.performance.now();(N||H||l.stats.parsing.start===0)&&(l.stats.parsing.start=z),u&&(K||!X)&&(u.stats.parsing.start=z);var J=new M.TransmuxState(L,X,d,N,f);if(!X||L){w.logger.log("[transmuxer-interface, "+l.type+"]: Starting new transmux session for sn: "+o.sn+" p: "+o.part+" level: "+o.level+" id: "+o.id+`
discontinuity: `+L+`
trackSwitch: `+N+`
contiguous: `+X+`
accurateTimeOffset: `+d+`
timeOffset: `+f);var te=new M.TransmuxConfig(n,c,a,m,i);this.configureTransmuxer(te)}if(this.frag=l,this.part=u,h)h.postMessage({cmd:"demux",data:e,decryptdata:T,chunkMeta:o,state:J},e instanceof ArrayBuffer?[e]:[]);else if(r){var ee=r.push(e,T,o,J);Object(M.isPromise)(ee)?ee.then(function(ve){t.handleTransmuxComplete(ve)}):this.handleTransmuxComplete(ee)}},p.flush=function(e){var a=this;e.transmuxing.start=self.performance.now();var n=this.transmuxer,c=this.worker;if(c)c.postMessage({cmd:"flush",chunkMeta:e});else if(n){var l=n.flush(e);Object(M.isPromise)(l)?l.then(function(u){a.handleFlushResult(u,e)}):this.handleFlushResult(l,e)}},p.handleFlushResult=function(e,a){var n=this;e.forEach(function(c){n.handleTransmuxComplete(c)}),this.onFlush(a)},p.onWorkerMessage=function(e){var a=e.data,n=this.hls;switch(a.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(a.data);break}case"flush":{this.onFlush(a.data);break}default:{a.data=a.data||{},a.data.frag=this.frag,a.data.id=this.id,n.trigger(a.event,a.data);break}}},p.configureTransmuxer=function(e){var a=this.worker,n=this.transmuxer;a?a.postMessage({cmd:"configure",config:e}):n&&n.configure(e)},p.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},y}()},"./src/demux/transmuxer-worker.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return A});var O=b("./src/demux/transmuxer.ts"),C=b("./src/events.ts"),E=b("./src/utils/logger.ts"),M=b("./node_modules/eventemitter3/index.js"),w=b.n(M);function A(v){var y=new M.EventEmitter,p=function(e,a){v.postMessage({event:e,data:a})};y.on(C.Events.FRAG_DECRYPTED,p),y.on(C.Events.ERROR,p),v.addEventListener("message",function(s){var e=s.data;switch(e.cmd){case"init":{var a=JSON.parse(e.config);v.transmuxer=new O.default(y,e.typeSupported,a,e.vendor,e.id),Object(E.enableLogs)(a.debug),p("init",null);break}case"configure":{v.transmuxer.configure(e.config);break}case"demux":{var n=v.transmuxer.push(e.data,e.decryptdata,e.chunkMeta,e.state);Object(O.isPromise)(n)?n.then(function(u){_(v,u)}):_(v,n);break}case"flush":{var c=e.chunkMeta,l=v.transmuxer.flush(c);Object(O.isPromise)(l)?l.then(function(u){x(v,u,c)}):x(v,l,c);break}default:break}})}function _(v,y){if(S(y.remuxResult))return;var p=[],s=y.remuxResult,e=s.audio,a=s.video;e&&g(p,e),a&&g(p,a),v.postMessage({event:"transmuxComplete",data:y},p)}function g(v,y){y.data1&&v.push(y.data1.buffer),y.data2&&v.push(y.data2.buffer)}function x(v,y,p){y.forEach(function(s){_(v,s)}),v.postMessage({event:"flush",data:p})}function S(v){return!v.audio&&!v.video&&!v.text&&!v.id3&&!v.initSegment}},"./src/demux/transmuxer.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return a}),b.d(k,"isPromise",function(){return l}),b.d(k,"TransmuxConfig",function(){return u}),b.d(k,"TransmuxState",function(){return m});var O=b("./src/events.ts"),C=b("./src/errors.ts"),E=b("./src/crypt/decrypter.ts"),M=b("./src/demux/aacdemuxer.ts"),w=b("./src/demux/mp4demuxer.ts"),A=b("./src/demux/tsdemuxer.ts"),_=b("./src/demux/mp3demuxer.ts"),g=b("./src/remux/mp4-remuxer.ts"),x=b("./src/remux/passthrough-remuxer.ts"),S=b("./src/demux/chunk-cache.ts"),v=b("./src/utils/mp4-tools.ts"),y=b("./src/utils/logger.ts"),p;try{p=self.performance.now.bind(self.performance)}catch(d){y.logger.debug("Unable to use Performance API on this environment"),p=self.Date.now}var s=[{demux:A.default,remux:g.default},{demux:w.default,remux:x.default},{demux:M.default,remux:g.default},{demux:_.default,remux:g.default}],e=1024;s.forEach(function(d){var o=d.demux;e=Math.max(e,o.minProbeByteLength)});var a=function(){function d(i,t,r,h,f){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new S.default,this.observer=i,this.typeSupported=t,this.config=r,this.vendor=h,this.id=f}var o=d.prototype;return o.configure=function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()},o.push=function(t,r,h,f){var T=this,R=h.transmuxing;R.executeStart=p();var L=new Uint8Array(t),N=this.cache,H=this.config,K=this.currentTransmuxState,X=this.transmuxConfig;f&&(this.currentTransmuxState=f);var z=n(L,r);if(z&&z.method==="AES-128"){var J=this.getDecrypter();if(H.enableSoftwareAES){var te=J.softwareDecrypt(L,z.key.buffer,z.iv.buffer);if(!te)return R.executeEnd=p(),c(h);L=new Uint8Array(te)}else return this.decryptionPromise=J.webCryptoDecrypt(L,z.key.buffer,z.iv.buffer).then(function(se){var he=T.push(se,null,h);return T.decryptionPromise=null,he}),this.decryptionPromise}var ee=f||K,ve=ee.contiguous,re=ee.discontinuity,de=ee.trackSwitch,ie=ee.accurateTimeOffset,le=ee.timeOffset,Q=X.audioCodec,Z=X.videoCodec,ne=X.defaultInitPts,Te=X.duration,Ee=X.initSegmentData;if((re||de)&&this.resetInitSegment(Ee,Q,Z,Te),re&&this.resetInitialTimestamp(ne),ve||this.resetContiguity(),this.needsProbing(L,re,de)){if(N.dataLength){var Ce=N.flush();L=Object(v.appendUint8Array)(Ce,L)}this.configureTransmuxer(L,X)}var Ae=this.transmux(L,z,le,ie,h),oe=this.currentTransmuxState;return oe.contiguous=!0,oe.discontinuity=!1,oe.trackSwitch=!1,R.executeEnd=p(),Ae},o.flush=function(t){var r=this,h=t.transmuxing;h.executeStart=p();var f=this.decrypter,T=this.cache,R=this.currentTransmuxState,L=this.decryptionPromise;if(L)return L.then(function(){return r.flush(t)});var N=[],H=R.timeOffset;if(f){var K=f.flush();K&&N.push(this.push(K,null,t))}var X=T.dataLength;T.reset();var z=this.demuxer,J=this.remuxer;if(!z||!J)return X>=e&&this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),h.executeEnd=p(),[c(t)];var te=z.flush(H);return l(te)?te.then(function(ee){return r.flushRemux(N,ee,t),N}):(this.flushRemux(N,te,t),N)},o.flushRemux=function(t,r,h){var f=r.audioTrack,T=r.avcTrack,R=r.id3Track,L=r.textTrack,N=this.currentTransmuxState,H=N.accurateTimeOffset,K=N.timeOffset;y.logger.log("[transmuxer.ts]: Flushed fragment "+h.sn+(h.part>-1?" p: "+h.part:"")+" of level "+h.level);var X=this.remuxer.remux(f,T,R,L,K,H,!0,this.id);t.push({remuxResult:X,chunkMeta:h}),h.transmuxing.executeEnd=p()},o.resetInitialTimestamp=function(t){var r=this.demuxer,h=this.remuxer;if(!r||!h)return;r.resetTimeStamp(t),h.resetTimeStamp(t)},o.resetContiguity=function(){var t=this.demuxer,r=this.remuxer;if(!t||!r)return;t.resetContiguity(),r.resetNextTimestamp()},o.resetInitSegment=function(t,r,h,f){var T=this.demuxer,R=this.remuxer;if(!T||!R)return;T.resetInitSegment(r,h,f),R.resetInitSegment(t,r,h)},o.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},o.transmux=function(t,r,h,f,T){var R;return r&&r.method==="SAMPLE-AES"?R=this.transmuxSampleAes(t,r,h,f,T):R=this.transmuxUnencrypted(t,h,f,T),R},o.transmuxUnencrypted=function(t,r,h,f){var T=this.demuxer.demux(t,r,!1,!this.config.progressive),R=T.audioTrack,L=T.avcTrack,N=T.id3Track,H=T.textTrack,K=this.remuxer.remux(R,L,N,H,r,h,!1,this.id);return{remuxResult:K,chunkMeta:f}},o.transmuxSampleAes=function(t,r,h,f,T){var R=this;return this.demuxer.demuxSampleAes(t,r,h).then(function(L){var N=R.remuxer.remux(L.audioTrack,L.avcTrack,L.id3Track,L.textTrack,h,f,!1,R.id);return{remuxResult:N,chunkMeta:T}})},o.configureTransmuxer=function(t,r){for(var h=this.config,f=this.observer,T=this.typeSupported,R=this.vendor,L=r.audioCodec,N=r.defaultInitPts,H=r.duration,K=r.initSegmentData,X=r.videoCodec,z,J=0,te=s.length;J<te;J++)if(s[J].demux.probe(t)){z=s[J];break}z||(y.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),z={demux:w.default,remux:x.default});var ee=this.demuxer,ve=this.remuxer,re=z.remux,de=z.demux;(!ve||!(ve instanceof re))&&(this.remuxer=new re(f,h,T,R)),(!ee||!(ee instanceof de))&&(this.demuxer=new de(f,h,T),this.probe=de.probe),this.resetInitSegment(K,L,X,H),this.resetInitialTimestamp(N)},o.needsProbing=function(t,r,h){return!this.demuxer||!this.remuxer||r||h},o.getDecrypter=function(){var t=this.decrypter;return t||(t=this.decrypter=new E.default(this.observer,this.config)),t},d}();function n(d,o){var i=null;return d.byteLength>0&&o!=null&&o.key!=null&&o.iv!==null&&o.method!=null&&(i=o),i}var c=function(o){return{remuxResult:{},chunkMeta:o}};function l(d){return"then"in d&&d.then instanceof Function}var u=function(o,i,t,r,h){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=o,this.videoCodec=i,this.initSegmentData=t,this.duration=r,this.defaultInitPts=h},m=function(o,i,t,r,h){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=o,this.contiguous=i,this.accurateTimeOffset=t,this.trackSwitch=r,this.timeOffset=h}},"./src/demux/tsdemuxer.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"discardEPB",function(){return c});var O=b("./src/demux/adts.ts"),C=b("./src/demux/mpegaudio.ts"),E=b("./src/demux/exp-golomb.ts"),M=b("./src/demux/id3.ts"),w=b("./src/demux/sample-aes.ts"),A=b("./src/events.ts"),_=b("./src/utils/mp4-tools.ts"),g=b("./src/utils/logger.ts"),x=b("./src/errors.ts"),S={video:1,audio:2,id3:3,text:4},v=function(){function l(m,d,o){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=m,this.config=d,this.typeSupported=o}l.probe=function(d){var o=l.syncOffset(d);return o<0?!1:(o&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+o+", junk ahead ?"),!0)},l.syncOffset=function(d){for(var o=Math.min(1e3,d.length-3*188),i=0;i<o;){if(d[i]===71&&d[i+188]===71&&d[i+2*188]===71)return i;i++}return-1},l.createTrack=function(d,o){return{container:d==="video"||d==="audio"?"video/mp2t":void 0,type:d,id:S[d],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:d==="audio"?o:void 0}};var u=l.prototype;return u.resetInitSegment=function(d,o,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=l.createTrack("video",i),this._audioTrack=l.createTrack("audio",i),this._id3Track=l.createTrack("id3",i),this._txtTrack=l.createTrack("text",i),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=d,this.videoCodec=o,this._duration=i},u.resetTimeStamp=function(){},u.resetContiguity=function(){var d=this._audioTrack,o=this._avcTrack,i=this._id3Track;d&&(d.pesData=null),o&&(o.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},u.demux=function(d,o,i,t){i===void 0&&(i=!1),t===void 0&&(t=!1),i||(this.sampleAes=null);var r,h=this._avcTrack,f=this._audioTrack,T=this._id3Track,R=h.pid,L=h.pesData,N=f.pid,H=T.pid,K=f.pesData,X=T.pesData,z=!1,J=this.pmtParsed,te=this._pmtId,ee=d.length;if(this.remainderData&&(d=Object(_.appendUint8Array)(this.remainderData,d),ee=d.length,this.remainderData=null),ee<188&&!t)return this.remainderData=d,{audioTrack:f,avcTrack:h,id3Track:T,textTrack:this._txtTrack};var ve=Math.max(0,l.syncOffset(d));ee-=(ee+ve)%188,ee<d.byteLength&&!t&&(this.remainderData=new Uint8Array(d.buffer,ee,d.buffer.byteLength-ee));for(var re=ve;re<ee;re+=188)if(d[re]===71){var de=!!(d[re+1]&64),ie=((d[re+1]&31)<<8)+d[re+2],le=(d[re+3]&48)>>4,Q=void 0;if(le>1){if(Q=re+5+d[re+4],Q===re+188)continue}else Q=re+4;switch(ie){case R:de&&(L&&(r=e(L))&&this.parseAVCPES(r,!1),L={data:[],size:0}),L&&(L.data.push(d.subarray(Q,re+188)),L.size+=re+188-Q);break;case N:de&&(K&&(r=e(K))&&(f.isAAC?this.parseAACPES(r):this.parseMPEGPES(r)),K={data:[],size:0}),K&&(K.data.push(d.subarray(Q,re+188)),K.size+=re+188-Q);break;case H:de&&(X&&(r=e(X))&&this.parseID3PES(r),X={data:[],size:0}),X&&(X.data.push(d.subarray(Q,re+188)),X.size+=re+188-Q);break;case 0:de&&(Q+=d[Q]+1),te=this._pmtId=p(d,Q);break;case te:{de&&(Q+=d[Q]+1);var Z=s(d,Q,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,i);R=Z.avc,R>0&&(h.pid=R),N=Z.audio,N>0&&(f.pid=N,f.isAAC=Z.isAAC),H=Z.id3,H>0&&(T.pid=H),z&&!J&&(g.logger.log("reparse from beginning"),z=!1,re=ve-188),J=this.pmtParsed=!0;break}case 17:case 8191:break;default:z=!0;break}}else this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});h.pesData=L,f.pesData=K,T.pesData=X;var ne={audioTrack:f,avcTrack:h,id3Track:T,textTrack:this._txtTrack};return t&&this.extractRemainingSamples(ne),ne},u.flush=function(){var d=this.remainderData;this.remainderData=null;var o;return d?o=this.demux(d,-1,!1,!0):o={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(o),this.sampleAes?this.decrypt(o,this.sampleAes):o},u.extractRemainingSamples=function(d){var o=d.audioTrack,i=d.avcTrack,t=d.id3Track,r=i.pesData,h=o.pesData,f=t.pesData,T;r&&(T=e(r))?(this.parseAVCPES(T,!0),i.pesData=null):i.pesData=r,h&&(T=e(h))?(o.isAAC?this.parseAACPES(T):this.parseMPEGPES(T),o.pesData=null):(h!=null&&h.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),o.pesData=h),f&&(T=e(f))?(this.parseID3PES(T),t.pesData=null):t.pesData=f},u.demuxSampleAes=function(d,o,i){var t=this.demux(d,i,!0,!this.config.progressive),r=this.sampleAes=new w.default(this.observer,this.config,o);return this.decrypt(t,r)},u.decrypt=function(d,o){return new Promise(function(i){var t=d.audioTrack,r=d.avcTrack;t.samples&&t.isAAC?o.decryptAacSamples(t.samples,0,function(){r.samples?o.decryptAvcSamples(r.samples,0,0,function(){i(d)}):i(d)}):r.samples&&o.decryptAvcSamples(r.samples,0,0,function(){i(d)})})},u.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},u.parseAVCPES=function(d,o){var i=this,t=this._avcTrack,r=this.parseAVCNALu(d.data),h=!1,f=this.avcSample,T,R=!1;d.data=null,f&&r.length&&!t.audFound&&(a(f,t),f=this.avcSample=y(!1,d.pts,d.dts,"")),r.forEach(function(L){switch(L.type){case 1:{T=!0,f||(f=i.avcSample=y(!0,d.pts,d.dts,"")),h&&(f.debug+="NDR "),f.frame=!0;var N=L.data;if(R&&N.length>4){var H=new E.default(N).readSliceType();(H===2||H===4||H===7||H===9)&&(f.key=!0)}break}case 5:T=!0,f||(f=i.avcSample=y(!0,d.pts,d.dts,"")),h&&(f.debug+="IDR "),f.key=!0,f.frame=!0;break;case 6:{T=!0,h&&f&&(f.debug+="SEI ");var K=new E.default(c(L.data));K.readUByte();for(var X=0,z=0,J=!1,te=0;!J&&K.bytesAvailable>1;){X=0;do te=K.readUByte(),X+=te;while(te===255);z=0;do te=K.readUByte(),z+=te;while(te===255);if(X===4&&K.bytesAvailable!==0){J=!0;var ee=K.readUByte();if(ee===181){var ve=K.readUShort();if(ve===49){var re=K.readUInt();if(re===1195456820){var de=K.readUByte();if(de===3){for(var ie=K.readUByte(),le=K.readUByte(),Q=31&ie,Z=[ie,le],ne=0;ne<Q;ne++)Z.push(K.readUByte()),Z.push(K.readUByte()),Z.push(K.readUByte());n(i._txtTrack.samples,{type:3,pts:d.pts,bytes:Z})}}}}}else if(X===5&&K.bytesAvailable!==0){if(J=!0,z>16){for(var Te=[],Ee=0;Ee<16;Ee++)Te.push(K.readUByte().toString(16)),(Ee===3||Ee===5||Ee===7||Ee===9)&&Te.push("-");for(var Ce=z-16,Ae=new Uint8Array(Ce),oe=0;oe<Ce;oe++)Ae[oe]=K.readUByte();n(i._txtTrack.samples,{pts:d.pts,payloadType:X,uuid:Te.join(""),userData:Object(M.utf8ArrayToStr)(Ae),userDataBytes:Ae})}}else if(z<K.bytesAvailable)for(var se=0;se<z;se++)K.readUByte()}break}case 7:if(T=!0,R=!0,h&&f&&(f.debug+="SPS "),!t.sps){var he=new E.default(L.data),ge=he.readSPS();t.width=ge.width,t.height=ge.height,t.pixelRatio=ge.pixelRatio,t.sps=[L.data],t.duration=i._duration;for(var ye=L.data.subarray(1,4),me="avc1.",ue=0;ue<3;ue++){var Oe=ye[ue].toString(16);Oe.length<2&&(Oe="0"+Oe),me+=Oe}t.codec=me}break;case 8:T=!0,h&&f&&(f.debug+="PPS "),t.pps||(t.pps=[L.data]);break;case 9:T=!1,t.audFound=!0,f&&a(f,t),f=i.avcSample=y(!1,d.pts,d.dts,h?"AUD ":"");break;case 12:T=!1;break;default:T=!1,f&&(f.debug+="unknown NAL "+L.type+" ");break}if(f&&T){var Re=f.units;Re.push(L)}}),o&&f&&(a(f,t),this.avcSample=null)},u.getLastNalUnit=function(){var d,o=this.avcSample,i;if(!o||o.units.length===0){var t=this._avcTrack.samples;o=t[t.length-1]}if((d=o)!==null&&d!==void 0&&d.units){var r=o.units;i=r[r.length-1]}return i},u.parseAVCNALu=function(d){var o=d.byteLength,i=this._avcTrack,t=i.naluState||0,r=t,h=[],f=0,T,R,L,N=-1,H=0;for(t===-1&&(N=0,H=d[0]&31,t=0,f=1);f<o;){if(T=d[f++],!t){t=T?0:1;continue}if(t===1){t=T?0:2;continue}if(!T)t=3;else if(T===1){if(N>=0){var K={data:d.subarray(N,f-t-1),type:H};h.push(K)}else{var X=this.getLastNalUnit();if(X&&(r&&f<=4-r&&(X.state&&(X.data=X.data.subarray(0,X.data.byteLength-r))),R=f-t-1,R>0)){var z=new Uint8Array(X.data.byteLength+R);z.set(X.data,0),z.set(d.subarray(0,R),X.data.byteLength),X.data=z,X.state=0}}f<o?(L=d[f]&31,N=f,H=L,t=0):t=-1}else t=0}if(N>=0&&t>=0){var J={data:d.subarray(N,o),type:H,state:t};h.push(J)}if(h.length===0){var te=this.getLastNalUnit();if(te){var ee=new Uint8Array(te.data.byteLength+d.byteLength);ee.set(te.data,0),ee.set(d,te.data.byteLength),te.data=ee}}return i.naluState=t,h},u.parseAACPES=function(d){var o=0,i=this._audioTrack,t=this.aacOverFlow,r=d.data;if(t){this.aacOverFlow=null;var h=t.sample.unit.byteLength,f=Math.min(t.missing,h),T=h-f;t.sample.unit.set(r.subarray(0,f),T),i.samples.push(t.sample),o=t.missing}var R,L;for(R=o,L=r.length;R<L-1&&!O.isHeader(r,R);R++);if(R!==o){var N,H;if(R<L-1?(N="AAC PES did not start with ADTS header,offset:"+R,H=!1):(N="no ADTS header found in AAC PES",H=!0),g.logger.warn("parsing error:"+N),this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.FRAG_PARSING_ERROR,fatal:H,reason:N}),H)return}O.initTrackConfig(i,this.observer,r,R,this.audioCodec);var K;if(d.pts!==void 0)K=d.pts;else if(t){var X=O.getFrameDuration(i.samplerate);K=t.sample.pts+X}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var z=0;R<L;)if(O.isHeader(r,R)){if(R+5<L){var J=O.appendFrame(i,r,R,K,z);if(J)if(J.missing)this.aacOverFlow=J;else{R+=J.length,z++;continue}}break}else R++},u.parseMPEGPES=function(d){var o=d.data,i=o.length,t=0,r=0,h=d.pts;if(h===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;r<i;)if(C.isHeader(o,r)){var f=C.appendFrame(this._audioTrack,o,r,h,t);if(f)r+=f.length,t++;else break}else r++},u.parseID3PES=function(d){if(d.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(d)},l}();v.minProbeByteLength=188;function y(l,u,m,d){return{key:l,frame:!1,pts:u,dts:m,units:[],debug:d,length:0}}function p(l,u){return(l[u+10]&31)<<8|l[u+11]}function s(l,u,m,d){var o={audio:-1,avc:-1,id3:-1,isAAC:!0},i=(l[u+1]&15)<<8|l[u+2],t=u+3+i-4,r=(l[u+10]&15)<<8|l[u+11];for(u+=12+r;u<t;){var h=(l[u+1]&31)<<8|l[u+2];switch(l[u]){case 207:if(!d){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:o.audio===-1&&(o.audio=h);break;case 21:o.id3===-1&&(o.id3=h);break;case 219:if(!d){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:o.avc===-1&&(o.avc=h);break;case 3:case 4:m?o.audio===-1&&(o.audio=h,o.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}u+=((l[u+3]&15)<<8|l[u+4])+5}return o}function e(l){var u=0,m,d,o,i,t,r=l.data;if(!l||l.size===0)return null;for(;r[0].length<19&&r.length>1;){var h=new Uint8Array(r[0].length+r[1].length);h.set(r[0]),h.set(r[1],r[0].length),r[0]=h,r.splice(1,1)}m=r[0];var f=(m[0]<<16)+(m[1]<<8)+m[2];if(f===1){if(d=(m[4]<<8)+m[5],d&&d>l.size-6)return null;var T=m[7];T&192&&(i=(m[9]&14)*536870912+(m[10]&255)*4194304+(m[11]&254)*16384+(m[12]&255)*128+(m[13]&254)/2,T&64?(t=(m[14]&14)*536870912+(m[15]&255)*4194304+(m[16]&254)*16384+(m[17]&255)*128+(m[18]&254)/2,i-t>60*9e4&&(g.logger.warn(Math.round((i-t)/9e4)+"s delta between PTS and DTS, align them"),i=t)):t=i),o=m[8];var R=o+9;if(l.size<=R)return null;l.size-=R;for(var L=new Uint8Array(l.size),N=0,H=r.length;N<H;N++){m=r[N];var K=m.byteLength;if(R)if(R>K){R-=K;continue}else m=m.subarray(R),K-=R,R=0;L.set(m,u),u+=K}return d&&(d-=o+3),{data:L,pts:i,dts:t,len:d}}return null}function a(l,u){if(l.units.length&&l.frame){if(l.pts===void 0){var m=u.samples,d=m.length;if(d){var o=m[d-1];l.pts=o.pts,l.dts=o.dts}else{u.dropped++;return}}u.samples.push(l)}l.debug.length&&g.logger.log(l.pts+"/"+l.dts+":"+l.debug)}function n(l,u){var m=l.length;if(m>0){if(u.pts>=l[m-1].pts)l.push(u);else for(var d=m-1;d>=0;d--)if(u.pts<l[d].pts){l.splice(d,0,u);break}}else l.push(u)}function c(l){for(var u=l.byteLength,m=[],d=1;d<u-2;)l[d]===0&&l[d+1]===0&&l[d+2]===3?(m.push(d+2),d+=2):d++;if(m.length===0)return l;var o=u-m.length,i=new Uint8Array(o),t=0;for(d=0;d<o;t++,d++)t===m[0]&&(t++,m.shift()),i[d]=l[t];return i}k.default=v},"./src/errors.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"ErrorTypes",function(){return O}),b.d(k,"ErrorDetails",function(){return C});var O;(function(E){E.NETWORK_ERROR="networkError",E.MEDIA_ERROR="mediaError",E.KEY_SYSTEM_ERROR="keySystemError",E.MUX_ERROR="muxError",E.OTHER_ERROR="otherError"})(O||(O={}));var C;(function(E){E.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",E.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",E.KEY_SYSTEM_NO_SESSION="keySystemNoSession",E.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",E.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",E.MANIFEST_LOAD_ERROR="manifestLoadError",E.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",E.MANIFEST_PARSING_ERROR="manifestParsingError",E.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",E.LEVEL_EMPTY_ERROR="levelEmptyError",E.LEVEL_LOAD_ERROR="levelLoadError",E.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",E.LEVEL_SWITCH_ERROR="levelSwitchError",E.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",E.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",E.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",E.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",E.FRAG_LOAD_ERROR="fragLoadError",E.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",E.FRAG_DECRYPT_ERROR="fragDecryptError",E.FRAG_PARSING_ERROR="fragParsingError",E.REMUX_ALLOC_ERROR="remuxAllocError",E.KEY_LOAD_ERROR="keyLoadError",E.KEY_LOAD_TIMEOUT="keyLoadTimeOut",E.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",E.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",E.BUFFER_APPEND_ERROR="bufferAppendError",E.BUFFER_APPENDING_ERROR="bufferAppendingError",E.BUFFER_STALLED_ERROR="bufferStalledError",E.BUFFER_FULL_ERROR="bufferFullError",E.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",E.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",E.INTERNAL_EXCEPTION="internalException",E.INTERNAL_ABORTED="aborted",E.UNKNOWN="unknown"})(C||(C={}))},"./src/events.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"Events",function(){return O});var O;(function(C){C.MEDIA_ATTACHING="hlsMediaAttaching",C.MEDIA_ATTACHED="hlsMediaAttached",C.MEDIA_DETACHING="hlsMediaDetaching",C.MEDIA_DETACHED="hlsMediaDetached",C.BUFFER_RESET="hlsBufferReset",C.BUFFER_CODECS="hlsBufferCodecs",C.BUFFER_CREATED="hlsBufferCreated",C.BUFFER_APPENDING="hlsBufferAppending",C.BUFFER_APPENDED="hlsBufferAppended",C.BUFFER_EOS="hlsBufferEos",C.BUFFER_FLUSHING="hlsBufferFlushing",C.BUFFER_FLUSHED="hlsBufferFlushed",C.MANIFEST_LOADING="hlsManifestLoading",C.MANIFEST_LOADED="hlsManifestLoaded",C.MANIFEST_PARSED="hlsManifestParsed",C.LEVEL_SWITCHING="hlsLevelSwitching",C.LEVEL_SWITCHED="hlsLevelSwitched",C.LEVEL_LOADING="hlsLevelLoading",C.LEVEL_LOADED="hlsLevelLoaded",C.LEVEL_UPDATED="hlsLevelUpdated",C.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",C.LEVELS_UPDATED="hlsLevelsUpdated",C.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",C.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",C.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",C.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",C.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",C.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",C.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",C.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",C.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",C.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",C.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",C.CUES_PARSED="hlsCuesParsed",C.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",C.INIT_PTS_FOUND="hlsInitPtsFound",C.FRAG_LOADING="hlsFragLoading",C.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",C.FRAG_LOADED="hlsFragLoaded",C.FRAG_DECRYPTED="hlsFragDecrypted",C.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",C.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",C.FRAG_PARSING_METADATA="hlsFragParsingMetadata",C.FRAG_PARSED="hlsFragParsed",C.FRAG_BUFFERED="hlsFragBuffered",C.FRAG_CHANGED="hlsFragChanged",C.FPS_DROP="hlsFpsDrop",C.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",C.ERROR="hlsError",C.DESTROYING="hlsDestroying",C.KEY_LOADING="hlsKeyLoading",C.KEY_LOADED="hlsKeyLoaded",C.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",C.BACK_BUFFER_REACHED="hlsBackBufferReached"})(O||(O={}))},"./src/hls.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return l});var O=b("./node_modules/url-toolkit/src/url-toolkit.js"),C=b.n(O),E=b("./src/loader/playlist-loader.ts"),M=b("./src/loader/key-loader.ts"),w=b("./src/controller/id3-track-controller.ts"),A=b("./src/controller/latency-controller.ts"),_=b("./src/controller/level-controller.ts"),g=b("./src/controller/fragment-tracker.ts"),x=b("./src/controller/stream-controller.ts"),S=b("./src/is-supported.ts"),v=b("./src/utils/logger.ts"),y=b("./src/config.ts"),p=b("./node_modules/eventemitter3/index.js"),s=b.n(p),e=b("./src/events.ts"),a=b("./src/errors.ts");function n(u,m){for(var d=0;d<m.length;d++){var o=m[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(u,o.key,o)}}function c(u,m,d){return m&&n(u.prototype,m),d&&n(u,d),u}var l=function(){u.isSupported=function(){return Object(S.isSupported)()};function u(d){d===void 0&&(d={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var o=this.config=Object(y.mergeConfig)(u.DefaultConfig,d);this.userConfig=d,Object(v.enableLogs)(o.debug),this._autoLevelCapping=-1,o.progressive&&Object(y.enableStreamingMode)(o);var i=o.abrController,t=o.bufferController,r=o.capLevelController,h=o.fpsController,f=this.abrController=new i(this),T=this.bufferController=new t(this),R=this.capLevelController=new r(this),L=new h(this),N=new E.default(this),H=new M.default(this),K=new w.default(this),X=this.levelController=new _.default(this),z=new g.FragmentTracker(this),J=this.streamController=new x.default(this,z);R.setStreamController(J),L.setStreamController(J);var te=[X,J];this.networkControllers=te;var ee=[N,H,f,T,R,L,K,z];this.audioTrackController=this.createController(o.audioTrackController,null,te),this.createController(o.audioStreamController,z,te),this.subtitleTrackController=this.createController(o.subtitleTrackController,null,te),this.createController(o.subtitleStreamController,z,te),this.createController(o.timelineController,null,ee),this.emeController=this.createController(o.emeController,null,ee),this.cmcdController=this.createController(o.cmcdController,null,ee),this.latencyController=this.createController(A.default,null,ee),this.coreComponents=ee}var m=u.prototype;return m.createController=function(o,i,t){if(o){var r=i?new o(this,i):new o(this);return t&&t.push(r),r}return null},m.on=function(o,i,t){t===void 0&&(t=this),this._emitter.on(o,i,t)},m.once=function(o,i,t){t===void 0&&(t=this),this._emitter.once(o,i,t)},m.removeAllListeners=function(o){this._emitter.removeAllListeners(o)},m.off=function(o,i,t,r){t===void 0&&(t=this),this._emitter.off(o,i,t,r)},m.listeners=function(o){return this._emitter.listeners(o)},m.emit=function(o,i,t){return this._emitter.emit(o,i,t)},m.trigger=function(o,i){if(this.config.debug)return this.emit(o,o,i);try{return this.emit(o,o,i)}catch(t){v.logger.error("An internal error happened while handling event "+o+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.trigger(e.Events.ERROR,{type:a.ErrorTypes.OTHER_ERROR,details:a.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:o,error:t})}return!1},m.listenerCount=function(o){return this._emitter.listenerCount(o)},m.destroy=function(){v.logger.log("destroy"),this.trigger(e.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(o){return o.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(o){return o.destroy()}),this.coreComponents.length=0},m.attachMedia=function(o){v.logger.log("attachMedia"),this._media=o,this.trigger(e.Events.MEDIA_ATTACHING,{media:o})},m.detachMedia=function(){v.logger.log("detachMedia"),this.trigger(e.Events.MEDIA_DETACHING,void 0),this._media=null},m.loadSource=function(o){this.stopLoad();var i=this.media,t=this.url,r=this.url=O.buildAbsoluteURL(self.location.href,o,{alwaysNormalize:!0});v.logger.log("loadSource:"+r),i&&t&&t!==r&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(i)),this.trigger(e.Events.MANIFEST_LOADING,{url:o})},m.startLoad=function(o){o===void 0&&(o=-1),v.logger.log("startLoad("+o+")"),this.networkControllers.forEach(function(i){i.startLoad(o)})},m.stopLoad=function(){v.logger.log("stopLoad"),this.networkControllers.forEach(function(o){o.stopLoad()})},m.swapAudioCodec=function(){v.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},m.recoverMediaError=function(){v.logger.log("recoverMediaError");var o=this._media;this.detachMedia(),o&&this.attachMedia(o)},m.removeLevel=function(o,i){i===void 0&&(i=0),this.levelController.removeLevel(o,i)},c(u,[{key:"levels",get:function(){var o=this.levelController.levels;return o||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(o){v.logger.log("set currentLevel:"+o),this.loadLevel=o,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(o){v.logger.log("set nextLevel:"+o),this.levelController.manualLevel=o,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(o){v.logger.log("set loadLevel:"+o),this.levelController.manualLevel=o}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(o){this.levelController.nextLoadLevel=o}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(o){v.logger.log("set firstLevel:"+o),this.levelController.firstLevel=o}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(o){v.logger.log("set startLevel:"+o),o!==-1&&(o=Math.max(o,this.minAutoLevel)),this.levelController.startLevel=o}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(o){var i=!!o;i!==this.config.capLevelToPlayerSize&&(i?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=i)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(o){this._autoLevelCapping!==o&&(v.logger.log("set autoLevelCapping:"+o),this._autoLevelCapping=o)}},{key:"bandwidthEstimate",get:function(){var o=this.abrController.bwEstimator;return o?o.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var o=this.levels,i=this.config.minAutoBitrate;if(!o)return 0;for(var t=o.length,r=0;r<t;r++)if(o[r].maxBitrate>i)return r;return 0}},{key:"maxAutoLevel",get:function(){var o=this.levels,i=this.autoLevelCapping,t;return i===-1&&o&&o.length?t=o.length-1:t=i,t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(o){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,o)}},{key:"audioTracks",get:function(){var o=this.audioTrackController;return o?o.audioTracks:[]}},{key:"audioTrack",get:function(){var o=this.audioTrackController;return o?o.audioTrack:-1},set:function(o){var i=this.audioTrackController;i&&(i.audioTrack=o)}},{key:"subtitleTracks",get:function(){var o=this.subtitleTrackController;return o?o.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var o=this.subtitleTrackController;return o?o.subtitleTrack:-1},set:function(o){var i=this.subtitleTrackController;i&&(i.subtitleTrack=o)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var o=this.subtitleTrackController;return o?o.subtitleDisplay:!1},set:function(o){var i=this.subtitleTrackController;i&&(i.subtitleDisplay=o)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(o){this.config.lowLatencyMode=o}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return e.Events}},{key:"ErrorTypes",get:function(){return a.ErrorTypes}},{key:"ErrorDetails",get:function(){return a.ErrorDetails}},{key:"DefaultConfig",get:function(){return u.defaultConfig?u.defaultConfig:y.hlsDefaultConfig},set:function(o){u.defaultConfig=o}}]),u}();l.defaultConfig=void 0},"./src/is-supported.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"isSupported",function(){return E}),b.d(k,"changeTypeSupported",function(){return M});var O=b("./src/utils/mediasource-helper.ts");function C(){return self.SourceBuffer||self.WebKitSourceBuffer}function E(){var w=Object(O.getMediaSource)();if(!w)return!1;var A=C(),_=w&&typeof w.isTypeSupported=="function"&&w.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!A||A.prototype&&typeof A.prototype.appendBuffer=="function"&&typeof A.prototype.remove=="function";return!!_&&!!g}function M(){var w,A=C();return typeof(A==null||((w=A.prototype)===null||w===void 0)?void 0:w.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return v}),b.d(k,"LoadError",function(){return p});var O=b("./src/polyfills/number.ts"),C=b("./src/errors.ts");function E(s,e){s.prototype=Object.create(e.prototype),s.prototype.constructor=s,g(s,e)}function M(s){var e=typeof Map=="function"?new Map:void 0;return M=function(n){if(n===null||!_(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(n))return e.get(n);e.set(n,c)}function c(){return w(n,arguments,x(this).constructor)}return c.prototype=Object.create(n.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),g(c,n)},M(s)}function w(s,e,a){return A()?w=Reflect.construct:w=function(c,l,u){var m=[null];m.push.apply(m,l);var d=Function.bind.apply(c,m),o=new d;return u&&g(o,u.prototype),o},w.apply(null,arguments)}function A(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(s){return!1}}function _(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function g(s,e){return g=Object.setPrototypeOf||function(n,c){return n.__proto__=c,n},g(s,e)}function x(s){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},x(s)}var S=Math.pow(2,17),v=function(){function s(a){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=a}var e=s.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(n,c){var l=this,u=n.url;if(!u)return Promise.reject(new p({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,networkDetails:null},"Fragment does not have a "+(u?"part list":"url")));this.abort();var m=this.config,d=m.fLoader,o=m.loader;return new Promise(function(i,t){l.loader&&l.loader.destroy();var r=l.loader=n.loader=d?new d(m):new o(m),h=y(n),f={timeout:m.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:m.fragLoadingMaxRetryTimeout,highWaterMark:S};n.stats=r.stats,r.load(h,f,{onSuccess:function(R,L,N,H){l.resetLoader(n,r),i({frag:n,part:null,payload:R.data,networkDetails:H})},onError:function(R,L,N){l.resetLoader(n,r),t(new p({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,response:R,networkDetails:N}))},onAbort:function(R,L,N){l.resetLoader(n,r),t(new p({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,networkDetails:N}))},onTimeout:function(R,L,N){l.resetLoader(n,r),t(new p({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,networkDetails:N}))},onProgress:function(R,L,N,H){c&&c({frag:n,part:null,payload:N,networkDetails:H})}})})},e.loadPart=function(n,c,l){var u=this;this.abort();var m=this.config,d=m.fLoader,o=m.loader;return new Promise(function(i,t){u.loader&&u.loader.destroy();var r=u.loader=n.loader=d?new d(m):new o(m),h=y(n,c),f={timeout:m.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:m.fragLoadingMaxRetryTimeout,highWaterMark:S};c.stats=r.stats,r.load(h,f,{onSuccess:function(R,L,N,H){u.resetLoader(n,r),u.updateStatsFromPart(n,c);var K={frag:n,part:c,payload:R.data,networkDetails:H};l(K),i(K)},onError:function(R,L,N){u.resetLoader(n,r),t(new p({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,part:c,response:R,networkDetails:N}))},onAbort:function(R,L,N){n.stats.aborted=c.stats.aborted,u.resetLoader(n,r),t(new p({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,part:c,networkDetails:N}))},onTimeout:function(R,L,N){u.resetLoader(n,r),t(new p({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,part:c,networkDetails:N}))}})})},e.updateStatsFromPart=function(n,c){var l=n.stats,u=c.stats,m=u.total;if(l.loaded+=u.loaded,m){var d=Math.round(n.duration/c.duration),o=Math.min(Math.round(l.loaded/m),d),i=d-o,t=i*Math.round(l.loaded/o);l.total=l.loaded+t}else l.total=Math.max(l.loaded,l.total);var r=l.loading,h=u.loading;r.start?r.first+=h.first-h.start:(r.start=h.start,r.first=h.first),r.end=h.end},e.resetLoader=function(n,c){n.loader=null,this.loader===c&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),c.destroy()},s}();function y(s,e){e===void 0&&(e=null);var a=e||s,n={frag:s,part:e,responseType:"arraybuffer",url:a.url,headers:{},rangeStart:0,rangeEnd:0},c=a.byteRangeStartOffset,l=a.byteRangeEndOffset;return Object(O.isFiniteNumber)(c)&&Object(O.isFiniteNumber)(l)&&(n.rangeStart=c,n.rangeEnd=l),n}var p=function(s){E(e,s);function e(a){for(var n,c=arguments.length,l=new Array(c>1?c-1:0),u=1;u<c;u++)l[u-1]=arguments[u];return n=s.call.apply(s,[this].concat(l))||this,n.data=void 0,n.data=a,n}return e}(M(Error))},"./src/loader/fragment.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"ElementaryStreamTypes",function(){return v}),b.d(k,"BaseSegment",function(){return y}),b.d(k,"Fragment",function(){return p}),b.d(k,"Part",function(){return s});var O=b("./src/polyfills/number.ts"),C=b("./node_modules/url-toolkit/src/url-toolkit.js"),E=b.n(C),M=b("./src/utils/logger.ts"),w=b("./src/loader/level-key.ts"),A=b("./src/loader/load-stats.ts");function _(e,a){e.prototype=Object.create(a.prototype),e.prototype.constructor=e,g(e,a)}function g(e,a){return g=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},g(e,a)}function x(e,a){for(var n=0;n<a.length;n++){var c=a[n];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(e,c.key,c)}}function S(e,a,n){return a&&x(e.prototype,a),n&&x(e,n),e}var v;(function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"})(v||(v={}));var y=function(){function e(n){var c;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(c={},c[v.AUDIO]=null,c[v.VIDEO]=null,c[v.AUDIOVIDEO]=null,c),this.baseurl=n}var a=e.prototype;return a.setByteRange=function(c,l){var u=c.split("@",2),m=[];u.length===1?m[0]=l?l.byteRangeEndOffset:0:m[0]=parseInt(u[1]),m[1]=parseInt(u[0])+m[0],this._byteRange=m},S(e,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(C.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(c){this._url=c}}]),e}(),p=function(e){_(a,e);function a(c,l){var u;return u=e.call(this,l)||this,u._decryptdata=null,u.rawProgramDateTime=null,u.programDateTime=null,u.tagList=[],u.duration=0,u.sn=0,u.levelkey=void 0,u.type=void 0,u.loader=null,u.level=-1,u.cc=0,u.startPTS=void 0,u.endPTS=void 0,u.appendedPTS=void 0,u.startDTS=void 0,u.endDTS=void 0,u.start=0,u.deltaPTS=void 0,u.maxStartPTS=void 0,u.minEndPTS=void 0,u.stats=new A.LoadStats,u.urlId=0,u.data=void 0,u.bitrateTest=!1,u.title=null,u.initSegment=null,u.type=c,u}var n=a.prototype;return n.createInitializationVector=function(l){for(var u=new Uint8Array(16),m=12;m<16;m++)u[m]=l>>8*(15-m)&255;return u},n.setDecryptDataFromLevelKey=function(l,u){var m=l;return(l==null?void 0:l.method)==="AES-128"&&l.uri&&!l.iv&&(m=w.LevelKey.fromURI(l.uri),m.method=l.method,m.iv=this.createInitializationVector(u),m.keyFormat="identity"),m},n.setElementaryStreamInfo=function(l,u,m,d,o,i){i===void 0&&(i=!1);var t=this.elementaryStreams,r=t[l];if(!r){t[l]={startPTS:u,endPTS:m,startDTS:d,endDTS:o,partial:i};return}r.startPTS=Math.min(r.startPTS,u),r.endPTS=Math.max(r.endPTS,m),r.startDTS=Math.min(r.startDTS,d),r.endDTS=Math.max(r.endDTS,o)},n.clearElementaryStreamInfo=function(){var l=this.elementaryStreams;l[v.AUDIO]=null,l[v.VIDEO]=null,l[v.AUDIOVIDEO]=null},S(a,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var l=this.sn;typeof l!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&M.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),l=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,l)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(O.isFiniteNumber)(this.programDateTime))return null;var l=Object(O.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+l*1e3}},{key:"encrypted",get:function(){var l;return!!((l=this.decryptdata)!==null&&l!==void 0&&l.keyFormat&&this.decryptdata.uri)}}]),a}(y),s=function(e){_(a,e);function a(n,c,l,u,m){var d;d=e.call(this,l)||this,d.fragOffset=0,d.duration=0,d.gap=!1,d.independent=!1,d.relurl=void 0,d.fragment=void 0,d.index=void 0,d.stats=new A.LoadStats,d.duration=n.decimalFloatingPoint("DURATION"),d.gap=n.bool("GAP"),d.independent=n.bool("INDEPENDENT"),d.relurl=n.enumeratedString("URI"),d.fragment=c,d.index=u;var o=n.enumeratedString("BYTERANGE");return o&&d.setByteRange(o,m),m&&(d.fragOffset=m.fragOffset+m.duration),d}return S(a,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var c=this.elementaryStreams;return!!(c.audio||c.video||c.audiovideo)}}]),a}(y)},"./src/loader/key-loader.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return M});var O=b("./src/events.ts"),C=b("./src/errors.ts"),E=b("./src/utils/logger.ts"),M=function(){function w(_){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=_,this._registerListeners()}var A=w.prototype;return A._registerListeners=function(){this.hls.on(O.Events.KEY_LOADING,this.onKeyLoading,this)},A._unregisterListeners=function(){this.hls.off(O.Events.KEY_LOADING,this.onKeyLoading)},A.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var x=this.loaders[g];x&&x.destroy()}this.loaders={}},A.onKeyLoading=function(g,x){var S=x.frag,v=S.type,y=this.loaders[v];if(!S.decryptdata){E.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var p=S.decryptdata.uri;if(p!==this.decrypturl||this.decryptkey===null){var s=this.hls.config;if(y&&(E.logger.warn("abort previous key loader for type:"+v),y.abort()),!p){E.logger.warn("key uri is falsy");return}var e=s.loader,a=S.loader=this.loaders[v]=new e(s);this.decrypturl=p,this.decryptkey=null;var n={url:p,frag:S,responseType:"arraybuffer"},c={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:0},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};a.load(n,c,l)}else this.decryptkey&&(S.decryptdata.key=this.decryptkey,this.hls.trigger(O.Events.KEY_LOADED,{frag:S}))},A.loadsuccess=function(g,x,S){var v=S.frag;if(!v.decryptdata){E.logger.error("after key load, decryptdata unset");return}this.decryptkey=v.decryptdata.key=new Uint8Array(g.data),v.loader=null,delete this.loaders[v.type],this.hls.trigger(O.Events.KEY_LOADED,{frag:v})},A.loaderror=function(g,x){var S=x.frag,v=S.loader;v&&v.abort(),delete this.loaders[S.type],this.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:S,response:g})},A.loadtimeout=function(g,x){var S=x.frag,v=S.loader;v&&v.abort(),delete this.loaders[S.type],this.hls.trigger(O.Events.ERROR,{type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:S})},w}()},"./src/loader/level-details.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"LevelDetails",function(){return w});var O=b("./src/polyfills/number.ts");function C(A,_){for(var g=0;g<_.length;g++){var x=_[g];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(A,x.key,x)}}function E(A,_,g){return _&&C(A.prototype,_),g&&C(A,g),A}var M=10,w=function(){function A(g){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=g}var _=A.prototype;return _.reloaded=function(x){if(!x){this.advanced=!0,this.updated=!0;return}var S=this.lastPartSn-x.lastPartSn,v=this.lastPartIndex-x.lastPartIndex;this.updated=this.endSN!==x.endSN||!!v||!!S,this.advanced=this.endSN>x.endSN||S>0||S===0&&v>0,this.updated||this.advanced?this.misses=Math.floor(x.misses*.6):this.misses=x.misses+1,this.availabilityDelay=x.availabilityDelay},E(A,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(O.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||M}},{key:"drift",get:function(){var x=this.driftEndTime-this.driftStartTime;if(x>0){var S=this.driftEnd-this.driftStart;return S*1e3/x}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var x;return(x=this.fragments)!==null&&x!==void 0&&x.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),A}()},"./src/loader/level-key.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"LevelKey",function(){return w});var O=b("./node_modules/url-toolkit/src/url-toolkit.js"),C=b.n(O);function E(A,_){for(var g=0;g<_.length;g++){var x=_[g];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(A,x.key,x)}}function M(A,_,g){return _&&E(A.prototype,_),g&&E(A,g),A}var w=function(){A.fromURL=function(g,x){return new A(g,x)},A.fromURI=function(g){return new A(g)};function A(_,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(O.buildAbsoluteURL)(_,g,{alwaysNormalize:!0}):this._uri=_}return M(A,[{key:"uri",get:function(){return this._uri}}]),A}()},"./src/loader/load-stats.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"LoadStats",function(){return O});var O=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return a});var O=b("./src/polyfills/number.ts"),C=b("./node_modules/url-toolkit/src/url-toolkit.js"),E=b.n(C),M=b("./src/loader/fragment.ts"),w=b("./src/loader/level-details.ts"),A=b("./src/loader/level-key.ts"),_=b("./src/utils/attr-list.ts"),g=b("./src/utils/logger.ts"),x=b("./src/utils/codecs.ts"),S=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,v=/#EXT-X-MEDIA:(.*)/g,y=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),s=/\.(mp4|m4s|m4v|m4a)$/i;function e(m){var d,o;return s.test((d=(o=C.parseURL(m))===null||o===void 0?void 0:o.path)!=null?d:"")}var a=function(){function m(){}return m.findGroup=function(o,i){for(var t=0;t<o.length;t++){var r=o[t];if(r.id===i)return r}},m.convertAVC1ToAVCOTI=function(o){var i=o.split(".");if(i.length>2){var t=i.shift()+".";return t+=parseInt(i.shift()).toString(16),t+=("000"+parseInt(i.shift()).toString(16)).substr(-4),t}return o},m.resolve=function(o,i){return C.buildAbsoluteURL(i,o,{alwaysNormalize:!0})},m.parseMasterPlaylist=function(o,i){var t=[],r={},h=!1;S.lastIndex=0;for(var f;(f=S.exec(o))!=null;)if(f[1]){var T=new _.AttrList(f[1]),R={attrs:T,bitrate:T.decimalInteger("AVERAGE-BANDWIDTH")||T.decimalInteger("BANDWIDTH"),name:T.NAME,url:m.resolve(f[2],i)},L=T.decimalResolution("RESOLUTION");L&&(R.width=L.width,R.height=L.height),n((T.CODECS||"").split(/[ ,]+/).filter(function(H){return H}),R),R.videoCodec&&R.videoCodec.indexOf("avc1")!==-1&&(R.videoCodec=m.convertAVC1ToAVCOTI(R.videoCodec)),t.push(R)}else if(f[3]){var N=new _.AttrList(f[3]);N["DATA-ID"]&&(h=!0,r[N["DATA-ID"]]=N)}return{levels:t,sessionData:h?r:null}},m.parseMasterPlaylistMedia=function(o,i,t,r){r===void 0&&(r=[]);var h,f=[],T=0;for(v.lastIndex=0;(h=v.exec(o))!==null;){var R=new _.AttrList(h[1]);if(R.TYPE===t){var L={attrs:R,bitrate:0,id:T++,groupId:R["GROUP-ID"],instreamId:R["INSTREAM-ID"],name:R.NAME||R.LANGUAGE||"",type:t,default:R.bool("DEFAULT"),autoselect:R.bool("AUTOSELECT"),forced:R.bool("FORCED"),lang:R.LANGUAGE,url:R.URI?m.resolve(R.URI,i):""};if(r.length){var N=m.findGroup(r,L.groupId)||r[0];c(L,N,"audioCodec"),c(L,N,"textCodec")}f.push(L)}}return f},m.parseLevelPlaylist=function(o,i,t,r,h){var f=new w.LevelDetails(i),T=f.fragments,R=null,L=0,N=0,H=0,K=0,X=null,z=new M.Fragment(r,i),J,te,ee,ve=-1,re=!1;for(y.lastIndex=0,f.m3u8=o;(J=y.exec(o))!==null;){re&&(re=!1,z=new M.Fragment(r,i),z.start=H,z.sn=L,z.cc=K,z.level=t,R&&(z.initSegment=R,z.rawProgramDateTime=R.rawProgramDateTime));var de=J[1];if(de){z.duration=parseFloat(de);var ie=(" "+J[2]).slice(1);z.title=ie||null,z.tagList.push(ie?["INF",de,ie]:["INF",de])}else if(J[3])Object(O.isFiniteNumber)(z.duration)&&(z.start=H,ee&&(z.levelkey=ee),z.sn=L,z.level=t,z.cc=K,z.urlId=h,T.push(z),z.relurl=(" "+J[3]).slice(1),u(z,X),X=z,H+=z.duration,L++,N=0,re=!0);else if(J[4]){var le=(" "+J[4]).slice(1);X?z.setByteRange(le,X):z.setByteRange(le)}else if(J[5])z.rawProgramDateTime=(" "+J[5]).slice(1),z.tagList.push(["PROGRAM-DATE-TIME",z.rawProgramDateTime]),ve===-1&&(ve=T.length);else{if(J=J[0].match(p),!J){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(te=1;te<J.length&&!(typeof J[te]!="undefined");te++);var Q=(" "+J[te]).slice(1),Z=(" "+J[te+1]).slice(1),ne=J[te+2]?(" "+J[te+2]).slice(1):"";switch(Q){case"PLAYLIST-TYPE":f.type=Z.toUpperCase();break;case"MEDIA-SEQUENCE":L=f.startSN=parseInt(Z);break;case"SKIP":{var Te=new _.AttrList(Z),Ee=Te.decimalInteger("SKIPPED-SEGMENTS");if(Object(O.isFiniteNumber)(Ee)){f.skippedSegments=Ee;for(var Ce=Ee;Ce--;)T.unshift(null);L+=Ee}var Ae=Te.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ae&&(f.recentlyRemovedDateranges=Ae.split(" "));break}case"TARGETDURATION":f.targetduration=parseFloat(Z);break;case"VERSION":f.version=parseInt(Z);break;case"EXTM3U":break;case"ENDLIST":f.live=!1;break;case"#":(Z||ne)&&z.tagList.push(ne?[Z,ne]:[Z]);break;case"DIS":K++;case"GAP":z.tagList.push([Q]);break;case"BITRATE":z.tagList.push([Q,Z]);break;case"DISCONTINUITY-SEQ":K=parseInt(Z);break;case"KEY":{var oe,se=new _.AttrList(Z),he=se.enumeratedString("METHOD"),ge=se.URI,ye=se.hexadecimalInteger("IV"),me=se.enumeratedString("KEYFORMATVERSIONS"),ue=se.enumeratedString("KEYID"),Oe=(oe=se.enumeratedString("KEYFORMAT"))!=null?oe:"identity",Re=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Re.indexOf(Oe)>-1){g.logger.warn("Keyformat "+Oe+" is not supported from the manifest");continue}else if(Oe!=="identity")continue;he&&(ee=A.LevelKey.fromURL(i,ge),ge&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(he)>=0&&(ee.method=he,ee.keyFormat=Oe,ue&&(ee.keyID=ue),me&&(ee.keyFormatVersions=me),ee.iv=ye));break}case"START":{var fe=new _.AttrList(Z),_e=fe.decimalFloatingPoint("TIME-OFFSET");Object(O.isFiniteNumber)(_e)&&(f.startTimeOffset=_e);break}case"MAP":{var je=new _.AttrList(Z);z.relurl=je.URI,je.BYTERANGE&&z.setByteRange(je.BYTERANGE),z.level=t,z.sn="initSegment",ee&&(z.levelkey=ee),z.initSegment=null,R=z,re=!0;break}case"SERVER-CONTROL":{var Ie=new _.AttrList(Z);f.canBlockReload=Ie.bool("CAN-BLOCK-RELOAD"),f.canSkipUntil=Ie.optionalFloat("CAN-SKIP-UNTIL",0),f.canSkipDateRanges=f.canSkipUntil>0&&Ie.bool("CAN-SKIP-DATERANGES"),f.partHoldBack=Ie.optionalFloat("PART-HOLD-BACK",0),f.holdBack=Ie.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var De=new _.AttrList(Z);f.partTarget=De.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ce=f.partList;ce||(ce=f.partList=[]);var Me=N>0?ce[ce.length-1]:void 0,Be=N++,B=new M.Part(new _.AttrList(Z),z,i,Be,Me);ce.push(B),z.duration+=B.duration;break}case"PRELOAD-HINT":{var D=new _.AttrList(Z);f.preloadHint=D;break}case"RENDITION-REPORT":{var P=new _.AttrList(Z);f.renditionReports=f.renditionReports||[],f.renditionReports.push(P);break}default:g.logger.warn("line parsed but not handled: "+J);break}}}X&&!X.relurl?(T.pop(),H-=X.duration,f.partList&&(f.fragmentHint=X)):f.partList&&(u(z,X),z.cc=K,f.fragmentHint=z);var F=T.length,W=T[0],I=T[F-1];if(H+=f.skippedSegments*f.targetduration,H>0&&F&&I){f.averagetargetduration=H/F;var U=I.sn;f.endSN=U!=="initSegment"?U:0,W&&(f.startCC=W.cc,W.initSegment||f.fragments.every(function(j){return j.relurl&&e(j.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),z=new M.Fragment(r,i),z.relurl=I.relurl,z.level=t,z.sn="initSegment",W.initSegment=z,f.needSidxRanges=!0))}else f.endSN=0,f.startCC=0;return f.fragmentHint&&(H+=f.fragmentHint.duration),f.totalduration=H,f.endCC=K,ve>0&&l(T,ve),f},m}();function n(m,d){["video","audio","text"].forEach(function(o){var i=m.filter(function(r){return Object(x.isCodecType)(r,o)});if(i.length){var t=i.filter(function(r){return r.lastIndexOf("avc1",0)===0||r.lastIndexOf("mp4a",0)===0});d[o+"Codec"]=t.length>0?t[0]:i[0],m=m.filter(function(r){return i.indexOf(r)===-1})}}),d.unknownCodecs=m}function c(m,d,o){var i=d[o];i&&(m[o]=i)}function l(m,d){for(var o=m[d],i=d;i--;){var t=m[i];if(!t)return;t.programDateTime=o.programDateTime-t.duration*1e3,o=t}}function u(m,d){m.rawProgramDateTime?m.programDateTime=Date.parse(m.rawProgramDateTime):d!=null&&d.programDateTime&&(m.programDateTime=d.endProgramDateTime),Object(O.isFiniteNumber)(m.programDateTime)||(m.programDateTime=null,m.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/polyfills/number.ts"),C=b("./src/events.ts"),E=b("./src/errors.ts"),M=b("./src/utils/logger.ts"),w=b("./src/utils/mp4-tools.ts"),A=b("./src/loader/m3u8-parser.ts"),_=b("./src/types/loader.ts"),g=b("./src/utils/attr-list.ts");function x(y){var p=y.type;switch(p){case _.PlaylistContextType.AUDIO_TRACK:return _.PlaylistLevelType.AUDIO;case _.PlaylistContextType.SUBTITLE_TRACK:return _.PlaylistLevelType.SUBTITLE;default:return _.PlaylistLevelType.MAIN}}function S(y,p){var s=y.url;return(s===void 0||s.indexOf("data:")===0)&&(s=p.url),s}var v=function(){function y(s){this.hls=void 0,this.loaders=Object.create(null),this.hls=s,this.registerListeners()}var p=y.prototype;return p.registerListeners=function(){var e=this.hls;e.on(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(C.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(C.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(C.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.unregisterListeners=function(){var e=this.hls;e.off(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(C.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(C.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(C.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.createInternalLoader=function(e){var a=this.hls.config,n=a.pLoader,c=a.loader,l=n||c,u=new l(a);return e.loader=u,this.loaders[e.type]=u,u},p.getInternalLoader=function(e){return this.loaders[e.type]},p.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},p.destroyInternalLoaders=function(){for(var e in this.loaders){var a=this.loaders[e];a&&a.destroy(),this.resetInternalLoader(e)}},p.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},p.onManifestLoading=function(e,a){var n=a.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:_.PlaylistContextType.MANIFEST,url:n,deliveryDirectives:null})},p.onLevelLoading=function(e,a){var n=a.id,c=a.level,l=a.url,u=a.deliveryDirectives;this.load({id:n,groupId:null,level:c,responseType:"text",type:_.PlaylistContextType.LEVEL,url:l,deliveryDirectives:u})},p.onAudioTrackLoading=function(e,a){var n=a.id,c=a.groupId,l=a.url,u=a.deliveryDirectives;this.load({id:n,groupId:c,level:null,responseType:"text",type:_.PlaylistContextType.AUDIO_TRACK,url:l,deliveryDirectives:u})},p.onSubtitleTrackLoading=function(e,a){var n=a.id,c=a.groupId,l=a.url,u=a.deliveryDirectives;this.load({id:n,groupId:c,level:null,responseType:"text",type:_.PlaylistContextType.SUBTITLE_TRACK,url:l,deliveryDirectives:u})},p.load=function(e){var a,n=this.hls.config,c=this.getInternalLoader(e);if(c){var l=c.context;if(l&&l.url===e.url){M.logger.trace("[playlist-loader]: playlist request ongoing");return}M.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),c.abort()}var u,m,d,o;switch(e.type){case _.PlaylistContextType.MANIFEST:u=n.manifestLoadingMaxRetry,m=n.manifestLoadingTimeOut,d=n.manifestLoadingRetryDelay,o=n.manifestLoadingMaxRetryTimeout;break;case _.PlaylistContextType.LEVEL:case _.PlaylistContextType.AUDIO_TRACK:case _.PlaylistContextType.SUBTITLE_TRACK:u=0,m=n.levelLoadingTimeOut;break;default:u=n.levelLoadingMaxRetry,m=n.levelLoadingTimeOut,d=n.levelLoadingRetryDelay,o=n.levelLoadingMaxRetryTimeout;break}if(c=this.createInternalLoader(e),(a=e.deliveryDirectives)!==null&&a!==void 0&&a.part){var i;if(e.type===_.PlaylistContextType.LEVEL&&e.level!==null?i=this.hls.levels[e.level].details:e.type===_.PlaylistContextType.AUDIO_TRACK&&e.id!==null?i=this.hls.audioTracks[e.id].details:e.type===_.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(i=this.hls.subtitleTracks[e.id].details),i){var t=i.partTarget,r=i.targetduration;t&&r&&(m=Math.min(Math.max(t*3,r*.8)*1e3,m))}}var h={timeout:m,maxRetry:u,retryDelay:d,maxRetryDelay:o,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};c.load(e,h,f)},p.loadsuccess=function(e,a,n,c){if(c===void 0&&(c=null),n.isSidxRequest){this.handleSidxRequest(e,n),this.handlePlaylistLoaded(e,a,n,c);return}this.resetInternalLoader(n.type);var l=e.data;if(l.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(e,n,"no EXTM3U delimiter",c);return}a.parsing.start=performance.now(),l.indexOf("#EXTINF:")>0||l.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,a,n,c):this.handleMasterPlaylist(e,a,n,c)},p.loaderror=function(e,a,n){n===void 0&&(n=null),this.handleNetworkError(a,n,!1,e)},p.loadtimeout=function(e,a,n){n===void 0&&(n=null),this.handleNetworkError(a,n,!0)},p.handleMasterPlaylist=function(e,a,n,c){var l=this.hls,u=e.data,m=S(e,n),d=A.default.parseMasterPlaylist(u,m),o=d.levels,i=d.sessionData;if(!o.length){this.handleManifestParsingError(e,n,"no level found in manifest",c);return}var t=o.map(function(L){return{id:L.attrs.AUDIO,audioCodec:L.audioCodec}}),r=o.map(function(L){return{id:L.attrs.SUBTITLES,textCodec:L.textCodec}}),h=A.default.parseMasterPlaylistMedia(u,m,"AUDIO",t),f=A.default.parseMasterPlaylistMedia(u,m,"SUBTITLES",r),T=A.default.parseMasterPlaylistMedia(u,m,"CLOSED-CAPTIONS");if(h.length){var R=h.some(function(L){return!L.url});!R&&o[0].audioCodec&&!o[0].attrs.AUDIO&&(M.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),h.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}l.trigger(C.Events.MANIFEST_LOADED,{levels:o,audioTracks:h,subtitles:f,captions:T,url:m,stats:a,networkDetails:c,sessionData:i})},p.handleTrackOrLevelPlaylist=function(e,a,n,c){var l=this.hls,u=n.id,m=n.level,d=n.type,o=S(e,n),i=Object(O.isFiniteNumber)(u)?u:0,t=Object(O.isFiniteNumber)(m)?m:i,r=x(n),h=A.default.parseLevelPlaylist(e.data,o,t,r,i);if(!h.fragments.length){l.trigger(C.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:o,reason:"no fragments found in level",level:typeof n.level=="number"?n.level:void 0});return}if(d===_.PlaylistContextType.MANIFEST){var f={attrs:new g.AttrList({}),bitrate:0,details:h,name:"",url:o};l.trigger(C.Events.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:o,stats:a,networkDetails:c,sessionData:null})}if(a.parsing.end=performance.now(),h.needSidxRanges){var T,R=(T=h.fragments[0].initSegment)===null||T===void 0?void 0:T.url;this.load({url:R,isSidxRequest:!0,type:d,level:m,levelDetails:h,id:u,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}n.levelDetails=h,this.handlePlaylistLoaded(e,a,n,c)},p.handleSidxRequest=function(e,a){var n=Object(w.parseSegmentIndex)(new Uint8Array(e.data));if(!n)return;var c=n.references,l=a.levelDetails;c.forEach(function(u,m){var d=u.info,o=l.fragments[m];o.byteRange.length===0&&o.setByteRange(String(1+d.end-d.start)+"@"+String(d.start)),o.initSegment&&o.initSegment.setByteRange(String(n.moovEndOffset)+"@0")})},p.handleManifestParsingError=function(e,a,n,c){this.hls.trigger(C.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:a.type===_.PlaylistContextType.MANIFEST,url:e.url,reason:n,response:e,context:a,networkDetails:c})},p.handleNetworkError=function(e,a,n,c){n===void 0&&(n=!1),M.logger.warn("[playlist-loader]: A network "+(n?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var l=E.ErrorDetails.UNKNOWN,u=!1,m=this.getInternalLoader(e);switch(e.type){case _.PlaylistContextType.MANIFEST:l=n?E.ErrorDetails.MANIFEST_LOAD_TIMEOUT:E.ErrorDetails.MANIFEST_LOAD_ERROR,u=!0;break;case _.PlaylistContextType.LEVEL:l=n?E.ErrorDetails.LEVEL_LOAD_TIMEOUT:E.ErrorDetails.LEVEL_LOAD_ERROR,u=!1;break;case _.PlaylistContextType.AUDIO_TRACK:l=n?E.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:E.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case _.PlaylistContextType.SUBTITLE_TRACK:l=n?E.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:E.ErrorDetails.SUBTITLE_LOAD_ERROR,u=!1;break}m&&this.resetInternalLoader(e.type);var d={type:E.ErrorTypes.NETWORK_ERROR,details:l,fatal:u,url:e.url,loader:m,context:e,networkDetails:a};c&&(d.response=c),this.hls.trigger(C.Events.ERROR,d)},p.handlePlaylistLoaded=function(e,a,n,c){var l=n.type,u=n.level,m=n.id,d=n.groupId,o=n.loader,i=n.levelDetails,t=n.deliveryDirectives;if(!(i!=null&&i.targetduration)){this.handleManifestParsingError(e,n,"invalid target duration",c);return}if(!o)return;i.live&&(o.getCacheAge&&(i.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(i.ageHeader))&&(i.ageHeader=0));switch(l){case _.PlaylistContextType.MANIFEST:case _.PlaylistContextType.LEVEL:this.hls.trigger(C.Events.LEVEL_LOADED,{details:i,level:u||0,id:m||0,stats:a,networkDetails:c,deliveryDirectives:t});break;case _.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(C.Events.AUDIO_TRACK_LOADED,{details:i,id:m||0,groupId:d||"",stats:a,networkDetails:c,deliveryDirectives:t});break;case _.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(C.Events.SUBTITLE_TRACK_LOADED,{details:i,id:m||0,groupId:d||"",stats:a,networkDetails:c,deliveryDirectives:t});break}},y}();k.default=v},"./src/polyfills/number.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"isFiniteNumber",function(){return O}),b.d(k,"MAX_SAFE_INTEGER",function(){return C});var O=Number.isFinite||function(E){return typeof E=="number"&&isFinite(E)},C=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ae,k,b){"use strict";b.r(k);var O=function(){function C(){}return C.getSilentFrame=function(M,w){switch(M){case"mp4a.40.2":if(w===1)return new Uint8Array([0,200,0,128,35,128]);if(w===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(w===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(w===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(w===5)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(w===6)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(w===1)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(w===2)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(w===3)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]);break}return},C}();k.default=O},"./src/remux/mp4-generator.ts":function(ae,k,b){"use strict";b.r(k);var O=Math.pow(2,32)-1,C=function(){function E(){}return E.init=function(){E.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var w;for(w in E.types)E.types.hasOwnProperty(w)&&(E.types[w]=[w.charCodeAt(0),w.charCodeAt(1),w.charCodeAt(2),w.charCodeAt(3)]);var A=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]),_=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);E.HDLR_TYPES={video:A,audio:_};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0]);E.STTS=E.STSC=E.STCO=x,E.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),E.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),E.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),E.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var S=new Uint8Array([105,115,111,109]),v=new Uint8Array([97,118,99,49]),y=new Uint8Array([0,0,0,1]);E.FTYP=E.box(E.types.ftyp,S,y,S,v),E.DINF=E.box(E.types.dinf,E.box(E.types.dref,g))},E.box=function(w){for(var A=8,_=arguments.length,g=new Array(_>1?_-1:0),x=1;x<_;x++)g[x-1]=arguments[x];for(var S=g.length,v=S;S--;)A+=g[S].byteLength;var y=new Uint8Array(A);for(y[0]=A>>24&255,y[1]=A>>16&255,y[2]=A>>8&255,y[3]=A&255,y.set(w,4),S=0,A=8;S<v;S++)y.set(g[S],A),A+=g[S].byteLength;return y},E.hdlr=function(w){return E.box(E.types.hdlr,E.HDLR_TYPES[w])},E.mdat=function(w){return E.box(E.types.mdat,w)},E.mdhd=function(w,A){A*=w;var _=Math.floor(A/(O+1)),g=Math.floor(A%(O+1));return E.box(E.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,w>>24&255,w>>16&255,w>>8&255,w&255,_>>24,_>>16&255,_>>8&255,_&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},E.mdia=function(w){return E.box(E.types.mdia,E.mdhd(w.timescale,w.duration),E.hdlr(w.type),E.minf(w))},E.mfhd=function(w){return E.box(E.types.mfhd,new Uint8Array([0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255]))},E.minf=function(w){return w.type==="audio"?E.box(E.types.minf,E.box(E.types.smhd,E.SMHD),E.DINF,E.stbl(w)):E.box(E.types.minf,E.box(E.types.vmhd,E.VMHD),E.DINF,E.stbl(w))},E.moof=function(w,A,_){return E.box(E.types.moof,E.mfhd(w),E.traf(_,A))},E.moov=function(w){for(var A=w.length,_=[];A--;)_[A]=E.trak(w[A]);return E.box.apply(null,[E.types.moov,E.mvhd(w[0].timescale,w[0].duration)].concat(_).concat(E.mvex(w)))},E.mvex=function(w){for(var A=w.length,_=[];A--;)_[A]=E.trex(w[A]);return E.box.apply(null,[E.types.mvex].concat(_))},E.mvhd=function(w,A){A*=w;var _=Math.floor(A/(O+1)),g=Math.floor(A%(O+1)),x=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,w>>24&255,w>>16&255,w>>8&255,w&255,_>>24,_>>16&255,_>>8&255,_&255,g>>24,g>>16&255,g>>8&255,g&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return E.box(E.types.mvhd,x)},E.sdtp=function(w){var A=w.samples||[],_=new Uint8Array(4+A.length),g,x;for(g=0;g<A.length;g++)x=A[g].flags,_[g+4]=x.dependsOn<<4|x.isDependedOn<<2|x.hasRedundancy;return E.box(E.types.sdtp,_)},E.stbl=function(w){return E.box(E.types.stbl,E.stsd(w),E.box(E.types.stts,E.STTS),E.box(E.types.stsc,E.STSC),E.box(E.types.stsz,E.STSZ),E.box(E.types.stco,E.STCO))},E.avc1=function(w){var A=[],_=[],g,x,S;for(g=0;g<w.sps.length;g++)x=w.sps[g],S=x.byteLength,A.push(S>>>8&255),A.push(S&255),A=A.concat(Array.prototype.slice.call(x));for(g=0;g<w.pps.length;g++)x=w.pps[g],S=x.byteLength,_.push(S>>>8&255),_.push(S&255),_=_.concat(Array.prototype.slice.call(x));var v=E.box(E.types.avcC,new Uint8Array([1,A[3],A[4],A[5],252|3,224|w.sps.length].concat(A).concat([w.pps.length]).concat(_))),y=w.width,p=w.height,s=w.pixelRatio[0],e=w.pixelRatio[1];return E.box(E.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,y>>8&255,y&255,p>>8&255,p&255,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]),v,E.box(E.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),E.box(E.types.pasp,new Uint8Array([s>>24,s>>16&255,s>>8&255,s&255,e>>24,e>>16&255,e>>8&255,e&255])))},E.esds=function(w){var A=w.config.length;return new Uint8Array([0,0,0,0,3,23+A,0,1,0,4,15+A,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([A]).concat(w.config).concat([6,1,2]))},E.mp4a=function(w){var A=w.samplerate;return E.box(E.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,w.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]),E.box(E.types.esds,E.esds(w)))},E.mp3=function(w){var A=w.samplerate;return E.box(E.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,w.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]))},E.stsd=function(w){return w.type==="audio"?!w.isAAC&&w.codec==="mp3"?E.box(E.types.stsd,E.STSD,E.mp3(w)):E.box(E.types.stsd,E.STSD,E.mp4a(w)):E.box(E.types.stsd,E.STSD,E.avc1(w))},E.tkhd=function(w){var A=w.id,_=w.duration*w.timescale,g=w.width,x=w.height,S=Math.floor(_/(O+1)),v=Math.floor(_%(O+1));return E.box(E.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,A>>24&255,A>>16&255,A>>8&255,A&255,0,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,v>>24,v>>16&255,v>>8&255,v&255,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,g>>8&255,g&255,0,0,x>>8&255,x&255,0,0]))},E.traf=function(w,A){var _=E.sdtp(w),g=w.id,x=Math.floor(A/(O+1)),S=Math.floor(A%(O+1));return E.box(E.types.traf,E.box(E.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),E.box(E.types.tfdt,new Uint8Array([1,0,0,0,x>>24,x>>16&255,x>>8&255,x&255,S>>24,S>>16&255,S>>8&255,S&255])),E.trun(w,_.length+16+20+8+16+8+8),_)},E.trak=function(w){return w.duration=w.duration||4294967295,E.box(E.types.trak,E.tkhd(w),E.mdia(w))},E.trex=function(w){var A=w.id;return E.box(E.types.trex,new Uint8Array([0,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},E.trun=function(w,A){var _=w.samples||[],g=_.length,x=12+16*g,S=new Uint8Array(x),v,y,p,s,e,a;for(A+=8+x,S.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255],0),v=0;v<g;v++)y=_[v],p=y.duration,s=y.size,e=y.flags,a=y.cts,S.set([p>>>24&255,p>>>16&255,p>>>8&255,p&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255,e.isLeading<<2|e.dependsOn,e.isDependedOn<<6|e.hasRedundancy<<4|e.paddingValue<<1|e.isNonSync,e.degradPrio&240<<8,e.degradPrio&15,a>>>24&255,a>>>16&255,a>>>8&255,a&255],12+16*v);return E.box(E.types.trun,S)},E.initSegment=function(w){E.types||E.init();var A=E.moov(w),_=new Uint8Array(E.FTYP.byteLength+A.byteLength);return _.set(E.FTYP),_.set(A,E.FTYP.byteLength),_},E}();C.types=void 0,C.HDLR_TYPES=void 0,C.STTS=void 0,C.STSC=void 0,C.STCO=void 0,C.STSZ=void 0,C.VMHD=void 0,C.SMHD=void 0,C.STSD=void 0,C.FTYP=void 0,C.DINF=void 0,k.default=C},"./src/remux/mp4-remuxer.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return a}),b.d(k,"normalizePts",function(){return n});var O=b("./src/polyfills/number.ts"),C=b("./src/remux/aac-helper.ts"),E=b("./src/remux/mp4-generator.ts"),M=b("./src/events.ts"),w=b("./src/errors.ts"),A=b("./src/utils/logger.ts"),_=b("./src/types/loader.ts"),g=b("./src/utils/timescale-conversion.ts");function x(){return x=Object.assign||function(m){for(var d=1;d<arguments.length;d++){var o=arguments[d];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(m[i]=o[i])}return m},x.apply(this,arguments)}var S=10*1e3,v=1024,y=1152,p=null,s=null,e=!1,a=function(){function m(o,i,t,r){if(r===void 0&&(r=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=o,this.config=i,this.typeSupported=t,this.ISGenerated=!1,p===null){var h=navigator.userAgent||"",f=h.match(/Chrome\/(\d+)/i);p=f?parseInt(f[1]):0}if(s===null){var T=navigator.userAgent.match(/Safari\/(\d+)/i);s=T?parseInt(T[1]):0}e=!!p&&p<75||!!s&&s<600}var d=m.prototype;return d.destroy=function(){},d.resetTimeStamp=function(i){A.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=i},d.resetNextTimestamp=function(){A.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},d.resetInitSegment=function(){A.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},d.getVideoStartPts=function(i){var t=!1,r=i.reduce(function(h,f){var T=f.pts-h;return T<-4294967296?(t=!0,n(h,f.pts)):T>0?h:f.pts},i[0].pts);return t&&A.logger.debug("PTS rollover detected"),r},d.remux=function(i,t,r,h,f,T,R,L){var N,H,K,X,z,J,te=f,ee=f,ve=i.pid>-1,re=t.pid>-1,de=t.samples.length,ie=i.samples.length>0,le=de>1,Q=(!ve||ie)&&(!re||le)||this.ISGenerated||R;if(Q){this.ISGenerated||(K=this.generateIS(i,t,f));var Z=this.isVideoContiguous,ne=-1;if(le&&(ne=c(t.samples),!Z&&this.config.forceKeyFrameOnDiscontinuity))if(J=!0,ne>0){A.logger.warn("[mp4-remuxer]: Dropped "+ne+" out of "+de+" video samples due to a missing keyframe");var Te=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(ne),t.dropped+=ne,ee+=(t.samples[0].pts-Te)/(t.timescale||9e4)}else ne===-1&&(A.logger.warn("[mp4-remuxer]: No keyframe found out of "+de+" video samples"),J=!1);if(this.ISGenerated){if(ie&&le){var Ee=this.getVideoStartPts(t.samples),Ce=n(i.samples[0].pts,Ee)-Ee,Ae=Ce/t.inputTimeScale;te+=Math.max(0,Ae),ee+=Math.max(0,-Ae)}if(ie){if(i.samplerate||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),K=this.generateIS(i,t,f)),H=this.remuxAudio(i,te,this.isAudioContiguous,T,re||le||L===_.PlaylistLevelType.AUDIO?ee:void 0),le){var oe=H?H.endPTS-H.startPTS:0;t.inputTimeScale||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),K=this.generateIS(i,t,f)),N=this.remuxVideo(t,ee,Z,oe)}}else le&&(N=this.remuxVideo(t,ee,Z,0));N&&(N.firstKeyFrame=ne,N.independent=ne!==-1)}}return this.ISGenerated&&(r.samples.length&&(z=this.remuxID3(r,f)),h.samples.length&&(X=this.remuxText(h,f))),{audio:H,video:N,initSegment:K,independent:J,text:X,id3:z}},d.generateIS=function(i,t,r){var h=i.samples,f=t.samples,T=this.typeSupported,R={},L=!Object(O.isFiniteNumber)(this._initPTS),N="audio/mp4",H,K,X;if(L&&(H=K=Infinity),i.config&&h.length&&(i.timescale=i.samplerate,i.isAAC||(T.mpeg?(N="audio/mpeg",i.codec=""):T.mp3&&(i.codec="mp3")),R.audio={id:"audio",container:N,codec:i.codec,initSegment:!i.isAAC&&T.mpeg?new Uint8Array(0):E.default.initSegment([i]),metadata:{channelCount:i.channelCount}},L&&(X=i.inputTimeScale,H=K=h[0].pts-Math.round(X*r))),t.sps&&t.pps&&f.length&&(t.timescale=t.inputTimeScale,R.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:E.default.initSegment([t]),metadata:{width:t.width,height:t.height}},L)){X=t.inputTimeScale;var z=this.getVideoStartPts(f),J=Math.round(X*r);K=Math.min(K,n(f[0].dts,z)-J),H=Math.min(H,z-J)}if(Object.keys(R).length)return this.ISGenerated=!0,L&&(this._initPTS=H,this._initDTS=K),{tracks:R,initPTS:H,timescale:X}},d.remuxVideo=function(i,t,r,h){var f=i.inputTimeScale,T=i.samples,R=[],L=T.length,N=this._initPTS,H=this.nextAvcDts,K=8,X,z,J,te=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,ve=0,re=!1;if(!r||H===null){var de=t*f,ie=T[0].pts-n(T[0].dts,T[0].pts);H=de-ie}for(var le=0;le<L;le++){var Q=T[le];if(Q.pts=n(Q.pts-N,H),Q.dts=n(Q.dts-N,H),Q.dts>Q.pts){var Z=9e4*.2;ve=Math.max(Math.min(ve,Q.pts-Q.dts),-1*Z)}Q.dts<T[le>0?le-1:le].dts&&(re=!0)}re&&T.sort(function(Ke,Fe){var ke=Ke.dts-Fe.dts,ze=Ke.pts-Fe.pts;return ke||ze}),z=T[0].dts,J=T[T.length-1].dts;var ne=Math.round((J-z)/(L-1));if(ve<0){if(ve<ne*-2){A.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-ne,!0)+" ms");for(var Te=ve,Ee=0;Ee<L;Ee++)T[Ee].dts=Te=Math.max(Te,T[Ee].pts-ne),T[Ee].pts=Math.max(Te,T[Ee].pts)}else{A.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(ve,!0)+" ms to overcome this issue");for(var Ce=0;Ce<L;Ce++)T[Ce].dts=T[Ce].dts+ve}z=T[0].dts}if(r){var Ae=z-H,oe=Ae>ne,se=Ae<-1;if(oe||se){oe?A.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Ae,!0)+" ms ("+Ae+"dts) hole between fragments detected, filling it"):A.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Ae,!0)+" ms ("+Ae+"dts) overlapping between fragments detected"),z=H;var he=T[0].pts-Ae;T[0].dts=z,T[0].pts=he,A.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(he,!0)+"/"+Object(g.toMsFromMpegTsClock)(z,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(Ae,!0)+" ms")}}e&&(z=Math.max(0,z));for(var ge=0,ye=0,me=0;me<L;me++){for(var ue=T[me],Oe=ue.units,Re=Oe.length,fe=0,_e=0;_e<Re;_e++)fe+=Oe[_e].data.length;ye+=fe,ge+=Re,ue.length=fe,ue.dts=Math.max(ue.dts,z),ue.pts=Math.max(ue.pts,ue.dts,0),te=Math.min(ue.pts,te),ee=Math.max(ue.pts,ee)}J=T[L-1].dts;var je=ye+4*ge+8,Ie;try{Ie=new Uint8Array(je)}catch(Ke){this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:w.ErrorTypes.MUX_ERROR,details:w.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating video mdat "+je});return}var De=new DataView(Ie.buffer);De.setUint32(0,je),Ie.set(E.default.types.mdat,4);for(var ce=0;ce<L;ce++){for(var Me=T[ce],Be=Me.units,B=0,D=0,P=Be.length;D<P;D++){var F=Be[D],W=F.data,I=F.data.byteLength;De.setUint32(K,I),K+=4,Ie.set(W,K),K+=I,B+=4+I}if(ce<L-1)X=T[ce+1].dts-Me.dts;else{var U=this.config,j=Me.dts-T[ce>0?ce-1:ce].dts;if(U.stretchShortVideoTrack&&this.nextAudioPts!==null){var G=Math.floor(U.maxBufferHole*f),$=(h?te+h*f:this.nextAudioPts)-Me.pts;$>G?(X=$-j,X<0&&(X=j),A.logger.log("[mp4-remuxer]: It is approximately "+$/90+" ms to the next segment; using duration "+X/90+" ms for the last video frame.")):X=j}else X=j}var Y=Math.round(Me.pts-Me.dts);R.push(new l(Me.key,X,B,Y))}if(R.length&&p&&p<70){var q=R[0].flags;q.dependsOn=2,q.isNonSync=0}console.assert(X!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=H=J+X,this.isVideoContiguous=!0;var Se=E.default.moof(i.sequenceNumber++,z,x({},i,{samples:R})),we="video",xe={data1:Se,data2:Ie,startPTS:te/f,endPTS:(ee+X)/f,startDTS:z/f,endDTS:H/f,type:we,hasAudio:!1,hasVideo:!0,nb:R.length,dropped:i.dropped};return i.samples=[],i.dropped=0,console.assert(Ie.length,"MDAT length must not be zero"),xe},d.remuxAudio=function(i,t,r,h,f){var T=i.inputTimeScale,R=i.samplerate?i.samplerate:T,L=T/R,N=i.isAAC?v:y,H=N*L,K=this._initPTS,X=!i.isAAC&&this.typeSupported.mpeg,z=[],J=i.samples,te=X?0:8,ee=this.nextAudioPts||-1,ve=t*T;if(this.isAudioContiguous=r=r||J.length&&ee>0&&(h&&Math.abs(ve-ee)<9e3||Math.abs(n(J[0].pts-K,ve)-ee)<20*H),J.forEach(function(W){W.pts=n(W.pts-K,ve)}),!r||ee<0){if(J=J.filter(function(W){return W.pts>=0}),!J.length)return;f===0?ee=0:h?ee=Math.max(0,ve):ee=J[0].pts}if(i.isAAC)for(var re=f!==void 0,de=this.config.maxAudioFramesDrift,ie=0,le=ee;ie<J.length;ie++){var Q=J[ie],Z=Q.pts,ne=Z-le,Te=Math.abs(1e3*ne/T);if(ne<=-de*H&&re)ie===0&&(A.logger.warn("Audio frame @ "+(Z/T).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ne/T)+" ms."),this.nextAudioPts=ee=le=Z);else if(ne>=de*H&&Te<S&&re){var Ee=Math.round(ne/H);le=Z-Ee*H,le<0&&(Ee--,le+=H),ie===0&&(this.nextAudioPts=ee=le),A.logger.warn("[mp4-remuxer]: Injecting "+Ee+" audio frame @ "+(le/T).toFixed(3)+"s due to "+Math.round(1e3*ne/T)+" ms gap.");for(var Ce=0;Ce<Ee;Ce++){var Ae=Math.max(le,0),oe=C.default.getSilentFrame(i.manifestCodec||i.codec,i.channelCount);oe||(A.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),oe=Q.unit.subarray()),J.splice(ie,0,{unit:oe,pts:Ae}),le+=H,ie++}}Q.pts=le,le+=H}for(var se=null,he=null,ge,ye=0,me=J.length;me--;)ye+=J[me].unit.byteLength;for(var ue=0,Oe=J.length;ue<Oe;ue++){var Re=J[ue],fe=Re.unit,_e=Re.pts;if(he!==null){var je=z[ue-1];je.duration=Math.round((_e-he)/L)}else if(r&&i.isAAC&&(_e=ee),se=_e,ye>0){ye+=te;try{ge=new Uint8Array(ye)}catch(W){this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:w.ErrorTypes.MUX_ERROR,details:w.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ye,reason:"fail allocating audio mdat "+ye});return}if(!X){var Ie=new DataView(ge.buffer);Ie.setUint32(0,ye),ge.set(E.default.types.mdat,4)}}else return;ge.set(fe,te);var De=fe.byteLength;te+=De,z.push(new l(!0,N,De,0)),he=_e}var ce=z.length;if(!ce)return;var Me=z[z.length-1];this.nextAudioPts=ee=he+L*Me.duration;var Be=X?new Uint8Array(0):E.default.moof(i.sequenceNumber++,se/L,x({},i,{samples:z}));i.samples=[];var B=se/T,D=ee/T,P="audio",F={data1:Be,data2:ge,startPTS:B,endPTS:D,startDTS:B,endDTS:D,type:P,hasAudio:!0,hasVideo:!1,nb:ce};return this.isAudioContiguous=!0,console.assert(ge.length,"MDAT length must not be zero"),F},d.remuxEmptyAudio=function(i,t,r,h){var f=i.inputTimeScale,T=i.samplerate?i.samplerate:f,R=f/T,L=this.nextAudioPts,N=(L!==null?L:h.startDTS*f)+this._initDTS,H=h.endDTS*f+this._initDTS,K=R*v,X=Math.ceil((H-N)/K),z=C.default.getSilentFrame(i.manifestCodec||i.codec,i.channelCount);if(A.logger.warn("[mp4-remuxer]: remux empty Audio"),!z){A.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var J=[],te=0;te<X;te++){var ee=N+te*K;J.push({unit:z,pts:ee,dts:ee})}return i.samples=J,this.remuxAudio(i,t,r,!1)},d.remuxID3=function(i,t){var r=i.samples.length;if(!r)return;for(var h=i.inputTimeScale,f=this._initPTS,T=this._initDTS,R=0;R<r;R++){var L=i.samples[R];L.pts=n(L.pts-f,t*h)/h,L.dts=n(L.dts-T,t*h)/h}var N=i.samples;return i.samples=[],{samples:N}},d.remuxText=function(i,t){var r=i.samples.length;if(!r)return;for(var h=i.inputTimeScale,f=this._initPTS,T=0;T<r;T++){var R=i.samples[T];R.pts=n(R.pts-f,t*h)/h}i.samples.sort(function(N,H){return N.pts-H.pts});var L=i.samples;return i.samples=[],{samples:L}},m}();function n(m,d){var o;if(d===null)return m;for(d<m?o=-8589934592:o=8589934592;Math.abs(m-d)>4294967296;)m+=o;return m}function c(m){for(var d=0;d<m.length;d++)if(m[d].key)return d;return-1}var l=function(d,o,i,t){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=o,this.size=i,this.cts=t,this.flags=new u(d)},u=function(d){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=d?2:1,this.isNonSync=d?0:1}},"./src/remux/passthrough-remuxer.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/polyfills/number.ts"),C=b("./src/utils/mp4-tools.ts"),E=b("./src/loader/fragment.ts"),M=b("./src/utils/logger.ts"),w=function(){function g(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var x=g.prototype;return x.destroy=function(){},x.resetTimeStamp=function(v){this.initPTS=v,this.lastEndDTS=null},x.resetNextTimestamp=function(){this.lastEndDTS=null},x.resetInitSegment=function(v,y,p){this.audioCodec=y,this.videoCodec=p,this.generateInitSegment(v),this.emitInitSegment=!0},x.generateInitSegment=function(v){var y=this.audioCodec,p=this.videoCodec;if(!v||!v.byteLength){this.initTracks=void 0,this.initData=void 0;return}var s=this.initData=Object(C.parseInitSegment)(v);y||(y=_(s.audio,E.ElementaryStreamTypes.AUDIO)),p||(p=_(s.video,E.ElementaryStreamTypes.VIDEO));var e={};s.audio&&s.video?e.audiovideo={container:"video/mp4",codec:y+","+p,initSegment:v,id:"main"}:s.audio?e.audio={container:"audio/mp4",codec:y,initSegment:v,id:"audio"}:s.video?e.video={container:"video/mp4",codec:p,initSegment:v,id:"main"}:M.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=e},x.remux=function(v,y,p,s,e){var a=this.initPTS,n=this.lastEndDTS,c={audio:void 0,video:void 0,text:s,id3:p,initSegment:void 0};Object(O.isFiniteNumber)(n)||(n=this.lastEndDTS=e||0);var l=y.samples;if(!l||!l.length)return c;var u={initPTS:void 0,timescale:1},m=this.initData;if((!m||!m.length)&&(this.generateInitSegment(l),m=this.initData),!m||!m.length)return M.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),c;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1),Object(O.isFiniteNumber)(a)||(this.initPTS=u.initPTS=a=A(m,l,n));var d=Object(C.getDuration)(l,m),o=n,i=d+o;Object(C.offsetStartDTS)(m,l,a),d>0?this.lastEndDTS=i:(M.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var t=!!m.audio,r=!!m.video,h="";t&&(h+="audio"),r&&(h+="video");var f={data1:l,startPTS:o,startDTS:o,endPTS:i,endDTS:i,type:h,hasAudio:t,hasVideo:r,nb:1,dropped:0};return c.audio=f.type==="audio"?f:void 0,c.video=f.type!=="audio"?f:void 0,c.text=s,c.id3=p,c.initSegment=u,c},g}(),A=function(x,S,v){return Object(C.getStartDTS)(x,S)-v};function _(g,x){var S=g==null?void 0:g.codec;return S&&S.length>4?S:S==="hvc1"?"hvc1.1.c.L120.90":S==="av01"?"av01.0.04M.08":S==="avc1"||x===E.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}k.default=w},"./src/task-loop.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return O});var O=function(){function C(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var E=C.prototype;return E.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},E.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},E.onHandlerDestroyed=function(){},E.hasInterval=function(){return!!this._tickInterval},E.hasNextTick=function(){return!!this._tickTimer},E.setInterval=function(w){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,w),!0)},E.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},E.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},E.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},E.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},E.doTick=function(){},C}()},"./src/types/cmcd.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"CMCDVersion",function(){return O}),b.d(k,"CMCDObjectType",function(){return C}),b.d(k,"CMCDStreamingFormat",function(){return E}),b.d(k,"CMCDStreamType",function(){return M});var O=1,C;(function(w){w.MANIFEST="m",w.AUDIO="a",w.VIDEO="v",w.MUXED="av",w.INIT="i",w.CAPTION="c",w.TIMED_TEXT="tt",w.KEY="k",w.OTHER="o"})(C||(C={}));var E;(function(w){w.DASH="d",w.HLS="h",w.SMOOTH="s",w.OTHER="o"})(E||(E={}));var M;(function(w){w.VOD="v",w.LIVE="l"})(M||(M={}))},"./src/types/level.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"HlsSkip",function(){return E}),b.d(k,"getSkipValue",function(){return M}),b.d(k,"HlsUrlParameters",function(){return w}),b.d(k,"Level",function(){return A});function O(_,g){for(var x=0;x<g.length;x++){var S=g[x];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(_,S.key,S)}}function C(_,g,x){return g&&O(_.prototype,g),x&&O(_,x),_}var E;(function(_){_.No="",_.Yes="YES",_.v2="v2"})(E||(E={}));function M(_,g){var x=_.canSkipUntil,S=_.canSkipDateRanges,v=_.endSN,y=g!==void 0?g-v:0;return x&&y<x?S?E.v2:E.Yes:E.No}var w=function(){function _(x,S,v){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=x,this.part=S,this.skip=v}var g=_.prototype;return g.addDirectives=function(S){var v=new self.URL(S);return this.msn!==void 0&&v.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&v.searchParams.set("_HLS_part",this.part.toString()),this.skip&&v.searchParams.set("_HLS_skip",this.skip),v.toString()},_}(),A=function(){function _(g){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(x){return x}).join(",").replace(/\.[^.,]+/g,"")}return C(_,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(x){var S=x%this.url.length;this._urlId!==S&&(this.details=void 0,this._urlId=S)}}]),_}()},"./src/types/loader.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"PlaylistContextType",function(){return O}),b.d(k,"PlaylistLevelType",function(){return C});var O;(function(E){E.MANIFEST="manifest",E.LEVEL="level",E.AUDIO_TRACK="audioTrack",E.SUBTITLE_TRACK="subtitleTrack"})(O||(O={}));var C;(function(E){E.MAIN="main",E.AUDIO="audio",E.SUBTITLE="subtitle"})(C||(C={}))},"./src/types/transmuxer.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"ChunkMetadata",function(){return O});var O=function(M,w,A,_,g,x){_===void 0&&(_=0),g===void 0&&(g=-1),x===void 0&&(x=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=C(),this.buffering={audio:C(),video:C(),audiovideo:C()},this.level=M,this.sn=w,this.id=A,this.size=_,this.part=g,this.partial=x};function C(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"AttrList",function(){return E});var O=/^(\d+)x(\d+)$/,C=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,E=function(){function M(A){typeof A=="string"&&(A=M.parseAttrList(A));for(var _ in A)A.hasOwnProperty(_)&&(this[_]=A[_])}var w=M.prototype;return w.decimalInteger=function(_){var g=parseInt(this[_],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},w.hexadecimalInteger=function(_){if(this[_]){var g=(this[_]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var x=new Uint8Array(g.length/2),S=0;S<g.length/2;S++)x[S]=parseInt(g.slice(S*2,S*2+2),16);return x}else return null},w.hexadecimalIntegerAsNumber=function(_){var g=parseInt(this[_],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},w.decimalFloatingPoint=function(_){return parseFloat(this[_])},w.optionalFloat=function(_,g){var x=this[_];return x?parseFloat(x):g},w.enumeratedString=function(_){return this[_]},w.bool=function(_){return this[_]==="YES"},w.decimalResolution=function(_){var g=O.exec(this[_]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},M.parseAttrList=function(_){var g,x={},S='"';for(C.lastIndex=0;(g=C.exec(_))!==null;){var v=g[2];v.indexOf(S)===0&&v.lastIndexOf(S)===v.length-1&&(v=v.slice(1,-1)),x[g[1]]=v}return x},M}()},"./src/utils/binary-search.ts":function(ae,k,b){"use strict";b.r(k);var O={search:function(E,M){for(var w=0,A=E.length-1,_=null,g=null;w<=A;){_=(w+A)/2|0,g=E[_];var x=M(g);if(x>0)w=_+1;else if(x<0)A=_-1;else return g}return null}};k.default=O},"./src/utils/buffer-helper.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"BufferHelper",function(){return E});var O=b("./src/utils/logger.ts"),C={length:0,start:function(){return 0},end:function(){return 0}},E=function(){function M(){}return M.isBuffered=function(A,_){try{if(A){for(var g=M.getBuffered(A),x=0;x<g.length;x++)if(_>=g.start(x)&&_<=g.end(x))return!0}}catch(S){}return!1},M.bufferInfo=function(A,_,g){try{if(A){var x=M.getBuffered(A),S=[],v;for(v=0;v<x.length;v++)S.push({start:x.start(v),end:x.end(v)});return this.bufferedInfo(S,_,g)}}catch(y){}return{len:0,start:_,end:_,nextStart:void 0}},M.bufferedInfo=function(A,_,g){_=Math.max(0,_),A.sort(function(u,m){var d=u.start-m.start;return d||m.end-u.end});var x=[];if(g)for(var S=0;S<A.length;S++){var v=x.length;if(v){var y=x[v-1].end;A[S].start-y<g?A[S].end>y&&(x[v-1].end=A[S].end):x.push(A[S])}else x.push(A[S])}else x=A;for(var p=0,s,e=_,a=_,n=0;n<x.length;n++){var c=x[n].start,l=x[n].end;if(_+g>=c&&_<l)e=c,a=l,p=a-_;else if(_+g<c){s=c;break}}return{len:p,start:e||0,end:a||0,nextStart:s}},M.getBuffered=function(A){try{return A.buffered}catch(_){return O.logger.log("failed to get media.buffered",_),C}},M}()},"./src/utils/cea-608-parser.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"Row",function(){return a}),b.d(k,"CaptionScreen",function(){return n});var O=b("./src/utils/logger.ts"),C={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},E=function(i){var t=i;return C.hasOwnProperty(i)&&(t=C[i]),String.fromCharCode(t)},M=15,w=100,A={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},x={25:2,26:4,29:6,30:8,31:10,27:13,28:15},S=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],v;(function(o){o[o.ERROR=0]="ERROR",o[o.TEXT=1]="TEXT",o[o.WARNING=2]="WARNING",o[o.INFO=2]="INFO",o[o.DEBUG=3]="DEBUG",o[o.DATA=3]="DATA"})(v||(v={}));var y=function(){function o(){this.time=null,this.verboseLevel=v.ERROR}var i=o.prototype;return i.log=function(r,h){this.verboseLevel>=r&&O.logger.log(this.time+" ["+r+"] "+h)},o}(),p=function(i){for(var t=[],r=0;r<i.length;r++)t.push(i[r].toString(16));return t},s=function(){function o(t,r,h,f,T){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=t||"white",this.underline=r||!1,this.italics=h||!1,this.background=f||"black",this.flash=T||!1}var i=o.prototype;return i.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},i.setStyles=function(r){for(var h=["foreground","underline","italics","background","flash"],f=0;f<h.length;f++){var T=h[f];r.hasOwnProperty(T)&&(this[T]=r[T])}},i.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},i.equals=function(r){return this.foreground===r.foreground&&this.underline===r.underline&&this.italics===r.italics&&this.background===r.background&&this.flash===r.flash},i.copy=function(r){this.foreground=r.foreground,this.underline=r.underline,this.italics=r.italics,this.background=r.background,this.flash=r.flash},i.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},o}(),e=function(){function o(t,r,h,f,T,R){this.uchar=void 0,this.penState=void 0,this.uchar=t||" ",this.penState=new s(r,h,f,T,R)}var i=o.prototype;return i.reset=function(){this.uchar=" ",this.penState.reset()},i.setChar=function(r,h){this.uchar=r,this.penState.copy(h)},i.setPenState=function(r){this.penState.copy(r)},i.equals=function(r){return this.uchar===r.uchar&&this.penState.equals(r.penState)},i.copy=function(r){this.uchar=r.uchar,this.penState.copy(r.penState)},i.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},o}(),a=function(){function o(t){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var r=0;r<w;r++)this.chars.push(new e);this.logger=t,this.pos=0,this.currPenState=new s}var i=o.prototype;return i.equals=function(r){for(var h=!0,f=0;f<w;f++)if(!this.chars[f].equals(r.chars[f])){h=!1;break}return h},i.copy=function(r){for(var h=0;h<w;h++)this.chars[h].copy(r.chars[h])},i.isEmpty=function(){for(var r=!0,h=0;h<w;h++)if(!this.chars[h].isEmpty()){r=!1;break}return r},i.setCursor=function(r){this.pos!==r&&(this.pos=r),this.pos<0?(this.logger.log(v.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>w&&(this.logger.log(v.DEBUG,"Too large cursor position "+this.pos),this.pos=w)},i.moveCursor=function(r){var h=this.pos+r;if(r>1)for(var f=this.pos+1;f<h+1;f++)this.chars[f].setPenState(this.currPenState);this.setCursor(h)},i.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},i.insertChar=function(r){r>=144&&this.backSpace();var h=E(r);if(this.pos>=w){this.logger.log(v.ERROR,"Cannot insert "+r.toString(16)+" ("+h+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(h,this.currPenState),this.moveCursor(1)},i.clearFromPos=function(r){var h;for(h=r;h<w;h++)this.chars[h].reset()},i.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},i.clearToEndOfRow=function(){this.clearFromPos(this.pos)},i.getTextString=function(){for(var r=[],h=!0,f=0;f<w;f++){var T=this.chars[f].uchar;T!==" "&&(h=!1),r.push(T)}return h?"":r.join("")},i.setPenStyles=function(r){this.currPenState.setStyles(r);var h=this.chars[this.pos];h.setPenState(this.currPenState)},o}(),n=function(){function o(t){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var r=0;r<M;r++)this.rows.push(new a(t));this.logger=t,this.currRow=M-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var i=o.prototype;return i.reset=function(){for(var r=0;r<M;r++)this.rows[r].clear();this.currRow=M-1},i.equals=function(r){for(var h=!0,f=0;f<M;f++)if(!this.rows[f].equals(r.rows[f])){h=!1;break}return h},i.copy=function(r){for(var h=0;h<M;h++)this.rows[h].copy(r.rows[h])},i.isEmpty=function(){for(var r=!0,h=0;h<M;h++)if(!this.rows[h].isEmpty()){r=!1;break}return r},i.backSpace=function(){var r=this.rows[this.currRow];r.backSpace()},i.clearToEndOfRow=function(){var r=this.rows[this.currRow];r.clearToEndOfRow()},i.insertChar=function(r){var h=this.rows[this.currRow];h.insertChar(r)},i.setPen=function(r){var h=this.rows[this.currRow];h.setPenStyles(r)},i.moveCursor=function(r){var h=this.rows[this.currRow];h.moveCursor(r)},i.setCursor=function(r){this.logger.log(v.INFO,"setCursor: "+r);var h=this.rows[this.currRow];h.setCursor(r)},i.setPAC=function(r){this.logger.log(v.INFO,"pacData = "+JSON.stringify(r));var h=r.row-1;if(this.nrRollUpRows&&h<this.nrRollUpRows-1&&(h=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==h){for(var f=0;f<M;f++)this.rows[f].clear();var T=this.currRow+1-this.nrRollUpRows,R=this.lastOutputScreen;if(R){var L=R.rows[T].cueStartTime,N=this.logger.time;if(L&&N!==null&&L<N)for(var H=0;H<this.nrRollUpRows;H++)this.rows[h-this.nrRollUpRows+H+1].copy(R.rows[T+H])}}this.currRow=h;var K=this.rows[this.currRow];if(r.indent!==null){var X=r.indent,z=Math.max(X-1,0);K.setCursor(r.indent),r.color=K.chars[z].penState.foreground}var J={foreground:r.color,underline:r.underline,italics:r.italics,background:"black",flash:!1};this.setPen(J)},i.setBkgData=function(r){this.logger.log(v.INFO,"bkgData = "+JSON.stringify(r)),this.backSpace(),this.setPen(r),this.insertChar(32)},i.setRollUpRows=function(r){this.nrRollUpRows=r},i.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(v.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(v.TEXT,this.getDisplayText());var r=this.currRow+1-this.nrRollUpRows,h=this.rows.splice(r,1)[0];h.clear(),this.rows.splice(this.currRow,0,h),this.logger.log(v.INFO,"Rolling up")},i.getDisplayText=function(r){r=r||!1;for(var h=[],f="",T=-1,R=0;R<M;R++){var L=this.rows[R].getTextString();L&&(T=R+1,r?h.push("Row "+T+": '"+L+"'"):h.push(L.trim()))}return h.length>0&&(r?f="["+h.join(" | ")+"]":f=h.join(`
`)),f},i.getTextAndFormat=function(){return this.rows},o}(),c=function(){function o(t,r,h){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new n(h),this.nonDisplayedMemory=new n(h),this.lastOutputScreen=new n(h),this.currRollUpRow=this.displayedMemory.rows[M-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=h}var i=o.prototype;return i.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[M-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},i.getHandler=function(){return this.outputFilter},i.setHandler=function(r){this.outputFilter=r},i.setPAC=function(r){this.writeScreen.setPAC(r)},i.setBkgData=function(r){this.writeScreen.setBkgData(r)},i.setMode=function(r){if(r===this.mode)return;this.mode=r,this.logger.log(v.INFO,"MODE="+r),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=r},i.insertChars=function(r){for(var h=0;h<r.length;h++)this.writeScreen.insertChar(r[h]);var f=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(v.INFO,f+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(v.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},i.ccRCL=function(){this.logger.log(v.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},i.ccBS=function(){if(this.logger.log(v.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},i.ccAOF=function(){},i.ccAON=function(){},i.ccDER=function(){this.logger.log(v.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},i.ccRU=function(r){this.logger.log(v.INFO,"RU("+r+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(r)},i.ccFON=function(){this.logger.log(v.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},i.ccRDC=function(){this.logger.log(v.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},i.ccTR=function(){this.logger.log(v.INFO,"TR"),this.setMode("MODE_TEXT")},i.ccRTD=function(){this.logger.log(v.INFO,"RTD"),this.setMode("MODE_TEXT")},i.ccEDM=function(){this.logger.log(v.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},i.ccCR=function(){this.logger.log(v.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},i.ccENM=function(){this.logger.log(v.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},i.ccEOC=function(){if(this.logger.log(v.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var r=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=r,this.writeScreen=this.nonDisplayedMemory,this.logger.log(v.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},i.ccTO=function(r){this.logger.log(v.INFO,"TO("+r+") - Tab Offset"),this.writeScreen.moveCursor(r)},i.ccMIDROW=function(r){var h={flash:!1};if(h.underline=r%2===1,h.italics=r>=46,h.italics)h.foreground="white";else{var f=Math.floor(r/2)-16,T=["white","green","blue","cyan","red","yellow","magenta"];h.foreground=T[f]}this.logger.log(v.INFO,"MIDROW: "+JSON.stringify(h)),this.writeScreen.setPen(h)},i.outputDataUpdate=function(r){r===void 0&&(r=!1);var h=this.logger.time;if(h===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=h:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,h,this.lastOutputScreen),r&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:h),this.lastOutputScreen.copy(this.displayedMemory))},i.cueSplitAtTime=function(r){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,r,this.displayedMemory),this.cueStartTime=r))},o}(),l=function(){function o(t,r,h){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var f=new y;this.channels=[null,new c(t,r,f),new c(t+1,h,f)],this.cmdHistory=d(),this.logger=f}var i=o.prototype;return i.getHandler=function(r){return this.channels[r].getHandler()},i.setHandler=function(r,h){this.channels[r].setHandler(h)},i.addData=function(r,h){var f,T,R,L=!1;this.logger.time=r;for(var N=0;N<h.length;N+=2){if(T=h[N]&127,R=h[N+1]&127,T===0&&R===0)continue;if(this.logger.log(v.DATA,"["+p([h[N],h[N+1]])+"] -> ("+p([T,R])+")"),f=this.parseCmd(T,R),f||(f=this.parseMidrow(T,R)),f||(f=this.parsePAC(T,R)),f||(f=this.parseBackgroundAttributes(T,R)),!f&&(L=this.parseChars(T,R),L)){var H=this.currentChannel;if(H&&H>0){var K=this.channels[H];K.insertChars(L)}else this.logger.log(v.WARNING,"No channel found yet. TEXT-MODE?")}!f&&!L&&this.logger.log(v.WARNING,"Couldn't parse cleaned data "+p([T,R])+" orig: "+p([h[N],h[N+1]]))}},i.parseCmd=function(r,h){var f=this.cmdHistory,T=(r===20||r===28||r===21||r===29)&&h>=32&&h<=47,R=(r===23||r===31)&&h>=33&&h<=35;if(!(T||R))return!1;if(m(r,h,f))return u(null,null,f),this.logger.log(v.DEBUG,"Repeated command ("+p([r,h])+") is dropped"),!0;var L=r===20||r===21||r===23?1:2,N=this.channels[L];return r===20||r===21||r===28||r===29?h===32?N.ccRCL():h===33?N.ccBS():h===34?N.ccAOF():h===35?N.ccAON():h===36?N.ccDER():h===37?N.ccRU(2):h===38?N.ccRU(3):h===39?N.ccRU(4):h===40?N.ccFON():h===41?N.ccRDC():h===42?N.ccTR():h===43?N.ccRTD():h===44?N.ccEDM():h===45?N.ccCR():h===46?N.ccENM():h===47&&N.ccEOC():N.ccTO(h-32),u(r,h,f),this.currentChannel=L,!0},i.parseMidrow=function(r,h){var f=0;if((r===17||r===25)&&h>=32&&h<=47){if(r===17?f=1:f=2,f!==this.currentChannel)return this.logger.log(v.ERROR,"Mismatch channel in midrow parsing"),!1;var T=this.channels[f];return T?(T.ccMIDROW(h),this.logger.log(v.DEBUG,"MIDROW ("+p([r,h])+")"),!0):!1}return!1},i.parsePAC=function(r,h){var f,T=this.cmdHistory,R=(r>=17&&r<=23||r>=25&&r<=31)&&h>=64&&h<=127,L=(r===16||r===24)&&h>=64&&h<=95;if(!(R||L))return!1;if(m(r,h,T))return u(null,null,T),!0;var N=r<=23?1:2;h>=64&&h<=95?f=N===1?A[r]:g[r]:f=N===1?_[r]:x[r];var H=this.channels[N];return H?(H.setPAC(this.interpretPAC(f,h)),u(r,h,T),this.currentChannel=N,!0):!1},i.interpretPAC=function(r,h){var f,T={color:null,italics:!1,indent:null,underline:!1,row:r};return h>95?f=h-96:f=h-64,T.underline=(f&1)===1,f<=13?T.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(f/2)]:f<=15?(T.italics=!0,T.color="white"):T.indent=Math.floor((f-16)/2)*4,T},i.parseChars=function(r,h){var f,T=null,R=null;if(r>=25?(f=2,R=r-8):(f=1,R=r),R>=17&&R<=19){var L;R===17?L=h+80:R===18?L=h+112:L=h+144,this.logger.log(v.INFO,"Special char '"+E(L)+"' in channel "+f),T=[L]}else r>=32&&r<=127&&(T=h===0?[r]:[r,h]);if(T){var N=p(T);this.logger.log(v.DEBUG,"Char codes = "+N.join(",")),u(r,h,this.cmdHistory)}return T},i.parseBackgroundAttributes=function(r,h){var f=(r===16||r===24)&&h>=32&&h<=47,T=(r===23||r===31)&&h>=45&&h<=47;if(!(f||T))return!1;var R,L={};r===16||r===24?(R=Math.floor((h-32)/2),L.background=S[R],h%2===1&&(L.background=L.background+"_semi")):h===45?L.background="transparent":(L.foreground="black",h===47&&(L.underline=!0));var N=r<=23?1:2,H=this.channels[N];return H.setBkgData(L),u(r,h,this.cmdHistory),!0},i.reset=function(){for(var r=0;r<Object.keys(this.channels).length;r++){var h=this.channels[r];h&&h.reset()}this.cmdHistory=d()},i.cueSplitAtTime=function(r){for(var h=0;h<this.channels.length;h++){var f=this.channels[h];f&&f.cueSplitAtTime(r)}},o}();function u(o,i,t){t.a=o,t.b=i}function m(o,i,t){return t.a===o&&t.b===i}function d(){return{a:null,b:null}}k.default=l},"./src/utils/codecs.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"isCodecType",function(){return C}),b.d(k,"isCodecSupportedInMp4",function(){return E});var O={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,av01:!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},text:{stpp:!0,wvtt:!0}};function C(M,w){var A=O[w];return!!A&&A[M.slice(0,4)]===!0}function E(M,w){return MediaSource.isTypeSupported((w||"video")+'/mp4;codecs="'+M+'"')}},"./src/utils/cues.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/utils/vttparser.ts"),C=b("./src/utils/webvtt-parser.ts"),E=b("./src/utils/texttrack-utils.ts"),M=/\s/,w={newCue:function(_,g,x,S){for(var v=[],y,p,s,e,a,n=self.VTTCue||self.TextTrackCue,c=0;c<S.rows.length;c++)if(y=S.rows[c],s=!0,e=0,a="",!y.isEmpty()){for(var l=0;l<y.chars.length;l++)M.test(y.chars[l].uchar)&&s?e++:(a+=y.chars[l].uchar,s=!1);y.cueStartTime=g,g===x&&(x+=1e-4),e>=16?e--:e++;var u=Object(O.fixLineBreaks)(a.trim()),m=Object(C.generateCueId)(g,x,u);(!_||!_.cues||!_.cues.getCueById(m))&&(p=new n(g,x,u),p.id=m,p.line=c+1,p.align="left",p.position=10+Math.min(80,Math.floor(e*8/32)*10),v.push(p))}return _&&v.length&&(v.sort(function(d,o){return d.line==="auto"||o.line==="auto"?0:d.line>8&&o.line>8?o.line-d.line:d.line-o.line}),v.forEach(function(d){return Object(E.addCueToTrack)(_,d)})),v}};k.default=w},"./src/utils/discontinuities.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"findFirstFragWithCC",function(){return M}),b.d(k,"shouldAlignOnDiscontinuities",function(){return w}),b.d(k,"findDiscontinuousReferenceFrag",function(){return A}),b.d(k,"adjustSlidingStart",function(){return g}),b.d(k,"alignStream",function(){return x}),b.d(k,"alignPDT",function(){return v}),b.d(k,"alignFragmentByPDTDelta",function(){return y}),b.d(k,"alignMediaPlaylistByPDT",function(){return p});var O=b("./src/polyfills/number.ts"),C=b("./src/utils/logger.ts"),E=b("./src/controller/level-helper.ts");function M(s,e){for(var a=null,n=0,c=s.length;n<c;n++){var l=s[n];if(l&&l.cc===e){a=l;break}}return a}function w(s,e,a){return!!(e.details&&(a.endCC>a.startCC||s&&s.cc<a.startCC))}function A(s,e){var a=s.fragments,n=e.fragments;if(!n.length||!a.length){C.logger.log("No fragments to align");return}var c=M(a,n[0].cc);if(!c||c&&!c.startPTS){C.logger.log("No frag in previous level to align on");return}return c}function _(s,e){if(s){var a=s.start+e;s.start=s.startPTS=a,s.endPTS=a+s.duration}}function g(s,e){for(var a=e.fragments,n=0,c=a.length;n<c;n++)_(a[n],s);e.fragmentHint&&_(e.fragmentHint,s),e.alignedSliding=!0}function x(s,e,a){if(!e)return;S(s,a,e),!a.alignedSliding&&e.details&&v(a,e.details),!a.alignedSliding&&e.details&&!a.skippedSegments&&Object(E.adjustSliding)(e.details,a)}function S(s,e,a){if(w(s,a,e)){var n=A(a.details,e);n&&Object(O.isFiniteNumber)(n.start)&&(C.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),g(n.start,e))}}function v(s,e){if(!e.fragments.length||!s.hasProgramDateTime||!e.hasProgramDateTime)return;var a=e.fragments[0].programDateTime,n=s.fragments[0].programDateTime,c=(n-a)/1e3+e.fragments[0].start;c&&Object(O.isFiniteNumber)(c)&&(C.logger.log("Adjusting PTS using programDateTime delta "+(n-a)+"ms, sliding:"+c.toFixed(3)+" "+s.url+" "),g(c,s))}function y(s,e){var a=s.programDateTime;if(!a)return;var n=(a-e)/1e3;s.start=s.startPTS=n,s.endPTS=n+s.duration}function p(s,e){if(!e.fragments.length||!s.hasProgramDateTime||!e.hasProgramDateTime)return;var a=e.fragments[0].programDateTime,n=e.fragments[0].start,c=a-n*1e3;s.fragments.forEach(function(l){y(l,c)}),s.fragmentHint&&y(s.fragmentHint,c),s.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/utils/ewma.ts"),C=function(){function E(w,A,_){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=_,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new O.default(w),this.fast_=new O.default(A)}var M=E.prototype;return M.update=function(A,_){var g=this.slow_,x=this.fast_;this.slow_.halfLife!==A&&(this.slow_=new O.default(A,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==_&&(this.fast_=new O.default(_,x.getEstimate(),x.getTotalWeight()))},M.sample=function(A,_){A=Math.max(A,this.minDelayMs_);var g=8*_,x=A/1e3,S=g/x;this.fast_.sample(x,S),this.slow_.sample(x,S)},M.canEstimate=function(){var A=this.fast_;return A&&A.getTotalWeight()>=this.minWeight_},M.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},M.destroy=function(){},E}();k.default=C},"./src/utils/ewma.ts":function(ae,k,b){"use strict";b.r(k);var O=function(){function C(M,w,A){w===void 0&&(w=0),A===void 0&&(A=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=M,this.alpha_=M?Math.exp(Math.log(.5)/M):0,this.estimate_=w,this.totalWeight_=A}var E=C.prototype;return E.sample=function(w,A){var _=Math.pow(this.alpha_,w);this.estimate_=A*(1-_)+_*this.estimate_,this.totalWeight_+=w},E.getTotalWeight=function(){return this.totalWeight_},E.getEstimate=function(){if(this.alpha_){var w=1-Math.pow(this.alpha_,this.totalWeight_);if(w)return this.estimate_/w}return this.estimate_},C}();k.default=O},"./src/utils/fetch-loader.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"fetchSupported",function(){return y});var O=b("./src/polyfills/number.ts"),C=b("./src/loader/load-stats.ts"),E=b("./src/demux/chunk-cache.ts");function M(n,c){n.prototype=Object.create(c.prototype),n.prototype.constructor=n,x(n,c)}function w(n){var c=typeof Map=="function"?new Map:void 0;return w=function(u){if(u===null||!g(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof c!="undefined"){if(c.has(u))return c.get(u);c.set(u,m)}function m(){return A(u,arguments,S(this).constructor)}return m.prototype=Object.create(u.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),x(m,u)},w(n)}function A(n,c,l){return _()?A=Reflect.construct:A=function(m,d,o){var i=[null];i.push.apply(i,d);var t=Function.bind.apply(m,i),r=new t;return o&&x(r,o.prototype),r},A.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(n){return!1}}function g(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function x(n,c){return x=Object.setPrototypeOf||function(u,m){return u.__proto__=m,u},x(n,c)}function S(n){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},S(n)}function v(){return v=Object.assign||function(n){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(n[u]=l[u])}return n},v.apply(this,arguments)}function y(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(n){}return!1}var p=function(){function n(l){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=l.fetchSetup||e,this.controller=new self.AbortController,this.stats=new C.LoadStats}var c=n.prototype;return c.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},c.abortInternal=function(){var u=this.response;(!u||!u.ok)&&(this.stats.aborted=!0,this.controller.abort())},c.abort=function(){var u;this.abortInternal(),(u=this.callbacks)!==null&&u!==void 0&&u.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},c.load=function(u,m,d){var o=this,i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();var t=s(u,this.controller.signal),r=d.onProgress,h=u.responseType==="arraybuffer",f=h?"byteLength":"length";this.context=u,this.config=m,this.callbacks=d,this.request=this.fetchSetup(u,t),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){o.abortInternal(),d.onTimeout(i,u,o.response)},m.timeout),self.fetch(this.request).then(function(T){if(o.response=o.loader=T,!T.ok){var R=T.status,L=T.statusText;throw new a(L||"fetch, bad network response",R,T)}return i.loading.first=Math.max(self.performance.now(),i.loading.start),i.total=parseInt(T.headers.get("Content-Length")||"0"),r&&Object(O.isFiniteNumber)(m.highWaterMark)?o.loadProgressively(T,i,u,m.highWaterMark,r):h?T.arrayBuffer():T.text()}).then(function(T){var R=o.response;self.clearTimeout(o.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first),i.loaded=i.total=T[f];var L={url:R.url,data:T};r&&!Object(O.isFiniteNumber)(m.highWaterMark)&&r(i,u,T,R),d.onSuccess(L,i,u,R)}).catch(function(T){if(self.clearTimeout(o.requestTimeout),i.aborted)return;var R=T.code||0;d.onError({code:R,text:T.message},u,T.details)})},c.getCacheAge=function(){var u=null;if(this.response){var m=this.response.headers.get("age");u=m?parseFloat(m):null}return u},c.loadProgressively=function(u,m,d,o,i){o===void 0&&(o=0);var t=new E.default,r=u.body.getReader(),h=function f(){return r.read().then(function(T){if(T.done)return t.dataLength&&i(m,d,t.flush(),u),Promise.resolve(new ArrayBuffer(0));var R=T.value,L=R.length;return m.loaded+=L,L<o||t.dataLength?(t.push(R),t.dataLength>=o&&i(m,d,t.flush(),u)):i(m,d,R,u),f()}).catch(function(){return Promise.reject()})};return h()},n}();function s(n,c){var l={method:"GET",mode:"cors",credentials:"same-origin",signal:c,headers:new self.Headers(v({},n.headers))};return n.rangeEnd&&l.headers.set("Range","bytes="+n.rangeStart+"-"+String(n.rangeEnd-1)),l}function e(n,c){return new self.Request(n.url,c)}var a=function(n){M(c,n);function c(l,u,m){var d;return d=n.call(this,l)||this,d.code=void 0,d.details=void 0,d.code=u,d.details=m,d}return c}(w(Error));k.default=p},"./src/utils/imsc1-ttml-parser.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"IMSC1_CODEC",function(){return g}),b.d(k,"parseIMSC1",function(){return y});var O=b("./src/utils/mp4-tools.ts"),C=b("./src/utils/vttparser.ts"),E=b("./src/utils/vttcue.ts"),M=b("./src/demux/id3.ts"),w=b("./src/utils/timescale-conversion.ts"),A=b("./src/utils/webvtt-parser.ts");function _(){return _=Object.assign||function(o){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(o[r]=t[r])}return o},_.apply(this,arguments)}var g="stpp.ttml.im1t",x=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,S=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,v={left:"start",center:"center",right:"end",start:"start",end:"end"};function y(o,i,t,r,h){var f=Object(O.findBox)(new Uint8Array(o),["mdat"]);if(f.length===0){h(new Error("Could not parse IMSC1 mdat"));return}var T=f[0],R=Object(M.utf8ArrayToStr)(new Uint8Array(o,T.start,T.end-T.start)),L=Object(w.toTimescaleFromScale)(i,1,t);try{r(p(R,L))}catch(N){h(N)}}function p(o,i){var t=new DOMParser,r=t.parseFromString(o,"text/xml"),h=r.getElementsByTagName("tt")[0];if(!h)throw new Error("Invalid ttml");var f={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},T=Object.keys(f).reduce(function(K,X){return K[X]=h.getAttribute("ttp:"+X)||f[X],K},{}),R=h.getAttribute("xml:space")!=="preserve",L=e(s(h,"styling","style")),N=e(s(h,"layout","region")),H=s(h,"body","[begin]");return[].map.call(H,function(K){var X=a(K,R);if(!X||!K.hasAttribute("begin"))return null;var z=u(K.getAttribute("begin"),T),J=u(K.getAttribute("dur"),T),te=u(K.getAttribute("end"),T);if(z===null)throw l(K);if(te===null){if(J===null)throw l(K);te=z+J}var ee=new E.default(z-i,te-i,X);ee.id=Object(A.generateCueId)(ee.startTime,ee.endTime,ee.text);var ve=N[K.getAttribute("region")],re=L[K.getAttribute("style")];ee.position=10,ee.size=80;var de=n(ve,re),ie=de.textAlign;if(ie){var le=v[ie];le&&(ee.lineAlign=le),ee.align=ie}return _(ee,de),ee}).filter(function(K){return K!==null})}function s(o,i,t){var r=o.getElementsByTagName(i)[0];return r?[].slice.call(r.querySelectorAll(t)):[]}function e(o){return o.reduce(function(i,t){var r=t.getAttribute("xml:id");return r&&(i[r]=t),i},{})}function a(o,i){return[].slice.call(o.childNodes).reduce(function(t,r,h){var f;return r.nodeName==="br"&&h?t+`
`:(f=r.childNodes)!==null&&f!==void 0&&f.length?a(r,i):i?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent},"")}function n(o,i){var t="http://www.w3.org/ns/ttml#styling",r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return r.reduce(function(h,f){var T=c(i,t,f)||c(o,t,f);return T&&(h[f]=T),h},{})}function c(o,i,t){return o.hasAttributeNS(i,t)?o.getAttributeNS(i,t):null}function l(o){return new Error("Could not parse ttml timestamp "+o)}function u(o,i){if(!o)return null;var t=Object(C.parseTimeStamp)(o);return t===null&&(x.test(o)?t=m(o,i):S.test(o)&&(t=d(o,i))),t}function m(o,i){var t=x.exec(o),r=(t[4]|0)+(t[5]|0)/i.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+r/i.frameRate}function d(o,i){var t=S.exec(o),r=Number(t[1]),h=t[2];switch(h){case"h":return r*3600;case"m":return r*60;case"ms":return r*1e3;case"f":return r/i.frameRate;case"t":return r/i.tickRate}return r}},"./src/utils/logger.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"enableLogs",function(){return A}),b.d(k,"logger",function(){return _});var O=function(){},C={trace:O,debug:O,log:O,warn:O,info:O,error:O},E=C;function M(g){var x=self.console[g];return x?x.bind(self.console,"["+g+"] >"):O}function w(g){for(var x=arguments.length,S=new Array(x>1?x-1:0),v=1;v<x;v++)S[v-1]=arguments[v];S.forEach(function(y){E[y]=g[y]?g[y].bind(g):M(y)})}function A(g){if(self.console&&g===!0||typeof g=="object"){w(g,"debug","log","info","warn","error");try{E.log()}catch(x){E=C}}else E=C}var _=E},"./src/utils/mediakeys-helper.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"KeySystems",function(){return O}),b.d(k,"requestMediaKeySystemAccess",function(){return C});var O;(function(E){E.WIDEVINE="com.widevine.alpha",E.PLAYREADY="com.microsoft.playready"})(O||(O={}));var C=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"getMediaSource",function(){return O});function O(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"bin2str",function(){return w}),b.d(k,"readUint16",function(){return A}),b.d(k,"readUint32",function(){return _}),b.d(k,"writeUint32",function(){return g}),b.d(k,"findBox",function(){return x}),b.d(k,"parseSegmentIndex",function(){return S}),b.d(k,"parseInitSegment",function(){return v}),b.d(k,"getStartDTS",function(){return y}),b.d(k,"getDuration",function(){return p}),b.d(k,"computeRawDurationFromSamples",function(){return s}),b.d(k,"offsetStartDTS",function(){return e}),b.d(k,"segmentValidRange",function(){return a}),b.d(k,"appendUint8Array",function(){return n});var O=b("./src/utils/typed-array.ts"),C=b("./src/loader/fragment.ts"),E=Math.pow(2,32)-1,M=[].push;function w(c){return String.fromCharCode.apply(null,c)}function A(c,l){"data"in c&&(l+=c.start,c=c.data);var u=c[l]<<8|c[l+1];return u<0?65536+u:u}function _(c,l){"data"in c&&(l+=c.start,c=c.data);var u=c[l]<<24|c[l+1]<<16|c[l+2]<<8|c[l+3];return u<0?4294967296+u:u}function g(c,l,u){"data"in c&&(l+=c.start,c=c.data),c[l]=u>>24,c[l+1]=u>>16&255,c[l+2]=u>>8&255,c[l+3]=u&255}function x(c,l){var u=[];if(!l.length)return u;var m,d,o;"data"in c?(m=c.data,d=c.start,o=c.end):(m=c,d=0,o=m.byteLength);for(var i=d;i<o;){var t=_(m,i),r=w(m.subarray(i+4,i+8)),h=t>1?i+t:o;if(r===l[0])if(l.length===1)u.push({data:m,start:i+8,end:h});else{var f=x({data:m,start:i+8,end:h},l.slice(1));f.length&&M.apply(u,f)}i=h}return u}function S(c){var l=x(c,["moov"]),u=l[0],m=u?u.end:null,d=x(c,["sidx"]);if(!d||!d[0])return null;var o=[],i=d[0],t=i.data[0],r=t===0?8:16,h=_(i,r);r+=4;var f=0,T=0;t===0?r+=8:r+=16,r+=2;var R=i.end+T,L=A(i,r);r+=2;for(var N=0;N<L;N++){var H=r,K=_(i,H);H+=4;var X=K&2147483647,z=(K&2147483648)>>>31;if(z===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var J=_(i,H);H+=4,o.push({referenceSize:X,subsegmentDuration:J,info:{duration:J/h,start:R,end:R+X-1}}),R+=X,H+=4,r=H}return{earliestPresentationTime:f,timescale:h,version:t,referencesCount:L,references:o,moovEndOffset:m}}function v(c){for(var l=[],u=x(c,["moov","trak"]),m=0;m<u.length;m++){var d=u[m],o=x(d,["tkhd"])[0];if(o){var i=o.data[o.start],t=i===0?12:20,r=_(o,t),h=x(d,["mdia","mdhd"])[0];if(h){i=h.data[h.start],t=i===0?12:20;var f=_(h,t),T=x(d,["mdia","hdlr"])[0];if(T){var R=w(T.data.subarray(T.start+8,T.start+12)),L={soun:C.ElementaryStreamTypes.AUDIO,vide:C.ElementaryStreamTypes.VIDEO}[R];if(L){var N=x(d,["mdia","minf","stbl","stsd"])[0],H=void 0;N&&(H=w(N.data.subarray(N.start+12,N.start+16))),l[r]={timescale:f,type:L},l[L]={timescale:f,id:r,codec:H}}}}}}var K=x(c,["moov","mvex","trex"]);return K.forEach(function(X){var z=_(X,4),J=l[z];J&&(J.default={duration:_(X,12),flags:_(X,20)})}),l}function y(c,l){return x(l,["moof","traf"]).reduce(function(u,m){var d=x(m,["tfdt"])[0],o=d.data[d.start],i=x(m,["tfhd"]).reduce(function(t,r){var h=_(r,4),f=c[h];if(f){var T=_(d,4);o===1&&(T*=Math.pow(2,32),T+=_(d,8));var R=f.timescale||9e4,L=T/R;if(isFinite(L)&&(t===null||L<t))return L}return t},null);return i!==null&&isFinite(i)&&(u===null||i<u)?i:u},null)||0}function p(c,l){for(var u=0,m=0,d=0,o=x(c,["moof","traf"]),i=0;i<o.length;i++){var t=o[i],r=x(t,["tfhd"])[0],h=_(r,4),f=l[h];if(!f)continue;var T=f.default,R=_(r,0)|(T==null?void 0:T.flags),L=T==null?void 0:T.duration;R&8&&(R&2?L=_(r,12):L=_(r,8));for(var N=f.timescale||9e4,H=x(t,["trun"]),K=0;K<H.length;K++){if(L){var X=_(H[K],4);u=L*X}else u=s(H[K]);f.type===C.ElementaryStreamTypes.VIDEO?m+=u/N:f.type===C.ElementaryStreamTypes.AUDIO&&(d+=u/N)}}if(m===0&&d===0){var z=S(c);if(z!=null&&z.references)return z.references.reduce(function(J,te){return J+te.info.duration||0},0)}return m||d}function s(c){var l=_(c,0),u=8;l&1&&(u+=4),l&4&&(u+=4);for(var m=0,d=_(c,4),o=0;o<d;o++){if(l&256){var i=_(c,u);m+=i,u+=4}l&512&&(u+=4),l&1024&&(u+=4),l&2048&&(u+=4)}return m}function e(c,l,u){x(l,["moof","traf"]).forEach(function(m){x(m,["tfhd"]).forEach(function(d){var o=_(d,4),i=c[o];if(!i)return;var t=i.timescale||9e4;x(m,["tfdt"]).forEach(function(r){var h=r.data[r.start],f=_(r,4);if(h===0)g(r,4,f-u*t);else{f*=Math.pow(2,32),f+=_(r,8),f-=u*t,f=Math.max(f,0);var T=Math.floor(f/(E+1)),R=Math.floor(f%(E+1));g(r,4,T),g(r,8,R)}})})})}function a(c){var l={valid:null,remainder:null},u=x(c,["moof"]);if(u){if(u.length<2)return l.remainder=c,l}else return l;var m=u[u.length-1];return l.valid=Object(O.sliceUint8)(c,0,m.start-8),l.remainder=Object(O.sliceUint8)(c,m.start-8),l}function n(c,l){var u=new Uint8Array(c.length+l.length);return u.set(c),u.set(l,c.length),u}},"./src/utils/output-filter.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"default",function(){return O});var O=function(){function C(M,w){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=M,this.trackName=w}var E=C.prototype;return E.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},E.newCue=function(w,A,_){(this.startTime===null||this.startTime>w)&&(this.startTime=w),this.endTime=A,this.screen=_,this.timelineController.createCaptionsTrack(this.trackName)},E.reset=function(){this.cueRanges=[]},C}()},"./src/utils/texttrack-utils.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"sendAddTrackEvent",function(){return C}),b.d(k,"addCueToTrack",function(){return E}),b.d(k,"clearCurrentCues",function(){return M}),b.d(k,"removeCuesInRange",function(){return w}),b.d(k,"getCuesInRange",function(){return _});var O=b("./src/utils/logger.ts");function C(g,x){var S;try{S=new Event("addtrack")}catch(v){S=document.createEvent("Event"),S.initEvent("addtrack",!1,!1)}S.track=g,x.dispatchEvent(S)}function E(g,x){var S=g.mode;if(S==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(x.id))try{if(g.addCue(x),!g.cues.getCueById(x.id))throw new Error("addCue is failed for: "+x)}catch(y){O.logger.debug("[texttrack-utils]: "+y);var v=new self.TextTrackCue(x.startTime,x.endTime,x.text);v.id=x.id,g.addCue(v)}S==="disabled"&&(g.mode=S)}function M(g){var x=g.mode;if(x==="disabled"&&(g.mode="hidden"),g.cues)for(var S=g.cues.length;S--;)g.removeCue(g.cues[S]);x==="disabled"&&(g.mode=x)}function w(g,x,S){var v=g.mode;if(v==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var y=_(g.cues,x,S),p=0;p<y.length;p++)g.removeCue(y[p]);v==="disabled"&&(g.mode=v)}function A(g,x){if(x<g[0].startTime)return 0;var S=g.length-1;if(x>g[S].endTime)return-1;for(var v=0,y=S;v<=y;){var p=Math.floor((y+v)/2);if(x<g[p].startTime)y=p-1;else if(x>g[p].startTime&&v<S)v=p+1;else return p}return g[v].startTime-x<x-g[y].startTime?v:y}function _(g,x,S){var v=[],y=A(g,x);if(y>-1)for(var p=y,s=g.length;p<s;p++){var e=g[p];if(e.startTime>=x&&e.endTime<=S)v.push(e);else if(e.startTime>S)return v}return v}},"./src/utils/time-ranges.ts":function(ae,k,b){"use strict";b.r(k);var O={toString:function(E){for(var M="",w=E.length,A=0;A<w;A++)M+="["+E.start(A).toFixed(3)+","+E.end(A).toFixed(3)+"]";return M}};k.default=O},"./src/utils/timescale-conversion.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"toTimescaleFromBase",function(){return C}),b.d(k,"toTimescaleFromScale",function(){return E}),b.d(k,"toMsFromMpegTsClock",function(){return M}),b.d(k,"toMpegTsClockFromTimescale",function(){return w});var O=9e4;function C(A,_,g,x){g===void 0&&(g=1),x===void 0&&(x=!1);var S=A*_*g;return x?Math.round(S):S}function E(A,_,g,x){return g===void 0&&(g=1),x===void 0&&(x=!1),C(A,_,1/g,x)}function M(A,_){return _===void 0&&(_=!1),C(A,1e3,1/O,_)}function w(A,_){return _===void 0&&(_=1),C(A,O,1/_)}},"./src/utils/typed-array.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"sliceUint8",function(){return O});function O(C,E,M){return Uint8Array.prototype.slice?C.slice(E,M):new Uint8Array(Array.prototype.slice.call(C,E,M))}},"./src/utils/vttcue.ts":function(ae,k,b){"use strict";b.r(k),k.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var O=["","lr","rl"],C=["start","middle","end","left","right"];function E(g,x){if(typeof x!="string")return!1;if(!Array.isArray(g))return!1;var S=x.toLowerCase();return~g.indexOf(S)?S:!1}function M(g){return E(O,g)}function w(g){return E(C,g)}function A(g){for(var x=arguments.length,S=new Array(x>1?x-1:0),v=1;v<x;v++)S[v-1]=arguments[v];for(var y=1;y<arguments.length;y++){var p=arguments[y];for(var s in p)g[s]=p[s]}return g}function _(g,x,S){var v=this,y={enumerable:!0};v.hasBeenReset=!1;var p="",s=!1,e=g,a=x,n=S,c=null,l="",u=!0,m="auto",d="start",o=50,i="middle",t=50,r="middle";Object.defineProperty(v,"id",A({},y,{get:function(){return p},set:function(f){p=""+f}})),Object.defineProperty(v,"pauseOnExit",A({},y,{get:function(){return s},set:function(f){s=!!f}})),Object.defineProperty(v,"startTime",A({},y,{get:function(){return e},set:function(f){if(typeof f!="number")throw new TypeError("Start time must be set to a number.");e=f,this.hasBeenReset=!0}})),Object.defineProperty(v,"endTime",A({},y,{get:function(){return a},set:function(f){if(typeof f!="number")throw new TypeError("End time must be set to a number.");a=f,this.hasBeenReset=!0}})),Object.defineProperty(v,"text",A({},y,{get:function(){return n},set:function(f){n=""+f,this.hasBeenReset=!0}})),Object.defineProperty(v,"region",A({},y,{get:function(){return c},set:function(f){c=f,this.hasBeenReset=!0}})),Object.defineProperty(v,"vertical",A({},y,{get:function(){return l},set:function(f){var T=M(f);if(T===!1)throw new SyntaxError("An invalid or illegal string was specified.");l=T,this.hasBeenReset=!0}})),Object.defineProperty(v,"snapToLines",A({},y,{get:function(){return u},set:function(f){u=!!f,this.hasBeenReset=!0}})),Object.defineProperty(v,"line",A({},y,{get:function(){return m},set:function(f){if(typeof f!="number"&&f!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");m=f,this.hasBeenReset=!0}})),Object.defineProperty(v,"lineAlign",A({},y,{get:function(){return d},set:function(f){var T=w(f);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");d=T,this.hasBeenReset=!0}})),Object.defineProperty(v,"position",A({},y,{get:function(){return o},set:function(f){if(f<0||f>100)throw new Error("Position must be between 0 and 100.");o=f,this.hasBeenReset=!0}})),Object.defineProperty(v,"positionAlign",A({},y,{get:function(){return i},set:function(f){var T=w(f);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");i=T,this.hasBeenReset=!0}})),Object.defineProperty(v,"size",A({},y,{get:function(){return t},set:function(f){if(f<0||f>100)throw new Error("Size must be between 0 and 100.");t=f,this.hasBeenReset=!0}})),Object.defineProperty(v,"align",A({},y,{get:function(){return r},set:function(f){var T=w(f);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");r=T,this.hasBeenReset=!0}})),v.displayState=void 0}return _.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},_}()},"./src/utils/vttparser.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"parseTimeStamp",function(){return E}),b.d(k,"fixLineBreaks",function(){return x}),b.d(k,"VTTParser",function(){return S});var O=b("./src/utils/vttcue.ts"),C=function(){function v(){}var y=v.prototype;return y.decode=function(s,e){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},v}();function E(v){function y(s,e,a,n){return(s|0)*3600+(e|0)*60+(a|0)+parseFloat(n||0)}var p=v.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return p?parseFloat(p[2])>59?y(p[2],p[3],0,p[4]):y(p[1],p[2],p[3],p[4]):null}var M=function(){function v(){this.values=Object.create(null)}var y=v.prototype;return y.set=function(s,e){!this.get(s)&&e!==""&&(this.values[s]=e)},y.get=function(s,e,a){return a?this.has(s)?this.values[s]:e[a]:this.has(s)?this.values[s]:e},y.has=function(s){return s in this.values},y.alt=function(s,e,a){for(var n=0;n<a.length;++n)if(e===a[n]){this.set(s,e);break}},y.integer=function(s,e){/^-?\d+$/.test(e)&&this.set(s,parseInt(e,10))},y.percent=function(s,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var a=parseFloat(e);if(a>=0&&a<=100)return this.set(s,a),!0}return!1},v}();function w(v,y,p,s){var e=s?v.split(s):[v];for(var a in e){if(typeof e[a]!="string")continue;var n=e[a].split(p);if(n.length!==2)continue;var c=n[0],l=n[1];y(c,l)}}var A=new O.default(0,0,""),_=A.align==="middle"?"middle":"center";function g(v,y,p){var s=v;function e(){var c=E(v);if(c===null)throw new Error("Malformed timestamp: "+s);return v=v.replace(/^[^\sa-zA-Z-]+/,""),c}function a(c,l){var u=new M;w(c,function(o,i){var t;switch(o){case"region":for(var r=p.length-1;r>=0;r--)if(p[r].id===i){u.set(o,p[r].region);break}break;case"vertical":u.alt(o,i,["rl","lr"]);break;case"line":t=i.split(","),u.integer(o,t[0]),u.percent(o,t[0])&&u.set("snapToLines",!1),u.alt(o,t[0],["auto"]),t.length===2&&u.alt("lineAlign",t[1],["start",_,"end"]);break;case"position":t=i.split(","),u.percent(o,t[0]),t.length===2&&u.alt("positionAlign",t[1],["start",_,"end","line-left","line-right","auto"]);break;case"size":u.percent(o,i);break;case"align":u.alt(o,i,["start",_,"end","left","right"]);break}},/:/,/\s/),l.region=u.get("region",null),l.vertical=u.get("vertical","");var m=u.get("line","auto");m==="auto"&&A.line===-1&&(m=-1),l.line=m,l.lineAlign=u.get("lineAlign","start"),l.snapToLines=u.get("snapToLines",!0),l.size=u.get("size",100),l.align=u.get("align",_);var d=u.get("position","auto");d==="auto"&&A.position===50&&(d=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=d}function n(){v=v.replace(/^\s+/,"")}if(n(),y.startTime=e(),n(),v.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);v=v.substr(3),n(),y.endTime=e(),n(),a(v,y)}function x(v){return v.replace(/<br(?: \/)?>/gi,`
`)}var S=function(){function v(){this.state="INITIAL",this.buffer="",this.decoder=new C,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var y=v.prototype;return y.parse=function(s){var e=this;s&&(e.buffer+=e.decoder.decode(s,{stream:!0}));function a(){var d=e.buffer,o=0;for(d=x(d);o<d.length&&d[o]!=="\r"&&d[o]!==`
`;)++o;var i=d.substr(0,o);return d[o]==="\r"&&++o,d[o]===`
`&&++o,e.buffer=d.substr(o),i}function n(d){w(d,function(o,i){},/:/)}try{var c="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;c=a();var l=c.match(/^()?WEBVTT([ \t].*)?$/);if(!l||!l[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var u=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;u?u=!1:c=a();switch(e.state){case"HEADER":/:/.test(c)?n(c):c||(e.state="ID");continue;case"NOTE":c||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(c)){e.state="NOTE";break}if(!c)continue;if(e.cue=new O.default(0,0,""),e.state="CUE",c.indexOf("-->")===-1){e.cue.id=c;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{g(c,e.cue,e.regionList)}catch(d){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var m=c.indexOf("-->")!==-1;if(!c||m&&(u=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(e.cue===null)continue;e.cue.text&&(e.cue.text+=`
`),e.cue.text+=c}continue;case"BADCUE":c||(e.state="ID")}}}catch(d){e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},y.flush=function(){var s=this;try{if((s.cue||s.state==="HEADER")&&(s.buffer+=`
`,s.parse()),s.state==="INITIAL"||s.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(e){s.onparsingerror&&s.onparsingerror(e)}return s.onflush&&s.onflush(),this},v}()},"./src/utils/webvtt-parser.ts":function(ae,k,b){"use strict";b.r(k),b.d(k,"generateCueId",function(){return S}),b.d(k,"parseWebVTT",function(){return y});var O=b("./src/polyfills/number.ts"),C=b("./src/utils/vttparser.ts"),E=b("./src/demux/id3.ts"),M=b("./src/utils/timescale-conversion.ts"),w=b("./src/remux/mp4-remuxer.ts"),A=/\r\n|\n\r|\n|\r/g,_=function(s,e,a){return a===void 0&&(a=0),s.substr(a,e.length)===e},g=function(s){var e=parseInt(s.substr(-3)),a=parseInt(s.substr(-6,2)),n=parseInt(s.substr(-9,2)),c=s.length>9?parseInt(s.substr(0,s.indexOf(":"))):0;if(!Object(O.isFiniteNumber)(e)||!Object(O.isFiniteNumber)(a)||!Object(O.isFiniteNumber)(n)||!Object(O.isFiniteNumber)(c))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+s);return e+=1e3*a,e+=60*1e3*n,e+=60*60*1e3*c,e},x=function(s){for(var e=5381,a=s.length;a;)e=e*33^s.charCodeAt(--a);return(e>>>0).toString()};function S(p,s,e){return x(p.toString())+x(s.toString())+x(e)}var v=function(s,e,a){var n=s[e],c=s[n.prevCC];if(!c||!c.new&&n.new){s.ccOffset=s.presentationOffset=n.start,n.new=!1;return}for(;(l=c)!==null&&l!==void 0&&l.new;){var l;s.ccOffset+=n.start-c.start,n.new=!1,n=c,c=s[n.prevCC]}s.presentationOffset=a};function y(p,s,e,a,n,c,l,u){var m=new C.VTTParser,d=Object(E.utf8ArrayToStr)(new Uint8Array(p)).trim().replace(A,`
`).split(`
`),o=[],i=Object(M.toMpegTsClockFromTimescale)(s,e),t="00:00.000",r=0,h=0,f,T=!0,R=!1;m.oncue=function(L){var N=a[n],H=a.ccOffset,K=(r-i)/9e4;if(N!=null&&N.new&&(h!==void 0?H=a.ccOffset=N.start:v(a,n,K)),K&&(H=K-a.presentationOffset),R){var X=L.endTime-L.startTime,z=Object(w.normalizePts)((L.startTime+H-h)*9e4,c*9e4)/9e4;L.startTime=z,L.endTime=z+X}var J=L.text.trim();L.text=decodeURIComponent(encodeURIComponent(J)),L.id||(L.id=S(L.startTime,L.endTime,J)),L.endTime>0&&o.push(L)},m.onparsingerror=function(L){f=L},m.onflush=function(){if(f){u(f);return}l(o)},d.forEach(function(L){if(T)if(_(L,"X-TIMESTAMP-MAP=")){T=!1,R=!0,L.substr(16).split(",").forEach(function(N){_(N,"LOCAL:")?t=N.substr(6):_(N,"MPEGTS:")&&(r=parseInt(N.substr(7)))});try{h=g(t)/1e3}catch(N){R=!1,f=N}return}else L===""&&(T=!1);m.parse(L+`
`)}),m.flush()}},"./src/utils/xhr-loader.ts":function(ae,k,b){"use strict";b.r(k);var O=b("./src/utils/logger.ts"),C=b("./src/loader/load-stats.ts"),E=/^age:\s*[\d.]+\s*$/m,M=function(){function w(_){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=_?_.xhrSetup:null,this.stats=new C.LoadStats,this.retryDelay=0}var A=w.prototype;return A.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},A.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},A.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},A.load=function(g,x,S){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=x,this.callbacks=S,this.retryDelay=x.retryDelay,this.loadInternal()},A.loadInternal=function(){var g=this.config,x=this.context;if(!g)return;var S=this.loader=new self.XMLHttpRequest,v=this.stats;v.loading.first=0,v.loaded=0;var y=this.xhrSetup;try{if(y)try{y(S,x.url)}catch(e){S.open("GET",x.url,!0),y(S,x.url)}S.readyState||S.open("GET",x.url,!0);var p=this.context.headers;if(p)for(var s in p)S.setRequestHeader(s,p[s])}catch(e){this.callbacks.onError({code:S.status,text:e.message},x,S);return}x.rangeEnd&&S.setRequestHeader("Range","bytes="+x.rangeStart+"-"+(x.rangeEnd-1)),S.onreadystatechange=this.readystatechange.bind(this),S.onprogress=this.loadprogress.bind(this),S.responseType=x.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),S.send()},A.readystatechange=function(){var g=this.context,x=this.loader,S=this.stats;if(!g||!x)return;var v=x.readyState,y=this.config;if(S.aborted)return;if(v>=2)if(self.clearTimeout(this.requestTimeout),S.loading.first===0&&(S.loading.first=Math.max(self.performance.now(),S.loading.start)),v===4){x.onreadystatechange=null,x.onprogress=null;var p=x.status;if(p>=200&&p<300){S.loading.end=Math.max(self.performance.now(),S.loading.first);var s,e;if(g.responseType==="arraybuffer"?(s=x.response,e=s.byteLength):(s=x.responseText,e=s.length),S.loaded=S.total=e,!this.callbacks)return;var a=this.callbacks.onProgress;if(a&&a(S,g,s,x),!this.callbacks)return;var n={url:x.responseURL,data:s};this.callbacks.onSuccess(n,S,g,x)}else S.retry>=y.maxRetry||p>=400&&p<499?(O.logger.error(p+" while loading "+g.url),this.callbacks.onError({code:p,text:x.statusText},g,x)):(O.logger.warn(p+" while loading "+g.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,y.maxRetryDelay),S.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout)},A.loadtimeout=function(){O.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},A.loadprogress=function(g){var x=this.stats;x.loaded=g.loaded,g.lengthComputable&&(x.total=g.total)},A.getCacheAge=function(){var g=null;if(this.loader&&E.test(this.loader.getAllResponseHeaders())){var x=this.loader.getResponseHeader("age");g=x?parseFloat(x):null}return g},w}();k.default=M}}).default})},vToQ:function(He,We,V){He.exports={flex_box_center:"flex_box_center___3UWMh",flex_space_between:"flex_space_between___2nh9S",flex_box_vertical_center:"flex_box_vertical_center___2Neiq",flex_box_center_end:"flex_box_center_end___2_1FS",flex_box_column:"flex_box_column___2E-v7",userPic:"userPic___3Pu9t",rightMenu:"rightMenu___1qaVl",menuWrap:"menuWrap___3r9jm",exit:"exit___38Urs",classromediv:"classromediv___2R8_g",glow:"glow___323IR",height67:"height67___1DFRI",login:"login___20J7t"}},vix7:function(He,We,V){He.exports=V.p+"static/101logo.30046b37.svg"},xnZT:function(He,We,V){He.exports={modalityModal:"modalityModal___wjui6",modal:"modal___sNGOo",itemWarp:"itemWarp___Fnx0H",close:"close___1_R1B",selfdomModal:"selfdomModal___5WR35"}},xrsn:function(He,We,V){He.exports={flex_box_center:"flex_box_center___2cC1r",flex_space_between:"flex_space_between___9TeDx",flex_box_vertical_center:"flex_box_vertical_center___3EIYv",flex_box_center_end:"flex_box_center_end___1Uph0",flex_box_column:"flex_box_column___17_5w",header:"header___1E4MV",logo:"logo___R8PNJ",menu:"menu___Km2Uo",dropDown:"dropDown___3Phxo",line:"line___3lQ2g",subName:"subName___3sqtP",name:"name___1Odvx",actived:"actived___12Ff0","edu-menu":"edu-menu___2hxbr",newslight:"newslight___jwZR3",classromediv:"classromediv___Cjpgf",glow:"glow___3Nuu5",spandiv:"spandiv___3YPu8","header-iearning":"header-iearning___2Us_L",title:"title___3TtoH",headerFixed:"headerFixed___1V7d4"}},"yTi+":function(He,We,V){He.exports=V.p+"static/AssistantCode3.fdd8db3c.jpeg"}}]);