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/p__Classrooms__Lists__Group...

143 lines
785 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[82,5,6,7,16],{"+NIl":function(qe,He,J){(function(q){q(J("VrN/"))})(function(q){"use strict";q.defineMode("stex",function(z,L){"use strict";function K(w,x){w.cmdState.push(x)}function F(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function O(w){var x=w.cmdState.pop();x&&x.closeBracket()}function B(w){for(var x=w.cmdState,v=x.length-1;v>=0;v--){var d=x[v];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function k(w,x,v){return function(){this.name=w,this.bracketNo=0,this.style=x,this.styles=v,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var R={};R.importmodule=k("importmodule","tag",["string","builtin"]),R.documentclass=k("documentclass","tag",["","atom"]),R.usepackage=k("usepackage","tag",["atom"]),R.begin=k("begin","tag",["atom"]),R.end=k("end","tag",["atom"]),R.label=k("label","tag",["atom"]),R.ref=k("ref","tag",["atom"]),R.eqref=k("eqref","tag",["atom"]),R.cite=k("cite","tag",["atom"]),R.bibitem=k("bibitem","tag",["atom"]),R.Bibitem=k("Bibitem","tag",["atom"]),R.RBibitem=k("RBibitem","tag",["atom"]),R.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function S(w,x){w.f=x}function m(w,x){var v;if(w.match(/^\\[a-zA-Z@]+/)){var d=w.current().slice(1);return v=R.hasOwnProperty(d)?R[d]:R.DEFAULT,v=new v,K(x,v),S(x,P),v.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return S(x,function(u,s){return b(u,s,"\\]")}),"keyword";if(w.match("\\("))return S(x,function(u,s){return b(u,s,"\\)")}),"keyword";if(w.match("$$"))return S(x,function(u,s){return b(u,s,"$$")}),"keyword";if(w.match("$"))return S(x,function(u,s){return b(u,s,"$")}),"keyword";var o=w.next();if(o=="%")return w.skipToEnd(),"comment";if(o=="}"||o=="]"){if(v=F(x),v)v.closeBracket(o),S(x,P);else return"error";return"bracket"}else return o=="{"||o=="["?(v=R.DEFAULT,v=new v,K(x,v),"bracket"):/\d/.test(o)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),v=B(x),v.name=="begin"&&(v.argument=w.current()),v.styleIdentifier())}function b(w,x,v){if(w.eatSpace())return null;if(v&&w.match(v))return S(x,m),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=w.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(w.skipToEnd(),"comment"):"error"}function P(w,x){var v=w.peek(),d;return v=="{"||v=="["?(d=F(x),d.openBracket(v),w.eat(v),S(x,m),"bracket"):/[ \t\r]/.test(v)?(w.eat(v),null):(S(x,m),O(x),m(w,x))}return{startState:function(){var w=L.inMathMode?function(x,v){return b(x,v)}:m;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,x){return x.f(w,x)},blankLine:function(w){w.f=m,w.cmdState.length=0},lineComment:"%"}}),q.defineMIME("text/x-stex","stex"),q.defineMIME("text/x-latex","stex")})},"+ua5":function(qe,He,J){},"19Vz":function(qe,He,J){(function(q){q(J("VrN/"))})(function(q){q.defineOption("placeholder","",function(k,R,S){var m=S&&S!=q.Init;if(R&&!m)k.on("blur",F),k.on("change",O),k.on("swapDoc",O),q.on(k.getInputField(),"compositionupdate",k.state.placeholderCompose=function(){K(k)}),O(k);else if(!R&&m){k.off("blur",F),k.off("change",O),k.off("swapDoc",O),q.off(k.getInputField(),"compositionupdate",k.state.placeholderCompose),z(k);var b=k.getWrapperElement();b.className=b.className.replace(" CodeMirror-empty","")}R&&!k.hasFocus()&&F(k)});function z(k){k.state.placeholder&&(k.state.placeholder.parentNode.removeChild(k.state.placeholder),k.state.placeholder=null)}function L(k){z(k);var R=k.state.placeholder=document.createElement("pre");R.style.cssText="height: 0; overflow: visible",R.style.direction=k.getOption("direction"),R.className="CodeMirror-placeholder CodeMirror-line-like";var S=k.getOption("placeholder");typeof S=="string"&&(S=document.createTextNode(S)),R.appendChild(S),k.display.lineSpace.insertBefore(R,k.display.lineSpace.firstChild)}function K(k){setTimeout(function(){var R=!1,S=k.getInputField();S.nodeName=="TEXTAREA"?R=!S.value:k.lineCount()==1&&(R=!/[^\u200b]/.test(S.querySelector(".CodeMirror-line").textContent)),R?L(k):z(k)},20)}function F(k){B(k)&&L(k)}function O(k){var R=k.getWrapperElement(),S=B(k);R.className=R.className.replace(" CodeMirror-empty","")+(S?" CodeMirror-empty":""),S?L(k):z(k)}function B(k){return k.lineCount()===1&&k.getLine(0)===""}})},"1eCo":function(qe,He,J){(function(q){q(J("VrN/"))})(function(q){"use strict";var z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};q.defineMode("xml",function(K,F){var O=K.indentUnit,B={},k=F.htmlMode?z:L;for(var R in k)B[R]=k[R];for(var R in F)B[R]=F[R];var S,m;function b(a,T){function y(U){return T.tokenize=U,U(a,T)}var h=a.next();if(h=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?y(x("atom","]]>")):null:a.match("--")?y(x("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),y(v(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),T.tokenize=x("meta","?>"),"meta"):(S=a.eat("/")?"closeTag":"openTag",T.tokenize=P,"tag bracket");if(h=="&"){var D;return a.eat("#")?a.eat("x")?D=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):D=a.eatWhile(/[\d]/)&&a.eat(";"):D=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),D?"atom":"error"}else return a.eatWhile(/[^&<]/),null}b.isInText=!0;function P(a,T){var y=a.next();if(y==">"||y=="/"&&a.eat(">"))return T.tokenize=b,S=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return S="equals",null;if(y=="<"){T.tokenize=b,T.state=s,T.tagName=T.tagStart=null;var h=T.tokenize(a,T);return h?h+" tag error":"tag error"}else return/[\'\"]/.test(y)?(T.tokenize=w(y),T.stringStartCol=a.column(),T.tokenize(a,T)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(a){var T=function(y,h){for(;!y.eol();)if(y.next()==a){h.tokenize=P;break}return"string"};return T.isInAttribute=!0,T}function x(a,T){return function(y,h){for(;!y.eol();){if(y.match(T)){h.tokenize=b;break}y.next()}return a}}function v(a){return function(T,y){for(var h;(h=T.next())!=null;){if(h=="<")return y.tokenize=v(a+1),y.tokenize(T,y);if(h==">")if(a==1){y.tokenize=b;break}else return y.tokenize=v(a-1),y.tokenize(T,y)}return"meta"}}function d(a,T,y){this.prev=a.context,this.tagName=T,this.indent=a.indented,this.startOfLine=y,(B.doNotIndent.hasOwnProperty(T)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function u(a,T){for(var y;;){if(!a.context)return;if(y=a.context.tagName,!B.contextGrabbers.hasOwnProperty(y)||!B.contextGrabbers[y].hasOwnProperty(T))return;o(a)}}function s(a,T,y){return a=="openTag"?(y.tagStart=T.column(),C):a=="closeTag"?E:s}function C(a,T,y){return a=="word"?(y.tagName=T.current(),m="tag",g):B.allowMissingTagName&&a=="endTag"?(m="tag bracket",g(a,T,y)):(m="error",C)}function E(a,T,y){if(a=="word"){var h=T.current();return y.context&&y.context.tagName!=h&&B.implicitlyClosed.hasOwnProperty(y.context.tagName)&&o(y),y.context&&y.context.tagName==h||B.matchClosing===!1?(m="tag",f):(m="tag error",A)}else return B.allowMissingTagName&&a=="endTag"?(m="tag bracket",f(a,T,y)):(m="error",A)}function f(a,T,y){return a!="endTag"?(m="error",f):(o(y),s)}function A(a,T,y){return m="error",f(a,T,y)}function g(a,T,y){if(a=="word")return m="attribute",p;if(a=="endTag"||a=="selfcloseTag"){var h=y.tagName,D=y.tagStart;return y.tagName=y.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(h)?u(y,h):(u(y,h),y.context=new d(y,h,D==y.indented)),s}return m="error",g}function p(a,T,y){return a=="equals"?c:(B.allowMissing||(m="error"),g(a,T,y))}function c(a,T,y){return a=="string"?l:a=="word"&&B.allowUnquoted?(m="string",g):(m="error",g(a,T,y))}function l(a,T,y){return a=="string"?l:g(a,T,y)}return{startState:function(a){var T={tokenize:b,state:s,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(T.baseIndent=a),T},token:function(a,T){if(!T.tagName&&a.sol()&&(T.indented=a.indentation()),a.eatSpace())return null;S=null;var y=T.tokenize(a,T);return(y||S)&&y!="comment"&&(m=null,T.state=T.state(S||y,a,T),m&&(y=m=="error"?y+" error":m)),y},indent:function(a,T,y){var h=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+O;if(h&&h.noIndent)return q.Pass;if(a.tokenize!=P&&a.tokenize!=b)return y?y.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+O*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(T))return 0;var D=T&&/^<(\/)?([\w_:\.-]*)/.exec(T);if(D&&D[1])for(;h;)if(h.tagName==D[2]){h=h.prev;break}else if(B.implicitlyClosed.hasOwnProperty(h.tagName))h=h.prev;else break;else if(D)for(;h;){var U=B.contextGrabbers[h.tagName];if(U&&U.hasOwnProperty(D[2]))h=h.prev;else break}for(;h&&h.prev&&!h.startOfLine;)h=h.prev;return h?h.indent+O:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=g)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var T=[],y=a.context;y;y=y.prev)y.tagName&&T.push(y.tagName);return T.reverse()}}}),q.defineMIME("text/xml","xml"),q.defineMIME("application/xml","xml"),q.mimeModes.hasOwnProperty("text/html")||q.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(qe,He,J){"use strict";J.d(He,"a",function(){return E});var q=J("+L6B"),z=J("2/Rp"),L=J("2qtc"),K=J("kLXV"),F=J("9og8"),O=J("k1fw"),B=J("miYZ"),k=J("tsqr"),R=J("oBTY"),S=J("tJVT"),m=J("DZo9"),b=J("8z0m"),P=J("WmNS"),w=J.n(P),x=J("cDcd"),v=J.n(x),d=J("m3rI"),o=J("wzkS"),u=J("y5JW"),s=J("LtfV"),C=b.a.Dragger;function E(f){var A=[];return f&&f.length>0&&(A=f.map(function(g){return{uid:g.id,id:g.id,name:g.title+u.c+g.filesize,url:g.url,filesize:g.filesize,status:"done",response:{id:g.id}}})),A}He.b=function(f){var A=f.value,g=f.onChange,p=f.action,c=f.className,l=f.maxSize,a=l===void 0?150:l,T=f.title,y=T===void 0?"\u4E0A\u4F20\u9644\u4EF6":T,h=f.showRemoveModal,D=h===void 0?!1:h,U=f.accept,N=U===void 0?"":U,W=f.additionalText,M=f.isDragger,I=f.number,H=I===void 0?1e3:I,X=f.aloneClear,te=X===void 0?!1:X,ae=Object(x.useState)(!1),be=Object(S.a)(ae,2),pe=be[0],ue=be[1],se=Object(x.useState)(A||[]),he=Object(S.a)(se,2),ne=he[0],me=he[1];Object(x.useEffect)(function(){A&&(me(Object(R.a)(A)),H===(A==null?void 0:A.length)&&ue(!0))},[A]);var Q=function(){setTimeout(function(){ne.pop(),me(Object(R.a)(ne))},500)},ie={multiple:!0,disabled:pe,accept:N,withCredentials:!0,fileList:ne,beforeUpload:function(_e,ve){var ye=_e.size/1024/1024;return ne.concat(ve).length>H?(ne.pop(),me(Object(R.a)(ne)),k.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(H,"\u4E2A\u6587\u4EF6")),te?Promise.reject():(Q(),!1)):!0},action:p||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(_e){var ve,ye,we=Object(R.a)(_e.fileList);if(_e.file.status==="done"&&((ve=_e.file)===null||ve===void 0||((ye=ve.response)===null||ye===void 0)?void 0:ye.status)===-1){var Le,Ie;k.b.error((Le=_e.file)===null||Le===void 0||((Ie=Le.response)===null||Ie===void 0)?void 0:Ie.message);return}we.length>=H?ue(!0):ue(!1),me(Object(R.a)(we)),we=we.map(function(Ae){var De;if(Ae!=null&&(De=Ae.response)!==null&&De!==void 0&&De.id){var We;Ae.url="/api/attachments/".concat(Ae==null||((We=Ae.response)===null||We===void 0)?void 0:We.id)}return Ae.name.indexOf(u.c)===-1&&(Ae.name="".concat(Ae.name).concat(u.c).concat(Object(u.a)(Ae.size))),Object(O.a)({},Ae)}),console.log("info:",_e),g(we)},onRemove:function(){var Ee=Object(F.a)(w.a.mark(function ve(ye){var we;return w.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:if(we=function(){var Ae=Object(F.a)(w.a.mark(function De(){var We,Ve;return w.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:if(We=ye.response?ye.response.id:ye.id,!We){Ne.next=8;break}return Ne.next=4,Object(o.d)(ye.response?ye.response.id:ye.uid);case 4:return Ve=Ne.sent,Ne.abrupt("return",Ve);case 8:return Ne.abrupt("return",!0);case 9:case"end":return Ne.stop()}},De)}));return function(){return Ae.apply(this,arguments)}}(),!D){Ie.next=5;break}return Ie.abrupt("return",new Promise(function(Ae,De){K.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:v.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var We=Object(F.a)(w.a.mark(function je(){var Ne;return w.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return Xe.next=2,we();case 2:Ne=Xe.sent,k.b.success("\u5220\u9664\u6210\u529F"),Ae(!0);case 5:case"end":return Xe.stop()}},je)}));function Ve(){return We.apply(this,arguments)}return Ve}(),onCancel:function(){return Ae(!1)}})}));case 5:return Ie.next=7,we();case 7:return Ie.abrupt("return",Ie.sent);case 8:case"end":return Ie.stop()}},ve)}));function _e(ve){return Ee.apply(this,arguments)}return _e}()};function ee(Ee){Ee.preventDefault(),Ee.stopPropagation()}return v.a.createElement("div",{className:"multi-upload ".concat(c||"")},M&&v.a.createElement(C,ie,v.a.createElement("p",{className:"ant-upload-drag-icon"},v.a.createElement(s.a,null)),v.a.createElement("p",{className:"ant-upload-text"},"\u70B9\u51FB\u4E0A\u4F20\u56FE\u6807\uFF0C\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64",v.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB)"," "),W),!M&&v.a.createElement(b.a,ie,v.a.createElement(z.a,{disabled:pe},y),v.a.createElement("span",{onClick:ee,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB)"," ")))}},"55Ip":function(qe,He,J){"use strict";J.d(He,"a",function(){return u});var q=J("Ty5D"),z=J("dI71"),L=J("cDcd"),K=J.n(L),F=J("YS25"),O=J("17x9"),B=J.n(O),k=J("wx14"),R=J("zLVn"),S=J("9R94"),m=function(c){Object(z.a)(l,c);function l(){for(var T,y=arguments.length,h=new Array(y),D=0;D<y;D++)h[D]=arguments[D];return T=c.call.apply(c,[this].concat(h))||this,T.history=Object(F.a)(T.props),T}var a=l.prototype;return a.render=function(){return K.a.createElement(q.c,{history:this.history,children:this.props.children})},l}(K.a.Component),b=function(c){Object(z.a)(l,c);function l(){for(var T,y=arguments.length,h=new Array(y),D=0;D<y;D++)h[D]=arguments[D];return T=c.call.apply(c,[this].concat(h))||this,T.history=Object(F.b)(T.props),T}var a=l.prototype;return a.render=function(){return K.a.createElement(q.c,{history:this.history,children:this.props.children})},l}(K.a.Component),P=function(l,a){return typeof l=="function"?l(a):l},w=function(l,a){return typeof l=="string"?Object(F.c)(l,null,null,a):l},x=function(l){return l},v=K.a.forwardRef;typeof v=="undefined"&&(v=x);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=v(function(c,l){var a=c.innerRef,T=c.navigate,y=c.onClick,h=Object(R.a)(c,["innerRef","navigate","onClick"]),D=h.target,U=Object(k.a)({},h,{onClick:function(W){try{y&&y(W)}catch(M){throw W.preventDefault(),M}!W.defaultPrevented&&W.button===0&&(!D||D==="_self")&&!d(W)&&(W.preventDefault(),T())}});return x!==v?U.ref=l||a:U.ref=a,K.a.createElement("a",U)}),u=v(function(c,l){var a=c.component,T=a===void 0?o:a,y=c.replace,h=c.to,D=c.innerRef,U=Object(R.a)(c,["component","replace","to","innerRef"]);return K.a.createElement(q.e.Consumer,null,function(N){N||Object(S.a)(!1);var W=N.history,M=w(P(h,N.location),N.location),I=M?W.createHref(M):"",H=Object(k.a)({},U,{href:I,navigate:function(){var te=P(h,N.location),ae=y?W.replace:W.push;ae(te)}});return x!==v?H.ref=l||D:H.innerRef=D,K.a.createElement(T,H)})});if(!1)var s,C;var E=function(l){return l},f=K.a.forwardRef;typeof f=="undefined"&&(f=E);function A(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(T){return T}).join(" ")}var g=f(function(c,l){var a=c["aria-current"],T=a===void 0?"page":a,y=c.activeClassName,h=y===void 0?"active":y,D=c.activeStyle,U=c.className,N=c.exact,W=c.isActive,M=c.location,I=c.sensitive,H=c.strict,X=c.style,te=c.to,ae=c.innerRef,be=Object(R.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return K.a.createElement(q.e.Consumer,null,function(pe){pe||Object(S.a)(!1);var ue=M||pe.location,se=w(P(te,ue),ue),he=se.pathname,ne=he&&he.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),me=ne?Object(q.f)(ue.pathname,{path:ne,exact:N,sensitive:I,strict:H}):null,Q=!!(W?W(me,ue):me),ie=Q?A(U,h):U,ee=Q?Object(k.a)({},X,{},D):X,Ee=Object(k.a)({"aria-current":Q&&T||null,className:ie,style:ee,to:se},be);return E!==f?Ee.ref=l||ae:Ee.innerRef=ae,K.a.createElement(u,Ee)})});if(!1)var p},"7Cbv":function(qe,He,J){"use strict";var q=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),z=new Uint8Array(16);function L(){if(!q)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return q(z)}var K=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function F(P){return typeof P=="string"&&K.test(P)}for(var O=F,B=[],k=0;k<256;++k)B.push((k+256).toString(16).substr(1));function R(P){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,x=(B[P[w+0]]+B[P[w+1]]+B[P[w+2]]+B[P[w+3]]+"-"+B[P[w+4]]+B[P[w+5]]+"-"+B[P[w+6]]+B[P[w+7]]+"-"+B[P[w+8]]+B[P[w+9]]+"-"+B[P[w+10]]+B[P[w+11]]+B[P[w+12]]+B[P[w+13]]+B[P[w+14]]+B[P[w+15]]).toLowerCase();if(!O(x))throw TypeError("Stringified UUID is invalid");return x}var S=R;function m(P,w,x){P=P||{};var v=P.random||(P.rng||L)();if(v[6]=v[6]&15|64,v[8]=v[8]&63|128,w){x=x||0;for(var d=0;d<16;++d)w[x+d]=v[d];return w}return S(v)}var b=He.a=m},"7ahc":function(qe,He,J){"use strict";J.d(He,"a",function(){return C});var q=J("k1fw"),z=J("0Owb"),L=J("+L6B"),K=J("2/Rp"),F=J("y8nQ"),O=J("Vl3Y"),B=J("tJVT"),k=J("OaEy"),R=J("2fM7"),S=J("cDcd"),m=J.n(S),b=J("VrN/"),P=J.n(b),w=J("p77/"),x=J.n(w),v=J("c5Ni"),d=J.n(v),o=R.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},s={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};He.b=function(E){var f=E.callback,A=E.onCancel,g=Object(S.useState)("python"),p=Object(B.a)(g,2),c=p[0],l=p[1];function a(y){l(s[y][1])}function T(y){f(y)}return m.a.createElement(O.a,Object(z.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:T}),m.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},m.a.createElement(R.a,{onChange:a},Object.keys(s).map(function(y){return m.a.createElement(o,{key:y,value:y},s[y][0])}))),m.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},m.a.createElement(C,{mode:c})),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(K.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function C(E){var f=E.value,A=E.onChange,g=E.mode,p=E.options,c=p===void 0?{}:p,l=Object(S.useRef)(),a=Object(S.useState)(),T=Object(B.a)(a,2),y=T[0],h=T[1];return Object(S.useEffect)(function(){if(y){function D(U){var N=U.getValue();A&&A(N)}return y.on("change",D),function(){y.off("change",D)}}},[y,A]),Object(S.useEffect)(function(){y&&y.setOption("mode",g)},[y,g]),Object(S.useEffect)(function(){y&&((f!==y.getValue()||f==="")&&setTimeout(function(){y.setValue(f||" ")},300))},[y,f]),Object(S.useEffect)(function(){if(l.current&&!y){var D=P.a.fromTextArea(l.current,Object(q.a)({mode:g,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));h(D)}},[l.current,y]),m.a.createElement("div",{className:"my-codemirror-container"},m.a.createElement("textarea",{ref:l}))}},"8EBN":function(qe,He,J){(function(q){q(J("VrN/"))})(function(q){"use strict";q.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var z=0;z<q.modeInfo.length;z++){var L=q.modeInfo[z];L.mimes&&(L.mime=L.mimes[0])}q.findModeByMIME=function(K){K=K.toLowerCase();for(var F=0;F<q.modeInfo.length;F++){var O=q.modeInfo[F];if(O.mime==K)return O;if(O.mimes){for(var B=0;B<O.mimes.length;B++)if(O.mimes[B]==K)return O}}if(/\+xml$/.test(K))return q.findModeByMIME("application/xml");if(/\+json$/.test(K))return q.findModeByMIME("application/json")},q.findModeByExtension=function(K){K=K.toLowerCase();for(var F=0;F<q.modeInfo.length;F++){var O=q.modeInfo[F];if(O.ext){for(var B=0;B<O.ext.length;B++)if(O.ext[B]==K)return O}}},q.findModeByFileName=function(K){for(var F=0;F<q.modeInfo.length;F++){var O=q.modeInfo[F];if(O.file&&O.file.test(K))return O}var B=K.lastIndexOf("."),k=B>-1&&K.substring(B+1,K.length);if(k)return q.findModeByExtension(k)},q.findModeByName=function(K){K=K.toLowerCase();for(var F=0;F<q.modeInfo.length;F++){var O=q.modeInfo[F];if(O.name.toLowerCase()==K)return O;if(O.alias){for(var B=0;B<O.alias.length;B++)if(O.alias[B].toLowerCase()==K)return O}}}})},"8hTe":function(qe,He,J){qe.exports={button:"button___1wy9m"}},"9Bee":function(qe,He,J){"use strict";var q=J("DYRE"),z=J("zeV3"),L=J("+L6B"),K=J("2/Rp"),F=J("k1fw"),O=J("tJVT"),B=J("cDcd"),k=J.n(B),R=J("vg9a"),S=J("DlQD"),m=J.n(S),b=J("rUJ1");function P(ue,se){var he=ue.match(/^(\s+)(?:```)/);if(he===null)return se;var ne=he[1];return se.split(`
`).map(function(me){var Q=me.match(/^\s+/);if(Q===null)return me;var ie=Object(O.a)(Q,1),ee=ie[0];return ee.length>=ne.length?me.slice(ne.length):me}).join(`
`)}var w=[],x=["<ul>"],v=new m.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){w.length=0,x=["<ul>"]}var u={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function s(ue,se,he,ne){if(se>=ue.length||ue[se].level<=he)return se;var me=ue[se];ne.push("<li><a href='#"+me.anchor+"'>"+me.text+"</a>"),se++;var Q=[];return se=s(ue,se,me.level,Q),Q.length>0&&(ne.push("<ul>"),Q.forEach(function(ie){ne.push(ie)}),ne.push("</ul>")),ne.push("</li>"),se=s(ue,se,he,ne),se}function C(){return s(w,0,0,x),x.push("</ul>"),x.join("")}var E={heading:function(se){var he=d.exec(se);if(he)return{type:"heading",raw:he[0],depth:he[1].length,text:he[2]}},fences:function(se){var he=this.rules.block.fences.exec(se);if(he){var ne=he[0],me=P(ne,he[3]||""),Q=he[2]?he[2].trim():he[2];if(["latex","katex","math"].indexOf(Q)>=0){var ie=g(),ee=me;me=ie,p[ie]={type:"block",expression:ee}}return{type:"code",raw:ne,lang:Q,text:me}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,g=function(){return"__special_katext_id_".concat(A++,"__")},p={};function c(){return p}function l(){A=0,p={}}function a(ue){return ue=ue.replace(f,function(se,he){var ne=g();return p[ne]={type:"inline",expression:he},ne}),ue}var T=v.listitem;v.listitem=function(ue){return T(a(ue))};var y=v.paragraph;v.paragraph=function(ue){return y(a(ue))};var h=v.tablecell;v.tablecell=function(ue,se){return h(a(ue),se)},v.code=function(ue,se,he){var ne=(se||"").match(/\S*/)[0];return ne?["latex","katex","math"].indexOf(ne)>=0?"<p class='editormd-tex'>".concat(ue,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(se,'">').concat(he?ue:Object(b.escape)(ue,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(he?ue:Object(b.escape)(ue,!0))+"</code></pre>"},v.heading=function(ue,se,he){var ne=this.options.headerPrefix+he.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return w.push({anchor:ne,level:se,text:ue}),"<h"+se+' id="'+ne+'">'+ue+"</h"+se+">"},m.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),m.a.use({tokenizer:E,renderer:v});var D=m.a,U=J("SJMd"),N=J("ulZh"),W=J.n(N),M=J("m3rI"),I=J("Oy/b"),H=J("p5ED"),X=J("8hTe"),te=J.n(X),ae=/<pre[^>]*>/g;function be(ue){var se=document.createElement("div");return se.innerHTML=ue,se.childNodes.length===0?"":se.childNodes[0].nodeValue}var pe=He.a=function(ue){var se=ue.value,he=se===void 0?"":se,ne=ue.edit,me=ne===void 0?!1:ne,Q=ue.className,ie=ue.showTextOnly,ee=ue.showLines,Ee=ue.replaces,_e=ue.zoomImg,ve=ue.hasMask,ye=ue.style,we=ye===void 0?{}:ye,Le=ue.stylesPrev,Ie=Le===void 0?{}:Le,Ae=String(he),De=Object(B.useRef)(),We=Object(B.useRef)(),Ve=Object(B.useState)(""),je=Object(O.a)(Ve,2),Ne=je[0],Je=je[1],Xe=Object(B.useState)("office"),Ze=Object(O.a)(Xe,2),Ce=Ze[0],et=Ze[1],Ye=Object(B.useMemo)(function(){try{var fe=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Y=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Z=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ae=Ae.replace(fe,"("+M.a.API_SERVER+"/api/attachments/").replace(Y,'"'+M.a.API_SERVER+"/api/attachments/").replace(Z,'"'+M.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(Re){}var re=D(Ae),le=c();if(Ae.match(/\[TOC\]/)&&(re=re.replace("<p>[TOC]</p>",C()),o()),re=re.replace(/(__special_katext_id_\d+__)/g,function(Re,Me){var Ge=le[Me],it=Ge.type,Pe=Ge.expression;return Object(I.renderToString)(be(Pe)||"",{displayMode:it==="block",throwOnError:!1,output:"html"})}),re=re.replace(/▁/g,"\u2581\u2581\u2581"),l(),ie){var Te=document.createElement("div");return Te.innerHTML=re,Te.innerText}return setTimeout(function(){return ge()},500),re},[Ae]),Oe=Object(B.useRef)();u.WebkitLineClamp=ee,ee&&(we=Object(F.a)(Object(F.a)({},we),u));function Ue(fe){var Y=fe.target;if(Y.tagName.toUpperCase()==="IMG"){if(_e){var Z=Y.getAttribute("src");Je(Z),et("image")}}else if(Y.tagName.toUpperCase()==="A"){var re=Y.getAttribute("href");if(re.indexOf("office")>-1)fe.preventDefault(),Je(re),et("office");else if(re.indexOf("application/pdf")>-1)fe.preventDefault(),Je(re),et("pdf");else if(re.indexOf("text/html")>-1)fe.preventDefault(),Je(re),et("html");else if(re.startsWith("#")){fe.preventDefault();var le=document.getElementById(re.replace("#",""));le&&le.scrollIntoView(!0)}}}var ge=function(){var Y,Z=(Y=Oe.current)===null||Y===void 0?void 0:Y.querySelectorAll("video");Z==null||Z.forEach(function(re){if(re.oncontextmenu=function(){return!1},re.src.indexOf(".m3u8")>-1&&!re.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var le=new W.a;le.loadSource(re.src),le.attachMedia(re)}}})};Object(B.useEffect)(function(){if(Oe.current&&Ye&&(Ye.match(ae)&&window.PR.prettyPrint()),Oe.current)return Oe.current.addEventListener("click",Ue),function(){Oe.current.removeEventListener("click",Ue),l(),o()}},[Ye,Oe.current,Ue]);var ce=function(Y){if(!me)return;Y.target.nodeName==="IMG"?(De.current.style.display="flex",De.current.style.width=Y.target.clientWidth+"px",De.current.style.height=Y.target.clientHeight+"px",De.current.style.top=Y.target.offsetTop+"px",De.current.style.left=Y.target.offsetLeft+"px",We.current.src=Y.target.getAttribute("src")):De.current.style.display="none"};return k.a.createElement("div",{style:{position:"relative"}},k.a.createElement("div",{ref:Oe,style:Object(F.a)({},we),className:"".concat(Q||""," markdown-body ").concat(te.a.mdBody),onMouseOver:ce,dangerouslySetInnerHTML:{__html:Ye}}),k.a.createElement("div",{ref:De,className:te.a.button},k.a.createElement(z.a,null,k.a.createElement(K.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),k.a.createElement(K.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),k.a.createElement("img",{ref:We,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),k.a.createElement(H.a,{close:!0,data:Ne,type:Ne!=null&&Ne.length?Ce:"",style:Object(F.a)({},Ie),onClose:function(){return Je("")}}))}},"9VGf":function(qe,He,J){"use strict";J.d(He,"a",function(){return L});var q=J("cDcd"),z=J.n(q);function L(K,F){var O=Object(q.useRef)();Object(q.useEffect)(function(){O.current=K}),Object(q.useEffect)(function(){function B(){O.current()}if(F!==null){var k=setInterval(B,F);return function(){return clearInterval(k)}}},[F])}},BU3w:function(qe,He,J){"use strict";J.d(He,"a",function(){return O});var q=J("MNnm"),z="rc-util-key";function L(B){if(B.attachTo)return B.attachTo;var k=document.querySelector("head");return k||document.body}function K(B){var k,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(q.a)())return null;var S=document.createElement("style");if((k=R.csp)===null||k===void 0?void 0:k.nonce){var m;S.nonce=(m=R.csp)===null||m===void 0?void 0:m.nonce}S.innerHTML=B;var b=L(R),P=b.firstChild;return R.prepend&&b.prepend?b.prepend(S):R.prepend&&P?b.insertBefore(S,P):b.appendChild(S),S}var F=new Map;function O(B,k){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=L(R);if(!F.has(S)){var m=K("",R),b=m.parentNode;F.set(S,b),b.removeChild(m)}var P=Array.from(F.get(S).children).find(function(o){return o.tagName==="STYLE"&&o[z]===k});if(P){var w,x;if(((w=R.csp)===null||w===void 0?void 0:w.nonce)&&P.nonce!==((x=R.csp)===null||x===void 0?void 0:x.nonce)){var v;P.nonce=(v=R.csp)===null||v===void 0?void 0:v.nonce}return P.innerHTML!==B&&(P.innerHTML=B),P}var d=K(B,R);return d[z]=k,d}},Bd2K:function(qe,He,J){(function(q){q(J("VrN/"),J("osHv"))})(function(q){q.defineOption("autoCloseTags",!1,function(R,S,m){if(m!=q.Init&&m&&R.removeKeyMap("autoCloseTags"),!S)return;var b={name:"autoCloseTags"};(typeof S!="object"||S.whenClosing!==!1)&&(b["'/'"]=function(P){return O(P)}),(typeof S!="object"||S.whenOpening!==!1)&&(b["'>'"]=function(P){return K(P)}),R.addKeyMap(b)});var z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function K(R){if(R.getOption("disableInput"))return q.Pass;for(var S=R.listSelections(),m=[],b=R.getOption("autoCloseTags"),P=0;P<S.length;P++){if(!S[P].empty())return q.Pass;var w=S[P].head,x=R.getTokenAt(w),v=q.innerMode(R.getMode(),x.state),d=v.state,o=v.mode.xmlCurrentTag&&v.mode.xmlCurrentTag(d),u=o&&o.name;if(!u)return q.Pass;var s=v.mode.configuration=="html",C=typeof b=="object"&&b.dontCloseTags||s&&z,E=typeof b=="object"&&b.indentTags||s&&L;x.end>w.ch&&(u=u.slice(0,u.length-x.end+w.ch));var f=u.toLowerCase();if(!u||x.type=="string"&&(x.end!=w.ch||!/[\"\']/.test(x.string.charAt(x.string.length-1))||x.string.length==1)||x.type=="tag"&&o.close||x.string.indexOf("/")==w.ch-x.start-1||C&&B(C,f)>-1||k(R,v.mode.xmlCurrentContext&&v.mode.xmlCurrentContext(d)||[],u,w,!0))return q.Pass;var A=typeof b=="object"&&b.emptyTags;if(A&&B(A,u)>-1){m[P]={text:"/>",newPos:q.Pos(w.line,w.ch+2)};continue}var g=E&&B(E,f)>-1;m[P]={indent:g,text:">"+(g?`
`:"")+"</"+u+">",newPos:g?q.Pos(w.line+1,0):q.Pos(w.line,w.ch+1)}}for(var p=typeof b=="object"&&b.dontIndentOnAutoClose,P=S.length-1;P>=0;P--){var c=m[P];R.replaceRange(c.text,S[P].head,S[P].anchor,"+insert");var l=R.listSelections().slice(0);l[P]={head:c.newPos,anchor:c.newPos},R.setSelections(l),!p&&c.indent&&(R.indentLine(c.newPos.line,null,!0),R.indentLine(c.newPos.line+1,null,!0))}}function F(R,S){for(var m=R.listSelections(),b=[],P=S?"/":"</",w=R.getOption("autoCloseTags"),x=typeof w=="object"&&w.dontIndentOnSlash,v=0;v<m.length;v++){if(!m[v].empty())return q.Pass;var d=m[v].head,o=R.getTokenAt(d),u=q.innerMode(R.getMode(),o.state),s=u.state;if(S&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return q.Pass;var C,E=u.mode.name!="xml"&&R.getMode().name=="htmlmixed";if(E&&u.mode.name=="javascript")C=P+"script";else if(E&&u.mode.name=="css")C=P+"style";else{var f=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(s);if(!f||f.length&&k(R,f,f[f.length-1],d))return q.Pass;C=P+f[f.length-1]}R.getLine(d.line).charAt(o.end)!=">"&&(C+=">"),b[v]=C}if(R.replaceSelections(b),m=R.listSelections(),!x)for(var v=0;v<m.length;v++)(v==m.length-1||m[v].head.line<m[v+1].head.line)&&R.indentLine(m[v].head.line)}function O(R){return R.getOption("disableInput")?q.Pass:F(R,!0)}q.commands.closeTag=function(R){return F(R)};function B(R,S){if(R.indexOf)return R.indexOf(S);for(var m=0,b=R.length;m<b;++m)if(R[m]==S)return m;return-1}function k(R,S,m,b,P){if(!q.scanForClosingTag)return!1;var w=Math.min(R.lastLine()+1,b.line+500),x=q.scanForClosingTag(R,b,null,w);if(!x||x.tag!=m)return!1;for(var v=P?1:0,d=S.length-1;d>=0&&S[d]==m;d--)++v;b=x.to;for(var d=1;d<v;d++){var o=q.scanForClosingTag(R,b,null,w);if(!o||o.tag!=m)return!1;b=o.to}return!0}})},BjJ7:function(qe,He,J){"use strict";J.d(He,"d",function(){return z}),J.d(He,"c",function(){return L}),J.d(He,"e",function(){return K}),J.d(He,"b",function(){return F}),J.d(He,"a",function(){return B});var q=J("m3rI");function z(k){var R=!0;if(k.length>0){for(var S=0;S<k.length;S++)if(k[S].compile_success==0||!k[S].compile_success){R=!1;break}}else R=!1;return R}function L(k){for(var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",S=[],m=0;m<k.length;m++){var b=k[m],P=R?"".concat(R,"/").concat(b.name):"".concat(b.name);S.push({title:b.name,isLeaf:!(b.type==="tree"),key:P})}return S}function K(k,R,S){for(var m=0;m<k.length;m++){var b=k[m];if(b.key===R){b.children=S;break}b.children&&K(b.children,R,S)}return k}function F(k,R,S){var m;return function(){var b=this,P=arguments,w=function(){m=null,S||k.apply(b,P)},x=S&&!m;clearTimeout(m),m=setTimeout(w,R),x&&k.apply(b,P)}}var O=!0,B=q.a.API_SERVER},"C+DQ":function(qe,He,J){},D1Df:function(qe,He,J){"use strict";function q(h){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?q=function(U){return typeof U}:q=function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},q(h)}function z(){return z=Object.assign||function(h){for(var D=1;D<arguments.length;D++){var U=arguments[D];for(var N in U)Object.prototype.hasOwnProperty.call(U,N)&&(h[N]=U[N])}return h},z.apply(this,arguments)}function L(h,D){var U=Object.keys(h);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(h);D&&(N=N.filter(function(W){return Object.getOwnPropertyDescriptor(h,W).enumerable})),U.push.apply(U,N)}return U}function K(h){for(var D=1;D<arguments.length;D++){var U=arguments[D]!=null?arguments[D]:{};D%2?L(U,!0).forEach(function(N){x(h,N,U[N])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(U)):L(U).forEach(function(N){Object.defineProperty(h,N,Object.getOwnPropertyDescriptor(U,N))})}return h}function F(h,D){if(h==null)return{};var U=O(h,D),N,W;if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(h);for(W=0;W<M.length;W++){if(N=M[W],D.indexOf(N)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(h,N))continue;U[N]=h[N]}}return U}function O(h,D){if(h==null)return{};var U={},N=Object.keys(h),W,M;for(M=0;M<N.length;M++){if(W=N[M],D.indexOf(W)>=0)continue;U[W]=h[W]}return U}function B(h,D){if(!(h instanceof D))throw new TypeError("Cannot call a class as a function")}function k(h,D){for(var U=0;U<D.length;U++){var N=D[U];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(h,N.key,N)}}function R(h,D,U){return D&&k(h.prototype,D),U&&k(h,U),h}function S(h,D){return D&&(q(D)==="object"||typeof D=="function")?D:b(h)}function m(h){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(U){return U.__proto__||Object.getPrototypeOf(U)},m(h)}function b(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function P(h,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function");h.prototype=Object.create(D&&D.prototype,{constructor:{value:h,writable:!0,configurable:!0}}),D&&w(h,D)}function w(h,D){return w=Object.setPrototypeOf||function(N,W){return N.__proto__=W,N},w(h,D)}function x(h,D,U){return D in h?Object.defineProperty(h,D,{value:U,enumerable:!0,configurable:!0,writable:!0}):h[D]=U,h}var v=J("cDcd"),d=J("17x9"),o=J("H38U"),u=J("aRTE");function s(h){for(var D="",U=0;U<h.length;U++){var N=h.charCodeAt(U);N<128?D+=String.fromCharCode(N):N<2048?(D+=String.fromCharCode(192|N>>6),D+=String.fromCharCode(128|N&63)):N<55296||N>=57344?(D+=String.fromCharCode(224|N>>12),D+=String.fromCharCode(128|N>>6&63),D+=String.fromCharCode(128|N&63)):(U++,N=65536+((N&1023)<<10|h.charCodeAt(U)&1023),D+=String.fromCharCode(240|N>>18),D+=String.fromCharCode(128|N>>12&63),D+=String.fromCharCode(128|N>>6&63),D+=String.fromCharCode(128|N&63))}return D}var C={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},E={},f=4,A=.1;function g(h){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,U=[];return h.forEach(function(N,W){var M=null;N.forEach(function(I,H){if(!I&&M!==null){U.push("M".concat(M+D," ").concat(W+D,"h").concat(H-M,"v1H").concat(M+D,"z")),M=null;return}if(H===N.length-1){if(!I)return;M===null?U.push("M".concat(H+D,",").concat(W+D," h1v1H").concat(H+D,"z")):U.push("M".concat(M+D,",").concat(W+D," h").concat(H+1-M,"v1H").concat(M+D,"z"));return}I&&M===null&&(M=H)})}),U.join("")}function p(h,D){return h.slice().map(function(U,N){return N<D.y||N>=D.y+D.h?U:U.map(function(W,M){return M<D.x||M>=D.x+D.w?W:!1})})}function c(h,D){var U=h.imageSettings,N=h.size,W=h.includeMargin;if(U==null)return null;var M=W?f:0,I=D.length+M*2,H=Math.floor(N*A),X=I/N,te=(U.width||H)*X,ae=(U.height||H)*X,be=U.x==null?D.length/2-te/2:U.x*X,pe=U.y==null?D.length/2-ae/2:U.y*X,ue=null;if(U.excavate){var se=Math.floor(be),he=Math.floor(pe),ne=Math.ceil(te+be-se),me=Math.ceil(ae+pe-he);ue={x:se,y:he,w:ne,h:me}}return{x:be,y:pe,h:ae,w:te,excavation:ue}}var l=function(){try{new Path2D().addPath(new Path2D)}catch(h){return!1}return!0}(),a=function(h){P(D,h);function D(){var U,N;B(this,D);for(var W=arguments.length,M=new Array(W),I=0;I<W;I++)M[I]=arguments[I];return N=S(this,(U=m(D)).call.apply(U,[this].concat(M))),x(b(N),"_canvas",void 0),x(b(N),"_image",void 0),x(b(N),"state",{imgLoaded:!1}),x(b(N),"handleImageLoad",function(){N.setState({imgLoaded:!0})}),N}return R(D,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var N=this.props,W=N.value,M=N.size,I=N.level,H=N.bgColor,X=N.fgColor,te=N.includeMargin,ae=N.imageSettings,be=new o(-1,u[I]);if(be.addData(s(W)),be.make(),this._canvas!=null){var pe=this._canvas,ue=pe.getContext("2d");if(!ue)return;var se=be.modules;if(se===null)return;var he=te?f:0,ne=se.length+he*2,me=c(this.props,se);ae!=null&&me!=null&&(me.excavation!=null&&(se=p(se,me.excavation)));var Q=window.devicePixelRatio||1;pe.height=pe.width=M*Q;var ie=M/ne*Q;ue.scale(ie,ie),ue.fillStyle=H,ue.fillRect(0,0,ne,ne),ue.fillStyle=X,l?ue.fill(new Path2D(g(se,he))):se.forEach(function(ee,Ee){ee.forEach(function(_e,ve){_e&&ue.fillRect(ve+he,Ee+he,1,1)})}),this.state.imgLoaded&&this._image&&me!=null&&ue.drawImage(this._image,me.x+he,me.y+he,me.w,me.h)}}},{key:"render",value:function(){var N=this,W=this.props,M=W.value,I=W.size,H=W.level,X=W.bgColor,te=W.fgColor,ae=W.style,be=W.includeMargin,pe=W.imageSettings,ue=F(W,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),se=K({height:I,width:I},ae),he=null,ne=pe&&pe.src;return pe!=null&&ne!=null&&(he=v.createElement("img",{src:ne,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(Q){return N._image=Q}})),v.createElement(v.Fragment,null,v.createElement("canvas",z({style:se,height:I,width:I,ref:function(Q){return N._canvas=Q}},ue)),he)}}]),D}(v.PureComponent);x(a,"defaultProps",C);var T=function(h){P(D,h);function D(){return B(this,D),S(this,m(D).apply(this,arguments))}return R(D,[{key:"render",value:function(){var N=this.props,W=N.value,M=N.size,I=N.level,H=N.bgColor,X=N.fgColor,te=N.includeMargin,ae=N.imageSettings,be=F(N,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),pe=new o(-1,u[I]);pe.addData(s(W)),pe.make();var ue=pe.modules;if(ue===null)return null;var se=te?f:0,he=ue.length+se*2,ne=c(this.props,ue),me=null;ae!=null&&ne!=null&&(ne.excavation!=null&&(ue=p(ue,ne.excavation)),me=v.createElement("image",{xlinkHref:ae.src,height:ne.h,width:ne.w,x:ne.x+se,y:ne.y+se,preserveAspectRatio:"none"}));var Q=g(ue,se);return v.createElement("svg",z({shapeRendering:"crispEdges",height:M,width:M,viewBox:"0 0 ".concat(he," ").concat(he)},be),v.createElement("path",{fill:H,d:"M0,0 h".concat(he,"v").concat(he,"H0z")}),v.createElement("path",{fill:X,d:Q}),me)}}]),D}(v.PureComponent);x(T,"defaultProps",C);var y=function(D){var U=D.renderAs,N=F(D,["renderAs"]),W=U==="svg"?T:a;return v.createElement(W,N)};y.defaultProps=K({renderAs:"canvas"},C),qe.exports=y},DlQD:function(qe,He,J){(function(q,z){qe.exports=z()})(this,function(){"use strict";function q(ge,ce){for(var fe=0;fe<ce.length;fe++){var Y=ce[fe];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(ge,Y.key,Y)}}function z(ge,ce,fe){return ce&&q(ge.prototype,ce),fe&&q(ge,fe),ge}function L(ge,ce){if(!ge)return;if(typeof ge=="string")return K(ge,ce);var fe=Object.prototype.toString.call(ge).slice(8,-1);if(fe==="Object"&&ge.constructor&&(fe=ge.constructor.name),fe==="Map"||fe==="Set")return Array.from(ge);if(fe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(fe))return K(ge,ce)}function K(ge,ce){(ce==null||ce>ge.length)&&(ce=ge.length);for(var fe=0,Y=new Array(ce);fe<ce;fe++)Y[fe]=ge[fe];return Y}function F(ge,ce){var fe;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(fe=L(ge))||ce&&ge&&typeof ge.length=="number"){fe&&(ge=fe);var Y=0;return function(){return Y>=ge.length?{done:!0}:{done:!1,value:ge[Y++]}}}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 fe=ge[Symbol.iterator](),fe.next.bind(fe)}function O(ge,ce){return ce={exports:{}},ge(ce,ce.exports),ce.exports}var B=O(function(ge){function ce(){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 fe(Y){ge.exports.defaults=Y}ge.exports={defaults:ce(),getDefaults:ce,changeDefaults:fe}}),k=B.defaults,R=B.getDefaults,S=B.changeDefaults,m=/[&<>"']/,b=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},v=function(ce){return x[ce]};function d(ge,ce){if(ce){if(m.test(ge))return ge.replace(b,v)}else if(P.test(ge))return ge.replace(w,v);return ge}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(ge){return ge.replace(o,function(ce,fe){return fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""})}var s=/(^|[^\[])\^/g;function C(ge,ce){ge=ge.source||ge,ce=ce||"";var fe={replace:function(Z,re){return re=re.source||re,re=re.replace(s,"$1"),ge=ge.replace(Z,re),fe},getRegex:function(){return new RegExp(ge,ce)}};return fe}var E=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(ge,ce,fe){if(ge){var Y;try{Y=decodeURIComponent(u(fe)).replace(E,"").toLowerCase()}catch(Z){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}ce&&!f.test(fe)&&(fe=a(ce,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch(Z){return null}return fe}var g={},p=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ge,ce){g[" "+ge]||(p.test(ge)?g[" "+ge]=ge+"/":g[" "+ge]=D(ge,"/",!0)),ge=g[" "+ge];var fe=ge.indexOf(":")===-1;return ce.substring(0,2)==="//"?fe?ce:ge.replace(c,"$1")+ce:ce.charAt(0)==="/"?fe?ce:ge.replace(l,"$1")+ce:ge+ce}var T={exec:function(){}};function y(ge){for(var ce=1,fe,Y;ce<arguments.length;ce++){fe=arguments[ce];for(Y in fe)Object.prototype.hasOwnProperty.call(fe,Y)&&(ge[Y]=fe[Y])}return ge}function h(ge,ce){var fe=ge.replace(/\|/g,function(re,le,Te){for(var Re=!1,Me=le;--Me>=0&&Te[Me]==="\\";)Re=!Re;return Re?"|":" |"}),Y=fe.split(/ \|/),Z=0;if(Y.length>ce)Y.splice(ce);else for(;Y.length<ce;)Y.push("");for(;Z<Y.length;Z++)Y[Z]=Y[Z].trim().replace(/\\\|/g,"|");return Y}function D(ge,ce,fe){var Y=ge.length;if(Y===0)return"";for(var Z=0;Z<Y;){var re=ge.charAt(Y-Z-1);if(re===ce&&!fe)Z++;else if(re!==ce&&fe)Z++;else break}return ge.substr(0,Y-Z)}function U(ge,ce){if(ge.indexOf(ce[1])===-1)return-1;for(var fe=ge.length,Y=0,Z=0;Z<fe;Z++)if(ge[Z]==="\\")Z++;else if(ge[Z]===ce[0])Y++;else if(ge[Z]===ce[1]&&(Y--,Y<0))return Z;return-1}function N(ge){ge&&ge.sanitize&&!ge.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 W={escape:d,unescape:u,edit:C,cleanUrl:A,resolveUrl:a,noopTest:T,merge:y,splitCells:h,rtrim:D,findClosingBracket:U,checkSanitizeDeprecation:N},M=B.defaults,I=W.rtrim,H=W.splitCells,X=W.escape,te=W.findClosingBracket;function ae(ge,ce,fe){var Y=ce.href,Z=ce.title?X(ce.title):null,re=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:fe,href:Y,title:Z,text:re}:{type:"image",raw:fe,href:Y,title:Z,text:X(re)}}function be(ge,ce){var fe=ge.match(/^(\s+)(?:```)/);if(fe===null)return ce;var Y=fe[1];return ce.split(`
`).map(function(Z){var re=Z.match(/^\s+/);if(re===null)return Z;var le=re[0];return le.length>=Y.length?Z.slice(Y.length):Z}).join(`
`)}var pe=function(){function ge(fe){this.options=fe||M}var ce=ge.prototype;return ce.space=function(Y){var Z=this.rules.block.newline.exec(Y);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:`
`}},ce.code=function(Y,Z){var re=this.rules.block.code.exec(Y);if(re){var le=Z[Z.length-1];if(le&&le.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var Te=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:I(Te,`
`)}}},ce.fences=function(Y){var Z=this.rules.block.fences.exec(Y);if(Z){var re=Z[0],le=be(re,Z[3]||"");return{type:"code",raw:re,lang:Z[2]?Z[2].trim():Z[2],text:le}}},ce.heading=function(Y){var Z=this.rules.block.heading.exec(Y);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},ce.nptable=function(Y){var Z=this.rules.block.nptable.exec(Y);if(Z){var re={type:"table",header:H(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
`):[],raw:Z[0]};if(re.header.length===re.align.length){var le=re.align.length,Te;for(Te=0;Te<le;Te++)/^ *-+: *$/.test(re.align[Te])?re.align[Te]="right":/^ *:-+: *$/.test(re.align[Te])?re.align[Te]="center":/^ *:-+ *$/.test(re.align[Te])?re.align[Te]="left":re.align[Te]=null;for(le=re.cells.length,Te=0;Te<le;Te++)re.cells[Te]=H(re.cells[Te],re.header.length);return re}}},ce.hr=function(Y){var Z=this.rules.block.hr.exec(Y);if(Z)return{type:"hr",raw:Z[0]}},ce.blockquote=function(Y){var Z=this.rules.block.blockquote.exec(Y);if(Z){var re=Z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Z[0],text:re}}},ce.list=function(Y){var Z=this.rules.block.list.exec(Y);if(Z){for(var re=Z[0],le=Z[2],Te=le.length>1,Re=le[le.length-1]===")",Me={type:"list",raw:re,ordered:Te,start:Te?+le.slice(0,-1):"",loose:!1,items:[]},Ge=Z[0].match(this.rules.block.item),it=!1,Pe,ct,at,rt,xt,Et,Rt,At=Ge.length,pt=0;pt<At;pt++)Pe=Ge[pt],re=Pe,ct=Pe.length,Pe=Pe.replace(/^ *([*+-]|\d+[.)]) */,""),~Pe.indexOf(`
`)&&(ct-=Pe.length,Pe=this.options.pedantic?Pe.replace(/^ {1,4}/gm,""):Pe.replace(new RegExp("^ {1,"+ct+"}","gm"),"")),pt!==At-1&&(at=this.rules.block.bullet.exec(Ge[pt+1])[0],(Te?at.length===1||!Re&&at[at.length-1]===")":at.length>1||this.options.smartLists&&at!==le)&&(rt=Ge.slice(pt+1).join(`
`),Me.raw=Me.raw.substring(0,Me.raw.length-rt.length),pt=At-1)),xt=it||/\n\n(?!\s*$)/.test(Pe),pt!==At-1&&(it=Pe.charAt(Pe.length-1)===`
`,xt||(xt=it)),xt&&(Me.loose=!0),Et=/^\[[ xX]\] /.test(Pe),Rt=void 0,Et&&(Rt=Pe[1]!==" ",Pe=Pe.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:re,task:Et,checked:Rt,loose:xt,text:Pe});return Me}},ce.html=function(Y){var Z=this.rules.block.html.exec(Y);if(Z)return{type:this.options.sanitize?"paragraph":"html",raw:Z[0],pre:!this.options.sanitizer&&(Z[1]==="pre"||Z[1]==="script"||Z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):X(Z[0]):Z[0]}},ce.def=function(Y){var Z=this.rules.block.def.exec(Y);if(Z){Z[3]&&(Z[3]=Z[3].substring(1,Z[3].length-1));var re=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:Z[0],href:Z[2],title:Z[3]}}},ce.table=function(Y){var Z=this.rules.block.table.exec(Y);if(Z){var re={type:"table",header:H(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
`):[]};if(re.header.length===re.align.length){re.raw=Z[0];var le=re.align.length,Te;for(Te=0;Te<le;Te++)/^ *-+: *$/.test(re.align[Te])?re.align[Te]="right":/^ *:-+: *$/.test(re.align[Te])?re.align[Te]="center":/^ *:-+ *$/.test(re.align[Te])?re.align[Te]="left":re.align[Te]=null;for(le=re.cells.length,Te=0;Te<le;Te++)re.cells[Te]=H(re.cells[Te].replace(/^ *\| *| *\| *$/g,""),re.header.length);return re}}},ce.lheading=function(Y){var Z=this.rules.block.lheading.exec(Y);if(Z)return{type:"heading",raw:Z[0],depth:Z[2].charAt(0)==="="?1:2,text:Z[1]}},ce.paragraph=function(Y){var Z=this.rules.block.paragraph.exec(Y);if(Z)return{type:"paragraph",raw:Z[0],text:Z[1].charAt(Z[1].length-1)===`
`?Z[1].slice(0,-1):Z[1]}},ce.text=function(Y,Z){var re=this.rules.block.text.exec(Y);if(re){var le=Z[Z.length-1];return le&&le.type==="text"?{raw:re[0],text:re[0]}:{type:"text",raw:re[0],text:re[0]}}},ce.escape=function(Y){var Z=this.rules.inline.escape.exec(Y);if(Z)return{type:"escape",raw:Z[0],text:X(Z[1])}},ce.tag=function(Y,Z,re){var le=this.rules.inline.tag.exec(Y);if(le)return!Z&&/^<a /i.test(le[0])?Z=!0:Z&&/^<\/a>/i.test(le[0])&&(Z=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:Z,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):X(le[0]):le[0]}},ce.link=function(Y){var Z=this.rules.inline.link.exec(Y);if(Z){var re=te(Z[2],"()");if(re>-1){var le=Z[0].indexOf("!")===0?5:4,Te=le+Z[1].length+re;Z[2]=Z[2].substring(0,re),Z[0]=Z[0].substring(0,Te).trim(),Z[3]=""}var Re=Z[2],Me="";if(this.options.pedantic){var Ge=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Re);Ge?(Re=Ge[1],Me=Ge[3]):Me=""}else Me=Z[3]?Z[3].slice(1,-1):"";Re=Re.trim().replace(/^<([\s\S]*)>$/,"$1");var it=ae(Z,{href:Re&&Re.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},Z[0]);return it}},ce.reflink=function(Y,Z){var re;if((re=this.rules.inline.reflink.exec(Y))||(re=this.rules.inline.nolink.exec(Y))){var le=(re[2]||re[1]).replace(/\s+/g," ");if(le=Z[le.toLowerCase()],!le||!le.href){var Te=re[0].charAt(0);return{type:"text",raw:Te,text:Te}}var Re=ae(re,le,re[0]);return Re}},ce.strong=function(Y,Z,re){re===void 0&&(re="");var le=this.rules.inline.strong.start.exec(Y);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){Z=Z.slice(-1*Y.length);var Te=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var Re;(le=Te.exec(Z))!=null;)if(Re=this.rules.inline.strong.middle.exec(Z.slice(0,le.index+3)),Re)return{type:"strong",raw:Y.slice(0,Re[0].length),text:Y.slice(2,Re[0].length-2)}}},ce.em=function(Y,Z,re){re===void 0&&(re="");var le=this.rules.inline.em.start.exec(Y);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){Z=Z.slice(-1*Y.length);var Te=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var Re;(le=Te.exec(Z))!=null;)if(Re=this.rules.inline.em.middle.exec(Z.slice(0,le.index+2)),Re)return{type:"em",raw:Y.slice(0,Re[0].length),text:Y.slice(1,Re[0].length-1)}}},ce.codespan=function(Y){var Z=this.rules.inline.code.exec(Y);if(Z){var re=Z[2].replace(/\n/g," "),le=/[^ ]/.test(re),Te=re.startsWith(" ")&&re.endsWith(" ");return le&&Te&&(re=re.substring(1,re.length-1)),re=X(re,!0),{type:"codespan",raw:Z[0],text:re}}},ce.br=function(Y){var Z=this.rules.inline.br.exec(Y);if(Z)return{type:"br",raw:Z[0]}},ce.del=function(Y){var Z=this.rules.inline.del.exec(Y);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},ce.autolink=function(Y,Z){var re=this.rules.inline.autolink.exec(Y);if(re){var le,Te;return re[2]==="@"?(le=X(this.options.mangle?Z(re[1]):re[1]),Te="mailto:"+le):(le=X(re[1]),Te=le),{type:"link",raw:re[0],text:le,href:Te,tokens:[{type:"text",raw:le,text:le}]}}},ce.url=function(Y,Z){var re;if(re=this.rules.inline.url.exec(Y)){var le,Te;if(re[2]==="@")le=X(this.options.mangle?Z(re[0]):re[0]),Te="mailto:"+le;else{var Re;do Re=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(Re!==re[0]);le=X(re[0]),re[1]==="www."?Te="http://"+le:Te=le}return{type:"link",raw:re[0],text:le,href:Te,tokens:[{type:"text",raw:le,text:le}]}}},ce.inlineText=function(Y,Z,re){var le=this.rules.inline.text.exec(Y);if(le){var Te;return Z?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):X(le[0]):le[0]:Te=X(this.options.smartypants?re(le[0]):le[0]),{type:"text",raw:le[0],text:Te}}},ge}(),ue=W.noopTest,se=W.edit,he=W.merge,ne={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:ue,table:ue,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ne._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ne._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ne.def=se(ne.def).replace("label",ne._label).replace("title",ne._title).getRegex(),ne.bullet=/(?:[*+-]|\d{1,9}[.)])/,ne.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ne.item=se(ne.item,"gm").replace(/bull/g,ne.bullet).getRegex(),ne.list=se(ne.list).replace(/bull/g,ne.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ne.def.source+")").getRegex(),ne._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",ne._comment=/<!--(?!-?>)[\s\S]*?-->/,ne.html=se(ne.html,"i").replace("comment",ne._comment).replace("tag",ne._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ne.paragraph=se(ne._paragraph).replace("hr",ne.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",ne._tag).getRegex(),ne.blockquote=se(ne.blockquote).replace("paragraph",ne.paragraph).getRegex(),ne.normal=he({},ne),ne.gfm=he({},ne.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*|$)"}),ne.gfm.nptable=se(ne.gfm.nptable).replace("hr",ne.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",ne._tag).getRegex(),ne.gfm.table=se(ne.gfm.table).replace("hr",ne.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",ne._tag).getRegex(),ne.pedantic=he({},ne.normal,{html:se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ne._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:ue,paragraph:se(ne.normal._paragraph).replace("hr",ne.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ne.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var me={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ue,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:ue,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};me._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",me.punctuation=se(me.punctuation).replace(/punctuation/g,me._punctuation).getRegex(),me._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",me._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",me.em.start=se(me.em.start).replace(/punctuation/g,me._punctuation).getRegex(),me.em.middle=se(me.em.middle).replace(/punctuation/g,me._punctuation).replace(/overlapSkip/g,me._overlapSkip).getRegex(),me.em.endAst=se(me.em.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.em.endUnd=se(me.em.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.start=se(me.strong.start).replace(/punctuation/g,me._punctuation).getRegex(),me.strong.middle=se(me.strong.middle).replace(/punctuation/g,me._punctuation).replace(/blockSkip/g,me._blockSkip).getRegex(),me.strong.endAst=se(me.strong.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.endUnd=se(me.strong.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.blockSkip=se(me._blockSkip,"g").getRegex(),me.overlapSkip=se(me._overlapSkip,"g").getRegex(),me._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,me._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,me._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])?)+(?![-_])/,me.autolink=se(me.autolink).replace("scheme",me._scheme).replace("email",me._email).getRegex(),me._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,me.tag=se(me.tag).replace("comment",ne._comment).replace("attribute",me._attribute).getRegex(),me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,me._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,me.link=se(me.link).replace("label",me._label).replace("href",me._href).replace("title",me._title).getRegex(),me.reflink=se(me.reflink).replace("label",me._label).getRegex(),me.reflinkSearch=se(me.reflinkSearch,"g").replace("reflink",me.reflink).replace("nolink",me.nolink).getRegex(),me.normal=he({},me),me.pedantic=he({},me.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:se(/^!?\[(label)\]\((.*?)\)/).replace("label",me._label).getRegex(),reflink:se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",me._label).getRegex()}),me.gfm=he({},me.normal,{escape:se(me.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),me.gfm.url=se(me.gfm.url,"i").replace("email",me.gfm._extended_email).getRegex(),me.breaks=he({},me.gfm,{br:se(me.br).replace("{2,}","*").getRegex(),text:se(me.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Q={block:ne,inline:me},ie=B.defaults,ee=Q.block,Ee=Q.inline;function _e(ge){return ge.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 ve(ge){var ce="",fe,Y,Z=ge.length;for(fe=0;fe<Z;fe++)Y=ge.charCodeAt(fe),Math.random()>.5&&(Y="x"+Y.toString(16)),ce+="&#"+Y+";";return ce}var ye=function(){function ge(fe){this.tokens=[],this.tokens.links=Object.create(null),this.options=fe||ie,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:ee.normal,inline:Ee.normal};this.options.pedantic?(Y.block=ee.pedantic,Y.inline=Ee.pedantic):this.options.gfm&&(Y.block=ee.gfm,this.options.breaks?Y.inline=Ee.breaks:Y.inline=Ee.gfm),this.tokenizer.rules=Y}ge.lex=function(Y,Z){var re=new ge(Z);return re.lex(Y)};var ce=ge.prototype;return ce.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},ce.blockTokens=function(Y,Z,re){Z===void 0&&(Z=[]),re===void 0&&(re=!0),Y=Y.replace(/^ +$/gm,"");for(var le,Te,Re,Me;Y;){if(le=this.tokenizer.space(Y)){Y=Y.substring(le.raw.length),le.type&&Z.push(le);continue}if(le=this.tokenizer.code(Y,Z)){Y=Y.substring(le.raw.length),le.type?Z.push(le):(Me=Z[Z.length-1],Me.raw+=`
`+le.raw,Me.text+=`
`+le.text);continue}if(le=this.tokenizer.fences(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.heading(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.nptable(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.hr(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.blockquote(Y)){Y=Y.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],re),Z.push(le);continue}if(le=this.tokenizer.list(Y)){for(Y=Y.substring(le.raw.length),Re=le.items.length,Te=0;Te<Re;Te++)le.items[Te].tokens=this.blockTokens(le.items[Te].text,[],!1);Z.push(le);continue}if(le=this.tokenizer.html(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(re&&(le=this.tokenizer.def(Y))){Y=Y.substring(le.raw.length),this.tokens.links[le.tag]||(this.tokens.links[le.tag]={href:le.href,title:le.title});continue}if(le=this.tokenizer.table(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.lheading(Y)){Y=Y.substring(le.raw.length),Z.push(le);continue}if(re&&(le=this.tokenizer.paragraph(Y))){Y=Y.substring(le.raw.length),Z.push(le);continue}if(le=this.tokenizer.text(Y,Z)){Y=Y.substring(le.raw.length),le.type?Z.push(le):(Me=Z[Z.length-1],Me.raw+=`
`+le.raw,Me.text+=`
`+le.text);continue}if(Y){var Ge="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return Z},ce.inline=function(Y){var Z,re,le,Te,Re,Me,Ge=Y.length;for(Z=0;Z<Ge;Z++){Me=Y[Z];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},Te=Me.header.length,re=0;re<Te;re++)Me.tokens.header[re]=[],this.inlineTokens(Me.header[re],Me.tokens.header[re]);for(Te=Me.cells.length,re=0;re<Te;re++)for(Re=Me.cells[re],Me.tokens.cells[re]=[],le=0;le<Re.length;le++)Me.tokens.cells[re][le]=[],this.inlineTokens(Re[le],Me.tokens.cells[re][le]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(Te=Me.items.length,re=0;re<Te;re++)this.inline(Me.items[re].tokens);break}}}return Y},ce.inlineTokens=function(Y,Z,re,le,Te){Z===void 0&&(Z=[]),re===void 0&&(re=!1),le===void 0&&(le=!1),Te===void 0&&(Te="");var Re,Me=Y,Ge;if(this.tokens.links){var it=Object.keys(this.tokens.links);if(it.length>0)for(;(Ge=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)it.includes(Ge[0].slice(Ge[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ge=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(Re=this.tokenizer.escape(Y)){Y=Y.substring(Re.raw.length),Z.push(Re);continue}if(Re=this.tokenizer.tag(Y,re,le)){Y=Y.substring(Re.raw.length),re=Re.inLink,le=Re.inRawBlock,Z.push(Re);continue}if(Re=this.tokenizer.link(Y)){Y=Y.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,le)),Z.push(Re);continue}if(Re=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,le)),Z.push(Re);continue}if(Re=this.tokenizer.strong(Y,Me,Te)){Y=Y.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],re,le),Z.push(Re);continue}if(Re=this.tokenizer.em(Y,Me,Te)){Y=Y.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],re,le),Z.push(Re);continue}if(Re=this.tokenizer.codespan(Y)){Y=Y.substring(Re.raw.length),Z.push(Re);continue}if(Re=this.tokenizer.br(Y)){Y=Y.substring(Re.raw.length),Z.push(Re);continue}if(Re=this.tokenizer.del(Y)){Y=Y.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],re,le),Z.push(Re);continue}if(Re=this.tokenizer.autolink(Y,ve)){Y=Y.substring(Re.raw.length),Z.push(Re);continue}if(!re&&(Re=this.tokenizer.url(Y,ve))){Y=Y.substring(Re.raw.length),Z.push(Re);continue}if(Re=this.tokenizer.inlineText(Y,le,_e)){Y=Y.substring(Re.raw.length),Te=Re.raw.slice(-1),Z.push(Re);continue}if(Y){var Pe="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(Pe);break}else throw new Error(Pe)}}return Z},z(ge,null,[{key:"rules",get:function(){return{block:ee,inline:Ee}}}]),ge}(),we=B.defaults,Le=W.cleanUrl,Ie=W.escape,Ae=function(){function ge(fe){this.options=fe||we}var ce=ge.prototype;return ce.code=function(Y,Z,re){var le=(Z||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(Y,le);Te!=null&&Te!==Y&&(re=!0,Y=Te)}return le?'<pre><code class="'+this.options.langPrefix+Ie(le,!0)+'">'+(re?Y:Ie(Y,!0))+`</code></pre>
`:"<pre><code>"+(re?Y:Ie(Y,!0))+`</code></pre>
`},ce.blockquote=function(Y){return`<blockquote>
`+Y+`</blockquote>
`},ce.html=function(Y){return Y},ce.heading=function(Y,Z,re,le){return this.options.headerIds?"<h"+Z+' id="'+this.options.headerPrefix+le.slug(re)+'">'+Y+"</h"+Z+`>
`:"<h"+Z+">"+Y+"</h"+Z+`>
`},ce.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ce.list=function(Y,Z,re){var le=Z?"ol":"ul",Te=Z&&re!==1?' start="'+re+'"':"";return"<"+le+Te+`>
`+Y+"</"+le+`>
`},ce.listitem=function(Y){return"<li>"+Y+`</li>
`},ce.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ce.paragraph=function(Y){return"<p>"+Y+`</p>
`},ce.table=function(Y,Z){return Z&&(Z="<tbody>"+Z+"</tbody>"),`<table>
<thead>
`+Y+`</thead>
`+Z+`</table>
`},ce.tablerow=function(Y){return`<tr>
`+Y+`</tr>
`},ce.tablecell=function(Y,Z){var re=Z.header?"th":"td",le=Z.align?"<"+re+' align="'+Z.align+'">':"<"+re+">";return le+Y+"</"+re+`>
`},ce.strong=function(Y){return"<strong>"+Y+"</strong>"},ce.em=function(Y){return"<em>"+Y+"</em>"},ce.codespan=function(Y){return"<code>"+Y+"</code>"},ce.br=function(){return this.options.xhtml?"<br/>":"<br>"},ce.del=function(Y){return"<del>"+Y+"</del>"},ce.link=function(Y,Z,re){if(Y=Le(this.options.sanitize,this.options.baseUrl,Y),Y===null)return re;var le='<a href="'+Ie(Y)+'"';return Z&&(le+=' title="'+Z+'"'),le+=">"+re+"</a>",le},ce.image=function(Y,Z,re){if(Y=Le(this.options.sanitize,this.options.baseUrl,Y),Y===null)return re;var le='<img src="'+Y+'" alt="'+re+'"';return Z&&(le+=' title="'+Z+'"'),le+=this.options.xhtml?"/>":">",le},ce.text=function(Y){return Y},ge}(),De=function(){function ge(){}var ce=ge.prototype;return ce.strong=function(Y){return Y},ce.em=function(Y){return Y},ce.codespan=function(Y){return Y},ce.del=function(Y){return Y},ce.html=function(Y){return Y},ce.text=function(Y){return Y},ce.link=function(Y,Z,re){return""+re},ce.image=function(Y,Z,re){return""+re},ce.br=function(){return""},ge}(),We=function(){function ge(){this.seen={}}var ce=ge.prototype;return ce.slug=function(Y){var Z=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Z)){var re=Z;do this.seen[re]++,Z=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},ge}(),Ve=B.defaults,je=W.unescape,Ne=function(){function ge(fe){this.options=fe||Ve,this.options.renderer=this.options.renderer||new Ae,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new De,this.slugger=new We}ge.parse=function(Y,Z){var re=new ge(Z);return re.parse(Y)};var ce=ge.prototype;return ce.parse=function(Y,Z){Z===void 0&&(Z=!0);var re="",le,Te,Re,Me,Ge,it,Pe,ct,at,rt,xt,Et,Rt,At,pt,or,Kt,Nt,Tr=Y.length;for(le=0;le<Tr;le++){rt=Y[le];switch(rt.type){case"space":continue;case"hr":{re+=this.renderer.hr();continue}case"heading":{re+=this.renderer.heading(this.parseInline(rt.tokens),rt.depth,je(this.parseInline(rt.tokens,this.textRenderer)),this.slugger);continue}case"code":{re+=this.renderer.code(rt.text,rt.lang,rt.escaped);continue}case"table":{for(ct="",Pe="",Me=rt.header.length,Te=0;Te<Me;Te++)Pe+=this.renderer.tablecell(this.parseInline(rt.tokens.header[Te]),{header:!0,align:rt.align[Te]});for(ct+=this.renderer.tablerow(Pe),at="",Me=rt.cells.length,Te=0;Te<Me;Te++){for(it=rt.tokens.cells[Te],Pe="",Ge=it.length,Re=0;Re<Ge;Re++)Pe+=this.renderer.tablecell(this.parseInline(it[Re]),{header:!1,align:rt.align[Re]});at+=this.renderer.tablerow(Pe)}re+=this.renderer.table(ct,at);continue}case"blockquote":{at=this.parse(rt.tokens),re+=this.renderer.blockquote(at);continue}case"list":{for(xt=rt.ordered,Et=rt.start,Rt=rt.loose,Me=rt.items.length,at="",Te=0;Te<Me;Te++)pt=rt.items[Te],or=pt.checked,Kt=pt.task,At="",pt.task&&(Nt=this.renderer.checkbox(or),Rt?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=Nt+" "+pt.tokens[0].text,pt.tokens[0].tokens&&pt.tokens[0].tokens.length>0&&pt.tokens[0].tokens[0].type==="text"&&(pt.tokens[0].tokens[0].text=Nt+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:Nt}):At+=Nt),At+=this.parse(pt.tokens,Rt),at+=this.renderer.listitem(At,Kt,or);re+=this.renderer.list(at,xt,Et);continue}case"html":{re+=this.renderer.html(rt.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline(rt.tokens));continue}case"text":{for(at=rt.tokens?this.parseInline(rt.tokens):rt.text;le+1<Tr&&Y[le+1].type==="text";)rt=Y[++le],at+=`
`+(rt.tokens?this.parseInline(rt.tokens):rt.text);re+=Z?this.renderer.paragraph(at):at;continue}default:{var vr='Token with "'+rt.type+'" type was not found.';if(this.options.silent){console.error(vr);return}else throw new Error(vr)}}}return re},ce.parseInline=function(Y,Z){Z=Z||this.renderer;var re="",le,Te,Re=Y.length;for(le=0;le<Re;le++){Te=Y[le];switch(Te.type){case"escape":{re+=Z.text(Te.text);break}case"html":{re+=Z.html(Te.text);break}case"link":{re+=Z.link(Te.href,Te.title,this.parseInline(Te.tokens,Z));break}case"image":{re+=Z.image(Te.href,Te.title,Te.text);break}case"strong":{re+=Z.strong(this.parseInline(Te.tokens,Z));break}case"em":{re+=Z.em(this.parseInline(Te.tokens,Z));break}case"codespan":{re+=Z.codespan(Te.text);break}case"br":{re+=Z.br();break}case"del":{re+=Z.del(this.parseInline(Te.tokens,Z));break}case"text":{re+=Z.text(Te.text);break}default:{var Me='Token with "'+Te.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return re},ge}(),Je=W.merge,Xe=W.checkSanitizeDeprecation,Ze=W.escape,Ce=B.getDefaults,et=B.changeDefaults,Ye=B.defaults;function Oe(ge,ce,fe){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof ce=="function"&&(fe=ce,ce=null),ce=Je({},Oe.defaults,ce||{}),Xe(ce),fe){var Y=ce.highlight,Z;try{Z=ye.lex(ge,ce)}catch(Re){return fe(Re)}var re=function(Me){var Ge;if(!Me)try{Ge=Ne.parse(Z,ce)}catch(it){Me=it}return ce.highlight=Y,Me?fe(Me):fe(null,Ge)};if(!Y||Y.length<3)return re();if(delete ce.highlight,!Z.length)return re();var le=0;Oe.walkTokens(Z,function(Re){Re.type==="code"&&(le++,setTimeout(function(){Y(Re.text,Re.lang,function(Me,Ge){if(Me)return re(Me);Ge!=null&&Ge!==Re.text&&(Re.text=Ge,Re.escaped=!0),le--,le===0&&re()})},0))}),le===0&&re();return}try{var Te=ye.lex(ge,ce);return ce.walkTokens&&Oe.walkTokens(Te,ce.walkTokens),Ne.parse(Te,ce)}catch(Re){if(Re.message+=`
Please report this to https://github.com/markedjs/marked.`,ce.silent)return"<p>An error occurred:</p><pre>"+Ze(Re.message+"",!0)+"</pre>";throw Re}}Oe.options=Oe.setOptions=function(ge){return Je(Oe.defaults,ge),et(Oe.defaults),Oe},Oe.getDefaults=Ce,Oe.defaults=Ye,Oe.use=function(ge){var ce=Je({},ge);if(ge.renderer&&function(){var Y=Oe.defaults.renderer||new Ae,Z=function(Te){var Re=Y[Te];Y[Te]=function(){for(var Me=arguments.length,Ge=new Array(Me),it=0;it<Me;it++)Ge[it]=arguments[it];var Pe=ge.renderer[Te].apply(Y,Ge);return Pe===!1&&(Pe=Re.apply(Y,Ge)),Pe}};for(var re in ge.renderer)Z(re);ce.renderer=Y}(),ge.tokenizer&&function(){var Y=Oe.defaults.tokenizer||new pe,Z=function(Te){var Re=Y[Te];Y[Te]=function(){for(var Me=arguments.length,Ge=new Array(Me),it=0;it<Me;it++)Ge[it]=arguments[it];var Pe=ge.tokenizer[Te].apply(Y,Ge);return Pe===!1&&(Pe=Re.apply(Y,Ge)),Pe}};for(var re in ge.tokenizer)Z(re);ce.tokenizer=Y}(),ge.walkTokens){var fe=Oe.defaults.walkTokens;ce.walkTokens=function(Y){ge.walkTokens(Y),fe&&fe(Y)}}Oe.setOptions(ce)},Oe.walkTokens=function(ge,ce){for(var fe=F(ge),Y;!(Y=fe()).done;){var Z=Y.value;ce(Z);switch(Z.type){case"table":{for(var re=F(Z.tokens.header),le;!(le=re()).done;){var Te=le.value;Oe.walkTokens(Te,ce)}for(var Re=F(Z.tokens.cells),Me;!(Me=Re()).done;)for(var Ge=Me.value,it=F(Ge),Pe;!(Pe=it()).done;){var ct=Pe.value;Oe.walkTokens(ct,ce)}break}case"list":{Oe.walkTokens(Z.items,ce);break}default:Z.tokens&&Oe.walkTokens(Z.tokens,ce)}}},Oe.Parser=Ne,Oe.parser=Ne.parse,Oe.Renderer=Ae,Oe.TextRenderer=De,Oe.Lexer=ye,Oe.lexer=ye.lex,Oe.Tokenizer=pe,Oe.Slugger=We,Oe.parse=Oe;var Ue=Oe;return Ue})},ELLl:function(qe,He,J){(function(q){q(J("VrN/"))})(function(q){var z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=q.Pos;q.defineOption("autoCloseBrackets",!1,function(x,v,d){d&&d!=q.Init&&(x.removeKeyMap(F),x.state.closeBrackets=null),v&&(O(K(v,"pairs")),x.state.closeBrackets=v,x.addKeyMap(F))});function K(x,v){return v=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[v]!=null?x[v]:z[v]}var F={Backspace:R,Enter:S};function O(x){for(var v=0;v<x.length;v++){var d=x.charAt(v),o="'"+d+"'";F[o]||(F[o]=B(d))}}O(z.pairs+"`");function B(x){return function(v){return b(v,x)}}function k(x){var v=x.state.closeBrackets;if(!v||v.override)return v;var d=x.getModeAt(x.getCursor());return d.closeBrackets||v}function R(x){var v=k(x);if(!v||x.getOption("disableInput"))return q.Pass;for(var d=K(v,"pairs"),o=x.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return q.Pass;var s=P(x,o[u].head);if(!s||d.indexOf(s)%2!=0)return q.Pass}for(var u=o.length-1;u>=0;u--){var C=o[u].head;x.replaceRange("",L(C.line,C.ch-1),L(C.line,C.ch+1),"+delete")}}function S(x){var v=k(x),d=v&&K(v,"explode");if(!d||x.getOption("disableInput"))return q.Pass;for(var o=x.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return q.Pass;var s=P(x,o[u].head);if(!s||d.indexOf(s)%2!=0)return q.Pass}x.operation(function(){var C=x.lineSeparator()||`
`;x.replaceSelection(C+C,null),x.execCommand("goCharLeft"),o=x.listSelections();for(var E=0;E<o.length;E++){var f=o[E].head.line;x.indentLine(f,null,!0),x.indentLine(f+1,null,!0)}})}function m(x){var v=q.cmpPos(x.anchor,x.head)>0;return{anchor:new L(x.anchor.line,x.anchor.ch+(v?-1:1)),head:new L(x.head.line,x.head.ch+(v?1:-1))}}function b(x,v){var d=k(x);if(!d||x.getOption("disableInput"))return q.Pass;var o=K(d,"pairs"),u=o.indexOf(v);if(u==-1)return q.Pass;for(var s=K(d,"closeBefore"),C=K(d,"triples"),E=o.charAt(u+1)==v,f=x.listSelections(),A=u%2==0,g,p=0;p<f.length;p++){var c=f[p],l=c.head,a,T=x.getRange(l,L(l.line,l.ch+1));if(A&&!c.empty())a="surround";else if((E||!A)&&T==v)E&&w(x,l)?a="both":C.indexOf(v)>=0&&x.getRange(l,L(l.line,l.ch+3))==v+v+v?a="skipThree":a="skip";else if(E&&l.ch>1&&C.indexOf(v)>=0&&x.getRange(L(l.line,l.ch-2),l)==v+v){if(l.ch>2&&/\bstring/.test(x.getTokenTypeAt(L(l.line,l.ch-2))))return q.Pass;a="addFour"}else if(E){var y=l.ch==0?" ":x.getRange(L(l.line,l.ch-1),l);if(!q.isWordChar(T)&&y!=v&&!q.isWordChar(y))a="both";else return q.Pass}else if(A&&(T.length===0||/\s/.test(T)||s.indexOf(T)>-1))a="both";else return q.Pass;if(!g)g=a;else if(g!=a)return q.Pass}var h=u%2?o.charAt(u-1):v,D=u%2?v:o.charAt(u+1);x.operation(function(){if(g=="skip")x.execCommand("goCharRight");else if(g=="skipThree")for(var U=0;U<3;U++)x.execCommand("goCharRight");else if(g=="surround"){for(var N=x.getSelections(),U=0;U<N.length;U++)N[U]=h+N[U]+D;x.replaceSelections(N,"around"),N=x.listSelections().slice();for(var U=0;U<N.length;U++)N[U]=m(N[U]);x.setSelections(N)}else g=="both"?(x.replaceSelection(h+D,null),x.triggerElectric(h+D),x.execCommand("goCharLeft")):g=="addFour"&&(x.replaceSelection(h+h+h+h,"before"),x.execCommand("goCharRight"))})}function P(x,v){var d=x.getRange(L(v.line,v.ch-1),L(v.line,v.ch+1));return d.length==2?d:null}function w(x,v){var d=x.getTokenAt(L(v.line,v.ch+1));return/\bstring/.test(d.type)&&d.start==v.ch&&(v.ch==0||!/\bstring/.test(x.getTokenTypeAt(v)))}})},GfqC:function(qe,He,J){"use strict";var q=J("cDcd"),z=J.n(q),L=J("TSYQ"),K=J.n(L);function F(W,M){var I="cannot "+W.method+" "+W.action+" "+M.status+"'",H=new Error(I);return H.status=M.status,H.method=W.method,H.url=W.action,H}function O(W){var M=W.responseText||W.response;if(!M)return M;try{return JSON.parse(M)}catch(I){return M}}function B(W){var M=new XMLHttpRequest;W.onProgress&&M.upload&&(M.upload.onprogress=function(te){te.total>0&&(te.percent=te.loaded/te.total*100),W.onProgress(te)});var I=new FormData;W.data&&Object.keys(W.data).forEach(function(X){var te=W.data[X];if(Array.isArray(te)){te.forEach(function(ae){I.append(X+"[]",ae)});return}I.append(X,W.data[X])}),W.file instanceof Blob?I.append(W.filename,W.file,W.file.name):I.append(W.filename,W.file),M.onerror=function(te){W.onError(te)},M.onload=function(){return M.status<200||M.status>=300?W.onError(F(W,M),O(M)):W.onSuccess(O(M),M)},M.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in M&&(M.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&M.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(X){H[X]!==null&&M.setRequestHeader(X,H[X])}),M.send(I),{abort:function(){M.abort()}}}var k=+new Date,R=0;function S(){return"rc-upload-"+k+"-"+ ++R}function m(W,M){return W.indexOf(M,W.length-M.length)!==-1}var b=function(W,M){if(W&&M){var I=Array.isArray(M)?M:M.split(","),H=W.name||"",X=W.type||"",te=X.replace(/\/.*$/,"");return I.some(function(ae){var be=ae.trim();return be.charAt(0)==="."?m(H.toLowerCase(),be.toLowerCase()):/\/\*$/.test(be)?te===be.replace(/\/.*$/,""):X===be})}return!0};function P(W,M){var I=W.createReader(),H=[];function X(){I.readEntries(function(te){var ae=Array.prototype.slice.apply(te);H=H.concat(ae);var be=!ae.length;be?M(H):X()})}X()}var w=function(M,I,H){var X=function te(ae,be){be=be||"",ae.isFile?ae.file(function(pe){H(pe)&&(ae.fullPath&&!pe.webkitRelativePath&&(Object.defineProperties(pe,{webkitRelativePath:{writable:!0}}),pe.webkitRelativePath=ae.fullPath.replace(/^\//,""),Object.defineProperties(pe,{webkitRelativePath:{writable:!1}})),I([pe]))}):ae.isDirectory&&P(ae,function(pe){pe.forEach(function(ue){te(ue,""+be+ae.name+"/")})})};M.forEach(function(te){X(te.webkitGetAsEntry())})},x=w,v=Object.assign||function(W){for(var M=1;M<arguments.length;M++){var I=arguments[M];for(var H in I)Object.prototype.hasOwnProperty.call(I,H)&&(W[H]=I[H])}return W},d=function(){function W(M,I){var H=[],X=!0,te=!1,ae=void 0;try{for(var be=M[Symbol.iterator](),pe;!(X=(pe=be.next()).done)&&!(H.push(pe.value),I&&H.length===I);X=!0);}catch(ue){te=!0,ae=ue}finally{try{!X&&be.return&&be.return()}finally{if(te)throw ae}}return H}return function(M,I){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return W(M,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(M,I){for(var H=0;H<I.length;H++){var X=I[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(M,X.key,X)}}return function(M,I,H){return I&&W(M.prototype,I),H&&W(M,H),M}}();function u(W,M,I){return M in W?Object.defineProperty(W,M,{value:I,enumerable:!0,configurable:!0,writable:!0}):W[M]=I,W}function s(W,M){var I={};for(var H in W){if(M.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;I[H]=W[H]}return I}function C(W,M){if(!(W instanceof M))throw new TypeError("Cannot call a class as a function")}function E(W,M){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:W}function f(W,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);W.prototype=Object.create(M&&M.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(W,M):W.__proto__=M)}var A=function(M){return Object.keys(M).reduce(function(I,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(I[H]=M[H]),I},{})},g=function(W){f(M,W);function M(){var I,H,X,te;C(this,M);for(var ae=arguments.length,be=Array(ae),pe=0;pe<ae;pe++)be[pe]=arguments[pe];return te=(H=(X=E(this,(I=M.__proto__||Object.getPrototypeOf(M)).call.apply(I,[this].concat(be))),X),X.state={uid:S()},X.reqs={},X.onChange=function(ue){var se=ue.target.files;X.uploadFiles(se),X.reset()},X.onClick=function(ue){var se=X.fileInput;if(!se)return;var he=X.props,ne=he.children,me=he.onClick;ne&&ne.type==="button"&&(se.parentNode.focus(),se.parentNode.querySelector("button").blur()),se.click(),me&&me(ue)},X.onKeyDown=function(ue){ue.key==="Enter"&&X.onClick()},X.onFileDrop=function(ue){var se=X.props.multiple;if(ue.preventDefault(),ue.type==="dragover")return;if(X.props.directory)x(Array.prototype.slice.call(ue.dataTransfer.items),X.uploadFiles,function(ne){return b(ne,X.props.accept)});else{var he=Array.prototype.slice.call(ue.dataTransfer.files).filter(function(ne){return b(ne,X.props.accept)});se===!1&&(he=he.slice(0,1)),X.uploadFiles(he)}},X.uploadFiles=function(ue){var se=Array.prototype.slice.call(ue);se.map(function(he){return he.uid=S(),he}).forEach(function(he){X.upload(he,se)})},X.saveFileInput=function(ue){X.fileInput=ue},H),E(X,te)}return o(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,X){var te=this,ae=this.props;if(!ae.beforeUpload)return setTimeout(function(){return te.post(H)},0);var be=ae.beforeUpload(H,X);be&&be.then?be.then(function(pe){var ue=Object.prototype.toString.call(pe);return ue==="[object File]"||ue==="[object Blob]"?te.post(pe):te.post(H)}).catch(function(pe){console.log(pe)}):be!==!1&&setTimeout(function(){return te.post(H)},0);return}},{key:"post",value:function(H){var X=this;if(!this._isMounted)return;var te=this.props,ae=te.onStart,be=te.onProgress,pe=te.transformFile,ue=pe===void 0?function(se){return se}:pe;new Promise(function(se){var he=te.action;return typeof he=="function"&&(he=he(H)),se(he)}).then(function(se){var he=H.uid,ne=te.customRequest||B,me=Promise.resolve(ue(H)).then(function(Q){var ie=te.data;return typeof ie=="function"&&(ie=ie(Q)),Promise.all([Q,ie])}).catch(function(Q){console.error(Q)});me.then(function(Q){var ie=d(Q,2),ee=ie[0],Ee=ie[1],_e={action:se,filename:te.name,data:Ee,file:ee,headers:te.headers,withCredentials:te.withCredentials,method:te.method||"post",onProgress:be?function(ve){be(ve,H)}:null,onSuccess:function(ye,we){delete X.reqs[he],te.onSuccess(ye,H,we)},onError:function(ye,we){delete X.reqs[he],te.onError(ye,we,H)}};ae(H),X.reqs[he]=ne(_e)})})}},{key:"reset",value:function(){this.setState({uid:S()})}},{key:"abort",value:function(H){var X=this.reqs;if(H){var te=H;H&&H.uid&&(te=H.uid),X[te]&&X[te].abort&&X[te].abort(),delete X[te]}else Object.keys(X).forEach(function(ae){X[ae]&&X[ae].abort&&X[ae].abort(),delete X[ae]})}},{key:"render",value:function(){var H,X=this.props,te=X.component,ae=X.prefixCls,be=X.className,pe=X.disabled,ue=X.id,se=X.style,he=X.multiple,ne=X.accept,me=X.children,Q=X.directory,ie=X.openFileDialogOnClick,ee=X.onMouseEnter,Ee=X.onMouseLeave,_e=s(X,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ve=K()((H={},u(H,ae,!0),u(H,ae+"-disabled",pe),u(H,be,be),H)),ye=pe?{}:{onClick:ie?this.onClick:function(){},onKeyDown:ie?this.onKeyDown:function(){},onMouseEnter:ee,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return z.a.createElement(te,v({},ye,{className:ve,role:"button",style:se}),z.a.createElement("input",v({},A(_e),{id:ue,type:"file",ref:this.saveFileInput,onClick:function(Le){return Le.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ne,directory:Q?"directory":null,webkitdirectory:Q?"webkitdirectory":null,multiple:he,onChange:this.onChange})),me)}}]),M}(q.Component),p=g,c=Object.assign||function(W){for(var M=1;M<arguments.length;M++){var I=arguments[M];for(var H in I)Object.prototype.hasOwnProperty.call(I,H)&&(W[H]=I[H])}return W},l=function(){function W(M,I){for(var H=0;H<I.length;H++){var X=I[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(M,X.key,X)}}return function(M,I,H){return I&&W(M.prototype,I),H&&W(M,H),M}}();function a(W,M){if(!(W instanceof M))throw new TypeError("Cannot call a class as a function")}function T(W,M){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:W}function y(W,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);W.prototype=Object.create(M&&M.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(W,M):W.__proto__=M)}function h(){}var D=function(W){y(M,W);function M(){var I,H,X,te;a(this,M);for(var ae=arguments.length,be=Array(ae),pe=0;pe<ae;pe++)be[pe]=arguments[pe];return te=(H=(X=T(this,(I=M.__proto__||Object.getPrototypeOf(M)).call.apply(I,[this].concat(be))),X),X.saveUploader=function(ue){X.uploader=ue},H),T(X,te)}return l(M,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return z.a.createElement(p,c({},this.props,{ref:this.saveUploader}))}}]),M}(q.Component);D.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:h,onError:h,onSuccess:h,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=D,N=He.a=U},H38U:function(qe,He,J){var q=J("f4xo"),z=J("rcnY"),L=J("wU8J"),K=J("Iq15"),F=J("dWSS");function O(k,R){this.typeNumber=k,this.errorCorrectLevel=R,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var B=O.prototype;B.addData=function(k){var R=new q(k);this.dataList.push(R),this.dataCache=null},B.isDark=function(k,R){if(k<0||this.moduleCount<=k||R<0||this.moduleCount<=R)throw new Error(k+","+R);return this.modules[k][R]},B.getModuleCount=function(){return this.moduleCount},B.make=function(){if(this.typeNumber<1){var k=1;for(k=1;k<40;k++){for(var R=z.getRSBlocks(k,this.errorCorrectLevel),S=new L,m=0,b=0;b<R.length;b++)m+=R[b].dataCount;for(var b=0;b<this.dataList.length;b++){var P=this.dataList[b];S.put(P.mode,4),S.put(P.getLength(),K.getLengthInBits(P.mode,k)),P.write(S)}if(S.getLengthInBits()<=m*8)break}this.typeNumber=k}this.makeImpl(!1,this.getBestMaskPattern())},B.makeImpl=function(k,R){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var S=0;S<this.moduleCount;S++){this.modules[S]=new Array(this.moduleCount);for(var m=0;m<this.moduleCount;m++)this.modules[S][m]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(k,R),this.typeNumber>=7&&this.setupTypeNumber(k),this.dataCache==null&&(this.dataCache=O.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,R)},B.setupPositionProbePattern=function(k,R){for(var S=-1;S<=7;S++){if(k+S<=-1||this.moduleCount<=k+S)continue;for(var m=-1;m<=7;m++){if(R+m<=-1||this.moduleCount<=R+m)continue;0<=S&&S<=6&&(m==0||m==6)||0<=m&&m<=6&&(S==0||S==6)||2<=S&&S<=4&&2<=m&&m<=4?this.modules[k+S][R+m]=!0:this.modules[k+S][R+m]=!1}}},B.getBestMaskPattern=function(){for(var k=0,R=0,S=0;S<8;S++){this.makeImpl(!0,S);var m=K.getLostPoint(this);(S==0||k>m)&&(k=m,R=S)}return R},B.createMovieClip=function(k,R,S){var m=k.createEmptyMovieClip(R,S),b=1;this.make();for(var P=0;P<this.modules.length;P++)for(var w=P*b,x=0;x<this.modules[P].length;x++){var v=x*b,d=this.modules[P][x];d&&(m.beginFill(0,100),m.moveTo(v,w),m.lineTo(v+b,w),m.lineTo(v+b,w+b),m.lineTo(v,w+b),m.endFill())}return m},B.setupTimingPattern=function(){for(var k=8;k<this.moduleCount-8;k++){if(this.modules[k][6]!=null)continue;this.modules[k][6]=k%2==0}for(var R=8;R<this.moduleCount-8;R++){if(this.modules[6][R]!=null)continue;this.modules[6][R]=R%2==0}},B.setupPositionAdjustPattern=function(){for(var k=K.getPatternPosition(this.typeNumber),R=0;R<k.length;R++)for(var S=0;S<k.length;S++){var m=k[R],b=k[S];if(this.modules[m][b]!=null)continue;for(var P=-2;P<=2;P++)for(var w=-2;w<=2;w++)P==-2||P==2||w==-2||w==2||P==0&&w==0?this.modules[m+P][b+w]=!0:this.modules[m+P][b+w]=!1}},B.setupTypeNumber=function(k){for(var R=K.getBCHTypeNumber(this.typeNumber),S=0;S<18;S++){var m=!k&&(R>>S&1)==1;this.modules[Math.floor(S/3)][S%3+this.moduleCount-8-3]=m}for(var S=0;S<18;S++){var m=!k&&(R>>S&1)==1;this.modules[S%3+this.moduleCount-8-3][Math.floor(S/3)]=m}},B.setupTypeInfo=function(k,R){for(var S=this.errorCorrectLevel<<3|R,m=K.getBCHTypeInfo(S),b=0;b<15;b++){var P=!k&&(m>>b&1)==1;b<6?this.modules[b][8]=P:b<8?this.modules[b+1][8]=P:this.modules[this.moduleCount-15+b][8]=P}for(var b=0;b<15;b++){var P=!k&&(m>>b&1)==1;b<8?this.modules[8][this.moduleCount-b-1]=P:b<9?this.modules[8][15-b-1+1]=P:this.modules[8][15-b-1]=P}this.modules[this.moduleCount-8][8]=!k},B.mapData=function(k,R){for(var S=-1,m=this.moduleCount-1,b=7,P=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var x=0;x<2;x++)if(this.modules[m][w-x]==null){var v=!1;P<k.length&&(v=(k[P]>>>b&1)==1);var d=K.getMask(R,m,w-x);d&&(v=!v),this.modules[m][w-x]=v,b--,b==-1&&(P++,b=7)}if(m+=S,m<0||this.moduleCount<=m){m-=S,S=-S;break}}},O.PAD0=236,O.PAD1=17,O.createData=function(k,R,S){for(var m=z.getRSBlocks(k,R),b=new L,P=0;P<S.length;P++){var w=S[P];b.put(w.mode,4),b.put(w.getLength(),K.getLengthInBits(w.mode,k)),w.write(b)}for(var x=0,P=0;P<m.length;P++)x+=m[P].dataCount;if(b.getLengthInBits()>x*8)throw new Error("code length overflow. ("+b.getLengthInBits()+">"+x*8+")");for(b.getLengthInBits()+4<=x*8&&b.put(0,4);b.getLengthInBits()%8!=0;)b.putBit(!1);for(;!(b.getLengthInBits()>=x*8);){if(b.put(O.PAD0,8),b.getLengthInBits()>=x*8)break;b.put(O.PAD1,8)}return O.createBytes(b,m)},O.createBytes=function(k,R){for(var S=0,m=0,b=0,P=new Array(R.length),w=new Array(R.length),x=0;x<R.length;x++){var v=R[x].dataCount,d=R[x].totalCount-v;m=Math.max(m,v),b=Math.max(b,d),P[x]=new Array(v);for(var o=0;o<P[x].length;o++)P[x][o]=255&k.buffer[o+S];S+=v;var u=K.getErrorCorrectPolynomial(d),s=new F(P[x],u.getLength()-1),C=s.mod(u);w[x]=new Array(u.getLength()-1);for(var o=0;o<w[x].length;o++){var E=o+C.getLength()-w[x].length;w[x][o]=E>=0?C.get(E):0}}for(var f=0,o=0;o<R.length;o++)f+=R[o].totalCount;for(var A=new Array(f),g=0,o=0;o<m;o++)for(var x=0;x<R.length;x++)o<P[x].length&&(A[g++]=P[x][o]);for(var o=0;o<b;o++)for(var x=0;x<R.length;x++)o<w[x].length&&(A[g++]=w[x][o]);return A},qe.exports=O},HmJG:function(qe,He,J){},Iq15:function(qe,He,J){var q=J("nVVt"),z=J("dWSS"),L=J("dQei"),K={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},F={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(O){for(var B=O<<10;F.getBCHDigit(B)-F.getBCHDigit(F.G15)>=0;)B^=F.G15<<F.getBCHDigit(B)-F.getBCHDigit(F.G15);return(O<<10|B)^F.G15_MASK},getBCHTypeNumber:function(O){for(var B=O<<12;F.getBCHDigit(B)-F.getBCHDigit(F.G18)>=0;)B^=F.G18<<F.getBCHDigit(B)-F.getBCHDigit(F.G18);return O<<12|B},getBCHDigit:function(O){for(var B=0;O!=0;)B++,O>>>=1;return B},getPatternPosition:function(O){return F.PATTERN_POSITION_TABLE[O-1]},getMask:function(O,B,k){switch(O){case K.PATTERN000:return(B+k)%2==0;case K.PATTERN001:return B%2==0;case K.PATTERN010:return k%3==0;case K.PATTERN011:return(B+k)%3==0;case K.PATTERN100:return(Math.floor(B/2)+Math.floor(k/3))%2==0;case K.PATTERN101:return B*k%2+B*k%3==0;case K.PATTERN110:return(B*k%2+B*k%3)%2==0;case K.PATTERN111:return(B*k%3+(B+k)%2)%2==0;default:throw new Error("bad maskPattern:"+O)}},getErrorCorrectPolynomial:function(O){for(var B=new z([1],0),k=0;k<O;k++)B=B.multiply(new z([1,L.gexp(k)],0));return B},getLengthInBits:function(O,B){if(1<=B&&B<10)switch(O){case q.MODE_NUMBER:return 10;case q.MODE_ALPHA_NUM:return 9;case q.MODE_8BIT_BYTE:return 8;case q.MODE_KANJI:return 8;default:throw new Error("mode:"+O)}else if(B<27)switch(O){case q.MODE_NUMBER:return 12;case q.MODE_ALPHA_NUM:return 11;case q.MODE_8BIT_BYTE:return 16;case q.MODE_KANJI:return 10;default:throw new Error("mode:"+O)}else if(B<41)switch(O){case q.MODE_NUMBER:return 14;case q.MODE_ALPHA_NUM:return 13;case q.MODE_8BIT_BYTE:return 16;case q.MODE_KANJI:return 12;default:throw new Error("mode:"+O)}else throw new Error("type:"+B)},getLostPoint:function(O){for(var B=O.getModuleCount(),k=0,R=0;R<B;R++)for(var S=0;S<B;S++){for(var m=0,b=O.isDark(R,S),P=-1;P<=1;P++){if(R+P<0||B<=R+P)continue;for(var w=-1;w<=1;w++){if(S+w<0||B<=S+w)continue;if(P==0&&w==0)continue;b==O.isDark(R+P,S+w)&&m++}}m>5&&(k+=3+m-5)}for(var R=0;R<B-1;R++)for(var S=0;S<B-1;S++){var x=0;O.isDark(R,S)&&x++,O.isDark(R+1,S)&&x++,O.isDark(R,S+1)&&x++,O.isDark(R+1,S+1)&&x++,(x==0||x==4)&&(k+=3)}for(var R=0;R<B;R++)for(var S=0;S<B-6;S++)O.isDark(R,S)&&!O.isDark(R,S+1)&&O.isDark(R,S+2)&&O.isDark(R,S+3)&&O.isDark(R,S+4)&&!O.isDark(R,S+5)&&O.isDark(R,S+6)&&(k+=40);for(var S=0;S<B;S++)for(var R=0;R<B-6;R++)O.isDark(R,S)&&!O.isDark(R+1,S)&&O.isDark(R+2,S)&&O.isDark(R+3,S)&&O.isDark(R+4,S)&&!O.isDark(R+5,S)&&O.isDark(R+6,S)&&(k+=40);for(var v=0,S=0;S<B;S++)for(var R=0;R<B;R++)O.isDark(R,S)&&v++;var d=Math.abs(100*v/B/B-50)/5;return k+=d*10,k}};qe.exports=F},LdHM:function(qe,He,J){"use strict";J.d(He,"b",function(){return s}),J.d(He,"a",function(){return E});var q=J("1OyB"),z=J("vuIU"),L=J("Ji7U"),K=J("LK+K"),F=J("cDcd"),O=J("rePB"),B=J("Ff2n"),k=J("ODXe"),R=J("4IlW"),S=J("bX4T"),m=J("YrtM"),b=J("TSYQ"),P=J.n(b),w=J("+nKL"),x=J("8OUc"),v=function(H,X){var te=H.prefixCls,ae=H.id,be=H.flattenOptions,pe=H.childrenAsData,ue=H.values,se=H.searchValue,he=H.multiple,ne=H.defaultActiveFirstOption,me=H.height,Q=H.itemHeight,ie=H.notFoundContent,ee=H.open,Ee=H.menuItemSelectedIcon,_e=H.virtual,ve=H.onSelect,ye=H.onToggleOpen,we=H.onActiveValue,Le=H.onScroll,Ie=H.onMouseEnter,Ae="".concat(te,"-item"),De=Object(m.a)(function(){return be},[ee,be],function(Ue,ge){return ge[0]&&Ue[1]!==ge[1]}),We=F.useRef(null),Ve=function(ge){ge.preventDefault()},je=function(ge){We.current&&We.current.scrollTo({index:ge})},Ne=function(ge){for(var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,fe=De.length,Y=0;Y<fe;Y+=1){var Z=(ge+Y*ce+fe)%fe,re=De[Z],le=re.group,Te=re.data;if(!le&&!Te.disabled)return Z}return-1},Je=F.useState(function(){return Ne(0)}),Xe=Object(k.a)(Je,2),Ze=Xe[0],Ce=Xe[1],et=function(ge){Ce(ge);var ce=De[ge];if(!ce){we(null,-1);return}we(ce.data.value,ge)};F.useEffect(function(){et(ne!==!1?Ne(0):-1)},[De.length,se]),F.useEffect(function(){var Ue=setTimeout(function(){if(!he&&ee&&ue.size===1){var ge=Array.from(ue)[0],ce=De.findIndex(function(fe){var Y=fe.data;return Y.value===ge});et(ce),je(ce)}});return function(){return clearTimeout(Ue)}},[ee]);var Ye=function(ge){ge!==void 0&&ve(ge,{selected:!ue.has(ge)}),he||ye(!1)};if(F.useImperativeHandle(X,function(){return{onKeyDown:function(ge){var ce=ge.which;switch(ce){case R.a.UP:case R.a.DOWN:{var fe=0;if(ce===R.a.UP?fe=-1:ce===R.a.DOWN&&(fe=1),fe!==0){var Y=Ne(Ze+fe,fe);je(Y),et(Y)}break}case R.a.ENTER:{var Z=De[Ze];Z&&!Z.data.disabled?Ye(Z.data.value):Ye(void 0),ee&&ge.preventDefault();break}case R.a.ESC:ye(!1)}},onKeyUp:function(){},scrollTo:function(ge){je(ge)}}}),De.length===0)return F.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),className:"".concat(Ae,"-empty"),onMouseDown:Ve},ie);function Oe(Ue){var ge=De[Ue];if(!ge)return null;var ce=ge.data||{},fe=ce.value,Y=ce.label,Z=ce.children,re=Object(S.a)(ce,!0),le=pe?Z:Y;return ge?F.createElement("div",Object.assign({"aria-label":typeof le=="string"?le:null},re,{key:Ue,role:"option",id:"".concat(ae,"_list_").concat(Ue),"aria-selected":ue.has(fe)}),fe):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),style:{height:0,width:0,overflow:"hidden"}},Oe(Ze-1),Oe(Ze),Oe(Ze+1)),F.createElement(w.a,{itemKey:"key",ref:We,data:De,height:me,itemHeight:Q,fullHeight:!1,onMouseDown:Ve,onScroll:Le,virtual:_e,onMouseEnter:Ie},function(Ue,ge){var ce,fe=Ue.group,Y=Ue.groupOption,Z=Ue.data,re=Z.label,le=Z.key;if(fe)return F.createElement("div",{className:P()(Ae,"".concat(Ae,"-group"))},re!==void 0?re:le);var Te=Z.disabled,Re=Z.value,Me=Z.title,Ge=Z.children,it=Z.style,Pe=Z.className,ct=Object(B.a)(Z,["disabled","value","title","children","style","className"]),at=ue.has(Re),rt="".concat(Ae,"-option"),xt=P()(Ae,rt,Pe,(ce={},Object(O.a)(ce,"".concat(rt,"-grouped"),Y),Object(O.a)(ce,"".concat(rt,"-active"),Ze===ge&&!Te),Object(O.a)(ce,"".concat(rt,"-disabled"),Te),Object(O.a)(ce,"".concat(rt,"-selected"),at),ce)),Et=pe?Ge:re,Rt=!Ee||typeof Ee=="function"||at;return F.createElement("div",Object.assign({},ct,{"aria-selected":at,className:xt,title:Me,onMouseMove:function(){if(Ze===ge||Te)return;et(ge)},onClick:function(){Te||Ye(Re)},style:it}),F.createElement("div",{className:"".concat(rt,"-content")},Et||Re),F.isValidElement(Ee)||at,Rt&&F.createElement(x.a,{className:"".concat(Ae,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:at}},at?"\u2713":null))}))},d=F.forwardRef(v);d.displayName="OptionList";var o=d,u=function(){return null};u.isSelectOption=!0;var s=u,C=function(){return null};C.isSelectOptGroup=!0;var E=C,f=J("VTBJ"),A=J("Zm9Q");function g(I){var H=I.key,X=I.props,te=X.children,ae=X.value,be=Object(B.a)(X,["children","value"]);return Object(f.a)({key:H,value:ae!==void 0?ae:H,children:te},be)}function p(I){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(I).map(function(X,te){if(!F.isValidElement(X)||!X.type)return null;var ae=X.type.isSelectOptGroup,be=X.key,pe=X.props,ue=pe.children,se=Object(B.a)(pe,["children"]);return H||!ae?g(X):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(be===null?te:be,"__"),label:be},se),{},{options:p(ue)})}).filter(function(X){return X})}var c=J("2Qr1"),l=J("qNPg"),a=J("U8pU"),T=J("Kwbf"),y=J("WKfj");function h(I){var H=I.mode,X=I.options,te=I.children,ae=I.backfill,be=I.allowClear,pe=I.placeholder,ue=I.getInputElement,se=I.showSearch,he=I.onSearch,ne=I.defaultOpen,me=I.autoFocus,Q=I.labelInValue,ie=I.value,ee=I.inputValue,Ee=I.optionLabelProp,_e=H==="multiple"||H==="tags",ve=se!==void 0?se:_e||H==="combobox",ye=X||p(te);if(Object(T.a)(H!=="tags"||ye.every(function(Ae){return!Ae.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var we=ye.some(function(Ae){return Ae.options?Ae.options.some(function(De){return typeof("value"in De?De.value:De.key)=="number"}):typeof("value"in Ae?Ae.value:Ae.key)=="number"});Object(T.a)(!we,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(T.a)(H!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(T.a)(H==="combobox"||!ae,"`backfill` only works with `combobox` mode."),Object(T.a)(H==="combobox"||!ue,"`getInputElement` only work with `combobox` mode."),Object(T.b)(H!=="combobox"||!ue||!be||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),he&&!ve&&H!=="combobox"&&H!=="tags"&&Object(T.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(T.b)(!ne||me,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ie!=null){var Le=Object(y.d)(ie);Object(T.a)(!Q||Le.every(function(Ae){return Object(a.a)(Ae)==="object"&&("key"in Ae||"value"in Ae)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(T.a)(!_e||Array.isArray(ie),"`value` should be array when `mode` is `multiple` or `tags`")}if(te){var Ie=null;Object(A.a)(te).some(function(Ae){if(!F.isValidElement(Ae)||!Ae.type)return!1;var De=Ae.type;if(De.isSelectOption)return!1;if(De.isSelectOptGroup){var We=Object(A.a)(Ae.props.children).every(function(Ve){return!F.isValidElement(Ve)||!Ae.type||Ve.type.isSelectOption?!0:(Ie=Ve.type,!1)});return!We}return Ie=De,!0}),Ie&&Object(T.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ie.displayName||Ie.name||Ie,"`.")),Object(T.a)(ee===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var D=h,U=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:p,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:D,fillOptionsWithMissingValue:c.a}),N=function(I){Object(L.a)(X,I);var H=Object(K.a)(X);function X(){var te;return Object(q.a)(this,X),te=H.apply(this,arguments),te.selectRef=F.createRef(),te.focus=function(){te.selectRef.current.focus()},te.blur=function(){te.selectRef.current.blur()},te}return Object(z.a)(X,[{key:"render",value:function(){return F.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),X}(F.Component);N.Option=s,N.OptGroup=E;var W=N,M=He.c=W},M8RZ:function(qe,He,J){"use strict";J.d(He,"a",function(){return R});var q=J("fWQN"),z=J("mtLc"),L=J("yKVA"),K=J("879j"),F=J("cDcd"),O=J.n(F),B=J("faye"),k=J.n(B),R=function(S){Object(L.a)(b,S);var m=Object(K.a)(b);function b(P){var w;Object(q.a)(this,b),w=m.call(this,P);var x=window.document;return w.node=x.createElement("div"),x.body.appendChild(w.node),w}return Object(z.a)(b,[{key:"render",value:function(){var w=this.props.children;return Object(B.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),b}(O.a.Component)},Ot1p:function(qe,He,J){"use strict";var q=J("2qtc"),z=J("kLXV"),L=J("rAM+"),K=J("miYZ"),F=J("tsqr"),O=J("9og8"),B=J("tJVT"),k=J("jrin"),R=J("WmNS"),S=J.n(R),m=J("cDcd"),b=J.n(m),P=J("VrN/"),w=J.n(P),x=J("bdgK"),v=J("p77/"),d=J("Bd2K"),o=J("ELLl"),u=J("19Vz"),s=J("lZu9"),C=J("+NIl"),E=J("kSUc"),f=J("9Bee"),A=function(Pe){var ct=Pe.value,at=ct===void 0?"":ct,rt=Pe.className,xt=Pe.showTextOnly,Et=Pe.showLines,Rt=Pe.style,At=Rt===void 0?{}:Rt,pt=Object(m.useMemo)(function(){return""},[at]);return b.a.createElement(b.a.Fragment,null,b.a.createElement("div",{dangerouslySetInnerHTML:{__html:pt}}))},g=J("Q9mQ"),p=J("diRs"),c=J("0Owb"),l=J("dejd"),a=J("C+DQ"),T=J("D1Df"),y=J.n(T),h=J("1vsH"),D=J("m3rI"),U=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function N(Pe){var ct=Pe.onActionCallback,at=Pe.title,rt=Pe.icon,xt=Pe.actionName,Et=Pe.className,Rt=Et===void 0?"":Et,At=Pe.children;function pt(){ct(xt)}return b.a.createElement("a",{title:at,className:Rt,onClick:pt},b.a.createElement("i",{className:"md-iconfont ".concat(rt)}),At)}var W=function(Pe){var ct=Pe.watch,at=Pe.showNullButton,rt=Pe.onActionCallback,xt=Pe.fullScreen,Et=Pe.insertTemp,Rt=Pe.hidetoolBar,At=Pe.uuid,pt=Pe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(h.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(h.G)("_educoder_session"),"&key=").concat(At,"&api=").concat(encodeURIComponent(D.a.PROXY_SERVER)));var or=[].concat(U,[{title:"".concat(ct?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ct?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return b.a.createElement("ul",{className:"markdown-toolbar-container"},!Rt&&or.map(function(Kt,Nt){return b.a.createElement("li",{key:Nt},Kt.actionName?b.a.createElement(N,Object(c.a)({},Kt,{onActionCallback:rt})):b.a.createElement("span",{className:"v-line"}))}),at?b.a.createElement("li",null,b.a.createElement(N,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:rt},b.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Et&&b.a.createElement("li",null,b.a.createElement(N,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Et),onActionCallback:rt},b.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),b.a.createElement("li",null,b.a.createElement(p.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:b.a.createElement("div",null,b.a.createElement(y.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(h.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(h.G)("_educoder_session"),"&key=").concat(At,"&api=").concat(encodeURIComponent(D.a.PROXY_SERVER))}))},b.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return pt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),b.a.createElement("li",{className:"btn-full-screen"},b.a.createElement(N,{icon:"".concat(xt?"icon-shrink":"icon-enlarge"),title:xt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:rt})))},M=J("M8RZ"),I=J("+L6B"),H=J("2/Rp"),X=J("y8nQ"),te=J("Vl3Y"),ae=J("5NDa"),be=J("5rEg"),pe={labelCol:{span:4},wrapperCol:{span:20}},ue=function(Pe){var ct=Pe.callback,at=Pe.onCancel;function rt(xt){ct(xt)}return b.a.createElement(te.a,Object(c.a)({},pe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:rt}),b.a.createElement(te.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},b.a.createElement(be.a,null)),b.a.createElement(te.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},b.a.createElement(be.a,null)),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(H.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},se=J("7ahc"),he=J("k1fw"),ne=J("HmJG"),me=J("BjJ7"),Q=te.a.useForm,ie={width:280,marginRight:10},ee={labelCol:{span:5},wrapperCol:{span:19}},Ee=function(Pe){var ct=Pe.callback,at=Pe.onCancel,rt=Q(),xt=Object(B.a)(rt,1),Et=xt[0],Rt=useRef();function At(Kt){ct(Object(he.a)(Object(he.a)({},Kt),{},{name:Rt.current}))}function pt(Kt,Nt){if(Kt.status===-1){F.b.error(Kt.message);return}Et.setFieldsValue({src:"/api/attachments/".concat(Kt.id),type:Nt.type})}function or(Kt){var Nt=Kt.target.files[0];Rt.current=Nt.name,ve(Nt,pt)}return b.a.createElement(te.a,Object(c.a)({form:Et},ee,{className:"upload-image-panel",onFinish:At}),b.a.createElement(te.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},b.a.createElement("div",{className:"flex-container"},b.a.createElement(te.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},b.a.createElement(be.a,{style:ie})),b.a.createElement(_e,{onFileChange:or}))),b.a.createElement(te.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},b.a.createElement(be.a,{style:{width:264}})),b.a.createElement(te.a.Item,{style:{textAlign:"right"}},b.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(H.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))};function _e(Pe){var ct=Pe.onFileChange;return b.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",b.a.createElement("input",{type:"file",onChange:ct}))}function ve(Pe,ct){if(!Pe)throw new String("\u6CA1\u6709\u6587\u4EF6");var at=new FormData;at.append("editormd-image-file",Pe),at.append("file_param_name","editormd-image-file"),at.append("byxhr","true");var rt=new window.XMLHttpRequest;rt.withCredentials=!0,rt.addEventListener("load",function(xt){ct(JSON.parse(xt.target.responseText),Pe)},!1),rt.addEventListener("error",function(xt){console.error(xt)},!1),rt.open("POST","".concat(me.a,"/api/attachments.json")),rt.send(at)}var ye=J("giR+"),we=J("fyUT"),Le=J("7Kak"),Ie=J("9yH6"),Ae=Ie.a.Group,De={margin:"0 8px"},We=function(Pe){var ct=Pe.callback,at=Pe.onCancel;function rt(xt){ct(xt)}return b.a.createElement(te.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:rt},b.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},b.a.createElement("span",{style:De},"\u5355\u5143\u683C\u6570\uFF1A"),b.a.createElement("span",{style:De},"\u884C\u6570"),b.a.createElement(te.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},b.a.createElement(we.a,null)),b.a.createElement("span",{style:De},"\u5217\u6570"),b.a.createElement(te.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},b.a.createElement(we.a,null))),b.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},b.a.createElement("span",{style:De},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),b.a.createElement(te.a.Item,{name:"align"},b.a.createElement(Ae,null,b.a.createElement(Ie.a,{value:"default"},b.a.createElement("i",{className:"fa fa-align-justify"})),b.a.createElement(Ie.a,{value:"left"},b.a.createElement("i",{className:"fa fa-align-left"})),b.a.createElement(Ie.a,{value:"center"},b.a.createElement("i",{className:"fa fa-align-center"})),b.a.createElement(Ie.a,{value:"right"},b.a.createElement("i",{className:"fa fa-align-right"}))))),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(H.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},Ve=J("ErOA"),je=J("7Cbv"),Ne="link",Je="upload-image",Xe="code-block",Ze="add-table",Ce="------------",et={default:Ce,left:":".concat(Ce),center:":".concat(Ce,":"),right:"".concat(Ce,":")},Ye=J("9VGf"),Oe,Ue;function ge(){}var ce=0,fe=1e4,Y="\u2581",Z=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function re(Pe){return/^\d+$/.test(Pe)?"".concat(Pe,"px"):Pe}var le=navigator.platform.toUpperCase().indexOf("MAC")>=0,Te=le?"Cmd":"Ctrl",Re=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],Me=(Oe={},Object(k.a)(Oe,Te+"-B","bold"),Object(k.a)(Oe,Te+"-I","italic"),Oe),Ge=(Ue={},Object(k.a)(Ue,Ne,"\u6DFB\u52A0\u94FE\u63A5"),Object(k.a)(Ue,Xe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(k.a)(Ue,Je,"\u6DFB\u52A0\u6587\u4EF6"),Object(k.a)(Ue,Ze,"\u6DFB\u52A0\u8868\u683C"),Ue),it=He.a=function(Pe){var ct=Pe.defaultValue,at=ct===void 0?"":ct,rt=Pe.onChange,xt=Pe.width,Et=xt===void 0?"100%":xt,Rt=Pe.height,At=Rt===void 0?400:Rt,pt=Pe.miniToolbar,or=pt===void 0?!1:pt,Kt=Pe.isFocus,Nt=Kt===void 0?!1:Kt,Tr=Pe.watch,vr=Pe.insertTemp,wi=Pe.mode,mr=wi===void 0?"markdown":wi,vn=Pe.id,Jr=vn===void 0?"markdown-editor-id":vn,Mt=Pe.showResizeBar,st=Mt===void 0?!1:Mt,Sr=Pe.noStorage,Vn=Sr===void 0?!1:Sr,cr=Pe.showNullButton,St=cr===void 0?!1:cr,wr=Pe.hidetoolBar,Zr=wr===void 0?!1:wr,yn=Pe.fullScreen,Be=yn===void 0?!1:yn,ft=Pe.onBlur,qr=Pe.onCMBeforeChange,en=Pe.onFullScreen,tn=Pe.className,bn=tn===void 0?"":tn,Xn=Pe.disablePaste,mt=Xn===void 0?!1:Xn,_i=Pe.placeholder,Ci=_i===void 0?"":_i,rn=Pe.values,sr=rn===void 0?"":rn,Ai=Object(m.useState)(null),Yn=Object(B.a)(Ai,2),Ke=Yn[0],$n=Yn[1],Li=Object(m.useState)(at),En=Object(B.a)(Li,2),nn=En[0],Ur=En[1],Di=Object(m.useState)(Tr),Qn=Object(B.a)(Di,2),Dr=Qn[0],Oi=Qn[1],Ri=Object(m.useState)(Be),pr=Object(B.a)(Ri,2),_r=pr[0],Pi=pr[1],xn=Object(m.useState)(""),Fr=Object(B.a)(xn,2),Nr=Fr[0],Br=Fr[1],aa=Object(m.useState)(0),Mi=Object(B.a)(aa,2),Or=Mi[0],Tn=Mi[1],oa=Object(m.useState)(At),Jn=Object(B.a)(oa,2),Zn=Jn[0],an=Jn[1],Sn=Object(m.useState)(!1),wn=Object(B.a)(Sn,2),sa=wn[0],_n=wn[1],on=Object(m.useRef)(Object(je.a)()),ki=Object(m.useRef)(!1),qn=Object(m.useRef)(),$t=Object(m.useRef)(),jr=Object(m.useRef)(),Cn=Object(m.useRef)(),Wr=Object(m.useRef)(),Ii=function(){var ot=Object(O.a)(S.a.mark(function ht(){var ut,vt;return S.a.wrap(function(Dt){for(;;)switch(Dt.prev=Dt.next){case 0:return Dt.next=2,Object(Ve.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:on.current}});case 2:vt=Dt.sent,vt!=null&&(ut=vt.attachments)!==null&&ut!==void 0&&ut.length&&(console.log("cm:",Ke,$t),vt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?Ke.replaceSelection("![,](/api/attachments/".concat(yt.id,"?type=").concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?Ke.replaceSelection('<video width="100%" controls src="'.concat(D.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):yt.content_type.indexOf("pdf")>-1?Ke.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,'&disposition=inline" target="_blank">').concat(yt.name,"</a>")):Ke.replaceSelection("[".concat(yt.name,"](").concat(D.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return Dt.stop()}},ht)}));return function(){return ot.apply(this,arguments)}}();Object(m.useEffect)(function(){Ur(sr),Ke==null||Ke.setValue(sr)},[sr]),Object(m.useEffect)(function(){en==null||en(_r)},[_r]),Object(m.useEffect)(function(){if($t.current){var ot=w.a.fromTextArea($t.current,{mode:mr,lineNumbers:!or,lineWrapping:!0,value:at,autoCloseTags:!0,autoCloseBrackets:!0});Nt&&ot.focus();function ht(ut,vt){if(mt){vt.preventDefault();return}var Tt=vt.clipboardData;if(Tt){var Dt=Tt.types.toString(),yt=Tt.items;if(Dt==="Files"||Tt.types.indexOf("Files")>-1){if(vt.preventDefault(),mr=="stex")return;try{var It,Wt=yt[1];((It=yt[0])===null||It===void 0?void 0:It.kind)==="file"&&(Wt=yt[0]);var bt=Wt.getAsFile(),Pr=bt.name.split(".").pop();ve(bt,function(_t){if(_t.id){var Zt,Lt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?ot.replaceSelection("![,](/api/attachments/".concat(_t.id,"?type=").concat(_t.content_type,")")):(bt==null||((Lt=bt.type)===null||Lt===void 0)?void 0:Lt.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(D.a.API_SERVER,"/api/attachments/").concat(_t.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(_t.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Re.includes(Pr)?ot.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(_t.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):ot.replaceSelection("[".concat(bt.name,"](").concat(D.a.API_SERVER,"/api/attachments/").concat(_t.id,"?type=").concat(_t.content_type,")"))}else(_t==null?void 0:_t.status)===401&&(document.location.href="/user/login")})}catch(_t){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ot.on("paste",ht),ot.on("dragleave",function(ut,vt){jr.current.classList.remove("mouse-hover-md")}),ot.on("dragover",function(ut,vt){jr.current.classList.add("mouse-hover-md")}),ot.on("drop",function(ut,vt){jr.current.classList.add("mouse-hover-md");var Tt;if(Tt=vt.dataTransfer.files,Tt.length>0){vt.preventDefault(),vt.stopPropagation();for(var Dt=function(Wt){var bt=Tt[Wt],Pr=bt.name.split(".").pop();ve(bt,function(_t){if(_t.id){var Zt,Lt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?ot.replaceSelection("![,](/api/attachments/".concat(_t.id,"?type=").concat(_t.content_type,")")):(bt==null||((Lt=bt.type)===null||Lt===void 0)?void 0:Lt.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(D.a.API_SERVER,"/api/attachments/").concat(_t.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(_t.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Re.includes(Pr)?ot.replaceSelection('<a href="'.concat(D.a.API_SERVER,"/api/attachments/").concat(_t.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):ot.replaceSelection("[".concat(bt.name,"](").concat(D.a.API_SERVER,"/api/attachments/").concat(_t.id,"?type=").concat(_t.content_type,")"))}else(_t==null?void 0:_t.status)===401&&(document.location.href="/user/login")})},yt=0;yt<Tt.length;yt++)Dt(yt)}}),$n(ot),function(){ot.off("paste",ht)}}},[]);var yr=Object(m.useCallback)(function(){if(jr.current)try{}catch(ot){console.log(ot,"---- to set md editor body height")}},[Zn,jr,_r]);Object(m.useEffect)(function(){function ot(){var ut=new x.default(function(vt){var Tt=Object(L.a)(vt),Dt;try{for(Tt.s();!(Dt=Tt.n()).done;){var yt=Dt.value;(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&(yr(),Ke.setSize("100%","100%"),Ke.refresh())}}catch(It){Tt.e(It)}finally{Tt.f()}});return ut.observe($t.current.parentElement),ut}if(Ke){var ht=ot();return function(){ht.unobserve($t.current.parentElement)}}},[Ke,yr]),Object(m.useEffect)(function(){if(Ke){for(var ot=[],ht=function(){var yt=vt[ut];Tt=Object(B.a)(yt,2);var It=Tt[0],Wt=Tt[1],bt=Object(k.a)({},It,function(){An(Wt)});ot.push(bt),Ke.addKeyMap(bt)},ut=0,vt=Object.entries(Me);ut<vt.length;ut++){var Tt;ht()}return qn.current=setInterval(function(){ki.current&&Ii()},4e3),function(){clearInterval(qn.current);var Dt=Object(L.a)(ot),yt;try{for(Dt.s();!(yt=Dt.n()).done;){var It=yt.value;Ke.removeKeyMap(It)}}catch(Wt){Dt.e(Wt)}finally{Dt.f()}}}},[Ke]),Object(m.useEffect)(function(){Be!==_r&&Pi(Be)},[Be]),Object(Ye.a)(function(){if(!Vn&&Or>0){var ot=new Date().getTime(),ht=window.sessionStorage.getItem(Jr);ot>=Or+fe&&(!ht||ht!==nn)&&(window.sessionStorage.setItem(Jr,nn),_n(!0))}},fe),Object(m.useEffect)(function(){Oi(Tr)},[Ke,Tr]),Object(m.useEffect)(function(){Ke&&(Nt&&Ke.focus())},[Ke,Nt]),Object(m.useEffect)(function(){if(Dr&&Ke){var ot=Ke.getScrollerElement();function ht(ut){var vt=ut.target;if(Wr.current){var Tt=vt.scrollTop/vt.scrollHeight;Wr.current.scrollTop=Wr.current.scrollHeight*Tt}}return ot.addEventListener("scroll",ht),function(){ot.removeEventListener("scroll",ht)}}},[Ke,Dr]),Object(m.useEffect)(function(){if(Ke&&qr){function ot(ht,ut){qr(ht,ut)}return Ke.on("beforeChange",ot),function(){Ke.off("beforeChange",ot)}}},[Ke,qr]),Object(m.useEffect)(function(){if(Ke&&ft){function ot(){ft(Ke.getValue())}return Ke.on("blur",ot),function(){Ke.off("blur",ot)}}},[Ke,ft]),Object(m.useEffect)(function(){if(Ke){function ot(ht){var ut=ht.getValue();Ur(ut),Tn(new Date().getTime()),ht.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),rt&&rt(ut)}return Ke.on("change",ot),function(){Ke.off("change",ot)}}},[Ke,rt]),Object(m.useEffect)(function(){Ke&&(at==null?(Ke.setValue(""),Ur("")):at!==Ke.getValue()&&(Ke.setValue(at),Ur(at),Ke.setCursor(Ke.lineCount(),0)))},[Ke,at]);var An=Object(m.useCallback)(function(ot){var ht=Ke.getCursor(),ut=Ke.getSelection(),vt=ut.split(`
`);switch(ot){case"bold":return Ke.replaceSelection("**"+ut+"**"),ut===""&&Ke.setCursor(ht.line,ht.ch+2),Ke.focus();case"italic":return Ke.replaceSelection("*"+ut+"*"),ut===""&&Ke.setCursor(ht.line,ht.ch+1),Ke.focus();case"code":return Ke.replaceSelection("`"+ut+"`"),ut===""&&Ke.setCursor(ht.line,ht.ch+1),Ke.focus();case"inline-latex":return Ke.replaceSelection("`$$"+ut+"$$`"),ut===""&&Ke.setCursor(ht.line,ht.ch+3),Ke.focus();case"latex":return Ke.replaceSelection("```latex\n"+ut+"\n```"),Ke.setCursor(ht.line+1,ut.length+1),Ke.focus();case"line-break":return Ke.replaceSelection(`<br/>
`),Ke.focus();case"list-ul":return ut===""?Ke.replaceSelection("- "+ut):Ke.replaceSelection(vt.map(function(Tt){return Tt===""?"":"- ".concat(Tt)}).join(`
`)),Ke.focus();case"list-ol":return ut===""?Ke.replaceSelection("1. "+ut):Ke.replaceSelection(vt.map(function(Tt,Dt){return Tt===""?"":"".concat(Dt+1,". ").concat(Tt)}).join(`
`)),Ke.focus();case"add-null-ch":return ut===""&&Ke.setCursor(ht.line,ht.ch+1),Ke.replaceSelection(Y),Ke.focus();case"inster-template-1":return ut===""&&Ke.setCursor(ht.line,ht.ch),Ke.replaceSelection(Z),Ke.focus();case"eraser":return Ke.setValue(""),Ke.focus();case"trigger-watch":return Oi(!Dr),Ke.focus();case"trigger-full-screen":return Pi(!_r),Ke.focus();case Ne:Br(Ne);return;case Xe:Br(Xe);return;case Je:Br(Je);return;case Ze:Br(Ze);return;default:throw new Error}},[Ke,Dr,_r]),lr=Object(m.useCallback)(function(ot){Br("");switch(Nr){case Ne:var ht=ot.title,ut=ot.link;return Ke.replaceSelection("[".concat(ht,"](").concat(ut,")")),Ke.focus();case Xe:var vt=ot.language,Tt=ot.content;return Ke.replaceSelection(["```"+vt,Tt,"```"].join(`
`)),Ke.focus();case Je:var Dt=ot.src,yt=ot.alt;return yt?Ke.replaceSelection("![ ".concat(yt," ]( ").concat(Dt,' "').concat(yt,'" )')):Ke.replaceSelection("![,](".concat(Dt,")")),Ke.focus();case Ze:for(var It=ot.row,Wt=ot.col,bt=ot.align,Pr=`
`,_t=0;_t<It;_t++){for(var Zt=[],Lt=[],gr=0;gr<Wt;gr++)_t===1&&Lt.push(et[bt]),Zt.push(" ");_t===1&&(Pr+="| ".concat(Lt.join(" | "),` |
`)),Pr+="| ".concat(Zt.join(Wt===1?"":" | "),` |
`)}return Ke.replaceSelection(Pr+`
`),Ke.focus();default:throw new Error}},[Ke,Nr]),Ln=Object(m.useMemo)(function(){switch(Nr){case Ne:return b.a.createElement(ue,{callback:lr,onCancel:Rr});case Xe:return b.a.createElement(se.b,{callback:lr,onCancel:Rr});case Je:return b.a.createElement(Ee,{callback:lr,onCancel:Rr});case Ze:return b.a.createElement(We,{callback:lr,onCancel:Rr});default:return null}},[Nr]);function Rr(){Br("")}Object(m.useEffect)(function(){if(Cn.current){var ot=Cn.current,ht=!1,ut=0;function vt(yt){ht=!0,ut=yt.pageY}function Tt(){ht=!1}function Dt(yt){if(ht){var It=yt.pageY-ut;It<0&&(It=0),It>300&&(It=300);var Wt=At+It+"px";an(Wt)}}return ot.addEventListener("mousedown",vt),document.addEventListener("mousemove",Dt),document.addEventListener("mouseup",Tt),function(){ot.removeEventListener("mousedown",vt),document.removeEventListener("mousemove",Dt),document.removeEventListener("mouseup",Tt)}}},[Ke,Cn]),Object(m.useEffect)(function(){an(At)},[At]);var Hr=re(Et),la=re(Zn),ua={width:Hr,height:la},$a=Object(m.useMemo)(function(){if(Or){var ot=new Date(Or),ht=ot.getHours(),ut=ot.getMinutes(),vt=ot.getSeconds();return ht=ht<10?"0"+ht:ht,ut=ut<10?"0"+ut:ut,vt=vt<10?"0"+vt:vt,"".concat(ht,":").concat(ut,":").concat(vt)}return 0},[Or]);function Qa(){window.sessionStorage.removeItem(Jr),_n(!1),Tn(0)}function da(){_n(!1),Tn(0),Ke.setValue(window.sessionStorage.getItem(Jr))}function Ui(ot,ht){var ut=Ke.getValue();ut=ut.replace(ot,ht),Ur(ut),Ke==null||Ke.setValue(ut)}return b.a.createElement(m.Fragment,null,b.a.createElement("div",{className:"markdown-editor-wrapper",ref:jr},b.a.createElement("div",{className:"markdown-editor-container ".concat(bn," ").concat(Dr?"on-preview":""," ").concat(or?"mini":""," ").concat(_r?"full-screen":""),style:ua},b.a.createElement(W,{insertTemp:vr,watch:Dr,fullScreen:_r,showNullButton:St,onActionCallback:An,hidetoolBar:Zr,uuid:on.current,setOpenPhones:function(){ki.current=!0}}),b.a.createElement("div",{className:"markdown-editor-body"},b.a.createElement("div",{className:"codemirror-container"},b.a.createElement("textarea",{ref:$t,placeholder:Ci})),Dr?b.a.createElement("div",{ref:Wr,className:"preview-container"},mr==="stex"&&b.a.createElement(A,{value:nn}),mr!=="stex"&&b.a.createElement(f.a,{edit:!0,value:nn,replaces:Ui})):null))),st?b.a.createElement("a",{ref:Cn,className:"editor-resize"}):null,b.a.createElement(M.a,null,Ge[Nr]?b.a.createElement(z.a,{centered:!0,title:Ge[Nr],visible:!0,onCancel:Rr,footer:null,className:"markdown-popup-form"},Ln):null))}},SJMd:function(qe,He){/**
* @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 J,q,z,L=!1,K,F;window.PR_SHOULD_USE_CONTINUATION=!0;var O,B;(function(){var k=window,R=["break,continue,do,else,for,if,return,while"],S=[R,"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"],m=[S,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],b=[m,"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"],P=[m,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[m,"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"],x="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",v=[m,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="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",o=[R,"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"],u=[R,"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"],s=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[b,w,P,v,d,o,u,s],E=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",A="kwd",g="com",p="typ",c="lit",l="pun",a="pln",T="tag",y="dec",h="src",D="atn",U="atv",N="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(ve){for(var ye=0,we=!1,Le=!1,Ie=0,Ae=ve.length;Ie<Ae;++Ie){var De=ve[Ie];if(De.ignoreCase)Le=!0;else if(/[a-z]/i.test(De.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){we=!0,Le=!1;break}}var We={b:8,t:9,n:10,v:11,f:12,r:13};function Ve(Ze){var Ce=Ze.charCodeAt(0);if(Ce!==92)return Ce;var et=Ze.charAt(1);return Ce=We[et],Ce||("0"<=et&&et<="7"?parseInt(Ze.substring(1),8):et==="u"||et==="x"?parseInt(Ze.substring(2),16):Ze.charCodeAt(1))}function je(Ze){if(Ze<32)return(Ze<16?"\\x0":"\\x")+Ze.toString(16);var Ce=String.fromCharCode(Ze);return Ce==="\\"||Ce==="-"||Ce==="]"||Ce==="^"?"\\"+Ce:Ce}function Ne(Ze){var Ce=Ze.substring(1,Ze.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")),et=[],Ye=Ce[0]==="^",Oe=["["];Ye&&Oe.push("^");for(var Ue=Ye?1:0,ge=Ce.length;Ue<ge;++Ue){var ce=Ce[Ue];if(/\\[bdsw]/i.test(ce))Oe.push(ce);else{var fe=Ve(ce),Y;Ue+2<ge&&Ce[Ue+1]==="-"?(Y=Ve(Ce[Ue+2]),Ue+=2):Y=fe,et.push([fe,Y]),Y<65||fe>122||(Y<65||fe>90||et.push([Math.max(65,fe)|32,Math.min(Y,90)|32]),Y<97||fe>122||et.push([Math.max(97,fe)&~32,Math.min(Y,122)&~32]))}}et.sort(function(Te,Re){return Te[0]-Re[0]||Re[1]-Te[1]});for(var Z=[],re=[],Ue=0;Ue<et.length;++Ue){var le=et[Ue];le[0]<=re[1]+1?re[1]=Math.max(re[1],le[1]):Z.push(re=le)}for(var Ue=0;Ue<Z.length;++Ue){var le=Z[Ue];Oe.push(je(le[0])),le[1]>le[0]&&(le[1]+1>le[0]&&Oe.push("-"),Oe.push(je(le[1])))}return Oe.push("]"),Oe.join("")}function Je(Ze){for(var Ce=Ze.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")),et=Ce.length,Ye=[],Oe=0,Ue=0;Oe<et;++Oe){var ge=Ce[Oe];if(ge==="(")++Ue;else if(ge.charAt(0)==="\\"){var ce=+ge.substring(1);ce&&(ce<=Ue?Ye[ce]=-1:Ce[Oe]=je(ce))}}for(var Oe=1;Oe<Ye.length;++Oe)Ye[Oe]===-1&&(Ye[Oe]=++ye);for(var Oe=0,Ue=0;Oe<et;++Oe){var ge=Ce[Oe];if(ge==="(")++Ue,Ye[Ue]||(Ce[Oe]="(?:");else if(ge.charAt(0)==="\\"){var ce=+ge.substring(1);ce&&ce<=Ue&&(Ce[Oe]="\\"+Ye[ce])}}for(var Oe=0;Oe<et;++Oe)Ce[Oe]==="^"&&Ce[Oe+1]!=="^"&&(Ce[Oe]="");if(Ze.ignoreCase&&we)for(var Oe=0;Oe<et;++Oe){var ge=Ce[Oe],fe=ge.charAt(0);ge.length>=2&&fe==="["?Ce[Oe]=Ne(ge):fe!=="\\"&&(Ce[Oe]=ge.replace(/[a-zA-Z]/g,function(re){var le=re.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return Ce.join("")}for(var Xe=[],Ie=0,Ae=ve.length;Ie<Ae;++Ie){var De=ve[Ie];if(De.global||De.multiline)throw new Error(""+De);Xe.push("(?:"+Je(De)+")")}return new RegExp(Xe.join("|"),Le?"gi":"g")}function I(ve,ye){var we=/(?:^|\s)nocode(?:\s|$)/,Le=[],Ie=0,Ae=[],De=0;function We(Ve){var je=Ve.nodeType;if(je==1){if(we.test(Ve.className))return;for(var Ne=Ve.firstChild;Ne;Ne=Ne.nextSibling)We(Ne);var Je=Ve.nodeName.toLowerCase();(Je==="br"||Je==="li")&&(Le[De]=`
`,Ae[De<<1]=Ie++,Ae[De++<<1|1]=Ve)}else if(je==3||je==4){var Xe=Ve.nodeValue;Xe.length&&(ye?Xe=Xe.replace(/\r\n?/g,`
`):Xe=Xe.replace(/[ \t\r\n]+/g," "),Le[De]=Xe,Ae[De<<1]=Ie,Ie+=Xe.length,Ae[De++<<1|1]=Ve)}}return We(ve),{sourceCode:Le.join("").replace(/\n$/,""),spans:Ae}}function H(ve,ye,we,Le,Ie){if(!we)return;var Ae={sourceNode:ve,pre:1,langExtension:null,numberLines:null,sourceCode:we,spans:null,basePos:ye,decorations:null};Le(Ae),Ie.push.apply(Ie,Ae.decorations)}var X=/\S/;function te(ve){for(var ye=void 0,we=ve.firstChild;we;we=we.nextSibling){var Le=we.nodeType;ye=Le===1?ye?ve:we:Le===3&&X.test(we.nodeValue)?ve:ye}return ye===ve?void 0:ye}function ae(ve,ye){var we={},Le;(function(){for(var De=ve.concat(ye),We=[],Ve={},je=0,Ne=De.length;je<Ne;++je){var Je=De[je],Xe=Je[3];if(Xe)for(var Ze=Xe.length;--Ze>=0;)we[Xe.charAt(Ze)]=Je;var Ce=Je[1],et=""+Ce;Ve.hasOwnProperty(et)||(We.push(Ce),Ve[et]=null)}We.push(/[\0-\uffff]/),Le=M(We)})();var Ie=ye.length,Ae=function(De){for(var We=De.sourceCode,Ve=De.basePos,je=De.sourceNode,Ne=[Ve,a],Je=0,Xe=We.match(Le)||[],Ze={},Ce=0,et=Xe.length;Ce<et;++Ce){var Ye=Xe[Ce],Oe=Ze[Ye],Ue=void 0,ge;if(typeof Oe=="string")ge=!1;else{var ce=we[Ye.charAt(0)];if(ce)Ue=Ye.match(ce[1]),Oe=ce[0];else{for(var fe=0;fe<Ie;++fe)if(ce=ye[fe],Ue=Ye.match(ce[1]),Ue){Oe=ce[0];break}Ue||(Oe=a)}ge=Oe.length>=5&&Oe.substring(0,5)==="lang-",ge&&!(Ue&&typeof Ue[1]=="string")&&(ge=!1,Oe=h),ge||(Ze[Ye]=Oe)}var Y=Je;if(Je+=Ye.length,!ge)Ne.push(Ve+Y,Oe);else{var Z=Ue[1],re=Ye.indexOf(Z),le=re+Z.length;Ue[2]&&(le=Ye.length-Ue[2].length,re=le-Z.length);var Te=Oe.substring(5);H(je,Ve+Y,Ye.substring(0,re),Ae,Ne),H(je,Ve+Y+re,Z,me(Te,Z),Ne),H(je,Ve+Y+le,Ye.substring(le),Ae,Ne)}}De.decorations=Ne};return Ae}function be(ve){var ye=[],we=[];ve.tripleQuotedStrings?ye.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ve.multiLineStrings?ye.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ye.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ve.verbatimStrings&&we.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Le=ve.hashComments;Le&&(ve.cStyleComments?(Le>1?ye.push([g,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ye.push([g,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),we.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ye.push([g,/^#[^\r\n]*/,null,"#"])),ve.cStyleComments&&(we.push([g,/^\/\/[^\r\n]*/,null]),we.push([g,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=ve.regexLiterals;if(Ie){var Ae=Ie>1?"":`
\r`,De=Ae?".":"[\\S\\s]",We="/(?=[^/*"+Ae+"])(?:[^/\\x5B\\x5C"+Ae+"]|\\x5C"+De+"|\\x5B(?:[^\\x5C\\x5D"+Ae+"]|\\x5C"+De+")*(?:\\x5D|$))+/";we.push(["lang-regex",RegExp("^"+W+"("+We+")")])}var Ve=ve.types;Ve&&we.push([p,Ve]);var je=(""+ve.keywords).replace(/^ | $/g,"");je.length&&we.push([A,new RegExp("^(?:"+je.replace(/[\s,]+/g,"|")+")\\b"),null]),ye.push([a,/^\s+/,null,` \r
\xA0`]);var Ne="^.[^\\s\\w.$@'\"`/\\\\]*";return ve.regexLiterals&&(Ne+="(?!s*/)"),we.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[p,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(Ne),null]),ae(ye,we)}var pe=be({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ue(ve,ye,we){for(var Le=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,Ae=ve.ownerDocument,De=Ae.createElement("li");ve.firstChild;)De.appendChild(ve.firstChild);var We=[De];function Ve(Ce){var et=Ce.nodeType;if(et==1&&!Le.test(Ce.className))if(Ce.nodeName==="br")je(Ce),Ce.parentNode&&Ce.parentNode.removeChild(Ce);else for(var Ye=Ce.firstChild;Ye;Ye=Ye.nextSibling)Ve(Ye);else if((et==3||et==4)&&we){var Oe=Ce.nodeValue,Ue=Oe.match(Ie);if(Ue){var ge=Oe.substring(0,Ue.index);Ce.nodeValue=ge;var ce=Oe.substring(Ue.index+Ue[0].length);if(ce){var fe=Ce.parentNode;fe.insertBefore(Ae.createTextNode(ce),Ce.nextSibling)}je(Ce),ge||Ce.parentNode.removeChild(Ce)}}}function je(Ce){for(;!Ce.nextSibling;)if(Ce=Ce.parentNode,!Ce)return;function et(Ue,ge){var ce=ge?Ue.cloneNode(!1):Ue,fe=Ue.parentNode;if(fe){var Y=et(fe,1),Z=Ue.nextSibling;Y.appendChild(ce);for(var re=Z;re;re=Z)Z=re.nextSibling,Y.appendChild(re)}return ce}for(var Ye=et(Ce.nextSibling,0),Oe;(Oe=Ye.parentNode)&&Oe.nodeType===1;)Ye=Oe;We.push(Ye)}for(var Ne=0;Ne<We.length;++Ne)Ve(We[Ne]);ye===(ye|0)&&We[0].setAttribute("value",ye);var Je=Ae.createElement("ol");Je.className="linenums";for(var Xe=Math.max(0,ye-1|0)||0,Ne=0,Ze=We.length;Ne<Ze;++Ne)De=We[Ne],De.className="L"+(Ne+Xe)%10,De.firstChild||De.appendChild(Ae.createTextNode("\xA0")),Je.appendChild(De);ve.appendChild(Je)}function se(ve){var ye=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ye=ye&&+ye[1]<=8;var we=/\n/g,Le=ve.sourceCode,Ie=Le.length,Ae=0,De=ve.spans,We=De.length,Ve=0,je=ve.decorations,Ne=je.length,Je=0;je[Ne]=Ie;var Xe,Ze;for(Ze=Xe=0;Ze<Ne;)je[Ze]!==je[Ze+2]?(je[Xe++]=je[Ze++],je[Xe++]=je[Ze++]):Ze+=2;for(Ne=Xe,Ze=Xe=0;Ze<Ne;){for(var Ce=je[Ze],et=je[Ze+1],Ye=Ze+2;Ye+2<=Ne&&je[Ye+1]===et;)Ye+=2;je[Xe++]=Ce,je[Xe++]=et,Ze=Ye}Ne=je.length=Xe;var Oe=ve.sourceNode,Ue="";Oe&&(Ue=Oe.style.display,Oe.style.display="none");try{for(var ge=null;Ve<We;){var ce=De[Ve],fe=De[Ve+2]||Ie,Y=je[Je+2]||Ie,Ye=Math.min(fe,Y),Z=De[Ve+1],re;if(Z.nodeType!==1&&(re=Le.substring(Ae,Ye))){ye&&(re=re.replace(we,"\r")),Z.nodeValue=re;var le=Z.ownerDocument,Te=le.createElement("span");Te.className=je[Je+1];var Re=Z.parentNode;Re.replaceChild(Te,Z),Te.appendChild(Z),Ae<fe&&(De[Ve+1]=Z=le.createTextNode(Le.substring(Ye,fe)),Re.insertBefore(Z,Te.nextSibling))}Ae=Ye,Ae>=fe&&(Ve+=2),Ae>=Y&&(Je+=2)}}finally{Oe&&(Oe.style.display=Ue)}}var he={};function ne(ve,ye){for(var we=ye.length;--we>=0;){var Le=ye[we];he.hasOwnProperty(Le)?k.console&&console.warn("cannot override language handler %s",Le):he[Le]=ve}}function me(ve,ye){return ve&&he.hasOwnProperty(ve)||(ve=/^\s*</.test(ye)?"default-markup":"default-code"),he[ve]}ne(pe,["default-code"]),ne(ae([],[[a,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[g,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["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"]),ne(ae([[a,/^[\s]+/,null,` \r
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[T,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[D,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["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"]),ne(ae([],[[U,/^[\s\S]+/]]),["uq.val"]),ne(be({keywords:b,hashComments:!0,cStyleComments:!0,types:E}),["c","cc","cpp","cxx","cyc","m"]),ne(be({keywords:"null,true,false"}),["json"]),ne(be({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:E}),["cs"]),ne(be({keywords:P,cStyleComments:!0}),["java"]),ne(be({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ne(be({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ne(be({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ne(be({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ne(be({keywords:v,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ne(be({keywords:x,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ne(ae([],[[f,/^[\s\S]+/]]),["regex"]);function Q(ve){var ye=ve.langExtension;try{var we=I(ve.sourceNode,ve.pre),Le=we.sourceCode;ve.sourceCode=Le,ve.spans=we.spans,ve.basePos=0,me(ye,Le)(ve),se(ve)}catch(Ie){k.console&&console.log(Ie&&Ie.stack||Ie)}}function ie(ve,ye,we){var Le=we||!1,Ie=ye||null,Ae=document.createElement("div");Ae.innerHTML="<pre>"+ve+"</pre>",Ae=Ae.firstChild,Le&&ue(Ae,Le,!0);var De={langExtension:Ie,numberLines:Le,sourceNode:Ae,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Q(De),Ae.innerHTML}function ee(ve,ye){var we=ye||document.body,Le=we.ownerDocument||document;function Ie(ce){return we.getElementsByTagName(ce)}for(var Ae=[Ie("pre"),Ie("code"),Ie("xmp")],De=[],We=0;We<Ae.length;++We)for(var Ve=0,je=Ae[We].length;Ve<je;++Ve)De.push(Ae[We][Ve]);Ae=null;var Ne=Date;Ne.now||(Ne={now:function(){return+new Date}});var Je=0,Xe=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ze=/\bprettyprint\b/,Ce=/\bprettyprinted\b/,et=/pre|xmp/i,Ye=/^code$/i,Oe=/^(?:pre|code|xmp)$/i,Ue={};function ge(){for(var ce=k.PR_SHOULD_USE_CONTINUATION?Ne.now()+250:Infinity;Je<De.length&&Ne.now()<ce;Je++){for(var fe=De[Je],Y=Ue,Z=fe;Z=Z.previousSibling;){var re=Z.nodeType,le=(re===7||re===8)&&Z.nodeValue;if(le?!/^\??prettify\b/.test(le):re!==3||/\S/.test(Z.nodeValue))break;if(le){Y={},le.replace(/\b(\w+)=([\w:.%+-]+)/g,function(At,pt,or){Y[pt]=or});break}}var Te=fe.className;if((Y!==Ue||Ze.test(Te))&&!Ce.test(Te)){for(var Re=!1,Me=fe.parentNode;Me;Me=Me.parentNode){var Ge=Me.tagName;if(Oe.test(Ge)&&Me.className&&Ze.test(Me.className)){Re=!0;break}}if(!Re){fe.className+=" prettyprinted";var it=Y.lang;if(!it){it=Te.match(Xe);var Pe;!it&&(Pe=te(fe))&&Ye.test(Pe.tagName)&&(it=Pe.className.match(Xe)),it&&(it=it[1])}var ct;if(et.test(fe.tagName))ct=1;else{var at=fe.currentStyle,rt=Le.defaultView,xt=at?at.whiteSpace:rt&&rt.getComputedStyle?rt.getComputedStyle(fe,null).getPropertyValue("white-space"):0;ct=xt&&xt.substring(0,3)==="pre"}var Et=Y.linenums;(Et=Et==="true"||+Et)||(Et=Te.match(/\blinenums\b(?::(\d+))?/),Et=Et?Et[1]&&Et[1].length?+Et[1]:!0:!1),Et&&ue(fe,Et,ct);var Rt={langExtension:it,sourceNode:fe,numberLines:Et,pre:ct,sourceCode:null,basePos:null,spans:null,decorations:null};Q(Rt)}}}Je<De.length?k.setTimeout(ge,250):typeof ve=="function"&&ve()}ge()}var Ee=k.PR={createSimpleLexer:ae,registerLangHandler:ne,sourceDecorator:be,PR_ATTRIB_NAME:D,PR_ATTRIB_VALUE:U,PR_COMMENT:g,PR_DECLARATION:y,PR_KEYWORD:A,PR_LITERAL:c,PR_NOCODE:N,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:h,PR_STRING:f,PR_TAG:T,PR_TYPE:p,prettyPrintOne:L?k.prettyPrintOne=ie:O=ie,prettyPrint:B=L?k.prettyPrint=ee:B=ee},_e=k.define;typeof _e=="function"&&_e.amd&&_e("google-code-prettify",[],function(){return Ee})})()},"VrN/":function(qe,He,J){(function(q,z){qe.exports=z()})(this,function(){"use strict";var q=navigator.userAgent,z=navigator.platform,L=/gecko\/\d/i.test(q),K=/MSIE \d/.test(q),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(q),O=/Edge\/(\d+)/.exec(q),B=K||F||O,k=B&&(K?document.documentMode||6:+(O||F)[1]),R=!O&&/WebKit\//.test(q),S=R&&/Qt\/\d+\.\d+/.test(q),m=!O&&/Chrome\//.test(q),b=/Opera\//.test(q),P=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(q),x=/PhantomJS/.test(q),v=!O&&/AppleWebKit/.test(q)&&/Mobile\/\w+/.test(q),d=/Android/.test(q),o=v||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(q),u=v||/Mac/.test(z),s=/\bCrOS\b/.test(q),C=/win/i.test(z),E=b&&q.match(/Version\/(\d*\.\d*)/);E&&(E=Number(E[1])),E&&E>=15&&(b=!1,R=!0);var f=u&&(S||b&&(E==null||E<12.11)),A=L||B&&k>=9;function g(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var p=function(e,t){var n=e.className,r=g(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function l(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var _=0;_<t.length;++_)i.appendChild(t[_]);return i}function T(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var y;document.createRange?y=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:y=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function h(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function D(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function U(e,t){var n=e.className;g(t).test(n)||(e.className+=(n?" ":"")+t)}function N(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!g(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};v?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function H(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var _=r||0,j=i||0;;){var G=e.indexOf(" ",_);if(G<0||G>=t)return j+(t-_);j+=G-_,j+=n-j%n,_=G+1}}var X=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};X.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},X.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function te(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ae=50,be={toString:function(){return"CodeMirror.Pass"}},pe={scroll:!1},ue={origin:"*mouse"},se={origin:"+move"};function he(e,t,n){for(var r=0,i=0;;){var _=e.indexOf(" ",r);_==-1&&(_=e.length);var j=_-r;if(_==e.length||i+j>=t)return r+Math.min(j,t-i);if(i+=_-r,i+=n-i%n,r=_+1,i>=t)return r}}var ne=[""];function me(e){for(;ne.length<=e;)ne.push(Q(ne)+" ");return ne[e]}function Q(e){return e[e.length-1]}function ie(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function ee(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ee(){}function _e(e,t){var n;return Object.create?n=Object.create(e):(Ee.prototype=e,n=new Ee),t&&I(t,n),n}var ve=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ye(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ve.test(e))}function we(e,t){return t?t.source.indexOf("\\w")>-1&&ye(e)?!0:t.test(e):ye(e)}function Le(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ie=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ae(e){return e.charCodeAt(0)>=768&&Ie.test(e)}function De(e,t,n){for(;(n<0?t>0:t<e.length)&&Ae(e.charAt(t));)t+=n;return t}function We(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,_=r<0?Math.ceil(i):Math.floor(i);if(_==t)return e(_)?t:n;e(_)?n=_:t=_+r}}function Ve(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,_=0;_<e.length;++_){var j=e[_];(j.from<n&&j.to>t||t==n&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,n),j.level==1?"rtl":"ltr",_),i=!0)}i||r(t,n,"ltr")}var je=null;function Ne(e,t,n){var r;je=null;for(var i=0;i<e.length;++i){var _=e[i];if(_.from<t&&_.to>t)return i;_.to==t&&(_.from!=_.to&&n=="before"?r=i:je=i),_.from==t&&(_.from!=_.to&&n!="before"?r=i:je=i)}return r!=null?r:je}var Je=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n($){return $<=247?e.charAt($):1424<=$&&$<=1524?"R":1536<=$&&$<=1785?t.charAt($-1536):1774<=$&&$<=2220?"r":8192<=$&&$<=8203?"w":$==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,_=/[LRr]/,j=/[Lb1n]/,G=/[1n]/;function V($,oe,de){this.level=$,this.from=oe,this.to=de}return function($,oe){var de=oe=="ltr"?"L":"R";if($.length==0||oe=="ltr"&&!r.test($))return!1;for(var Se=$.length,xe=[],ke=0;ke<Se;++ke)xe.push(n($.charCodeAt(ke)));for(var Fe=0,ze=de;Fe<Se;++Fe){var $e=xe[Fe];$e=="m"?xe[Fe]=ze:ze=$e}for(var tt=0,Qe=de;tt<Se;++tt){var nt=xe[tt];nt=="1"&&Qe=="r"?xe[tt]="n":_.test(nt)&&(Qe=nt,nt=="r"&&(xe[tt]="R"))}for(var dt=1,lt=xe[0];dt<Se-1;++dt){var gt=xe[dt];gt=="+"&&lt=="1"&&xe[dt+1]=="1"?xe[dt]="1":gt==","&&lt==xe[dt+1]&&(lt=="1"||lt=="n")&&(xe[dt]=lt),lt=gt}for(var Ot=0;Ot<Se;++Ot){var Vt=xe[Ot];if(Vt==",")xe[Ot]="N";else if(Vt=="%"){var kt=void 0;for(kt=Ot+1;kt<Se&&xe[kt]=="%";++kt);for(var dr=Ot&&xe[Ot-1]=="!"||kt<Se&&xe[kt]=="1"?"1":"N",nr=Ot;nr<kt;++nr)xe[nr]=dr;Ot=kt-1}}for(var Bt=0,ir=de;Bt<Se;++Bt){var Yt=xe[Bt];ir=="L"&&Yt=="1"?xe[Bt]="L":_.test(Yt)&&(ir=Yt)}for(var Ht=0;Ht<Se;++Ht)if(i.test(xe[Ht])){var jt=void 0;for(jt=Ht+1;jt<Se&&i.test(xe[jt]);++jt);for(var Ut=(Ht?xe[Ht-1]:de)=="L",ar=(jt<Se?xe[jt]:de)=="L",zn=Ut==ar?Ut?"L":"R":de,Qr=Ht;Qr<jt;++Qr)xe[Qr]=zn;Ht=jt-1}for(var Jt=[],Lr,Xt=0;Xt<Se;)if(j.test(xe[Xt])){var Xa=Xt;for(++Xt;Xt<Se&&j.test(xe[Xt]);++Xt);Jt.push(new V(0,Xa,Xt))}else{var Ir=Xt,pn=Jt.length,gn=oe=="rtl"?1:0;for(++Xt;Xt<Se&&xe[Xt]!="L";++Xt);for(var er=Ir;er<Xt;)if(G.test(xe[er])){Ir<er&&(Jt.splice(pn,0,new V(1,Ir,er)),pn+=gn);var Gn=er;for(++er;er<Xt&&G.test(xe[er]);++er);Jt.splice(pn,0,new V(2,Gn,er)),pn+=gn,Ir=er}else++er;Ir<Xt&&Jt.splice(pn,0,new V(1,Ir,Xt))}return oe=="ltr"&&(Jt[0].level==1&&(Lr=$.match(/^\s+/))&&(Jt[0].from=Lr[0].length,Jt.unshift(new V(0,0,Lr[0].length))),Q(Jt).level==1&&(Lr=$.match(/\s+$/))&&(Q(Jt).to-=Lr[0].length,Jt.push(new V(0,Se-Lr[0].length,Se)))),oe=="rtl"?Jt.reverse():Jt}}();function Xe(e,t){var n=e.order;return n==null&&(n=e.order=Je(e.text,t)),n}var Ze=[],Ce=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Ze).concat(n)}};function et(e,t){return e._handlers&&e._handlers[t]||Ze}function Ye(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var _=te(i,n);_>-1&&(r[t]=i.slice(0,_).concat(i.slice(_+1)))}}}function Oe(e,t){var n=et(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ue(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Oe(e,n||t.type,e,t),re(t)||t.codemirrorIgnore}function ge(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)te(n,t[r])==-1&&n.push(t[r])}function ce(e,t){return et(e,t).length>0}function fe(e){e.prototype.on=function(t,n){Ce(this,t,n)},e.prototype.off=function(t,n){Ye(this,t,n)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function re(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){Y(e),Z(e)}function Te(e){return e.target||e.srcElement}function Re(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var Me=function(){if(B&&k<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ge;function it(e){if(Ge==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ge=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&k<8))}var n=Ge?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Pe;function ct(e){if(Pe!=null)return Pe;var t=l(e,document.createTextNode("A\u062EA")),n=y(t,0,1).getBoundingClientRect(),r=y(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:Pe=r.right-n.right<3}var at=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
`,t);i==-1&&(i=e.length);var _=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),j=_.indexOf("\r");j!=-1?(n.push(_.slice(0,j)),t+=j+1):(n.push(_),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},rt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},xt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function Rt(e){if(Et!=null)return Et;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=y(t,0,1).getBoundingClientRect();return Et=Math.abs(n.left-r.left)>1}var At={},pt={};function or(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),At[e]=t}function Kt(e,t){pt[e]=t}function Nt(e){if(typeof e=="string"&&pt.hasOwnProperty(e))e=pt[e];else if(e&&typeof e.name=="string"&&pt.hasOwnProperty(e.name)){var t=pt[e.name];typeof t=="string"&&(t={name:t}),e=_e(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Nt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Nt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Tr(e,t){t=Nt(t);var n=At[t.name];if(!n)return Tr(e,"text/plain");var r=n(e,t);if(vr.hasOwnProperty(t.name)){var i=vr[t.name];for(var _ in i){if(!i.hasOwnProperty(_))continue;r.hasOwnProperty(_)&&(r["_"+_]=r[_]),r[_]=i[_]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var vr={};function wi(e,t){var n=vr.hasOwnProperty(e)?vr[e]:vr[e]={};I(t,n)}function mr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function vn(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Jr(e,t,n){return e.startState?e.startState(t,n):!0}var Mt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Mt.prototype.eol=function(){return this.pos>=this.string.length},Mt.prototype.sol=function(){return this.pos==this.lineStart},Mt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Mt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Mt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Mt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Mt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Mt.prototype.skipToEnd=function(){this.pos=this.string.length},Mt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Mt.prototype.backUp=function(e){this.pos-=e},Mt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(j){return n?j.toLowerCase():j},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var _=this.string.slice(this.pos).match(e);return _&&_.index>0?null:(_&&t!==!1&&(this.pos+=_[0].length),_)}},Mt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Mt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Mt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Mt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function st(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],_=i.chunkSize();if(t<_){n=i;break}t-=_}return n.lines[t]}function Sr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(_){var j=_.text;i==n.line&&(j=j.slice(0,n.ch)),i==t.line&&(j=j.slice(t.ch)),r.push(j),++i}),r}function Vn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function cr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function St(e){if(e.parent==null)return null;for(var t=e.parent,n=te(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function wr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],_=i.height;if(t<_){e=i;continue e}t-=_,n+=i.chunkSize()}return n}while(!e.lines);for(var j=0;j<e.lines.length;++j){var G=e.lines[j],V=G.height;if(t<V)break;t-=V}return n+j}function Zr(e,t){return t>=e.first&&t<e.first+e.size}function yn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Be(e,t,n){if(n===void 0&&(n=null),!(this instanceof Be))return new Be(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ft(e,t){return e.line-t.line||e.ch-t.ch}function qr(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function en(e){return Be(e.line,e.ch)}function tn(e,t){return ft(e,t)<0?t:e}function bn(e,t){return ft(e,t)<0?e:t}function Xn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function mt(e,t){if(t.line<e.first)return Be(e.first,0);var n=e.first+e.size-1;return t.line>n?Be(n,st(e,n).text.length):_i(t,st(e,t.line).text.length)}function _i(e,t){var n=e.ch;return n==null||n>t?Be(e.line,t):n<0?Be(e.line,0):e}function Ci(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=mt(e,t[r]);return n}var rn=function(e,t){this.state=e,this.lookAhead=t},sr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};sr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},sr.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},sr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},sr.fromSaved=function(e,t,n){return t instanceof rn?new sr(e,mr(e.mode,t.state),n,t.lookAhead):new sr(e,mr(e.mode,t),n)},sr.prototype.save=function(e){var t=e!==!1?mr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new rn(t,this.maxLookAhead):t};function Ai(e,t,n,r){var i=[e.state.modeGen],_={};Qn(e,t.text,e.doc.mode,n,function($,oe){return i.push($,oe)},_,r);for(var j=n.state,G=function($){n.baseTokens=i;var oe=e.state.overlays[$],de=1,Se=0;n.state=!0,Qn(e,t.text,oe.mode,n,function(xe,ke){for(var Fe=de;Se<xe;){var ze=i[de];ze>xe&&i.splice(de,1,xe,i[de+1],ze),de+=2,Se=Math.min(xe,ze)}if(!ke)return;if(oe.opaque)i.splice(Fe,de-Fe,xe,"overlay "+ke),de=Fe+2;else for(;Fe<de;Fe+=2){var $e=i[Fe+1];i[Fe+1]=($e?$e+" ":"")+"overlay "+ke}},_),n.state=j,n.baseTokens=null,n.baseTokenPos=1},V=0;V<e.state.overlays.length;++V)G(V);return{styles:i,classes:_.bgClass||_.textClass?_:null}}function Yn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Ke(e,St(t)),i=t.text.length>e.options.maxHighlightLength&&mr(e.doc.mode,r.state),_=Ai(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=_.styles,_.classes?t.styleClasses=_.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ke(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new sr(r,!0,t);var _=Dr(e,t,n),j=_>r.first&&st(r,_-1).stateAfter,G=j?sr.fromSaved(r,j,_):new sr(r,Jr(r.mode),_);return r.iter(_,t,function(V){$n(e,V.text,G);var $=G.line;V.stateAfter=$==t-1||$%5==0||$>=i.viewFrom&&$<i.viewTo?G.save():null,G.nextLine()}),n&&(r.modeFrontier=G.line),G}function $n(e,t,n,r){var i=e.doc.mode,_=new Mt(t,e.options.tabSize,n);for(_.start=_.pos=r||0,t==""&&Li(i,n.state);!_.eol();)En(i,_,n.state),_.start=_.pos}function Li(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=vn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function En(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=vn(e,n).mode);var _=e.token(t,n);if(t.pos>t.start)return _}throw new Error("Mode "+e.name+" failed to advance stream.")}var nn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ur(e,t,n,r){var i=e.doc,_=i.mode,j;t=mt(i,t);var G=st(i,t.line),V=Ke(e,t.line,n),$=new Mt(G.text,e.options.tabSize,V),oe;for(r&&(oe=[]);(r||$.pos<t.ch)&&!$.eol();)$.start=$.pos,j=En(_,$,V.state),r&&oe.push(new nn($,j,mr(i.mode,V.state)));return r?oe:new nn($,j,V.state)}function Di(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Qn(e,t,n,r,i,_,j){var G=n.flattenSpans;G==null&&(G=e.options.flattenSpans);var V=0,$=null,oe=new Mt(t,e.options.tabSize,r),de,Se=e.options.addModeClass&&[null];for(t==""&&Di(Li(n,r.state),_);!oe.eol();){if(oe.pos>e.options.maxHighlightLength?(G=!1,j&&$n(e,t,r,oe.pos),oe.pos=t.length,de=null):de=Di(En(n,oe,r.state,Se),_),Se){var xe=Se[0].name;xe&&(de="m-"+(de?xe+" "+de:xe))}if(!G||$!=de){for(;V<oe.start;)V=Math.min(oe.start,V+5e3),i(V,$);$=de}oe.start=oe.pos}for(;V<oe.pos;){var ke=Math.min(oe.pos,V+5e3);i(ke,$),V=ke}}function Dr(e,t,n){for(var r,i,_=e.doc,j=n?-1:t-(e.doc.mode.innerMode?1e3:100),G=t;G>j;--G){if(G<=_.first)return _.first;var V=st(_,G-1),$=V.stateAfter;if($&&(!n||G+($ instanceof rn?$.lookAhead:0)<=_.modeFrontier))return G;var oe=H(V.text,null,e.options.tabSize);(i==null||r>oe)&&(i=G-1,r=oe)}return i}function Oi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=st(e,r).stateAfter;if(i&&(!(i instanceof rn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ri=!1,pr=!1;function _r(){Ri=!0}function Pi(){pr=!0}function xn(e,t,n){this.marker=e,this.from=t,this.to=n}function Fr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Nr(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Br(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function aa(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var _=e[i],j=_.marker,G=_.from==null||(j.inclusiveLeft?_.from<=t:_.from<t);if(G||_.from==t&&j.type=="bookmark"&&(!n||!_.marker.insertLeft)){var V=_.to==null||(j.inclusiveRight?_.to>=t:_.to>t);(r||(r=[])).push(new xn(j,_.from,V?null:_.to))}}return r}function Mi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var _=e[i],j=_.marker,G=_.to==null||(j.inclusiveRight?_.to>=t:_.to>t);if(G||_.from==t&&j.type=="bookmark"&&(!n||_.marker.insertLeft)){var V=_.from==null||(j.inclusiveLeft?_.from<=t:_.from<t);(r||(r=[])).push(new xn(j,V?null:_.from-t,_.to==null?null:_.to-t))}}return r}function Or(e,t){if(t.full)return null;var n=Zr(e,t.from.line)&&st(e,t.from.line).markedSpans,r=Zr(e,t.to.line)&&st(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,_=t.to.ch,j=ft(t.from,t.to)==0,G=aa(n,i,j),V=Mi(r,_,j),$=t.text.length==1,oe=Q(t.text).length+($?i:0);if(G)for(var de=0;de<G.length;++de){var Se=G[de];if(Se.to==null){var xe=Fr(V,Se.marker);xe?$&&(Se.to=xe.to==null?null:xe.to+oe):Se.to=i}}if(V)for(var ke=0;ke<V.length;++ke){var Fe=V[ke];if(Fe.to!=null&&(Fe.to+=oe),Fe.from==null){var ze=Fr(G,Fe.marker);ze||(Fe.from=oe,$&&(G||(G=[])).push(Fe))}else Fe.from+=oe,$&&(G||(G=[])).push(Fe)}G&&(G=Tn(G)),V&&V!=G&&(V=Tn(V));var $e=[G];if(!$){var tt=t.text.length-2,Qe;if(tt>0&&G)for(var nt=0;nt<G.length;++nt)G[nt].to==null&&(Qe||(Qe=[])).push(new xn(G[nt].marker,null,null));for(var dt=0;dt<tt;++dt)$e.push(Qe);$e.push(V)}return $e}function Tn(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function oa(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(xe){if(xe.markedSpans)for(var ke=0;ke<xe.markedSpans.length;++ke){var Fe=xe.markedSpans[ke].marker;Fe.readOnly&&(!r||te(r,Fe)==-1)&&(r||(r=[])).push(Fe)}}),!r)return null;for(var i=[{from:t,to:n}],_=0;_<r.length;++_)for(var j=r[_],G=j.find(0),V=0;V<i.length;++V){var $=i[V];if(ft($.to,G.from)<0||ft($.from,G.to)>0)continue;var oe=[V,1],de=ft($.from,G.from),Se=ft($.to,G.to);(de<0||!j.inclusiveLeft&&!de)&&oe.push({from:$.from,to:G.from}),(Se>0||!j.inclusiveRight&&!Se)&&oe.push({from:G.to,to:$.to}),i.splice.apply(i,oe),V+=oe.length-3}return i}function Jn(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Zn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function an(e){return e.inclusiveLeft?-1:0}function Sn(e){return e.inclusiveRight?1:0}function wn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),_=ft(r.from,i.from)||an(e)-an(t);if(_)return-_;var j=ft(r.to,i.to)||Sn(e)-Sn(t);return j||t.id-e.id}function sa(e,t){var n=pr&&e.markedSpans,r;if(n)for(var i=void 0,_=0;_<n.length;++_)i=n[_],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||wn(r,i.marker)<0)&&(r=i.marker);return r}function _n(e){return sa(e,!0)}function on(e){return sa(e,!1)}function ki(e,t){var n=pr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var _=n[i];_.marker.collapsed&&(_.from==null||_.from<t)&&(_.to==null||_.to>t)&&(!r||wn(r,_.marker)<0)&&(r=_.marker)}return r}function qn(e,t,n,r,i){var _=st(e,t),j=pr&&_.markedSpans;if(j)for(var G=0;G<j.length;++G){var V=j[G];if(!V.marker.collapsed)continue;var $=V.marker.find(0),oe=ft($.from,n)||an(V.marker)-an(i),de=ft($.to,r)||Sn(V.marker)-Sn(i);if(oe>=0&&de<=0||oe<=0&&de>=0)continue;if(oe<=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ft($.to,n)>=0:ft($.to,n)>0)||oe>=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ft($.from,r)<=0:ft($.from,r)<0))return!0}}function $t(e){for(var t;t=_n(e);)e=t.find(-1,!0).line;return e}function jr(e){for(var t;t=on(e);)e=t.find(1,!0).line;return e}function Cn(e){for(var t,n;t=on(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Wr(e,t){var n=st(e,t),r=$t(n);return n==r?t:St(r)}function Ii(e,t){if(t>e.lastLine())return t;var n=st(e,t),r;if(!yr(e,n))return t;for(;r=on(n);)n=r.find(1,!0).line;return St(n)+1}function yr(e,t){var n=pr&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&An(e,t,r))return!0}}function An(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return An(e,r.line,Fr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,_=0;_<t.markedSpans.length;++_)if(i=t.markedSpans[_],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&An(e,t,i))return!0}function lr(e){e=$t(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var _=n.parent;_;n=_,_=n.parent)for(var j=0;j<_.children.length;++j){var G=_.children[j];if(G==n)break;t+=G.height}return t}function Ln(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=_n(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=on(r);){var _=n.find(0,!0);t-=r.text.length-_.from.ch,r=_.to.line,t+=r.text.length-_.to.ch}return t}function Rr(e){var t=e.display,n=e.doc;t.maxLine=st(n,n.first),t.maxLineLength=Ln(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Ln(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Hr=function(e,t,n){this.text=e,Zn(this,t),this.height=n?n(this):1};Hr.prototype.lineNo=function(){return St(this)},fe(Hr);function la(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Jn(e),Zn(e,n);var i=r?r(e):1;i!=e.height&&cr(e,i)}function ua(e){e.parent=null,Jn(e)}var $a={},Qa={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Qa:$a;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ui(e,t){var n=T("span",null,null,R?"padding-right: .1px":null),r={pre:T("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var _=i?t.rest[i-1]:t.line,j=void 0;r.pos=0,r.addToken=ht,ct(e.display.measure)&&(j=Xe(_,e.doc.direction))&&(r.addToken=vt(r.addToken,j)),r.map=[];var G=t!=e.display.externalMeasured&&St(_);Dt(_,r,Yn(e,_,G)),_.styleClasses&&(_.styleClasses.bgClass&&(r.bgClass=N(_.styleClasses.bgClass,r.bgClass||"")),_.styleClasses.textClass&&(r.textClass=N(_.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(it(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(R){var V=r.content.lastChild;(/\bcm-tab\b/.test(V.className)||V.querySelector&&V.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Oe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=N(r.pre.className,r.textClass||"")),r}function ot(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ht(e,t,n,r,i,_,j){if(!t)return;var G=e.splitSpaces?ut(t,e.trailingSpace):t,V=e.cm.state.specialChars,$=!1,oe;if(!V.test(t))e.col+=t.length,oe=document.createTextNode(G),e.map.push(e.pos,e.pos+t.length,oe),B&&k<9&&($=!0),e.pos+=t.length;else{oe=document.createDocumentFragment();for(var de=0;;){V.lastIndex=de;var Se=V.exec(t),xe=Se?Se.index-de:t.length-de;if(xe){var ke=document.createTextNode(G.slice(de,de+xe));B&&k<9?oe.appendChild(a("span",[ke])):oe.appendChild(ke),e.map.push(e.pos,e.pos+xe,ke),e.col+=xe,e.pos+=xe}if(!Se)break;de+=xe+1;var Fe=void 0;if(Se[0]==" "){var ze=e.cm.options.tabSize,$e=ze-e.col%ze;Fe=oe.appendChild(a("span",me($e),"cm-tab")),Fe.setAttribute("role","presentation"),Fe.setAttribute("cm-text"," "),e.col+=$e}else Se[0]=="\r"||Se[0]==`
`?(Fe=oe.appendChild(a("span",Se[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Fe.setAttribute("cm-text",Se[0]),e.col+=1):(Fe=e.cm.options.specialCharPlaceholder(Se[0]),Fe.setAttribute("cm-text",Se[0]),B&&k<9?oe.appendChild(a("span",[Fe])):oe.appendChild(Fe),e.col+=1);e.map.push(e.pos,e.pos+1,Fe),e.pos++}}if(e.trailingSpace=G.charCodeAt(t.length-1)==32,n||r||i||$||_||j){var tt=n||"";r&&(tt+=r),i&&(tt+=i);var Qe=a("span",[oe],tt,_);if(j)for(var nt in j)j.hasOwnProperty(nt)&&nt!="style"&&nt!="class"&&Qe.setAttribute(nt,j[nt]);return e.content.appendChild(Qe)}e.content.appendChild(oe)}function ut(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var _=e.charAt(i);_==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(_="\xA0"),r+=_,n=_==" "}return r}function vt(e,t){return function(n,r,i,_,j,G,V){i=i?i+" cm-force-border":"cm-force-border";for(var $=n.pos,oe=$+r.length;;){for(var de=void 0,Se=0;Se<t.length&&!(de=t[Se],de.to>$&&de.from<=$);Se++);if(de.to>=oe)return e(n,r,i,_,j,G,V);e(n,r.slice(0,de.to-$),i,_,null,G,V),_=null,r=r.slice(de.to-$),$=de.to}}}function Tt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Dt(e,t,n){var r=e.markedSpans,i=e.text,_=0;if(!r){for(var j=1;j<n.length;j+=2)t.addToken(t,i.slice(_,_=n[j]),da(n[j+1],t.cm.options));return}for(var G=i.length,V=0,$=1,oe="",de,Se,xe=0,ke,Fe,ze,$e,tt;;){if(xe==V){ke=Fe=ze=Se="",tt=null,$e=null,xe=Infinity;for(var Qe=[],nt=void 0,dt=0;dt<r.length;++dt){var lt=r[dt],gt=lt.marker;if(gt.type=="bookmark"&&lt.from==V&&gt.widgetNode)Qe.push(gt);else if(lt.from<=V&&(lt.to==null||lt.to>V||gt.collapsed&&lt.to==V&&lt.from==V)){if(lt.to!=null&&lt.to!=V&&xe>lt.to&&(xe=lt.to,Fe=""),gt.className&&(ke+=" "+gt.className),gt.css&&(Se=(Se?Se+";":"")+gt.css),gt.startStyle&&lt.from==V&&(ze+=" "+gt.startStyle),gt.endStyle&&lt.to==xe&&(nt||(nt=[])).push(gt.endStyle,lt.to),gt.title&&((tt||(tt={})).title=gt.title),gt.attributes)for(var Ot in gt.attributes)(tt||(tt={}))[Ot]=gt.attributes[Ot];gt.collapsed&&(!$e||wn($e.marker,gt)<0)&&($e=lt)}else lt.from>V&&xe>lt.from&&(xe=lt.from)}if(nt)for(var Vt=0;Vt<nt.length;Vt+=2)nt[Vt+1]==xe&&(Fe+=" "+nt[Vt]);if(!$e||$e.from==V)for(var kt=0;kt<Qe.length;++kt)Tt(t,0,Qe[kt]);if($e&&($e.from||0)==V){if(Tt(t,($e.to==null?G+1:$e.to)-V,$e.marker,$e.from==null),$e.to==null)return;$e.to==V&&($e=!1)}}if(V>=G)break;for(var dr=Math.min(G,xe);;){if(oe){var nr=V+oe.length;if(!$e){var Bt=nr>dr?oe.slice(0,dr-V):oe;t.addToken(t,Bt,de?de+ke:ke,ze,V+Bt.length==xe?Fe:"",Se,tt)}if(nr>=dr){oe=oe.slice(dr-V),V=dr;break}V=nr,ze=""}oe=i.slice(_,_=n[$++]),de=da(n[$++],t.cm.options)}}}function yt(e,t,n){this.line=t,this.rest=Cn(t),this.size=this.rest?St(Q(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(e,t)}function It(e,t,n){for(var r=[],i,_=t;_<n;_=i){var j=new yt(e.doc,st(e.doc,_),_);i=_+j.size,r.push(j)}return r}var Wt=null;function bt(e){Wt?Wt.ops.push(e):e.ownsGroup=Wt={ops:[e],delayedCallbacks:[]}}function Pr(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function _t(e,t){var n=e.ownsGroup;if(!n)return;try{Pr(n)}finally{Wt=null,t(n)}}var Zt=null;function Lt(e,t){var n=et(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Wt?i=Wt.delayedCallbacks:Zt?i=Zt:(i=Zt=[],setTimeout(gr,0));for(var _=function(G){i.push(function(){return n[G].apply(null,r)})},j=0;j<n.length;++j)_(j)}function gr(){var e=Zt;Zt=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var i=0;i<t.changes.length;i++){var _=t.changes[i];_=="text"?ks(e,t):_=="gutter"?qa(e,t,n,r):_=="class"?ca(e,t):_=="widget"&&Is(e,t,r)}t.changes=null}function ei(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&k<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=ei(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ui(e,t)}function ks(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ca(e,t)):n&&(t.text.className=n)}function ca(e,t){Ms(e,t),t.line.wrapClass?ei(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function qa(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ei(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var _=t.line.gutterMarkers;if(e.options.lineNumbers||_){var j=ei(t),G=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(G),j.insertBefore(G,t.text),t.line.gutterClass&&(G.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!_||!_["CodeMirror-linenumbers"])&&(t.lineNumber=G.appendChild(a("div",yn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),_)for(var V=0;V<e.display.gutterSpecs.length;++V){var $=e.display.gutterSpecs[V].className,oe=_.hasOwnProperty($)&&_[$];oe&&G.appendChild(a("div",[oe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[$]+"px; width: "+r.gutterWidth[$]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=g("CodeMirror-linewidget"),i=t.node.firstChild,_=void 0;i;i=_)_=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);eo(e,t,n)}function Us(e,t,n,r){var i=Za(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ca(e,t),qa(e,t,n,r),eo(e,t,r),t.node}function eo(e,t,n){if(to(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,n,!1)}function to(e,t,n,r,i){if(!t.widgets)return;for(var _=ei(n),j=0,G=t.widgets;j<G.length;++j){var V=G[j],$=a("div",[V.node],"CodeMirror-linewidget"+(V.className?" "+V.className:""));V.handleMouseEvents||$.setAttribute("cm-ignore-events","true"),Fs(V,$,n,r),e.display.input.setUneditable($),i&&V.above?_.insertBefore($,n.gutter||n.text):_.appendChild($),Lt(V,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ti(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!h(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),l(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Mr(e,t){for(var n=Te(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Fi(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Cr(e){return ae-e.display.nativeBarWidth}function sn(e){return e.display.scroller.clientWidth-Cr(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-Cr(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&sn(e);if(!t.measure.heights||r&&t.measure.width!=i){var _=t.measure.heights=[];if(r){t.measure.width=i;for(var j=t.text.firstChild.getClientRects(),G=0;G<j.length-1;G++){var V=j[G],$=j[G+1];Math.abs(V.bottom-$.bottom)>2&&_.push((V.bottom+$.top)/2-n.top)}}_.push(n.bottom-n.top)}}function no(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(St(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=$t(t);var n=St(t),r=e.display.externalMeasured=new yt(e.doc,t,n);r.lineN=n;var i=r.built=Ui(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return Ar(e,Dn(e,t),n,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[dn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Dn(e,t){var n=St(t),r=ma(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=no(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Ar(e,t,n,r,i){t.before&&(n=-1);var _=n+(r||""),j;return t.cache.hasOwnProperty(_)?j=t.cache[_]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),j=Ws(e,t,n,r),j.bogus||(t.cache[_]=j)),{left:j.left,right:j.right,top:i?j.rtop:j.top,bottom:i?j.rbottom:j.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,n){for(var r,i,_,j,G,V,$=0;$<e.length;$+=3)if(G=e[$],V=e[$+1],t<G?(i=0,_=1,j="left"):t<V?(i=t-G,_=i+1):($==e.length-3||t==V&&e[$+3]>t)&&(_=V-G,i=_-1,t>=V&&(j="right")),i!=null){if(r=e[$+2],G==V&&n==(r.insertLeft?"left":"right")&&(j=n),n=="left"&&i==0)for(;$&&e[$-2]==e[$-3]&&e[$-1].insertLeft;)r=e[($-=3)+2],j="left";if(n=="right"&&i==V-G)for(;$<e.length-3&&e[$+3]==e[$+4]&&!e[$+5].insertLeft;)r=e[($+=3)+2],j="right";break}return{node:r,start:i,end:_,collapse:j,coverStart:G,coverEnd:V}}function js(e,t){var n=ao;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=oo(t.map,n,r),_=i.node,j=i.start,G=i.end,V=i.collapse,$;if(_.nodeType==3){for(var oe=0;oe<4;oe++){for(;j&&Ae(t.line.text.charAt(i.coverStart+j));)--j;for(;i.coverStart+G<i.coverEnd&&Ae(t.line.text.charAt(i.coverStart+G));)++G;if(B&&k<9&&j==0&&G==i.coverEnd-i.coverStart?$=_.parentNode.getBoundingClientRect():$=js(y(_,j,G).getClientRects(),r),$.left||$.right||j==0)break;G=j,j=j-1,V="right"}B&&k<11&&($=Hs(e.display.measure,$))}else{j>0&&(V=r="right");var de;e.options.lineWrapping&&(de=_.getClientRects()).length>1?$=de[r=="right"?de.length-1:0]:$=_.getBoundingClientRect()}if(B&&k<9&&!j&&(!$||!$.left&&!$.right)){var Se=_.parentNode.getClientRects()[0];Se?$={left:Se.left,right:Se.left+Rn(e.display),top:Se.top,bottom:Se.bottom}:$=ao}for(var xe=$.top-t.rect.top,ke=$.bottom-t.rect.top,Fe=(xe+ke)/2,ze=t.view.measure.heights,$e=0;$e<ze.length-1&&!(Fe<ze[$e]);$e++);var tt=$e?ze[$e-1]:0,Qe=ze[$e],nt={left:(V=="right"?$.right:$.left)-t.rect.left,right:(V=="left"?$.left:$.right)-t.rect.left,top:tt,bottom:Qe};return!$.left&&!$.right&&(nt.bogus=!0),e.options.singleCursorHeightPerLine||(nt.rtop=xe,nt.rbottom=ke),nt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Rt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function so(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lo(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function ri(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return m&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function co(){return m&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ti(e.widgets[n]));return t}function Ni(e,t,n,r,i){if(!i){var _=pa(t);n.top+=_,n.bottom+=_}if(r=="line")return n;r||(r="local");var j=lr(t);if(r=="local"?j+=Fi(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var G=e.display.lineSpace.getBoundingClientRect();j+=G.top+(r=="window"?0:co());var V=G.left+(r=="window"?0:uo());n.left+=V,n.right+=V}return n.top+=j,n.bottom+=j,n}function fo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=uo(),i-=co();else if(n=="local"||!n){var _=e.display.sizer.getBoundingClientRect();r+=_.left,i+=_.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:r-j.left,top:i-j.top}}function ga(e,t,n,r,i){return r||(r=st(e.doc,t.line)),Ni(e,r,io(e,r,t.ch,i),n)}function br(e,t,n,r,i,_){r=r||st(e.doc,t.line),i||(i=Dn(e,r));function j(ke,Fe){var ze=Ar(e,i,ke,Fe?"right":"left",_);return Fe?ze.left=ze.right:ze.right=ze.left,Ni(e,r,ze,n)}var G=Xe(r,e.doc.direction),V=t.ch,$=t.sticky;if(V>=r.text.length?(V=r.text.length,$="before"):V<=0&&(V=0,$="after"),!G)return j($=="before"?V-1:V,$=="before");function oe(ke,Fe,ze){var $e=G[Fe],tt=$e.level==1;return j(ze?ke-1:ke,tt!=ze)}var de=Ne(G,V,$),Se=je,xe=oe(V,de,$=="before");return Se!=null&&(xe.other=oe(V,Se,$!="before")),xe}function ho(e,t){var n=0;t=mt(e.doc,t),e.options.lineWrapping||(n=Rn(e.display)*t.ch);var r=st(e.doc,t.line),i=lr(r)+Fi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function va(e,t,n,r,i){var _=Be(e,t,n);return _.xRel=i,r&&(_.outside=r),_}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var i=wr(r,n),_=r.first+r.size-1;if(i>_)return va(r.first+r.size-1,st(r,_).text.length,null,1,1);t<0&&(t=0);for(var j=st(r,i);;){var G=Ks(e,j,i,t,n),V=ki(j,G.ch+(G.xRel>0||G.outside>0?1:0));if(!V)return G;var $=V.find(1);if($.line==i)return $;j=st(r,i=$.line)}}function mo(e,t,n,r){r-=pa(t);var i=t.text.length,_=We(function(j){return Ar(e,n,j-1).bottom<=r},i,0);return i=We(function(j){return Ar(e,n,j).top>r},_,i),{begin:_,end:i}}function po(e,t,n,r){n||(n=Dn(e,t));var i=Ni(e,t,Ar(e,n,r),"line").top;return mo(e,t,n,i)}function ba(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=lr(t);var _=Dn(e,t),j=pa(t),G=0,V=t.text.length,$=!0,oe=Xe(t,e.doc.direction);if(oe){var de=(e.options.lineWrapping?Gs:zs)(e,t,n,_,oe,r,i);$=de.level!=1,G=$?de.from:de.to-1,V=$?de.to:de.from-1}var Se=null,xe=null,ke=We(function(dt){var lt=Ar(e,_,dt);return lt.top+=j,lt.bottom+=j,ba(lt,r,i,!1)?(lt.top<=i&&lt.left<=r&&(Se=dt,xe=lt),!0):!1},G,V),Fe,ze,$e=!1;if(xe){var tt=r-xe.left<xe.right-r,Qe=tt==$;ke=Se+(Qe?0:1),ze=Qe?"after":"before",Fe=tt?xe.left:xe.right}else{!$&&(ke==V||ke==G)&&ke++,ze=ke==0?"after":ke==t.text.length?"before":Ar(e,_,ke-($?1:0)).bottom+j<=i==$?"after":"before";var nt=br(e,Be(n,ke,ze),"line",t,_);Fe=nt.left,$e=i<nt.top?-1:i>=nt.bottom?1:0}return ke=De(t.text,ke,1),va(n,ke,ze,$e,r-Fe)}function zs(e,t,n,r,i,_,j){var G=We(function(de){var Se=i[de],xe=Se.level!=1;return ba(br(e,Be(n,xe?Se.to:Se.from,xe?"before":"after"),"line",t,r),_,j,!0)},0,i.length-1),V=i[G];if(G>0){var $=V.level!=1,oe=br(e,Be(n,$?V.from:V.to,$?"after":"before"),"line",t,r);ba(oe,_,j,!0)&&oe.top>j&&(V=i[G-1])}return V}function Gs(e,t,n,r,i,_,j){var G=mo(e,t,r,j),V=G.begin,$=G.end;/\s/.test(t.text.charAt($-1))&&$--;for(var oe=null,de=null,Se=0;Se<i.length;Se++){var xe=i[Se];if(xe.from>=$||xe.to<=V)continue;var ke=xe.level!=1,Fe=Ar(e,r,ke?Math.min($,xe.to)-1:Math.max(V,xe.from)).right,ze=Fe<_?_-Fe+1e9:Fe-_;(!oe||de>ze)&&(oe=xe,de=ze)}return oe||(oe=i[i.length-1]),oe.from<V&&(oe={from:V,to:oe.to,level:oe.level}),oe.to>$&&(oe={from:oe.from,to:$,level:oe.level}),oe}var ln;function On(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ln==null){ln=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ln.appendChild(document.createTextNode("x")),ln.appendChild(a("br"));ln.appendChild(document.createTextNode("x"))}l(e.measure,ln);var n=ln.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Rn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ea(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,_=t.gutters.firstChild,j=0;_;_=_.nextSibling,++j){var G=e.display.gutterSpecs[j].className;n[G]=_.offsetLeft+_.clientLeft+i,r[G]=_.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=On(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Rn(e.display)-3);return function(i){if(yr(e.doc,i))return 0;var _=0;if(i.widgets)for(var j=0;j<i.widgets.length;j++)i.widgets[j].height&&(_+=i.widgets[j].height);return n?_+(Math.ceil(i.text.length/r)||1)*t:_+t}}function Ta(e){var t=e.doc,n=go(e);t.iter(function(r){var i=n(r);i!=r.height&&cr(r,i)})}function un(e,t,n,r){var i=e.display;if(!n&&Te(t).getAttribute("cm-not-content")=="true")return null;var _,j,G=i.lineSpace.getBoundingClientRect();try{_=t.clientX-G.left,j=t.clientY-G.top}catch(de){return null}var V=ya(e,_,j),$;if(r&&V.xRel>0&&($=st(e.doc,V.line).text).length==V.ch){var oe=H($,$.length,e.options.tabSize)-$.length;V=Be(V.line,Math.max(0,Math.round((_-ro(e.display).left)/Rn(e.display))-oe))}return V}function dn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function tr(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)pr&&Wr(e.doc,t)<i.viewTo&&zr(e);else if(n<=i.viewFrom)pr&&Ii(e.doc,n+r)>i.viewFrom?zr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)zr(e);else if(t<=i.viewFrom){var _=Bi(e,n,n+r,1);_?(i.view=i.view.slice(_.index),i.viewFrom=_.lineN,i.viewTo+=r):zr(e)}else if(n>=i.viewTo){var j=Bi(e,t,t,-1);j?(i.view=i.view.slice(0,j.index),i.viewTo=j.lineN):zr(e)}else{var G=Bi(e,t,t,-1),V=Bi(e,n,n+r,1);G&&V?(i.view=i.view.slice(0,G.index).concat(It(e,G.lineN,V.lineN)).concat(i.view.slice(V.index)),i.viewTo+=r):zr(e)}var $=i.externalMeasured;$&&(n<$.lineN?$.lineN+=r:t<$.lineN+$.size&&(i.externalMeasured=null))}function Kr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var _=r.view[dn(e,t)];if(_.node==null)return;var j=_.changes||(_.changes=[]);te(j,n)==-1&&j.push(n)}function zr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bi(e,t,n,r){var i=dn(e,t),_,j=e.display.view;if(!pr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var G=e.display.viewFrom,V=0;V<i;V++)G+=j[V].size;if(G!=t){if(r>0){if(i==j.length-1)return null;_=G+j[i].size-t,i++}else _=G-t;t+=_,n+=_}for(;Wr(e.doc,n)!=n;){if(i==(r<0?0:j.length-1))return null;n+=r*j[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=It(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=It(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(dn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(It(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,dn(e,n)))),r.viewTo=n}function vo(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function ni(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),_=r.selection=document.createDocumentFragment(),j=0;j<n.sel.ranges.length;j++){if(!t&&j==n.sel.primIndex)continue;var G=n.sel.ranges[j];if(G.from().line>=e.display.viewTo||G.to().line<e.display.viewFrom)continue;var V=G.empty();(V||e.options.showCursorWhenSelecting)&&bo(e,G.head,i),V||Xs(e,G,_)}return r}function bo(e,t,n){var r=br(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var _=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));_.style.display="",_.style.left=r.other.left+"px",_.style.top=r.other.top+"px",_.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ji(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,_=document.createDocumentFragment(),j=ro(e.display),G=j.left,V=Math.max(r.sizerWidth,sn(e)-r.sizer.offsetLeft)-j.right,$=i.direction=="ltr";function oe(Qe,nt,dt,lt){nt<0&&(nt=0),nt=Math.round(nt),lt=Math.round(lt),_.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Qe+`px;
top: `+nt+"px; width: "+(dt==null?V-Qe:dt)+`px;
height: `+(lt-nt)+"px"))}function de(Qe,nt,dt){var lt=st(i,Qe),gt=lt.text.length,Ot,Vt;function kt(Bt,ir){return ga(e,Be(Qe,Bt),"div",lt,ir)}function dr(Bt,ir,Yt){var Ht=po(e,lt,null,Bt),jt=ir=="ltr"==(Yt=="after")?"left":"right",Ut=Yt=="after"?Ht.begin:Ht.end-(/\s/.test(lt.text.charAt(Ht.end-1))?2:1);return kt(Ut,jt)[jt]}var nr=Xe(lt,i.direction);return Ve(nr,nt||0,dt==null?gt:dt,function(Bt,ir,Yt,Ht){var jt=Yt=="ltr",Ut=kt(Bt,jt?"left":"right"),ar=kt(ir-1,jt?"right":"left"),zn=nt==null&&Bt==0,Qr=dt==null&&ir==gt,Jt=Ht==0,Lr=!nr||Ht==nr.length-1;if(ar.top-Ut.top<=3){var Xt=($?zn:Qr)&&Jt,Xa=($?Qr:zn)&&Lr,Ir=Xt?G:(jt?Ut:ar).left,pn=Xa?V:(jt?ar:Ut).right;oe(Ir,Ut.top,pn-Ir,Ut.bottom)}else{var gn,er,Gn,Ya;jt?(gn=$&&zn&&Jt?G:Ut.left,er=$?V:dr(Bt,Yt,"before"),Gn=$?G:dr(ir,Yt,"after"),Ya=$&&Qr&&Lr?V:ar.right):(gn=$?dr(Bt,Yt,"before"):G,er=!$&&zn&&Jt?V:Ut.right,Gn=!$&&Qr&&Lr?G:ar.left,Ya=$?dr(ir,Yt,"after"):V),oe(gn,Ut.top,er-gn,Ut.bottom),Ut.bottom<ar.top&&oe(G,Ut.bottom,null,ar.top),oe(Gn,ar.top,Ya-Gn,ar.bottom)}(!Ot||ji(Ut,Ot)<0)&&(Ot=Ut),ji(ar,Ot)<0&&(Ot=ar),(!Vt||ji(Ut,Vt)<0)&&(Vt=Ut),ji(ar,Vt)<0&&(Vt=ar)}),{start:Ot,end:Vt}}var Se=t.from(),xe=t.to();if(Se.line==xe.line)de(Se.line,Se.ch,xe.ch);else{var ke=st(i,Se.line),Fe=st(i,xe.line),ze=$t(ke)==$t(Fe),$e=de(Se.line,Se.ch,ze?ke.text.length+1:null).end,tt=de(xe.line,ze?0:null,xe.ch).start;ze&&($e.top<tt.top-2?(oe($e.right,$e.top,null,$e.bottom),oe(G,tt.top,tt.left,tt.bottom)):oe($e.right,$e.top,tt.left-$e.right,$e.bottom)),$e.bottom<tt.top&&oe(G,$e.bottom,null,tt.top)}n.appendChild(_)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Pn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),wa(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Pn(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Oe(e,"focus",e,t),e.state.focused=!0,U(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),R&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Pn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Oe(e,"blur",e,t),e.state.focused=!1,p(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],_=e.options.lineWrapping,j=void 0,G=0;if(i.hidden)continue;if(B&&k<8){var V=i.node.offsetTop+i.node.offsetHeight;j=V-n,n=V}else{var $=i.node.getBoundingClientRect();j=$.bottom-$.top,!_&&i.text.firstChild&&(G=i.text.firstChild.getBoundingClientRect().right-$.left-1)}var oe=i.line.height-j;if((oe>.005||oe<-.005)&&(cr(i.line,j),To(i.line),i.rest))for(var de=0;de<i.rest.length;de++)To(i.rest[de]);if(G>e.display.sizerWidth){var Se=Math.ceil(G/Rn(e.display));Se>e.display.maxLineLength&&(e.display.maxLineLength=Se,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function To(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Hi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Fi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,_=wr(t,r),j=wr(t,i);if(n&&n.ensure){var G=n.ensure.from.line,V=n.ensure.to.line;G<_?(_=G,j=wr(t,lr(st(t,G))+e.wrapper.clientHeight)):Math.min(V,t.lastLine())>=j&&(_=wr(t,lr(st(t,V))-e.wrapper.clientHeight),j=V)}return{from:_,to:Math.max(j,_+1)}}function Ys(e,t){if(Ue(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!x){var _=a("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Fi(e.display))+`px;
height: `+(t.bottom-t.top+Cr(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(_),_.scrollIntoView(i),e.display.lineSpace.removeChild(_)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Be(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Be(t.line,t.ch+1,"before"):t);for(var _=0;_<5;_++){var j=!1,G=br(e,t),V=!n||n==t?G:br(e,n);i={left:Math.min(G.left,V.left),top:Math.min(G.top,V.top)-r,right:Math.max(G.left,V.left),bottom:Math.max(G.bottom,V.bottom)+r};var $=_a(e,i),oe=e.doc.scrollTop,de=e.doc.scrollLeft;if($.scrollTop!=null&&(ai(e,$.scrollTop),Math.abs(e.doc.scrollTop-oe)>1&&(j=!0)),$.scrollLeft!=null&&(cn(e,$.scrollLeft),Math.abs(e.doc.scrollLeft-de)>1&&(j=!0)),!j)break}return i}function Qs(e,t){var n=_a(e,t);n.scrollTop!=null&&ai(e,n.scrollTop),n.scrollLeft!=null&&cn(e,n.scrollLeft)}function _a(e,t){var n=e.display,r=On(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,_=ha(e),j={};t.bottom-t.top>_&&(t.bottom=t.top+_);var G=e.doc.height+fa(n),V=t.top<r,$=t.bottom>G-r;if(t.top<i)j.scrollTop=V?0:t.top;else if(t.bottom>i+_){var oe=Math.min(t.top,($?G:t.bottom)-_);oe!=i&&(j.scrollTop=oe)}var de=e.options.fixedGutter?0:n.gutters.offsetWidth,Se=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-de,xe=sn(e)-n.gutters.offsetWidth,ke=t.right-t.left>xe;return ke&&(t.right=t.left+xe),t.left<10?j.scrollLeft=0:t.left<Se?j.scrollLeft=Math.max(0,t.left+de-(ke?0:10)):t.right>xe+Se-3&&(j.scrollLeft=t.right+(ke?0:10)-xe),j}function Ca(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Mn(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ii(e,t,n){(t!=null||n!=null)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ho(e,t.from),r=ho(e,t.to);So(e,n,r,t.margin)}}function So(e,t,n,r){var i=_a(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});ii(e,i.scrollLeft,i.scrollTop)}function ai(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||La(e,{top:t}),wo(e,t,!0),L&&La(e),li(e,100)}function wo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function cn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Do(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function oi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Cr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var fn=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ce(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ce(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};fn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var _=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+_)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},fn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},fn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},fn.prototype.zeroWidthHack=function(){var e=u&&!w?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new X,this.disableVert=new X},fn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),_=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);_!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},fn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var si=function(){};si.prototype.update=function(){return{bottom:0,right:0}},si.prototype.setScrollLeft=function(){},si.prototype.setScrollTop=function(){},si.prototype.clear=function(){};function kn(e,t){t||(t=oi(e));var n=e.display.barWidth,r=e.display.barHeight;_o(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Wi(e),_o(e,oi(e)),n=e.display.barWidth,r=e.display.barHeight}function _o(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Co={native:fn,null:si};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&p(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Co[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ce(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?cn(e,t):ai(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function hn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},bt(e.curOp)}function mn(e){var t=e.curOp;t&&_t(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var _=0;_<t.length;_++)nl(t[_]);for(var j=0;j<t.length;j++)il(t[j])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Rr(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new zi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Wi(t),e.barMeasure=oi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Cr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-sn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&cn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==D();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&kn(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Eo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Lo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&wo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&cn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,mt(r,e.scrollToPos.from),mt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var _=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(_)for(var G=0;G<_.length;++G)_[G].lines.length||Oe(_[G],"hide");if(j)for(var V=0;V<j.length;++V)j[V].lines.length&&Oe(j[V],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Oe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ur(e,t){if(e.curOp)return t();hn(e);try{return t()}finally{mn(e)}}function zt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);hn(e);try{return t.apply(e,arguments)}finally{mn(e)}}}function qt(e){return function(){if(this.curOp)return e.apply(this,arguments);hn(this);try{return e.apply(this,arguments)}finally{mn(this)}}}function Gt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);hn(t);try{return e.apply(this,arguments)}finally{mn(t)}}}function li(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Ke(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(_){if(r.line>=e.display.viewFrom){var j=_.styles,G=_.text.length>e.options.maxHighlightLength?mr(t.mode,r.state):null,V=Ai(e,_,r,!0);G&&(r.state=G),_.styles=V.styles;var $=_.styleClasses,oe=V.classes;oe?_.styleClasses=oe:$&&(_.styleClasses=null);for(var de=!j||j.length!=_.styles.length||$!=oe&&(!$||!oe||$.bgClass!=oe.bgClass||$.textClass!=oe.textClass),Se=0;!de&&Se<j.length;++Se)de=j[Se]!=_.styles[Se];de&&i.push(r.line),_.stateAfter=r.save(),r.nextLine()}else _.text.length<=e.options.maxHighlightLength&&$n(e,_.text,r),_.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return li(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ur(e,function(){for(var _=0;_<i.length;_++)Kr(e,i[_],"text")})}var zi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Hi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=sn(e),this.force=n,this.dims=Ea(e),this.events=[]};zi.prototype.signal=function(e,t){ce(e,t)&&this.events.push(arguments)},zi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Oe.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Cr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Cr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=D();if(!t||!h(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&h(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==D())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&h(document.body,e.anchorNode)&&h(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Aa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return zr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&vo(e)==0)return!1;Oo(e)&&(zr(e),t.dims=Ea(e));var i=r.first+r.size,_=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<_&&_-n.viewFrom<20&&(_=Math.max(r.first,n.viewFrom)),n.viewTo>j&&n.viewTo-j<20&&(j=Math.min(i,n.viewTo)),pr&&(_=Wr(e.doc,_),j=Ii(e.doc,j));var G=_!=n.viewFrom||j!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,_,j),n.viewOffset=lr(st(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var V=vo(e);if(!G&&V==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var $=sl(e);return V>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),V>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll($),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,G&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,li(e,400)),n.updateLineNumbers=null,!0}function Lo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==sn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+fa(e.display)-ha(e),n.top)}),t.visible=Hi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hi(e.display,e.doc,n));if(!Aa(e,t))break;Wi(e);var i=oi(e);ni(e),kn(e,i),Oa(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function La(e,t){var n=new zi(e,t);if(Aa(e,n)){Wi(e),Lo(e,n);var r=oi(e);ni(e),kn(e,r),Oa(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,_=r.lineDiv,j=_.firstChild;function G(ke){var Fe=ke.nextSibling;return R&&u&&e.display.currentWheelTarget==ke?ke.style.display="none":ke.parentNode.removeChild(ke),Fe}for(var V=r.view,$=r.viewFrom,oe=0;oe<V.length;oe++){var de=V[oe];if(!de.hidden)if(!de.node||de.node.parentNode!=_){var Se=Us(e,de,$,n);_.insertBefore(Se,j)}else{for(;j!=de.node;)j=G(j);var xe=i&&t!=null&&t<=$&&de.lineNumber;de.changes&&(te(de.changes,"gutter")>-1&&(xe=!1),Ja(e,de,$,n)),xe&&(c(de.lineNumber),de.lineNumber.appendChild(document.createTextNode(yn(e.options,$)))),j=de.node.nextSibling}$+=de.size}for(;j;)j=G(j)}function Da(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Cr(e)+"px"}function Do(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,_=r+"px",j=0;j<n.length;j++)if(!n[j].hidden){e.options.fixedGutter&&(n[j].gutter&&(n[j].gutter.style.left=_),n[j].gutterBackground&&(n[j].gutterBackground.style.left=_));var G=n[j].alignable;if(G)for(var V=0;V<G.length;V++)G[V].style.left=_}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Oo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=yn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),_=i.firstChild.offsetWidth,j=i.offsetWidth-_;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(_,r.lineGutter.offsetWidth-j)+1,r.lineNumWidth=r.lineNumInnerWidth+j,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Da(e.display),!0}return!1}function Ra(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var _=e[i],j=null;if(typeof _!="string"&&(j=_.style,_=_.className),_=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:_,style:j})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Ro(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],_=i.className,j=i.style,G=t.appendChild(a("div",null,"CodeMirror-gutter "+_));j&&(G.style.cssText=j),_=="CodeMirror-linenumbers"&&(e.lineGutter=G,G.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Da(e)}function ui(e){Ro(e.display),tr(e),Do(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=T("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=T("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var _=T("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[_],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+ae+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!R&&!(L&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Ra(r.gutters,r.lineNumbers),Ro(i),n.init(i)}var Gi=0,fr=null;B?fr=-.53:L?fr=15:m?fr=-.7:P&&(fr=-1/3);function Po(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Po(e);return t.x*=fr,t.y*=fr,t}function Mo(e,t){var n=Po(t),r=n.x,i=n.y,_=e.display,j=_.scroller,G=j.scrollWidth>j.clientWidth,V=j.scrollHeight>j.clientHeight;if(!(r&&G||i&&V))return;if(i&&u&&R){e:for(var $=t.target,oe=_.view;$!=j;$=$.parentNode)for(var de=0;de<oe.length;de++)if(oe[de].node==$){e.display.currentWheelTarget=$;break e}}if(r&&!L&&!b&&fr!=null){i&&V&&ai(e,Math.max(0,j.scrollTop+i*fr)),cn(e,Math.max(0,j.scrollLeft+r*fr)),(!i||i&&V)&&Y(t),_.wheelStartX=null;return}if(i&&fr!=null){var Se=i*fr,xe=e.doc.scrollTop,ke=xe+_.wrapper.clientHeight;Se<0?xe=Math.max(0,xe+Se-50):ke=Math.min(e.doc.height,ke+Se+50),La(e,{top:xe,bottom:ke})}Gi<20&&(_.wheelStartX==null?(_.wheelStartX=j.scrollLeft,_.wheelStartY=j.scrollTop,_.wheelDX=r,_.wheelDY=i,setTimeout(function(){if(_.wheelStartX==null)return;var Fe=j.scrollLeft-_.wheelStartX,ze=j.scrollTop-_.wheelStartY,$e=ze&&_.wheelDY&&ze/_.wheelDY||Fe&&_.wheelDX&&Fe/_.wheelDX;if(_.wheelStartX=_.wheelStartY=null,!$e)return;fr=(fr*Gi+$e)/(Gi+1),++Gi},200)):(_.wheelDX+=r,_.wheelDY+=i))}var hr=function(e,t){this.ranges=e,this.primIndex=t};hr.prototype.primary=function(){return this.ranges[this.primIndex]},hr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!qr(n.anchor,r.anchor)||!qr(n.head,r.head))return!1}return!0},hr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new wt(en(this.ranges[t].anchor),en(this.ranges[t].head));return new hr(e,this.primIndex)},hr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},hr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ft(t,r.from())>=0&&ft(e,r.to())<=0)return n}return-1};var wt=function(e,t){this.anchor=e,this.head=t};wt.prototype.from=function(){return bn(this.anchor,this.head)},wt.prototype.to=function(){return tn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Er(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Se,xe){return ft(Se.from(),xe.from())}),n=te(t,i);for(var _=1;_<t.length;_++){var j=t[_],G=t[_-1],V=ft(G.to(),j.from());if(r&&!j.empty()?V>0:V>=0){var $=bn(G.from(),j.from()),oe=tn(G.to(),j.to()),de=G.empty()?j.from()==j.head:G.from()==G.head;_<=n&&--n,t.splice(--_,2,new wt(de?oe:$,de?$:oe))}}return new hr(t,n)}function Gr(e,t){return new hr([new wt(e,t||e)],0)}function Vr(e){return e.text?Be(e.from.line+e.text.length-1,Q(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ko(e,t){if(ft(e,t.from)<0)return e;if(ft(e,t.to)<=0)return Vr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Vr(t).ch-t.to.ch),Be(n,r)}function Pa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new wt(ko(i.anchor,t),ko(i.head,t)))}return Er(e.cm,n,e.sel.primIndex)}function Io(e,t,n){return e.line==t.line?Be(n.line,e.ch-t.ch+n.ch):Be(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Be(e.first,0),_=i,j=0;j<t.length;j++){var G=t[j],V=Io(G.from,i,_),$=Io(Vr(G),i,_);if(i=G.to,_=$,n=="around"){var oe=e.sel.ranges[j],de=ft(oe.head,oe.anchor)<0;r[j]=new wt(de?$:V,de?V:$)}else r[j]=new wt(V,V)}return new hr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Tr(e.options,e.doc.modeOption),di(e)}function di(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,li(e,100),e.state.modeGen++,e.curOp&&tr(e)}function Uo(e,t){return t.from.ch==0&&t.to.ch==0&&Q(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ka(e,t,n,r){function i(tt){return n?n[tt]:null}function _(tt,Qe,nt){la(tt,Qe,nt,r),Lt(tt,"change",tt,t)}function j(tt,Qe){for(var nt=[],dt=tt;dt<Qe;++dt)nt.push(new Hr($[dt],i(dt),r));return nt}var G=t.from,V=t.to,$=t.text,oe=st(e,G.line),de=st(e,V.line),Se=Q($),xe=i($.length-1),ke=V.line-G.line;if(t.full)e.insert(0,j(0,$.length)),e.remove($.length,e.size-$.length);else if(Uo(e,t)){var Fe=j(0,$.length-1);_(de,de.text,xe),ke&&e.remove(G.line,ke),Fe.length&&e.insert(G.line,Fe)}else if(oe==de)if($.length==1)_(oe,oe.text.slice(0,G.ch)+Se+oe.text.slice(V.ch),xe);else{var ze=j(1,$.length-1);ze.push(new Hr(Se+oe.text.slice(V.ch),xe,r)),_(oe,oe.text.slice(0,G.ch)+$[0],i(0)),e.insert(G.line+1,ze)}else if($.length==1)_(oe,oe.text.slice(0,G.ch)+$[0]+de.text.slice(V.ch),i(0)),e.remove(G.line+1,ke);else{_(oe,oe.text.slice(0,G.ch)+$[0],i(0)),_(de,Se+de.text.slice(V.ch),xe);var $e=j(1,$.length-1);ke>1&&e.remove(G.line+1,ke-1),e.insert(G.line+1,$e)}Lt(e,"change",e,t)}function Xr(e,t,n){function r(i,_,j){if(i.linked)for(var G=0;G<i.linked.length;++G){var V=i.linked[G];if(V.doc==_)continue;var $=j&&V.sharedHist;if(n&&!$)continue;t(V.doc,$),r(V.doc,i,$)}}r(e,null,!0)}function Fo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ta(e),Ma(e),No(e),e.options.lineWrapping||Rr(e),e.options.mode=t.modeOption,tr(e)}function No(e){(e.doc.direction=="rtl"?U:p)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){ur(e,function(){No(e),tr(e)})}function Vi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ia(e,t){var n={from:en(t.from),to:Vr(t),text:Sr(e,t.from,t.to)};return Wo(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return Wo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=Q(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Bo(e.done),Q(e.done);if(e.done.length&&!Q(e.done).ranges)return Q(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Q(e.done)}function jo(e,t,n,r){var i=e.history;i.undone.length=0;var _=+new Date,j,G;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>_-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=ml(i,i.lastOp==r)))G=Q(j.changes),ft(t.from,t.to)==0&&ft(t.from,G.to)==0?G.to=Vr(t):j.changes.push(Ia(e,t));else{var V=Q(i.done);for((!V||!V.ranges)&&Xi(e.sel,i.done),j={changes:[Ia(e,t)],generation:i.generation},i.done.push(j);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=_,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,G||Oe(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,_=r&&r.origin;n==i.lastSelOp||_&&i.lastSelOrigin==_&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==_||pl(e,_,Q(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=_,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function Xi(e,t){var n=Q(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],_=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((i||(i=t["spans_"+e.id]={}))[_]=j.markedSpans),++_})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Ho(e,t){var n=yl(e,t),r=Or(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var _=n[i],j=r[i];if(_&&j){e:for(var G=0;G<j.length;++G){for(var V=j[G],$=0;$<_.length;++$)if(_[$].marker==V.marker)continue e;_.push(V)}}else j&&(n[i]=j)}return n}function In(e,t,n){for(var r=[],i=0;i<e.length;++i){var _=e[i];if(_.ranges){r.push(n?hr.prototype.deepCopy.call(_):_);continue}var j=_.changes,G=[];r.push({changes:G});for(var V=0;V<j.length;++V){var $=j[V],oe=void 0;if(G.push({from:$.from,to:$.to,text:$.text}),t)for(var de in $)(oe=de.match(/^spans_(\d+)$/))&&(te(t,Number(oe[1]))>-1&&(Q(G)[de]=$[de],delete $[de]))}}return r}function Ua(e,t,n,r){if(r){var i=e.anchor;if(n){var _=ft(t,i)<0;_!=ft(n,i)<0?(i=t,t=n):_!=ft(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qt(e,new hr([Ua(e.sel.primary(),t,n,i)],0),r)}function Ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),_=0;_<e.sel.ranges.length;_++)r[_]=Ua(e.sel.ranges[_],t[_],null,i);var j=Er(e.cm,r,e.sel.primIndex);Qt(e,j,n)}function Fa(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Qt(e,Er(e.cm,i,e.sel.primIndex),r)}function zo(e,t,n,r){Qt(e,Gr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var _=0;_<i.length;_++)this.ranges[_]=new wt(mt(e,i[_].anchor),mt(e,i[_].head))},origin:n&&n.origin};return Oe(e,"beforeSelectionChange",e,r),e.cm&&Oe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Er(e.cm,r.ranges,r.ranges.length-1):t}function Go(e,t,n){var r=e.history.done,i=Q(r);i&&i.ranges?(r[r.length-1]=t,$i(e,t,n)):Qt(e,t,n)}function Qt(e,t,n){$i(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function $i(e,t,n){(ce(e,"beforeSelectionChange")||e.cm&&ce(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Mn(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),Lt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,n,r){for(var i,_=0;_<t.ranges.length;_++){var j=t.ranges[_],G=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[_],V=Qi(e,j.anchor,G&&G.anchor,n,r),$=Qi(e,j.head,G&&G.head,n,r);(i||V!=j.anchor||$!=j.head)&&(i||(i=t.ranges.slice(0,_)),i[_]=new wt(V,$))}return i?Er(e.cm,i,t.primIndex):t}function Un(e,t,n,r,i){var _=st(e,t.line);if(_.markedSpans)for(var j=0;j<_.markedSpans.length;++j){var G=_.markedSpans[j],V=G.marker,$="selectLeft"in V?!V.selectLeft:V.inclusiveLeft,oe="selectRight"in V?!V.selectRight:V.inclusiveRight;if((G.from==null||($?G.from<=t.ch:G.from<t.ch))&&(G.to==null||(oe?G.to>=t.ch:G.to>t.ch))){if(i&&(Oe(V,"beforeCursorEnter"),V.explicitlyCleared))if(_.markedSpans){--j;continue}else break;if(!V.atomic)continue;if(n){var de=V.find(r<0?1:-1),Se=void 0;if((r<0?oe:$)&&(de=$o(e,de,-r,de&&de.line==t.line?_:null)),de&&de.line==t.line&&(Se=ft(de,n))&&(r<0?Se<0:Se>0))return Un(e,de,t,r,i)}var xe=V.find(r<0?-1:1);return(r<0?$:oe)&&(xe=$o(e,xe,r,xe.line==t.line?_:null)),xe?Un(e,xe,t,r,i):null}}return t}function Qi(e,t,n,r,i){var _=r||1,j=Un(e,t,n,_,i)||!i&&Un(e,t,n,_,!0)||Un(e,t,n,-_,i)||!i&&Un(e,t,n,-_,!0);return j||(e.cantEdit=!0,Be(e.first,0))}function $o(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?mt(e,Be(t.line-1)):null:n>0&&t.ch==(r||st(e,t.line)).text.length?t.line<e.first+e.size-1?Be(t.line+1,0):null:new Be(t.line,t.ch+n)}function Qo(e){e.setSelection(Be(e.firstLine(),0),Be(e.lastLine()),pe)}function Jo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,_,j,G){i&&(r.from=mt(e,i)),_&&(r.to=mt(e,_)),j&&(r.text=j),G!==void 0&&(r.origin=G)}),Oe(e,"beforeChange",e,r),e.cm&&Oe(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Fn(e,t,n){if(e.cm){if(!e.cm.curOp)return zt(e.cm,Fn)(e,t,n);if(e.cm.state.suppressEdits)return}if((ce(e,"beforeChange")||e.cm&&ce(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Ri&&!n&&oa(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Zo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&ft(t.from,t.to)==0)return;var n=Pa(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),ci(e,t,n,Or(e,t));var r=[];Xr(e,function(i,_){!_&&te(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),ci(i,t,null,Or(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,_,j=e.sel,G=t=="undo"?i.done:i.undone,V=t=="undo"?i.undone:i.done,$=0;$<G.length&&!(_=G[$],n?_.ranges&&!_.equals(e.sel):!_.ranges);$++);if($==G.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(_=G.pop(),_.ranges){if(Xi(_,V),n&&!_.equals(e.sel)){Qt(e,_,{clearRedo:!1});return}j=_}else if(r){G.push(_);return}else break;var oe=[];Xi(j,V),V.push({changes:oe,generation:i.generation}),i.generation=_.generation||++i.maxGeneration;for(var de=ce(e,"beforeChange")||e.cm&&ce(e.cm,"beforeChange"),Se=function(Fe){var ze=_.changes[Fe];if(ze.origin=t,de&&!Jo(e,ze,!1))return G.length=0,{};oe.push(Ia(e,ze));var $e=Fe?Pa(e,ze):Q(G);ci(e,ze,$e,Ho(e,ze)),!Fe&&e.cm&&e.cm.scrollIntoView({from:ze.from,to:Vr(ze)});var tt=[];Xr(e,function(Qe,nt){!nt&&te(tt,Qe.history)==-1&&(rs(Qe.history,ze),tt.push(Qe.history)),ci(Qe,ze,null,Ho(Qe,ze))})},xe=_.changes.length-1;xe>=0;--xe){var ke=Se(xe);if(ke)return ke.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new hr(ie(e.sel.ranges,function(i){return new wt(Be(i.anchor.line+t,i.anchor.ch),Be(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Kr(e.cm,r,"gutter")}}function ci(e,t,n,r){if(e.cm&&!e.cm.curOp)return zt(e.cm,ci)(e,t,n,r);if(t.to.line<e.first){qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);qo(e,i),t={from:Be(e.first,0),to:Be(t.to.line+i,t.to.ch),text:[Q(t.text)],origin:t.origin}}var _=e.lastLine();t.to.line>_&&(t={from:t.from,to:Be(_,st(e,_).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sr(e,t.from,t.to),n||(n=Pa(e,t)),e.cm?El(e.cm,t,r):ka(e,t,r),$i(e,n,pe),e.cantEdit&&Qi(e,Be(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,_=t.from,j=t.to,G=!1,V=_.line;e.options.lineWrapping||(V=St($t(st(r,_.line))),r.iter(V,j.line+1,function(xe){if(xe==i.maxLine)return G=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),ka(r,t,n,go(e)),e.options.lineWrapping||(r.iter(V,_.line+t.text.length,function(xe){var ke=Ln(xe);ke>i.maxLineLength&&(i.maxLine=xe,i.maxLineLength=ke,i.maxLineChanged=!0,G=!1)}),G&&(e.curOp.updateMaxLine=!0)),Oi(r,_.line),li(e,400);var $=t.text.length-(j.line-_.line)-1;t.full?tr(e):_.line==j.line&&t.text.length==1&&!Uo(e.doc,t)?Kr(e,_.line,"text"):tr(e,_.line,j.line+1,$);var oe=ce(e,"changes"),de=ce(e,"change");if(de||oe){var Se={from:_,to:j,text:t.text,removed:t.removed,origin:t.origin};de&&Lt(e,"change",e,Se),oe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Se)}e.display.selForContextMenu=null}function Nn(e,t,n,r,i){var _;r||(r=n),ft(r,n)<0&&(_=[r,n],n=_[0],r=_[1]),typeof t=="string"&&(t=e.splitLines(t)),Fn(e,{from:n,to:r,text:t,origin:i})}function es(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,n,r){for(var i=0;i<e.length;++i){var _=e[i],j=!0;if(_.ranges){_.copied||(_=e[i]=_.deepCopy(),_.copied=!0);for(var G=0;G<_.ranges.length;G++)es(_.ranges[G].anchor,t,n,r),es(_.ranges[G].head,t,n,r);continue}for(var V=0;V<_.changes.length;++V){var $=_.changes[V];if(n<$.from.line)$.from=Be($.from.line+r,$.from.ch),$.to=Be($.to.line+r,$.to.ch);else if(t<=$.to.line){j=!1;break}}j||(e.splice(0,i+1),i=0)}}function rs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ts(e.done,n,r,i),ts(e.undone,n,r,i)}function fi(e,t,n,r){var i=t,_=t;return typeof t=="number"?_=st(e,Xn(e,t)):i=St(t),i==null?null:(r(_,i)&&e.cm&&Kr(e.cm,i,n),_)}function hi(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}hi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,ua(i),Lt(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function mi(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}mi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var _=Math.min(t,i-e),j=r.height;if(r.removeInner(e,_),this.height-=j-r.height,i==_&&(this.children.splice(n--,1),r.parent=null),(t-=_)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof hi))){var G=[];this.collapse(G),this.children=[new hi(G)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],_=i.chunkSize();if(e<=_){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var j=i.lines.length%25+25,G=j;G<i.lines.length;){var V=new hi(i.lines.slice(G,G+=25));i.height-=V.height,this.children.splice(++r,0,V),V.parent=this}i.lines=i.lines.slice(0,j),this.maybeSpill()}break}e-=_}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new mi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=te(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new mi(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],_=i.chunkSize();if(e<_){var j=Math.min(t,_-e);if(i.iterN(e,j,n))return!0;if((t-=j)==0)break;e=0}else e-=_}}};var pi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};pi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=St(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var _=ti(this);cr(n,Math.max(0,n.height-_)),e&&(ur(e,function(){ns(e,n,-_),Kr(e,r,"widget")}),Lt(e,"lineWidgetCleared",e,this,r))},pi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ti(this)-t;if(!i)return;yr(this.doc,r)||cr(r,r.height+i),n&&ur(n,function(){n.curOp.forceUpdate=!0,ns(n,r,i),Lt(n,"lineWidgetChanged",n,e,St(r))})},fe(pi);function ns(e,t,n){lr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ca(e,n)}function xl(e,t,n,r){var i=new pi(e,n,r),_=e.cm;return _&&i.noHScroll&&(_.display.alignWidgets=!0),fi(e,t,"widget",function(j){var G=j.widgets||(j.widgets=[]);if(i.insertAt==null?G.push(i):G.splice(Math.min(G.length-1,Math.max(0,i.insertAt)),0,i),i.line=j,_&&!yr(e,j)){var V=lr(j)<e.scrollTop;cr(j,j.height+ti(i)),V&&Ca(_,i.height),_.curOp.forceUpdate=!0}return!0}),_&&Lt(_,"lineWidgetAdded",_,i,typeof t=="number"?t:St(t)),i}var is=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&hn(e),ce(this,"clear")){var n=this.find();n&&Lt(this,"clear",n.from,n.to)}for(var r=null,i=null,_=0;_<this.lines.length;++_){var j=this.lines[_],G=Fr(j.markedSpans,this);e&&!this.collapsed?Kr(e,St(j),"text"):e&&(G.to!=null&&(i=St(j)),G.from!=null&&(r=St(j))),j.markedSpans=Nr(j.markedSpans,G),G.from==null&&this.collapsed&&!yr(this.doc,j)&&e&&cr(j,On(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var V=0;V<this.lines.length;++V){var $=$t(this.lines[V]),oe=Ln($);oe>e.display.maxLineLength&&(e.display.maxLine=$,e.display.maxLineLength=oe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&Lt(e,"markerCleared",e,this,r,i),t&&mn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var _=this.lines[i],j=Fr(_.markedSpans,this);if(j.from!=null&&(n=Be(t?_:St(_),j.from),e==-1))return n;if(j.to!=null&&(r=Be(t?_:St(_),j.to),e==1))return r}return n&&{from:n,to:r}},Yr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;ur(r,function(){var i=t.line,_=St(t.line),j=ma(r,_);if(j&&(so(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!yr(n.doc,i)&&n.height!=null){var G=n.height;n.height=null;var V=ti(n)-G;V&&cr(i,i.height+V)}Lt(r,"markerChanged",r,e)})},Yr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||te(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Yr.prototype.detachLine=function(e){if(this.lines.splice(te(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},fe(Yr);function Bn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return zt(e.cm,Bn)(e,t,n,r,i);var _=new Yr(e,i),j=ft(t,n);if(r&&I(r,_,!1),j>0||j==0&&_.clearWhenEmpty!==!1)return _;if(_.replacedWith&&(_.collapsed=!0,_.widgetNode=T("span",[_.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||_.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(_.widgetNode.insertLeft=!0)),_.collapsed){if(qn(e,t.line,t,n,_)||t.line!=n.line&&qn(e,n.line,t,n,_))throw new Error("Inserting collapsed marker partially overlapping an existing one");Pi()}_.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var G=t.line,V=e.cm,$;if(e.iter(G,n.line+1,function(de){V&&_.collapsed&&!V.options.lineWrapping&&$t(de)==V.display.maxLine&&($=!0),_.collapsed&&G!=t.line&&cr(de,0),Br(de,new xn(_,G==t.line?t.ch:null,G==n.line?n.ch:null)),++G}),_.collapsed&&e.iter(t.line,n.line+1,function(de){yr(e,de)&&cr(de,0)}),_.clearOnEnter&&Ce(_,"beforeCursorEnter",function(){return _.clear()}),_.readOnly&&(_r(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),_.collapsed&&(_.id=++is,_.atomic=!0),V){if($&&(V.curOp.updateMaxLine=!0),_.collapsed)tr(V,t.line,n.line+1);else if(_.className||_.startStyle||_.endStyle||_.css||_.attributes||_.title)for(var oe=t.line;oe<=n.line;oe++)Kr(V,oe,"text");_.atomic&&Xo(V.doc),Lt(V,"markerAdded",V,_)}return _}var gi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};gi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Lt(this,"clear")},gi.prototype.find=function(e,t){return this.primary.find(e,t)},fe(gi);function Tl(e,t,n,r,i){r=I(r),r.shared=!1;var _=[Bn(e,t,n,r,i)],j=_[0],G=r.widgetNode;return Xr(e,function(V){G&&(r.widgetNode=G.cloneNode(!0)),_.push(Bn(V,mt(V,t),mt(V,n),r,i));for(var $=0;$<V.linked.length;++$)if(V.linked[$].isParent)return;j=Q(_)}),new gi(_,j)}function as(e){return e.findMarks(Be(e.first,0),e.clipPos(Be(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),_=e.clipPos(i.from),j=e.clipPos(i.to);if(ft(_,j)){var G=Bn(e,_,j,r.primary,r.primary.type);r.markers.push(G),G.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],_=[i.primary.doc];Xr(i.primary.doc,function(V){return _.push(V)});for(var j=0;j<i.markers.length;j++){var G=i.markers[j];te(_,G.doc)==-1&&(G.parent=null,i.markers.splice(j--,1))}},n=0;n<e.length;n++)t(n)}var _l=0,rr=function(e,t,n,r,i){if(!(this instanceof rr))return new rr(e,t,n,r,i);n==null&&(n=0),mi.call(this,[new hi([new Hr("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var _=Be(n,0);this.sel=Gr(_),this.history=new Vi(null),this.id=++_l,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ka(this,{from:_,to:_,text:e}),Qt(this,Gr(_),pe)};rr.prototype=_e(mi.prototype,{constructor:rr,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Vn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Gt(function(e){var t=Be(this.first,0),n=this.first+this.size-1;Fn(this,{from:t,to:Be(n,st(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ii(this.cm,0,0),Qt(this,Gr(t),pe)}),replaceRange:function(e,t,n,r){t=mt(this,t),n=n?mt(this,n):t,Nn(this,e,t,n,r)},getRange:function(e,t,n){var r=Sr(this,mt(this,e),mt(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Zr(this,e))return st(this,e)},getLineNumber:function(e){return St(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=st(this,e)),$t(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return mt(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Gt(function(e,t,n){zo(this,mt(this,typeof e=="number"?Be(e,t||0):e),null,n)}),setSelection:Gt(function(e,t,n){zo(this,mt(this,e),mt(this,t||e),n)}),extendSelection:Gt(function(e,t,n){Yi(this,mt(this,e),t&&mt(this,t),n)}),extendSelections:Gt(function(e,t){Ko(this,Ci(this,e),t)}),extendSelectionsBy:Gt(function(e,t){var n=ie(this.sel.ranges,e);Ko(this,Ci(this,n),t)}),setSelections:Gt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new wt(mt(this,e[i].anchor),mt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Qt(this,Er(this.cm,r,t),n)}),addSelection:Gt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new wt(mt(this,e),mt(this,t||e))),Qt(this,Er(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Sr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Sr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Gt(function(e,t,n){for(var r=[],i=this.sel,_=0;_<i.ranges.length;_++){var j=i.ranges[_];r[_]={from:j.from(),to:j.to(),text:this.splitLines(e[_]),origin:n}}for(var G=t&&t!="end"&&fl(this,r,t),V=r.length-1;V>=0;V--)Fn(this,r[V]);G?Go(this,G):this.cm&&Mn(this.cm)}),undo:Gt(function(){Ji(this,"undo")}),redo:Gt(function(){Ji(this,"redo")}),undoSelection:Gt(function(){Ji(this,"undo",!0)}),redoSelection:Gt(function(){Ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Vi(this.history.maxGeneration),Xr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:In(this.history.done),undone:In(this.history.undone)}},setHistory:function(e){var t=this.history=new Vi(this.history.maxGeneration);t.done=In(e.done.slice(0),null,!0),t.undone=In(e.undone.slice(0),null,!0)},setGutterMarker:Gt(function(e,t,n){return fi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Le(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Gt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&fi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Le(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Zr(this,e))return null;if(t=e,e=st(this,e),!e)return null}else if(t=St(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Gt(function(e,t,n){return fi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(g(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Gt(function(e,t,n){return fi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",_=r[i];if(_)if(n==null)r[i]=null;else{var j=_.match(g(n));if(!j)return!1;var G=j.index+j[0].length;r[i]=_.slice(0,j.index)+(!j.index||G==_.length?"":" ")+_.slice(G)||null}else return!1;return!0})}),addLineWidget:Gt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Bn(this,mt(this,e),mt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=mt(this,e),Bn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=mt(this,e);var t=[],n=st(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=mt(this,e),t=mt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(_){var j=_.markedSpans;if(j)for(var G=0;G<j.length;G++){var V=j[G];!(V.to!=null&&i==e.line&&e.ch>=V.to||V.from==null&&i!=e.line||V.from!=null&&i==t.line&&V.from>=t.ch)&&(!n||n(V.marker))&&r.push(V.marker.parent||V.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var _=i.text.length+r;if(_>e)return t=e,!0;e-=_,++n}),mt(this,Be(n,t))},indexFromPos:function(e){e=mt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new rr(Vn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new rr(Vn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,as(this)),r},unlinkDoc:function(e){if(e instanceof Pt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(as(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new Vi(null),e.history.done=In(this.history.done,r),e.history.undone=In(this.history.undone,r)}},iterLinkedDocs:function(e){Xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):at(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Gt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),rr.prototype.eachLine=rr.prototype.iter;var os=0;function Cl(e){var t=this;if(ss(t),Ue(t,e)||Mr(t.display,e))return;Y(e),B&&(os=+new Date);var n=un(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,_=Array(i),j=0,G=function(){++j==i&&zt(t,function(){n=mt(t.doc,n);var xe={from:n,to:n,text:t.doc.splitLines(_.filter(function(ke){return ke!=null}).join(t.doc.lineSeparator())),origin:"paste"};Fn(t.doc,xe),Go(t.doc,Gr(mt(t.doc,n),mt(t.doc,Vr(xe))))})()},V=function(xe,ke){if(t.options.allowDropFileTypes&&te(t.options.allowDropFileTypes,xe.type)==-1){G();return}var Fe=new FileReader;Fe.onerror=function(){return G()},Fe.onload=function(){var ze=Fe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(ze)){G();return}_[ke]=ze,G()},Fe.readAsText(xe)},$=0;$<r.length;$++)V(r[$],$);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var oe=e.dataTransfer.getData("Text");if(oe){var de;if(t.state.draggingText&&!t.state.draggingText.copy&&(de=t.listSelections()),$i(t.doc,Gr(n,n)),de)for(var Se=0;Se<de.length;++Se)Nn(t.doc,"",de[Se].anchor,de[Se].head,"drag");t.replaceSelection(oe,"around","paste"),t.display.input.focus()}}catch(xe){}}}function Al(e,t){if(B&&(!e.state.draggingText||+new Date-os<100)){le(t);return}if(Ue(e,t)||Mr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",b&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),b&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=un(e,t);if(!n)return;var r=document.createDocumentFragment();bo(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),l(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var _=0;_<n.length;_++)e(n[_])})}var us=!1;function Dl(){if(us)return;Ol(),us=!0}function Ol(){var e;Ce(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Rl)},100))}),Ce(window,"blur",function(){return ls(Pn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var $r={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},vi=0;vi<10;vi++)$r[vi+48]=$r[vi+96]=String(vi);for(var Zi=65;Zi<=90;Zi++)$r[Zi]=String.fromCharCode(Zi);for(var yi=1;yi<=12;yi++)$r[yi+111]=$r[yi+63235]="F"+yi;var kr={};kr.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},kr.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},kr.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},kr.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},kr.default=u?kr.macDefault:kr.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,_,j=0;j<t.length-1;j++){var G=t[j];if(/^(cmd|meta|m)$/i.test(G))_=!0;else if(/^a(lt)?$/i.test(G))n=!0;else if(/^(c|ctrl|control)$/i.test(G))r=!0;else if(/^s(hift)?$/i.test(G))i=!0;else throw new Error("Unrecognized modifier name: "+G)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),_&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=ie(n.split(" "),Pl),_=0;_<i.length;_++){var j=void 0,G=void 0;_==i.length-1?(G=i.join(" "),j=r):(G=i.slice(0,_+1).join(" "),j="...");var V=t[G];if(!V)t[G]=j;else if(V!=j)throw new Error("Inconsistent bindings for "+G)}delete e[n]}for(var $ in t)e[$]=t[$];return e}function jn(e,t,n,r){t=qi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return jn(e,t.fallthrough,n,r);for(var _=0;_<t.fallthrough.length;_++){var j=jn(e,t.fallthrough[_],n,r);if(j)return j}}}function ds(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(f?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(f?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function fs(e,t){if(b&&e.keyCode==34&&e.char)return!1;var n=$r[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),cs(n,e,t))}function qi(e){return typeof e=="string"?kr[e]:e}function Wn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var _=t(n[i]);r.length&&ft(_.from,Q(r).to)<=0;){var j=r.pop();if(ft(j.from,_.from)<0){_.from=j.from;break}}r.push(_)}ur(e,function(){for(var G=r.length-1;G>=0;G--)Nn(e.doc,"",r[G].from,r[G].to,"+delete");Mn(e)})}function Na(e,t,n){var r=De(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Na(e,t.ch,n);return r==null?null:new Be(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var _=Xe(n,t.doc.direction);if(_){var j=i<0?Q(_):_[0],G=i<0==(j.level==1),V=G?"after":"before",$;if(j.level>0||t.doc.direction=="rtl"){var oe=Dn(t,n);$=i<0?n.text.length-1:0;var de=Ar(t,oe,$).top;$=We(function(Se){return Ar(t,oe,Se).top==de},i<0==(j.level==1)?j.from:j.to-1,$),V=="before"&&($=Na(n,$,1))}else $=i<0?j.to:j.from;return new Be(r,$,V)}}return new Be(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=Xe(t,e.doc.direction);if(!i)return Ba(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var _=Ne(i,n.ch,n.sticky),j=i[_];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>n.ch:j.from<n.ch))return Ba(t,n,r);var G=function($e,tt){return Na(t,$e instanceof Be?$e.ch:$e,tt)},V,$=function($e){return e.options.lineWrapping?(V=V||Dn(e,t),po(e,t,V,$e)):{begin:0,end:t.text.length}},oe=$(n.sticky=="before"?G(n,-1):n.ch);if(e.doc.direction=="rtl"||j.level==1){var de=j.level==1==r<0,Se=G(n,de?1:-1);if(Se!=null&&(de?Se<=j.to&&Se<=oe.end:Se>=j.from&&Se>=oe.begin)){var xe=de?"before":"after";return new Be(n.line,Se,xe)}}var ke=function($e,tt,Qe){for(var nt=function(Ot,Vt){return Vt?new Be(n.line,G(Ot,1),"before"):new Be(n.line,Ot,"after")};$e>=0&&$e<i.length;$e+=tt){var dt=i[$e],lt=tt>0==(dt.level!=1),gt=lt?Qe.begin:G(Qe.end,-1);if(dt.from<=gt&&gt<dt.to)return nt(gt,lt);if(gt=lt?dt.from:G(dt.to,-1),Qe.begin<=gt&&gt<Qe.end)return nt(gt,lt)}},Fe=ke(_+r,r,oe);if(Fe)return Fe;var ze=r>0?oe.end:G(oe.begin,-1);return ze!=null&&!(r>0&&ze==t.text.length)&&(Fe=ke(r>0?0:i.length-1,r,$(ze)),Fe)?Fe:null}var bi={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),pe)},killLine:function(e){return Wn(e,function(t){if(t.empty()){var n=st(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Be(t.head.line+1,0)}:{from:t.head,to:Be(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Wn(e,function(t){return{from:Be(t.from().line,0),to:mt(e.doc,Be(t.to().line+1,0))}})},delLineLeft:function(e){return Wn(e,function(t){return{from:Be(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Wn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Wn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Be(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Be(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ms(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},se)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},se)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?ms(e,t.head):r},se)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var _=n[i].from(),j=H(e.getLine(_.line),_.ch,r);t.push(me(r-j%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ur(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,_=st(e.doc,i.line).text;if(_){if(i.ch==_.length&&(i=new Be(i.line,i.ch-1)),i.ch>0)i=new Be(i.line,i.ch+1),e.replaceRange(_.charAt(i.ch-1)+_.charAt(i.ch-2),Be(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var j=st(e.doc,i.line-1).text;j&&(i=new Be(i.line,1),e.replaceRange(_.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Be(i.line-1,j.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ur(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Mn(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var n=st(e.doc,t),r=$t(n);return r!=n&&(t=St(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=st(e.doc,t),r=jr(n);return r!=n&&(t=St(r)),ja(!0,e,n,t,-1)}function ms(e,t){var n=hs(e,t.line),r=st(e.doc,n.line),i=Xe(r,e.doc.direction);if(!i||i[0].level==0){var _=Math.max(n.ch,r.text.search(/\S/)),j=t.line==n.line&&t.ch<=_&&t.ch;return Be(n.line,j?0:_,n.sticky)}return n}function ea(e,t,n){if(typeof t=="string"&&(t=bi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=be}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=jn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&jn(t,e.options.extraKeys,n,e)||jn(t,e.options.keyMap,n,e)}var Fl=new X;function Ei(e,t,n,r){var i=e.state.keySeq;if(i){if(ds(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,i+" "+t,n,r))return!0}return ps(e,t,n,r)}function ps(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Lt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),Sa(e)),!!i}function gs(e,t){var n=fs(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ei(e,"Shift-"+n,t,function(r){return ea(e,r,!0)})||Ei(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):Ei(e,n,t,function(r){return ea(e,r)}):!1}function Nl(e,t,n){return Ei(e,"'"+n+"'",t,function(r){return ea(e,r,!0)})}var Wa=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=D(),Ue(t,e))return;B&&k<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=gs(t,e);b&&(Wa=r?n:null,!r&&n==88&&!xt&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!u&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;U(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(p(t,"CodeMirror-crosshair"),Ye(document,"keyup",n),Ye(document,"mouseover",n))}Ce(document,"keyup",n),Ce(document,"mouseover",n)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ue(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Mr(t.display,e)||Ue(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(b&&n==Wa){Wa=null,Y(e);return}if(b&&(!e.which||e.which<10)&&gs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Nl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&ft(t,this.pos)==0&&n==this.button};var xi,Ti;function Wl(e,t){var n=+new Date;return Ti&&Ti.compare(n,e,t)?(xi=Ti=null,"triple"):xi&&xi.compare(n,e,t)?(Ti=new Ha(n,e,t),xi=null,"double"):(xi=new Ha(n,e,t),Ti=null,"single")}function Es(e){var t=this,n=t.display;if(Ue(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Mr(n,e)){R||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=un(t,e),i=Re(e),_=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,_,e))return;i==1?r?zl(t,r,_,e):Te(e)==n.scroller&&Y(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(A?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,i){var _="Click";return r=="double"?_="Double"+_:r=="triple"&&(_="Triple"+_),_=(t==1?"Left":t==2?"Middle":"Right")+_,Ei(e,cs(_,i),i,function(j){if(typeof j=="string"&&(j=bi[j]),!j)return!1;var G=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),G=j(e,n)!=be}finally{e.state.suppressEdits=!1}return G})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var _=s?n.shiftKey&&n.metaKey:n.altKey;i.unit=_?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=u?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(u?n.altKey:n.ctrlKey)),i}function zl(e,t,n,r){B?setTimeout(M(Eo,e),0):e.curOp.focus=D();var i=Kl(e,n,r),_=e.doc.sel,j;e.options.dragDrop&&Me&&!e.isReadOnly()&&n=="single"&&(j=_.contains(t))>-1&&(ft((j=_.ranges[j]).from(),t)<0||t.xRel>0)&&(ft(j.to(),t)>0||t.xRel<0)?Gl(e,r,t,i):Vl(e,r,t,i)}function Gl(e,t,n,r){var i=e.display,_=!1,j=zt(e,function($){R&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ye(i.wrapper.ownerDocument,"mouseup",j),Ye(i.wrapper.ownerDocument,"mousemove",G),Ye(i.scroller,"dragstart",V),Ye(i.scroller,"drop",j),_||(Y($),r.addNew||Yi(e.doc,n,null,null,r.extend),R&&!P||B&&k==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),G=function($){_=_||Math.abs(t.clientX-$.clientX)+Math.abs(t.clientY-$.clientY)>=10},V=function(){return _=!0};R&&(i.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ce(i.wrapper.ownerDocument,"mouseup",j),Ce(i.wrapper.ownerDocument,"mousemove",G),Ce(i.scroller,"dragstart",V),Ce(i.scroller,"drop",j),xo(e),setTimeout(function(){return i.input.focus()},20)}function xs(e,t,n){if(n=="char")return new wt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new wt(Be(t.line,0),mt(e.doc,Be(t.line+1,0)));var r=n(e,t);return new wt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,_=e.doc;Y(t);var j,G,V=_.sel,$=V.ranges;if(r.addNew&&!r.extend?(G=_.sel.contains(n),G>-1?j=$[G]:j=new wt(n,n)):(j=_.sel.primary(),G=_.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new wt(n,n)),n=un(e,t,!0,!0),G=-1;else{var oe=xs(e,n,r.unit);r.extend?j=Ua(j,oe.anchor,oe.head,r.extend):j=oe}r.addNew?G==-1?(G=$.length,Qt(_,Er(e,$.concat([j]),G),{scroll:!1,origin:"*mouse"})):$.length>1&&$[G].empty()&&r.unit=="char"&&!r.extend?(Qt(_,Er(e,$.slice(0,G).concat($.slice(G+1)),0),{scroll:!1,origin:"*mouse"}),V=_.sel):Fa(_,G,j,ue):(G=0,Qt(_,new hr([j],0),ue),V=_.sel);var de=n;function Se(Qe){if(ft(de,Qe)==0)return;if(de=Qe,r.unit=="rectangle"){for(var nt=[],dt=e.options.tabSize,lt=H(st(_,n.line).text,n.ch,dt),gt=H(st(_,Qe.line).text,Qe.ch,dt),Ot=Math.min(lt,gt),Vt=Math.max(lt,gt),kt=Math.min(n.line,Qe.line),dr=Math.min(e.lastLine(),Math.max(n.line,Qe.line));kt<=dr;kt++){var nr=st(_,kt).text,Bt=he(nr,Ot,dt);Ot==Vt?nt.push(new wt(Be(kt,Bt),Be(kt,Bt))):nr.length>Bt&&nt.push(new wt(Be(kt,Bt),Be(kt,he(nr,Vt,dt))))}nt.length||nt.push(new wt(n,n)),Qt(_,Er(e,V.ranges.slice(0,G).concat(nt),G),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Qe)}else{var ir=j,Yt=xs(e,Qe,r.unit),Ht=ir.anchor,jt;ft(Yt.anchor,Ht)>0?(jt=Yt.head,Ht=bn(ir.from(),Yt.anchor)):(jt=Yt.anchor,Ht=tn(ir.to(),Yt.head));var Ut=V.ranges.slice(0);Ut[G]=Xl(e,new wt(mt(_,Ht),jt)),Qt(_,Er(e,Ut,G),ue)}}var xe=i.wrapper.getBoundingClientRect(),ke=0;function Fe(Qe){var nt=++ke,dt=un(e,Qe,!0,r.unit=="rectangle");if(!dt)return;if(ft(dt,de)!=0){e.curOp.focus=D(),Se(dt);var lt=Hi(i,_);(dt.line>=lt.to||dt.line<lt.from)&&setTimeout(zt(e,function(){ke==nt&&Fe(Qe)}),150)}else{var gt=Qe.clientY<xe.top?-20:Qe.clientY>xe.bottom?20:0;gt&&setTimeout(zt(e,function(){if(ke!=nt)return;i.scroller.scrollTop+=gt,Fe(Qe)}),50)}}function ze(Qe){e.state.selectingText=!1,ke=Infinity,Qe&&(Y(Qe),i.input.focus()),Ye(i.wrapper.ownerDocument,"mousemove",$e),Ye(i.wrapper.ownerDocument,"mouseup",tt),_.history.lastSelOrigin=null}var $e=zt(e,function(Qe){Qe.buttons===0||!Re(Qe)?ze(Qe):Fe(Qe)}),tt=zt(e,ze);e.state.selectingText=tt,Ce(i.wrapper.ownerDocument,"mousemove",$e),Ce(i.wrapper.ownerDocument,"mouseup",tt)}function Xl(e,t){var n=t.anchor,r=t.head,i=st(e.doc,n.line);if(ft(n,r)==0&&n.sticky==r.sticky)return t;var _=Xe(i);if(!_)return t;var j=Ne(_,n.ch,n.sticky),G=_[j];if(G.from!=n.ch&&G.to!=n.ch)return t;var V=j+(G.from==n.ch==(G.level!=1)?0:1);if(V==0||V==_.length)return t;var $;if(r.line!=n.line)$=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var oe=Ne(_,r.ch,r.sticky),de=oe-j||(r.ch-n.ch)*(G.level==1?-1:1);oe==V-1||oe==V?$=de<0:$=de>0}var Se=_[V+($?-1:0)],xe=$==(Se.level==1),ke=xe?Se.from:Se.to,Fe=xe?"after":"before";return n.ch==ke&&n.sticky==Fe?t:new wt(new Be(n.line,ke,Fe),r)}function Ts(e,t,n,r){var i,_;if(t.touches)i=t.touches[0].clientX,_=t.touches[0].clientY;else try{i=t.clientX,_=t.clientY}catch(Se){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Y(t);var j=e.display,G=j.lineDiv.getBoundingClientRect();if(_>G.bottom||!ce(e,n))return re(t);_-=G.top-j.viewOffset;for(var V=0;V<e.display.gutterSpecs.length;++V){var $=j.gutters.childNodes[V];if($&&$.getBoundingClientRect().right>=i){var oe=wr(e.doc,_),de=e.display.gutterSpecs[V];return Oe(e,n,e,oe,de.className,t),re(t)}}}function Ka(e,t){return Ts(e,t,"gutterClick",!0)}function Ss(e,t){if(Mr(e.display,t)||Yl(e,t))return;if(Ue(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return ce(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function ws(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ri(e)}var Hn={toString:function(){return"CodeMirror.Init"}},_s={},ta={};function $l(e){var t=e.optionHandlers;function n(r,i,_,j){e.defaults[r]=i,_&&(t[r]=j?function(G,V,$){$!=Hn&&_(G,V,$)}:_)}e.defineOption=n,e.Init=Hn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ma(r)},!0),n("indentUnit",2,Ma,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){di(r),ri(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var _=[],j=r.doc.first;r.doc.iter(function(V){for(var $=0;;){var oe=V.text.indexOf(i,$);if(oe==-1)break;$=oe+i.length,_.push(Be(j,oe))}j++});for(var G=_.length-1;G>=0;G--)Nn(r.doc,i,_[G],Be(_[G].line,_[G].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,_){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),_!=Hn&&r.refresh()}),n("specialCharPlaceholder",ot,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!C),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ws(r),ui(r)},!0),n("keyMap","default",function(r,i,_){var j=qi(i),G=_!=Hn&&qi(_);G&&G.detach&&G.detach(r,j),j.attach&&j.attach(r,G||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Ra(i,r.options.lineNumbers),ui(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return kn(r)},!0),n("scrollbarStyle","native",function(r){Ao(r),kn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Ra(r.options.gutters,i),ui(r)},!0),n("firstLineNumber",1,ui,!0),n("lineNumberFormatter",function(r){return r},ui,!0),n("showCursorWhenSelecting",!1,ni,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Pn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ni,!0),n("singleCursorHeightPerLine",!0,ni,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,di,!0),n("addModeClass",!1,di,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,di,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Hn;if(!t!=!r){var i=e.display.dragFunctions,_=t?Ce:Ye;_(e.display.scroller,"dragstart",i.start),_(e.display.scroller,"dragenter",i.enter),_(e.display.scroller,"dragover",i.over),_(e.display.scroller,"dragleave",i.leave),_(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(p(e.display.wrapper,"CodeMirror-wrap"),Rr(e)),Ta(e),tr(e),ri(e),setTimeout(function(){return kn(e)},100)}function Pt(e,t){var n=this;if(!(this instanceof Pt))return new Pt(e,t);this.options=t=t?I(t):{},I(_s,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Pt.inputStyles[t.inputStyle](this),_=this.display=new dl(e,r,i,t);_.wrapper.CodeMirror=this,ws(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new X,keySeq:null,specialChars:null},t.autofocus&&!o&&_.input.focus(),B&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Dl(),hn(this),this.curOp.forceUpdate=!0,Fo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&wa(n)},20):Pn(this);for(var j in ta)ta.hasOwnProperty(j)&&ta[j](this,t[j],Hn);Oo(this),t.finishInit&&t.finishInit(this);for(var G=0;G<za.length;++G)za[G](this);mn(this),R&&t.lineWrapping&&getComputedStyle(_.lineDiv).textRendering=="optimizelegibility"&&(_.lineDiv.style.textRendering="auto")}Pt.defaults=_s,Pt.optionHandlers=ta;function Zl(e){var t=e.display;Ce(t.scroller,"mousedown",zt(e,Es)),B&&k<11?Ce(t.scroller,"dblclick",zt(e,function(V){if(Ue(e,V))return;var $=un(e,V);if(!$||Ka(e,V)||Mr(e.display,V))return;Y(V);var oe=e.findWordAt($);Yi(e.doc,oe.anchor,oe.head)})):Ce(t.scroller,"dblclick",function(V){return Ue(e,V)||Y(V)}),Ce(t.scroller,"contextmenu",function(V){return Ss(e,V)}),Ce(t.input.getField(),"contextmenu",function(V){t.scroller.contains(V.target)||Ss(e,V)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function _(V){if(V.touches.length!=1)return!1;var $=V.touches[0];return $.radiusX<=1&&$.radiusY<=1}function j(V,$){if($.left==null)return!0;var oe=$.left-V.left,de=$.top-V.top;return oe*oe+de*de>20*20}Ce(t.scroller,"touchstart",function(V){if(!Ue(e,V)&&!_(V)&&!Ka(e,V)){t.input.ensurePolled(),clearTimeout(n);var $=+new Date;t.activeTouch={start:$,moved:!1,prev:$-r.end<=300?r:null},V.touches.length==1&&(t.activeTouch.left=V.touches[0].pageX,t.activeTouch.top=V.touches[0].pageY)}}),Ce(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ce(t.scroller,"touchend",function(V){var $=t.activeTouch;if($&&!Mr(t,V)&&$.left!=null&&!$.moved&&new Date-$.start<300){var oe=e.coordsChar(t.activeTouch,"page"),de;!$.prev||j($,$.prev)?de=new wt(oe,oe):!$.prev.prev||j($,$.prev.prev)?de=e.findWordAt(oe):de=new wt(Be(oe.line,0),mt(e.doc,Be(oe.line+1,0))),e.setSelection(de.anchor,de.head),e.focus(),Y(V)}i()}),Ce(t.scroller,"touchcancel",i),Ce(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ai(e,t.scroller.scrollTop),cn(e,t.scroller.scrollLeft,!0),Oe(e,"scroll",e))}),Ce(t.scroller,"mousewheel",function(V){return Mo(e,V)}),Ce(t.scroller,"DOMMouseScroll",function(V){return Mo(e,V)}),Ce(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(V){Ue(e,V)||le(V)},over:function(V){Ue(e,V)||(Ll(e,V),le(V))},start:function(V){return Al(e,V)},drop:zt(e,Cl),leave:function(V){Ue(e,V)||ss(e)}};var G=t.input.getField();Ce(G,"keyup",function(V){return ys.call(e,V)}),Ce(G,"keydown",zt(e,vs)),Ce(G,"keypress",zt(e,bs)),Ce(G,"focus",function(V){return wa(e,V)}),Ce(G,"blur",function(V){return Pn(e,V)})}var za=[];Pt.defineInitHook=function(e){return za.push(e)};function Si(e,t,n,r){var i=e.doc,_;n==null&&(n="add"),n=="smart"&&(i.mode.indent?_=Ke(e,t).state:n="prev");var j=e.options.tabSize,G=st(i,t),V=H(G.text,null,j);G.stateAfter&&(G.stateAfter=null);var $=G.text.match(/^\s*/)[0],oe;if(!r&&!/\S/.test(G.text))oe=0,n="not";else if(n=="smart"&&(oe=i.mode.indent(_,G.text.slice($.length),G.text),oe==be||oe>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?oe=H(st(i,t-1).text,null,j):oe=0:n=="add"?oe=V+e.options.indentUnit:n=="subtract"?oe=V-e.options.indentUnit:typeof n=="number"&&(oe=V+n),oe=Math.max(0,oe);var de="",Se=0;if(e.options.indentWithTabs)for(var xe=Math.floor(oe/j);xe;--xe)Se+=j,de+=" ";if(Se<oe&&(de+=me(oe-Se)),de!=$)return Nn(i,de,Be(t,0),Be(t,$.length),"+input"),G.stateAfter=null,!0;for(var ke=0;ke<i.sel.ranges.length;ke++){var Fe=i.sel.ranges[ke];if(Fe.head.line==t&&Fe.head.ch<$.length){var ze=Be(t,$.length);Fa(i,ke,new wt(ze,ze));break}}}var xr=null;function ra(e){xr=e}function Ga(e,t,n,r,i){var _=e.doc;e.display.shift=!1,r||(r=_.sel);var j=+new Date-200,G=i=="paste"||e.state.pasteIncoming>j,V=at(t),$=null;if(G&&r.ranges.length>1)if(xr&&xr.text.join(`
`)==t){if(r.ranges.length%xr.text.length==0){$=[];for(var oe=0;oe<xr.text.length;oe++)$.push(_.splitLines(xr.text[oe]))}}else V.length==r.ranges.length&&e.options.pasteLinesPerSelection&&($=ie(V,function($e){return[$e]}));for(var de=e.curOp.updateInput,Se=r.ranges.length-1;Se>=0;Se--){var xe=r.ranges[Se],ke=xe.from(),Fe=xe.to();xe.empty()&&(n&&n>0?ke=Be(ke.line,ke.ch-n):e.state.overwrite&&!G?Fe=Be(Fe.line,Math.min(st(_,Fe.line).text.length,Fe.ch+Q(V).length)):G&&xr&&xr.lineWise&&xr.text.join(`
`)==V.join(`
`)&&(ke=Fe=Be(ke.line,0)));var ze={from:ke,to:Fe,text:$?$[Se%$.length]:V,origin:i||(G?"paste":e.state.cutIncoming>j?"cut":"+input")};Fn(e.doc,ze),Lt(e,"inputRead",e,ze)}t&&!G&&As(e,t),Mn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=de),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Cs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&ur(t,function(){return Ga(t,n,0,null,"paste")}),!0}function As(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var _=e.getModeAt(i.head),j=!1;if(_.electricChars){for(var G=0;G<_.electricChars.length;G++)if(t.indexOf(_.electricChars.charAt(G))>-1){j=Si(e,i.head.line,"smart");break}}else _.electricInput&&(_.electricInput.test(st(e.doc,i.head.line).text.slice(0,i.head.ch))&&(j=Si(e,i.head.line,"smart")));j&&Lt(e,"electricInput",e,i.head.line)}}function Ls(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,_={anchor:Be(i,0),head:Be(i+1,0)};n.push(_),t.push(e.getRange(_.anchor,_.head))}return{text:t,ranges:n}}function Ds(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Os(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return R?e.style.width="1000px":e.setAttribute("wrap","off"),v&&(e.style.border="1px solid black"),Ds(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var _=this.options,j=_[r];if(_[r]==i&&r!="mode")return;_[r]=i,t.hasOwnProperty(r)&&zt(this,t[r])(this,i,j),Oe(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](qi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,_=0;_<i.length;++_)if(i[_]==r||i[_].name==r)return i.splice(_,1),!0},addOverlay:qt(function(r,i){var _=r.token?r:e.getMode(this.options,r);if(_.startState)throw new Error("Overlays may not be stateful.");ee(this.state.overlays,{mode:_,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(j){return j.priority}),this.state.modeGen++,tr(this)}),removeOverlay:qt(function(r){for(var i=this.state.overlays,_=0;_<i.length;++_){var j=i[_].modeSpec;if(j==r||typeof r=="string"&&j.name==r){i.splice(_,1),this.state.modeGen++,tr(this);return}}}),indentLine:qt(function(r,i,_){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Zr(this.doc,r)&&Si(this,r,i,_)}),indentSelection:qt(function(r){for(var i=this.doc.sel.ranges,_=-1,j=0;j<i.length;j++){var G=i[j];if(G.empty())G.head.line>_&&(Si(this,G.head.line,r,!0),_=G.head.line,j==this.doc.sel.primIndex&&Mn(this));else{var V=G.from(),$=G.to(),oe=Math.max(_,V.line);_=Math.min(this.lastLine(),$.line-($.ch?0:1))+1;for(var de=oe;de<_;++de)Si(this,de,r);var Se=this.doc.sel.ranges;V.ch==0&&i.length==Se.length&&Se[j].from().ch>0&&Fa(this.doc,j,new wt(V,Se[j].to()),pe)}}}),getTokenAt:function(r,i){return Ur(this,r,i)},getLineTokens:function(r,i){return Ur(this,Be(r),i,!0)},getTokenTypeAt:function(r){r=mt(this.doc,r);var i=Yn(this,st(this.doc,r.line)),_=0,j=(i.length-1)/2,G=r.ch,V;if(G==0)V=i[2];else for(;;){var $=_+j>>1;if(($?i[$*2-1]:0)>=G)j=$;else if(i[$*2+1]<G)_=$+1;else{V=i[$*2+2];break}}var oe=V?V.indexOf("overlay "):-1;return oe<0?V:oe==0?null:V.slice(0,oe-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var _=[];if(!n.hasOwnProperty(i))return _;var j=n[i],G=this.getModeAt(r);if(typeof G[i]=="string")j[G[i]]&&_.push(j[G[i]]);else if(G[i])for(var V=0;V<G[i].length;V++){var $=j[G[i][V]];$&&_.push($)}else G.helperType&&j[G.helperType]?_.push(j[G.helperType]):j[G.name]&&_.push(j[G.name]);for(var oe=0;oe<j._global.length;oe++){var de=j._global[oe];de.pred(G,this)&&te(_,de.val)==-1&&_.push(de.val)}return _},getStateAfter:function(r,i){var _=this.doc;return r=Xn(_,r==null?_.first+_.size-1:r),Ke(this,r+1,i).state},cursorCoords:function(r,i){var _,j=this.doc.sel.primary();return r==null?_=j.head:typeof r=="object"?_=mt(this.doc,r):_=r?j.from():j.to(),br(this,_,i||"page")},charCoords:function(r,i){return ga(this,mt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=fo(this,r,i||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,i){return r=fo(this,{top:r,left:0},i||"page").top,wr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,_){var j=!1,G;if(typeof r=="number"){var V=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>V&&(r=V,j=!0),G=st(this.doc,r)}else G=r;return Ni(this,G,{top:0,left:0},i||"page",_||j).top+(j?this.doc.height-lr(G):0)},defaultTextHeight:function(){return On(this.display)},defaultCharWidth:function(){return Rn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,_,j,G){var V=this.display;r=br(this,mt(this.doc,r));var $=r.bottom,oe=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),V.sizer.appendChild(i),j=="over")$=r.top;else if(j=="above"||j=="near"){var de=Math.max(V.wrapper.clientHeight,this.doc.height),Se=Math.max(V.sizer.clientWidth,V.lineSpace.clientWidth);(j=="above"||r.bottom+i.offsetHeight>de)&&r.top>i.offsetHeight?$=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=de&&($=r.bottom),oe+i.offsetWidth>Se&&(oe=Se-i.offsetWidth)}i.style.top=$+"px",i.style.left=i.style.right="",G=="right"?(oe=V.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(G=="left"?oe=0:G=="middle"&&(oe=(V.sizer.clientWidth-i.offsetWidth)/2),i.style.left=oe+"px"),_&&Qs(this,{left:oe,top:$,right:oe+i.offsetWidth,bottom:$+i.offsetHeight})},triggerOnKeyDown:qt(vs),triggerOnKeyPress:qt(bs),triggerOnKeyUp:ys,triggerOnMouseDown:qt(Es),execCommand:function(r){if(bi.hasOwnProperty(r))return bi[r].call(null,this)},triggerElectric:qt(function(r){As(this,r)}),findPosH:function(r,i,_,j){var G=1;i<0&&(G=-1,i=-i);for(var V=mt(this.doc,r),$=0;$<i&&!(V=Va(this.doc,V,G,_,j),V.hitSide);++$);return V},moveH:qt(function(r,i){var _=this;this.extendSelectionsBy(function(j){return _.display.shift||_.doc.extend||j.empty()?Va(_.doc,j.head,r,i,_.options.rtlMoveVisually):r<0?j.from():j.to()},se)}),deleteH:qt(function(r,i){var _=this.doc.sel,j=this.doc;_.somethingSelected()?j.replaceSelection("",null,"+delete"):Wn(this,function(G){var V=Va(j,G.head,r,i,!1);return r<0?{from:V,to:G.head}:{from:G.head,to:V}})}),findPosV:function(r,i,_,j){var G=1,V=j;i<0&&(G=-1,i=-i);for(var $=mt(this.doc,r),oe=0;oe<i;++oe){var de=br(this,$,"div");if(V==null?V=de.left:de.left=V,$=Rs(this,de,G,_),$.hitSide)break}return $},moveV:qt(function(r,i){var _=this,j=this.doc,G=[],V=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(oe){if(V)return r<0?oe.from():oe.to();var de=br(_,oe.head,"div");oe.goalColumn!=null&&(de.left=oe.goalColumn),G.push(de.left);var Se=Rs(_,de,r,i);return i=="page"&&oe==j.sel.primary()&&Ca(_,ga(_,Se,"div").top-de.top),Se},se),G.length)for(var $=0;$<j.sel.ranges.length;$++)j.sel.ranges[$].goalColumn=G[$]}),findWordAt:function(r){var i=this.doc,_=st(i,r.line).text,j=r.ch,G=r.ch;if(_){var V=this.getHelper(r,"wordChars");(r.sticky=="before"||G==_.length)&&j?--j:++G;for(var $=_.charAt(j),oe=we($,V)?function(de){return we(de,V)}:/\s/.test($)?function(de){return/\s/.test(de)}:function(de){return!/\s/.test(de)&&!we(de)};j>0&&oe(_.charAt(j-1));)--j;for(;G<_.length&&oe(_.charAt(G));)++G}return new wt(Be(r.line,j),Be(r.line,G))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):p(this.display.cursorDiv,"CodeMirror-overwrite"),Oe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:qt(function(r,i){ii(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Cr(this)-this.display.barHeight,width:r.scrollWidth-Cr(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:sn(this)}},scrollIntoView:qt(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Be(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Js(this,r):So(this,r.from,r.to,r.margin)}),setSize:qt(function(r,i){var _=this,j=function(V){return typeof V=="number"||/^\d+$/.test(String(V))?V+"px":V};r!=null&&(this.display.wrapper.style.width=j(r)),i!=null&&(this.display.wrapper.style.height=j(i)),this.options.lineWrapping&&lo(this);var G=this.display.viewFrom;this.doc.iter(G,this.display.viewTo,function(V){if(V.widgets){for(var $=0;$<V.widgets.length;$++)if(V.widgets[$].noHScroll){Kr(_,G,"widget");break}}++G}),this.curOp.forceUpdate=!0,Oe(this,"refresh",this)}),operation:function(r){return ur(this,r)},startOperation:function(){return hn(this)},endOperation:function(){return mn(this)},refresh:qt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ri(this),ii(this,this.doc.scrollLeft,this.doc.scrollTop),Da(this.display),(r==null||Math.abs(r-On(this.display))>.5||this.options.lineWrapping)&&Ta(this),Oe(this,"refresh",this)}),swapDoc:qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Fo(this,r),ri(this),this.display.input.reset(),ii(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Lt(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},fe(e),e.registerHelper=function(r,i,_){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=_},e.registerGlobalHelper=function(r,i,_,j){e.registerHelper(r,i,j),n[r]._global.push({pred:_,val:j})}}function Va(e,t,n,r,i){var _=t,j=n,G=st(e,t.line),V=i&&e.direction=="rtl"?-n:n;function $(){var tt=t.line+V;return tt<e.first||tt>=e.first+e.size?!1:(t=new Be(tt,t.ch,t.sticky),G=st(e,tt))}function oe(tt){var Qe;if(r=="codepoint"){var nt=G.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(nt)?Qe=null:Qe=new Be(t.line,Math.max(0,Math.min(G.text.length,t.ch+n*(nt>=55296&&nt<56320?2:1))),-n)}else i?Qe=kl(e.cm,G,t,n):Qe=Ba(G,t,n);if(Qe==null)if(!tt&&$())t=ja(i,e.cm,G,t.line,V);else return!1;else t=Qe;return!0}if(r=="char"||r=="codepoint")oe();else if(r=="column")oe(!0);else if(r=="word"||r=="group")for(var de=null,Se=r=="group",xe=e.cm&&e.cm.getHelper(t,"wordChars"),ke=!0;!(n<0&&!oe(!ke));ke=!1){var Fe=G.text.charAt(t.ch)||`
`,ze=we(Fe,xe)?"w":Se&&Fe==`
`?"n":!Se||/\s/.test(Fe)?null:"p";if(Se&&!ke&&!ze&&(ze="s"),de&&de!=ze){n<0&&(n=1,oe(),t.sticky="after");break}if(ze&&(de=ze),n>0&&!oe(!ke))break}var $e=Qi(e,t,_,j,!0);return qr(_,$e)&&($e.hitSide=!0),$e}function Rs(e,t,n,r){var i=e.doc,_=t.left,j;if(r=="page"){var G=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),V=Math.max(G-.5*On(e.display),3);j=(n>0?t.bottom:t.top)+n*V}else r=="line"&&(j=n>0?t.bottom+3:t.top-3);for(var $;!($=ya(e,_,j),!$.outside);){if(n<0?j<=0:j>=i.height){$.hitSide=!0;break}j+=n*5}return $}var Ct=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new X,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ct.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Ds(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function _(G){for(var V=G.target;V;V=V.parentNode){if(V==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(V.className))break}return!1}Ce(i,"paste",function(G){if(!_(G)||Ue(r,G)||Cs(G,r))return;k<=11&&setTimeout(zt(r,function(){return t.updateFromDOM()}),20)}),Ce(i,"compositionstart",function(G){t.composing={data:G.data,done:!1}}),Ce(i,"compositionupdate",function(G){t.composing||(t.composing={data:G.data,done:!1})}),Ce(i,"compositionend",function(G){t.composing&&(G.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ce(i,"touchstart",function(){return n.forceCompositionEnd()}),Ce(i,"input",function(){t.composing||t.readFromDOMSoon()});function j(G){if(!_(G)||Ue(r,G))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),G.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var V=Ls(r);ra({lineWise:!0,text:V.text}),G.type=="cut"&&r.operation(function(){r.setSelections(V.ranges,0,pe),r.replaceSelection("",null,"cut")})}else return;if(G.clipboardData){G.clipboardData.clearData();var $=xr.text.join(`
`);if(G.clipboardData.setData("Text",$),G.clipboardData.getData("Text")==$){G.preventDefault();return}}var oe=Os(),de=oe.firstChild;r.display.lineSpace.insertBefore(oe,r.display.lineSpace.firstChild),de.value=xr.text.join(`
`);var Se=document.activeElement;W(de),setTimeout(function(){r.display.lineSpace.removeChild(oe),Se.focus(),Se==i&&n.showPrimarySelection()},50)}Ce(i,"copy",j),Ce(i,"cut",j)},Ct.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ct.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Ct.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Ct.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ct.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var _=na(t,e.anchorNode,e.anchorOffset),j=na(t,e.focusNode,e.focusOffset);if(_&&!_.bad&&j&&!j.bad&&ft(bn(_,j),r)==0&&ft(tn(_,j),i)==0)return;var G=t.display.view,V=r.line>=t.display.viewFrom&&Ps(t,r)||{node:G[0].measure.map[2],offset:0},$=i.line<t.display.viewTo&&Ps(t,i);if(!$){var oe=G[G.length-1].measure,de=oe.maps?oe.maps[oe.maps.length-1]:oe.map;$={node:de[de.length-1],offset:de[de.length-2]-de[de.length-3]}}if(!V||!$){e.removeAllRanges();return}var Se=e.rangeCount&&e.getRangeAt(0),xe;try{xe=y(V.node,V.offset,$.offset,$.node)}catch(ke){}xe&&(!L&&t.state.focused?(e.collapse(V.node,V.offset),xe.collapsed||(e.removeAllRanges(),e.addRange(xe))):(e.removeAllRanges(),e.addRange(xe)),Se&&e.anchorNode==null?e.addRange(Se):L&&this.startGracePeriod()),this.rememberSelection()},Ct.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Ct.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},Ct.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ct.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return h(this.div,t)},Ct.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ct.prototype.blur=function(){this.div.blur()},Ct.prototype.getField=function(){return this.div},Ct.prototype.supportsTouch=function(){return!0},Ct.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():ur(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Ct.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ct.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&m&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=na(t,e.anchorNode,e.anchorOffset),r=na(t,e.focusNode,e.focusOffset);n&&r&&ur(t,function(){Qt(t.doc,Gr(n,r),pe),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Ct.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Be(r.line-1,st(e.doc,r.line-1).length)),i.ch==st(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Be(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var _,j,G;r.line==t.viewFrom||(_=dn(e,r.line))==0?(j=St(t.view[0].line),G=t.view[0].node):(j=St(t.view[_].line),G=t.view[_-1].node.nextSibling);var V=dn(e,i.line),$,oe;if(V==t.view.length-1?($=t.viewTo-1,oe=t.lineDiv.lastChild):($=St(t.view[V+1].line)-1,oe=t.view[V+1].node.previousSibling),!G)return!1;for(var de=e.doc.splitLines(tu(e,G,oe,j,$)),Se=Sr(e.doc,Be(j,0),Be($,st(e.doc,$).text.length));de.length>1&&Se.length>1;)if(Q(de)==Q(Se))de.pop(),Se.pop(),$--;else if(de[0]==Se[0])de.shift(),Se.shift(),j++;else break;for(var xe=0,ke=0,Fe=de[0],ze=Se[0],$e=Math.min(Fe.length,ze.length);xe<$e&&Fe.charCodeAt(xe)==ze.charCodeAt(xe);)++xe;for(var tt=Q(de),Qe=Q(Se),nt=Math.min(tt.length-(de.length==1?xe:0),Qe.length-(Se.length==1?xe:0));ke<nt&&tt.charCodeAt(tt.length-ke-1)==Qe.charCodeAt(Qe.length-ke-1);)++ke;if(de.length==1&&Se.length==1&&j==r.line)for(;xe&&xe>r.ch&&tt.charCodeAt(tt.length-ke-1)==Qe.charCodeAt(Qe.length-ke-1);)xe--,ke++;de[de.length-1]=tt.slice(0,tt.length-ke).replace(/^\u200b+/,""),de[0]=de[0].slice(xe).replace(/\u200b+$/,"");var dt=Be(j,xe),lt=Be($,Se.length?Q(Se).length-ke:0);if(de.length>1||de[0]||ft(dt,lt))return Nn(e.doc,de,dt,lt,"+input"),!0},Ct.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ct.prototype.reset=function(){this.forceCompositionEnd()},Ct.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Ct.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Ct.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ur(this.cm,function(){return tr(e.cm)})},Ct.prototype.setUneditable=function(e){e.contentEditable="false"},Ct.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||zt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Ct.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ct.prototype.onContextMenu=function(){},Ct.prototype.resetPosition=function(){},Ct.prototype.needsContentAttribute=!0;function Ps(e,t){var n=ma(e,t.line);if(!n||n.hidden)return null;var r=st(e.doc,t.line),i=no(n,r,t.line),_=Xe(r,e.doc.direction),j="left";if(_){var G=Ne(_,t.ch);j=G%2?"right":"left"}var V=oo(i.map,t.ch,j);return V.offset=V.collapse=="right"?V.end:V.start,V}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Kn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var _="",j=!1,G=e.doc.lineSeparator(),V=!1;function $(xe){return function(ke){return ke.id==xe}}function oe(){j&&(_+=G,V&&(_+=G),j=V=!1)}function de(xe){xe&&(oe(),_+=xe)}function Se(xe){if(xe.nodeType==1){var ke=xe.getAttribute("cm-text");if(ke){de(ke);return}var Fe=xe.getAttribute("cm-marker"),ze;if(Fe){var $e=e.findMarks(Be(r,0),Be(i+1,0),$(+Fe));$e.length&&(ze=$e[0].find(0))&&de(Sr(e.doc,ze.from,ze.to).join(G));return}if(xe.getAttribute("contenteditable")=="false")return;var tt=/^(pre|div|p|li|table|br)$/i.test(xe.nodeName);if(!/^br$/i.test(xe.nodeName)&&xe.textContent.length==0)return;tt&&oe();for(var Qe=0;Qe<xe.childNodes.length;Qe++)Se(xe.childNodes[Qe]);/^(pre|p)$/i.test(xe.nodeName)&&(V=!0),tt&&(j=!0)}else xe.nodeType==3&&de(xe.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Se(t),t==n);)t=t.nextSibling,V=!1;return _}function na(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Kn(e.clipPos(Be(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var _=e.display.view[i];if(_.node==r)return ru(_,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!h(r,t))return Kn(Be(St(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var _=e.rest?Q(e.rest):e.line;return Kn(Be(St(_),_.text.length),i)}var j=t.nodeType==3?t:null,G=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,n&&(n=j.nodeValue.length));G.parentNode!=r;)G=G.parentNode;var V=e.measure,$=V.maps;function oe(ze,$e,tt){for(var Qe=-1;Qe<($?$.length:0);Qe++)for(var nt=Qe<0?V.map:$[Qe],dt=0;dt<nt.length;dt+=3){var lt=nt[dt+2];if(lt==ze||lt==$e){var gt=St(Qe<0?e.line:e.rest[Qe]),Ot=nt[dt]+tt;return(tt<0||lt!=ze)&&(Ot=nt[dt+(tt?1:0)]),Be(gt,Ot)}}}var de=oe(j,G,n);if(de)return Kn(de,i);for(var Se=G.nextSibling,xe=j?j.nodeValue.length-n:0;Se;Se=Se.nextSibling){if(de=oe(Se,Se.firstChild,0),de)return Kn(Be(de.line,de.ch-xe),i);xe+=Se.textContent.length}for(var ke=G.previousSibling,Fe=n;ke;ke=ke.previousSibling){if(de=oe(ke,ke.firstChild,-1),de)return Kn(Be(de.line,de.ch+Fe),i);Fe+=ke.textContent.length}}var Ft=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new X,this.hasSelection=!1,this.composing=null};Ft.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),v&&(i.style.width="0px"),Ce(i,"input",function(){B&&k>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ce(i,"paste",function(j){if(Ue(r,j)||Cs(j,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function _(j){if(Ue(r,j))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var G=Ls(r);ra({lineWise:!0,text:G.text}),j.type=="cut"?r.setSelections(G.ranges,null,pe):(n.prevInput="",i.value=G.text.join(`
`),W(i))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}Ce(i,"cut",_),Ce(i,"copy",_),Ce(e.scroller,"paste",function(j){if(Mr(e,j)||Ue(r,j))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var G=new Event("paste");G.clipboardData=j.clipboardData,i.dispatchEvent(G)}),Ce(e.lineSpace,"selectstart",function(j){Mr(e,j)||Y(j)}),Ce(i,"compositionstart",function(){var j=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:j,range:r.markText(j,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ce(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ft.prototype.createField=function(e){this.wrapper=Os(),this.textarea=this.wrapper.firstChild},Ft.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ft.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var i=br(e,n.sel.primary().head,"div"),_=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+j.top-_.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+j.left-_.left))}return r},Ft.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ft.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),B&&k>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&k>=9&&(this.hasSelection=null))},Ft.prototype.getField=function(){return this.textarea},Ft.prototype.supportsTouch=function(){return!1},Ft.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ft.prototype.blur=function(){this.textarea.blur()},Ft.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ft.prototype.receivedFocus=function(){this.slowPoll()},Ft.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ft.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Ft.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||rt(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&k>=9&&this.hasSelection===i||u&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var _=i.charCodeAt(0);if(_==8203&&!r&&(r="\u200B"),_==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,G=Math.min(r.length,i.length);j<G&&r.charCodeAt(j)==i.charCodeAt(j);)++j;return ur(t,function(){Ga(t,i.slice(j),r.length-j,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ft.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ft.prototype.onKeyPress=function(){B&&k>=9&&(this.hasSelection=null),this.fastPoll()},Ft.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var _=un(n,e),j=r.scroller.scrollTop;if(!_||b)return;var G=n.options.resetSelectionOnContextMenu;G&&n.doc.sel.contains(_)==-1&&zt(n,Qt)(n.doc,Gr(_),pe);var V=i.style.cssText,$=t.wrapper.style.cssText,oe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-oe.top-5)+"px; left: "+(e.clientX-oe.left-5)+`px;
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var de;R&&(de=window.scrollY),r.input.focus(),R&&window.scrollTo(null,de),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=xe,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Se(){if(i.selectionStart!=null){var Fe=n.somethingSelected(),ze="\u200B"+(Fe?i.value:"");i.value="\u21DA",i.value=ze,t.prevInput=Fe?"":"\u200B",i.selectionStart=1,i.selectionEnd=ze.length,r.selForContextMenu=n.doc.sel}}function xe(){if(t.contextMenuPending!=xe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=$,i.style.cssText=V,B&&k<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),i.selectionStart!=null){(!B||B&&k<9)&&Se();var Fe=0,ze=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?zt(n,Qo)(n):Fe++<10?r.detectingSelectAll=setTimeout(ze,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(ze,200)}}if(B&&k>=9&&Se(),A){le(e);var ke=function(){Ye(window,"mouseup",ke),setTimeout(xe,20)};Ce(window,"mouseup",ke)}else setTimeout(xe,50)},Ft.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ft.prototype.setUneditable=function(){},Ft.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?I(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=D();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=G.getValue()}var i;if(e.form&&(Ce(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var _=e.form;i=_.submit;try{var j=_.submit=function(){r(),_.submit=i,_.submit(),_.submit=j}}catch(V){}}t.finishInit=function(V){V.save=r,V.getTextArea=function(){return e},V.toTextArea=function(){V.toTextArea=isNaN,r(),e.parentNode.removeChild(V.getWrapperElement()),e.style.display="",e.form&&(Ye(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var G=Pt(function(V){return e.parentNode.insertBefore(V,e.nextSibling)},t);return G}function iu(e){e.off=Ye,e.on=Ce,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=at,e.countColumn=H,e.findColumn=he,e.isWordChar=ye,e.Pass=be,e.signal=Oe,e.Line=Hr,e.changeEnd=Vr,e.scrollbarModel=Co,e.Pos=Be,e.cmpPos=ft,e.modes=At,e.mimeModes=pt,e.resolveMode=Nt,e.getMode=Tr,e.modeExtensions=vr,e.extendMode=wi,e.copyState=mr,e.startState=Jr,e.innerMode=vn,e.commands=bi,e.keyMap=kr,e.keyName=fs,e.isModifierKey=ds,e.lookupKey=jn,e.normalizeKeyMap=Ml,e.StringStream=Mt,e.SharedTextMarker=gi,e.TextMarker=Yr,e.LineWidget=pi,e.e_preventDefault=Y,e.e_stopPropagation=Z,e.e_stop=le,e.addClass=U,e.contains=h,e.rmClass=p,e.keyNames=$r}$l(Pt),ql(Pt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in rr.prototype)rr.prototype.hasOwnProperty(ia)&&te(au,ia)<0&&(Pt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[ia]));return fe(rr),Pt.inputStyles={textarea:Ft,contenteditable:Ct},Pt.defineMode=function(e){!Pt.defaults.mode&&e!="null"&&(Pt.defaults.mode=e),or.apply(this,arguments)},Pt.defineMIME=Kt,Pt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Pt.defineMIME("text/plain","null"),Pt.defineExtension=function(e,t){Pt.prototype[e]=t},Pt.defineDocExtension=function(e,t){rr.prototype[e]=t},Pt.fromTextArea=nu,iu(Pt),Pt.version="5.58.2",Pt})},Y1PL:function(qe,He,J){"use strict";J.r(He),J.d(He,"ResizableTextArea",function(){return te});var q=J("wx14"),z=J("1OyB"),L=J("vuIU"),K=J("Ji7U"),F=J("LK+K"),O=J("cDcd"),B=J("VTBJ"),k=J("rePB"),R=J("Zm9Q"),S=J("Kwbf"),m=J("c+Xe"),b=J("m+aA"),P=J("bdgK"),w=new Map;function x(pe){pe.forEach(function(ue){var se,he=ue.target;(se=w.get(he))===null||se===void 0||se.forEach(function(ne){return ne(he)})})}var v=new P.default(x),d=null,o=null;function u(pe,ue){w.has(pe)||(w.set(pe,new Set),v.observe(pe)),w.get(pe).add(ue)}function s(pe,ue){w.has(pe)&&(w.get(pe).delete(ue),w.get(pe).size||(v.unobserve(pe),w.delete(pe)))}var C=function(pe){Object(K.a)(se,pe);var ue=Object(F.a)(se);function se(){return Object(z.a)(this,se),ue.apply(this,arguments)}return Object(L.a)(se,[{key:"render",value:function(){return this.props.children}}]),se}(O.Component),E=O.createContext(null);function f(pe){var ue=pe.children,se=pe.onBatchResize,he=O.useRef(0),ne=O.useRef([]),me=O.useContext(E),Q=O.useCallback(function(ie,ee,Ee){he.current+=1;var _e=he.current;ne.current.push({size:ie,element:ee,data:Ee}),Promise.resolve().then(function(){_e===he.current&&(se==null||se(ne.current),ne.current=[])}),me==null||me(ie,ee,Ee)},[se,me]);return O.createElement(E.Provider,{value:Q},ue)}function A(pe){var ue=pe.children,se=pe.disabled,he=O.useRef(null),ne=O.useRef(null),me=O.useContext(E),Q=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ie=O.isValidElement(ue)&&Object(m.c)(ue),ee=ie?ue.ref:null,Ee=O.useMemo(function(){return Object(m.a)(ee,he)},[ee,he]),_e=O.useRef(pe);_e.current=pe;var ve=O.useCallback(function(ye){var we=_e.current,Le=we.onResize,Ie=we.data,Ae=ye.getBoundingClientRect(),De=Ae.width,We=Ae.height,Ve=ye.offsetWidth,je=ye.offsetHeight,Ne=Math.floor(De),Je=Math.floor(We);if(Q.current.width!==Ne||Q.current.height!==Je||Q.current.offsetWidth!==Ve||Q.current.offsetHeight!==je){var Xe={width:Ne,height:Je,offsetWidth:Ve,offsetHeight:je};Q.current=Xe;var Ze=Ve===Math.round(De)?De:Ve,Ce=je===Math.round(We)?We:je,et=Object(B.a)(Object(B.a)({},Xe),{},{offsetWidth:Ze,offsetHeight:Ce});me==null||me(et,ye,Ie),Le&&Promise.resolve().then(function(){Le(et,ye)})}},[]);return O.useEffect(function(){var ye=Object(b.a)(he.current)||Object(b.a)(ne.current);return ye&&!se&&u(ye,ve),function(){return s(ye,ve)}},[he.current,se]),O.createElement(C,{ref:ne},ie?O.cloneElement(ue,{ref:Ee}):ue)}var g="rc-observer-key";function p(pe){var ue=pe.children,se=Object(R.a)(ue);return se.map(function(he,ne){var me=(he==null?void 0:he.key)||"".concat(g,"-").concat(ne);return O.createElement(A,Object(q.a)({},pe,{key:me}),he)})}p.Collection=f;var c=p,l=J("bT9E"),a=J("TSYQ"),T=J.n(a),y=`
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
`,h=["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"],D={},U;function N(pe){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,se=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(ue&&D[se])return D[se];var he=window.getComputedStyle(pe),ne=he.getPropertyValue("box-sizing")||he.getPropertyValue("-moz-box-sizing")||he.getPropertyValue("-webkit-box-sizing"),me=parseFloat(he.getPropertyValue("padding-bottom"))+parseFloat(he.getPropertyValue("padding-top")),Q=parseFloat(he.getPropertyValue("border-bottom-width"))+parseFloat(he.getPropertyValue("border-top-width")),ie=h.map(function(Ee){return"".concat(Ee,":").concat(he.getPropertyValue(Ee))}).join(";"),ee={sizingStyle:ie,paddingSize:me,borderSize:Q,boxSizing:ne};return ue&&se&&(D[se]=ee),ee}function W(pe){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,he=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),pe.getAttribute("wrap")?U.setAttribute("wrap",pe.getAttribute("wrap")):U.removeAttribute("wrap");var ne=N(pe,ue),me=ne.paddingSize,Q=ne.borderSize,ie=ne.boxSizing,ee=ne.sizingStyle;U.setAttribute("style","".concat(ee,";").concat(y)),U.value=pe.value||pe.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,_e=Number.MAX_SAFE_INTEGER,ve=U.scrollHeight,ye;if(ie==="border-box"?ve+=Q:ie==="content-box"&&(ve-=me),se!==null||he!==null){U.value=" ";var we=U.scrollHeight-me;se!==null&&(Ee=we*se,ie==="border-box"&&(Ee=Ee+me+Q),ve=Math.max(Ee,ve)),he!==null&&(_e=we*he,ie==="border-box"&&(_e=_e+me+Q),ye=ve>_e?"":"hidden",ve=Math.min(_e,ve))}return{height:ve,minHeight:Ee,maxHeight:_e,overflowY:ye,resize:"none"}}var M=J("Gytx"),I=J.n(M),H;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})(H||(H={}));var X=function(pe){Object(K.a)(se,pe);var ue=Object(F.a)(se);function se(he){var ne;return Object(z.a)(this,se),ne=ue.call(this,he),ne.nextFrameActionId=void 0,ne.resizeFrameId=void 0,ne.textArea=void 0,ne.saveTextArea=function(me){ne.textArea=me},ne.handleResize=function(me){var Q=ne.state.resizeStatus,ie=ne.props,ee=ie.autoSize,Ee=ie.onResize;if(Q!==H.NONE)return;typeof Ee=="function"&&Ee(me),ee&&ne.resizeOnNextFrame()},ne.resizeOnNextFrame=function(){cancelAnimationFrame(ne.nextFrameActionId),ne.nextFrameActionId=requestAnimationFrame(ne.resizeTextarea)},ne.resizeTextarea=function(){var me=ne.props.autoSize;if(!me||!ne.textArea)return;var Q=me.minRows,ie=me.maxRows,ee=W(ne.textArea,!1,Q,ie);ne.setState({textareaStyles:ee,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ne.resizeFrameId),ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:H.RESIZED},function(){ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:H.NONE}),ne.fixFirefoxAutoScroll()})})})})},ne.renderTextArea=function(){var me=ne.props,Q=me.prefixCls,ie=Q===void 0?"rc-textarea":Q,ee=me.autoSize,Ee=me.onResize,_e=me.className,ve=me.disabled,ye=ne.state,we=ye.textareaStyles,Le=ye.resizeStatus,Ie=Object(l.a)(ne.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ae=T()(ie,_e,Object(k.a)({},"".concat(ie,"-disabled"),ve));"value"in Ie&&(Ie.value=Ie.value||"");var De=Object(B.a)(Object(B.a)(Object(B.a)({},ne.props.style),we),Le===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(c,{onResize:ne.handleResize,disabled:!(ee||Ee)},O.createElement("textarea",Object(q.a)({},Ie,{className:Ae,style:De,ref:ne.saveTextArea})))},ne.state={textareaStyles:{},resizeStatus:H.NONE},ne}return Object(L.a)(se,[{key:"componentDidUpdate",value:function(ne){(ne.value!==this.props.value||!I()(ne.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 ne=this.textArea.selectionStart,me=this.textArea.selectionEnd;this.textArea.setSelectionRange(ne,me)}}catch(Q){}}},{key:"render",value:function(){return this.renderTextArea()}}]),se}(O.Component),te=X,ae=function(pe){Object(K.a)(se,pe);var ue=Object(F.a)(se);function se(he){var ne;Object(z.a)(this,se),ne=ue.call(this,he),ne.resizableTextArea=void 0,ne.focus=function(){ne.resizableTextArea.textArea.focus()},ne.saveTextArea=function(Q){ne.resizableTextArea=Q},ne.handleChange=function(Q){var ie=ne.props.onChange;ne.setValue(Q.target.value,function(){ne.resizableTextArea.resizeTextarea()}),ie&&ie(Q)},ne.handleKeyDown=function(Q){var ie=ne.props,ee=ie.onPressEnter,Ee=ie.onKeyDown;Q.keyCode===13&&ee&&ee(Q),Ee&&Ee(Q)};var me=typeof he.value=="undefined"||he.value===null?he.defaultValue:he.value;return ne.state={value:me},ne}return Object(L.a)(se,[{key:"setValue",value:function(ne,me){"value"in this.props||this.setState({value:ne},me)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(te,Object(q.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ne){return"value"in ne?{value:ne.value}:null}}]),se}(O.Component),be=He.default=ae},ZW9T:function(qe,He,J){"use strict";J.d(He,"a",function(){return E});var q=J("k1fw"),z=J("miYZ"),L=J("tsqr"),K=J("rAM+"),F=J("tJVT"),O=J("PpiC"),B=J("cDcd"),k=J.n(B),R=J("bdgK");function S(f,A,g,p,c){var l=A.getWordUntilPosition(g),a={startLineNumber:g.lineNumber,endLineNumber:g.lineNumber,startColumn:l.startColumn,endColumn:l.endColumn},T=p.map(function(y){return{label:y,kind:f.languages.CompletionItemKind.Keyword,insertText:y,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}});return c.map(function(y){T.push(Object(q.a)(Object(q.a)({},y),{},{range:a}))}),T}var m=function(f){var A={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},g=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(a,T){var y=S(f,a,T,g,[A]);return{suggestions:y}}});var p=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(a,T){var y=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],h=S(f,a,T,p,y);return{suggestions:h}}});var c=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(a,T){var y=[A,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],h=S(f,a,T,c,y);return{suggestions:h}}})},b="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",P=J("LvDl"),w=J("+ua5");function x(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function v(){}var d=!1,o={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function u(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],A=f;if(Array.isArray(f)){for(var g=0;g<f.length;g++){var p=o[f[g]];if(p)return p}return A[0]}return o[A]||A}var s=null,C=He.b=function(f){var A=f.width,g=A===void 0?"100%":A,p=f.height,c=p===void 0?"100%":p,l=f.value,a=f.language,T=a===void 0?"javascript":a,y=f.style,h=y===void 0?{}:y,D=f.options,U=D===void 0?{}:D,N=f.overrideServices,W=N===void 0?{}:N,M=f.theme,I=M===void 0?"vs-dark":M,H=f.onEditBlur,X=f.onSave,te=f.autoHeight,ae=te===void 0?!1:te,be=f.forbidCopy,pe=be===void 0?!1:be,ue=f.onChange,se=ue===void 0?v:ue,he=f.editorDidMount,ne=he===void 0?v:he,me=f.onFocus,Q=me===void 0?v:me,ie=f.filename,ee=ie===void 0?"educoder.txt":ie,Ee=f.errorLine,_e=f.errorContent,ve=_e===void 0?"":_e,ye=Object(O.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),we=Object(B.useRef)(),Le=Object(B.useRef)({}),Ie=Object(B.useRef)(),Ae=Object(B.useRef)(!1),De=Object(B.useRef)(),We=Object(B.useState)(!1),Ve=Object(F.a)(We,2),je=Ve[0],Ne=Ve[1];function Je(){var Me;return we.current&&(Me=new R.default(function(Ge){var it=Object(K.a)(Ge),Pe;try{for(it.s();!(Pe=it.n()).done;){var ct=Pe.value;(ct.target.offsetHeight>0||ct.target.offsetWidth>0)&&Le.current.instance.layout()}}catch(at){it.e(at)}finally{it.f()}}),Me.observe(we.current)),Me}function Xe(){L.b.warn(decodeURIComponent(b))}var Ze=function(){var Ge=Le.current.instance;if(l!=null&&Ge&&je){var it=Ge.getModel();it&&l!==it.getValue()&&(d=!0,it.setValue(l),Ge.layout(),d=!1)}};Object(B.useEffect)(function(){Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(function(){Ze()},500)},[l,je,Le.current]),Object(B.useEffect)(function(){if(Ee&&Le.current&&Le.current.instance){var Me=Le.current.instance;Me.changeViewZones(function(it){var Pe=document.createElement("div");Pe.style.padding="10px 20px",Pe.style.width="calc(100% - 20px)",Pe.className="my-error-line-wrp",Pe.innerHTML=ve,it.addZone({afterLineNumber:Ee||11,heightInLines:3,domNode:Pe})});var Ge={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Me.addOverlayWidget(Ge),Me.revealPositionInCenter({lineNumber:20,column:1})}},[Ee,Le.current,je]);function Ce(){var Me=Le.current.instance;if(Me){var Ge=Me.getSelection(),it=Le.current.pastePos||{},Pe=new s.Range(it.startLineNumber||Ge.endLineNumber,it.startColumn||Ge.endColumn,it.endLineNumber||Ge.endLineNumber,it.endColumn||Ge.endColumn);setTimeout(function(){Me.executeEdits("",[{range:Pe,text:""}])},300)}}function et(Me){(window.navigator.platform.match("Mac")?Me.metaKey:Me.ctrlKey)&&Me.keyCode==83&&(Me.preventDefault(),X())}var Ye=function(){if(ae&&Le.current.instance){var Ge=Le.current.instance.getContentHeight();Te(Ge<c?c:Ge)}else Te(c)};function Oe(Me){var Ge=document.createEvent("MouseEvents");Ge.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Me.dispatchEvent(Ge)}function Ue(Me,Ge){var it=window.URL||window.webkitURL||window,Pe=new Blob([Ge]),ct=document.createElementNS("http://www.w3.org/1999/xhtml","a");ct.href=it.createObjectURL(Pe),ct.download=Me,Oe(ct)}Object(B.useEffect)(function(){Ye()},[Ye]),Object(B.useEffect)(function(){we.current&&!je&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(Me){try{s=Me,Le.current.instance=s.editor.create(we.current,{value:l,language:u(T),theme:I,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var Ge=Le.current.instance;if(ne(Ge,s),setTimeout(function(){Ye(),Le.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ue(ee||"educoder.txt",Ge.getValue())}})},500),Le.current.subscription=Ge.onDidChangeModelContent(function(Pe){Ae.current?clearTimeout(De.current):(Ye(),se(Ge.getValue(),Pe)),De.current=setTimeout(function(){Ae.current=!1},500)}),window.Monaco||m(s),pe&&(Ge.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Xe(),null}),Ge.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Xe(),null})),window.Monaco=s,H&&Ge.onDidBlurEditorWidget(function(){H(Ge.getValue())}),Q&&Ge.onDidFocusEditorText(function(){Q(Ge.getValue())}),pe){Ge.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Xe(),null}),Ge.onDidPaste(function(Pe){Le.current.pastePos=Pe});try{window.addEventListener("paste",Ce)}catch(Pe){}}var it=Je();return Ne(!0),function(){var Pe=Le.current.instance;Pe.dispose();var ct=Pe.getModel();ct&&ct.dispose(),Le.current.subscription&&Le.current.subscription.dispose(),pe&&window.removeEventListener("paste",Ce),it.unobserve(we.current)}}catch(Pe){}})},[]),Object(B.useEffect)(function(){var Me=Le.current.instance;if(Me&&je)return document.addEventListener("keydown",et,!1),function(){document.removeEventListener("keydown",et)}},[X,je]),Object(B.useEffect)(function(){var Me=Le.current.instance;if(Me&&je){var Ge=u(T);s.editor.setModelLanguage(Me.getModel(),Ge),console.log("language:",T,Me.getModel(),Ge)}},[T,je]),Object(B.useEffect)(function(){var Me=Le.current.instance;Me&&je&&s.editor.setTheme(I)},[I,je]),Object(B.useEffect)(function(){var Me=Le.current.instance;Me&&je&&(Me.updateOptions(Object(q.a)({},U)),setTimeout(function(){Me.getModel().updateOptions(Object(q.a)({},U))},200))},[JSON.stringify(U),je]),Object(B.useEffect)(function(){var Me=Le.current.instance;Me&&je&&Me.layout()},[g,c,je]);var ge=Object(B.useState)(x(g)),ce=Object(F.a)(ge,2),fe=ce[0],Y=ce[1],Z=Object(B.useState)(x(c)),re=Object(F.a)(Z,2),le=re[0],Te=re[1],Re=Object(q.a)(Object(q.a)({},h),{},{width:fe,height:le});return k.a.createElement("div",{className:"my-monaco-editor",ref:we,style:Re})};function E(f){var A=f.width,g=A===void 0?"100%":A,p=f.height,c=p===void 0?"100%":p,l=f.original,a=f.modified,T=f.language,y=f.options,h=y===void 0?{}:y,D=Object(B.useRef)(),U=Object(B.useState)(null),N=Object(F.a)(U,2),W=N[0],M=N[1];function I(ae){var be;return D.current&&(be=new R.default(function(pe){var ue=Object(K.a)(pe),se;try{for(ue.s();!(se=ue.n()).done;){var he=se.value;(he.target.offsetHeight>0||he.target.offsetWidth>0)&&ae.layout()}}catch(ne){ue.e(ne)}finally{ue.f()}}),be.observe(D.current)),be}Object(B.useEffect)(function(){D.current&&J.e(27).then(J.t.bind(null,"M/lh",7)).then(function(ae){s=ae;var be=s.editor.createDiffEditor(D.current,Object(q.a)(Object(q.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},h),{},{wordWrap:!0}));M(be);var pe=I(be);return function(){be.dispose();var ue=be.getModel();ue&&ue.dispose(),pe.unobserve(D.current)}})},[]),Object(B.useEffect)(function(){W&&W.setModel({original:s.editor.createModel(l,T),modified:s.editor.createModel(a,T)})},[l,a,T,W]);var H=x(g),X=x(c),te={width:H,height:X};return k.a.createElement("div",{className:"my-diff-editor",ref:D,style:te})}},ZpRC:function(qe,He,J){"use strict";function q(m){return typeof m=="object"&&m!=null&&m.nodeType===1}function z(m,b){return(!b||m!=="hidden")&&m!=="visible"&&m!=="clip"}function L(m,b){if(m.clientHeight<m.scrollHeight||m.clientWidth<m.scrollWidth){var P=getComputedStyle(m,null);return z(P.overflowY,b)||z(P.overflowX,b)||function(w){var x=function(v){if(!v.ownerDocument||!v.ownerDocument.defaultView)return null;try{return v.ownerDocument.defaultView.frameElement}catch(d){return null}}(w);return!!x&&(x.clientHeight<w.scrollHeight||x.clientWidth<w.scrollWidth)}(m)}return!1}function K(m,b,P,w,x,v,d,o){return v<m&&d>b||v>m&&d<b?0:v<=m&&o<=P||d>=b&&o>=P?v-m-w:d>b&&o<P||v<m&&o>P?d-b+x:0}var F=function(m,b){var P=window,w=b.scrollMode,x=b.block,v=b.inline,d=b.boundary,o=b.skipOverflowHiddenElements,u=typeof d=="function"?d:function(we){return we!==d};if(!q(m))throw new TypeError("Invalid target");for(var s=document.scrollingElement||document.documentElement,C=[],E=m;q(E)&&u(E);){if((E=E.parentElement)===s){C.push(E);break}E!=null&&E===document.body&&L(E)&&!L(document.documentElement)||E!=null&&L(E,o)&&C.push(E)}for(var f=P.visualViewport?P.visualViewport.width:innerWidth,A=P.visualViewport?P.visualViewport.height:innerHeight,g=window.scrollX||pageXOffset,p=window.scrollY||pageYOffset,c=m.getBoundingClientRect(),l=c.height,a=c.width,T=c.top,y=c.right,h=c.bottom,D=c.left,U=x==="start"||x==="nearest"?T:x==="end"?h:T+l/2,N=v==="center"?D+a/2:v==="end"?y:D,W=[],M=0;M<C.length;M++){var I=C[M],H=I.getBoundingClientRect(),X=H.height,te=H.width,ae=H.top,be=H.right,pe=H.bottom,ue=H.left;if(w==="if-needed"&&T>=0&&D>=0&&h<=A&&y<=f&&T>=ae&&h<=pe&&D>=ue&&y<=be)return W;var se=getComputedStyle(I),he=parseInt(se.borderLeftWidth,10),ne=parseInt(se.borderTopWidth,10),me=parseInt(se.borderRightWidth,10),Q=parseInt(se.borderBottomWidth,10),ie=0,ee=0,Ee="offsetWidth"in I?I.offsetWidth-I.clientWidth-he-me:0,_e="offsetHeight"in I?I.offsetHeight-I.clientHeight-ne-Q:0;if(s===I)ie=x==="start"?U:x==="end"?U-A:x==="nearest"?K(p,p+A,A,ne,Q,p+U,p+U+l,l):U-A/2,ee=v==="start"?N:v==="center"?N-f/2:v==="end"?N-f:K(g,g+f,f,he,me,g+N,g+N+a,a),ie=Math.max(0,ie+p),ee=Math.max(0,ee+g);else{ie=x==="start"?U-ae-ne:x==="end"?U-pe+Q+_e:x==="nearest"?K(ae,pe,X,ne,Q+_e,U,U+l,l):U-(ae+X/2)+_e/2,ee=v==="start"?N-ue-he:v==="center"?N-(ue+te/2)+Ee/2:v==="end"?N-be+me+Ee:K(ue,be,te,he,me+Ee,N,N+a,a);var ve=I.scrollLeft,ye=I.scrollTop;U+=ye-(ie=Math.max(0,Math.min(ye+ie,I.scrollHeight-X+_e))),N+=ve-(ee=Math.max(0,Math.min(ve+ee,I.scrollWidth-te+Ee)))}W.push({el:I,top:ie,left:ee})}return W};function O(m){return m===Object(m)&&Object.keys(m).length!==0}function B(m,b){b===void 0&&(b="auto");var P="scrollBehavior"in document.body.style;m.forEach(function(w){var x=w.el,v=w.top,d=w.left;x.scroll&&P?x.scroll({top:v,left:d,behavior:b}):(x.scrollTop=v,x.scrollLeft=d)})}function k(m){return m===!1?{block:"end",inline:"nearest"}:O(m)?m:{block:"start",inline:"nearest"}}function R(m,b){var P=!m.ownerDocument.documentElement.contains(m);if(O(b)&&typeof b.behavior=="function")return b.behavior(P?[]:F(m,b));if(P)return;var w=k(b);return B(F(m,w),w.behavior)}var S=He.a=R},Zss7:function(qe,He,J){var q;(function(z){var L=/^\s+/,K=/\s+$/,F=0,O=z.round,B=z.min,k=z.max,R=z.random;function S(Q,ie){if(Q=Q||"",ie=ie||{},Q instanceof S)return Q;if(!(this instanceof S))return new S(Q,ie);var ee=m(Q);this._originalInput=Q,this._r=ee.r,this._g=ee.g,this._b=ee.b,this._a=ee.a,this._roundA=O(100*this._a)/100,this._format=ie.format||ee.format,this._gradientType=ie.gradientType,this._r<1&&(this._r=O(this._r)),this._g<1&&(this._g=O(this._g)),this._b<1&&(this._b=O(this._b)),this._ok=ee.ok,this._tc_id=F++}S.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var Q=this.toRgb();return(Q.r*299+Q.g*587+Q.b*114)/1e3},getLuminance:function(){var Q=this.toRgb(),ie,ee,Ee,_e,ve,ye;return ie=Q.r/255,ee=Q.g/255,Ee=Q.b/255,ie<=.03928?_e=ie/12.92:_e=z.pow((ie+.055)/1.055,2.4),ee<=.03928?ve=ee/12.92:ve=z.pow((ee+.055)/1.055,2.4),Ee<=.03928?ye=Ee/12.92:ye=z.pow((Ee+.055)/1.055,2.4),.2126*_e+.7152*ve+.0722*ye},setAlpha:function(Q){return this._a=W(Q),this._roundA=O(100*this._a)/100,this},toHsv:function(){var Q=x(this._r,this._g,this._b);return{h:Q.h*360,s:Q.s,v:Q.v,a:this._a}},toHsvString:function(){var Q=x(this._r,this._g,this._b),ie=O(Q.h*360),ee=O(Q.s*100),Ee=O(Q.v*100);return this._a==1?"hsv("+ie+", "+ee+"%, "+Ee+"%)":"hsva("+ie+", "+ee+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var Q=P(this._r,this._g,this._b);return{h:Q.h*360,s:Q.s,l:Q.l,a:this._a}},toHslString:function(){var Q=P(this._r,this._g,this._b),ie=O(Q.h*360),ee=O(Q.s*100),Ee=O(Q.l*100);return this._a==1?"hsl("+ie+", "+ee+"%, "+Ee+"%)":"hsla("+ie+", "+ee+"%, "+Ee+"%, "+this._roundA+")"},toHex:function(Q){return d(this._r,this._g,this._b,Q)},toHexString:function(Q){return"#"+this.toHex(Q)},toHex8:function(Q){return o(this._r,this._g,this._b,this._a,Q)},toHex8String:function(Q){return"#"+this.toHex8(Q)},toRgb:function(){return{r:O(this._r),g:O(this._g),b:O(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+O(this._r)+", "+O(this._g)+", "+O(this._b)+")":"rgba("+O(this._r)+", "+O(this._g)+", "+O(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:O(M(this._r,255)*100)+"%",g:O(M(this._g,255)*100)+"%",b:O(M(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+O(M(this._r,255)*100)+"%, "+O(M(this._g,255)*100)+"%, "+O(M(this._b,255)*100)+"%)":"rgba("+O(M(this._r,255)*100)+"%, "+O(M(this._g,255)*100)+"%, "+O(M(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[d(this._r,this._g,this._b,!0)]||!1},toFilter:function(Q){var ie="#"+u(this._r,this._g,this._b,this._a),ee=ie,Ee=this._gradientType?"GradientType = 1, ":"";if(Q){var _e=S(Q);ee="#"+u(_e._r,_e._g,_e._b,_e._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ie+",endColorstr="+ee+")"},toString:function(Q){var ie=!!Q;Q=Q||this._format;var ee=!1,Ee=this._a<1&&this._a>=0,_e=!ie&&Ee&&(Q==="hex"||Q==="hex6"||Q==="hex3"||Q==="hex4"||Q==="hex8"||Q==="name");return _e?Q==="name"&&this._a===0?this.toName():this.toRgbString():(Q==="rgb"&&(ee=this.toRgbString()),Q==="prgb"&&(ee=this.toPercentageRgbString()),(Q==="hex"||Q==="hex6")&&(ee=this.toHexString()),Q==="hex3"&&(ee=this.toHexString(!0)),Q==="hex4"&&(ee=this.toHex8String(!0)),Q==="hex8"&&(ee=this.toHex8String()),Q==="name"&&(ee=this.toName()),Q==="hsl"&&(ee=this.toHslString()),Q==="hsv"&&(ee=this.toHsvString()),ee||this.toHexString())},clone:function(){return S(this.toString())},_applyModification:function(Q,ie){var ee=Q.apply(null,[this].concat([].slice.call(ie)));return this._r=ee._r,this._g=ee._g,this._b=ee._b,this.setAlpha(ee._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(g,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(C,arguments)},greyscale:function(){return this._applyModification(E,arguments)},spin:function(){return this._applyModification(p,arguments)},_applyCombination:function(Q,ie){return Q.apply(null,[this].concat([].slice.call(ie)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(h,arguments)},splitcomplement:function(){return this._applyCombination(T,arguments)},triad:function(){return this._applyCombination(l,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},S.fromRatio=function(Q,ie){if(typeof Q=="object"){var ee={};for(var Ee in Q)Q.hasOwnProperty(Ee)&&(Ee==="a"?ee[Ee]=Q[Ee]:ee[Ee]=be(Q[Ee]));Q=ee}return S(Q,ie)};function m(Q){var ie={r:0,g:0,b:0},ee=1,Ee=null,_e=null,ve=null,ye=!1,we=!1;return typeof Q=="string"&&(Q=ne(Q)),typeof Q=="object"&&(he(Q.r)&&he(Q.g)&&he(Q.b)?(ie=b(Q.r,Q.g,Q.b),ye=!0,we=String(Q.r).substr(-1)==="%"?"prgb":"rgb"):he(Q.h)&&he(Q.s)&&he(Q.v)?(Ee=be(Q.s),_e=be(Q.v),ie=v(Q.h,Ee,_e),ye=!0,we="hsv"):he(Q.h)&&he(Q.s)&&he(Q.l)&&(Ee=be(Q.s),ve=be(Q.l),ie=w(Q.h,Ee,ve),ye=!0,we="hsl"),Q.hasOwnProperty("a")&&(ee=Q.a)),ee=W(ee),{ok:ye,format:Q.format||we,r:B(255,k(ie.r,0)),g:B(255,k(ie.g,0)),b:B(255,k(ie.b,0)),a:ee}}function b(Q,ie,ee){return{r:M(Q,255)*255,g:M(ie,255)*255,b:M(ee,255)*255}}function P(Q,ie,ee){Q=M(Q,255),ie=M(ie,255),ee=M(ee,255);var Ee=k(Q,ie,ee),_e=B(Q,ie,ee),ve,ye,we=(Ee+_e)/2;if(Ee==_e)ve=ye=0;else{var Le=Ee-_e;ye=we>.5?Le/(2-Ee-_e):Le/(Ee+_e);switch(Ee){case Q:ve=(ie-ee)/Le+(ie<ee?6:0);break;case ie:ve=(ee-Q)/Le+2;break;case ee:ve=(Q-ie)/Le+4;break}ve/=6}return{h:ve,s:ye,l:we}}function w(Q,ie,ee){var Ee,_e,ve;Q=M(Q,360),ie=M(ie,100),ee=M(ee,100);function ye(Ie,Ae,De){return De<0&&(De+=1),De>1&&(De-=1),De<1/6?Ie+(Ae-Ie)*6*De:De<1/2?Ae:De<2/3?Ie+(Ae-Ie)*(2/3-De)*6:Ie}if(ie===0)Ee=_e=ve=ee;else{var we=ee<.5?ee*(1+ie):ee+ie-ee*ie,Le=2*ee-we;Ee=ye(Le,we,Q+1/3),_e=ye(Le,we,Q),ve=ye(Le,we,Q-1/3)}return{r:Ee*255,g:_e*255,b:ve*255}}function x(Q,ie,ee){Q=M(Q,255),ie=M(ie,255),ee=M(ee,255);var Ee=k(Q,ie,ee),_e=B(Q,ie,ee),ve,ye,we=Ee,Le=Ee-_e;if(ye=Ee===0?0:Le/Ee,Ee==_e)ve=0;else{switch(Ee){case Q:ve=(ie-ee)/Le+(ie<ee?6:0);break;case ie:ve=(ee-Q)/Le+2;break;case ee:ve=(Q-ie)/Le+4;break}ve/=6}return{h:ve,s:ye,v:we}}function v(Q,ie,ee){Q=M(Q,360)*6,ie=M(ie,100),ee=M(ee,100);var Ee=z.floor(Q),_e=Q-Ee,ve=ee*(1-ie),ye=ee*(1-_e*ie),we=ee*(1-(1-_e)*ie),Le=Ee%6,Ie=[ee,ye,ve,ve,we,ee][Le],Ae=[we,ee,ee,ye,ve,ve][Le],De=[ve,ve,we,ee,ee,ye][Le];return{r:Ie*255,g:Ae*255,b:De*255}}function d(Q,ie,ee,Ee){var _e=[ae(O(Q).toString(16)),ae(O(ie).toString(16)),ae(O(ee).toString(16))];return Ee&&_e[0].charAt(0)==_e[0].charAt(1)&&_e[1].charAt(0)==_e[1].charAt(1)&&_e[2].charAt(0)==_e[2].charAt(1)?_e[0].charAt(0)+_e[1].charAt(0)+_e[2].charAt(0):_e.join("")}function o(Q,ie,ee,Ee,_e){var ve=[ae(O(Q).toString(16)),ae(O(ie).toString(16)),ae(O(ee).toString(16)),ae(pe(Ee))];return _e&&ve[0].charAt(0)==ve[0].charAt(1)&&ve[1].charAt(0)==ve[1].charAt(1)&&ve[2].charAt(0)==ve[2].charAt(1)&&ve[3].charAt(0)==ve[3].charAt(1)?ve[0].charAt(0)+ve[1].charAt(0)+ve[2].charAt(0)+ve[3].charAt(0):ve.join("")}function u(Q,ie,ee,Ee){var _e=[ae(pe(Ee)),ae(O(Q).toString(16)),ae(O(ie).toString(16)),ae(O(ee).toString(16))];return _e.join("")}S.equals=function(Q,ie){return!Q||!ie?!1:S(Q).toRgbString()==S(ie).toRgbString()},S.random=function(){return S.fromRatio({r:R(),g:R(),b:R()})};function s(Q,ie){ie=ie===0?0:ie||10;var ee=S(Q).toHsl();return ee.s-=ie/100,ee.s=I(ee.s),S(ee)}function C(Q,ie){ie=ie===0?0:ie||10;var ee=S(Q).toHsl();return ee.s+=ie/100,ee.s=I(ee.s),S(ee)}function E(Q){return S(Q).desaturate(100)}function f(Q,ie){ie=ie===0?0:ie||10;var ee=S(Q).toHsl();return ee.l+=ie/100,ee.l=I(ee.l),S(ee)}function A(Q,ie){ie=ie===0?0:ie||10;var ee=S(Q).toRgb();return ee.r=k(0,B(255,ee.r-O(255*-(ie/100)))),ee.g=k(0,B(255,ee.g-O(255*-(ie/100)))),ee.b=k(0,B(255,ee.b-O(255*-(ie/100)))),S(ee)}function g(Q,ie){ie=ie===0?0:ie||10;var ee=S(Q).toHsl();return ee.l-=ie/100,ee.l=I(ee.l),S(ee)}function p(Q,ie){var ee=S(Q).toHsl(),Ee=(ee.h+ie)%360;return ee.h=Ee<0?360+Ee:Ee,S(ee)}function c(Q){var ie=S(Q).toHsl();return ie.h=(ie.h+180)%360,S(ie)}function l(Q){var ie=S(Q).toHsl(),ee=ie.h;return[S(Q),S({h:(ee+120)%360,s:ie.s,l:ie.l}),S({h:(ee+240)%360,s:ie.s,l:ie.l})]}function a(Q){var ie=S(Q).toHsl(),ee=ie.h;return[S(Q),S({h:(ee+90)%360,s:ie.s,l:ie.l}),S({h:(ee+180)%360,s:ie.s,l:ie.l}),S({h:(ee+270)%360,s:ie.s,l:ie.l})]}function T(Q){var ie=S(Q).toHsl(),ee=ie.h;return[S(Q),S({h:(ee+72)%360,s:ie.s,l:ie.l}),S({h:(ee+216)%360,s:ie.s,l:ie.l})]}function y(Q,ie,ee){ie=ie||6,ee=ee||30;var Ee=S(Q).toHsl(),_e=360/ee,ve=[S(Q)];for(Ee.h=(Ee.h-(_e*ie>>1)+720)%360;--ie;)Ee.h=(Ee.h+_e)%360,ve.push(S(Ee));return ve}function h(Q,ie){ie=ie||6;for(var ee=S(Q).toHsv(),Ee=ee.h,_e=ee.s,ve=ee.v,ye=[],we=1/ie;ie--;)ye.push(S({h:Ee,s:_e,v:ve})),ve=(ve+we)%1;return ye}S.mix=function(Q,ie,ee){ee=ee===0?0:ee||50;var Ee=S(Q).toRgb(),_e=S(ie).toRgb(),ve=ee/100,ye={r:(_e.r-Ee.r)*ve+Ee.r,g:(_e.g-Ee.g)*ve+Ee.g,b:(_e.b-Ee.b)*ve+Ee.b,a:(_e.a-Ee.a)*ve+Ee.a};return S(ye)},S.readability=function(Q,ie){var ee=S(Q),Ee=S(ie);return(z.max(ee.getLuminance(),Ee.getLuminance())+.05)/(z.min(ee.getLuminance(),Ee.getLuminance())+.05)},S.isReadable=function(Q,ie,ee){var Ee=S.readability(Q,ie),_e,ve;ve=!1,_e=me(ee);switch(_e.level+_e.size){case"AAsmall":case"AAAlarge":ve=Ee>=4.5;break;case"AAlarge":ve=Ee>=3;break;case"AAAsmall":ve=Ee>=7;break}return ve},S.mostReadable=function(Q,ie,ee){var Ee=null,_e=0,ve,ye,we,Le;ee=ee||{},ye=ee.includeFallbackColors,we=ee.level,Le=ee.size;for(var Ie=0;Ie<ie.length;Ie++)ve=S.readability(Q,ie[Ie]),ve>_e&&(_e=ve,Ee=S(ie[Ie]));return S.isReadable(Q,Ee,{level:we,size:Le})||!ye?Ee:(ee.includeFallbackColors=!1,S.mostReadable(Q,["#fff","#000"],ee))};var D=S.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=S.hexNames=N(D);function N(Q){var ie={};for(var ee in Q)Q.hasOwnProperty(ee)&&(ie[Q[ee]]=ee);return ie}function W(Q){return Q=parseFloat(Q),(isNaN(Q)||Q<0||Q>1)&&(Q=1),Q}function M(Q,ie){X(Q)&&(Q="100%");var ee=te(Q);return Q=B(ie,k(0,parseFloat(Q))),ee&&(Q=parseInt(Q*ie,10)/100),z.abs(Q-ie)<1e-6?1:Q%ie/parseFloat(ie)}function I(Q){return B(1,k(0,Q))}function H(Q){return parseInt(Q,16)}function X(Q){return typeof Q=="string"&&Q.indexOf(".")!=-1&&parseFloat(Q)===1}function te(Q){return typeof Q=="string"&&Q.indexOf("%")!=-1}function ae(Q){return Q.length==1?"0"+Q:""+Q}function be(Q){return Q<=1&&(Q=Q*100+"%"),Q}function pe(Q){return z.round(parseFloat(Q)*255).toString(16)}function ue(Q){return H(Q)/255}var se=function(){var Q="[-\\+]?\\d+%?",ie="[-\\+]?\\d*\\.\\d+%?",ee="(?:"+ie+")|(?:"+Q+")",Ee="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?",_e="[\\s|\\(]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")[,|\\s]+("+ee+")\\s*\\)?";return{CSS_UNIT:new RegExp(ee),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+_e),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+_e),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+_e),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function he(Q){return!!se.CSS_UNIT.exec(Q)}function ne(Q){Q=Q.replace(L,"").replace(K,"").toLowerCase();var ie=!1;if(D[Q])Q=D[Q],ie=!0;else if(Q=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ee;return(ee=se.rgb.exec(Q))?{r:ee[1],g:ee[2],b:ee[3]}:(ee=se.rgba.exec(Q))?{r:ee[1],g:ee[2],b:ee[3],a:ee[4]}:(ee=se.hsl.exec(Q))?{h:ee[1],s:ee[2],l:ee[3]}:(ee=se.hsla.exec(Q))?{h:ee[1],s:ee[2],l:ee[3],a:ee[4]}:(ee=se.hsv.exec(Q))?{h:ee[1],s:ee[2],v:ee[3]}:(ee=se.hsva.exec(Q))?{h:ee[1],s:ee[2],v:ee[3],a:ee[4]}:(ee=se.hex8.exec(Q))?{r:H(ee[1]),g:H(ee[2]),b:H(ee[3]),a:ue(ee[4]),format:ie?"name":"hex8"}:(ee=se.hex6.exec(Q))?{r:H(ee[1]),g:H(ee[2]),b:H(ee[3]),format:ie?"name":"hex"}:(ee=se.hex4.exec(Q))?{r:H(ee[1]+""+ee[1]),g:H(ee[2]+""+ee[2]),b:H(ee[3]+""+ee[3]),a:ue(ee[4]+""+ee[4]),format:ie?"name":"hex8"}:(ee=se.hex3.exec(Q))?{r:H(ee[1]+""+ee[1]),g:H(ee[2]+""+ee[2]),b:H(ee[3]+""+ee[3]),format:ie?"name":"hex"}:!1}function me(Q){var ie,ee;return Q=Q||{level:"AA",size:"small"},ie=(Q.level||"AA").toUpperCase(),ee=(Q.size||"small").toLowerCase(),ie!=="AA"&&ie!=="AAA"&&(ie="AA"),ee!=="small"&&ee!=="large"&&(ee="small"),{level:ie,size:ee}}qe.exports?qe.exports=S:!(q=function(){return S}.call(He,J,He,qe),q!==void 0&&(qe.exports=q))})(Math)},aRTE:function(qe,He){qe.exports={L:1,M:0,Q:3,H:2}},bT9E:function(qe,He,J){"use strict";J.d(He,"a",function(){return z});var q=J("VTBJ");function z(L,K){var F=Object(q.a)({},L);return Array.isArray(K)&&K.forEach(function(O){delete F[O]}),F}},c5Ni:function(qe,He,J){},dQei:function(qe,He){for(var J={glog:function(z){if(z<1)throw new Error("glog("+z+")");return J.LOG_TABLE[z]},gexp:function(z){for(;z<0;)z+=255;for(;z>=256;)z-=255;return J.EXP_TABLE[z]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},q=0;q<8;q++)J.EXP_TABLE[q]=1<<q;for(var q=8;q<256;q++)J.EXP_TABLE[q]=J.EXP_TABLE[q-4]^J.EXP_TABLE[q-5]^J.EXP_TABLE[q-6]^J.EXP_TABLE[q-8];for(var q=0;q<255;q++)J.LOG_TABLE[J.EXP_TABLE[q]]=q;qe.exports=J},dWSS:function(qe,He,J){var q=J("dQei");function z(L,K){if(L.length==null)throw new Error(L.length+"/"+K);for(var F=0;F<L.length&&L[F]==0;)F++;this.num=new Array(L.length-F+K);for(var O=0;O<L.length-F;O++)this.num[O]=L[O+F]}z.prototype={get:function(L){return this.num[L]},getLength:function(){return this.num.length},multiply:function(L){for(var K=new Array(this.getLength()+L.getLength()-1),F=0;F<this.getLength();F++)for(var O=0;O<L.getLength();O++)K[F+O]^=q.gexp(q.glog(this.get(F))+q.glog(L.get(O)));return new z(K,0)},mod:function(L){if(this.getLength()-L.getLength()<0)return this;for(var K=q.glog(this.get(0))-q.glog(L.get(0)),F=new Array(this.getLength()),O=0;O<this.getLength();O++)F[O]=this.get(O);for(var O=0;O<L.getLength();O++)F[O]^=q.gexp(q.glog(L.get(O))+K);return new z(F,0).mod(L)}},qe.exports=z},dejd:function(qe,He,J){},dmUQ:function(qe,He,J){"use strict";var q=J("Ff2n"),z=J("rePB"),L=J("1OyB"),K=J("vuIU"),F=J("Ji7U"),O=J("md7G"),B=J("foSv"),k=J("cDcd"),R=J.n(k),S=J("TSYQ"),m=J.n(S),b=J("4IlW");function P(l,a){var T=Object.keys(l);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(l);a&&(y=y.filter(function(h){return Object.getOwnPropertyDescriptor(l,h).enumerable})),T.push.apply(T,y)}return T}function w(l){for(var a=1;a<arguments.length;a++){var T=arguments[a]!=null?arguments[a]:{};a%2?P(Object(T),!0).forEach(function(y){Object(z.a)(l,y,T[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(T)):P(Object(T)).forEach(function(y){Object.defineProperty(l,y,Object.getOwnPropertyDescriptor(T,y))})}return l}function x(l){var a=v();return function(){var y=Object(B.a)(l),h;if(a){var D=Object(B.a)(this).constructor;h=Reflect.construct(y,arguments,D)}else h=y.apply(this,arguments);return Object(O.a)(this,h)}}function v(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(l){return!1}}function d(){}function o(l){l.preventDefault()}var u=function(a){return a.replace(/[^\w.-]+/g,"")},s=200,C=600,E=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},A=function(a,T){return T===a||typeof T=="number"&&typeof a=="number"&&isNaN(T)&&isNaN(a)},g=function(l){Object(F.a)(T,l);var a=x(T);function T(y){var h;Object(L.a)(this,T),h=a.call(this,y),h.onKeyDown=function(N){var W=h.props,M=W.onKeyDown,I=W.onPressEnter;if(N.keyCode===b.a.UP){var H=h.getRatio(N);h.up(N,H,null),h.stop()}else if(N.keyCode===b.a.DOWN){var X=h.getRatio(N);h.down(N,X,null),h.stop()}else N.keyCode===b.a.ENTER&&I&&I(N);if(h.recordCursorPosition(),h.lastKeyCode=N.keyCode,M){for(var te=arguments.length,ae=new Array(te>1?te-1:0),be=1;be<te;be++)ae[be-1]=arguments[be];M.apply(void 0,[N].concat(ae))}},h.onKeyUp=function(N){var W=h.props.onKeyUp;if(h.stop(),h.recordCursorPosition(),W){for(var M=arguments.length,I=new Array(M>1?M-1:0),H=1;H<M;H++)I[H-1]=arguments[H];W.apply(void 0,[N].concat(I))}},h.onChange=function(N){var W=h.props.onChange;h.state.focused&&(h.inputting=!0),h.rawInput=h.props.parser(h.getValueFromEvent(N)),h.setState({inputValue:h.rawInput}),W(h.toNumber(h.rawInput))},h.onMouseUp=function(){var N=h.props.onMouseUp;h.recordCursorPosition(),N&&N.apply(void 0,arguments)},h.onFocus=function(){var N;h.setState({focused:!0}),(N=h.props).onFocus.apply(N,arguments)},h.onBlur=function(){var N=h.props.onBlur;h.inputting=!1,h.setState({focused:!1});var W=h.getCurrentValidValue(h.state.inputValue),M=h.setValue(W,d);if(N){var I=h.input.value,H=h.getInputDisplayValue({focus:!1,value:M});h.input.value=H&&Number(H),N.apply(void 0,arguments),h.input.value=I}},h.getRatio=function(N){var W=1;return N.metaKey||N.ctrlKey?W=.1:N.shiftKey&&(W=10),W},h.getFullNum=function(N){return isNaN(N)?N:/e/i.test(String(N))?Number(N).toFixed(18).replace(/\.?0+$/,""):N},h.getPrecision=function(N){if(f(h.props.precision))return h.props.precision;var W=String(N);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var M=0;return W.indexOf(".")>=0&&(M=W.length-W.indexOf(".")-1),M},h.getInputDisplayValue=function(N){var W=N||h.state,M=W.focused,I=W.inputValue,H=W.value,X;M?X=I:X=h.toPrecisionAsStep(H),X==null&&(X="");var te=h.formatWrapper(X);return f(h.props.decimalSeparator)&&(te=te.toString().replace(".",h.props.decimalSeparator)),te},h.recordCursorPosition=function(){try{h.cursorStart=h.input.selectionStart,h.cursorEnd=h.input.selectionEnd,h.currentValue=h.input.value,h.cursorBefore=h.input.value.substring(0,h.cursorStart),h.cursorAfter=h.input.value.substring(h.cursorEnd)}catch(N){}},h.restoreByAfter=function(N){if(N===void 0)return!1;var W=h.input.value,M=W.lastIndexOf(N);if(M===-1)return!1;var I=h.cursorBefore.length;return h.lastKeyCode===b.a.DELETE&&h.cursorBefore.charAt(I-1)===N[0]?(h.fixCaret(I,I),!0):M+N.length===W.length?(h.fixCaret(M,M),!0):!1},h.partRestoreByAfter=function(N){return N===void 0?!1:Array.prototype.some.call(N,function(W,M){var I=N.substring(M);return h.restoreByAfter(I)})},h.isNotCompleteNumber=function(N){return isNaN(N)||N===""||N===null||N&&N.toString().indexOf(".")===N.toString().length-1},h.stop=function(){h.autoStepTimer&&clearTimeout(h.autoStepTimer)},h.down=function(N,W,M){h.pressingUpOrDown=!0,h.step("down",N,W,M)},h.up=function(N,W,M){h.pressingUpOrDown=!0,h.step("up",N,W,M)},h.saveInput=function(N){h.input=N};var D=y.value;D===void 0&&(D=y.defaultValue),h.state={focused:y.autoFocus};var U=h.getValidValue(h.toNumber(D));return h.state=w(w({},h.state),{},{inputValue:h.toPrecisionAsStep(U),value:U}),h}return Object(K.a)(T,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(h){var D=this.props,U=D.value,N=D.onChange,W=D.max,M=D.min,I=this.state.focused;if(h){if(!A(h.value,U)||!A(h.max,W)||!A(h.min,M)){var H=I?U:this.getValidValue(U),X;this.pressingUpOrDown?X=H:this.inputting?X=this.rawInput:X=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:X})}var te="value"in this.props?U:this.state.value;"max"in this.props&&h.max!==W&&typeof te=="number"&&te>W&&N&&N(W),"min"in this.props&&h.min!==M&&typeof te=="number"&&te<M&&N&&N(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ae=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===b.a.BACKSPACE?ae=this.cursorStart-1:this.lastKeyCode===b.a.DELETE&&(ae=this.cursorStart):ae=this.input.value.length,this.fixCaret(ae,ae)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case b.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case b.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(be){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(h){var D=h;return D===""?D="":this.isNotCompleteNumber(parseFloat(D))?D=this.state.value:D=this.getValidValue(D),this.toNumber(D)}},{key:"getValueFromEvent",value:function(h){var D=h.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(D=D.replace(this.props.decimalSeparator,".")),D}},{key:"getValidValue",value:function(h){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,N=parseFloat(h);return isNaN(N)?h:(N<D&&(N=D),N>U&&(N=U),N)}},{key:"setValue",value:function(h,D){var U=this.props.precision,N=this.isNotCompleteNumber(parseFloat(h))?null:parseFloat(h),W=this.state.value,M=W===void 0?null:W,I=this.state.inputValue,H=I===void 0?null:I,X=typeof N=="number"?N.toFixed(U):"".concat(N),te=N!==M||X!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},D)):this.setState({value:N,inputValue:this.toPrecisionAsStep(h)},D),te&&this.props.onChange(N),N}},{key:"getMaxPrecision",value:function(h){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,N=U.precision,W=U.step;if(f(N))return N;var M=this.getPrecision(D),I=this.getPrecision(W),H=this.getPrecision(h);return h?Math.max(H,M+I):M+I}},{key:"getPrecisionFactor",value:function(h){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(h,D);return Math.pow(10,U)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(h){return this.props.formatter?this.props.formatter(h):h}},{key:"toPrecisionAsStep",value:function(h){if(this.isNotCompleteNumber(h)||h==="")return h;var D=Math.abs(this.getMaxPrecision(h));return isNaN(D)?h.toString():Number(h).toFixed(D)}},{key:"toNumber",value:function(h){var D=this.props.precision,U=this.state.focused,N=h&&h.length>16&&U;return this.isNotCompleteNumber(h)||N?h:f(D)?Math.round(h*Math.pow(10,D))/Math.pow(10,D):Number(h)}},{key:"upStep",value:function(h,D){var U=this.props.step,N=this.getPrecisionFactor(h,D),W=Math.abs(this.getMaxPrecision(h,D)),M=((N*h+N*U*D)/N).toFixed(W);return this.toNumber(M)}},{key:"downStep",value:function(h,D){var U=this.props.step,N=this.getPrecisionFactor(h,D),W=Math.abs(this.getMaxPrecision(h,D)),M=((N*h-N*U*D)/N).toFixed(W);return this.toNumber(M)}},{key:"step",value:function(h,D){var U=this,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),D&&(D.persist(),D.preventDefault());var M=this.props;if(M.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var H=this["".concat(h,"Step")](I,N),X=H>M.max||H<M.min;if(H>M.max?H=M.max:H<M.min&&(H=M.min),this.setValue(H,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),X)return;this.autoStepTimer=setTimeout(function(){U[h](D,N,!0)},W?s:C)}},{key:"fixCaret",value:function(h,D){if(h===void 0||D===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,N=this.input.selectionEnd;(h!==U||D!==N)&&this.input.setSelectionRange(h,D)}catch(W){}}},{key:"render",value:function(){var h,D=this.props,U=D.prefixCls,N=D.disabled,W=D.readOnly,M=D.useTouch,I=D.autoComplete,H=D.upHandler,X=D.downHandler,te=D.className,ae=D.max,be=D.min,pe=D.style,ue=D.title,se=D.onMouseEnter,he=D.onMouseLeave,ne=D.onMouseOver,me=D.onMouseOut,Q=D.required,ie=D.onClick,ee=D.tabIndex,Ee=D.type,_e=D.placeholder,ve=D.id,ye=D.inputMode,we=D.pattern,Le=D.step,Ie=D.maxLength,Ae=D.autoFocus,De=D.name,We=D.onPaste,Ve=D.onInput,je=Object(q.a)(D,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Ne=this.state,Je=Ne.value,Xe=Ne.focused,Ze=m()(U,(h={},Object(z.a)(h,te,!!te),Object(z.a)(h,"".concat(U,"-disabled"),N),Object(z.a)(h,"".concat(U,"-focused"),Xe),h)),Ce={};Object.keys(je).forEach(function(le){(le.substr(0,5)==="data-"||le.substr(0,5)==="aria-"||le==="role")&&(Ce[le]=je[le])});var et=!W&&!N,Ye=this.getInputDisplayValue(null),Oe=(Je||Je===0)&&(isNaN(Je)||Number(Je)>=ae),Ue=(Je||Je===0)&&(isNaN(Je)||Number(Je)<=be),ge=Oe||N||W,ce=Ue||N||W,fe=m()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(z.a)({},"".concat(U,"-handler-up-disabled"),ge)),Y=m()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(z.a)({},"".concat(U,"-handler-down-disabled"),ce)),Z=M?{onTouchStart:ge?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},re=M?{onTouchStart:ce?d:this.down,onTouchEnd:this.stop}:{onMouseDown:ce?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return R.a.createElement("div",{className:Ze,style:pe,title:ue,onMouseEnter:se,onMouseLeave:he,onMouseOver:ne,onMouseOut:me,onFocus:function(){return null},onBlur:function(){return null}},R.a.createElement("div",{className:"".concat(U,"-handler-wrap")},R.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:fe}),H||R.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),R.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Decrease Value","aria-disabled":ce,className:Y}),X||R.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),R.a.createElement("div",{className:"".concat(U,"-input-wrap")},R.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":be,"aria-valuemax":ae,"aria-valuenow":Je,required:Q,type:Ee,placeholder:_e,onPaste:We,onClick:ie,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:ee,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:et?this.onKeyDown:d,onKeyUp:et?this.onKeyUp:d,autoFocus:Ae,maxLength:Ie,readOnly:W,disabled:N,max:ae,min:be,step:Le,name:De,title:ue,id:ve,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ye),pattern:we,inputMode:ye,onInput:Ve},Ce))))}}]),T}(R.a.Component);g.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:E,min:-E,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:u,required:!1,autoComplete:"off"};var p=g,c=He.a=p},f4xo:function(qe,He,J){var q=J("nVVt");function z(L){this.mode=q.MODE_8BIT_BYTE,this.data=L}z.prototype={getLength:function(L){return this.data.length},write:function(L){for(var K=0;K<this.data.length;K++)L.put(this.data.charCodeAt(K),8)}},qe.exports=z},gMzb:function(qe,He,J){"use strict";var q=J("k1fw"),z=J("oBTY"),L=J("9og8"),K=J("tJVT"),F=J("sRBo"),O=J("kaz8"),B=J("WmNS"),k=J.n(B),R=J("cDcd"),S=J.n(R),m=J("9kvl"),b=J("wlus"),P=J("w5pM"),w=J("ErOA"),x=J("OaEy"),v=J("2fM7"),d=J("y8nQ"),o=J("Vl3Y"),u=J("Ty5D"),s=J("yQHh"),C=J.n(s),E=O.a.Group,f=function(a){var T,y,h,D,U,N,W,M,I=a.classroomList,H=a.loading,X=a.user,te=a.exercise_id,ae=te===void 0?null:te,be=a.homework_common_id,pe=be===void 0?null:be,ue=a.setitem,se=a.item,he=a.type,ne=a.rz,me=a.dispatch,Q=Object(R.useState)([]),ie=Object(K.a)(Q,2),ee=ie[0],Ee=ie[1],_e=Object(R.useState)({zydatas:[],jbdatas:[],kcdatas:[],zsdatas:[],page:1,per_page:20}),ve=Object(K.a)(_e,2),ye=ve[0],we=ve[1],Le=Object(u.i)(),Ie=Object(R.useState)(!1),Ae=Object(K.a)(Ie,2),De=Ae[0],We=Ae[1],Ve=Object(R.useState)(!1),je=Object(K.a)(Ve,2),Ne=je[0],Je=je[1],Xe=o.a.useForm(),Ze=Object(K.a)(Xe,1),Ce=Ze[0];Object(R.useEffect)(function(){ne&&(ye.zydatas=ne,we(Object(q.a)({},ye)),se!=null&&se.ec_course_id&&et())},[se,ne]);function et(){return Ye.apply(this,arguments)}function Ye(){return Ye=Object(L.a)(k.a.mark(function Y(){return k.a.wrap(function(re){for(;;)switch(re.prev=re.next){case 0:return console.log("----",se),re.next=3,Oe(se==null?void 0:se.ec_major_school_id);case 3:return re.next=5,ge(se==null?void 0:se.ec_year_id);case 5:return re.next=7,fe(se==null?void 0:se.ec_course_id);case 7:Ce.setFieldsValue({ec_course_id:se==null?void 0:se.ec_course_id,ec_major_school_id:se==null?void 0:se.ec_major_school_id,ec_point_ids:se==null?void 0:se.ec_point_ids,ec_year_id:se==null?void 0:se.ec_year_id});case 8:case"end":return re.stop()}},Y)})),Ye.apply(this,arguments)}function Oe(Y){return Ue.apply(this,arguments)}function Ue(){return Ue=Object(L.a)(k.a.mark(function Y(Z){var re;return k.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return Te.next=2,Object(w.a)("/api/ec_major_schools/".concat(Z,"/ec_years/get_year_list.json"),{method:"get"});case 2:re=Te.sent,ye.jbdatas=re==null?void 0:re.data,we(Object(q.a)({},ye)),Ce.setFieldsValue({ec_year_id:"",ec_course_id:"",ec_point_ids:[]});case 6:case"end":return Te.stop()}},Y)})),Ue.apply(this,arguments)}function ge(Y){return ce.apply(this,arguments)}function ce(){return ce=Object(L.a)(k.a.mark(function Y(Z){var re;return k.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return Te.next=2,Object(w.a)("/api/ec_years/".concat(Z,"/ec_courses/get_courses.json"),{method:"get"});case 2:re=Te.sent,ye.kcdatas=re==null?void 0:re.data,we(Object(q.a)({},ye)),Ce.setFieldsValue({ec_course_id:"",ec_point_ids:[]});case 6:case"end":return Te.stop()}},Y)})),ce.apply(this,arguments)}var fe=function(){var Y=Object(L.a)(k.a.mark(function Z(re){var le;return k.a.wrap(function(Re){for(;;)switch(Re.prev=Re.next){case 0:return Re.next=2,Object(w.a)("/api/ec_courses/".concat(re,"/ec_points.json"),{method:"get",params:{ec_course_id:re}});case 2:le=Re.sent,ye.zsdatas=le==null?void 0:le.data,we(Object(q.a)({},ye));case 5:case"end":return Re.stop()}},Z)}));return function(re){return Y.apply(this,arguments)}}();return S.a.createElement("div",{className:C.a.from},S.a.createElement(o.a,{form:Ce,layout:"inline",onValuesChange:function(Z){console.log("----",Z),Z.ec_major_school_id&&(ye.jbdatas=[],ye.kcdatas=[],ye.zsdatas=[],we(Object(q.a)({},ye)),Oe(Z.ec_major_school_id)),Z.ec_year_id&&(ye.kcdatas=[],ye.zsdatas=[],we(Object(q.a)({},ye)),ge(Z.ec_year_id)),Z.ec_course_id&&(ye.zsdatas=[],we(Object(q.a)({},ye)),fe(Z.ec_course_id))},onFinish:function(){var Y=Object(L.a)(k.a.mark(function Z(re){return k.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:ue(re);case 1:case"end":return Te.stop()}},Z)}));return function(Z){return Y.apply(this,arguments)}}()},S.a.createElement(o.a.Item,{label:"\u8BA4\u8BC1\u4E13\u4E1A",name:"ec_major_school_id"},S.a.createElement(v.a,{style:{width:150},disabled:((T=ye.zydatas)===null||T===void 0?void 0:T.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u4E13\u4E1A"},ye==null||((y=ye.zydatas)===null||y===void 0)?void 0:y.map(function(Y,Z){return S.a.createElement(v.a.Option,{key:Z,value:Y==null?void 0:Y.ec_major_school_id},Y==null?void 0:Y.name)}))),S.a.createElement(o.a.Item,{label:"\u8BA4\u8BC1\u5C4A\u522B",name:"ec_year_id"},S.a.createElement(v.a,{style:{width:150},disabled:((h=ye.jbdatas)===null||h===void 0?void 0:h.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u5C4A\u522B"},ye==null||((D=ye.jbdatas)===null||D===void 0)?void 0:D.map(function(Y,Z){return S.a.createElement(v.a.Option,{key:Z,value:Y==null?void 0:Y.ec_year_id},Y==null?void 0:Y.year)}))),S.a.createElement(o.a.Item,{label:"\u8BFE\u7A0B",name:"ec_course_id"},S.a.createElement(v.a,{style:{width:150},disabled:((U=ye.kcdatas)===null||U===void 0?void 0:U.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B"},ye==null||((N=ye.kcdatas)===null||N===void 0)?void 0:N.map(function(Y,Z){return S.a.createElement(v.a.Option,{key:Z,value:Y==null?void 0:Y.id},Y==null?void 0:Y.name)}))),S.a.createElement(o.a.Item,{label:"\u77E5\u8BC6\u70B9",name:"ec_point_ids"},S.a.createElement(v.a,{onChange:function(){Ce.submit()},style:{width:150},mode:"multiple",disabled:((W=ye.zsdatas)===null||W===void 0?void 0:W.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9"},ye==null||((M=ye.zsdatas)===null||M===void 0)?void 0:M.map(function(Y,Z){return S.a.createElement(v.a.Option,{key:Z,value:Y==null?void 0:Y.id},Y==null?void 0:Y.name)})))))},A=Object(m.a)(function(l){var a=l.classroomList,T=l.loading,y=l.globalSetting,h=l.user;return{classroomList:a,globalSetting:y,loading:T.effects,user:h}})(f),g=O.a.Group,p=function(a){var T,y,h,D=a.classroomList,U=a.loading,N=a.user,W=a.exercise_id,M=W===void 0?null:W,I=a.homework_common_id,H=I===void 0?null:I,X=a.setitem,te=a.type,ae=a.dispatch,be=Object(R.useState)([{}]),pe=Object(K.a)(be,2),ue=pe[0],se=pe[1],he=Object(R.useState)([]),ne=Object(K.a)(he,2),me=ne[0],Q=ne[1];function ie(){return ee.apply(this,arguments)}function ee(){return ee=Object(L.a)(k.a.mark(function ve(){var ye,we,Le,Ie,Ae;return k.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:return We.next=2,Object(w.a)("/api/ec_courses/".concat(0,"/ec_points/get_work_points.json"),{method:"get",params:{exercise_id:M,homework_common_id:H}});case 2:we=We.sent,(we==null||((ye=we.data)===null||ye===void 0)?void 0:ye.length)>0&&(Ae=[],we==null||((Le=we.data)===null||Le===void 0)||Le.map(function(Ve){var je;Ve==null||((je=Ve.ec_point_ids)===null||je===void 0)||je.map(function(Ne){Ae.push(Ne)})}),X(Object(q.a)(Object(q.a)({},we==null||((Ie=we.data)===null||Ie===void 0)?void 0:Ie[0]),{},{ec_point_ids:Ae})),se(we==null?void 0:we.data));case 4:case"end":return We.stop()}},ve)})),ee.apply(this,arguments)}Object(R.useEffect)(function(){var ve,ye;N!=null&&(ve=N.userInfo)!==null&&ve!==void 0&&(ye=ve.course)!==null&&ye!==void 0&&ye.course_school_id&&Ee()},[N==null||((T=N.userInfo)===null||T===void 0||((y=T.course)===null||y===void 0))?void 0:y.course_school_id]);function Ee(){return _e.apply(this,arguments)}function _e(){return _e=Object(L.a)(k.a.mark(function ve(){var ye,we,Le;return k.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:return Ae.next=2,Object(w.a)("/api/schools/".concat(N==null||((ye=N.userInfo)===null||ye===void 0||((we=ye.course)===null||we===void 0))?void 0:we.course_school_id,"/ec_majors/get_major_list.json"),{method:"get"});case 2:Le=Ae.sent,Q(Le==null?void 0:Le.data),(H||M)&&ie();case 5:case"end":return Ae.stop()}},ve)})),_e.apply(this,arguments)}return console.log(ue),S.a.createElement("div",{style:{display:(h=N.userInfo.course)!==null&&h!==void 0&&h.is_openengineering?"":"none"}},S.a.createElement("p",{style:{fontSize:"16px",fontWeight:400}},"\u5DE5\u7A0B\u8BA4\u8BC1\u8003\u6838\u77E5\u8BC6\u70B9"),ue==null?void 0:ue.map(function(ve,ye){return S.a.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:"10px"}},S.a.createElement(A,{rz:me,item:ve,type:ye,setitem:function(Le){ue.splice(ye,1,Le),se(Object(z.a)(ue));var Ie=[];ue==null||ue.map(function(Ae){var De;Ae==null||((De=Ae.ec_point_ids)===null||De===void 0)||De.map(function(We){Ie.push(We)})}),X(Object(q.a)(Object(q.a)({},Le),{},{ec_point_ids:Ie}))}}),ye!=0&&S.a.createElement(b.a,{onClick:function(){ue.splice(ye,1),se(Object(z.a)(ue))},style:{marginLeft:10,fontSize:"20px"}}),S.a.createElement(P.a,{onClick:function(){ue.push({}),se(Object(z.a)(ue))},style:{marginLeft:10,fontSize:"20px"}}))}))},c=He.a=Object(m.a)(function(l){var a=l.classroomList,T=l.loading,y=l.globalSetting,h=l.user;return{classroomList:a,globalSetting:y,loading:T.effects,user:h}})(p)},h78n:function(qe,He,J){"use strict";J.d(He,"a",function(){return h});var q=J("cDcd"),z=J.n(q),L=J("TSYQ"),K=J.n(L),F={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},O=function(N){var W=N.map(function(){return Object(q.useRef)()}),M=Object(q.useRef)();return Object(q.useEffect)(function(){var I=Date.now(),H=!1;Object.keys(W).forEach(function(X){var te=W[X].current;if(!te)return;H=!0;var ae=te.style;ae.transitionDuration=".3s, .3s, .3s, .06s",M.current&&I-M.current<100&&(ae.transitionDuration="0s, 0s")}),H&&(M.current=Date.now())}),[W]};function B(){return B=Object.assign||function(U){for(var N=1;N<arguments.length;N++){var W=arguments[N];for(var M in W)Object.prototype.hasOwnProperty.call(W,M)&&(U[M]=W[M])}return U},B.apply(this,arguments)}function k(U,N){return P(U)||b(U,N)||S(U,N)||R()}function R(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S(U,N){if(!U)return;if(typeof U=="string")return m(U,N);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return m(U,N)}function m(U,N){(N==null||N>U.length)&&(N=U.length);for(var W=0,M=new Array(N);W<N;W++)M[W]=U[W];return M}function b(U,N){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],M=!0,I=!1,H=void 0;try{for(var X=U[Symbol.iterator](),te;!(M=(te=X.next()).done)&&!(W.push(te.value),N&&W.length===N);M=!0);}catch(ae){I=!0,H=ae}finally{try{!M&&X.return!=null&&X.return()}finally{if(I)throw H}}return W}function P(U){if(Array.isArray(U))return U}function w(U,N){if(U==null)return{};var W=x(U,N),M,I;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(U);for(I=0;I<H.length;I++){if(M=H[I],N.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,M))continue;W[M]=U[M]}}return W}function x(U,N){if(U==null)return{};var W={},M=Object.keys(U),I,H;for(H=0;H<M.length;H++){if(I=M[H],N.indexOf(I)>=0)continue;W[I]=U[I]}return W}var v=function(N){var W=N.className,M=N.percent,I=N.prefixCls,H=N.strokeColor,X=N.strokeLinecap,te=N.strokeWidth,ae=N.style,be=N.trailColor,pe=N.trailWidth,ue=N.transition,se=w(N,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete se.gapPosition;var he=Array.isArray(M)?M:[M],ne=Array.isArray(H)?H:[H],me=O(he),Q=k(me,1),ie=Q[0],ee=te/2,Ee=100-te/2,_e="M ".concat(X==="round"?ee:0,",").concat(ee,`
L `).concat(X==="round"?Ee:100,",").concat(ee),ve="0 0 100 ".concat(te),ye=0;return z.a.createElement("svg",B({className:K()("".concat(I,"-line"),W),viewBox:ve,preserveAspectRatio:"none",style:ae},se),z.a.createElement("path",{className:"".concat(I,"-line-trail"),d:_e,strokeLinecap:X,stroke:be,strokeWidth:pe||te,fillOpacity:"0"}),he.map(function(we,Le){var Ie={strokeDasharray:"".concat(we,"px, 100px"),strokeDashoffset:"-".concat(ye,"px"),transition:ue||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ae=ne[Le]||ne[ne.length-1];return ye+=we,z.a.createElement("path",{key:Le,className:"".concat(I,"-line-path"),d:_e,strokeLinecap:X,stroke:Ae,strokeWidth:te,fillOpacity:"0",ref:ie[Le],style:Ie})}))};v.defaultProps=F;var d=v;function o(){return o=Object.assign||function(U){for(var N=1;N<arguments.length;N++){var W=arguments[N];for(var M in W)Object.prototype.hasOwnProperty.call(W,M)&&(U[M]=W[M])}return U},o.apply(this,arguments)}function u(U,N){return A(U)||f(U,N)||C(U,N)||s()}function s(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C(U,N){if(!U)return;if(typeof U=="string")return E(U,N);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return E(U,N)}function E(U,N){(N==null||N>U.length)&&(N=U.length);for(var W=0,M=new Array(N);W<N;W++)M[W]=U[W];return M}function f(U,N){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],M=!0,I=!1,H=void 0;try{for(var X=U[Symbol.iterator](),te;!(M=(te=X.next()).done)&&!(W.push(te.value),N&&W.length===N);M=!0);}catch(ae){I=!0,H=ae}finally{try{!M&&X.return!=null&&X.return()}finally{if(I)throw H}}return W}function A(U){if(Array.isArray(U))return U}function g(U,N){if(U==null)return{};var W=p(U,N),M,I;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(U);for(I=0;I<H.length;I++){if(M=H[I],N.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,M))continue;W[M]=U[M]}}return W}function p(U,N){if(U==null)return{};var W={},M=Object.keys(U),I,H;for(H=0;H<M.length;H++){if(I=M[H],N.indexOf(I)>=0)continue;W[I]=U[I]}return W}var c=0;function l(U){return+U.replace("%","")}function a(U){return Array.isArray(U)?U:[U]}function T(U,N,W,M){var I=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,X=50-M/2,te=0,ae=-X,be=0,pe=-2*X;switch(H){case"left":te=-X,ae=0,be=2*X,pe=0;break;case"right":te=X,ae=0,be=-2*X,pe=0;break;case"bottom":ae=X,pe=2*X;break;default:}var ue="M 50,50 m ".concat(te,",").concat(ae,`
a `).concat(X,",").concat(X," 0 1 1 ").concat(be,",").concat(-pe,`
a `).concat(X,",").concat(X," 0 1 1 ").concat(-be,",").concat(pe),se=Math.PI*2*X,he={stroke:W,strokeDasharray:"".concat(N/100*(se-I),"px ").concat(se,"px"),strokeDashoffset:"-".concat(I/2+U/100*(se-I),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ue,pathStyle:he}}var y=function(N){var W=N.prefixCls,M=N.strokeWidth,I=N.trailWidth,H=N.gapDegree,X=N.gapPosition,te=N.trailColor,ae=N.strokeLinecap,be=N.style,pe=N.className,ue=N.strokeColor,se=N.percent,he=g(N,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ne=Object(q.useMemo)(function(){return c+=1,c},[]),me=T(0,100,te,M,H,X),Q=me.pathString,ie=me.pathStyle,ee=a(se),Ee=a(ue),_e=Ee.find(function(Ie){return Object.prototype.toString.call(Ie)==="[object Object]"}),ve=O(ee),ye=u(ve,1),we=ye[0],Le=function(){var Ae=0;return ee.map(function(De,We){var Ve=Ee[We]||Ee[Ee.length-1],je=Object.prototype.toString.call(Ve)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ne,")"):"",Ne=T(Ae,De,Ve,M,H,X);return Ae+=De,z.a.createElement("path",{key:We,className:"".concat(W,"-circle-path"),d:Ne.pathString,stroke:je,strokeLinecap:ae,strokeWidth:M,opacity:De===0?0:1,fillOpacity:"0",style:Ne.pathStyle,ref:we[We]})})};return z.a.createElement("svg",o({className:K()("".concat(W,"-circle"),pe),viewBox:"0 0 100 100",style:be},he),_e&&z.a.createElement("defs",null,z.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ne),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(_e).sort(function(Ie,Ae){return l(Ie)-l(Ae)}).map(function(Ie,Ae){return z.a.createElement("stop",{key:Ae,offset:Ie,stopColor:_e[Ie]})}))),z.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:Q,stroke:te,strokeLinecap:ae,strokeWidth:I||M,fillOpacity:"0",style:ie}),Le().reverse())};y.defaultProps=F;var h=y,D={Line:d,Circle:h}},kSUc:function(qe,He,J){},lLeG:function(qe,He,J){qe.exports={bg:"bg___f0e4_",flexRow:"flexRow___1-S6r",flexJustifyCenter:"flexJustifyCenter___3KkrV",flexAlignEnd:"flexAlignEnd___146T7",flexAlignCenter:"flexAlignCenter___2UVve",flexColumn:"flexColumn___nj9sg",formWrap:"formWrap___2eqbH",titleWrap:"titleWrap___1gkN2",fieldWrap:"fieldWrap___2l5q8",mdWrap:"mdWrap___38Ffu",backgroundFa:"backgroundFa___2gBUv",button:"button___3jgMh"}},lZu9:function(qe,He,J){(function(q){q(J("VrN/"),J("1eCo"),J("8EBN"))})(function(q){"use strict";q.defineMode("markdown",function(z,L){var K=q.getMode(z,"text/html"),F=K.name=="null";function O(M){if(q.findModeByName){var I=q.findModeByName(M);I&&(M=I.mime||I.mimes[0])}var H=q.getMode(z,M);return H.name=="null"?null:H}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.tokenTypeOverrides={});var B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var k in B)B.hasOwnProperty(k)&&L.tokenTypeOverrides[k]&&(B[k]=L.tokenTypeOverrides[k]);var R=/^([*\-_])(?:\s*\1){2,}\s*$/,S=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,m=/^\[(x| )\](?=\s)/i,b=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,x=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,v=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function u(M,I,H){return I.f=I.inline=H,H(M,I)}function s(M,I,H){return I.f=I.block=H,H(M,I)}function C(M){return!M||!/\S/.test(M.string)}function E(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==A){var I=F;if(!I){var H=q.innerMode(K,M.htmlState);I=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}I&&(M.f=l,M.block=f,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function f(M,I){var H=M.column()===I.indentation,X=C(I.prevLine.stream),te=I.indentedCode,ae=I.prevLine.hr,be=I.list!==!1,pe=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var ue=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,be)){for(I.list=null;ue<I.listStack[I.listStack.length-1];)I.listStack.pop(),I.listStack.length?I.indentation=I.listStack[I.listStack.length-1]:I.list=!1;I.list!==!1&&(I.indentationDiff=ue-I.listStack[I.listStack.length-1])}var se=!X&&!ae&&!I.prevLine.header&&(!be||!te)&&!I.prevLine.fencedCodeEnd,he=(I.list===!1||ae||X)&&I.indentation<=pe&&M.match(R),ne=null;if(I.indentationDiff>=4&&(te||I.prevLine.fencedCodeEnd||I.prevLine.header||X))return M.skipToEnd(),I.indentedCode=!0,B.code;if(M.eatSpace())return null;if(H&&I.indentation<=pe&&(ne=M.match(b))&&ne[1].length<=6)return I.quote=0,I.header=ne[1].length,I.thisLine.header=!0,L.highlightFormatting&&(I.formatting="header"),I.f=I.inline,p(I);if(I.indentation<=pe&&M.eat(">"))return I.quote=H?1:I.quote+1,L.highlightFormatting&&(I.formatting="quote"),M.eatSpace(),p(I);if(!he&&!I.setext&&H&&I.indentation<=pe&&(ne=M.match(S))){var me=ne[1]?"ol":"ul";return I.indentation=ue+M.current().length,I.list=!0,I.quote=0,I.listStack.push(I.indentation),I.em=!1,I.strong=!1,I.code=!1,I.strikethrough=!1,L.taskLists&&M.match(m,!1)&&(I.taskList=!0),I.f=I.inline,L.highlightFormatting&&(I.formatting=["list","list-"+me]),p(I)}else{if(H&&I.indentation<=pe&&(ne=M.match(x,!0)))return I.quote=0,I.fencedEndRE=new RegExp(ne[1]+"+ *$"),I.localMode=L.fencedCodeBlockHighlighting&&O(ne[2]||L.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=q.startState(I.localMode)),I.f=I.block=g,L.highlightFormatting&&(I.formatting="code-block"),I.code=-1,p(I);if(I.setext||(!se||!be)&&!I.quote&&I.list===!1&&!I.code&&!he&&!v.test(M.string)&&(ne=M.lookAhead(1))&&(ne=ne.match(P)))return I.setext?(I.header=I.setext,I.setext=0,M.skipToEnd(),L.highlightFormatting&&(I.formatting="header")):(I.header=ne[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,p(I);if(he)return M.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,B.hr;if(M.peek()==="[")return u(M,I,D)}return u(M,I,I.inline)}function A(M,I){var H=K.token(M,I.htmlState);if(!F){var X=q.innerMode(K,I.htmlState);(X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText||I.md_inside&&M.current().indexOf(">")>-1)&&(I.f=l,I.block=f,I.htmlState=null)}return H}function g(M,I){var H=I.listStack[I.listStack.length-1]||0,X=I.indentation<H,te=H+3;if(I.fencedEndRE&&I.indentation<=te&&(X||M.match(I.fencedEndRE))){L.highlightFormatting&&(I.formatting="code-block");var ae;return X||(ae=p(I)),I.localMode=I.localState=null,I.block=f,I.f=l,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,X?s(M,I,I.block):ae}else return I.localMode?I.localMode.token(M,I.localState):(M.skipToEnd(),B.code)}function p(M){var I=[];if(M.formatting){I.push(B.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var H=0;H<M.formatting.length;H++)I.push(B.formatting+"-"+M.formatting[H]),M.formatting[H]==="header"&&I.push(B.formatting+"-"+M.formatting[H]+"-"+M.header),M.formatting[H]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=M.quote?I.push(B.formatting+"-"+M.formatting[H]+"-"+M.quote):I.push("error"))}if(M.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(M.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(M.linkHref?I.push(B.linkHref,"url"):(M.strong&&I.push(B.strong),M.em&&I.push(B.em),M.strikethrough&&I.push(B.strikethrough),M.emoji&&I.push(B.emoji),M.linkText&&I.push(B.linkText),M.code&&I.push(B.code),M.image&&I.push(B.image),M.imageAltText&&I.push(B.imageAltText,"link"),M.imageMarker&&I.push(B.imageMarker)),M.header&&I.push(B.header,B.header+"-"+M.header),M.quote&&(I.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=M.quote?I.push(B.quote+"-"+M.quote):I.push(B.quote+"-"+L.maxBlockquoteDepth)),M.list!==!1){var X=(M.listStack.length-1)%3;X?X===1?I.push(B.list2):I.push(B.list3):I.push(B.list1)}return M.trailingSpaceNewLine?I.push("trailing-space-new-line"):M.trailingSpace&&I.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function c(M,I){return M.match(w,!0)?p(I):void 0}function l(M,I){var H=I.text(M,I);if(typeof H!="undefined")return H;if(I.list)return I.list=null,p(I);if(I.taskList){var X=M.match(m,!0)[1]===" ";return X?I.taskOpen=!0:I.taskClosed=!0,L.highlightFormatting&&(I.formatting="task"),I.taskList=!1,p(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&M.match(/^#+$/,!0))return L.highlightFormatting&&(I.formatting="header"),p(I);var te=M.next();if(I.linkTitle){I.linkTitle=!1;var ae=te;te==="("&&(ae=")"),ae=(ae+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var be="^\\s*(?:[^"+ae+"\\\\]+|\\\\\\\\|\\\\.)"+ae;if(M.match(new RegExp(be),!0))return B.linkHref}if(te==="`"){var pe=I.formatting;L.highlightFormatting&&(I.formatting="code"),M.eatWhile("`");var ue=M.current().length;if(I.code==0&&(!I.quote||ue==1))return I.code=ue,p(I);if(ue==I.code){var se=p(I);return I.code=0,se}else return I.formatting=pe,p(I)}else if(I.code)return p(I);if(te==="\\"&&(M.next(),L.highlightFormatting)){var he=p(I),ne=B.formatting+"-escape";return he?he+" "+ne:ne}if(te==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,L.highlightFormatting&&(I.formatting="image"),p(I);if(te==="["&&I.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,L.highlightFormatting&&(I.formatting="image"),p(I);if(te==="]"&&I.imageAltText){L.highlightFormatting&&(I.formatting="image");var he=p(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=T,he}if(te==="["&&!I.image)return I.linkText&&M.match(/^.*?\]/)||(I.linkText=!0,L.highlightFormatting&&(I.formatting="link")),p(I);if(te==="]"&&I.linkText){L.highlightFormatting&&(I.formatting="link");var he=p(I);return I.linkText=!1,I.inline=I.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?T:l,he}if(te==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,L.highlightFormatting&&(I.formatting="link");var he=p(I);return he?he+=" ":he="",he+B.linkInline}if(te==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,L.highlightFormatting&&(I.formatting="link");var he=p(I);return he?he+=" ":he="",he+B.linkEmail}if(L.xml&&te==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var me=M.string.indexOf(">",M.pos);if(me!=-1){var Q=M.string.substring(M.start,me);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Q)&&(I.md_inside=!0)}return M.backUp(1),I.htmlState=q.startState(K),s(M,I,A)}if(L.xml&&te==="<"&&M.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(te==="*"||te==="_"){for(var ie=1,ee=M.pos==1?" ":M.string.charAt(M.pos-2);ie<3&&M.eat(te);)ie++;var Ee=M.peek()||" ",_e=!/\s/.test(Ee)&&(!d.test(Ee)||/\s/.test(ee)||d.test(ee)),ve=!/\s/.test(ee)&&(!d.test(ee)||/\s/.test(Ee)||d.test(Ee)),ye=null,we=null;if(ie%2&&(!I.em&&_e&&(te==="*"||!ve||d.test(ee))?ye=!0:I.em==te&&ve&&(te==="*"||!_e||d.test(Ee))&&(ye=!1)),ie>1&&(!I.strong&&_e&&(te==="*"||!ve||d.test(ee))?we=!0:I.strong==te&&ve&&(te==="*"||!_e||d.test(Ee))&&(we=!1)),we!=null||ye!=null){L.highlightFormatting&&(I.formatting=ye==null?"strong":we==null?"em":"strong em"),ye===!0&&(I.em=te),we===!0&&(I.strong=te);var se=p(I);return ye===!1&&(I.em=!1),we===!1&&(I.strong=!1),se}}else if(te===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return p(I);M.backUp(1)}if(L.strikethrough){if(te==="~"&&M.eatWhile(te)){if(I.strikethrough){L.highlightFormatting&&(I.formatting="strikethrough");var se=p(I);return I.strikethrough=!1,se}else if(M.match(/^[^\s]/,!1))return I.strikethrough=!0,L.highlightFormatting&&(I.formatting="strikethrough"),p(I)}else if(te===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return p(I);M.backUp(2)}}if(L.emoji&&te===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,L.highlightFormatting&&(I.formatting="emoji");var Le=p(I);return I.emoji=!1,Le}return te===" "&&(M.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),p(I)}function a(M,I){var H=M.next();if(H===">"){I.f=I.inline=l,L.highlightFormatting&&(I.formatting="link");var X=p(I);return X?X+=" ":X="",X+B.linkInline}return M.match(/^[^>]+/,!0),B.linkInline}function T(M,I){if(M.eatSpace())return null;var H=M.next();return H==="("||H==="["?(I.f=I.inline=h(H==="("?")":"]"),L.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,p(I)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function h(M){return function(I,H){var X=I.next();if(X===M){H.f=H.inline=l,L.highlightFormatting&&(H.formatting="link-string");var te=p(H);return H.linkHref=!1,te}return I.match(y[M]),H.linkHref=!0,p(H)}}function D(M,I){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=U,M.next(),L.highlightFormatting&&(I.formatting="link"),I.linkText=!0,p(I)):u(M,I,l)}function U(M,I){if(M.match(/^\]:/,!0)){I.f=I.inline=N,L.highlightFormatting&&(I.formatting="link");var H=p(I);return I.linkText=!1,H}return M.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function N(M,I){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?I.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.inline=l,B.linkHref+" url")}var W={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:l,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&q.copyState(K,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?q.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,I){if(I.formatting=!1,M!=I.thisLine.stream){if(I.header=0,I.hr=!1,M.match(/^\s*$/,!0))return E(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:M},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=A)){var H=M.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(I.indentation=H,I.indentationDiff=null,H>0)return null}}return I.f(M,I)},innerMode:function(M){return M.block==A?{state:M.htmlState,mode:K}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:W}},indent:function(M,I,H){return M.block==A&&K.indent?K.indent(M.htmlState,I,H):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,I,H):q.Pass},blankLine:E,getType:p,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),q.defineMIME("text/markdown","markdown"),q.defineMIME("text/x-markdown","markdown")})},nVVt:function(qe,He){qe.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(qe,He,J){(function(q){q(J("VrN/"))})(function(q){"use strict";var z=q.Pos;function L(d,o){return d.line-o.line||d.ch-o.ch}var K="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",F=K+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+K+"]["+F+"]*)","g");function B(d,o,u,s){this.line=o,this.ch=u,this.cm=d,this.text=d.getLine(o),this.min=s?Math.max(s.from,d.firstLine()):d.firstLine(),this.max=s?Math.min(s.to-1,d.lastLine()):d.lastLine()}function k(d,o){var u=d.cm.getTokenTypeAt(z(d.line,o));return u&&/\btag\b/.test(u)}function R(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function S(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function m(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(R(d))continue;return}if(!k(d,o+1)){d.ch=o+1;continue}var u=d.text.lastIndexOf("/",o),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function b(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(S(d))continue;return}if(!k(d,o+1)){d.ch=o;continue}O.lastIndex=o,d.ch=o;var u=O.exec(d.text);if(u&&u.index==o)return u}}function P(d){for(;;){O.lastIndex=d.ch;var o=O.exec(d.text);if(!o){if(R(d))continue;return}if(!k(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function w(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(S(d))continue;return}if(!k(d,o+1)){d.ch=o;continue}var u=d.text.lastIndexOf("/",o),s=u>-1&&!/\S/.test(d.text.slice(u+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function x(d,o){for(var u=[];;){var s=P(d),C,E=d.line,f=d.ch-(s?s[0].length:0);if(!s||!(C=m(d)))return;if(C=="selfClose")continue;if(s[1]){for(var A=u.length-1;A>=0;--A)if(u[A]==s[2]){u.length=A;break}if(A<0&&(!o||o==s[2]))return{tag:s[2],from:z(E,f),to:z(d.line,d.ch)}}else u.push(s[2])}}function v(d,o){for(var u=[];;){var s=w(d);if(!s)return;if(s=="selfClose"){b(d);continue}var C=d.line,E=d.ch,f=b(d);if(!f)return;if(f[1])u.push(f[2]);else{for(var A=u.length-1;A>=0;--A)if(u[A]==f[2]){u.length=A;break}if(A<0&&(!o||o==f[2]))return{tag:f[2],from:z(d.line,d.ch),to:z(C,E)}}}}q.registerHelper("fold","xml",function(d,o){for(var u=new B(d,o.line,0);;){var s=P(u);if(!s||u.line!=o.line)return;var C=m(u);if(!C)return;if(!s[1]&&C!="selfClose"){var E=z(u.line,u.ch),f=x(u,s[2]);return f&&L(f.from,E)>0?{from:E,to:f.from}:null}}}),q.findMatchingTag=function(d,o,u){var s=new B(d,o.line,o.ch,u);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1)return;var C=m(s),E=C&&z(s.line,s.ch),f=C&&b(s);if(!C||!f||L(s,o)>0)return;var A={from:z(s.line,s.ch),to:E,tag:f[2]};return C=="selfClose"?{open:A,close:null,at:"open"}:f[1]?{open:v(s,f[2]),close:A,at:"close"}:(s=new B(d,E.line,E.ch,u),{open:A,close:x(s,f[2]),at:"open"})},q.findEnclosingTag=function(d,o,u,s){for(var C=new B(d,o.line,o.ch,u);;){var E=v(C,s);if(!E)break;var f=new B(d,o.line,o.ch,u),A=x(f,E.tag);if(A)return{open:E,close:A}}},q.scanForClosingTag=function(d,o,u,s){var C=new B(d,o.line,o.ch,s?{from:0,to:s}:null);return x(C,u)}})},p5ED:function(qe,He,J){"use strict";var q=J("+L6B"),z=J("2/Rp"),L=J("5Dmo"),K=J("3S7+"),F=J("k1fw"),O=J("tJVT"),B=J("cDcd"),k=J.n(B),R=J("vHTk"),S=J.n(R),m=J("yEEn"),b=J("ZW9T"),P=J("1vsH");He.a=function(w){var x=w.name,v=w.data,d=w.theme,o=w.type,u=w.filename,s=w.monacoEditor,C=w.className,E=w.style,f=w.close,A=w.onClose,g=w.hasMask,p=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(O.a)(p,2),l=c[0],a=c[1],T=Object(B.useState)(""),y=Object(O.a)(T,2),h=y[0],D=y[1],U,N=1024*1024,W=10*N,M=Object(B.useRef)();o==="office"&&(U=Object(P.V)(v).filesize,U>W&&(o="other")),u&&(s.filename=u),Object(B.useEffect)(function(){var X,te,ae=(X=document.cookie)===null||X===void 0||((te=X.replace(/\s/g,""))===null||te===void 0)?void 0:te.split(";");ae==null||ae.map(function(be){var pe=be.split("=");pe[0]==="_educoder_session"&&D(pe[1])})},[]);var I=function(){if(v.startsWith("http")||v.startsWith("blob:")){H();return}Object(P.z)(u||"educoder",v,u)},H=function(){Object(P.x)(u||"educoder",decodeURIComponent(v))};return console.log("data:",v,"fileanme:",u," name:",x),k.a.createElement("div",{style:Object(F.a)({},E||{}),className:"".concat(g&&S.a.bgBlack," ").concat(o?S.a.wrp:"hide")},f&&k.a.createElement("div",{className:S.a.close,ref:M},k.a.createElement(K.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return M.current}},k.a.createElement("span",{onClick:H},k.a.createElement("i",{className:"icon-quxiaozhiding"}))),k.a.createElement(K.a,{title:"\u5173\u95ED",getPopupContainer:function(){return M.current}},k.a.createElement("span",{className:"",onClick:A},k.a.createElement("i",{className:"icon-guanbi1"})))),k.a.createElement("div",{className:"".concat(S.a[C]," ").concat(C," ").concat(S.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&k.a.createElement(b.b,s)),o==="audio"&&k.a.createElement("audio",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?v:"data:audio/mp3;base64,").concat(v),autoPlay:!0}),o==="video"&&k.a.createElement(k.a.Fragment,null,v!=null&&v.startsWith("/")?k.a.createElement("video",{controls:!0,src:"".concat(v),autoPlay:!0}):k.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(v),autoPlay:!0})),o==="html"&&k.a.createElement("iframe",{src:v+"&disposition=inline"}),o==="html"&&k.a.createElement("iframe",{src:v+"&disposition=inline"}),o==="pdf"&&k.a.createElement("embed",{className:S.a.embed,src:v}),o==="image"&&k.a.createElement(k.a.Fragment,null,k.a.createElement("img",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(v)})),o==="other"&&k.a.createElement("div",null,k.a.createElement(z.a,{type:"primary",size:"large",onClick:I},k.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&k.a.createElement(z.a,{type:"primary",size:"large",onClick:I},k.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(qe,He,J){},"rAM+":function(qe,He,J){"use strict";J.d(He,"a",function(){return z});var q=J("Qw5x");function z(L,K){var F;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(F=Object(q.a)(L))||K&&L&&typeof L.length=="number"){F&&(L=F);var O=0,B=function(){};return{s:B,n:function(){return O>=L.length?{done:!0}:{done:!1,value:L[O++]}},e:function(b){throw b},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var k=!0,R=!1,S;return{s:function(){F=L[Symbol.iterator]()},n:function(){var b=F.next();return k=b.done,b},e:function(b){R=!0,S=b},f:function(){try{!k&&F.return!=null&&F.return()}finally{if(R)throw S}}}}},rUJ1:function(qe,He){const J=/[&<>"']/,q=/[&<>"']/g,z=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,K={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},F=g=>K[g];function O(g,p){if(p){if(J.test(g))return g.replace(q,F)}else if(z.test(g))return g.replace(L,F);return g}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(g){return g.replace(B,(p,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const R=/(^|[^\[])\^/g;function S(g,p){g=g.source||g,p=p||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(R,"$1"),g=g.replace(l,a),c),getRegex:()=>new RegExp(g,p)};return c}const m=/[^\w:]/g,b=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(g,p,c){if(g){let l;try{l=decodeURIComponent(k(c)).replace(m,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}p&&!b.test(c)&&(c=o(p,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const w={},x=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(g,p){w[" "+g]||(x.test(g)?w[" "+g]=g+"/":w[" "+g]=E(g,"/",!0)),g=w[" "+g];const c=g.indexOf(":")===-1;return p.substring(0,2)==="//"?c?p:g.replace(v,"$1")+p:p.charAt(0)==="/"?c?p:g.replace(d,"$1")+p:g+p}const u={exec:function(){}};function s(g){let p=1,c,l;for(;p<arguments.length;p++){c=arguments[p];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(g[l]=c[l])}return g}function C(g,p){const c=g.replace(/\|/g,(T,y,h)=>{let D=!1,U=y;for(;--U>=0&&h[U]==="\\";)D=!D;return D?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>p)l.splice(p);else for(;l.length<p;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function E(g,p,c){const l=g.length;if(l===0)return"";let a=0;for(;a<l;){const T=g.charAt(l-a-1);if(T===p&&!c)a++;else if(T!==p&&c)a++;else break}return g.substr(0,l-a)}function f(g,p){if(g.indexOf(p[1])===-1)return-1;const c=g.length;let l=0,a=0;for(;a<c;a++)if(g[a]==="\\")a++;else if(g[a]===p[0])l++;else if(g[a]===p[1]&&(l--,l<0))return a;return-1}function A(g){g&&g.sanitize&&!g.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")}qe.exports={escape:O,unescape:k,edit:S,cleanUrl:P,resolveUrl:o,noopTest:u,merge:s,splitCells:C,rtrim:E,findClosingBracket:f,checkSanitizeDeprecation:A}},rcnY:function(qe,He,J){var q=J("aRTE");function z(L,K){this.totalCount=L,this.dataCount=K}z.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],z.getRSBlocks=function(L,K){var F=z.getRsBlockTable(L,K);if(F==null)throw new Error("bad rs block @ typeNumber:"+L+"/errorCorrectLevel:"+K);for(var O=F.length/3,B=new Array,k=0;k<O;k++)for(var R=F[k*3+0],S=F[k*3+1],m=F[k*3+2],b=0;b<R;b++)B.push(new z(S,m));return B},z.getRsBlockTable=function(L,K){switch(K){case q.L:return z.RS_BLOCK_TABLE[(L-1)*4+0];case q.M:return z.RS_BLOCK_TABLE[(L-1)*4+1];case q.Q:return z.RS_BLOCK_TABLE[(L-1)*4+2];case q.H:return z.RS_BLOCK_TABLE[(L-1)*4+3];default:return}},qe.exports=z},tt94:function(qe,He,J){"use strict";J.r(He);var q=J("+L6B"),z=J("2/Rp"),L=J("sRBo"),K=J("kaz8"),F=J("14J3"),O=J("BMrR"),B=J("jCWc"),k=J("kPKH"),R=J("giR+"),S=J("fyUT"),m=J("5NDa"),b=J("5rEg"),P=J("sPJy"),w=J("bE4q"),x=J("k1fw"),v=J("miYZ"),d=J("tsqr"),o=J("9og8"),u=J("y8nQ"),s=J("Vl3Y"),C=J("tJVT"),E=J("WmNS"),f=J.n(E),A=J("cDcd"),g=J.n(A),p=J("9kvl"),c=J("55Ip"),l=J("1vsH"),a=J("Ot1p"),T=J("XYT7"),y=J("lLeG"),h=J.n(y),D=J("500L"),U=J("gMzb"),N=J("ErOA"),W=function(I){var H,X=I.shixunHomeworks,te=I.newCourse,ae=I.globalSetting,be=I.loading,pe=I.dispatch,ue=I.match,se=s.a.useForm(),he=Object(C.a)(se,1),ne=he[0],me=Object(A.useState)({}),Q=Object(C.a)(me,2),ie=Q[0],ee=Q[1],Ee=Object(A.useRef)(),_e=X.commonHomeWorkAddDefaultData,ve=Object(A.useState)({}),ye=Object(C.a)(ve,2),we=ye[0],Le=ye[1];Object(A.useEffect)(function(){setTimeout(function(){document.body.scrollIntoView()},300);var We=ue.params,Ve=We.coursesId,je=We.categoryId;pe({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:je,coursesId:Ve,type:3}})},[]);var Ie=function(){var We=Object(o.a)(f.a.mark(function Ve(je){var Ne,Je,Xe,Ze,Ce,et,Ye;return f.a.wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:if(!(ie.min_num>ie.max_num)){Ue.next=3;break}return d.b.info("\u6700\u5927\u4EBA\u6570\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u4EBA\u6570"),Ue.abrupt("return");case 3:return Ne=Object(x.a)({},ie),Ne.attachment_ids&&(Ne.attachment_ids=Ne==null||((Je=Ne.attachment_ids)===null||Je===void 0)?void 0:Je.map(function(ge){return ge.response.id})),Ne.reference_attachment_ids&&(Ne.reference_attachment_ids=Ne==null||((Xe=Ne.reference_attachment_ids)===null||Xe===void 0)?void 0:Xe.map(function(ge){return ge.response.id})),Ze=ue.params,Ce=Ze.coursesId,et=Ze.categoryId,Ue.next=9,Object(T.a)(Object(x.a)(Object(x.a)({coursesId:Ce,category:et},Ne),{},{type:3}));case 9:Ye=Ue.sent,Ye.status===0&&(Ae(Ye.homework_id),Object(l.eb)(["\u6559\u5B66\u8BFE\u5802","\u5206\u7EC4\u4F5C\u4E1A","\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"]),p.d.push("/classrooms/".concat(Ce,"/group_homework/").concat(Ye.homework_id,"/detail")));case 11:case"end":return Ue.stop()}},Ve)}));return function(je){return We.apply(this,arguments)}}();function Ae(We){return De.apply(this,arguments)}function De(){return De=Object(o.a)(f.a.mark(function We(Ve){var je;return f.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:if(we!=null&&we.ec_point_ids){Je.next=2;break}return Je.abrupt("return");case 2:return Je.next=4,Object(N.a)("/api/ec_courses/".concat(we==null?void 0:we.ec_course_id,"/ec_points/set_work_points.json"),{method:"post",body:Object(x.a)({homework_common_id:Ve},we)});case 4:je=Je.sent;case 5:case"end":return Je.stop()}},We)})),De.apply(this,arguments)}return g.a.createElement("section",{className:h.a.bg},_e.course_name&&g.a.createElement("section",{className:"animated fadeIn"},g.a.createElement("aside",{className:"mt10"},_e.category&&g.a.createElement(w.a,{separator:">"},g.a.createElement(w.a.Item,null,g.a.createElement(c.a,{to:"/classrooms/".concat(_e.course_id,"/group_homework")},_e.course_name)),g.a.createElement(w.a.Item,null,g.a.createElement(c.a,{to:"/classrooms/".concat(_e.course_id,"/group_homework")},_e.category.category_name)),g.a.createElement(w.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),g.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"),g.a.createElement(s.a,{form:ne,className:h.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){ee(Object(x.a)({},ne.getFieldsValue()))},initialValues:{base_on_project:!1},onFinish:Ie},g.a.createElement("div",{className:h.a.fieldWrap},g.a.createElement(s.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},g.a.createElement(b.a,{maxLength:60,suffix:"".concat(((H=ie.name)===null||H===void 0?void 0:H.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),g.a.createElement("div",{className:h.a.mdWrap},g.a.createElement(s.a.Item,{name:"description",label:"\u5185\u5BB9:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},g.a.createElement(a.a,{watch:!0,defaultValue:ie.intro})),g.a.createElement("div",null,g.a.createElement(s.a.Item,{name:"attachment_ids"},g.a.createElement(D.b,null))),g.a.createElement(O.a,{gutter:[20,20]},g.a.createElement(k.a,{flex:"230px"},g.a.createElement(s.a.Item,{name:"min_num",label:"\u5206\u7EC4\u8BBE\u7F6E",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}]},g.a.createElement(S.a,{style:{width:200},min:1,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}))),g.a.createElement(k.a,{flex:"230px"},g.a.createElement(s.a.Item,{name:"max_num",label:g.a.createElement("div",null,"\xA0"),rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}]},g.a.createElement(S.a,{style:{width:200},max:100,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}))),g.a.createElement(k.a,null,g.a.createElement("div",{className:"mt30"},"\uFF08\u5B66\u751F\u63D0\u4EA4\u4F5C\u54C1\u65F6\u9700\u8981\u5173\u8054\u540C\u7EC4\u6210\u5458\uFF0C\u7EC4\u5185\u6210\u5458\u4F5C\u54C1\u5171\u4EAB\uFF09"))),g.a.createElement(O.a,null,g.a.createElement(k.a,null,g.a.createElement(s.a.Item,{name:"base_on_project",valuePropName:"checked"},g.a.createElement(K.a,{value:!0},"\u57FA\u4E8E\u9879\u76EE\u5B9E\u65BD")),g.a.createElement("span",{className:"c-light-black"},"\uFF08\u9009\u4E2D\uFF0C\u5219\u5FC5\u987B\u5728\u672C\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u9879\u76EE\u7BA1\u7406\u5458\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF1B\u4E0D\u9009\u4E2D\uFF0C\u65E0\u9700\u5728\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u4EFB\u610F\u5C0F\u7EC4\u6210\u5458\u5747\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF09")))),g.a.createElement("div",{className:h.a.mdWrap},g.a.createElement(s.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},g.a.createElement(a.a,{watch:!0,defaultValue:ie.notice})),g.a.createElement("div",null,g.a.createElement(s.a.Item,{name:"reference_attachment_ids"},g.a.createElement(D.b,null))))),g.a.createElement("div",{className:h.a.mdWrap},g.a.createElement(U.a,{setitem:function(Ve){return Le(Object(x.a)({},Ve))}})),g.a.createElement("div",{className:h.a.backgroundFa},g.a.createElement("div",{className:"pt40 mb30"},g.a.createElement(s.a.Item,null,g.a.createElement(z.a,{size:"large",type:"primary",onClick:function(){ne.submit()},className:"".concat(h.a.button," mr20"),htmlType:"submit",loading:be["newCourse/editCourse"]||be["newCourse/submitCourse"]},"\u63D0\u4EA4"),g.a.createElement(z.a,{size:"large",type:"primary",ghost:!0,className:h.a.button,onClick:function(){return p.d.push("/classrooms/".concat(ue.params.coursesId,"/group_homework"))}},"\u53D6\u6D88")))))};He.default=Object(p.a)(function(M){var I=M.shixunHomeworks,H=M.newCourse,X=M.loading,te=M.globalSetting;return{shixunHomeworks:I,newCourse:H,globalSetting:te,loading:X.effects}})(W)},ulZh:function(qe,He,J){typeof window!="undefined"&&function(z,L){qe.exports=L()}(this,function(){return function(q){var z={};function L(K){if(z[K])return z[K].exports;var F=z[K]={i:K,l:!1,exports:{}};return q[K].call(F.exports,F,F.exports,L),F.l=!0,F.exports}return L.m=q,L.c=z,L.d=function(K,F,O){L.o(K,F)||Object.defineProperty(K,F,{enumerable:!0,get:O})},L.r=function(K){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(K,"__esModule",{value:!0})},L.t=function(K,F){if(F&1&&(K=L(K)),F&8)return K;if(F&4&&typeof K=="object"&&K&&K.__esModule)return K;var O=Object.create(null);if(L.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:K}),F&2&&typeof K!="string")for(var B in K)L.d(O,B,function(k){return K[k]}.bind(null,B));return O},L.n=function(K){var F=K&&K.__esModule?function(){return K.default}:function(){return K};return L.d(F,"a",F),F},L.o=function(K,F){return Object.prototype.hasOwnProperty.call(K,F)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(q,z,L){"use strict";var K=Object.prototype.hasOwnProperty,F="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(F=!1));function B(m,b,P){this.fn=m,this.context=b,this.once=P||!1}function k(m,b,P,w,x){if(typeof P!="function")throw new TypeError("The listener must be a function");var v=new B(P,w||m,x),d=F?F+b:b;return m._events[d]?m._events[d].fn?m._events[d]=[m._events[d],v]:m._events[d].push(v):(m._events[d]=v,m._eventsCount++),m}function R(m,b){--m._eventsCount===0?m._events=new O:delete m._events[b]}function S(){this._events=new O,this._eventsCount=0}S.prototype.eventNames=function(){var b=[],P,w;if(this._eventsCount===0)return b;for(w in P=this._events)K.call(P,w)&&b.push(F?w.slice(1):w);return Object.getOwnPropertySymbols?b.concat(Object.getOwnPropertySymbols(P)):b},S.prototype.listeners=function(b){var P=F?F+b:b,w=this._events[P];if(!w)return[];if(w.fn)return[w.fn];for(var x=0,v=w.length,d=new Array(v);x<v;x++)d[x]=w[x].fn;return d},S.prototype.listenerCount=function(b){var P=F?F+b:b,w=this._events[P];return w?w.fn?1:w.length:0},S.prototype.emit=function(b,P,w,x,v,d){var o=F?F+b:b;if(!this._events[o])return!1;var u=this._events[o],s=arguments.length,C,E;if(u.fn){u.once&&this.removeListener(b,u.fn,void 0,!0);switch(s){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,P),!0;case 3:return u.fn.call(u.context,P,w),!0;case 4:return u.fn.call(u.context,P,w,x),!0;case 5:return u.fn.call(u.context,P,w,x,v),!0;case 6:return u.fn.call(u.context,P,w,x,v,d),!0}for(E=1,C=new Array(s-1);E<s;E++)C[E-1]=arguments[E];u.fn.apply(u.context,C)}else{var f=u.length,A;for(E=0;E<f;E++){u[E].once&&this.removeListener(b,u[E].fn,void 0,!0);switch(s){case 1:u[E].fn.call(u[E].context);break;case 2:u[E].fn.call(u[E].context,P);break;case 3:u[E].fn.call(u[E].context,P,w);break;case 4:u[E].fn.call(u[E].context,P,w,x);break;default:if(!C)for(A=1,C=new Array(s-1);A<s;A++)C[A-1]=arguments[A];u[E].fn.apply(u[E].context,C)}}}return!0},S.prototype.on=function(b,P,w){return k(this,b,P,w,!1)},S.prototype.once=function(b,P,w){return k(this,b,P,w,!0)},S.prototype.removeListener=function(b,P,w,x){var v=F?F+b:b;if(!this._events[v])return this;if(!P)return R(this,v),this;var d=this._events[v];if(d.fn)d.fn===P&&(!x||d.once)&&(!w||d.context===w)&&R(this,v);else{for(var o=0,u=[],s=d.length;o<s;o++)(d[o].fn!==P||x&&!d[o].once||w&&d[o].context!==w)&&u.push(d[o]);u.length?this._events[v]=u.length===1?u[0]:u:R(this,v)}return this},S.prototype.removeAllListeners=function(b){var P;return b?(P=F?F+b:b,this._events[P]&&R(this,P)):(this._events=new O,this._eventsCount=0),this},S.prototype.off=S.prototype.removeListener,S.prototype.addListener=S.prototype.on,S.prefixed=F,S.EventEmitter=S,q.exports=S},"./node_modules/url-toolkit/src/url-toolkit.js":function(q,z,L){(function(K){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(S,m,b){if(b=b||{},S=S.trim(),m=m.trim(),!m){if(!b.alwaysNormalize)return S;var P=R.parseURL(S);if(!P)throw new Error("Error trying to parse base URL.");return P.path=R.normalizePath(P.path),R.buildURLFromParts(P)}var w=R.parseURL(m);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return b.alwaysNormalize?(w.path=R.normalizePath(w.path),R.buildURLFromParts(w)):m;var x=R.parseURL(S);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var v=O.exec(x.path);x.netLoc=v[1],x.path=v[2]}x.netLoc&&!x.path&&(x.path="/");var d={scheme:x.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(d.netLoc=x.netLoc,w.path[0]!=="/"))if(!w.path)d.path=x.path,w.params||(d.params=x.params,w.query||(d.query=x.query));else{var o=x.path,u=o.substring(0,o.lastIndexOf("/")+1)+w.path;d.path=R.normalizePath(u)}return d.path===null&&(d.path=b.alwaysNormalize?R.normalizePath(w.path):w.path),R.buildURLFromParts(d)},parseURL:function(S){var m=F.exec(S);return m?{scheme:m[1]||"",netLoc:m[2]||"",path:m[3]||"",params:m[4]||"",query:m[5]||"",fragment:m[6]||""}:null},normalizePath:function(S){for(S=S.split("").reverse().join("").replace(B,"");S.length!==(S=S.replace(k,"")).length;);return S.split("").reverse().join("")},buildURLFromParts:function(S){return S.scheme+S.netLoc+S.path+S.params+S.query+S.fragment}};q.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(q,z,L){function K(b){var P={};function w(v){if(P[v])return P[v].exports;var d=P[v]={i:v,l:!1,exports:{}};return b[v].call(d.exports,d,d.exports,w),d.l=!0,d.exports}w.m=b,w.c=P,w.i=function(v){return v},w.d=function(v,d,o){w.o(v,d)||Object.defineProperty(v,d,{configurable:!1,enumerable:!0,get:o})},w.r=function(v){Object.defineProperty(v,"__esModule",{value:!0})},w.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return w.d(d,"a",d),d},w.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)},w.p="/",w.oe=function(v){throw console.error(v),v};var x=w(w.s=ENTRY_MODULE);return x.default||x}var F="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function B(b){return(b+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(b){return!isNaN(1*b)}function R(b,P,w){var x={};x[w]=[];var v=P.toString(),d=v.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return x;for(var o=d[1],u=new RegExp("(\\\\n|\\W)"+B(o)+O,"g"),s;s=u.exec(v);){if(s[3]==="dll-reference")continue;x[w].push(s[3])}for(u=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+O,"g");s=u.exec(v);)b[s[2]]||(x[w].push(s[1]),b[s[2]]=L(s[1]).m),x[s[2]]=x[s[2]]||[],x[s[2]].push(s[4]);for(var C=Object.keys(x),E=0;E<C.length;E++)for(var f=0;f<x[C[E]].length;f++)k(x[C[E]][f])&&(x[C[E]][f]=1*x[C[E]][f]);return x}function S(b){var P=Object.keys(b);return P.reduce(function(w,x){return w||b[x].length>0},!1)}function m(b,P){for(var w={main:[P]},x={main:[]},v={main:{}};S(w);)for(var d=Object.keys(w),o=0;o<d.length;o++){var u=d[o],s=w[u],C=s.pop();if(v[u]=v[u]||{},v[u][C]||!b[u][C])continue;v[u][C]=!0,x[u]=x[u]||[],x[u].push(C);for(var E=R(b,b[u][C],u),f=Object.keys(E),A=0;A<f.length;A++)w[f[A]]=w[f[A]]||[],w[f[A]]=w[f[A]].concat(E[f[A]])}return x}q.exports=function(b,P){P=P||{};var w={main:L.m},x=P.all?{main:Object.keys(w.main)}:m(w,b),v="";Object.keys(x).filter(function(C){return C!=="main"}).forEach(function(C){for(var E=0;x[C][E];)E++;x[C].push(E),w[C][E]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",v=v+"var "+C+" = ("+K.toString().replace("ENTRY_MODULE",JSON.stringify(E))+")({"+x[C].map(function(f){return""+JSON.stringify(f)+": "+w[C][f].toString()}).join(",")+`});
`}),v=v+"new (("+K.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+x.main.map(function(C){return""+JSON.stringify(C)+": "+w.main[C].toString()}).join(",")+"}))(self);";var d=new window.Blob([v],{type:"text/javascript"});if(P.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,u=o.createObjectURL(d),s=new window.Worker(u);return s.objectURL=u,s}},"./src/config.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"hlsDefaultConfig",function(){return A}),L.d(z,"mergeConfig",function(){return p}),L.d(z,"enableStreamingMode",function(){return c});var K=L("./src/controller/abr-controller.ts"),F=L("./src/controller/audio-stream-controller.ts"),O=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),k=L("./src/controller/subtitle-track-controller.ts"),R=L("./src/controller/buffer-controller.ts"),S=L("./src/controller/timeline-controller.ts"),m=L("./src/controller/cap-level-controller.ts"),b=L("./src/controller/fps-controller.ts"),P=L("./src/controller/eme-controller.ts"),w=L("./src/controller/cmcd-controller.ts"),x=L("./src/utils/xhr-loader.ts"),v=L("./src/utils/fetch-loader.ts"),d=L("./src/utils/cues.ts"),o=L("./src/utils/mediakeys-helper.ts"),u=L("./src/utils/logger.ts");function s(){return s=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var T=arguments[a];for(var y in T)Object.prototype.hasOwnProperty.call(T,y)&&(l[y]=T[y])}return l},s.apply(this,arguments)}function C(l,a){var T=Object.keys(l);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(l);a&&(y=y.filter(function(h){return Object.getOwnPropertyDescriptor(l,h).enumerable})),T.push.apply(T,y)}return T}function E(l){for(var a=1;a<arguments.length;a++){var T=arguments[a]!=null?arguments[a]:{};a%2?C(Object(T),!0).forEach(function(y){f(l,y,T[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(T)):C(Object(T)).forEach(function(y){Object.defineProperty(l,y,Object.getOwnPropertyDescriptor(T,y))})}return l}function f(l,a,T){return a in l?Object.defineProperty(l,a,{value:T,enumerable:!0,configurable:!0,writable:!0}):l[a]=T,l}var A=E(E({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:x.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:K.default,bufferController:R.default,capLevelController:m.default,fpsController:b.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:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},g()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:k.default,timelineController:S.TimelineController,audioStreamController:F.default,audioTrackController:O.default,emeController:P.default,cmcdController:w.default});function g(){return{cueHandler:d.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 p(l,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return s({},l,a)}function c(l){var a=l.loader;if(a!==v.default&&a!==x.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var T=Object(v.fetchSupported)();T&&(l.loader=v.default,l.progressive=!0,l.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),F=L("./src/utils/ewma-bandwidth-estimator.ts"),O=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),k=L("./src/errors.ts"),R=L("./src/types/loader.ts"),S=L("./src/utils/logger.ts");function m(w,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function b(w,x,v){return x&&m(w.prototype,x),v&&m(w,v),w}var P=function(){function w(v){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=v;var d=v.config;this.bwEstimator=new F.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var x=w.prototype;return x.registerListeners=function(){var d=this.hls;d.on(O.Events.FRAG_LOADING,this.onFragLoading,this),d.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(O.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var d=this.hls;d.off(O.Events.FRAG_LOADING,this.onFragLoading,this),d.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(O.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},x.onFragLoading=function(d,o){var u=o.frag;if(u.type===R.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=u,this.partCurrent=(s=o.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},x.onLevelLoaded=function(d,o){var u=this.hls.config;o.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},x._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,s=u.autoLevelEnabled,C=u.config,E=u.media;if(!d||!E)return;var f=o?o.stats:d.stats,A=o?o.duration:d.duration;if(f.aborted){S.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||E.paused||!E.playbackRate||!E.readyState)return;var g=performance.now()-f.loading.start,p=Math.abs(E.playbackRate);if(g<=500*A/p)return;var c=u.levels,l=u.minAutoLevel,a=c[d.level],T=f.total||Math.max(f.loaded,Math.round(A*a.maxBitrate/8)),y=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/g),h=(T-f.loaded)/y,D=E.currentTime,U=(B.BufferHelper.bufferInfo(E,D,C.maxBufferHole).end-D)/p;if(U>=2*A/p||h<=U)return;var N=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>l;W--){var M=c[W].maxBitrate;if(N=A*M/(8*.8*y),N<U)break}if(N>=h)return;var I=this.bwEstimator.getEstimate();S.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
Current BW estimate: `+(Object(K.isFiniteNumber)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+h.toFixed(3)+` s
Estimated load time for the next fragment: `+N.toFixed(3)+` s
Time to underbuffer: `+U.toFixed(3)+" s"),u.nextLoadLevel=W,this.bwEstimator.sample(g,f.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),u.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:f})},x.onFragLoaded=function(d,o){var u=o.frag,s=o.part;if(u.type===R.PlaylistLevelType.MAIN&&Object(K.isFiniteNumber)(u.sn)){var C=s?s.stats:u.stats,E=s?s.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[u.level],A=(f.loaded?f.loaded.bytes:0)+C.loaded,g=(f.loaded?f.loaded.duration:0)+E;f.loaded={bytes:A,duration:g},f.realBitrate=Math.round(8*A/g)}if(u.bitrateTest){var p={stats:C,frag:u,part:s,id:u.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,p),u.bitrateTest=!1}}},x.onFragBuffered=function(d,o){var u=o.frag,s=o.part,C=s?s.stats:u.stats;if(C.aborted)return;if(u.type!==R.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var E=C.parsing.end-C.loading.start;this.bwEstimator.sample(E,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=E/1e3:this.bitrateTestDelay=0},x.onError=function(d,o){switch(o.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},x.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},x.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,u=this.hls,s=u.maxAutoLevel,C=u.config,E=u.minAutoLevel,f=u.media,A=o?o.duration:d?d.duration:0,g=f?f.currentTime:0,p=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,l=(B.BufferHelper.bufferInfo(f,g,C.maxBufferHole).end-g)/p,a=this.findBestLevel(c,E,s,l,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(a>=0)return a;S.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var T=A?Math.min(A,C.maxStarvationDelay):C.maxStarvationDelay,y=C.abrBandWidthFactor,h=C.abrBandWidthUpFactor;if(!l){var D=this.bitrateTestDelay;if(D){var U=A?Math.min(A,C.maxLoadingDelay):C.maxLoadingDelay;T=U-D,S.logger.trace("bitrate test took "+Math.round(1e3*D)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*T)+" ms"),y=h=1}}return a=this.findBestLevel(c,E,s,l+T,y,h),Math.max(a,0)},x.findBestLevel=function(d,o,u,s,C,E){for(var f,A=this.fragCurrent,g=this.partCurrent,p=this.lastLoadedFragLevel,c=this.hls.levels,l=c[p],a=!!(l!=null&&(f=l.details)!==null&&f!==void 0&&f.live),T=l==null?void 0:l.codecSet,y=g?g.duration:A?A.duration:0,h=u;h>=o;h--){var D=c[h];if(!D||T&&D.codecSet!==T)continue;var U=D.details,N=(g?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||y,W=void 0;h<=p?W=C*d:W=E*d;var M=c[h].maxBitrate,I=M*N/W;if(S.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+h+"/"+Math.round(W)+"/"+M+"/"+N+"/"+s+"/"+I),W>M&&(!I||a&&!this.bitrateTestDelay||I<s))return h}return-1},b(w,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var u=this.getNextABRAutoLevel();return d!==-1&&(u=Math.min(d,u)),u},set:function(d){this._nextAutoLevel=d}}]),w}();z.default=P},"./src/controller/audio-stream-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),F=L("./src/controller/base-stream-controller.ts"),O=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),k=L("./src/controller/fragment-tracker.ts"),R=L("./src/types/level.ts"),S=L("./src/types/loader.ts"),m=L("./src/loader/fragment.ts"),b=L("./src/demux/chunk-cache.ts"),P=L("./src/demux/transmuxer-interface.ts"),w=L("./src/types/transmuxer.ts"),x=L("./src/controller/fragment-finders.ts"),v=L("./src/utils/discontinuities.ts"),d=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(A){for(var g=1;g<arguments.length;g++){var p=arguments[g];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(A[c]=p[c])}return A},u.apply(this,arguments)}function s(A,g){A.prototype=Object.create(g.prototype),A.prototype.constructor=A,C(A,g)}function C(A,g){return C=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},C(A,g)}var E=100,f=function(A){s(g,A);function g(c,l){var a;return a=A.call(this,c,l,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var p=g.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var l=this.hls;l.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(O.Events.ERROR,this.onError,this),l.on(O.Events.BUFFER_RESET,this.onBufferReset,this),l.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p._unregisterListeners=function(){var l=this.hls;l.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(O.Events.ERROR,this.onError,this),l.off(O.Events.BUFFER_RESET,this.onBufferReset,this),l.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},p.onInitPtsFound=function(l,a){var T=a.frag,y=a.id,h=a.initPTS;if(y==="main"){var D=T.cc;this.initPTS[T.cc]=h,this.log("InitPTS for cc: "+D+" found from main: "+h),this.videoTrackCC=D,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},p.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=F.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(E),this.fragLoadError=0,a>0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},p.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var l,a=this.levels,T=this.trackId,y=a==null||((l=a[T])===null||l===void 0)?void 0:l.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var h,D=performance.now(),U=this.retryDate;(!U||D>=U||(h=this.media)!==null&&h!==void 0&&h.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var N=this.waitingData;if(N){var W=N.frag,M=N.part,I=N.cache,H=N.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var X=I.flush(),te={frag:W,part:M,payload:X,networkDetails:null};this._handleFragmentLoadProgress(te),H&&A.prototype._handleFragmentLoadComplete.call(this,te)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ae=this.getLoadPosition(),be=B.BufferHelper.bufferInfo(this.mediaBuffer,ae,this.config.maxBufferHole),pe=Object(x.fragmentWithinToleranceTest)(be.end,this.config.maxFragLookUpTolerance,W);pe<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+be.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},p.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},p.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,T=a.buffered;!this.loadedmetadata&&T.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},p.doTickIdle=function(){var l,a,T=this.hls,y=this.levels,h=this.media,D=this.trackId,U=T.config;if(!y||!y[D])return;if(!h&&(this.startFragRequested||!U.startFragPrefetch))return;var N=y[D],W=N.details;if(!W||W.live&&this.levelLastLoaded!==D||this.waitForCdnTuneIn(W)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,m.ElementaryStreamTypes.AUDIO,S.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,S.PlaylistLevelType.AUDIO);if(M===null)return;var I=M.len,H=this.getMaxBufferLength(),X=this.audioSwitch;if(I>=H&&!X)return;if(!X&&this._streamEnded(M,W)){T.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var te=W.fragments,ae=te[0].start,be=M.end;if(X){var pe=this.getLoadPosition();be=pe,W.PTSKnown&&pe<ae&&((M.end>ae||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),h.currentTime=ae+.05))}var ue=this.getNextFragment(be,W);if(!ue){this.bufferFlushed=!0;return}((l=ue.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=ue.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ue,W):this.loadFragment(ue,W,be)},p.getMaxBufferLength=function(){var l=A.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,S.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},p.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},p.onAudioTracksUpdated=function(l,a){var T=a.audioTracks;this.resetTransmuxer(),this.levels=T.map(function(y){return new R.Level(y)})},p.onAudioTrackSwitching=function(l,a){var T=!!a.url;this.trackId=a.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),T?this.setInterval(E):this.resetTransmuxer(),T?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},p.onLevelLoaded=function(l,a){this.mainDetails=a.details},p.onAudioTrackLoaded=function(l,a){var T,y=this.levels,h=a.details,D=a.id;if(!y){this.warn("Audio tracks were reset while loading level "+D);return}this.log("Track "+D+" loaded ["+h.startSN+","+h.endSN+"],duration:"+h.totalduration);var U=y[D],N=0;if(h.live||(T=U.details)!==null&&T!==void 0&&T.live){var W=this.mainDetails;if(h.fragments[0]||(h.deltaUpdateFailed=!0),h.deltaUpdateFailed||!W)return;!U.details&&h.hasProgramDateTime&&W.hasProgramDateTime?(Object(v.alignMediaPlaylistByPDT)(h,W),N=h.fragments[0].start):N=this.alignPlaylists(h,U.details)}U.details=h,this.levelLastLoaded=D,!this.startFragRequested&&(this.mainDetails||!h.live)&&this.setStartPosition(U.details,N),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(h)&&(this.state=F.State.IDLE),this.tick()},p._handleFragmentLoadProgress=function(l){var a,T=l.frag,y=l.part,h=l.payload,D=this.config,U=this.trackId,N=this.levels;if(!N){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+T.sn+" of level "+T.level+" will not be buffered");return}var W=N[U];console.assert(W,"Audio track is defined on fragment load progress");var M=W.details;console.assert(M,"Audio track details are defined on fragment load progress");var I=D.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new P.default(this.hls,S.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var X=this.initPTS[T.cc],te=(a=T.initSegment)===null||a===void 0?void 0:a.data;if(X!==void 0){var ae=!1,be=y?y.index:-1,pe=be!==-1,ue=new w.ChunkMetadata(T.level,T.sn,T.stats.chunkCount,h.byteLength,be,pe);H.push(h,te,I,"",T,y,M.totalduration,ae,ue,X)}else{o.logger.log("Unknown video PTS for cc "+T.cc+", waiting for video PTS before demuxing audio frag "+T.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+U);var se=this.waitingData=this.waitingData||{frag:T,part:y,cache:new b.default,complete:!1},he=se.cache;he.push(new Uint8Array(h)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},p._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,l)},p.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},p.onBufferCreated=function(l,a){var T=a.tracks.audio;T&&(this.mediaBuffer=T.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},p.onFragBuffered=function(l,a){var T=a.frag,y=a.part;if(T.type!==S.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(T)){this.warn("Fragment "+T.sn+(y?" p: "+y.index:"")+" of level "+T.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}T.sn!=="initSegment"&&(this.fragPrevious=T,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(T,y)},p.onError=function(l,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=a.fatal?F.State.ERROR:F.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var T=!0,y=this.getFwdBufferInfo(this.mediaBuffer,S.PlaylistLevelType.AUDIO);y&&y.len>.5&&(T=!this.reduceMaxBufferLength(y.len)),T&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},p.onBufferFlushed=function(l,a){var T=a.type;T===m.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},p._handleTransmuxComplete=function(l){var a,T="audio",y=this.hls,h=l.remuxResult,D=l.chunkMeta,U=this.getCurrentContext(D);if(!U){this.warn("The loading context changed while buffering fragment "+D.sn+" of level "+D.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(D.level);return}var N=U.frag,W=U.part,M=h.audio,I=h.text,H=h.id3,X=h.initSegment;if(this.fragContextChanged(N))return;if(this.state=F.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),X!=null&&X.tracks&&(this._bufferInitSegment(X.tracks,N,D),y.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:T,tracks:X.tracks})),M){var te=M.startPTS,ae=M.endPTS,be=M.startDTS,pe=M.endDTS;W&&(W.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:te,endPTS:ae,startDTS:be,endDTS:pe}),N.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,te,ae,be,pe),this.bufferFragmentData(M,N,W,D)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var ue=u({frag:N,id:T},H);y.trigger(O.Events.FRAG_PARSING_METADATA,ue)}if(I){var se=u({frag:N,id:T},I);y.trigger(O.Events.FRAG_PARSING_USERDATA,se)}},p._bufferInitSegment=function(l,a,T){if(this.state!==F.State.PARSING)return;l.video&&delete l.video;var y=l.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,l);var h=y.initSegment;if(h!=null&&h.byteLength){var D={type:"audio",frag:a,part:null,chunkMeta:T,parent:a.type,data:h};this.hls.trigger(O.Events.BUFFER_APPENDING,D)}this.tick()},p.loadFragment=function(l,a,T){var y=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||y===k.FragmentState.NOT_LOADED||y===k.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(K.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,l,a,T)))},p.completeAudioSwitch=function(){var l=this.hls,a=this.media,T=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:T})},g}(F.default);z.default=f},"./src/controller/audio-track-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),F=L("./src/errors.ts"),O=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function k(P,w){for(var x=0;x<w.length;x++){var v=w[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(P,v.key,v)}}function R(P,w,x){return w&&k(P.prototype,w),x&&k(P,x),P}function S(P,w){P.prototype=Object.create(w.prototype),P.prototype.constructor=P,m(P,w)}function m(P,w){return m=Object.setPrototypeOf||function(v,d){return v.__proto__=d,v},m(P,w)}var b=function(P){S(w,P);function w(v){var d;return d=P.call(this,v,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var x=w.prototype;return x.registerListeners=function(){var d=this.hls;d.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(K.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var d=this.hls;d.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(K.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},x.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},x.onAudioTrackLoaded=function(d,o){var u=o.id,s=o.details,C=this.tracksInGroup[u];if(!C){this.warn("Invalid audio track id "+u);return}var E=C.details;C.details=o.details,this.log("audioTrack "+u+" loaded ["+s.startSN+"-"+s.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,o,E))},x.onLevelLoading=function(d,o){this.switchLevel(o.level)},x.onLevelSwitching=function(d,o){this.switchLevel(o.level)},x.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var u=o.audioGroupIds[o.urlId];if(this.groupId!==u){this.groupId=u;var s=this.tracks.filter(function(E){return!u||E.groupId===u});this.selectDefaultTrack&&!s.some(function(E){return E.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var C={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(K.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},x.onError=function(d,o){if(P.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},x.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=o[this.trackId];this.log("Now switching to audio-track index "+d);var s=o[d],C=s.id,E=s.groupId,f=E===void 0?"":E,A=s.name,g=s.type,p=s.url;if(this.trackId=d,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(K.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:f,name:A,type:g,url:p}),s.details&&!s.details.live)return;var c=this.switchParams(s.url,u==null?void 0:u.details);this.loadPlaylist(c)},x.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,u=this.findTrackId(o)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},x.findTrackId=function(d){for(var o=this.tracksInGroup,u=0;u<o.length;u++){var s=o[u];if((!this.selectDefaultTrack||s.default)&&(!d||d===s.name))return s.id}return-1},x.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var u=o.id,s=o.groupId,C=o.url;if(d)try{C=d.addDirectives(C)}catch(E){this.warn("Could not construct new URL with HLS Delivery Directives: "+E)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(K.Events.AUDIO_TRACK_LOADING,{url:C,id:u,groupId:s,deliveryDirectives:d||null})}},R(w,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),w}(O.default);z.default=b},"./src/controller/base-playlist-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return R});var K=L("./src/polyfills/number.ts"),F=L("./src/types/level.ts"),O=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),k=L("./src/errors.ts"),R=function(){function S(b,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,P+":"),this.warn=B.logger.warn.bind(B.logger,P+":"),this.hls=b}var m=S.prototype;return m.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},m.onError=function(P,w){w.fatal&&w.type===k.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},m.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},m.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},m.stopLoad=function(){this.canLoad=!1,this.clearTimer()},m.switchParams=function(P,w){var x=w==null?void 0:w.renditionReports;if(x)for(var v=0;v<x.length;v++){var d=x[v],o=""+d.URI;if(o===P.substr(-o.length)){var u=parseInt(d["LAST-MSN"]),s=parseInt(d["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var C=Math.min(w.age-w.partTarget,w.targetduration);s!==void 0&&C>w.partTarget&&(s+=1)}if(Object(K.isFiniteNumber)(u))return new F.HlsUrlParameters(u,Object(K.isFiniteNumber)(s)?s:void 0,F.HlsSkip.No)}}},m.loadPlaylist=function(P){},m.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},m.playlistLoaded=function(P,w,x){var v=this,d=w.details,o=w.stats,u=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-u,d.live||x!=null&&x.live){if(d.reloaded(x),x&&this.log("live playlist "+P+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),x&&d.fragments.length>0&&Object(O.mergeDetails)(x,d),!this.canLoad||!d.live)return;var s,C=void 0,E=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var f=this.hls.config.lowLatencyMode,A=d.lastPartSn,g=d.endSN,p=d.lastPartIndex,c=p!==-1,l=A===g,a=f?0:p;c?(C=l?g+1:A,E=l?a:p+1):C=g+1;var T=d.age,y=T+d.ageHeader,h=Math.min(y-d.partTarget,d.targetduration*1.5);if(h>0){if(x&&h>x.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+x.tuneInGoal+" to: "+h+" with playlist age: "+d.age),h=0;else{var D=Math.floor(h/d.targetduration);if(C+=D,E!==void 0){var U=Math.round(h%d.targetduration/d.partTarget);E+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+T.toFixed(2)+"s goal: "+h+" skip sn "+D+" to part "+E)}d.tuneInGoal=h}if(s=this.getDeliveryDirectives(d,w.deliveryDirectives,C,E),f||!l){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(d,w.deliveryDirectives,C,E);var N=Object(O.computeReloadInterval)(d,o);C!==void 0&&d.canBlockReload&&(N-=d.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(N)+" ms"),this.timer=self.setTimeout(function(){return v.loadPlaylist(s)},N)}else this.clearTimer()},m.getDeliveryDirectives=function(P,w,x,v){var d=Object(F.getSkipValue)(P,x);return w!=null&&w.skip&&P.deltaUpdateFailed&&(x=w.msn,v=w.part,d=F.HlsSkip.No),new F.HlsUrlParameters(x,v,d)},m.retryLoadingOrFail=function(P){var w=this,x=this.hls.config,v=this.retryCount<x.levelLoadingMaxRetry;if(v){var d;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(d=P.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*x.levelLoadingRetryDelay,x.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return v},S}()},"./src/controller/base-stream-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"State",function(){return g}),L.d(z,"default",function(){return p});var K=L("./src/polyfills/number.ts"),F=L("./src/task-loop.ts"),O=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),k=L("./src/utils/logger.ts"),R=L("./src/events.ts"),S=L("./src/errors.ts"),m=L("./src/types/transmuxer.ts"),b=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/discontinuities.ts"),w=L("./src/controller/fragment-finders.ts"),x=L("./src/controller/level-helper.ts"),v=L("./src/loader/fragment-loader.ts"),d=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),u=L("./src/types/loader.ts");function s(c,l){for(var a=0;a<l.length;a++){var T=l[a];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(c,T.key,T)}}function C(c,l,a){return l&&s(c.prototype,l),a&&s(c,a),c}function E(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,A(c,l)}function A(c,l){return A=Object.setPrototypeOf||function(T,y){return T.__proto__=y,T},A(c,l)}var g={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"},p=function(c){f(l,c);function l(T,y,h){var D;return D=c.call(this)||this,D.hls=void 0,D.fragPrevious=null,D.fragCurrent=null,D.fragmentTracker=void 0,D.transmuxer=null,D._state=g.STOPPED,D.media=void 0,D.mediaBuffer=void 0,D.config=void 0,D.bitrateTest=!1,D.lastCurrentTime=0,D.nextLoadPosition=0,D.startPosition=0,D.loadedmetadata=!1,D.fragLoadError=0,D.retryDate=0,D.levels=null,D.fragmentLoader=void 0,D.levelLastLoaded=null,D.startFragRequested=!1,D.decrypter=void 0,D.initPTS=[],D.onvseeking=null,D.onvended=null,D.logPrefix="",D.log=void 0,D.warn=void 0,D.logPrefix=h,D.log=k.logger.log.bind(k.logger,h+":"),D.warn=k.logger.warn.bind(k.logger,h+":"),D.hls=T,D.fragmentLoader=new v.default(T.config),D.fragmentTracker=y,D.config=T.config,D.decrypter=new d.default(T,T.config),T.on(R.Events.KEY_LOADED,D.onKeyLoaded,E(D)),D}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(y){},a.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=g.STOPPED},a._streamEnded=function(y,h){var D=this.fragCurrent,U=this.fragmentTracker;if(!h.live&&D&&D.sn===h.endSN&&!y.nextStart){var N=U.getState(D);return N===O.FragmentState.PARTIAL||N===O.FragmentState.OK}return!1},a.onMediaAttached=function(y,h){var D=this.media=this.mediaBuffer=h.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),D.addEventListener("seeking",this.onvseeking),D.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===g.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var y=this.config,h=this.fragCurrent,D=this.media,U=this.mediaBuffer,N=this.state,W=D?D.currentTime:0,M=B.BufferHelper.bufferInfo(U||D,W,y.maxBufferHole);if(this.log("media seeking to "+(Object(K.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+N),N===g.ENDED)this.resetLoadingState();else if(h&&!M.len){var I=y.maxFragLookUpTolerance,H=h.start-I,X=h.start+h.duration+I,te=W>X;(W<H||te)&&(te&&h.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),h.loader.abort()),this.resetLoadingState())}D&&(this.lastCurrentTime=W),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(y,h){if(this.state!==g.KEY_LOADING||h.frag!==this.fragCurrent||!this.levels)return;this.state=g.IDLE;var D=this.levels[h.frag.level].details;D&&this.loadFragment(h.frag,D,h.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=g.STOPPED,this.hls.off(R.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,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(y,h){this.log("Loading key for "+y.sn+" of ["+h.startSN+"-"+h.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=g.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(R.Events.KEY_LOADING,{frag:y})},a.loadFragment=function(y,h,D){this._loadFragForPlayback(y,h,D)},a._loadFragForPlayback=function(y,h,D){var U=this,N=function(M){if(U.fragContextChanged(y)){U.warn("Fragment "+y.sn+(M.part?" p: "+M.part.index:"")+" of level "+y.level+" was dropped during download."),U.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,U._handleFragmentLoadProgress(M)};this._doFragLoad(y,h,D,N).then(function(W){if(!W)return;U.fragLoadError=0;var M=U.state;if(U.fragContextChanged(y)){(M===g.FRAG_LOADING||M===g.BACKTRACKING||!U.fragCurrent&&M===g.PARSING)&&(U.fragmentTracker.removeFragment(y),U.state=g.IDLE);return}if("payload"in W&&(U.log("Loaded fragment "+y.sn+" of level "+y.level),U.hls.trigger(R.Events.FRAG_LOADED,W),U.state===g.BACKTRACKING)){U.fragmentTracker.backtrack(y,W),U.resetFragmentLoading(y);return}U._handleFragmentLoadComplete(W)}).catch(function(W){U.warn(W),U.resetFragmentLoading(y)})},a.flushMainBuffer=function(y,h,D){if(D===void 0&&(D=null),!(y-h))return;var U={startOffset:y,endOffset:h,type:D};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(y){var h=this;this._doFragLoad(y).then(function(D){if(!D||h.fragContextChanged(y)||!h.levels)throw new Error("init load aborted");return D}).then(function(D){var U=h.hls,N=D.payload,W=y.decryptdata;if(N&&N.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var M=self.performance.now();return h.decrypter.webCryptoDecrypt(new Uint8Array(N),W.key.buffer,W.iv.buffer).then(function(I){var H=self.performance.now();return U.trigger(R.Events.FRAG_DECRYPTED,{frag:y,payload:I,stats:{tstart:M,tdecrypt:H}}),D.payload=I,D})}return D}).then(function(D){var U=h.fragCurrent,N=h.hls,W=h.levels;if(!W)throw new Error("init load aborted, missing levels");var M=W[y.level].details;console.assert(M,"Level details are defined when init segment is loaded");var I=y.stats;h.state=g.IDLE,h.fragLoadError=0,y.data=new Uint8Array(D.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),D.frag===U&&N.trigger(R.Events.FRAG_BUFFERED,{stats:I,frag:U,part:null,id:y.type}),h.tick()}).catch(function(D){h.warn(D),h.resetFragmentLoading(y)})},a.fragContextChanged=function(y){var h=this.fragCurrent;return!y||!h||y.level!==h.level||y.sn!==h.sn||y.urlId!==h.urlId},a.fragBufferedComplete=function(y,h){var D=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(h?" part: "+h.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+o.default.toString(B.BufferHelper.getBuffered(D))),this.state=g.IDLE,this.tick()},a._handleFragmentLoadComplete=function(y){var h=this.transmuxer;if(!h)return;var D=y.frag,U=y.part,N=y.partsLoaded,W=!N||N.length===0||N.some(function(I){return!I}),M=new m.ChunkMetadata(D.level,D.sn,D.stats.chunkCount+1,0,U?U.index:-1,!W);h.flush(M)},a._handleFragmentLoadProgress=function(y){},a._doFragLoad=function(y,h,D,U){var N=this;if(D===void 0&&(D=null),!this.levels)throw new Error("frag load aborted, missing levels");if(D=Math.max(y.start,D||0),this.config.lowLatencyMode&&h){var W=h.partList;if(W&&U){D>y.end&&h.fragmentHint&&(y=h.fragmentHint);var M=this.getNextPart(W,y,D);if(M>-1){var I=W[M];return this.log("Loading part sn: "+y.sn+" p: "+I.index+" cc: "+y.cc+" of playlist ["+h.startSN+"-"+h.endSN+"] parts [0-"+M+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(D.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=g.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,part:W[M],targetBufferTime:D}),this.doFragPartsLoad(y,W,M,U).catch(function(H){return N.handleFragLoadError(H)})}else if(!y.url||this.loadedEndOfParts(W,D))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(h?"of ["+h.startSN+"-"+h.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(D.toFixed(3))),Object(K.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=g.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:y,targetBufferTime:D}),this.fragmentLoader.load(y,U).catch(function(H){return N.handleFragLoadError(H)})},a.doFragPartsLoad=function(y,h,D,U){var N=this;return new Promise(function(W,M){var I=[],H=function X(te){var ae=h[te];N.fragmentLoader.loadPart(y,ae,U).then(function(be){I[ae.index]=be;var pe=be.part;N.hls.trigger(R.Events.FRAG_LOADED,be);var ue=h[te+1];if(ue&&ue.fragment===y)X(te+1);else return W({frag:y,part:pe,partsLoaded:I})}).catch(M)};H(D)})},a.handleFragLoadError=function(y){var h=y.data;return h&&h.details===S.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(h.frag,h.part):this.hls.trigger(R.Events.ERROR,h),null},a._handleTransmuxerFlush=function(y){var h=this.getCurrentContext(y);if(!h||this.state!==g.PARSING){this.fragCurrent||(this.state=g.IDLE);return}var D=h.frag,U=h.part,N=h.level,W=self.performance.now();D.stats.parsing.end=W,U&&(U.stats.parsing.end=W),this.updateLevelTiming(D,U,N,y.partial)},a.getCurrentContext=function(y){var h=this.levels,D=y.level,U=y.sn,N=y.part;if(!h||!h[D])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+D+". The current chunk will not be buffered."),null;var W=h[D],M=N>-1?Object(x.getPartWith)(W,U,N):null,I=M?M.fragment:Object(x.getFragmentWithSN)(W,U,this.fragCurrent);return I?{frag:I,part:M,level:W}:null},a.bufferFragmentData=function(y,h,D,U){if(!y||this.state!==g.PARSING)return;var N=y.data1,W=y.data2,M=N;if(N&&W&&(M=Object(b.appendUint8Array)(N,W)),!M||!M.length)return;var I={type:y.type,frag:h,part:D,chunkMeta:U,parent:h.type,data:M};this.hls.trigger(R.Events.BUFFER_APPENDING,I),y.dropped&&y.independent&&!D&&this.flushBufferGap(h)},a.flushBufferGap=function(y){var h=this.media;if(!h)return;if(!B.BufferHelper.isBuffered(h,h.currentTime)){this.flushMainBuffer(0,y.start);return}var D=h.currentTime,U=B.BufferHelper.bufferInfo(h,D,0),N=y.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,N*.25),M=Math.max(Math.min(y.start-W,U.end-W),D+W);y.start-M>W&&this.flushMainBuffer(M,y.start)},a.getFwdBufferInfo=function(y,h){var D=this.config,U=this.getLoadPosition();if(!Object(K.isFiniteNumber)(U))return null;var N=B.BufferHelper.bufferInfo(y,U,D.maxBufferHole);if(N.len===0&&N.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(U,h);if(W&&N.nextStart<W.end)return B.BufferHelper.bufferInfo(y,U,Math.max(N.nextStart,D.maxBufferHole))}return N},a.getMaxBufferLength=function(y){var h=this.config,D;return y?D=Math.max(8*h.maxBufferSize/y,h.maxBufferLength):D=h.maxBufferLength,Math.min(D,h.maxMaxBufferLength)},a.reduceMaxBufferLength=function(y){var h=this.config,D=y||h.maxBufferLength;return h.maxMaxBufferLength>=D?(h.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+h.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(y,h){var D,U,N=h.fragments,W=N.length;if(!W)return null;var M=this.config,I=N[0].start,H;if(h.live){var X=M.initialLiveManifestSize;if(W<X)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+X+")"),null;!h.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(h,N),this.startPosition=H?this.hls.liveSyncPosition||H.start:y)}else y<=I&&(H=N[0]);if(!H){var te=M.lowLatencyMode?h.partEnd:h.fragmentEnd;H=this.getFragmentAtPosition(y,te,h)}return(D=H)!==null&&D!==void 0&&D.initSegment&&!((U=H)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},a.getNextPart=function(y,h,D){for(var U=-1,N=!1,W=!0,M=0,I=y.length;M<I;M++){var H=y[M];if(W=W&&!H.independent,U>-1&&D<H.start)break;var X=H.loaded;!X&&(N||H.independent||W)&&H.fragment===h&&(U=M),N=X}return U},a.loadedEndOfParts=function(y,h){var D=y[y.length-1];return D&&h>D.start&&D.loaded},a.getInitialLiveFragment=function(y,h){var D=this.fragPrevious,U=null;if(D){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+D.programDateTime),U=Object(w.findFragmentByPDT)(h,D.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var N=D.sn+1;if(N>=y.startSN&&N<=y.endSN){var W=h[N-y.startSN];D.cc===W.cc&&(U=W,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(w.findFragWithCC)(h,D.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(U=this.getFragmentAtPosition(M,this.bitrateTest?y.fragmentEnd:y.edge,y))}return U},a.getFragmentAtPosition=function(y,h,D){var U=this.config,N=this.fragPrevious,W=D.fragments,M=D.endSN,I=D.fragmentHint,H=U.maxFragLookUpTolerance,X=!!(U.lowLatencyMode&&D.partList&&I);X&&I&&!this.bitrateTest&&(W=W.concat(I),M=I.sn);var te;if(y<h){var ae=y>h-H?0:H;te=Object(w.findFragmentByPTS)(N,W,y,ae)}else te=W[W.length-1];if(te){var be=te.sn-D.startSN,pe=N&&te.level===N.level,ue=W[be+1],se=this.fragmentTracker.getState(te);if(se===O.FragmentState.BACKTRACKED){te=null;for(var he=be;W[he]&&this.fragmentTracker.getState(W[he])===O.FragmentState.BACKTRACKED;)N?te=W[he--]:te=W[--he];te||(te=ue)}else N&&te.sn===N.sn&&!X&&(pe&&(te.sn<M&&this.fragmentTracker.getState(ue)!==O.FragmentState.OK?(this.log("SN "+te.sn+" just loaded, load next one: "+ue.sn),te=ue):te=null))}return te},a.synchronizeToLiveEdge=function(y){var h=this.config,D=this.media;if(!D)return;var U=this.hls.liveSyncPosition,N=D.currentTime,W=y.fragments[0].start,M=y.edge,I=N>=W-h.maxFragLookUpTolerance&&N<=M;if(U!==null&&D.duration>U&&(N<U||!I)){var H=h.liveMaxLatencyDuration!==void 0?h.liveMaxLatencyDuration:h.liveMaxLatencyDurationCount*y.targetduration;(!I&&D.readyState<4||N<M-H)&&(this.loadedmetadata||(this.nextLoadPosition=U),D.readyState&&(this.warn("Playback: "+N.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+U.toFixed(3)),D.currentTime=U))}},a.alignPlaylists=function(y,h){var D=this.levels,U=this.levelLastLoaded,N=this.fragPrevious,W=U!==null?D[U]:null,M=y.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var I=y.fragments[0].start,H=!h,X=y.alignedSliding&&Object(K.isFiniteNumber)(I);if(H||!X&&!I){Object(P.alignStream)(N,W,y);var te=y.fragments[0].start;return this.log("Live playlist sliding: "+te.toFixed(2)+" start-sn: "+(h?h.startSN:"na")+"->"+y.startSN+" prev-sn: "+(N?N.sn:"na")+" fragments: "+M),te}return I},a.waitForCdnTuneIn=function(y){var h=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*h)},a.setStartPosition=function(y,h){var D=this.startPosition;if(D<h&&(D=-1),D===-1||this.lastCurrentTime===-1){var U=y.startTimeOffset;Object(K.isFiniteNumber)(U)?(D=h+U,U<0&&(D+=y.totalduration),D=Math.min(Math.max(h,D),h+y.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+D),this.startPosition=D):y.live?D=this.hls.liveSyncPosition||h:this.startPosition=D=0,this.lastCurrentTime=D}this.nextLoadPosition=D},a.getLoadPosition=function(){var y=this.media,h=0;return this.loadedmetadata&&y?h=y.currentTime:this.nextLoadPosition&&(h=this.nextLoadPosition),h},a.handleFragLoadAborted=function(y,h){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(h?" part"+h.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},a.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=g.IDLE)},a.onFragmentOrKeyLoadError=function(y,h){if(h.fatal)return;var D=h.frag;if(!D||D.type!==y)return;var U=this.fragCurrent;console.assert(U&&D.sn===U.sn&&D.level===U.level&&D.urlId===U.urlId,"Frag load error must match current frag to retry");var N=this.config;if(this.fragLoadError+1<=N.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(D.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*N.fragLoadingRetryDelay,N.fragLoadingMaxRetryTimeout);this.warn("Fragment "+D.sn+" of "+y+" "+D.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=g.FRAG_LOADING_WAITING_RETRY}else h.levelRetry?(y===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=g.IDLE):(k.logger.error(h.details+" reaches max retry, redispatch as fatal ..."),h.fatal=!0,this.hls.stopLoad(),this.state=g.ERROR)},a.afterBufferFlushed=function(y,h,D){if(!y)return;var U=B.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(h,U,D),this.state===g.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=g.IDLE},a.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var h=this.levels?this.levels[y].details:null;if(h!=null&&h.live)return this.startPosition=-1,this.setStartPosition(h,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(y,h,D,U){var N=this,W=D.details;console.assert(!!W,"level.details must be defined");var M=Object.keys(y.elementaryStreams).reduce(function(I,H){var X=y.elementaryStreams[H];if(X){var te=X.endPTS-X.startPTS;if(te<=0)return N.warn("Could not parse fragment "+y.sn+" "+H+" duration reliably ("+te+") resetting transmuxer to fallback to playlist timing"),N.resetTransmuxer(),I||!1;var ae=U?0:Object(x.updateFragPTSDTS)(W,y,X.startPTS,X.endPTS,X.startDTS,X.endDTS);return N.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:W,level:D,drift:ae,type:H,frag:y,start:X.startPTS,end:X.endPTS}),!0}return I},!1);M?(this.state=g.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:y,part:h})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(l,[{key:"state",get:function(){return this._state},set:function(y){var h=this._state;h!==y&&(this._state=y,this.log(h+"->"+y))}}]),l}(F.default)},"./src/controller/buffer-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return w});var K=L("./src/polyfills/number.ts"),F=L("./src/events.ts"),O=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),k=L("./src/utils/buffer-helper.ts"),R=L("./src/utils/mediasource-helper.ts"),S=L("./src/loader/fragment.ts"),m=L("./src/controller/buffer-operation-queue.ts"),b=Object(R.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function x(d){var o=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 u=o.hls,s=o.media,C=o.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),s&&(o.updateMediaElementDuration(),u.trigger(F.Events.MEDIA_ATTACHED,{media:s})),C&&C.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var v=x.prototype;return v.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},v.destroy=function(){this.unregisterListeners(),this.details=null},v.registerListeners=function(){var o=this.hls;o.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(F.Events.BUFFER_RESET,this.onBufferReset,this),o.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(F.Events.BUFFER_EOS,this.onBufferEos,this),o.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(F.Events.FRAG_PARSED,this.onFragParsed,this),o.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},v.unregisterListeners=function(){var o=this.hls;o.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(F.Events.BUFFER_RESET,this.onBufferReset,this),o.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(F.Events.BUFFER_EOS,this.onBufferEos,this),o.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(F.Events.FRAG_PARSED,this.onFragParsed,this),o.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},v._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new m.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},v.onManifestParsed=function(o,u){var s=2;(u.audio&&!u.video||!u.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},v.onMediaAttaching=function(o,u){var s=this.media=u.media;if(s&&b){var C=this.mediaSource=new b;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(C),this._objectUrl=s.src}},v.onMediaDetaching=function(){var o=this.media,u=this.mediaSource,s=this._objectUrl;if(u){if(O.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(C){O.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(s&&self.URL.revokeObjectURL(s),o.src===s?(o.removeAttribute("src"),o.load()):O.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(F.Events.MEDIA_DETACHED,void 0)},v.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(u){var s=o.sourceBuffer[u];try{s&&(o.removeBufferListeners(u),o.mediaSource&&o.mediaSource.removeSourceBuffer(s),o.sourceBuffer[u]=void 0)}catch(C){O.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",C)}}),this._initSourceBuffer()},v.onBufferCodecs=function(o,u){var s=this,C=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(E){if(C){var f=s.tracks[E];if(f&&typeof f.buffer.changeType=="function"){var A=u[E],g=A.codec,p=A.levelCodec,c=A.container,l=(f.levelCodec||f.codec).replace(P,"$1"),a=(p||g).replace(P,"$1");if(l!==a){var T=c+";codecs="+(p||g);s.appendChangeType(E,T)}}}else s.pendingTracks[E]=u[E]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},v.appendChangeType=function(o,u){var s=this,C=this.operationQueue,E={execute:function(){var A=s.sourceBuffer[o];A&&(O.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+u),A.changeType(u)),C.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(A){O.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",A)}};C.append(E,o)},v.onBufferAppending=function(o,u){var s=this,C=this.hls,E=this.operationQueue,f=this.tracks,A=u.data,g=u.type,p=u.frag,c=u.part,l=u.chunkMeta,a=l.buffering[g],T=self.performance.now();a.start=T;var y=p.stats.buffering,h=c?c.stats.buffering:null;y.start===0&&(y.start=T),h&&h.start===0&&(h.start=T);var D=f.audio,U=g==="audio"&&l.id===1&&(D==null?void 0:D.container)==="audio/mpeg",N={execute:function(){if(a.executeStart=self.performance.now(),U){var M=s.sourceBuffer[g];if(M){var I=p.start-M.timestampOffset;Math.abs(I)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+p.start+" (delta: "+I+") sn: "+p.sn+")"),M.timestampOffset=p.start)}}s.appendExecutor(A,g)},onStart:function(){},onComplete:function(){var M=self.performance.now();a.executeEnd=a.end=M,y.first===0&&(y.first=M),h&&h.first===0&&(h.first=M);var I=s.sourceBuffer,H={};for(var X in I)H[X]=k.BufferHelper.getBuffered(I[X]);s.appendError=0,s.hls.trigger(F.Events.BUFFER_APPENDED,{type:g,frag:p,part:c,chunkMeta:l,parent:p.type,timeRanges:H})},onError:function(M){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+g+" SourceBuffer",M);var I={type:B.ErrorTypes.MEDIA_ERROR,parent:p.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=B.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,I.details=B.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>C.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),C.trigger(F.Events.ERROR,I)}};E.append(N,g)},v.onBufferFlushing=function(o,u){var s=this,C=this.operationQueue,E=function(A){return{execute:s.removeExecutor.bind(s,A,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(F.Events.BUFFER_FLUSHED,{type:A})},onError:function(p){O.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",p)}}};u.type?C.append(E(u.type),u.type):this.getSourceBufferTypes().forEach(function(f){C.append(E(f),f)})},v.onFragParsed=function(o,u){var s=this,C=u.frag,E=u.part,f=[],A=E?E.elementaryStreams:C.elementaryStreams;A[S.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(A[S.ElementaryStreamTypes.AUDIO]&&f.push("audio"),A[S.ElementaryStreamTypes.VIDEO]&&f.push("video"));var g=function(){var c=self.performance.now();C.stats.buffering.end=c,E&&(E.stats.buffering.end=c);var l=E?E.stats:C.stats;s.hls.trigger(F.Events.FRAG_BUFFERED,{frag:C,part:E,stats:l,id:C.type})};f.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(g,f)},v.onFragChanged=function(o,u){this.flushBackBuffer()},v.onBufferEos=function(o,u){var s=this,C=this.getSourceBufferTypes().reduce(function(E,f){var A=s.sourceBuffer[f];return(!u.type||u.type===f)&&(A&&!A.ended&&(A.ended=!0,O.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),E&&!!(!A||A.ended)},!0);C&&this.blockBuffers(function(){var E=s.mediaSource;if(!E||E.readyState!=="open")return;E.endOfStream()})},v.onLevelUpdated=function(o,u){var s=u.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},v.flushBackBuffer=function(){var o=this.hls,u=this.details,s=this.media,C=this.sourceBuffer;if(!s||u===null)return;var E=this.getSourceBufferTypes();if(!E.length)return;var f=u.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(K.isFiniteNumber)(f)||f<0)return;var A=s.currentTime,g=u.levelTargetDuration,p=Math.max(f,g),c=Math.floor(A/g)*g-p;E.forEach(function(l){var a=C[l];if(a){var T=k.BufferHelper.getBuffered(a);T.length>0&&c>T.start(0)&&(o.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),u.live&&o.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},v.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,u=this.hls,s=this.media,C=this.mediaSource,E=o.fragments[0].start+o.totalduration,f=s.duration,A=Object(K.isFiniteNumber)(C.duration)?C.duration:0;o.live&&u.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(o)):(E>A&&E>f||!Object(K.isFiniteNumber)(f))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+E.toFixed(3)),C.duration=E)},v.updateSeekableRange=function(o){var u=this.mediaSource,s=o.fragments,C=s.length;if(C&&o.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var E=Math.max(0,s[0].start),f=Math.max(E,E+o.totalduration);u.setLiveSeekableRange(E,f)}},v.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,u=this.operationQueue,s=this.pendingTracks,C=Object.keys(s).length;if(C&&!o||C===2){this.createSourceBuffers(s),this.pendingTracks={};var E=this.getSourceBufferTypes();if(E.length===0){this.hls.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}E.forEach(function(f){u.executeNext(f)})}},v.createSourceBuffers=function(o){var u=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var E in o)if(!u[E]){var f=o[E];if(!f)throw Error("source buffer exists for track "+E+", however track does not");var A=f.levelCodec||f.codec,g=f.container+";codecs="+A;O.logger.log("[buffer-controller]: creating sourceBuffer("+g+")");try{var p=u[E]=s.addSourceBuffer(g),c=E;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[E]={buffer:p,codec:A,container:f.container,levelCodec:f.levelCodec,id:f.id},C++}catch(l){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:g})}}C&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},v._onSBUpdateStart=function(o){var u=this.operationQueue,s=u.current(o);s.onStart()},v._onSBUpdateEnd=function(o){var u=this.operationQueue,s=u.current(o);s.onComplete(),u.shiftAndExecuteNext(o)},v._onSBUpdateError=function(o,u){O.logger.error("[buffer-controller]: "+o+" SourceBuffer error",u),this.hls.trigger(F.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(o);s&&s.onError(u)},v.removeExecutor=function(o,u,s){var C=this.media,E=this.mediaSource,f=this.operationQueue,A=this.sourceBuffer,g=A[o];if(!C||!E||!g){O.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var p=Object(K.isFiniteNumber)(C.duration)?C.duration:Infinity,c=Object(K.isFiniteNumber)(E.duration)?E.duration:Infinity,l=Math.max(0,u),a=Math.min(s,p,c);a>l?(O.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!g.updating,o+" sourceBuffer must not be updating"),g.remove(l,a)):f.shiftAndExecuteNext(o)},v.appendExecutor=function(o,u){var s=this.operationQueue,C=this.sourceBuffer,E=C[u];if(!E){O.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(u);return}E.ended=!1,console.assert(!E.updating,u+" sourceBuffer must not be updating"),E.appendBuffer(o)},v.blockBuffers=function(o,u){var s=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var C=this.operationQueue,E=u.map(function(f){return C.appendBlocker(f)});Promise.all(E).then(function(){o(),u.forEach(function(f){var A=s.sourceBuffer[f];(!A||!A.updating)&&C.shiftAndExecuteNext(f)})})},v.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},v.addBufferListener=function(o,u,s){var C=this.sourceBuffer[o];if(!C)return;var E=s.bind(this,o);this.listeners[o].push({event:u,listener:E}),C.addEventListener(u,E)},v.removeBufferListeners=function(o){var u=this.sourceBuffer[o];if(!u)return;this.listeners[o].forEach(function(s){u.removeEventListener(s.event,s.listener)})},x}()},"./src/controller/buffer-operation-queue.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return F});var K=L("./src/utils/logger.ts"),F=function(){function O(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var B=O.prototype;return B.append=function(R,S){var m=this.queues[S];m.push(R),m.length===1&&this.buffers[S]&&this.executeNext(S)},B.insertAbort=function(R,S){var m=this.queues[S];m.unshift(R),this.executeNext(S)},B.appendBlocker=function(R){var S,m=new Promise(function(P){S=P}),b={execute:S,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(b,R),m},B.executeNext=function(R){var S=this.buffers,m=this.queues,b=S[R],P=m[R];if(P.length){var w=P[0];try{w.execute()}catch(x){K.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(x),(!b||!b.updating)&&(P.shift(),this.executeNext(R))}}},B.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},B.current=function(R){return this.queues[R][0]},O}()},"./src/controller/cap-level-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts");function F(k,R){for(var S=0;S<R.length;S++){var m=R[S];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(k,m.key,m)}}function O(k,R,S){return R&&F(k.prototype,R),S&&F(k,S),k}var B=function(){function k(S){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=S,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=k.prototype;return R.setStreamController=function(m){this.streamController=m},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var m=this.hls;m.on(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.on(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var m=this.hls;m.off(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.off(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(m,b){k.isLevelAllowed(b.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(b.droppedLevel)},R.onMediaAttaching=function(m,b){this.media=b.media instanceof HTMLVideoElement?b.media:null},R.onManifestParsed=function(m,b){var P=this.hls;this.restrictedLevels=[],this.firstLevel=b.firstLevel,P.config.capLevelToPlayerSize&&b.video&&this.startCapping()},R.onBufferCodecs=function(m,b){var P=this.hls;P.config.capLevelToPlayerSize&&b.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var m=this.hls.levels;if(m.length){var b=this.hls;b.autoLevelCapping=this.getMaxLevel(m.length-1),b.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=b.autoLevelCapping}}},R.getMaxLevel=function(m){var b=this,P=this.hls.levels;if(!P.length)return-1;var w=P.filter(function(x,v){return k.isLevelAllowed(v,b.restrictedLevels)&&v<=m});return this.clientRect=null,k.getMaxLevelByMediaSize(w,this.mediaWidth,this.mediaHeight)},R.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()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var m=this.media,b={width:0,height:0};if(m){var P=m.getBoundingClientRect();b.width=P.width,b.height=P.height,!b.width&&!b.height&&(b.width=P.right-P.left||m.width||0,b.height=P.bottom-P.top||m.height||0)}return this.clientRect=b,b},k.isLevelAllowed=function(m,b){return b===void 0&&(b=[]),b.indexOf(m)===-1},k.getMaxLevelByMediaSize=function(m,b,P){if(!m||!m.length)return-1;for(var w=function(u,s){return s?u.width!==s.width||u.height!==s.height:!0},x=m.length-1,v=0;v<m.length;v+=1){var d=m[v];if((d.width>=b||d.height>=P)&&w(d,m[v+1])){x=v;break}}return x},O(k,[{key:"mediaWidth",get:function(){return this.getDimensions().width*k.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*k.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var m=1;try{m=self.devicePixelRatio}catch(b){}return m}}]),k}();z.default=B},"./src/controller/cmcd-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return w});var K=L("./src/events.ts"),F=L("./src/types/cmcd.ts"),O=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function k(x,v){for(var d=0;d<v.length;d++){var o=v[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(x,o.key,o)}}function R(x,v,d){return v&&k(x.prototype,v),d&&k(x,d),x}function S(x,v){var d=typeof Symbol!="undefined"&&x[Symbol.iterator]||x["@@iterator"];if(d)return(d=d.call(x)).next.bind(d);if(Array.isArray(x)||(d=m(x))||v&&x&&typeof x.length=="number"){d&&(x=d);var o=0;return function(){return o>=x.length?{done:!0}:{done:!1,value:x[o++]}}}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 m(x,v){if(!x)return;if(typeof x=="string")return b(x,v);var d=Object.prototype.toString.call(x).slice(8,-1);if(d==="Object"&&x.constructor&&(d=x.constructor.name),d==="Map"||d==="Set")return Array.from(x);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return b(x,v)}function b(x,v){(v==null||v>x.length)&&(v=x.length);for(var d=0,o=new Array(v);d<v;d++)o[d]=x[d];return o}function P(){return P=Object.assign||function(x){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(x[o]=d[o])}return x},P.apply(this,arguments)}var w=function(){function x(d){var o=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(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(C){try{o.apply(C,{ot:F.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(E){B.logger.warn("Could not generate manifest CMCD data.",E)}},this.applyFragmentData=function(C){try{var E=C.frag,f=o.hls.levels[E.level],A=o.getObjectType(E),g={d:E.duration*1e3,ot:A};(A===F.CMCDObjectType.VIDEO||A===F.CMCDObjectType.AUDIO||A==F.CMCDObjectType.MUXED)&&(g.br=f.bitrate/1e3,g.tb=o.getTopBandwidth(A),g.bl=o.getBufferLength(A)),o.apply(C,g)}catch(p){B.logger.warn("Could not generate segment CMCD data.",p)}},this.hls=d;var u=this.config=d.config,s=u.cmcd;s!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||x.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var v=x.prototype;return v.registerListeners=function(){var o=this.hls;o.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this)},v.unregisterListeners=function(){var o=this.hls;o.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},v.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},v.onMediaAttached=function(o,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},v.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},v.onBufferCreated=function(o,u){var s,C;this.audioBuffer=(s=u.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(C=u.tracks.video)===null||C===void 0?void 0:C.buffer},v.createData=function(){var o;return{v:F.CMCDVersion,sf:F.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},v.apply=function(o,u){u===void 0&&(u={}),P(u,this.createData());var s=u.ot===F.CMCDObjectType.INIT||u.ot===F.CMCDObjectType.VIDEO||u.ot===F.CMCDObjectType.MUXED;if(this.starved&&s&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var C=x.toHeaders(u);if(!Object.keys(C).length)return;o.headers||(o.headers={}),P(o.headers,C)}else{var E=x.toQuery(u);if(!E)return;o.url=x.appendQueryToUri(o.url,E)}},v.getObjectType=function(o){var u=o.type;return u==="subtitle"?F.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?F.CMCDObjectType.INIT:u==="audio"?F.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},v.getTopBandwidth=function(o){for(var u=0,s=o===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=S(s),E;!(E=C()).done;){var f=E.value;f.bitrate>u&&(u=f.bitrate)}return u>0?u:NaN},v.getBufferLength=function(o){var u=this.hls.media,s=o===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!u)return NaN;var C=O.BufferHelper.bufferInfo(s,u.currentTime,this.config.maxBufferHole);return C.len*1e3},v.createPlaylistLoader=function(){var o=this.config.pLoader,u=this.applyPlaylistData,s=o||this.config.loader;return function(){function C(f){this.loader=void 0,this.loader=new s(f)}var E=C.prototype;return E.destroy=function(){this.loader.destroy()},E.abort=function(){this.loader.abort()},E.load=function(A,g,p){u(A),this.loader.load(A,g,p)},R(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},v.createFragmentLoader=function(){var o=this.config.fLoader,u=this.applyFragmentData,s=o||this.config.loader;return function(){function C(f){this.loader=void 0,this.loader=new s(f)}var E=C.prototype;return E.destroy=function(){this.loader.destroy()},E.abort=function(){this.loader.abort()},E.load=function(A,g,p){u(A),this.loader.load(A,g,p)},R(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},x.uuid=function(){var o=URL.createObjectURL(new Blob),u=o.toString();return URL.revokeObjectURL(o),u.substr(u.lastIndexOf("/")+1)},x.serialize=function(o){for(var u=[],s=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},C=function(U){return Math.round(U)},E=function(U){return C(U/100)*100},f=function(U){return encodeURIComponent(U)},A={br:C,d:C,bl:E,dl:E,mtp:E,nor:f,rtp:E,tb:C},g=Object.keys(o||{}).sort(),p=S(g),c;!(c=p()).done;){var l=c.value,a=o[l];if(!s(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var T=A[l];T&&(a=T(a));var y=typeof a,h=void 0;l==="ot"||l==="sf"||l==="st"?h=l+"="+a:y==="boolean"?h=l:y==="number"?h=l+"="+a:h=l+"="+JSON.stringify(a),u.push(h)}return u.join(",")},x.toHeaders=function(o){for(var u=Object.keys(o),s={},C=["Object","Request","Session","Status"],E=[{},{},{},{}],f={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},A=0,g=u;A<g.length;A++){var p=g[A],c=f[p]!=null?f[p]:1;E[c][p]=o[p]}for(var l=0;l<E.length;l++){var a=x.serialize(E[l]);a&&(s["CMCD-"+C[l]]=a)}return s},x.toQuery=function(o){return"CMCD="+encodeURIComponent(x.serialize(o))},x.appendQueryToUri=function(o,u){if(!u)return o;var s=o.includes("?")?"&":"?";return""+o+s+u},x}()},"./src/controller/eme-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),F=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function k(w,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function R(w,x,v){return x&&k(w.prototype,x),v&&k(w,v),w}var S=3,m=function(x,v,d){var o={audioCapabilities:[],videoCapabilities:[]};return x.forEach(function(u){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:d.audioRobustness||""})}),v.forEach(function(u){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:d.videoRobustness||""})}),[o]},b=function(x,v,d,o){switch(x){case B.KeySystems.WIDEVINE:return m(v,d,o);default:throw new Error("Unknown key-system: "+x)}},P=function(){function w(v){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=v,this._config=v.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 x=w.prototype;return x.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},x._registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x._unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x.getLicenseServerUrl=function(d){switch(d){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},x._attemptKeySystemAccess=function(d,o,u){var s=this,C=b(d,o,u,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var E=this.requestMediaKeySystemAccess(d,C);this.mediaKeysPromise=E.then(function(f){return s._onMediaKeySystemAccessObtained(d,f)}),E.catch(function(f){O.logger.error('Failed to obtain key-system "'+d+'" access:',f)})},x._onMediaKeySystemAccessObtained=function(d,o){var u=this;O.logger.log('Access for key-system "'+d+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(s);var C=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(E){return s.mediaKeys=E,O.logger.log('Media-keys created for key-system "'+d+'"'),u._onMediaKeysCreated(),E});return C.catch(function(E){O.logger.error("Failed to create media-keys:",E)}),C},x._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},x._onNewMediaKeySession=function(d){var o=this;O.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(u){o._onKeySessionMessage(d,u.message)},!1)},x._onKeySessionMessage=function(d,o){O.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(u){O.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),d.update(u)})},x.onMediaEncrypted=function(d){var o=this;if(O.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(C){if(!o._media)return;o._attemptSetMediaKeys(C),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(u).catch(u)},x._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},x._generateRequestWithPreferredKeySession=function(d,o){var u=this,s=this._mediaKeysList[0];if(!s){O.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var C=s.mediaKeysSession;if(!C){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+d+'" init data type'),s.mediaKeysSessionInitialized=!0,C.generateRequest(d,o).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(E){O.logger.error("Error generating key-session request:",E),u.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},x._createLicenseXhr=function(d,o,u){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,d,o,u);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,s,d),C=void 0}catch(E){O.logger.error(E)}try{s.readyState||s.open("POST",d,!0),C&&C.call(this.hls,s,d)}catch(E){throw new Error("issue setting up KeySystem license XHR "+E)}return s},x._onLicenseRequestReadyStageChange=function(d,o,u,s){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var C=d.response,E=this._licenseResponseCallback;if(E)try{C=E.call(this.hls,d,o)}catch(A){O.logger.error(A)}s(C)}else{if(O.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>S){this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=S-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(u,s)}break}},x._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},x._requestLicense=function(d,o){O.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(u.mediaKeySystemDomain),C=this._createLicenseXhr(s,d,o);O.logger.log("Sending license request to URL: "+s);var E=this._generateLicenseRequestChallenge(u,d);C.send(E)}catch(f){O.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},x.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var u=o.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},x.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},x.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var u=o.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),s=o.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,u,s)},R(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();z.default=P},"./src/controller/fps-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),F=L("./src/utils/logger.ts"),O=function(){function B(R){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=R,this.registerListeners()}var k=B.prototype;return k.setStreamController=function(S){this.streamController=S},k.registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},k.unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching)},k.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},k.onMediaAttaching=function(S,m){var b=this.hls.config;if(b.capLevelOnFPSDrop){var P=m.media instanceof self.HTMLVideoElement?m.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),b.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(S,m,b){var P=performance.now();if(m){if(this.lastTime){var w=P-this.lastTime,x=b-this.lastDroppedFrames,v=m-this.lastDecodedFrames,d=1e3*x/w,o=this.hls;if(o.trigger(K.Events.FPS_DROP,{currentDropped:x,currentDecoded:v,totalDroppedFrames:b}),d>0&&x>o.config.fpsDroppedMonitoringThreshold*v){var u=o.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=u)&&(u=u-1,o.trigger(K.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:o.currentLevel}),o.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=b,this.lastDecodedFrames=m}},k.checkFPSInterval=function(){var S=this.media;if(S)if(this.isVideoPlaybackQualityAvailable){var m=S.getVideoPlaybackQuality();this.checkFPS(S,m.totalVideoFrames,m.droppedVideoFrames)}else this.checkFPS(S,S.webkitDecodedFrameCount,S.webkitDroppedFrameCount)},B}();z.default=O},"./src/controller/fragment-finders.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"findFragmentByPDT",function(){return O}),L.d(z,"findFragmentByPTS",function(){return B}),L.d(z,"fragmentWithinToleranceTest",function(){return k}),L.d(z,"pdtWithinToleranceTest",function(){return R}),L.d(z,"findFragWithCC",function(){return S});var K=L("./src/polyfills/number.ts"),F=L("./src/utils/binary-search.ts");function O(m,b,P){if(b===null||!Array.isArray(m)||!m.length||!Object(K.isFiniteNumber)(b))return null;var w=m[0].programDateTime;if(b<(w||0))return null;var x=m[m.length-1].endProgramDateTime;if(b>=(x||0))return null;P=P||0;for(var v=0;v<m.length;++v){var d=m[v];if(R(b,P,d))return d}return null}function B(m,b,P,w){P===void 0&&(P=0),w===void 0&&(w=0);var x=null;if(m?x=b[m.sn-b[0].sn+1]||null:P===0&&b[0].start===0&&(x=b[0]),x&&k(P,w,x)===0)return x;var v=F.default.search(b,k.bind(null,P,w));return v||x}function k(m,b,P){m===void 0&&(m=0),b===void 0&&(b=0);var w=Math.min(b,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-w<=m?1:P.start-w>m&&P.start?-1:0}function R(m,b,P){var w=Math.min(b,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,x=P.endProgramDateTime||0;return x-w>m}function S(m,b){return F.default.search(m,function(P){return P.cc<b?1:P.cc>b?-1:0})}},"./src/controller/fragment-tracker.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"FragmentState",function(){return O}),L.d(z,"FragmentTracker",function(){return B});var K=L("./src/events.ts"),F=L("./src/types/loader.ts"),O;(function(S){S.NOT_LOADED="NOT_LOADED",S.BACKTRACKED="BACKTRACKED",S.APPENDING="APPENDING",S.PARTIAL="PARTIAL",S.OK="OK"})(O||(O={}));var B=function(){function S(b){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=b,this._registerListeners()}var m=S.prototype;return m._registerListeners=function(){var P=this.hls;P.on(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(K.Events.FRAG_LOADED,this.onFragLoaded,this)},m._unregisterListeners=function(){var P=this.hls;P.off(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(K.Events.FRAG_LOADED,this.onFragLoaded,this)},m.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},m.getAppendedFrag=function(P,w){if(w===F.PlaylistLevelType.MAIN){var x=this.activeFragment,v=this.activeParts;if(!x)return null;if(v)for(var d=v.length;d--;){var o=v[d],u=o?o.end:x.appendedPTS;if(o.start<=P&&u!==void 0&&P<=u)return d>9&&(this.activeParts=v.slice(d-9)),o}else if(x.start<=P&&x.appendedPTS!==void 0&&P<=x.appendedPTS)return x}return this.getBufferedFrag(P,w)},m.getBufferedFrag=function(P,w){for(var x=this.fragments,v=Object.keys(x),d=v.length;d--;){var o=x[v[d]];if((o==null?void 0:o.body.type)===w&&o.buffered){var u=o.body;if(u.start<=P&&P<=u.end)return u}}return null},m.detectEvictedFragments=function(P,w,x){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(!o.buffered){o.body.type===x&&v.removeFragment(o.body);return}var u=o.range[P];if(!u)return;u.time.some(function(s){var C=!v.isTimeBuffered(s.startPTS,s.endPTS,w);return C&&v.removeFragment(o.body),C})})},m.detectPartialFragments=function(P){var w=this,x=this.timeRanges,v=P.frag,d=P.part;if(!x||v.sn==="initSegment")return;var o=R(v),u=this.fragments[o];if(!u)return;Object.keys(x).forEach(function(s){var C=v.elementaryStreams[s];if(!C)return;var E=x[s],f=d!==null||C.partial===!0;u.range[s]=w.getBufferedTimes(v,d,f,E)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},m.fragBuffered=function(P){var w=R(P),x=this.fragments[w];x&&(x.backtrack=x.loaded=null,x.buffered=!0)},m.getBufferedTimes=function(P,w,x,v){for(var d={time:[],partial:x},o=w?w.start:P.start,u=w?w.end:P.end,s=P.minEndPTS||u,C=P.maxStartPTS||o,E=0;E<v.length;E++){var f=v.start(E)-this.bufferPadding,A=v.end(E)+this.bufferPadding;if(C>=f&&s<=A){d.time.push({startPTS:Math.max(o,v.start(E)),endPTS:Math.min(u,v.end(E))});break}else if(o<A&&u>f)d.partial=!0,d.time.push({startPTS:Math.max(o,v.start(E)),endPTS:Math.min(u,v.end(E))});else if(u<=f)break}return d},m.getPartialFragment=function(P){var w=null,x,v,d,o=0,u=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(C){var E=s[C];if(!E)return;k(E)&&(v=E.body.start-u,d=E.body.end+u,P>=v&&P<=d&&(x=Math.min(P-v,d-P),o<=x&&(w=E.body,o=x)))}),w},m.getState=function(P){var w=R(P),x=this.fragments[w];return x?x.buffered?k(x)?O.PARTIAL:O.OK:x.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},m.backtrack=function(P,w){var x=R(P),v=this.fragments[x];if(!v||v.backtrack)return null;var d=v.backtrack=w||v.loaded;return v.loaded=null,d},m.getBacktrackData=function(P){var w=R(P),x=this.fragments[w];if(x){var v,d=x.backtrack;if(d!=null&&(v=d.payload)!==null&&v!==void 0&&v.byteLength)return d;this.removeFragment(P)}return null},m.isTimeBuffered=function(P,w,x){for(var v,d,o=0;o<x.length;o++){if(v=x.start(o)-this.bufferPadding,d=x.end(o)+this.bufferPadding,P>=v&&w<=d)return!0;if(w<=v)return!1}return!1},m.onFragLoaded=function(P,w){var x=w.frag,v=w.part;if(x.sn==="initSegment"||x.bitrateTest||v)return;var d=R(x);this.fragments[d]={body:x,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},m.onBufferAppended=function(P,w){var x=this,v=w.frag,d=w.part,o=w.timeRanges;if(v.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=v,d){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(s){var C=o[s];if(x.detectEvictedFragments(s,C),!d)for(var E=0;E<C.length;E++)v.appendedPTS=Math.max(C.end(E),v.appendedPTS||0)})},m.onFragBuffered=function(P,w){this.detectPartialFragments(w)},m.hasFragment=function(P){var w=R(P);return!!this.fragments[w]},m.removeFragmentsInRange=function(P,w,x){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(o.buffered){var u=o.body;u.type===x&&u.start<w&&u.end>P&&v.removeFragment(u)}})},m.removeFragment=function(P){var w=R(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[w]},m.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},S}();function k(S){var m,b;return S.buffered&&(((m=S.range.video)===null||m===void 0?void 0:m.partial)||((b=S.range.audio)===null||b===void 0?void 0:b.partial))}function R(S){return S.type+"_"+S.level+"_"+S.urlId+"_"+S.sn}},"./src/controller/gap-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"STALL_MINIMUM_DURATION_MS",function(){return k}),L.d(z,"MAX_START_GAP_JUMP",function(){return R}),L.d(z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return S}),L.d(z,"SKIP_BUFFER_RANGE_START",function(){return m}),L.d(z,"default",function(){return b});var K=L("./src/utils/buffer-helper.ts"),F=L("./src/errors.ts"),O=L("./src/events.ts"),B=L("./src/utils/logger.ts"),k=250,R=2,S=.1,m=.05,b=function(){function P(x,v,d,o){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=x,this.media=v,this.fragmentTracker=d,this.hls=o}var w=P.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(v){var d=this.config,o=this.media,u=this.stalled,s=o.currentTime,C=o.seeking,E=this.seeking&&!C,f=!this.seeking&&C;if(this.seeking=C,s!==v){if(this.moved=!0,u!==null){if(this.stallReported){var A=self.performance.now()-u;B.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||E)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!K.BufferHelper.getBuffered(o).length)return;var g=K.BufferHelper.bufferInfo(o,s,0),p=g.len>0,c=g.nextStart||0;if(!p&&!c)return;if(C){var l=g.len>R,a=!c||c-s>R&&!this.fragmentTracker.getPartialFragment(s);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var T,y=Math.max(c,g.start||0)-s,h=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,D=h==null||((T=h.details)===null||T===void 0)?void 0:T.live,U=D?h.details.targetduration*2:R;if(y>0&&y<=U){this._trySkipBufferHole(null);return}}var N=self.performance.now();if(u===null){this.stalled=N;return}var W=N-u;!C&&W>=k&&this._reportStall(g.len);var M=K.BufferHelper.bufferInfo(o,s,d.maxBufferHole);this._tryFixBufferStall(M,W)},w._tryFixBufferStall=function(v,d){var o=this.config,u=this.fragmentTracker,s=this.media,C=s.currentTime,E=u.getPartialFragment(C);if(E){var f=this._trySkipBufferHole(E);if(f)return}v.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(v){var d=this.hls,o=this.media,u=this.stallReported;u||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+v+")"),d.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:v}))},w._trySkipBufferHole=function(v){for(var d=this.config,o=this.hls,u=this.media,s=u.currentTime,C=0,E=K.BufferHelper.getBuffered(u),f=0;f<E.length;f++){var A=E.start(f);if(s+d.maxBufferHole>=C&&s<A){var g=Math.max(A+m,u.currentTime+S);return B.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+g),this.moved=!0,this.stalled=null,u.currentTime=g,v&&o.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+g,frag:v}),g}C=E.end(f)}return 0},w._tryNudgeBuffer=function(){var v=this.config,d=this.hls,o=this.media,u=o.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<v.nudgeMaxRetry){var C=u+s*v.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+u+" to "+C),o.currentTime=C,d.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+v.nudgeMaxRetry+" nudges"),d.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),F=L("./src/utils/texttrack-utils.ts"),O=L("./src/demux/id3.ts"),B=.25,k=function(){function R(m){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=m,this._registerListeners()}var S=R.prototype;return S.destroy=function(){this._unregisterListeners()},S._registerListeners=function(){var b=this.hls;b.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var b=this.hls;b.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.onMediaAttached=function(b,P){this.media=P.media},S.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},S.getID3Track=function(b){if(!this.media)return;for(var P=0;P<b.length;P++){var w=b[P];if(w.kind==="metadata"&&w.label==="id3")return Object(F.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},S.onFragParsingMetadata=function(b,P){if(!this.media)return;var w=P.frag,x=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var v=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<x.length;d++){var o=O.getID3Frames(x[d].data);if(o){var u=x[d].pts,s=d<x.length-1?x[d+1].pts:w.end,C=s-u;C<=0&&(s=u+B);for(var E=0;E<o.length;E++){var f=o[E];if(!O.isTimeStampFrame(f)){var A=new v(u,s,"");A.value=f,this.id3Track.addCue(A)}}}}},S.onBufferFlushing=function(b,P){var w=P.startOffset,x=P.endOffset,v=P.type;if(!v||v==="audio"){var d=this.id3Track;d&&Object(F.removeCuesInRange)(d,w,x)}},R}();z.default=k},"./src/controller/latency-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return R});var K=L("./src/errors.ts"),F=L("./src/events.ts"),O=L("./src/utils/logger.ts");function B(S,m){for(var b=0;b<m.length;b++){var P=m[b];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(S,P.key,P)}}function k(S,m,b){return m&&B(S.prototype,m),b&&B(S,b),S}var R=function(){function S(b){var P=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 P.timeupdate()},this.hls=b,this.config=b.config,this.registerListeners()}var m=S.prototype;return m.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},m.registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(F.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(F.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(F.Events.ERROR,this.onError)},m.onMediaAttached=function(P,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},m.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},m.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},m.onLevelUpdated=function(P,w){var x=w.details;this.levelDetails=x,x.advanced&&this.timeupdate(),!x.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},m.onError=function(P,w){if(w.details!==K.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},m.timeupdate=function(){var P=this.media,w=this.levelDetails;if(!P||!w)return;this.currentTime=P.currentTime;var x=this.computeLatency();if(x===null)return;this._latency=x;var v=this.config,d=v.lowLatencyMode,o=v.maxLiveSyncPlaybackRate;if(!d||o===1)return;var u=this.targetLatency;if(u===null)return;var s=x-u,C=Math.min(this.maxLatency,u+w.targetduration),E=s<C;if(w.live&&E&&s>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),A=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;P.playbackRate=Math.min(f,Math.max(1,A))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},m.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},m.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},k(S,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,w=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:w?P.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var w=P.holdBack,x=P.partHoldBack,v=P.targetduration,d=this.config,o=d.liveSyncDuration,u=d.liveSyncDurationCount,s=d.lowLatencyMode,C=this.hls.userConfig,E=s&&x||w;(C.liveSyncDuration||C.liveSyncDurationCount||E===0)&&(E=o!==void 0?o:u*v);var f=v,A=1;return E+Math.min(this.stallCount*A,f)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),w=this.targetLatency,x=this.levelDetails;if(P===null||w===null||x===null)return null;var v=x.edge,d=P-w-this.edgeStalled,o=v-x.totalduration,u=v-(this.config.lowLatencyMode&&x.partTarget||x.targetduration);return Math.min(Math.max(o,d),u)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var w=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-w,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,w=this.levelDetails;if(!P||!w)return 0;var x=P.buffered.length;return x?P.buffered.end(x-1):w.edge-this.currentTime}}]),S}()},"./src/controller/level-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return d});var K=L("./src/types/level.ts"),F=L("./src/events.ts"),O=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),k=L("./src/controller/level-helper.ts"),R=L("./src/controller/base-playlist-controller.ts"),S=L("./src/types/loader.ts");function m(){return m=Object.assign||function(o){for(var u=1;u<arguments.length;u++){var s=arguments[u];for(var C in s)Object.prototype.hasOwnProperty.call(s,C)&&(o[C]=s[C])}return o},m.apply(this,arguments)}function b(o,u){for(var s=0;s<u.length;s++){var C=u[s];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function P(o,u,s){return u&&b(o.prototype,u),s&&b(o,s),o}function w(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,x(o,u)}function x(o,u){return x=Object.setPrototypeOf||function(C,E){return C.__proto__=E,C},x(o,u)}var v=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){w(u,o);function u(C){var E;return E=o.call(this,C,"[level-controller]")||this,E._levels=[],E._firstLevel=-1,E._startLevel=void 0,E.currentLevelIndex=-1,E.manualLevelIndex=-1,E.onParsedComplete=void 0,E._registerListeners(),E}var s=u.prototype;return s._registerListeners=function(){var E=this.hls;E.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),E.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),E.on(F.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var E=this.hls;E.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),E.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),E.off(F.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},s.startLoad=function(){var E=this._levels;E.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},s.onManifestLoaded=function(E,f){var A=[],g=[],p=[],c,l={},a,T=!1,y=!1,h=!1;if(f.levels.forEach(function(W){var M=W.attrs;T=T||!!(W.width&&W.height),y=y||!!W.videoCodec,h=h||!!W.audioCodec,v&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var I=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=l[I],a?a.url.push(W.url):(a=new K.Level(W),l[I]=a,A.push(a)),M&&(M.AUDIO&&Object(k.addGroupId)(a,"audio",M.AUDIO),M.SUBTITLES&&Object(k.addGroupId)(a,"text",M.SUBTITLES))}),(T||y)&&h&&(A=A.filter(function(W){var M=W.videoCodec,I=W.width,H=W.height;return!!M||!!(I&&H)})),A=A.filter(function(W){var M=W.audioCodec,I=W.videoCodec;return(!M||Object(B.isCodecSupportedInMp4)(M,"audio"))&&(!I||Object(B.isCodecSupportedInMp4)(I,"video"))}),f.audioTracks&&(g=f.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(g)),f.subtitles&&(p=f.subtitles,Object(k.assignTrackIdsByGroup)(p)),A.length>0){c=A[0].bitrate,A.sort(function(W,M){return W.bitrate-M.bitrate}),this._levels=A;for(var D=0;D<A.length;D++)if(A[D].bitrate===c){this._firstLevel=D,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+c);break}var U=h&&!y,N={levels:A,audioTracks:g,subtitleTracks:p,firstLevel:this._firstLevel,stats:f.stats,audio:h,video:y,altAudio:!U&&g.some(function(W){return!!W.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,N),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(F.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(E,f){if(o.prototype.onError.call(this,E,f),f.fatal)return;var A=f.context,g=this._levels[this.currentLevelIndex];if(A&&(A.type===S.PlaylistContextType.AUDIO_TRACK&&g.audioGroupIds&&A.groupId===g.audioGroupIds[g.urlId]||A.type===S.PlaylistContextType.SUBTITLE_TRACK&&g.textGroupIds&&A.groupId===g.textGroupIds[g.urlId])){this.redundantFailover(this.currentLevelIndex);return}var p=!1,c=!0,l;switch(f.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=f.frag.level)):l=f.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(c=!1),l=A.level),p=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:l=f.level,p=!0;break}l!==void 0&&this.recoverLevel(f,l,p,c)},s.recoverLevel=function(E,f,A,g){var p=E.details,c=this._levels[f];if(c.loadError++,A){var l=this.retryLoadingOrFail(E);if(l)E.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(g){var a=c.url.length;if(a>1&&c.loadError<a)E.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var T=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==T&&this._levels[T].loadError===0&&(this.warn(p+": switch to "+T),E.levelRetry=!0,this.hls.nextAutoLevel=T)}}},s.redundantFailover=function(E){var f=this._levels[E],A=f.url.length;if(A>1){var g=(f.urlId+1)%A;this.warn("Switching to redundant URL-id "+g),this._levels.forEach(function(p){p.urlId=g}),this.level=E}},s.onFragLoaded=function(E,f){var A=f.frag;if(A!==void 0&&A.type===S.PlaylistLevelType.MAIN){var g=this._levels[A.level];g!==void 0&&(g.fragmentError=0,g.loadError=0)}},s.onLevelLoaded=function(E,f){var A,g=f.level,p=f.details,c=this._levels[g];if(!c){var l;this.warn("Invalid level index "+g),(l=f.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(p.deltaUpdateFailed=!0);return}g===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(g,f,c.details)):(A=f.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(p.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(E,f){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var g=-1,p=this.hls.audioTracks[f.id].groupId,c=0;c<A.audioGroupIds.length;c++)if(A.audioGroupIds[c]===p){g=c;break}g!==A.urlId&&(A.urlId=g,this.startLoad())}},s.loadPlaylist=function(E){var f=this.currentLevelIndex,A=this._levels[f];if(this.canLoad&&A&&A.url.length>0){var g=A.urlId,p=A.url[g];if(E)try{p=E.addDirectives(p)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(E?" at sn "+E.msn+" part "+E.part:"")+" with URL-id "+g+" "+p),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:p,level:f,id:g,deliveryDirectives:E||null})}},s.removeLevel=function(E,f){var A=function(c,l){return l!==f},g=this._levels.filter(function(p,c){return c!==E?!0:p.url.length>1&&f!==void 0?(p.url=p.url.filter(A),p.audioGroupIds&&(p.audioGroupIds=p.audioGroupIds.filter(A)),p.textGroupIds&&(p.textGroupIds=p.textGroupIds.filter(A)),p.urlId=0,!0):!1}).map(function(p,c){var l=p.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),p});this._levels=g,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:g})},P(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(E){var f,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===E&&(f=A[E])!==null&&f!==void 0&&f.details)return;if(E<0||E>=A.length){var g=E<0;if(this.hls.trigger(F.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:E,fatal:g,reason:"invalid level idx"}),g)return;E=Math.min(E,A.length-1)}this.clearTimer();var p=this.currentLevelIndex,c=A[p],l=A[E];this.log("switching to level "+E+" from "+p),this.currentLevelIndex=E;var a=m({},l,{level:E,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,a);var T=l.details;if(!T||T.live){var y=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(E){this.manualLevelIndex=E,this._startLevel===void 0&&(this._startLevel=E),E!==-1&&(this.level=E)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(E){this._firstLevel=E}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var E=this.hls.config.startLevel;return E!==void 0?E:this._firstLevel}else return this._startLevel},set:function(E){this._startLevel=E}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(E){this.level=E,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=E)}}]),u}(R.default)},"./src/controller/level-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"addGroupId",function(){return O}),L.d(z,"assignTrackIdsByGroup",function(){return B}),L.d(z,"updatePTS",function(){return k}),L.d(z,"updateFragPTSDTS",function(){return S}),L.d(z,"mergeDetails",function(){return m}),L.d(z,"mapPartIntersection",function(){return b}),L.d(z,"mapFragmentIntersection",function(){return P}),L.d(z,"adjustSliding",function(){return w}),L.d(z,"addSliding",function(){return x}),L.d(z,"computeReloadInterval",function(){return v}),L.d(z,"getFragmentWithSN",function(){return d}),L.d(z,"getPartWith",function(){return o});var K=L("./src/polyfills/number.ts"),F=L("./src/utils/logger.ts");function O(u,s,C){switch(s){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(C);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(C);break}}function B(u){var s={};u.forEach(function(C){var E=C.groupId||"";C.id=s[E]=s[E]||0,s[E]++})}function k(u,s,C){var E=u[s],f=u[C];R(E,f)}function R(u,s){var C=s.startPTS;if(Object(K.isFiniteNumber)(C)){var E=0,f;s.sn>u.sn?(E=C-u.start,f=u):(E=u.start-C,f=s),f.duration!==E&&(f.duration=E)}else if(s.sn>u.sn){var A=u.cc===s.cc;A&&u.minEndPTS?s.start=u.start+(u.minEndPTS-u.start):s.start=u.start+u.duration}else s.start=Math.max(u.start-s.duration,0)}function S(u,s,C,E,f,A){var g=E-C;g<=0&&(F.logger.warn("Fragment should have a positive duration",s),E=C+s.duration,A=f+s.duration);var p=C,c=E,l=s.startPTS,a=s.endPTS;if(Object(K.isFiniteNumber)(l)){var T=Math.abs(l-C);Object(K.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(T,s.deltaPTS):s.deltaPTS=T,p=Math.max(C,l),C=Math.min(C,l),f=Math.min(f,s.startDTS),c=Math.min(E,a),E=Math.max(E,a),A=Math.max(A,s.endDTS)}s.duration=E-C;var y=C-s.start;s.appendedPTS=E,s.start=s.startPTS=C,s.maxStartPTS=p,s.startDTS=f,s.endPTS=E,s.minEndPTS=c,s.endDTS=A;var h=s.sn;if(!u||h<u.startSN||h>u.endSN)return 0;var D,U=h-u.startSN,N=u.fragments;for(N[U]=s,D=U;D>0;D--)R(N[D],N[D-1]);for(D=U;D<N.length-1;D++)R(N[D],N[D+1]);return u.fragmentHint&&R(N[N.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,y}function m(u,s){for(var C=null,E=u.fragments,f=E.length-1;f>=0;f--){var A=E[f].initSegment;if(A){C=A;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var g=0,p;if(P(u,s,function(D,U){D.relurl&&(g=D.cc-U.cc),Object(K.isFiniteNumber)(D.startPTS)&&Object(K.isFiniteNumber)(D.endPTS)&&(U.start=U.startPTS=D.startPTS,U.startDTS=D.startDTS,U.appendedPTS=D.appendedPTS,U.maxStartPTS=D.maxStartPTS,U.endPTS=D.endPTS,U.endDTS=D.endDTS,U.minEndPTS=D.minEndPTS,U.duration=D.endPTS-D.startPTS,U.duration&&(p=U),s.PTSKnown=s.alignedSliding=!0),U.elementaryStreams=D.elementaryStreams,U.loader=D.loader,U.stats=D.stats,U.urlId=D.urlId,D.initSegment&&(U.initSegment=D.initSegment,C=D.initSegment)}),C){var c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;c.forEach(function(D){var U;(!D.initSegment||D.initSegment.relurl===((U=C)===null||U===void 0?void 0:U.relurl))&&(D.initSegment=C)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(D){return!D}),s.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=s.skippedSegments;l--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var a=s.fragments;if(g){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var T=0;T<a.length;T++)a[T].cc+=g}s.skippedSegments&&(s.startCC=s.fragments[0].cc),b(u.partList,s.partList,function(D,U){U.elementaryStreams=D.elementaryStreams,U.stats=D.stats}),p?S(s,p,p.startPTS,p.endPTS,p.startDTS,p.endDTS):w(u,s),a.length&&(s.totalduration=s.edge-a[0].start),s.driftStartTime=u.driftStartTime,s.driftStart=u.driftStart;var y=s.advancedDateTime;if(s.advanced&&y){var h=s.edge;s.driftStart||(s.driftStartTime=y,s.driftStart=h),s.driftEndTime=y,s.driftEnd=h}else s.driftEndTime=u.driftEndTime,s.driftEnd=u.driftEnd,s.advancedDateTime=u.advancedDateTime}function b(u,s,C){if(u&&s)for(var E=0,f=0,A=u.length;f<=A;f++){var g=u[f],p=s[f+E];g&&p&&g.index===p.index&&g.fragment.sn===p.fragment.sn?C(g,p):E--}}function P(u,s,C){for(var E=s.skippedSegments,f=Math.max(u.startSN,s.startSN)-s.startSN,A=(u.fragmentHint?1:0)+(E?s.endSN:Math.min(u.endSN,s.endSN))-s.startSN,g=s.startSN-u.startSN,p=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,l=f;l<=A;l++){var a=c[g+l],T=p[l];E&&!T&&l<E&&(T=s.fragments[l]=a),a&&T&&C(a,T)}}function w(u,s){var C=s.startSN+s.skippedSegments-u.startSN,E=u.fragments;if(C<0||C>=E.length)return;x(s,E[C].start)}function x(u,s){if(s){for(var C=u.fragments,E=u.skippedSegments;E<C.length;E++)C[E].start+=s;u.fragmentHint&&(u.fragmentHint.start+=s)}}function v(u,s){var C=1e3*u.levelTargetDuration,E=C/2,f=u.age,A=f>0&&f<C*3,g=s.loading.end-s.loading.start,p,c=u.availabilityDelay;if(u.updated===!1)if(A){var l=333*u.misses;p=Math.max(Math.min(E,g*2),l),u.availabilityDelay=(u.availabilityDelay||0)+p}else p=E;else A?(c=Math.min(c||C/2,f),u.availabilityDelay=c,p=c+C-f):p=C-g;return Math.round(p)}function d(u,s,C){if(!u||!u.details)return null;var E=u.details,f=E.fragments[s-E.startSN];return f||(f=E.fragmentHint,f&&f.sn===s?f:s<E.startSN&&C&&C.sn===s?C:null)}function o(u,s,C){if(!u||!u.details)return null;var E=u.details.partList;if(E)for(var f=E.length;f--;){var A=E[f];if(A.index===C&&A.fragment.sn===s)return A}return null}},"./src/controller/stream-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return E});var K=L("./src/polyfills/number.ts"),F=L("./src/controller/base-stream-controller.ts"),O=L("./src/is-supported.ts"),B=L("./src/events.ts"),k=L("./src/utils/buffer-helper.ts"),R=L("./src/controller/fragment-tracker.ts"),S=L("./src/types/loader.ts"),m=L("./src/loader/fragment.ts"),b=L("./src/demux/transmuxer-interface.ts"),P=L("./src/types/transmuxer.ts"),w=L("./src/controller/gap-controller.ts"),x=L("./src/errors.ts"),v=L("./src/utils/logger.ts");function d(f,A){for(var g=0;g<A.length;g++){var p=A[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(f,p.key,p)}}function o(f,A,g){return A&&d(f.prototype,A),g&&d(f,g),f}function u(f,A){f.prototype=Object.create(A.prototype),f.prototype.constructor=f,s(f,A)}function s(f,A){return s=Object.setPrototypeOf||function(p,c){return p.__proto__=c,p},s(f,A)}var C=100,E=function(f){u(A,f);function A(p,c){var l;return l=f.call(this,p,c,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var g=A.prototype;return g._registerListeners=function(){var c=this.hls;c.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(B.Events.ERROR,this.onError,this),c.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(B.Events.ERROR,this.onError,this),c.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},g.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var T=a.startLevel;T===-1&&(a.config.testBandwidth?(T=0,this.bitrateTest=!0):T=a.nextAutoLevel),this.level=a.nextLoadLevel=T,this.loadedmetadata=!1}l>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},g.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},g.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,T=l==null||((c=l[a])===null||c===void 0)?void 0:c.details;if(T&&(!T.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(T))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var y,h=self.performance.now(),D=this.retryDate;(!D||h>=D||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},g.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},g.doTickIdle=function(){var c,l,a=this.hls,T=this.levelLastLoaded,y=this.levels,h=this.media,D=a.config,U=a.nextLoadLevel;if(T===null||!h&&(this.startFragRequested||!D.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[U])return;var N=y[U];this.level=a.nextLoadLevel=U;var W=N.details;if(!W||this.state===F.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==U){this.state=F.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:h,S.PlaylistLevelType.MAIN);if(M===null)return;var I=M.len,H=this.getMaxBufferLength(N.maxBitrate);if(I>=H)return;if(this._streamEnded(M,W)){var X={};this.altAudio&&(X.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,X),this.state=F.State.ENDED;return}var te=M.end,ae=this.getNextFragment(te,W);if(this.couldBacktrack&&!this.fragPrevious&&ae&&ae.sn!=="initSegment"){var be=ae.sn-W.startSN;be>1&&(ae=W.fragments[be-1],this.fragmentTracker.removeFragment(ae))}if(ae&&this.fragmentTracker.getState(ae)===R.FragmentState.OK&&this.nextLoadPosition>te){var pe=this.audioOnly&&!this.altAudio?m.ElementaryStreamTypes.AUDIO:m.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(h,pe,S.PlaylistLevelType.MAIN),ae=this.getNextFragment(this.nextLoadPosition,W)}if(!ae)return;ae.initSegment&&!ae.initSegment.data&&!this.bitrateTest&&(ae=ae.initSegment),((c=ae.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((l=ae.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(ae,W):this.loadFragment(ae,W,te)},g.loadFragment=function(c,l,a){var T,y=this.fragmentTracker.getState(c);if(this.fragCurrent=c,y===R.FragmentState.BACKTRACKED){var h=this.fragmentTracker.getBacktrackData(c);if(h){this._handleFragmentLoadProgress(h),this._handleFragmentLoadComplete(h);return}else y=R.FragmentState.NOT_LOADED}y===R.FragmentState.NOT_LOADED||y===R.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,c,l,a)):y===R.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((T=this.media)===null||T===void 0?void 0:T.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},g.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,S.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},g.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,S.PlaylistLevelType.MAIN)},g.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},g.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},g.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,T=this.getAppendedFrag(l.currentTime);if(T&&T.start>1&&this.flushMainBuffer(0,T.start-1),!l.paused&&c){var y=this.hls.nextLoadLevel,h=c[y],D=this.fragLastKbps;D&&this.fragCurrent?a=this.fragCurrent.duration*h.maxBitrate/(1e3*D)+1:a=0}else a=0;var U=this.getBufferedFrag(l.currentTime+a);if(U){var N=this.followingBufferedFrag(U);if(N){this.abortCurrentFrag();var W=N.maxStartPTS?N.maxStartPTS:N.start,M=N.duration,I=Math.max(U.end,W+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},g.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},g.flushMainBuffer=function(c,l){f.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},g.onMediaAttached=function(c,l){f.prototype.onMediaAttached.call(this,c,l);var a=l.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new w.default(this.config,a,this.fragmentTracker,this.hls)},g.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),f.prototype.onMediaDetaching.call(this)},g.onMediaPlaying=function(){this.tick()},g.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(K.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},g.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},g.onManifestParsed=function(c,l){var a=!1,T=!1,y;l.levels.forEach(function(h){y=h.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(a=!0),y.indexOf("mp4a.40.5")!==-1&&(T=!0))}),this.audioCodecSwitch=a&&T&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},g.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==F.State.IDLE)return;var T=a[l.level];(!T.details||T.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(T.details))&&(this.state=F.State.WAITING_LEVEL)},g.onLevelLoaded=function(c,l){var a,T=this.levels,y=l.level,h=l.details,D=h.totalduration;if(!T){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+h.startSN+","+h.endSN+"], cc ["+h.startCC+", "+h.endCC+"] duration:"+D);var U=this.fragCurrent;U&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==l.level&&U.loader&&(this.state=F.State.IDLE,U.loader.abort()));var N=T[y],W=0;if(h.live||(a=N.details)!==null&&a!==void 0&&a.live){if(h.fragments[0]||(h.deltaUpdateFailed=!0),h.deltaUpdateFailed)return;W=this.alignPlaylists(h,N.details)}if(N.details=h,this.levelLastLoaded=y,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:h,level:y}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(h))return;this.state=F.State.IDLE}this.startFragRequested?h.live&&this.synchronizeToLiveEdge(h):this.setStartPosition(h,W),this.tick()},g._handleFragmentLoadProgress=function(c){var l,a=c.frag,T=c.part,y=c.payload,h=this.levels;if(!h){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var D=h[a.level],U=D.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var N=D.videoCodec,W=U.PTSKnown||!U.live,M=(l=a.initSegment)===null||l===void 0?void 0:l.data,I=this._getAudioCodec(D),H=this.transmuxer=this.transmuxer||new b.default(this.hls,S.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),X=T?T.index:-1,te=X!==-1,ae=new P.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,y.byteLength,X,te),be=this.initPTS[a.cc];H.push(y,M,I,N,a,T,U.totalduration,W,ae,be)},g.onAudioTrackSwitching=function(c,l){var a=this.altAudio,T=!!l.url,y=l.id;if(!T){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var h=this.fragCurrent;h!=null&&h.loader&&(this.log("Switching to main audio track, cancel main fragment load"),h.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var D=this.hls;a&&D.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),D.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:y})}},g.onAudioTrackSwitched=function(c,l){var a=l.id,T=!!this.hls.audioTracks[a].url;if(T){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=T,this.tick()},g.onBufferCreated=function(c,l){var a=l.tracks,T,y,h=!1;for(var D in a){var U=a[D];if(U.id==="main"){if(y=D,T=U,D==="video"){var N=a[D];N&&(this.videoBuffer=N.buffer)}}else h=!0}h&&T?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=T.buffer):this.mediaBuffer=this.media},g.onFragBuffered=function(c,l){var a=l.frag,T=l.part;if(a&&a.type!==S.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(T?" p: "+T.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var y=T?T.stats:a.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,T)},g.onError=function(c,l){switch(l.details){case x.ErrorDetails.FRAG_LOAD_ERROR:case x.ErrorDetails.FRAG_LOAD_TIMEOUT:case x.ErrorDetails.KEY_LOAD_ERROR:case x.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(S.PlaylistLevelType.MAIN,l);break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=F.State.ERROR):!l.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case x.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var a=!0,T=this.getFwdBufferInfo(this.media,S.PlaylistLevelType.MAIN);T&&T.len>.5&&(a=!this.reduceMaxBufferLength(T.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},g.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=k.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},g.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},g.onBufferFlushed=function(c,l){var a=l.type;if(a!==m.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var T=(a===m.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(T,a,S.PlaylistLevelType.MAIN)}},g.onLevelsUpdated=function(c,l){this.levels=l.levels},g.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},g.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){v.logger.log("could not seek to "+a+", already seeking at "+l);return}var T=k.BufferHelper.getBuffered(c),y=T.length?T.start(0):0,h=y-a;h>0&&(h<this.config.maxBufferHole||h<this.config.maxFragLookUpTolerance)&&(v.logger.log("adjusting start position by "+h+" to match buffer start"),a+=h,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+l),c.currentTime=a}},g._getAudioCodec=function(c){var l=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},g._loadBitrateTestFrag=function(c){var l=this;this._doFragLoad(c).then(function(a){var T=l.hls;if(!a||T.nextLoadLevel||l.fragContextChanged(c))return;l.fragLoadError=0,l.state=F.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var y=c.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),T.trigger(B.Events.FRAG_LOADED,a)})},g._handleTransmuxComplete=function(c){var l,a="main",T=this.hls,y=c.remuxResult,h=c.chunkMeta,D=this.getCurrentContext(h);if(!D){this.warn("The loading context changed while buffering fragment "+h.sn+" of level "+h.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(h.level);return}var U=D.frag,N=D.part,W=D.level,M=y.video,I=y.text,H=y.id3,X=y.initSegment,te=this.altAudio?void 0:y.audio;if(this.fragContextChanged(U))return;if(this.state=F.State.PARSING,X){X.tracks&&(this._bufferInitSegment(W,X.tracks,U,h),T.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:X.tracks}));var ae=X.initPTS,be=X.timescale;Object(K.isFiniteNumber)(ae)&&(this.initPTS[U.cc]=ae,T.trigger(B.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:ae,timescale:be}))}if(M&&y.independent!==!1){if(W.details){var pe=M.startPTS,ue=M.endPTS,se=M.startDTS,he=M.endDTS;if(N)N.elementaryStreams[M.type]={startPTS:pe,endPTS:ue,startDTS:se,endDTS:he};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var ne=this.getLoadPosition()+this.config.maxBufferHole;if(ne<pe){this.backtrack(U);return}U.setElementaryStreamInfo(M.type,U.start,ue,U.start,he,!0)}U.setElementaryStreamInfo(M.type,pe,ue,se,he),this.bufferFragmentData(M,U,N,h)}}else if(y.independent===!1){this.backtrack(U);return}if(te){var me=te.startPTS,Q=te.endPTS,ie=te.startDTS,ee=te.endDTS;N&&(N.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:Q,startDTS:ie,endDTS:ee}),U.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,me,Q,ie,ee),this.bufferFragmentData(te,U,N,h)}if(H!=null&&(l=H.samples)!==null&&l!==void 0&&l.length){var Ee={frag:U,id:a,samples:H.samples};T.trigger(B.Events.FRAG_PARSING_METADATA,Ee)}if(I){var _e={frag:U,id:a,samples:I.samples};T.trigger(B.Events.FRAG_PARSING_USERDATA,_e)}},g._bufferInitSegment=function(c,l,a,T){var y=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var h=l.audio,D=l.video,U=l.audiovideo;if(h){var N=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(N&&(N.indexOf("mp4a.40.5")!==-1?N="mp4a.40.2":N="mp4a.40.5"),h.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(N="mp4a.40.5")),W.indexOf("android")!==-1&&h.container!=="audio/mpeg"&&(N="mp4a.40.2",this.log("Android: force audio codec to "+N)),c.audioCodec&&c.audioCodec!==N&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+N+'"'),h.levelCodec=N,h.id="main",this.log("Init audio buffer, container:"+h.container+", codecs[selected/level/parsed]=["+(N||"")+"/"+(c.audioCodec||"")+"/"+h.codec+"]")}D&&(D.levelCodec=c.videoCodec,D.id="main",this.log("Init video buffer, container:"+D.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+D.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,l),Object.keys(l).forEach(function(M){var I=l[M],H=I.initSegment;H!=null&&H.byteLength&&y.hls.trigger(B.Events.BUFFER_APPENDING,{type:M,data:H,frag:a,part:null,chunkMeta:T,parent:a.type})}),this.tick()},g.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var l=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,l?this.resetFragmentLoading(c):this.state=F.State.BACKTRACKING},g.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(k.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):k.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var T=this.fragPlaying,y=l.level;(!T||l.sn!==T.sn||T.level!==y||l.urlId!==T.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:l}),(!T||T.level!==y)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=l)}}},o(A,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"SubtitleStreamController",function(){return u});var K=L("./src/events.ts"),F=L("./src/utils/logger.ts"),O=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),k=L("./src/utils/discontinuities.ts"),R=L("./src/controller/level-helper.ts"),S=L("./src/controller/fragment-tracker.ts"),m=L("./src/controller/base-stream-controller.ts"),b=L("./src/types/loader.ts"),P=L("./src/types/level.ts");function w(s,C){for(var E=0;E<C.length;E++){var f=C[E];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(s,f.key,f)}}function x(s,C,E){return C&&w(s.prototype,C),E&&w(s,E),s}function v(s,C){s.prototype=Object.create(C.prototype),s.prototype.constructor=s,d(s,C)}function d(s,C){return d=Object.setPrototypeOf||function(f,A){return f.__proto__=A,f},d(s,C)}var o=500,u=function(s){v(C,s);function C(f,A){var g;return g=s.call(this,f,A,"[subtitle-stream-controller]")||this,g.levels=[],g.currentTrackId=-1,g.tracksBuffered=[],g.mainDetails=null,g._registerListeners(),g}var E=C.prototype;return E.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},E._registerListeners=function(){var A=this.hls;A.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(K.Events.ERROR,this.onError,this),A.on(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},E._unregisterListeners=function(){var A=this.hls;A.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(K.Events.ERROR,this.onError,this),A.off(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},E.startLoad=function(){this.stopLoad(),this.state=m.State.IDLE,this.setInterval(o),this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},E.onLevelLoaded=function(A,g){this.mainDetails=g.details},E.onSubtitleFragProcessed=function(A,g){var p=g.frag,c=g.success;if(this.fragPrevious=p,this.state=m.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,T=p.start,y=0;y<l.length;y++)if(T>=l[y].start&&T<=l[y].end){a=l[y];break}var h=p.start+p.duration;a?a.end=h:(a={start:T,end:h},l.push(a)),this.fragmentTracker.fragBuffered(p)},E.onBufferFlushing=function(A,g){var p=g.startOffset,c=g.endOffset;if(p===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var T=a[l].details,y=T.targetduration,h=c-y;if(h<=0)return;g.endOffsetSubtitles=Math.max(0,h),this.tracksBuffered.forEach(function(D){for(var U=0;U<D.length;){if(D[U].end<=h){D.shift();continue}else if(D[U].start<h)D[U].start=h;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(p,h,b.PlaylistLevelType.SUBTITLE)}},E.onError=function(A,g){var p,c=g.frag;if(!c||c.type!==b.PlaylistLevelType.SUBTITLE)return;(p=this.fragCurrent)!==null&&p!==void 0&&p.loader&&this.fragCurrent.loader.abort(),this.state=m.State.IDLE},E.onSubtitleTracksUpdated=function(A,g){var p=this,c=g.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(l){return new P.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){p.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},E.onSubtitleTrackSwitch=function(A,g){if(this.currentTrackId=g.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var p=this.levels[this.currentTrackId];p!=null&&p.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,p&&this.setInterval(o)},E.onSubtitleTrackLoaded=function(A,g){var p,c=g.details,l=g.id,a=this.currentTrackId,T=this.levels;if(!T.length)return;var y=T[a];if(l>=T.length||l!==a||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(p=y.details)!==null&&p!==void 0&&p.live){var h=this.mainDetails;if(c.deltaUpdateFailed||!h)return;var D=h.fragments[0];if(!y.details)c.hasProgramDateTime&&h.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(c,h):D&&Object(R.addSliding)(c,D.start);else{var U=this.alignPlaylists(c,y.details);U===0&&D&&Object(R.addSliding)(c,D.start)}}if(y.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===m.State.IDLE){var N=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);N||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},E._handleFragmentLoadComplete=function(A){var g=A.frag,p=A.payload,c=g.decryptdata,l=this.hls;if(this.fragContextChanged(g))return;if(p&&p.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(p),c.key.buffer,c.iv.buffer).then(function(T){var y=performance.now();l.trigger(K.Events.FRAG_DECRYPTED,{frag:g,payload:T,stats:{tstart:a,tdecrypt:y}})})}},E.doTick=function(){if(!this.media){this.state=m.State.IDLE;return}if(this.state===m.State.IDLE){var A,g=this.currentTrackId,p=this.levels;if(!p.length||!p[g]||!p[g].details)return;var c=p[g].details,l=c.targetduration,a=this.config,T=this.media,y=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,T.currentTime-l,a.maxBufferHole),h=y.end,D=y.len,U=this.getMaxBufferLength()+l;if(D>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var N=c.fragments,W=N.length,M=c.edge,I,H=this.fragPrevious;if(h<M){var X=a.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(I=Object(B.findFragmentByPDT)(N,H.endProgramDateTime,X)),I||(I=Object(B.findFragmentByPTS)(H,N,h,X),!I&&H&&H.start<N[0].start&&(I=N[0]))}else I=N[W-1];(A=I)!==null&&A!==void 0&&A.encrypted?(F.logger.log("Loading key for "+I.sn),this.state=m.State.KEY_LOADING,this.hls.trigger(K.Events.KEY_LOADING,{frag:I})):I&&this.fragmentTracker.getState(I)===S.FragmentState.NOT_LOADED&&this.loadFragment(I,c,h)}},E.loadFragment=function(A,g,p){this.fragCurrent=A,s.prototype.loadFragment.call(this,A,g,p)},x(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(m.default)},"./src/controller/subtitle-track-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),F=L("./src/utils/texttrack-utils.ts"),O=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function k(w,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function R(w,x,v){return x&&k(w.prototype,x),v&&k(w,v),w}function S(w,x){w.prototype=Object.create(x.prototype),w.prototype.constructor=w,m(w,x)}function m(w,x){return m=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},m(w,x)}var b=function(w){S(x,w);function x(d){var o;return o=w.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var v=x.prototype;return v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},v.registerListeners=function(){var o=this.hls;o.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(K.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var o=this.hls;o.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(K.Events.ERROR,this.onError,this)},v.onMediaAttached=function(o,u){if(this.media=u.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)},v.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},v.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 o=P(this.media.textTracks);o.forEach(function(u){Object(F.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},v.onManifestParsed=function(o,u){this.tracks=u.subtitleTracks},v.onSubtitleTrackLoaded=function(o,u){var s=u.id,C=u.details,E=this.trackId,f=this.tracksInGroup[E];if(!f){this.warn("Invalid subtitle track id "+s);return}var A=f.details;f.details=u.details,this.log("subtitle track "+s+" loaded ["+C.startSN+"-"+C.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,u,A))},v.onLevelLoading=function(o,u){this.switchLevel(u.level)},v.onLevelSwitching=function(o,u){this.switchLevel(u.level)},v.switchLevel=function(o){var u=this.hls.levels[o];if(!(u!=null&&u.textGroupIds))return;var s=u.textGroupIds[u.urlId];if(this.groupId!==s){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,E=this.tracks.filter(function(g){return!s||g.groupId===s});this.tracksInGroup=E;var f=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=s;var A={subtitleTracks:E};this.log("Updating subtitle tracks, "+E.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(K.Events.SUBTITLE_TRACKS_UPDATED,A),f!==-1&&this.setSubtitleTrack(f,C)}},v.findTrackId=function(o){for(var u=this.tracksInGroup,s=0;s<u.length;s++){var C=u[s];if((!this.selectDefaultTrack||C.default)&&(!o||o===C.name))return C.id}return-1},v.onError=function(o,u){if(w.prototype.onError.call(this,o,u),u.fatal||!u.context)return;u.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},v.loadPlaylist=function(o){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var s=u.id,C=u.groupId,E=u.url;if(o)try{E=o.addDirectives(E)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(K.Events.SUBTITLE_TRACK_LOADING,{url:E,id:s,groupId:C,deliveryDirectives:o||null})}},v.toggleTrackModes=function(o){var u=this,s=this.media,C=this.subtitleDisplay,E=this.trackId;if(!s)return;var f=P(s.textTracks),A=f.filter(function(c){return c.groupId===u.groupId});if(o===-1)[].slice.call(f).forEach(function(c){c.mode="disabled"});else{var g=A[E];g&&(g.mode="disabled")}var p=A[o];p&&(p.mode=C?"showing":"hidden")},v.setSubtitleTrack=function(o,u){var s,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(s=C[o])!==null&&s!==void 0&&s.details)||o<-1||o>=C.length)return;this.clearTimer();var E=C[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,E){var f=E.id,A=E.groupId,g=A===void 0?"":A,p=E.name,c=E.type,l=E.url;this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:g,name:p,type:c,url:l});var a=this.switchParams(E.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:o})},v.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,u=P(this.media.textTracks),s=0;s<u.length;s++)if(u[s].mode==="hidden")o=s;else if(u[s].mode==="showing"){o=s;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},R(x,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,u)}}]),x}(O.default);function P(w){for(var x=[],v=0;v<w.length;v++){var d=w[v];d.kind==="subtitles"&&d.label&&x.push(w[v])}return x}z.default=b},"./src/controller/timeline-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"TimelineController",function(){return P});var K=L("./src/polyfills/number.ts"),F=L("./src/events.ts"),O=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),k=L("./src/utils/webvtt-parser.ts"),R=L("./src/utils/texttrack-utils.ts"),S=L("./src/utils/imsc1-ttml-parser.ts"),m=L("./src/types/loader.ts"),b=L("./src/utils/logger.ts"),P=function(){function d(u){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=v(),this.captionsProperties=void 0,this.hls=u,this.config=u.config,this.Cues=u.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 s=new B.default(this,"textTrack1"),C=new B.default(this,"textTrack2"),E=new B.default(this,"textTrack3"),f=new B.default(this,"textTrack4");this.cea608Parser1=new O.default(1,s,C),this.cea608Parser2=new O.default(3,E,f)}u.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(F.Events.FRAG_LOADING,this.onFragLoading,this),u.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var s=this.hls;s.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(F.Events.FRAG_LOADING,this.onFragLoading,this),s.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(s,C,E,f,A){for(var g=!1,p=A.length;p--;){var c=A[p],l=x(c[0],c[1],C,E);if(l>=0&&(c[0]=Math.min(c[0],C),c[1]=Math.max(c[1],E),g=!0,l/(E-C)>.5))return}if(g||A.push([C,E]),this.config.renderTextTracksNatively){var a=this.captionsTracks[s];this.Cues.newCue(a,C,E,f)}else{var T=this.Cues.newCue(null,C,E,f);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:T,track:s})}},o.onInitPtsFound=function(s,C){var E=this,f=C.frag,A=C.id,g=C.initPTS,p=C.timescale,c=this.unparsedVttFrags;A==="main"&&(this.initPTS[f.cc]=g,this.timescale[f.cc]=p),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){E.onFragLoaded(F.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(s){var C=this.media;if(C)for(var E=0;E<C.textTracks.length;E++){var f=C.textTracks[E];if(f[s])return f}return null},o.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},o.createNativeTrack=function(s){if(this.captionsTracks[s])return;var C=this.captionsProperties,E=this.captionsTracks,f=this.media,A=C[s],g=A.label,p=A.languageCode,c=this.getExistingTrack(s);if(c)E[s]=c,Object(R.clearCurrentCues)(E[s]),Object(R.sendAddTrackEvent)(E[s],f);else{var l=this.createTextTrack("captions",g,p);l&&(l[s]=!0,E[s]=l)}},o.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var C=this.captionsProperties[s];if(!C)return;var E=C.label,f={_id:s,label:E,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[s]=f,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(s,C,E){var f=this.media;return f?f.addTextTrack(s,C,E):void 0},o.onMediaAttaching=function(s,C){this.media=C.media,this._cleanTracks()},o.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(C){Object(R.clearCurrentCues)(s[C]),delete s[C]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),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())},o._cleanTracks=function(){var s=this.media;if(!s)return;var C=s.textTracks;if(C)for(var E=0;E<C.length;E++)Object(R.clearCurrentCues)(C[E])},o.onSubtitleTracksUpdated=function(s,C){var E=this;this.textTracks=[];var f=C.subtitleTracks||[],A=f.some(function(l){return l.textCodec===S.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var g=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var p=this.media?this.media.textTracks:[];this.tracks.forEach(function(l,a){var T;if(a<p.length){for(var y=null,h=0;h<p.length;h++)if(w(p[h],l)){y=p[h];break}y&&(T=y)}T?Object(R.clearCurrentCues)(T):(T=E.createTextTrack("subtitles",l.name,l.lang),T&&(T.mode="disabled")),T&&(T.groupId=l.groupId,E.textTracks.push(T))})}else if(!g&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(s,C){var E=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(f){var A=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!A)return;var g="textTrack"+A[1],p=E.captionsProperties[g];if(!p)return;p.label=f.name,f.lang&&(p.languageCode=f.lang),p.media=f})},o.onFragLoading=function(s,C){var E=this.cea608Parser1,f=this.cea608Parser2,A=this.lastSn,g=this.lastPartIndex;if(!this.enabled||!(E&&f))return;if(C.frag.type===m.PlaylistLevelType.MAIN){var p,c,l=C.frag.sn,a=(p=C==null||((c=C.part)===null||c===void 0)?void 0:c.index)!=null?p:-1;l===A+1||l===A&&a===g+1||(E.reset(),f.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(s,C){var E=C.frag,f=C.payload,A=this.initPTS,g=this.unparsedVttFrags;if(E.type===m.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(K.isFiniteNumber)(A[E.cc])){g.push(C),A.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:E,error:new Error("Missing initial subtitle PTS")});return}var p=E.decryptdata;if(p==null||p.key==null||p.method!=="AES-128"){var c=this.tracks[E.level],l=this.vttCCs;l[E.cc]||(l[E.cc]={start:E.start,prevCC:this.prevCC,new:!0},this.prevCC=E.cc),c&&c.textCodec===S.IMSC1_CODEC?this._parseIMSC1(E,f):this._parseVTTs(E,f,l)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:E,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(s,C){var E=this,f=this.hls;Object(S.parseIMSC1)(C,this.initPTS[s.cc],this.timescale[s.cc],function(A){E._appendCues(A,s.level),f.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(A){b.logger.log("Failed to parse IMSC1: "+A),f.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:A})})},o._parseVTTs=function(s,C,E){var f=this,A=this.hls;Object(k.parseWebVTT)(C,this.initPTS[s.cc],this.timescale[s.cc],E,s.cc,s.start,function(g){f._appendCues(g,s.level),A.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(g){f._fallbackToIMSC1(s,C),b.logger.log("Failed to parse VTT cue: "+g),A.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:g})})},o._fallbackToIMSC1=function(s,C){var E=this,f=this.tracks[s.level];f.textCodec||Object(S.parseIMSC1)(C,this.initPTS[s.cc],this.timescale[s.cc],function(){f.textCodec=S.IMSC1_CODEC,E._parseIMSC1(s,C)},function(){f.textCodec="wvtt"})},o._appendCues=function(s,C){var E=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[C];if(f.mode==="disabled")return;s.forEach(function(p){return Object(R.addCueToTrack)(f,p)})}else{var A=this.tracks[C],g=A.default?"default":"subtitles"+C;E.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:s,track:g})}},o.onFragDecrypted=function(s,C){var E=C.frag;if(E.type===m.PlaylistLevelType.SUBTITLE){if(!Object(K.isFiniteNumber)(this.initPTS[E.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(F.Events.FRAG_LOADED,C)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(s,C){var E=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(E&&f))return;for(var A=0;A<C.samples.length;A++){var g=C.samples[A].bytes;if(g){var p=this.extractCea608Data(g);E.addData(C.samples[A].pts,p[0]),f.addData(C.samples[A].pts,p[1])}}},o.onBufferFlushing=function(s,C){var E=C.startOffset,f=C.endOffset,A=C.endOffsetSubtitles,g=C.type,p=this.media;if(!p||p.currentTime<f)return;if(!g||g==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(R.removeCuesInRange)(c[a],E,f)})}if(this.config.renderTextTracksNatively&&(E===0&&A!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(R.removeCuesInRange)(l[a],E,A)})}},o.extractCea608Data=function(s){for(var C=s[0]&31,E=2,f=[[],[]],A=0;A<C;A++){var g=s[E++],p=127&s[E++],c=127&s[E++],l=(4&g)!==0,a=3&g;if(p===0&&c===0)continue;l&&((a===0||a===1)&&(f[a].push(p),f[a].push(c)))}return f},d}();function w(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function x(d,o,u,s){return Math.min(o,s)-Math.max(d,u)}function v(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function F(B,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=k}var O=F.prototype;return O.decrypt=function(k,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,k)},F}()},"./src/crypt/aes-decryptor.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"removePadding",function(){return F}),L.d(z,"default",function(){return O});var K=L("./src/utils/typed-array.ts");function F(B){var k=B.byteLength,R=k&&new DataView(B.buffer).getUint8(k-1);return R?Object(K.sliceUint8)(B,0,k-R):B}var O=function(){function B(){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 k=B.prototype;return k.uint8ArrayToUint32Array_=function(S){for(var m=new DataView(S),b=new Uint32Array(4),P=0;P<4;P++)b[P]=m.getUint32(P*4);return b},k.initTable=function(){var S=this.sBox,m=this.invSBox,b=this.subMix,P=b[0],w=b[1],x=b[2],v=b[3],d=this.invSubMix,o=d[0],u=d[1],s=d[2],C=d[3],E=new Uint32Array(256),f=0,A=0,g=0;for(g=0;g<256;g++)g<128?E[g]=g<<1:E[g]=g<<1^283;for(g=0;g<256;g++){var p=A^A<<1^A<<2^A<<3^A<<4;p=p>>>8^p&255^99,S[f]=p,m[p]=f;var c=E[f],l=E[c],a=E[l],T=E[p]*257^p*16843008;P[f]=T<<24|T>>>8,w[f]=T<<16|T>>>16,x[f]=T<<8|T>>>24,v[f]=T,T=a*16843009^l*65537^c*257^f*16843008,o[p]=T<<24|T>>>8,u[p]=T<<16|T>>>16,s[p]=T<<8|T>>>24,C[p]=T,f?(f=c^E[E[E[a^c]]],A^=E[E[A]]):f=A=1}},k.expandKey=function(S){for(var m=this.uint8ArrayToUint32Array_(S),b=!0,P=0;P<m.length&&b;)b=m[P]===this.key[P],P++;if(b)return;this.key=m;var w=this.keySize=m.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var x=this.ksRows=(w+6+1)*4,v,d,o=this.keySchedule=new Uint32Array(x),u=this.invKeySchedule=new Uint32Array(x),s=this.sBox,C=this.rcon,E=this.invSubMix,f=E[0],A=E[1],g=E[2],p=E[3],c,l;for(v=0;v<x;v++){if(v<w){c=o[v]=m[v];continue}l=c,v%w===0?(l=l<<8|l>>>24,l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[l&255],l^=C[v/w|0]<<24):w>6&&v%w===4&&(l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[l&255]),o[v]=c=(o[v-w]^l)>>>0}for(d=0;d<x;d++)v=x-d,d&3?l=o[v]:l=o[v-4],d<4||v<=4?u[d]=l:u[d]=f[s[l>>>24]]^A[s[l>>>16&255]]^g[s[l>>>8&255]]^p[s[l&255]],u[d]=u[d]>>>0},k.networkToHostOrderSwap=function(S){return S<<24|(S&65280)<<8|(S&16711680)>>8|S>>>24},k.decrypt=function(S,m,b){for(var P=this.keySize+6,w=this.invKeySchedule,x=this.invSBox,v=this.invSubMix,d=v[0],o=v[1],u=v[2],s=v[3],C=this.uint8ArrayToUint32Array_(b),E=C[0],f=C[1],A=C[2],g=C[3],p=new Int32Array(S),c=new Int32Array(p.length),l,a,T,y,h,D,U,N,W,M,I,H,X,te,ae=this.networkToHostOrderSwap;m<p.length;){for(W=ae(p[m]),M=ae(p[m+1]),I=ae(p[m+2]),H=ae(p[m+3]),h=W^w[0],D=H^w[1],U=I^w[2],N=M^w[3],X=4,te=1;te<P;te++)l=d[h>>>24]^o[D>>16&255]^u[U>>8&255]^s[N&255]^w[X],a=d[D>>>24]^o[U>>16&255]^u[N>>8&255]^s[h&255]^w[X+1],T=d[U>>>24]^o[N>>16&255]^u[h>>8&255]^s[D&255]^w[X+2],y=d[N>>>24]^o[h>>16&255]^u[D>>8&255]^s[U&255]^w[X+3],h=l,D=a,U=T,N=y,X=X+4;l=x[h>>>24]<<24^x[D>>16&255]<<16^x[U>>8&255]<<8^x[N&255]^w[X],a=x[D>>>24]<<24^x[U>>16&255]<<16^x[N>>8&255]<<8^x[h&255]^w[X+1],T=x[U>>>24]<<24^x[N>>16&255]<<16^x[h>>8&255]<<8^x[D&255]^w[X+2],y=x[N>>>24]<<24^x[h>>16&255]<<16^x[D>>8&255]<<8^x[U&255]^w[X+3],c[m]=ae(l^E),c[m+1]=ae(y^f),c[m+2]=ae(T^A),c[m+3]=ae(a^g),E=W,f=M,A=I,g=H,m=m+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return m});var K=L("./src/crypt/aes-crypto.ts"),F=L("./src/crypt/fast-aes-key.ts"),O=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),k=L("./src/utils/mp4-tools.ts"),R=L("./src/utils/typed-array.ts"),S=16,m=function(){function b(w,x,v){var d=v===void 0?{}:v,o=d.removePKCS7Padding,u=o===void 0?!0:o;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=w,this.config=x,this.removePKCS7Padding=u,u)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=b.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var x=this.currentResult;if(!x){this.reset();return}var v=new Uint8Array(x);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(v):v},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(x,v,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(x),v,d);var u=this.flush();u&&o(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(x),v,d).then(o)},P.softwareDecrypt=function(x,v,d){var o=this.currentIV,u=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(x=Object(k.appendUint8Array)(s,x),this.remainderData=null);var C=this.getValidChunk(x);if(!C.length)return null;o&&(d=o);var E=this.softwareDecrypter;E||(E=this.softwareDecrypter=new O.default),E.expandKey(v);var f=u;return this.currentResult=E.decrypt(C.buffer,0,d),this.currentIV=Object(R.sliceUint8)(C,-16).buffer,f||null},P.webCryptoDecrypt=function(x,v,d){var o=this,u=this.subtle;return(this.key!==v||!this.fastAesKey)&&(this.key=v,this.fastAesKey=new F.default(u,v)),this.fastAesKey.expandKey().then(function(s){if(!u)return Promise.reject(new Error("web crypto not initialized"));var C=new K.default(u,d);return C.decrypt(x.buffer,s)}).catch(function(s){return o.onWebCryptoError(s,x,v,d)})},P.onWebCryptoError=function(x,v,d,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",x),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(v,d,o)},P.getValidChunk=function(x){var v=x,d=x.length-x.length%S;return d!==x.length&&(v=Object(R.sliceUint8)(x,0,d),this.remainderData=Object(R.sliceUint8)(x,d)),v},P.logOnce=function(x){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+x),this.logEnabled=!1},b}()},"./src/crypt/fast-aes-key.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function F(B,k){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=k}var O=F.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/demux/base-audio-demuxer.ts"),F=L("./src/demux/adts.ts"),O=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function k(m,b){m.prototype=Object.create(b.prototype),m.prototype.constructor=m,R(m,b)}function R(m,b){return R=Object.setPrototypeOf||function(w,x){return w.__proto__=x,w},R(m,b)}var S=function(m){k(b,m);function b(w,x){var v;return v=m.call(this)||this,v.observer=void 0,v.config=void 0,v.observer=w,v.config=x,v}var P=b.prototype;return P.resetInitSegment=function(x,v,d){m.prototype.resetInitSegment.call(this,x,v,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:x,duration:d,inputTimeScale:9e4,dropped:0}},b.probe=function(x){if(!x)return!1;for(var v=B.getID3Data(x,0)||[],d=v.length,o=x.length;d<o;d++)if(F.probe(x,d))return O.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(x,v){return F.canParse(x,v)},P.appendFrame=function(x,v,d){F.initTrackConfig(x,this.observer,v,d,x.manifestCodec);var o=F.appendFrame(x,v,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},b}(K.default);S.minProbeByteLength=9,z.default=S},"./src/demux/adts.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"getAudioConfig",function(){return B}),L.d(z,"isHeaderPattern",function(){return k}),L.d(z,"getHeaderLength",function(){return R}),L.d(z,"getFullFrameLength",function(){return S}),L.d(z,"canGetFrameLength",function(){return m}),L.d(z,"isHeader",function(){return b}),L.d(z,"canParse",function(){return P}),L.d(z,"probe",function(){return w}),L.d(z,"initTrackConfig",function(){return x}),L.d(z,"getFrameDuration",function(){return v}),L.d(z,"parseFrameHeader",function(){return d}),L.d(z,"appendFrame",function(){return o});var K=L("./src/utils/logger.ts"),F=L("./src/errors.ts"),O=L("./src/events.ts");function B(u,s,C,E){var f,A,g,p,c=navigator.userAgent.toLowerCase(),l=E,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((s[C+2]&192)>>>6)+1;var T=(s[C+2]&60)>>>2;if(T>a.length-1){u.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+T});return}return g=(s[C+2]&1)<<2,g|=(s[C+3]&192)>>>6,K.logger.log("manifest codec:"+E+", ADTS type:"+f+", samplingIndex:"+T),/firefox/i.test(c)?T>=6?(f=5,p=new Array(4),A=T-3):(f=2,p=new Array(2),A=T):c.indexOf("android")!==-1?(f=2,p=new Array(2),A=T):(f=5,p=new Array(4),E&&(E.indexOf("mp4a.40.29")!==-1||E.indexOf("mp4a.40.5")!==-1)||!E&&T>=6?A=T-3:((E&&E.indexOf("mp4a.40.2")!==-1&&(T>=6&&g===1||/vivaldi/i.test(c))||!E&&g===1)&&(f=2,p=new Array(2)),A=T)),p[0]=f<<3,p[0]|=(T&14)>>1,p[1]|=(T&1)<<7,p[1]|=g<<3,f===5&&(p[1]|=(A&14)>>1,p[2]=(A&1)<<7,p[2]|=2<<2,p[3]=0),{config:p,samplerate:a[T],channelCount:g,codec:"mp4a.40."+f,manifestCodec:l}}function k(u,s){return u[s]===255&&(u[s+1]&246)===240}function R(u,s){return u[s+1]&1?7:9}function S(u,s){return(u[s+3]&3)<<11|u[s+4]<<3|(u[s+5]&224)>>>5}function m(u,s){return s+5<u.length}function b(u,s){return s+1<u.length&&k(u,s)}function P(u,s){return m(u,s)&&k(u,s)&&S(u,s)<=u.length-s}function w(u,s){if(b(u,s)){var C=R(u,s);if(s+C>=u.length)return!1;var E=S(u,s);if(E<=C)return!1;var f=s+E;return f===u.length||b(u,f)}return!1}function x(u,s,C,E,f){if(!u.samplerate){var A=B(s,C,E,f);if(!A)return;u.config=A.config,u.samplerate=A.samplerate,u.channelCount=A.channelCount,u.codec=A.codec,u.manifestCodec=A.manifestCodec,K.logger.log("parsed codec:"+u.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function v(u){return 1024*9e4/u}function d(u,s,C,E,f){var A=R(u,s),g=S(u,s);if(g-=A,g>0){var p=C+E*f;return{headerLength:A,frameLength:g,stamp:p}}}function o(u,s,C,E,f){var A=v(u.samplerate),g=d(s,C,E,f,A);if(g){var p=g.frameLength,c=g.headerLength,l=g.stamp,a=c+p,T=Math.max(0,C+a-s.length),y;T?(y=new Uint8Array(a-c),y.set(s.subarray(C+c,s.length),0)):y=s.subarray(C+c,C+a);var h={unit:y,pts:l};return T||u.samples.push(h),{sample:h,length:a,missing:T}}}},"./src/demux/base-audio-demuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"initPTSFn",function(){return S});var K=L("./src/polyfills/number.ts"),F=L("./src/demux/id3.ts"),O=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),k=L("./src/utils/typed-array.ts"),R=function(){function m(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var b=m.prototype;return b.resetInitSegment=function(w,x,v){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},b.resetTimeStamp=function(){},b.resetContiguity=function(){},b.canParse=function(w,x){return!1},b.appendFrame=function(w,x,v){},b.demux=function(w,x){this.cachedData&&(w=Object(B.appendUint8Array)(this.cachedData,w),this.cachedData=null);var v=F.getID3Data(w,0),d=v?v.length:0,o,u,s=this._audioTrack,C=this._id3Track,E=v?F.getTimeStamp(v):void 0,f=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=S(E,x)),v&&v.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:v}),u=this.initPTS;d<f;){if(this.canParse(w,d)){var A=this.appendFrame(s,w,d);A?(this.frameIndex++,u=A.sample.pts,d+=A.length,o=d):d=f}else F.canParse(w,d)?(v=F.getID3Data(w,d),C.samples.push({pts:u,dts:u,data:v}),d+=v.length,o=d):d++;if(d===f&&o!==f){var g=Object(k.sliceUint8)(w,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,g):this.cachedData=g}}return{audioTrack:s,avcTrack:Object(O.dummyTrack)(),id3Track:C,textTrack:Object(O.dummyTrack)()}},b.demuxSampleAes=function(w,x,v){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},b.flush=function(w){var x=this.cachedData;return x&&(this.cachedData=null,this.demux(x,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},b.destroy=function(){},m}(),S=function(b,P){return Object(K.isFiniteNumber)(b)?b*90:P*9e4};z.default=R},"./src/demux/chunk-cache.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function O(){this.chunks=[],this.dataLength=0}var B=O.prototype;return B.push=function(R){this.chunks.push(R),this.dataLength+=R.length},B.flush=function(){var R=this.chunks,S=this.dataLength,m;if(R.length)R.length===1?m=R[0]:m=F(R,S);else return new Uint8Array(0);return this.reset(),m},B.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function F(O,B){for(var k=new Uint8Array(B),R=0,S=0;S<O.length;S++){var m=O[S];k.set(m,R),R+=m.length}return k}},"./src/demux/dummy-demuxed-track.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"dummyTrack",function(){return K});function K(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/logger.ts"),F=function(){function O(k){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=k,this.bytesAvailable=k.byteLength,this.word=0,this.bitsAvailable=0}var B=O.prototype;return B.loadWord=function(){var R=this.data,S=this.bytesAvailable,m=R.byteLength-S,b=new Uint8Array(4),P=Math.min(4,S);if(P===0)throw new Error("no bytes available");b.set(R.subarray(m,m+P)),this.word=new DataView(b.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},B.skipBits=function(R){var S;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,S=R>>3,R-=S>>3,this.bytesAvailable-=S,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},B.readBits=function(R){var S=Math.min(this.bitsAvailable,R),m=this.word>>>32-S;return R>32&&K.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=S,this.bitsAvailable>0?this.word<<=S:this.bytesAvailable>0&&this.loadWord(),S=R-S,S>0&&this.bitsAvailable?m<<S|this.readBits(S):m},B.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},B.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(R){for(var S=8,m=8,b,P=0;P<R;P++)m!==0&&(b=this.readEG(),m=(S+b+256)%256),S=m===0?S:m},B.readSPS=function(){var R=0,S=0,m=0,b=0,P,w,x,v=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),u=this.readBoolean.bind(this),s=this.skipBits.bind(this),C=this.skipEG.bind(this),E=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);v();var A=v();if(d(5),s(3),v(),E(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var g=o();if(g===3&&s(1),E(),E(),s(1),u())for(w=g!==3?8:12,x=0;x<w;x++)u()&&(x<6?f(16):f(64))}E();var p=o();if(p===0)o();else if(p===1)for(s(1),C(),C(),P=o(),x=0;x<P;x++)C();E(),s(1);var c=o(),l=o(),a=d(1);a===0&&s(1),s(1),u()&&(R=o(),S=o(),m=o(),b=o());var T=[1,1];if(u()&&u()){var y=v();switch(y){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[v()<<8|v(),v()<<8|v()];break}}}return{width:Math.ceil((c+1)*16-R*2-S*2),height:(2-a)*(l+1)*16-(a?2:4)*(m+b),pixelRatio:T}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();z.default=F},"./src/demux/id3.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isHeader",function(){return K}),L.d(z,"isFooter",function(){return F}),L.d(z,"getID3Data",function(){return O}),L.d(z,"canParse",function(){return k}),L.d(z,"getTimeStamp",function(){return R}),L.d(z,"isTimeStampFrame",function(){return S}),L.d(z,"getID3Frames",function(){return b}),L.d(z,"decodeFrame",function(){return P}),L.d(z,"utf8ArrayToStr",function(){return o}),L.d(z,"testables",function(){return u});var K=function(f,A){return A+10<=f.length&&(f[A]===73&&f[A+1]===68&&f[A+2]===51&&(f[A+3]<255&&f[A+4]<255&&(f[A+6]<128&&f[A+7]<128&&f[A+8]<128&&f[A+9]<128)))},F=function(f,A){return A+10<=f.length&&(f[A]===51&&f[A+1]===68&&f[A+2]===73&&(f[A+3]<255&&f[A+4]<255&&(f[A+6]<128&&f[A+7]<128&&f[A+8]<128&&f[A+9]<128)))},O=function(f,A){for(var g=A,p=0;K(f,A);){p+=10;var c=B(f,A+6);p+=c,F(f,A+10)&&(p+=10),A+=p}return p>0?f.subarray(g,g+p):void 0},B=function(f,A){var g=0;return g=(f[A]&127)<<21,g|=(f[A+1]&127)<<14,g|=(f[A+2]&127)<<7,g|=f[A+3]&127,g},k=function(f,A){return K(f,A)&&B(f,A+6)+10<=f.length-A},R=function(f){for(var A=b(f),g=0;g<A.length;g++){var p=A[g];if(S(p))return d(p)}return},S=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},m=function(f){var A=String.fromCharCode(f[0],f[1],f[2],f[3]),g=B(f,4),p=10;return{type:A,size:g,data:f.subarray(p,p+g)}},b=function(f){for(var A=0,g=[];K(f,A);){var p=B(f,A+6);A+=10;for(var c=A+p;A+8<c;){var l=m(f.subarray(A)),a=P(l);a&&g.push(a),A+=l.size+10}F(f,A)&&(A+=10)}return g},P=function(f){return f.type==="PRIV"?w(f):f.type[0]==="W"?v(f):x(f)},w=function(f){if(f.size<2)return;var A=o(f.data,!0),g=new Uint8Array(f.data.subarray(A.length+1));return{key:f.type,info:A,data:g.buffer}},x=function(f){if(f.size<2)return;if(f.type==="TXXX"){var A=1,g=o(f.data.subarray(A),!0);A+=g.length+1;var p=o(f.data.subarray(A));return{key:f.type,info:g,data:p}}var c=o(f.data.subarray(1));return{key:f.type,data:c}},v=function(f){if(f.type==="WXXX"){if(f.size<2)return;var A=1,g=o(f.data.subarray(A),!0);A+=g.length+1;var p=o(f.data.subarray(A));return{key:f.type,info:g,data:p}}var c=o(f.data);return{key:f.type,data:c}},d=function(f){if(f.data.byteLength===8){var A=new Uint8Array(f.data),g=A[3]&1,p=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return p/=45,g&&(p+=4772185884e-2),Math.round(p)}return},o=function(f,A){A===void 0&&(A=!1);var g=C();if(g){var p=g.decode(f);if(A){var c=p.indexOf("\0");return c!==-1?p.substring(0,c):p}return p.replace(/\0/g,"")}for(var l=f.length,a,T,y,h="",D=0;D<l;){if(a=f[D++],a===0&&A)return h;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:h+=String.fromCharCode(a);break;case 12:case 13:T=f[D++],h+=String.fromCharCode((a&31)<<6|T&63);break;case 14:T=f[D++],y=f[D++],h+=String.fromCharCode((a&15)<<12|(T&63)<<6|(y&63)<<0);break;default:}}return h},u={decodeTextFrame:x},s;function C(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/demux/base-audio-demuxer.ts"),F=L("./src/demux/id3.ts"),O=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function k(m,b){m.prototype=Object.create(b.prototype),m.prototype.constructor=m,R(m,b)}function R(m,b){return R=Object.setPrototypeOf||function(w,x){return w.__proto__=x,w},R(m,b)}var S=function(m){k(b,m);function b(){return m.apply(this,arguments)||this}var P=b.prototype;return P.resetInitSegment=function(x,v,d){m.prototype.resetInitSegment.call(this,x,v,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:x,duration:d,inputTimeScale:9e4,dropped:0}},b.probe=function(x){if(!x)return!1;for(var v=F.getID3Data(x,0)||[],d=v.length,o=x.length;d<o;d++)if(B.probe(x,d))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(x,v){return B.canParse(x,v)},P.appendFrame=function(x,v,d){return this.initPTS===null?void 0:B.appendFrame(x,v,d,this.initPTS,this.frameIndex)},b}(K.default);S.minProbeByteLength=4,z.default=S},"./src/demux/mp4demuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/mp4-tools.ts"),F=L("./src/demux/dummy-demuxed-track.ts"),O=function(){function B(R,S){this.remainderData=null,this.config=void 0,this.config=S}var k=B.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},B.probe=function(S){return Object(K.findBox)({data:S,start:0,end:Math.min(S.length,16384)},["moof"]).length>0},k.demux=function(S){var m=S,b=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(m=Object(K.appendUint8Array)(this.remainderData,S));var P=Object(K.segmentValidRange)(m);this.remainderData=P.remainder,b.samples=P.valid||new Uint8Array}else b.samples=m;return{audioTrack:Object(F.dummyTrack)(),avcTrack:b,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},k.flush=function(){var S=Object(F.dummyTrack)();return S.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:S,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},k.demuxSampleAes=function(S,m,b){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},B}();O.minProbeByteLength=1024,z.default=O},"./src/demux/mpegaudio.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"appendFrame",function(){return R}),L.d(z,"parseHeader",function(){return S}),L.d(z,"isHeaderPattern",function(){return m}),L.d(z,"isHeader",function(){return b}),L.d(z,"canParse",function(){return P}),L.d(z,"probe",function(){return w});var K=null,F=[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],O=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k=[0,1,1,4];function R(x,v,d,o,u){if(d+24>v.length)return;var s=S(v,d);if(s&&d+s.frameLength<=v.length){var C=s.samplesPerFrame*9e4/s.sampleRate,E=o+u*C,f={unit:v.subarray(d,d+s.frameLength),pts:E,dts:E};return x.config=[],x.channelCount=s.channelCount,x.samplerate=s.sampleRate,x.samples.push(f),{sample:f,length:s.frameLength,missing:0}}}function S(x,v){var d=x[v+1]>>3&3,o=x[v+1]>>1&3,u=x[v+2]>>4&15,s=x[v+2]>>2&3;if(d!==1&&u!==0&&u!==15&&s!==3){var C=x[v+2]>>1&1,E=x[v+3]>>6,f=d===3?3-o:o===3?3:4,A=F[f*14+u-1]*1e3,g=d===3?0:d===2?1:2,p=O[g*3+s],c=E===3?1:2,l=B[d][o],a=k[o],T=l*8*a,y=Math.floor(l*A/p+C)*a;if(K===null){var h=navigator.userAgent||"",D=h.match(/Chrome\/(\d+)/i);K=D?parseInt(D[1]):0}var U=!!K&&K<=87;return U&&o===2&&A>=224e3&&E===0&&(x[v+3]=x[v+3]|128),{sampleRate:p,channelCount:c,frameLength:y,samplesPerFrame:T}}}function m(x,v){return x[v]===255&&(x[v+1]&224)===224&&(x[v+1]&6)!==0}function b(x,v){return v+1<x.length&&m(x,v)}function P(x,v){var d=4;return m(x,v)&&d<=x.length-v}function w(x,v){if(v+1<x.length&&m(x,v)){var d=4,o=S(x,v),u=d;o!=null&&o.frameLength&&(u=o.frameLength);var s=v+u;return s===x.length||b(x,s)}return!1}},"./src/demux/sample-aes.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/crypt/decrypter.ts"),F=L("./src/demux/tsdemuxer.ts"),O=function(){function B(R,S,m){this.keyData=void 0,this.decrypter=void 0,this.keyData=m,this.decrypter=new K.default(R,S,{removePKCS7Padding:!1})}var k=B.prototype;return k.decryptBuffer=function(S,m){this.decrypter.decrypt(S,this.keyData.key.buffer,this.keyData.iv.buffer,m)},k.decryptAacSample=function(S,m,b,P){var w=S[m].unit,x=w.subarray(16,w.length-w.length%16),v=x.buffer.slice(x.byteOffset,x.byteOffset+x.length),d=this;this.decryptBuffer(v,function(o){var u=new Uint8Array(o);w.set(u,16),P||d.decryptAacSamples(S,m+1,b)})},k.decryptAacSamples=function(S,m,b){for(;;m++){if(m>=S.length){b();return}if(S[m].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(S,m,b,P),!P)return}},k.getAvcEncryptedData=function(S){for(var m=Math.floor((S.length-48)/160)*16+16,b=new Int8Array(m),P=0,w=32;w<=S.length-16;w+=160,P+=16)b.set(S.subarray(w,w+16),P);return b},k.getAvcDecryptedUnit=function(S,m){for(var b=new Uint8Array(m),P=0,w=32;w<=S.length-16;w+=160,P+=16)S.set(b.subarray(P,P+16),w);return S},k.decryptAvcSample=function(S,m,b,P,w,x){var v=Object(F.discardEPB)(w.data),d=this.getAvcEncryptedData(v),o=this;this.decryptBuffer(d.buffer,function(u){w.data=o.getAvcDecryptedUnit(v,u),x||o.decryptAvcSamples(S,m,b+1,P)})},k.decryptAvcSamples=function(S,m,b,P){if(S instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;m++,b=0){if(m>=S.length){P();return}for(var w=S[m].units;!(b>=w.length);b++){var x=w[b];if(x.data.length<=48||x.type!==1&&x.type!==5)continue;var v=this.decrypter.isSync();if(this.decryptAvcSample(S,m,b,P,x,v),!v)return}}},B}();z.default=O},"./src/demux/transmuxer-interface.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return w});var K=L("./node_modules/webworkify-webpack/index.js"),F=L.n(K),O=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),k=L("./src/utils/logger.ts"),R=L("./src/errors.ts"),S=L("./src/utils/mediasource-helper.ts"),m=L("./node_modules/eventemitter3/index.js"),b=L.n(m),P=Object(S.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function x(d,o,u,s){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=d,this.id=o,this.onTransmuxComplete=u,this.onFlush=s;var E=d.config,f=function(l,a){a=a||{},a.frag=C.frag,a.id=C.id,d.trigger(l,a)};this.observer=new m.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,f),this.observer.on(O.Events.ERROR,f);var A={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},g=navigator.vendor;if(E.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var p;try{p=this.worker=K("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),p.addEventListener("message",this.onwmsg),p.onerror=function(c){d.trigger(O.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},p.postMessage({cmd:"init",typeSupported:A,vendor:g,id:o,config:JSON.stringify(E)})}catch(c){k.logger.warn("Error in worker:",c),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),p&&self.URL.revokeObjectURL(p.objectURL),this.transmuxer=new B.default(this.observer,A,E,g,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,A,E,g,o)}var v=x.prototype;return v.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},v.push=function(o,u,s,C,E,f,A,g,p,c){var l=this;p.transmuxing.start=self.performance.now();var a=this.transmuxer,T=this.worker,y=f?f.start:E.start,h=E.decryptdata,D=this.frag,U=!(D&&E.cc===D.cc),N=!(D&&p.level===D.level),W=D?p.sn-D.sn:-1,M=this.part?p.part-this.part.index:1,I=!N&&(W===1||W===0&&M===1),H=self.performance.now();(N||W||E.stats.parsing.start===0)&&(E.stats.parsing.start=H),f&&(M||!I)&&(f.stats.parsing.start=H);var X=new B.TransmuxState(U,I,g,N,y);if(!I||U){k.logger.log("[transmuxer-interface, "+E.type+"]: Starting new transmux session for sn: "+p.sn+" p: "+p.part+" level: "+p.level+" id: "+p.id+`
discontinuity: `+U+`
trackSwitch: `+N+`
contiguous: `+I+`
accurateTimeOffset: `+g+`
timeOffset: `+y);var te=new B.TransmuxConfig(s,C,u,A,c);this.configureTransmuxer(te)}if(this.frag=E,this.part=f,T)T.postMessage({cmd:"demux",data:o,decryptdata:h,chunkMeta:p,state:X},o instanceof ArrayBuffer?[o]:[]);else if(a){var ae=a.push(o,h,p,X);Object(B.isPromise)(ae)?ae.then(function(be){l.handleTransmuxComplete(be)}):this.handleTransmuxComplete(ae)}},v.flush=function(o){var u=this;o.transmuxing.start=self.performance.now();var s=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:o});else if(s){var E=s.flush(o);Object(B.isPromise)(E)?E.then(function(f){u.handleFlushResult(f,o)}):this.handleFlushResult(E,o)}},v.handleFlushResult=function(o,u){var s=this;o.forEach(function(C){s.handleTransmuxComplete(C)}),this.onFlush(u)},v.onWorkerMessage=function(o){var u=o.data,s=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,s.trigger(u.event,u.data);break}}},v.configureTransmuxer=function(o){var u=this.worker,s=this.transmuxer;u?u.postMessage({cmd:"configure",config:o}):s&&s.configure(o)},v.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},x}()},"./src/demux/transmuxer-worker.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return R});var K=L("./src/demux/transmuxer.ts"),F=L("./src/events.ts"),O=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),k=L.n(B);function R(w){var x=new B.EventEmitter,v=function(o,u){w.postMessage({event:o,data:u})};x.on(F.Events.FRAG_DECRYPTED,v),x.on(F.Events.ERROR,v),w.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var u=JSON.parse(o.config);w.transmuxer=new K.default(x,o.typeSupported,u,o.vendor,o.id),Object(O.enableLogs)(u.debug),v("init",null);break}case"configure":{w.transmuxer.configure(o.config);break}case"demux":{var s=w.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(K.isPromise)(s)?s.then(function(f){S(w,f)}):S(w,s);break}case"flush":{var C=o.chunkMeta,E=w.transmuxer.flush(C);Object(K.isPromise)(E)?E.then(function(f){b(w,f,C)}):b(w,E,C);break}default:break}})}function S(w,x){if(P(x.remuxResult))return;var v=[],d=x.remuxResult,o=d.audio,u=d.video;o&&m(v,o),u&&m(v,u),w.postMessage({event:"transmuxComplete",data:x},v)}function m(w,x){x.data1&&w.push(x.data1.buffer),x.data2&&w.push(x.data2.buffer)}function b(w,x,v){x.forEach(function(d){S(w,d)}),w.postMessage({event:"flush",data:v})}function P(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return u}),L.d(z,"isPromise",function(){return E}),L.d(z,"TransmuxConfig",function(){return f}),L.d(z,"TransmuxState",function(){return A});var K=L("./src/events.ts"),F=L("./src/errors.ts"),O=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),k=L("./src/demux/mp4demuxer.ts"),R=L("./src/demux/tsdemuxer.ts"),S=L("./src/demux/mp3demuxer.ts"),m=L("./src/remux/mp4-remuxer.ts"),b=L("./src/remux/passthrough-remuxer.ts"),P=L("./src/demux/chunk-cache.ts"),w=L("./src/utils/mp4-tools.ts"),x=L("./src/utils/logger.ts"),v;try{v=self.performance.now.bind(self.performance)}catch(g){x.logger.debug("Unable to use Performance API on this environment"),v=self.Date.now}var d=[{demux:R.default,remux:m.default},{demux:k.default,remux:b.default},{demux:B.default,remux:m.default},{demux:S.default,remux:m.default}],o=1024;d.forEach(function(g){var p=g.demux;o=Math.max(o,p.minProbeByteLength)});var u=function(){function g(c,l,a,T,y){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 P.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=T,this.id=y}var p=g.prototype;return p.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},p.push=function(l,a,T,y){var h=this,D=T.transmuxing;D.executeStart=v();var U=new Uint8Array(l),N=this.cache,W=this.config,M=this.currentTransmuxState,I=this.transmuxConfig;y&&(this.currentTransmuxState=y);var H=s(U,a);if(H&&H.method==="AES-128"){var X=this.getDecrypter();if(W.enableSoftwareAES){var te=X.softwareDecrypt(U,H.key.buffer,H.iv.buffer);if(!te)return D.executeEnd=v(),C(T);U=new Uint8Array(te)}else return this.decryptionPromise=X.webCryptoDecrypt(U,H.key.buffer,H.iv.buffer).then(function(ye){var we=h.push(ye,null,T);return h.decryptionPromise=null,we}),this.decryptionPromise}var ae=y||M,be=ae.contiguous,pe=ae.discontinuity,ue=ae.trackSwitch,se=ae.accurateTimeOffset,he=ae.timeOffset,ne=I.audioCodec,me=I.videoCodec,Q=I.defaultInitPts,ie=I.duration,ee=I.initSegmentData;if((pe||ue)&&this.resetInitSegment(ee,ne,me,ie),pe&&this.resetInitialTimestamp(Q),be||this.resetContiguity(),this.needsProbing(U,pe,ue)){if(N.dataLength){var Ee=N.flush();U=Object(w.appendUint8Array)(Ee,U)}this.configureTransmuxer(U,I)}var _e=this.transmux(U,H,he,se,T),ve=this.currentTransmuxState;return ve.contiguous=!0,ve.discontinuity=!1,ve.trackSwitch=!1,D.executeEnd=v(),_e},p.flush=function(l){var a=this,T=l.transmuxing;T.executeStart=v();var y=this.decrypter,h=this.cache,D=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(l)});var N=[],W=D.timeOffset;if(y){var M=y.flush();M&&N.push(this.push(M,null,l))}var I=h.dataLength;h.reset();var H=this.demuxer,X=this.remuxer;if(!H||!X)return I>=o&&this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),T.executeEnd=v(),[C(l)];var te=H.flush(W);return E(te)?te.then(function(ae){return a.flushRemux(N,ae,l),N}):(this.flushRemux(N,te,l),N)},p.flushRemux=function(l,a,T){var y=a.audioTrack,h=a.avcTrack,D=a.id3Track,U=a.textTrack,N=this.currentTransmuxState,W=N.accurateTimeOffset,M=N.timeOffset;x.logger.log("[transmuxer.ts]: Flushed fragment "+T.sn+(T.part>-1?" p: "+T.part:"")+" of level "+T.level);var I=this.remuxer.remux(y,h,D,U,M,W,!0,this.id);l.push({remuxResult:I,chunkMeta:T}),T.transmuxing.executeEnd=v()},p.resetInitialTimestamp=function(l){var a=this.demuxer,T=this.remuxer;if(!a||!T)return;a.resetTimeStamp(l),T.resetTimeStamp(l)},p.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},p.resetInitSegment=function(l,a,T,y){var h=this.demuxer,D=this.remuxer;if(!h||!D)return;h.resetInitSegment(a,T,y),D.resetInitSegment(l,a,T)},p.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},p.transmux=function(l,a,T,y,h){var D;return a&&a.method==="SAMPLE-AES"?D=this.transmuxSampleAes(l,a,T,y,h):D=this.transmuxUnencrypted(l,T,y,h),D},p.transmuxUnencrypted=function(l,a,T,y){var h=this.demuxer.demux(l,a,!1,!this.config.progressive),D=h.audioTrack,U=h.avcTrack,N=h.id3Track,W=h.textTrack,M=this.remuxer.remux(D,U,N,W,a,T,!1,this.id);return{remuxResult:M,chunkMeta:y}},p.transmuxSampleAes=function(l,a,T,y,h){var D=this;return this.demuxer.demuxSampleAes(l,a,T).then(function(U){var N=D.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,T,y,!1,D.id);return{remuxResult:N,chunkMeta:h}})},p.configureTransmuxer=function(l,a){for(var T=this.config,y=this.observer,h=this.typeSupported,D=this.vendor,U=a.audioCodec,N=a.defaultInitPts,W=a.duration,M=a.initSegmentData,I=a.videoCodec,H,X=0,te=d.length;X<te;X++)if(d[X].demux.probe(l)){H=d[X];break}H||(x.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:k.default,remux:b.default});var ae=this.demuxer,be=this.remuxer,pe=H.remux,ue=H.demux;(!be||!(be instanceof pe))&&(this.remuxer=new pe(y,T,h,D)),(!ae||!(ae instanceof ue))&&(this.demuxer=new ue(y,T,h),this.probe=ue.probe),this.resetInitSegment(M,U,I,W),this.resetInitialTimestamp(N)},p.needsProbing=function(l,a,T){return!this.demuxer||!this.remuxer||a||T},p.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new O.default(this.observer,this.config)),l},g}();function s(g,p){var c=null;return g.byteLength>0&&p!=null&&p.key!=null&&p.iv!==null&&p.method!=null&&(c=p),c}var C=function(p){return{remuxResult:{},chunkMeta:p}};function E(g){return"then"in g&&g.then instanceof Function}var f=function(p,c,l,a,T){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=p,this.videoCodec=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=T},A=function(p,c,l,a,T){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=p,this.contiguous=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=T}},"./src/demux/tsdemuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"discardEPB",function(){return C});var K=L("./src/demux/adts.ts"),F=L("./src/demux/mpegaudio.ts"),O=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),k=L("./src/demux/sample-aes.ts"),R=L("./src/events.ts"),S=L("./src/utils/mp4-tools.ts"),m=L("./src/utils/logger.ts"),b=L("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},w=function(){function E(A,g,p){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=A,this.config=g,this.typeSupported=p}E.probe=function(g){var p=E.syncOffset(g);return p<0?!1:(p&&m.logger.warn("MPEG2-TS detected but first sync word found @ offset "+p+", junk ahead ?"),!0)},E.syncOffset=function(g){for(var p=Math.min(1e3,g.length-3*188),c=0;c<p;){if(g[c]===71&&g[c+188]===71&&g[c+2*188]===71)return c;c++}return-1},E.createTrack=function(g,p){return{container:g==="video"||g==="audio"?"video/mp2t":void 0,type:g,id:P[g],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:g==="audio"?p:void 0}};var f=E.prototype;return f.resetInitSegment=function(g,p,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=E.createTrack("video",c),this._audioTrack=E.createTrack("audio",c),this._id3Track=E.createTrack("id3",c),this._txtTrack=E.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=g,this.videoCodec=p,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var g=this._audioTrack,p=this._avcTrack,c=this._id3Track;g&&(g.pesData=null),p&&(p.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(g,p,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,T=this._avcTrack,y=this._audioTrack,h=this._id3Track,D=T.pid,U=T.pesData,N=y.pid,W=h.pid,M=y.pesData,I=h.pesData,H=!1,X=this.pmtParsed,te=this._pmtId,ae=g.length;if(this.remainderData&&(g=Object(S.appendUint8Array)(this.remainderData,g),ae=g.length,this.remainderData=null),ae<188&&!l)return this.remainderData=g,{audioTrack:y,avcTrack:T,id3Track:h,textTrack:this._txtTrack};var be=Math.max(0,E.syncOffset(g));ae-=(ae+be)%188,ae<g.byteLength&&!l&&(this.remainderData=new Uint8Array(g.buffer,ae,g.buffer.byteLength-ae));for(var pe=be;pe<ae;pe+=188)if(g[pe]===71){var ue=!!(g[pe+1]&64),se=((g[pe+1]&31)<<8)+g[pe+2],he=(g[pe+3]&48)>>4,ne=void 0;if(he>1){if(ne=pe+5+g[pe+4],ne===pe+188)continue}else ne=pe+4;switch(se){case D:ue&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(g.subarray(ne,pe+188)),U.size+=pe+188-ne);break;case N:ue&&(M&&(a=o(M))&&(y.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),M={data:[],size:0}),M&&(M.data.push(g.subarray(ne,pe+188)),M.size+=pe+188-ne);break;case W:ue&&(I&&(a=o(I))&&this.parseID3PES(a),I={data:[],size:0}),I&&(I.data.push(g.subarray(ne,pe+188)),I.size+=pe+188-ne);break;case 0:ue&&(ne+=g[ne]+1),te=this._pmtId=v(g,ne);break;case te:{ue&&(ne+=g[ne]+1);var me=d(g,ne,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);D=me.avc,D>0&&(T.pid=D),N=me.audio,N>0&&(y.pid=N,y.isAAC=me.isAAC),W=me.id3,W>0&&(h.pid=W),H&&!X&&(m.logger.log("reparse from beginning"),H=!1,pe=be-188),X=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});T.pesData=U,y.pesData=M,h.pesData=I;var Q={audioTrack:y,avcTrack:T,id3Track:h,textTrack:this._txtTrack};return l&&this.extractRemainingSamples(Q),Q},f.flush=function(){var g=this.remainderData;this.remainderData=null;var p;return g?p=this.demux(g,-1,!1,!0):p={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(p),this.sampleAes?this.decrypt(p,this.sampleAes):p},f.extractRemainingSamples=function(g){var p=g.audioTrack,c=g.avcTrack,l=g.id3Track,a=c.pesData,T=p.pesData,y=l.pesData,h;a&&(h=o(a))?(this.parseAVCPES(h,!0),c.pesData=null):c.pesData=a,T&&(h=o(T))?(p.isAAC?this.parseAACPES(h):this.parseMPEGPES(h),p.pesData=null):(T!=null&&T.size&&m.logger.log("last AAC PES packet truncated,might overlap between fragments"),p.pesData=T),y&&(h=o(y))?(this.parseID3PES(h),l.pesData=null):l.pesData=y},f.demuxSampleAes=function(g,p,c){var l=this.demux(g,c,!0,!this.config.progressive),a=this.sampleAes=new k.default(this.observer,this.config,p);return this.decrypt(l,a)},f.decrypt=function(g,p){return new Promise(function(c){var l=g.audioTrack,a=g.avcTrack;l.samples&&l.isAAC?p.decryptAacSamples(l.samples,0,function(){a.samples?p.decryptAvcSamples(a.samples,0,0,function(){c(g)}):c(g)}):a.samples&&p.decryptAvcSamples(a.samples,0,0,function(){c(g)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(g,p){var c=this,l=this._avcTrack,a=this.parseAVCNALu(g.data),T=!1,y=this.avcSample,h,D=!1;g.data=null,y&&a.length&&!l.audFound&&(u(y,l),y=this.avcSample=x(!1,g.pts,g.dts,"")),a.forEach(function(U){switch(U.type){case 1:{h=!0,y||(y=c.avcSample=x(!0,g.pts,g.dts,"")),T&&(y.debug+="NDR "),y.frame=!0;var N=U.data;if(D&&N.length>4){var W=new O.default(N).readSliceType();(W===2||W===4||W===7||W===9)&&(y.key=!0)}break}case 5:h=!0,y||(y=c.avcSample=x(!0,g.pts,g.dts,"")),T&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{h=!0,T&&y&&(y.debug+="SEI ");var M=new O.default(C(U.data));M.readUByte();for(var I=0,H=0,X=!1,te=0;!X&&M.bytesAvailable>1;){I=0;do te=M.readUByte(),I+=te;while(te===255);H=0;do te=M.readUByte(),H+=te;while(te===255);if(I===4&&M.bytesAvailable!==0){X=!0;var ae=M.readUByte();if(ae===181){var be=M.readUShort();if(be===49){var pe=M.readUInt();if(pe===1195456820){var ue=M.readUByte();if(ue===3){for(var se=M.readUByte(),he=M.readUByte(),ne=31&se,me=[se,he],Q=0;Q<ne;Q++)me.push(M.readUByte()),me.push(M.readUByte()),me.push(M.readUByte());s(c._txtTrack.samples,{type:3,pts:g.pts,bytes:me})}}}}}else if(I===5&&M.bytesAvailable!==0){if(X=!0,H>16){for(var ie=[],ee=0;ee<16;ee++)ie.push(M.readUByte().toString(16)),(ee===3||ee===5||ee===7||ee===9)&&ie.push("-");for(var Ee=H-16,_e=new Uint8Array(Ee),ve=0;ve<Ee;ve++)_e[ve]=M.readUByte();s(c._txtTrack.samples,{pts:g.pts,payloadType:I,uuid:ie.join(""),userData:Object(B.utf8ArrayToStr)(_e),userDataBytes:_e})}}else if(H<M.bytesAvailable)for(var ye=0;ye<H;ye++)M.readUByte()}break}case 7:if(h=!0,D=!0,T&&y&&(y.debug+="SPS "),!l.sps){var we=new O.default(U.data),Le=we.readSPS();l.width=Le.width,l.height=Le.height,l.pixelRatio=Le.pixelRatio,l.sps=[U.data],l.duration=c._duration;for(var Ie=U.data.subarray(1,4),Ae="avc1.",De=0;De<3;De++){var We=Ie[De].toString(16);We.length<2&&(We="0"+We),Ae+=We}l.codec=Ae}break;case 8:h=!0,T&&y&&(y.debug+="PPS "),l.pps||(l.pps=[U.data]);break;case 9:h=!1,l.audFound=!0,y&&u(y,l),y=c.avcSample=x(!1,g.pts,g.dts,T?"AUD ":"");break;case 12:h=!1;break;default:h=!1,y&&(y.debug+="unknown NAL "+U.type+" ");break}if(y&&h){var Ve=y.units;Ve.push(U)}}),p&&y&&(u(y,l),this.avcSample=null)},f.getLastNalUnit=function(){var g,p=this.avcSample,c;if(!p||p.units.length===0){var l=this._avcTrack.samples;p=l[l.length-1]}if((g=p)!==null&&g!==void 0&&g.units){var a=p.units;c=a[a.length-1]}return c},f.parseAVCNALu=function(g){var p=g.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,T=[],y=0,h,D,U,N=-1,W=0;for(l===-1&&(N=0,W=g[0]&31,l=0,y=1);y<p;){if(h=g[y++],!l){l=h?0:1;continue}if(l===1){l=h?0:2;continue}if(!h)l=3;else if(h===1){if(N>=0){var M={data:g.subarray(N,y-l-1),type:W};T.push(M)}else{var I=this.getLastNalUnit();if(I&&(a&&y<=4-a&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-a))),D=y-l-1,D>0)){var H=new Uint8Array(I.data.byteLength+D);H.set(I.data,0),H.set(g.subarray(0,D),I.data.byteLength),I.data=H,I.state=0}}y<p?(U=g[y]&31,N=y,W=U,l=0):l=-1}else l=0}if(N>=0&&l>=0){var X={data:g.subarray(N,p),type:W,state:l};T.push(X)}if(T.length===0){var te=this.getLastNalUnit();if(te){var ae=new Uint8Array(te.data.byteLength+g.byteLength);ae.set(te.data,0),ae.set(g,te.data.byteLength),te.data=ae}}return c.naluState=l,T},f.parseAACPES=function(g){var p=0,c=this._audioTrack,l=this.aacOverFlow,a=g.data;if(l){this.aacOverFlow=null;var T=l.sample.unit.byteLength,y=Math.min(l.missing,T),h=T-y;l.sample.unit.set(a.subarray(0,y),h),c.samples.push(l.sample),p=l.missing}var D,U;for(D=p,U=a.length;D<U-1&&!K.isHeader(a,D);D++);if(D!==p){var N,W;if(D<U-1?(N="AAC PES did not start with ADTS header,offset:"+D,W=!1):(N="no ADTS header found in AAC PES",W=!0),m.logger.warn("parsing error:"+N),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:N}),W)return}K.initTrackConfig(c,this.observer,a,D,this.audioCodec);var M;if(g.pts!==void 0)M=g.pts;else if(l){var I=K.getFrameDuration(c.samplerate);M=l.sample.pts+I}else{m.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;D<U;)if(K.isHeader(a,D)){if(D+5<U){var X=K.appendFrame(c,a,D,M,H);if(X)if(X.missing)this.aacOverFlow=X;else{D+=X.length,H++;continue}}break}else D++},f.parseMPEGPES=function(g){var p=g.data,c=p.length,l=0,a=0,T=g.pts;if(T===void 0){m.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(F.isHeader(p,a)){var y=F.appendFrame(this._audioTrack,p,a,T,l);if(y)a+=y.length,l++;else break}else a++},f.parseID3PES=function(g){if(g.pts===void 0){m.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(g)},E}();w.minProbeByteLength=188;function x(E,f,A,g){return{key:E,frame:!1,pts:f,dts:A,units:[],debug:g,length:0}}function v(E,f){return(E[f+10]&31)<<8|E[f+11]}function d(E,f,A,g){var p={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(E[f+1]&15)<<8|E[f+2],l=f+3+c-4,a=(E[f+10]&15)<<8|E[f+11];for(f+=12+a;f<l;){var T=(E[f+1]&31)<<8|E[f+2];switch(E[f]){case 207:if(!g){m.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:p.audio===-1&&(p.audio=T);break;case 21:p.id3===-1&&(p.id3=T);break;case 219:if(!g){m.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:p.avc===-1&&(p.avc=T);break;case 3:case 4:A?p.audio===-1&&(p.audio=T,p.isAAC=!1):m.logger.log("MPEG audio found, not supported in this browser");break;case 36:m.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((E[f+3]&15)<<8|E[f+4])+5}return p}function o(E){var f=0,A,g,p,c,l,a=E.data;if(!E||E.size===0)return null;for(;a[0].length<19&&a.length>1;){var T=new Uint8Array(a[0].length+a[1].length);T.set(a[0]),T.set(a[1],a[0].length),a[0]=T,a.splice(1,1)}A=a[0];var y=(A[0]<<16)+(A[1]<<8)+A[2];if(y===1){if(g=(A[4]<<8)+A[5],g&&g>E.size-6)return null;var h=A[7];h&192&&(c=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,h&64?(l=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,c-l>60*9e4&&(m.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),p=A[8];var D=p+9;if(E.size<=D)return null;E.size-=D;for(var U=new Uint8Array(E.size),N=0,W=a.length;N<W;N++){A=a[N];var M=A.byteLength;if(D)if(D>M){D-=M;continue}else A=A.subarray(D),M-=D,D=0;U.set(A,f),f+=M}return g&&(g-=p+3),{data:U,pts:c,dts:l,len:g}}return null}function u(E,f){if(E.units.length&&E.frame){if(E.pts===void 0){var A=f.samples,g=A.length;if(g){var p=A[g-1];E.pts=p.pts,E.dts=p.dts}else{f.dropped++;return}}f.samples.push(E)}E.debug.length&&m.logger.log(E.pts+"/"+E.dts+":"+E.debug)}function s(E,f){var A=E.length;if(A>0){if(f.pts>=E[A-1].pts)E.push(f);else for(var g=A-1;g>=0;g--)if(f.pts<E[g].pts){E.splice(g,0,f);break}}else E.push(f)}function C(E){for(var f=E.byteLength,A=[],g=1;g<f-2;)E[g]===0&&E[g+1]===0&&E[g+2]===3?(A.push(g+2),g+=2):g++;if(A.length===0)return E;var p=f-A.length,c=new Uint8Array(p),l=0;for(g=0;g<p;l++,g++)l===A[0]&&(l++,A.shift()),c[g]=E[l];return c}z.default=w},"./src/errors.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"ErrorTypes",function(){return K}),L.d(z,"ErrorDetails",function(){return F});var K;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(K||(K={}));var F;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(F||(F={}))},"./src/events.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"Events",function(){return K});var K;(function(F){F.MEDIA_ATTACHING="hlsMediaAttaching",F.MEDIA_ATTACHED="hlsMediaAttached",F.MEDIA_DETACHING="hlsMediaDetaching",F.MEDIA_DETACHED="hlsMediaDetached",F.BUFFER_RESET="hlsBufferReset",F.BUFFER_CODECS="hlsBufferCodecs",F.BUFFER_CREATED="hlsBufferCreated",F.BUFFER_APPENDING="hlsBufferAppending",F.BUFFER_APPENDED="hlsBufferAppended",F.BUFFER_EOS="hlsBufferEos",F.BUFFER_FLUSHING="hlsBufferFlushing",F.BUFFER_FLUSHED="hlsBufferFlushed",F.MANIFEST_LOADING="hlsManifestLoading",F.MANIFEST_LOADED="hlsManifestLoaded",F.MANIFEST_PARSED="hlsManifestParsed",F.LEVEL_SWITCHING="hlsLevelSwitching",F.LEVEL_SWITCHED="hlsLevelSwitched",F.LEVEL_LOADING="hlsLevelLoading",F.LEVEL_LOADED="hlsLevelLoaded",F.LEVEL_UPDATED="hlsLevelUpdated",F.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",F.LEVELS_UPDATED="hlsLevelsUpdated",F.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",F.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",F.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",F.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",F.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",F.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",F.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",F.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",F.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",F.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",F.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",F.CUES_PARSED="hlsCuesParsed",F.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",F.INIT_PTS_FOUND="hlsInitPtsFound",F.FRAG_LOADING="hlsFragLoading",F.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",F.FRAG_LOADED="hlsFragLoaded",F.FRAG_DECRYPTED="hlsFragDecrypted",F.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",F.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",F.FRAG_PARSING_METADATA="hlsFragParsingMetadata",F.FRAG_PARSED="hlsFragParsed",F.FRAG_BUFFERED="hlsFragBuffered",F.FRAG_CHANGED="hlsFragChanged",F.FPS_DROP="hlsFpsDrop",F.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",F.ERROR="hlsError",F.DESTROYING="hlsDestroying",F.KEY_LOADING="hlsKeyLoading",F.KEY_LOADED="hlsKeyLoaded",F.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",F.BACK_BUFFER_REACHED="hlsBackBufferReached"})(K||(K={}))},"./src/hls.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return E});var K=L("./node_modules/url-toolkit/src/url-toolkit.js"),F=L.n(K),O=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),k=L("./src/controller/id3-track-controller.ts"),R=L("./src/controller/latency-controller.ts"),S=L("./src/controller/level-controller.ts"),m=L("./src/controller/fragment-tracker.ts"),b=L("./src/controller/stream-controller.ts"),P=L("./src/is-supported.ts"),w=L("./src/utils/logger.ts"),x=L("./src/config.ts"),v=L("./node_modules/eventemitter3/index.js"),d=L.n(v),o=L("./src/events.ts"),u=L("./src/errors.ts");function s(f,A){for(var g=0;g<A.length;g++){var p=A[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(f,p.key,p)}}function C(f,A,g){return A&&s(f.prototype,A),g&&s(f,g),f}var E=function(){f.isSupported=function(){return Object(P.isSupported)()};function f(g){g===void 0&&(g={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new v.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 p=this.config=Object(x.mergeConfig)(f.DefaultConfig,g);this.userConfig=g,Object(w.enableLogs)(p.debug),this._autoLevelCapping=-1,p.progressive&&Object(x.enableStreamingMode)(p);var c=p.abrController,l=p.bufferController,a=p.capLevelController,T=p.fpsController,y=this.abrController=new c(this),h=this.bufferController=new l(this),D=this.capLevelController=new a(this),U=new T(this),N=new O.default(this),W=new B.default(this),M=new k.default(this),I=this.levelController=new S.default(this),H=new m.FragmentTracker(this),X=this.streamController=new b.default(this,H);D.setStreamController(X),U.setStreamController(X);var te=[I,X];this.networkControllers=te;var ae=[N,W,y,h,D,U,M,H];this.audioTrackController=this.createController(p.audioTrackController,null,te),this.createController(p.audioStreamController,H,te),this.subtitleTrackController=this.createController(p.subtitleTrackController,null,te),this.createController(p.subtitleStreamController,H,te),this.createController(p.timelineController,null,ae),this.emeController=this.createController(p.emeController,null,ae),this.cmcdController=this.createController(p.cmcdController,null,ae),this.latencyController=this.createController(R.default,null,ae),this.coreComponents=ae}var A=f.prototype;return A.createController=function(p,c,l){if(p){var a=c?new p(this,c):new p(this);return l&&l.push(a),a}return null},A.on=function(p,c,l){l===void 0&&(l=this),this._emitter.on(p,c,l)},A.once=function(p,c,l){l===void 0&&(l=this),this._emitter.once(p,c,l)},A.removeAllListeners=function(p){this._emitter.removeAllListeners(p)},A.off=function(p,c,l,a){l===void 0&&(l=this),this._emitter.off(p,c,l,a)},A.listeners=function(p){return this._emitter.listeners(p)},A.emit=function(p,c,l){return this._emitter.emit(p,c,l)},A.trigger=function(p,c){if(this.config.debug)return this.emit(p,p,c);try{return this.emit(p,p,c)}catch(l){w.logger.error("An internal error happened while handling event "+p+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:p,error:l})}return!1},A.listenerCount=function(p){return this._emitter.listenerCount(p)},A.destroy=function(){w.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(p){return p.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(p){return p.destroy()}),this.coreComponents.length=0},A.attachMedia=function(p){w.logger.log("attachMedia"),this._media=p,this.trigger(o.Events.MEDIA_ATTACHING,{media:p})},A.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(p){this.stopLoad();var c=this.media,l=this.url,a=this.url=K.buildAbsoluteURL(self.location.href,p,{alwaysNormalize:!0});w.logger.log("loadSource:"+a),c&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:p})},A.startLoad=function(p){p===void 0&&(p=-1),w.logger.log("startLoad("+p+")"),this.networkControllers.forEach(function(c){c.startLoad(p)})},A.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(p){p.stopLoad()})},A.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){w.logger.log("recoverMediaError");var p=this._media;this.detachMedia(),p&&this.attachMedia(p)},A.removeLevel=function(p,c){c===void 0&&(c=0),this.levelController.removeLevel(p,c)},C(f,[{key:"levels",get:function(){var p=this.levelController.levels;return p||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(p){w.logger.log("set currentLevel:"+p),this.loadLevel=p,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(p){w.logger.log("set nextLevel:"+p),this.levelController.manualLevel=p,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(p){w.logger.log("set loadLevel:"+p),this.levelController.manualLevel=p}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(p){this.levelController.nextLoadLevel=p}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(p){w.logger.log("set firstLevel:"+p),this.levelController.firstLevel=p}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(p){w.logger.log("set startLevel:"+p),p!==-1&&(p=Math.max(p,this.minAutoLevel)),this.levelController.startLevel=p}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(p){var c=!!p;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(p){this._autoLevelCapping!==p&&(w.logger.log("set autoLevelCapping:"+p),this._autoLevelCapping=p)}},{key:"bandwidthEstimate",get:function(){var p=this.abrController.bwEstimator;return p?p.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var p=this.levels,c=this.config.minAutoBitrate;if(!p)return 0;for(var l=p.length,a=0;a<l;a++)if(p[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var p=this.levels,c=this.autoLevelCapping,l;return c===-1&&p&&p.length?l=p.length-1:l=c,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(p){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,p)}},{key:"audioTracks",get:function(){var p=this.audioTrackController;return p?p.audioTracks:[]}},{key:"audioTrack",get:function(){var p=this.audioTrackController;return p?p.audioTrack:-1},set:function(p){var c=this.audioTrackController;c&&(c.audioTrack=p)}},{key:"subtitleTracks",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var p=this.subtitleTrackController;return p?p.subtitleTrack:-1},set:function(p){var c=this.subtitleTrackController;c&&(c.subtitleTrack=p)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var p=this.subtitleTrackController;return p?p.subtitleDisplay:!1},set:function(p){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=p)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(p){this.config.lowLatencyMode=p}},{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 o.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:x.hlsDefaultConfig},set:function(p){f.defaultConfig=p}}]),f}();E.defaultConfig=void 0},"./src/is-supported.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isSupported",function(){return O}),L.d(z,"changeTypeSupported",function(){return B});var K=L("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var k=Object(K.getMediaSource)();if(!k)return!1;var R=F(),S=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),m=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!S&&!!m}function B(){var k,R=F();return typeof(R==null||((k=R.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return w}),L.d(z,"LoadError",function(){return v});var K=L("./src/polyfills/number.ts"),F=L("./src/errors.ts");function O(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,m(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(s){if(s===null||!S(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(s))return o.get(s);o.set(s,C)}function C(){return k(s,arguments,b(this).constructor)}return C.prototype=Object.create(s.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),m(C,s)},B(d)}function k(d,o,u){return R()?k=Reflect.construct:k=function(C,E,f){var A=[null];A.push.apply(A,E);var g=Function.bind.apply(C,A),p=new g;return f&&m(p,f.prototype),p},k.apply(null,arguments)}function R(){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(d){return!1}}function S(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function m(d,o){return m=Object.setPrototypeOf||function(s,C){return s.__proto__=C,s},m(d,o)}function b(d){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},b(d)}var P=Math.pow(2,17),w=function(){function d(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(s,C){var E=this,f=s.url;if(!f)return Promise.reject(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var A=this.config,g=A.fLoader,p=A.loader;return new Promise(function(c,l){E.loader&&E.loader.destroy();var a=E.loader=s.loader=g?new g(A):new p(A),T=x(s),y={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:P};s.stats=a.stats,a.load(T,y,{onSuccess:function(D,U,N,W){E.resetLoader(s,a),c({frag:s,part:null,payload:D.data,networkDetails:W})},onError:function(D,U,N){E.resetLoader(s,a),l(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:D,networkDetails:N}))},onAbort:function(D,U,N){E.resetLoader(s,a),l(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:N}))},onTimeout:function(D,U,N){E.resetLoader(s,a),l(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:N}))},onProgress:function(D,U,N,W){C&&C({frag:s,part:null,payload:N,networkDetails:W})}})})},o.loadPart=function(s,C,E){var f=this;this.abort();var A=this.config,g=A.fLoader,p=A.loader;return new Promise(function(c,l){f.loader&&f.loader.destroy();var a=f.loader=s.loader=g?new g(A):new p(A),T=x(s,C),y={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:P};C.stats=a.stats,a.load(T,y,{onSuccess:function(D,U,N,W){f.resetLoader(s,a),f.updateStatsFromPart(s,C);var M={frag:s,part:C,payload:D.data,networkDetails:W};E(M),c(M)},onError:function(D,U,N){f.resetLoader(s,a),l(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:C,response:D,networkDetails:N}))},onAbort:function(D,U,N){s.stats.aborted=C.stats.aborted,f.resetLoader(s,a),l(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:C,networkDetails:N}))},onTimeout:function(D,U,N){f.resetLoader(s,a),l(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:C,networkDetails:N}))}})})},o.updateStatsFromPart=function(s,C){var E=s.stats,f=C.stats,A=f.total;if(E.loaded+=f.loaded,A){var g=Math.round(s.duration/C.duration),p=Math.min(Math.round(E.loaded/A),g),c=g-p,l=c*Math.round(E.loaded/p);E.total=E.loaded+l}else E.total=Math.max(E.loaded,E.total);var a=E.loading,T=f.loading;a.start?a.first+=T.first-T.start:(a.start=T.start,a.first=T.first),a.end=T.end},o.resetLoader=function(s,C){s.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},d}();function x(d,o){o===void 0&&(o=null);var u=o||d,s={frag:d,part:o,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},C=u.byteRangeStartOffset,E=u.byteRangeEndOffset;return Object(K.isFiniteNumber)(C)&&Object(K.isFiniteNumber)(E)&&(s.rangeStart=C,s.rangeEnd=E),s}var v=function(d){O(o,d);function o(u){for(var s,C=arguments.length,E=new Array(C>1?C-1:0),f=1;f<C;f++)E[f-1]=arguments[f];return s=d.call.apply(d,[this].concat(E))||this,s.data=void 0,s.data=u,s}return o}(B(Error))},"./src/loader/fragment.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"ElementaryStreamTypes",function(){return w}),L.d(z,"BaseSegment",function(){return x}),L.d(z,"Fragment",function(){return v}),L.d(z,"Part",function(){return d});var K=L("./src/polyfills/number.ts"),F=L("./node_modules/url-toolkit/src/url-toolkit.js"),O=L.n(F),B=L("./src/utils/logger.ts"),k=L("./src/loader/level-key.ts"),R=L("./src/loader/load-stats.ts");function S(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,m(o,u)}function m(o,u){return m=Object.setPrototypeOf||function(C,E){return C.__proto__=E,C},m(o,u)}function b(o,u){for(var s=0;s<u.length;s++){var C=u[s];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function P(o,u,s){return u&&b(o.prototype,u),s&&b(o,s),o}var w;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(w||(w={}));var x=function(){function o(s){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[w.AUDIO]=null,C[w.VIDEO]=null,C[w.AUDIOVIDEO]=null,C),this.baseurl=s}var u=o.prototype;return u.setByteRange=function(C,E){var f=C.split("@",2),A=[];f.length===1?A[0]=E?E.byteRangeEndOffset:0:A[0]=parseInt(f[1]),A[1]=parseInt(f[0])+A[0],this._byteRange=A},P(o,[{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(F.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),o}(),v=function(o){S(u,o);function u(C,E){var f;return f=o.call(this,E)||this,f._decryptdata=null,f.rawProgramDateTime=null,f.programDateTime=null,f.tagList=[],f.duration=0,f.sn=0,f.levelkey=void 0,f.type=void 0,f.loader=null,f.level=-1,f.cc=0,f.startPTS=void 0,f.endPTS=void 0,f.appendedPTS=void 0,f.startDTS=void 0,f.endDTS=void 0,f.start=0,f.deltaPTS=void 0,f.maxStartPTS=void 0,f.minEndPTS=void 0,f.stats=new R.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=C,f}var s=u.prototype;return s.createInitializationVector=function(E){for(var f=new Uint8Array(16),A=12;A<16;A++)f[A]=E>>8*(15-A)&255;return f},s.setDecryptDataFromLevelKey=function(E,f){var A=E;return(E==null?void 0:E.method)==="AES-128"&&E.uri&&!E.iv&&(A=k.LevelKey.fromURI(E.uri),A.method=E.method,A.iv=this.createInitializationVector(f),A.keyFormat="identity"),A},s.setElementaryStreamInfo=function(E,f,A,g,p,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[E];if(!a){l[E]={startPTS:f,endPTS:A,startDTS:g,endDTS:p,partial:c};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,A),a.startDTS=Math.min(a.startDTS,g),a.endDTS=Math.max(a.endDTS,p)},s.clearElementaryStreamInfo=function(){var E=this.elementaryStreams;E[w.AUDIO]=null,E[w.VIDEO]=null,E[w.AUDIOVIDEO]=null},P(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var E=this.sn;typeof E!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),E=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,E)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(K.isFiniteNumber)(this.programDateTime))return null;var E=Object(K.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+E*1e3}},{key:"encrypted",get:function(){var E;return!!((E=this.decryptdata)!==null&&E!==void 0&&E.keyFormat&&this.decryptdata.uri)}}]),u}(x),d=function(o){S(u,o);function u(s,C,E,f,A){var g;g=o.call(this,E)||this,g.fragOffset=0,g.duration=0,g.gap=!1,g.independent=!1,g.relurl=void 0,g.fragment=void 0,g.index=void 0,g.stats=new R.LoadStats,g.duration=s.decimalFloatingPoint("DURATION"),g.gap=s.bool("GAP"),g.independent=s.bool("INDEPENDENT"),g.relurl=s.enumeratedString("URI"),g.fragment=C,g.index=f;var p=s.enumeratedString("BYTERANGE");return p&&g.setByteRange(p,A),A&&(g.fragOffset=A.fragOffset+A.duration),g}return P(u,[{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)}}]),u}(x)},"./src/loader/key-loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return B});var K=L("./src/events.ts"),F=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),B=function(){function k(S){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=S,this._registerListeners()}var R=k.prototype;return R._registerListeners=function(){this.hls.on(K.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(K.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var m in this.loaders){var b=this.loaders[m];b&&b.destroy()}this.loaders={}},R.onKeyLoading=function(m,b){var P=b.frag,w=P.type,x=this.loaders[w];if(!P.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var v=P.decryptdata.uri;if(v!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(x&&(O.logger.warn("abort previous key loader for type:"+w),x.abort()),!v){O.logger.warn("key uri is falsy");return}var o=d.loader,u=P.loader=this.loaders[w]=new o(d);this.decrypturl=v,this.decryptkey=null;var s={url:v,frag:P,responseType:"arraybuffer"},C={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},E={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(s,C,E)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(K.Events.KEY_LOADED,{frag:P}))},R.loadsuccess=function(m,b,P){var w=P.frag;if(!w.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(m.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(K.Events.KEY_LOADED,{frag:w})},R.loaderror=function(m,b){var P=b.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:m})},R.loadtimeout=function(m,b){var P=b.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},k}()},"./src/loader/level-details.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"LevelDetails",function(){return k});var K=L("./src/polyfills/number.ts");function F(R,S){for(var m=0;m<S.length;m++){var b=S[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(R,b.key,b)}}function O(R,S,m){return S&&F(R.prototype,S),m&&F(R,m),R}var B=10,k=function(){function R(m){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=m}var S=R.prototype;return S.reloaded=function(b){if(!b){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-b.lastPartSn,w=this.lastPartIndex-b.lastPartIndex;this.updated=this.endSN!==b.endSN||!!w||!!P,this.advanced=this.endSN>b.endSN||P>0||P===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(b.misses*.6):this.misses=b.misses+1,this.availabilityDelay=b.availabilityDelay},O(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(K.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var b=this.driftEndTime-this.driftStartTime;if(b>0){var P=this.driftEnd-this.driftStart;return P*1e3/b}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var b;return(b=this.fragments)!==null&&b!==void 0&&b.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 b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"LevelKey",function(){return k});var K=L("./node_modules/url-toolkit/src/url-toolkit.js"),F=L.n(K);function O(R,S){for(var m=0;m<S.length;m++){var b=S[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(R,b.key,b)}}function B(R,S,m){return S&&O(R.prototype,S),m&&O(R,m),R}var k=function(){R.fromURL=function(m,b){return new R(m,b)},R.fromURI=function(m){return new R(m)};function R(S,m){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,m?this._uri=Object(K.buildAbsoluteURL)(S,m,{alwaysNormalize:!0}):this._uri=S}return B(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"LoadStats",function(){return K});var K=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(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return u});var K=L("./src/polyfills/number.ts"),F=L("./node_modules/url-toolkit/src/url-toolkit.js"),O=L.n(F),B=L("./src/loader/fragment.ts"),k=L("./src/loader/level-details.ts"),R=L("./src/loader/level-key.ts"),S=L("./src/utils/attr-list.ts"),m=L("./src/utils/logger.ts"),b=L("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,w=/#EXT-X-MEDIA:(.*)/g,x=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),v=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("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(A){var g,p;return d.test((g=(p=F.parseURL(A))===null||p===void 0?void 0:p.path)!=null?g:"")}var u=function(){function A(){}return A.findGroup=function(p,c){for(var l=0;l<p.length;l++){var a=p[l];if(a.id===c)return a}},A.convertAVC1ToAVCOTI=function(p){var c=p.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return p},A.resolve=function(p,c){return F.buildAbsoluteURL(c,p,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(p,c){var l=[],a={},T=!1;P.lastIndex=0;for(var y;(y=P.exec(p))!=null;)if(y[1]){var h=new S.AttrList(y[1]),D={attrs:h,bitrate:h.decimalInteger("AVERAGE-BANDWIDTH")||h.decimalInteger("BANDWIDTH"),name:h.NAME,url:A.resolve(y[2],c)},U=h.decimalResolution("RESOLUTION");U&&(D.width=U.width,D.height=U.height),s((h.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),D),D.videoCodec&&D.videoCodec.indexOf("avc1")!==-1&&(D.videoCodec=A.convertAVC1ToAVCOTI(D.videoCodec)),l.push(D)}else if(y[3]){var N=new S.AttrList(y[3]);N["DATA-ID"]&&(T=!0,a[N["DATA-ID"]]=N)}return{levels:l,sessionData:T?a:null}},A.parseMasterPlaylistMedia=function(p,c,l,a){a===void 0&&(a=[]);var T,y=[],h=0;for(w.lastIndex=0;(T=w.exec(p))!==null;){var D=new S.AttrList(T[1]);if(D.TYPE===l){var U={attrs:D,bitrate:0,id:h++,groupId:D["GROUP-ID"],instreamId:D["INSTREAM-ID"],name:D.NAME||D.LANGUAGE||"",type:l,default:D.bool("DEFAULT"),autoselect:D.bool("AUTOSELECT"),forced:D.bool("FORCED"),lang:D.LANGUAGE,url:D.URI?A.resolve(D.URI,c):""};if(a.length){var N=A.findGroup(a,U.groupId)||a[0];C(U,N,"audioCodec"),C(U,N,"textCodec")}y.push(U)}}return y},A.parseLevelPlaylist=function(p,c,l,a,T){var y=new k.LevelDetails(c),h=y.fragments,D=null,U=0,N=0,W=0,M=0,I=null,H=new B.Fragment(a,c),X,te,ae,be=-1,pe=!1;for(x.lastIndex=0,y.m3u8=p;(X=x.exec(p))!==null;){pe&&(pe=!1,H=new B.Fragment(a,c),H.start=W,H.sn=U,H.cc=M,H.level=l,D&&(H.initSegment=D,H.rawProgramDateTime=D.rawProgramDateTime));var ue=X[1];if(ue){H.duration=parseFloat(ue);var se=(" "+X[2]).slice(1);H.title=se||null,H.tagList.push(se?["INF",ue,se]:["INF",ue])}else if(X[3])Object(K.isFiniteNumber)(H.duration)&&(H.start=W,ae&&(H.levelkey=ae),H.sn=U,H.level=l,H.cc=M,H.urlId=T,h.push(H),H.relurl=(" "+X[3]).slice(1),f(H,I),I=H,W+=H.duration,U++,N=0,pe=!0);else if(X[4]){var he=(" "+X[4]).slice(1);I?H.setByteRange(he,I):H.setByteRange(he)}else if(X[5])H.rawProgramDateTime=(" "+X[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),be===-1&&(be=h.length);else{if(X=X[0].match(v),!X){m.logger.warn("No matches on slow regex match for level playlist!");continue}for(te=1;te<X.length&&!(typeof X[te]!="undefined");te++);var ne=(" "+X[te]).slice(1),me=(" "+X[te+1]).slice(1),Q=X[te+2]?(" "+X[te+2]).slice(1):"";switch(ne){case"PLAYLIST-TYPE":y.type=me.toUpperCase();break;case"MEDIA-SEQUENCE":U=y.startSN=parseInt(me);break;case"SKIP":{var ie=new S.AttrList(me),ee=ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(K.isFiniteNumber)(ee)){y.skippedSegments=ee;for(var Ee=ee;Ee--;)h.unshift(null);U+=ee}var _e=ie.enumeratedString("RECENTLY-REMOVED-DATERANGES");_e&&(y.recentlyRemovedDateranges=_e.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(me);break;case"VERSION":y.version=parseInt(me);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(me||Q)&&H.tagList.push(Q?[me,Q]:[me]);break;case"DIS":M++;case"GAP":H.tagList.push([ne]);break;case"BITRATE":H.tagList.push([ne,me]);break;case"DISCONTINUITY-SEQ":M=parseInt(me);break;case"KEY":{var ve,ye=new S.AttrList(me),we=ye.enumeratedString("METHOD"),Le=ye.URI,Ie=ye.hexadecimalInteger("IV"),Ae=ye.enumeratedString("KEYFORMATVERSIONS"),De=ye.enumeratedString("KEYID"),We=(ve=ye.enumeratedString("KEYFORMAT"))!=null?ve:"identity",Ve=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ve.indexOf(We)>-1){m.logger.warn("Keyformat "+We+" is not supported from the manifest");continue}else if(We!=="identity")continue;we&&(ae=R.LevelKey.fromURL(c,Le),Le&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(we)>=0&&(ae.method=we,ae.keyFormat=We,De&&(ae.keyID=De),Ae&&(ae.keyFormatVersions=Ae),ae.iv=Ie));break}case"START":{var je=new S.AttrList(me),Ne=je.decimalFloatingPoint("TIME-OFFSET");Object(K.isFiniteNumber)(Ne)&&(y.startTimeOffset=Ne);break}case"MAP":{var Je=new S.AttrList(me);H.relurl=Je.URI,Je.BYTERANGE&&H.setByteRange(Je.BYTERANGE),H.level=l,H.sn="initSegment",ae&&(H.levelkey=ae),H.initSegment=null,D=H,pe=!0;break}case"SERVER-CONTROL":{var Xe=new S.AttrList(me);y.canBlockReload=Xe.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Xe.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Xe.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Xe.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Xe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ze=new S.AttrList(me);y.partTarget=Ze.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ce=y.partList;Ce||(Ce=y.partList=[]);var et=N>0?Ce[Ce.length-1]:void 0,Ye=N++,Oe=new B.Part(new S.AttrList(me),H,c,Ye,et);Ce.push(Oe),H.duration+=Oe.duration;break}case"PRELOAD-HINT":{var Ue=new S.AttrList(me);y.preloadHint=Ue;break}case"RENDITION-REPORT":{var ge=new S.AttrList(me);y.renditionReports=y.renditionReports||[],y.renditionReports.push(ge);break}default:m.logger.warn("line parsed but not handled: "+X);break}}}I&&!I.relurl?(h.pop(),W-=I.duration,y.partList&&(y.fragmentHint=I)):y.partList&&(f(H,I),H.cc=M,y.fragmentHint=H);var ce=h.length,fe=h[0],Y=h[ce-1];if(W+=y.skippedSegments*y.targetduration,W>0&&ce&&Y){y.averagetargetduration=W/ce;var Z=Y.sn;y.endSN=Z!=="initSegment"?Z:0,fe&&(y.startCC=fe.cc,fe.initSegment||y.fragments.every(function(re){return re.relurl&&o(re.relurl)})&&(m.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new B.Fragment(a,c),H.relurl=Y.relurl,H.level=l,H.sn="initSegment",fe.initSegment=H,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(W+=y.fragmentHint.duration),y.totalduration=W,y.endCC=M,be>0&&E(h,be),y},A}();function s(A,g){["video","audio","text"].forEach(function(p){var c=A.filter(function(a){return Object(b.isCodecType)(a,p)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});g[p+"Codec"]=l.length>0?l[0]:c[0],A=A.filter(function(a){return c.indexOf(a)===-1})}}),g.unknownCodecs=A}function C(A,g,p){var c=g[p];c&&(A[p]=c)}function E(A,g){for(var p=A[g],c=g;c--;){var l=A[c];if(!l)return;l.programDateTime=p.programDateTime-l.duration*1e3,p=l}}function f(A,g){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):g!=null&&g.programDateTime&&(A.programDateTime=g.endProgramDateTime),Object(K.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),F=L("./src/events.ts"),O=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),k=L("./src/utils/mp4-tools.ts"),R=L("./src/loader/m3u8-parser.ts"),S=L("./src/types/loader.ts"),m=L("./src/utils/attr-list.ts");function b(x){var v=x.type;switch(v){case S.PlaylistContextType.AUDIO_TRACK:return S.PlaylistLevelType.AUDIO;case S.PlaylistContextType.SUBTITLE_TRACK:return S.PlaylistLevelType.SUBTITLE;default:return S.PlaylistLevelType.MAIN}}function P(x,v){var d=x.url;return(d===void 0||d.indexOf("data:")===0)&&(d=v.url),d}var w=function(){function x(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var v=x.prototype;return v.registerListeners=function(){var o=this.hls;o.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.unregisterListeners=function(){var o=this.hls;o.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.createInternalLoader=function(o){var u=this.hls.config,s=u.pLoader,C=u.loader,E=s||C,f=new E(u);return o.loader=f,this.loaders[o.type]=f,f},v.getInternalLoader=function(o){return this.loaders[o.type]},v.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},v.destroyInternalLoaders=function(){for(var o in this.loaders){var u=this.loaders[o];u&&u.destroy(),this.resetInternalLoader(o)}},v.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},v.onManifestLoading=function(o,u){var s=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:S.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},v.onLevelLoading=function(o,u){var s=u.id,C=u.level,E=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:null,level:C,responseType:"text",type:S.PlaylistContextType.LEVEL,url:E,deliveryDirectives:f})},v.onAudioTrackLoading=function(o,u){var s=u.id,C=u.groupId,E=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:C,level:null,responseType:"text",type:S.PlaylistContextType.AUDIO_TRACK,url:E,deliveryDirectives:f})},v.onSubtitleTrackLoading=function(o,u){var s=u.id,C=u.groupId,E=u.url,f=u.deliveryDirectives;this.load({id:s,groupId:C,level:null,responseType:"text",type:S.PlaylistContextType.SUBTITLE_TRACK,url:E,deliveryDirectives:f})},v.load=function(o){var u,s=this.hls.config,C=this.getInternalLoader(o);if(C){var E=C.context;if(E&&E.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),C.abort()}var f,A,g,p;switch(o.type){case S.PlaylistContextType.MANIFEST:f=s.manifestLoadingMaxRetry,A=s.manifestLoadingTimeOut,g=s.manifestLoadingRetryDelay,p=s.manifestLoadingMaxRetryTimeout;break;case S.PlaylistContextType.LEVEL:case S.PlaylistContextType.AUDIO_TRACK:case S.PlaylistContextType.SUBTITLE_TRACK:f=0,A=s.levelLoadingTimeOut;break;default:f=s.levelLoadingMaxRetry,A=s.levelLoadingTimeOut,g=s.levelLoadingRetryDelay,p=s.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(o),(u=o.deliveryDirectives)!==null&&u!==void 0&&u.part){var c;if(o.type===S.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===S.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===S.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(A=Math.min(Math.max(l*3,a*.8)*1e3,A))}}var T={timeout:A,maxRetry:f,retryDelay:g,maxRetryDelay:p,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(o,T,y)},v.loadsuccess=function(o,u,s,C){if(C===void 0&&(C=null),s.isSidxRequest){this.handleSidxRequest(o,s),this.handlePlaylistLoaded(o,u,s,C);return}this.resetInternalLoader(s.type);var E=o.data;if(E.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,s,"no EXTM3U delimiter",C);return}u.parsing.start=performance.now(),E.indexOf("#EXTINF:")>0||E.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,u,s,C):this.handleMasterPlaylist(o,u,s,C)},v.loaderror=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!1,o)},v.loadtimeout=function(o,u,s){s===void 0&&(s=null),this.handleNetworkError(u,s,!0)},v.handleMasterPlaylist=function(o,u,s,C){var E=this.hls,f=o.data,A=P(o,s),g=R.default.parseMasterPlaylist(f,A),p=g.levels,c=g.sessionData;if(!p.length){this.handleManifestParsingError(o,s,"no level found in manifest",C);return}var l=p.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=p.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),T=R.default.parseMasterPlaylistMedia(f,A,"AUDIO",l),y=R.default.parseMasterPlaylistMedia(f,A,"SUBTITLES",a),h=R.default.parseMasterPlaylistMedia(f,A,"CLOSED-CAPTIONS");if(T.length){var D=T.some(function(U){return!U.url});!D&&p[0].audioCodec&&!p[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),T.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new m.AttrList({}),bitrate:0,url:""}))}E.trigger(F.Events.MANIFEST_LOADED,{levels:p,audioTracks:T,subtitles:y,captions:h,url:A,stats:u,networkDetails:C,sessionData:c})},v.handleTrackOrLevelPlaylist=function(o,u,s,C){var E=this.hls,f=s.id,A=s.level,g=s.type,p=P(o,s),c=Object(K.isFiniteNumber)(f)?f:0,l=Object(K.isFiniteNumber)(A)?A:c,a=b(s),T=R.default.parseLevelPlaylist(o.data,p,l,a,c);if(!T.fragments.length){E.trigger(F.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:p,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(g===S.PlaylistContextType.MANIFEST){var y={attrs:new m.AttrList({}),bitrate:0,details:T,name:"",url:p};E.trigger(F.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:p,stats:u,networkDetails:C,sessionData:null})}if(u.parsing.end=performance.now(),T.needSidxRanges){var h,D=(h=T.fragments[0].initSegment)===null||h===void 0?void 0:h.url;this.load({url:D,isSidxRequest:!0,type:g,level:A,levelDetails:T,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=T,this.handlePlaylistLoaded(o,u,s,C)},v.handleSidxRequest=function(o,u){var s=Object(k.parseSegmentIndex)(new Uint8Array(o.data));if(!s)return;var C=s.references,E=u.levelDetails;C.forEach(function(f,A){var g=f.info,p=E.fragments[A];p.byteRange.length===0&&p.setByteRange(String(1+g.end-g.start)+"@"+String(g.start)),p.initSegment&&p.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},v.handleManifestParsingError=function(o,u,s,C){this.hls.trigger(F.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===S.PlaylistContextType.MANIFEST,url:o.url,reason:s,response:o,context:u,networkDetails:C})},v.handleNetworkError=function(o,u,s,C){s===void 0&&(s=!1),B.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var E=O.ErrorDetails.UNKNOWN,f=!1,A=this.getInternalLoader(o);switch(o.type){case S.PlaylistContextType.MANIFEST:E=s?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case S.PlaylistContextType.LEVEL:E=s?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case S.PlaylistContextType.AUDIO_TRACK:E=s?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case S.PlaylistContextType.SUBTITLE_TRACK:E=s?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}A&&this.resetInternalLoader(o.type);var g={type:O.ErrorTypes.NETWORK_ERROR,details:E,fatal:f,url:o.url,loader:A,context:o,networkDetails:u};C&&(g.response=C),this.hls.trigger(F.Events.ERROR,g)},v.handlePlaylistLoaded=function(o,u,s,C){var E=s.type,f=s.level,A=s.id,g=s.groupId,p=s.loader,c=s.levelDetails,l=s.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,s,"invalid target duration",C);return}if(!p)return;c.live&&(p.getCacheAge&&(c.ageHeader=p.getCacheAge()||0),(!p.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(E){case S.PlaylistContextType.MANIFEST:case S.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:c,level:f||0,id:A||0,stats:u,networkDetails:C,deliveryDirectives:l});break;case S.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:c,id:A||0,groupId:g||"",stats:u,networkDetails:C,deliveryDirectives:l});break;case S.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:c,id:A||0,groupId:g||"",stats:u,networkDetails:C,deliveryDirectives:l});break}},x}();z.default=w},"./src/polyfills/number.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isFiniteNumber",function(){return K}),L.d(z,"MAX_SAFE_INTEGER",function(){return F});var K=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(q,z,L){"use strict";L.r(z);var K=function(){function F(){}return F.getSilentFrame=function(B,k){switch(B){case"mp4a.40.2":if(k===1)return new Uint8Array([0,200,0,128,35,128]);if(k===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(k===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(k===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(k===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(k===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(k===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(k===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(k===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},F}();z.default=K},"./src/remux/mp4-generator.ts":function(q,z,L){"use strict";L.r(z);var K=Math.pow(2,32)-1,F=function(){function O(){}return O.init=function(){O.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 k;for(k in O.types)O.types.hasOwnProperty(k)&&(O.types[k]=[k.charCodeAt(0),k.charCodeAt(1),k.charCodeAt(2),k.charCodeAt(3)]);var R=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]),S=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]);O.HDLR_TYPES={video:R,audio:S};var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),b=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=b,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),x=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,P,x,P,w),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,m))},O.box=function(k){for(var R=8,S=arguments.length,m=new Array(S>1?S-1:0),b=1;b<S;b++)m[b-1]=arguments[b];for(var P=m.length,w=P;P--;)R+=m[P].byteLength;var x=new Uint8Array(R);for(x[0]=R>>24&255,x[1]=R>>16&255,x[2]=R>>8&255,x[3]=R&255,x.set(k,4),P=0,R=8;P<w;P++)x.set(m[P],R),R+=m[P].byteLength;return x},O.hdlr=function(k){return O.box(O.types.hdlr,O.HDLR_TYPES[k])},O.mdat=function(k){return O.box(O.types.mdat,k)},O.mdhd=function(k,R){R*=k;var S=Math.floor(R/(K+1)),m=Math.floor(R%(K+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,S>>24,S>>16&255,S>>8&255,S&255,m>>24,m>>16&255,m>>8&255,m&255,85,196,0,0]))},O.mdia=function(k){return O.box(O.types.mdia,O.mdhd(k.timescale,k.duration),O.hdlr(k.type),O.minf(k))},O.mfhd=function(k){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255]))},O.minf=function(k){return k.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(k)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(k))},O.moof=function(k,R,S){return O.box(O.types.moof,O.mfhd(k),O.traf(S,R))},O.moov=function(k){for(var R=k.length,S=[];R--;)S[R]=O.trak(k[R]);return O.box.apply(null,[O.types.moov,O.mvhd(k[0].timescale,k[0].duration)].concat(S).concat(O.mvex(k)))},O.mvex=function(k){for(var R=k.length,S=[];R--;)S[R]=O.trex(k[R]);return O.box.apply(null,[O.types.mvex].concat(S))},O.mvhd=function(k,R){R*=k;var S=Math.floor(R/(K+1)),m=Math.floor(R%(K+1)),b=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,S>>24,S>>16&255,S>>8&255,S&255,m>>24,m>>16&255,m>>8&255,m&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 O.box(O.types.mvhd,b)},O.sdtp=function(k){var R=k.samples||[],S=new Uint8Array(4+R.length),m,b;for(m=0;m<R.length;m++)b=R[m].flags,S[m+4]=b.dependsOn<<4|b.isDependedOn<<2|b.hasRedundancy;return O.box(O.types.sdtp,S)},O.stbl=function(k){return O.box(O.types.stbl,O.stsd(k),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(k){var R=[],S=[],m,b,P;for(m=0;m<k.sps.length;m++)b=k.sps[m],P=b.byteLength,R.push(P>>>8&255),R.push(P&255),R=R.concat(Array.prototype.slice.call(b));for(m=0;m<k.pps.length;m++)b=k.pps[m],P=b.byteLength,S.push(P>>>8&255),S.push(P&255),S=S.concat(Array.prototype.slice.call(b));var w=O.box(O.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|k.sps.length].concat(R).concat([k.pps.length]).concat(S))),x=k.width,v=k.height,d=k.pixelRatio[0],o=k.pixelRatio[1];return O.box(O.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,x>>8&255,x&255,v>>8&255,v&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]),w,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},O.esds=function(k){var R=k.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(k.config).concat([6,1,2]))},O.mp4a=function(k){var R=k.samplerate;return O.box(O.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]),O.box(O.types.esds,O.esds(k)))},O.mp3=function(k){var R=k.samplerate;return O.box(O.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]))},O.stsd=function(k){return k.type==="audio"?!k.isAAC&&k.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(k)):O.box(O.types.stsd,O.STSD,O.mp4a(k)):O.box(O.types.stsd,O.STSD,O.avc1(k))},O.tkhd=function(k){var R=k.id,S=k.duration*k.timescale,m=k.width,b=k.height,P=Math.floor(S/(K+1)),w=Math.floor(S%(K+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,w>>24,w>>16&255,w>>8&255,w&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,m>>8&255,m&255,0,0,b>>8&255,b&255,0,0]))},O.traf=function(k,R){var S=O.sdtp(k),m=k.id,b=Math.floor(R/(K+1)),P=Math.floor(R%(K+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,m>>24,m>>16&255,m>>8&255,m&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,P>>24,P>>16&255,P>>8&255,P&255])),O.trun(k,S.length+16+20+8+16+8+8),S)},O.trak=function(k){return k.duration=k.duration||4294967295,O.box(O.types.trak,O.tkhd(k),O.mdia(k))},O.trex=function(k){var R=k.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(k,R){var S=k.samples||[],m=S.length,b=12+16*m,P=new Uint8Array(b),w,x,v,d,o,u;for(R+=8+b,P.set([0,0,15,1,m>>>24&255,m>>>16&255,m>>>8&255,m&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),w=0;w<m;w++)x=S[w],v=x.duration,d=x.size,o=x.flags,u=x.cts,P.set([v>>>24&255,v>>>16&255,v>>>8&255,v&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*w);return O.box(O.types.trun,P)},O.initSegment=function(k){O.types||O.init();var R=O.moov(k),S=new Uint8Array(O.FTYP.byteLength+R.byteLength);return S.set(O.FTYP),S.set(R,O.FTYP.byteLength),S},O}();F.types=void 0,F.HDLR_TYPES=void 0,F.STTS=void 0,F.STSC=void 0,F.STCO=void 0,F.STSZ=void 0,F.VMHD=void 0,F.SMHD=void 0,F.STSD=void 0,F.FTYP=void 0,F.DINF=void 0,z.default=F},"./src/remux/mp4-remuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return u}),L.d(z,"normalizePts",function(){return s});var K=L("./src/polyfills/number.ts"),F=L("./src/remux/aac-helper.ts"),O=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),k=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),S=L("./src/types/loader.ts"),m=L("./src/utils/timescale-conversion.ts");function b(){return b=Object.assign||function(A){for(var g=1;g<arguments.length;g++){var p=arguments[g];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(A[c]=p[c])}return A},b.apply(this,arguments)}var P=10*1e3,w=1024,x=1152,v=null,d=null,o=!1,u=function(){function A(p,c,l,a){if(a===void 0&&(a=""),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=p,this.config=c,this.typeSupported=l,this.ISGenerated=!1,v===null){var T=navigator.userAgent||"",y=T.match(/Chrome\/(\d+)/i);v=y?parseInt(y[1]):0}if(d===null){var h=navigator.userAgent.match(/Safari\/(\d+)/i);d=h?parseInt(h[1]):0}o=!!v&&v<75||!!d&&d<600}var g=A.prototype;return g.destroy=function(){},g.resetTimeStamp=function(c){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},g.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},g.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},g.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(T,y){var h=y.pts-T;return h<-4294967296?(l=!0,s(T,y.pts)):h>0?T:y.pts},c[0].pts);return l&&R.logger.debug("PTS rollover detected"),a},g.remux=function(c,l,a,T,y,h,D,U){var N,W,M,I,H,X,te=y,ae=y,be=c.pid>-1,pe=l.pid>-1,ue=l.samples.length,se=c.samples.length>0,he=ue>1,ne=(!be||se)&&(!pe||he)||this.ISGenerated||D;if(ne){this.ISGenerated||(M=this.generateIS(c,l,y));var me=this.isVideoContiguous,Q=-1;if(he&&(Q=C(l.samples),!me&&this.config.forceKeyFrameOnDiscontinuity))if(X=!0,Q>0){R.logger.warn("[mp4-remuxer]: Dropped "+Q+" out of "+ue+" video samples due to a missing keyframe");var ie=this.getVideoStartPts(l.samples);l.samples=l.samples.slice(Q),l.dropped+=Q,ae+=(l.samples[0].pts-ie)/(l.timescale||9e4)}else Q===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+ue+" video samples"),X=!1);if(this.ISGenerated){if(se&&he){var ee=this.getVideoStartPts(l.samples),Ee=s(c.samples[0].pts,ee)-ee,_e=Ee/l.inputTimeScale;te+=Math.max(0,_e),ae+=Math.max(0,-_e)}if(se){if(c.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(c,l,y)),W=this.remuxAudio(c,te,this.isAudioContiguous,h,pe||he||U===S.PlaylistLevelType.AUDIO?ae:void 0),he){var ve=W?W.endPTS-W.startPTS:0;l.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(c,l,y)),N=this.remuxVideo(l,ae,me,ve)}}else he&&(N=this.remuxVideo(l,ae,me,0));N&&(N.firstKeyFrame=Q,N.independent=Q!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,y)),T.samples.length&&(I=this.remuxText(T,y))),{audio:W,video:N,initSegment:M,independent:X,text:I,id3:H}},g.generateIS=function(c,l,a){var T=c.samples,y=l.samples,h=this.typeSupported,D={},U=!Object(K.isFiniteNumber)(this._initPTS),N="audio/mp4",W,M,I;if(U&&(W=M=Infinity),c.config&&T.length&&(c.timescale=c.samplerate,c.isAAC||(h.mpeg?(N="audio/mpeg",c.codec=""):h.mp3&&(c.codec="mp3")),D.audio={id:"audio",container:N,codec:c.codec,initSegment:!c.isAAC&&h.mpeg?new Uint8Array(0):O.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(I=c.inputTimeScale,W=M=T[0].pts-Math.round(I*a))),l.sps&&l.pps&&y.length&&(l.timescale=l.inputTimeScale,D.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:O.default.initSegment([l]),metadata:{width:l.width,height:l.height}},U)){I=l.inputTimeScale;var H=this.getVideoStartPts(y),X=Math.round(I*a);M=Math.min(M,s(y[0].dts,H)-X),W=Math.min(W,H-X)}if(Object.keys(D).length)return this.ISGenerated=!0,U&&(this._initPTS=W,this._initDTS=M),{tracks:D,initPTS:W,timescale:I}},g.remuxVideo=function(c,l,a,T){var y=c.inputTimeScale,h=c.samples,D=[],U=h.length,N=this._initPTS,W=this.nextAvcDts,M=8,I,H,X,te=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,be=0,pe=!1;if(!a||W===null){var ue=l*y,se=h[0].pts-s(h[0].dts,h[0].pts);W=ue-se}for(var he=0;he<U;he++){var ne=h[he];if(ne.pts=s(ne.pts-N,W),ne.dts=s(ne.dts-N,W),ne.dts>ne.pts){var me=9e4*.2;be=Math.max(Math.min(be,ne.pts-ne.dts),-1*me)}ne.dts<h[he>0?he-1:he].dts&&(pe=!0)}pe&&h.sort(function(ct,at){var rt=ct.dts-at.dts,xt=ct.pts-at.pts;return rt||xt}),H=h[0].dts,X=h[h.length-1].dts;var Q=Math.round((X-H)/(U-1));if(be<0){if(be<Q*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(m.toMsFromMpegTsClock)(-Q,!0)+" ms");for(var ie=be,ee=0;ee<U;ee++)h[ee].dts=ie=Math.max(ie,h[ee].pts-Q),h[ee].pts=Math.max(ie,h[ee].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(m.toMsFromMpegTsClock)(be,!0)+" ms to overcome this issue");for(var Ee=0;Ee<U;Ee++)h[Ee].dts=h[Ee].dts+be}H=h[0].dts}if(a){var _e=H-W,ve=_e>Q,ye=_e<-1;if(ve||ye){ve?R.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(_e,!0)+" ms ("+_e+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(-_e,!0)+" ms ("+_e+"dts) overlapping between fragments detected"),H=W;var we=h[0].pts-_e;h[0].dts=H,h[0].pts=we,R.logger.log("Video: First PTS/DTS adjusted: "+Object(m.toMsFromMpegTsClock)(we,!0)+"/"+Object(m.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(m.toMsFromMpegTsClock)(_e,!0)+" ms")}}o&&(H=Math.max(0,H));for(var Le=0,Ie=0,Ae=0;Ae<U;Ae++){for(var De=h[Ae],We=De.units,Ve=We.length,je=0,Ne=0;Ne<Ve;Ne++)je+=We[Ne].data.length;Ie+=je,Le+=Ve,De.length=je,De.dts=Math.max(De.dts,H),De.pts=Math.max(De.pts,De.dts,0),te=Math.min(De.pts,te),ae=Math.max(De.pts,ae)}X=h[U-1].dts;var Je=Ie+4*Le+8,Xe;try{Xe=new Uint8Array(Je)}catch(ct){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Je,reason:"fail allocating video mdat "+Je});return}var Ze=new DataView(Xe.buffer);Ze.setUint32(0,Je),Xe.set(O.default.types.mdat,4);for(var Ce=0;Ce<U;Ce++){for(var et=h[Ce],Ye=et.units,Oe=0,Ue=0,ge=Ye.length;Ue<ge;Ue++){var ce=Ye[Ue],fe=ce.data,Y=ce.data.byteLength;Ze.setUint32(M,Y),M+=4,Xe.set(fe,M),M+=Y,Oe+=4+Y}if(Ce<U-1)I=h[Ce+1].dts-et.dts;else{var Z=this.config,re=et.dts-h[Ce>0?Ce-1:Ce].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(Z.maxBufferHole*y),Te=(T?te+T*y:this.nextAudioPts)-et.pts;Te>le?(I=Te-re,I<0&&(I=re),R.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=re}else I=re}var Re=Math.round(et.pts-et.dts);D.push(new E(et.key,I,Oe,Re))}if(D.length&&v&&v<70){var Me=D[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=X+I,this.isVideoContiguous=!0;var Ge=O.default.moof(c.sequenceNumber++,H,b({},c,{samples:D})),it="video",Pe={data1:Ge,data2:Xe,startPTS:te/y,endPTS:(ae+I)/y,startDTS:H/y,endDTS:W/y,type:it,hasAudio:!1,hasVideo:!0,nb:D.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Xe.length,"MDAT length must not be zero"),Pe},g.remuxAudio=function(c,l,a,T,y){var h=c.inputTimeScale,D=c.samplerate?c.samplerate:h,U=h/D,N=c.isAAC?w:x,W=N*U,M=this._initPTS,I=!c.isAAC&&this.typeSupported.mpeg,H=[],X=c.samples,te=I?0:8,ae=this.nextAudioPts||-1,be=l*h;if(this.isAudioContiguous=a=a||X.length&&ae>0&&(T&&Math.abs(be-ae)<9e3||Math.abs(s(X[0].pts-M,be)-ae)<20*W),X.forEach(function(fe){fe.pts=s(fe.pts-M,be)}),!a||ae<0){if(X=X.filter(function(fe){return fe.pts>=0}),!X.length)return;y===0?ae=0:T?ae=Math.max(0,be):ae=X[0].pts}if(c.isAAC)for(var pe=y!==void 0,ue=this.config.maxAudioFramesDrift,se=0,he=ae;se<X.length;se++){var ne=X[se],me=ne.pts,Q=me-he,ie=Math.abs(1e3*Q/h);if(Q<=-ue*W&&pe)se===0&&(R.logger.warn("Audio frame @ "+(me/h).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Q/h)+" ms."),this.nextAudioPts=ae=he=me);else if(Q>=ue*W&&ie<P&&pe){var ee=Math.round(Q/W);he=me-ee*W,he<0&&(ee--,he+=W),se===0&&(this.nextAudioPts=ae=he),R.logger.warn("[mp4-remuxer]: Injecting "+ee+" audio frame @ "+(he/h).toFixed(3)+"s due to "+Math.round(1e3*Q/h)+" ms gap.");for(var Ee=0;Ee<ee;Ee++){var _e=Math.max(he,0),ve=F.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ve||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ve=ne.unit.subarray()),X.splice(se,0,{unit:ve,pts:_e}),he+=W,se++}}ne.pts=he,he+=W}for(var ye=null,we=null,Le,Ie=0,Ae=X.length;Ae--;)Ie+=X[Ae].unit.byteLength;for(var De=0,We=X.length;De<We;De++){var Ve=X[De],je=Ve.unit,Ne=Ve.pts;if(we!==null){var Je=H[De-1];Je.duration=Math.round((Ne-we)/U)}else if(a&&c.isAAC&&(Ne=ae),ye=Ne,Ie>0){Ie+=te;try{Le=new Uint8Array(Ie)}catch(fe){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating audio mdat "+Ie});return}if(!I){var Xe=new DataView(Le.buffer);Xe.setUint32(0,Ie),Le.set(O.default.types.mdat,4)}}else return;Le.set(je,te);var Ze=je.byteLength;te+=Ze,H.push(new E(!0,N,Ze,0)),we=Ne}var Ce=H.length;if(!Ce)return;var et=H[H.length-1];this.nextAudioPts=ae=we+U*et.duration;var Ye=I?new Uint8Array(0):O.default.moof(c.sequenceNumber++,ye/U,b({},c,{samples:H}));c.samples=[];var Oe=ye/h,Ue=ae/h,ge="audio",ce={data1:Ye,data2:Le,startPTS:Oe,endPTS:Ue,startDTS:Oe,endDTS:Ue,type:ge,hasAudio:!0,hasVideo:!1,nb:Ce};return this.isAudioContiguous=!0,console.assert(Le.length,"MDAT length must not be zero"),ce},g.remuxEmptyAudio=function(c,l,a,T){var y=c.inputTimeScale,h=c.samplerate?c.samplerate:y,D=y/h,U=this.nextAudioPts,N=(U!==null?U:T.startDTS*y)+this._initDTS,W=T.endDTS*y+this._initDTS,M=D*w,I=Math.ceil((W-N)/M),H=F.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var X=[],te=0;te<I;te++){var ae=N+te*M;X.push({unit:H,pts:ae,dts:ae})}return c.samples=X,this.remuxAudio(c,l,a,!1)},g.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var T=c.inputTimeScale,y=this._initPTS,h=this._initDTS,D=0;D<a;D++){var U=c.samples[D];U.pts=s(U.pts-y,l*T)/T,U.dts=s(U.dts-h,l*T)/T}var N=c.samples;return c.samples=[],{samples:N}},g.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var T=c.inputTimeScale,y=this._initPTS,h=0;h<a;h++){var D=c.samples[h];D.pts=s(D.pts-y,l*T)/T}c.samples.sort(function(N,W){return N.pts-W.pts});var U=c.samples;return c.samples=[],{samples:U}},A}();function s(A,g){var p;if(g===null)return A;for(g<A?p=-8589934592:p=8589934592;Math.abs(A-g)>4294967296;)A+=p;return A}function C(A){for(var g=0;g<A.length;g++)if(A[g].key)return g;return-1}var E=function(g,p,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=p,this.size=c,this.cts=l,this.flags=new f(g)},f=function(g){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=g?2:1,this.isNonSync=g?0:1}},"./src/remux/passthrough-remuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),F=L("./src/utils/mp4-tools.ts"),O=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),k=function(){function m(){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 b=m.prototype;return b.destroy=function(){},b.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},b.resetNextTimestamp=function(){this.lastEndDTS=null},b.resetInitSegment=function(w,x,v){this.audioCodec=x,this.videoCodec=v,this.generateInitSegment(w),this.emitInitSegment=!0},b.generateInitSegment=function(w){var x=this.audioCodec,v=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(F.parseInitSegment)(w);x||(x=S(d.audio,O.ElementaryStreamTypes.AUDIO)),v||(v=S(d.video,O.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:x+","+v,initSegment:w,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:x,initSegment:w,id:"audio"}:d.video?o.video={container:"video/mp4",codec:v,initSegment:w,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},b.remux=function(w,x,v,d,o){var u=this.initPTS,s=this.lastEndDTS,C={audio:void 0,video:void 0,text:d,id3:v,initSegment:void 0};Object(K.isFiniteNumber)(s)||(s=this.lastEndDTS=o||0);var E=x.samples;if(!E||!E.length)return C;var f={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(E),A=this.initData),!A||!A.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(K.isFiniteNumber)(u)||(this.initPTS=f.initPTS=u=R(A,E,s));var g=Object(F.getDuration)(E,A),p=s,c=g+p;Object(F.offsetStartDTS)(A,E,u),g>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!A.audio,a=!!A.video,T="";l&&(T+="audio"),a&&(T+="video");var y={data1:E,startPTS:p,startDTS:p,endPTS:c,endDTS:c,type:T,hasAudio:l,hasVideo:a,nb:1,dropped:0};return C.audio=y.type==="audio"?y:void 0,C.video=y.type!=="audio"?y:void 0,C.text=d,C.id3=v,C.initSegment=f,C},m}(),R=function(b,P,w){return Object(F.getStartDTS)(b,P)-w};function S(m,b){var P=m==null?void 0:m.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||b===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}z.default=k},"./src/task-loop.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=F.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(k){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,k),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},F}()},"./src/types/cmcd.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"CMCDVersion",function(){return K}),L.d(z,"CMCDObjectType",function(){return F}),L.d(z,"CMCDStreamingFormat",function(){return O}),L.d(z,"CMCDStreamType",function(){return B});var K=1,F;(function(k){k.MANIFEST="m",k.AUDIO="a",k.VIDEO="v",k.MUXED="av",k.INIT="i",k.CAPTION="c",k.TIMED_TEXT="tt",k.KEY="k",k.OTHER="o"})(F||(F={}));var O;(function(k){k.DASH="d",k.HLS="h",k.SMOOTH="s",k.OTHER="o"})(O||(O={}));var B;(function(k){k.VOD="v",k.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"HlsSkip",function(){return O}),L.d(z,"getSkipValue",function(){return B}),L.d(z,"HlsUrlParameters",function(){return k}),L.d(z,"Level",function(){return R});function K(S,m){for(var b=0;b<m.length;b++){var P=m[b];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(S,P.key,P)}}function F(S,m,b){return m&&K(S.prototype,m),b&&K(S,b),S}var O;(function(S){S.No="",S.Yes="YES",S.v2="v2"})(O||(O={}));function B(S,m){var b=S.canSkipUntil,P=S.canSkipDateRanges,w=S.endSN,x=m!==void 0?m-w:0;return b&&x<b?P?O.v2:O.Yes:O.No}var k=function(){function S(b,P,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=b,this.part=P,this.skip=w}var m=S.prototype;return m.addDirectives=function(P){var w=new self.URL(P);return this.msn!==void 0&&w.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&w.searchParams.set("_HLS_part",this.part.toString()),this.skip&&w.searchParams.set("_HLS_skip",this.skip),w.toString()},S}(),R=function(){function S(m){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=[m.url],this.attrs=m.attrs,this.bitrate=m.bitrate,m.details&&(this.details=m.details),this.id=m.id||0,this.name=m.name,this.width=m.width||0,this.height=m.height||0,this.audioCodec=m.audioCodec,this.videoCodec=m.videoCodec,this.unknownCodecs=m.unknownCodecs,this.codecSet=[m.videoCodec,m.audioCodec].filter(function(b){return b}).join(",").replace(/\.[^.,]+/g,"")}return F(S,[{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(b){var P=b%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),S}()},"./src/types/loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"PlaylistContextType",function(){return K}),L.d(z,"PlaylistLevelType",function(){return F});var K;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(K||(K={}));var F;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"ChunkMetadata",function(){return K});var K=function(B,k,R,S,m,b){S===void 0&&(S=0),m===void 0&&(m=-1),b===void 0&&(b=!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=F(),this.buffering={audio:F(),video:F(),audiovideo:F()},this.level=B,this.sn=k,this.id=R,this.size=S,this.part=m,this.partial=b};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"AttrList",function(){return O});var K=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function B(R){typeof R=="string"&&(R=B.parseAttrList(R));for(var S in R)R.hasOwnProperty(S)&&(this[S]=R[S])}var k=B.prototype;return k.decimalInteger=function(S){var m=parseInt(this[S],10);return m>Number.MAX_SAFE_INTEGER?Infinity:m},k.hexadecimalInteger=function(S){if(this[S]){var m=(this[S]||"0x").slice(2);m=(m.length&1?"0":"")+m;for(var b=new Uint8Array(m.length/2),P=0;P<m.length/2;P++)b[P]=parseInt(m.slice(P*2,P*2+2),16);return b}else return null},k.hexadecimalIntegerAsNumber=function(S){var m=parseInt(this[S],16);return m>Number.MAX_SAFE_INTEGER?Infinity:m},k.decimalFloatingPoint=function(S){return parseFloat(this[S])},k.optionalFloat=function(S,m){var b=this[S];return b?parseFloat(b):m},k.enumeratedString=function(S){return this[S]},k.bool=function(S){return this[S]==="YES"},k.decimalResolution=function(S){var m=K.exec(this[S]);return m===null?void 0:{width:parseInt(m[1],10),height:parseInt(m[2],10)}},B.parseAttrList=function(S){var m,b={},P='"';for(F.lastIndex=0;(m=F.exec(S))!==null;){var w=m[2];w.indexOf(P)===0&&w.lastIndexOf(P)===w.length-1&&(w=w.slice(1,-1)),b[m[1]]=w}return b},B}()},"./src/utils/binary-search.ts":function(q,z,L){"use strict";L.r(z);var K={search:function(O,B){for(var k=0,R=O.length-1,S=null,m=null;k<=R;){S=(k+R)/2|0,m=O[S];var b=B(m);if(b>0)k=S+1;else if(b<0)R=S-1;else return m}return null}};z.default=K},"./src/utils/buffer-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"BufferHelper",function(){return O});var K=L("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function B(){}return B.isBuffered=function(R,S){try{if(R){for(var m=B.getBuffered(R),b=0;b<m.length;b++)if(S>=m.start(b)&&S<=m.end(b))return!0}}catch(P){}return!1},B.bufferInfo=function(R,S,m){try{if(R){var b=B.getBuffered(R),P=[],w;for(w=0;w<b.length;w++)P.push({start:b.start(w),end:b.end(w)});return this.bufferedInfo(P,S,m)}}catch(x){}return{len:0,start:S,end:S,nextStart:void 0}},B.bufferedInfo=function(R,S,m){S=Math.max(0,S),R.sort(function(f,A){var g=f.start-A.start;return g||A.end-f.end});var b=[];if(m)for(var P=0;P<R.length;P++){var w=b.length;if(w){var x=b[w-1].end;R[P].start-x<m?R[P].end>x&&(b[w-1].end=R[P].end):b.push(R[P])}else b.push(R[P])}else b=R;for(var v=0,d,o=S,u=S,s=0;s<b.length;s++){var C=b[s].start,E=b[s].end;if(S+m>=C&&S<E)o=C,u=E,v=u-S;else if(S+m<C){d=C;break}}return{len:v,start:o||0,end:u||0,nextStart:d}},B.getBuffered=function(R){try{return R.buffered}catch(S){return K.logger.log("failed to get media.buffered",S),F}},B}()},"./src/utils/cea-608-parser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"Row",function(){return u}),L.d(z,"CaptionScreen",function(){return s});var K=L("./src/utils/logger.ts"),F={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},O=function(c){var l=c;return F.hasOwnProperty(c)&&(l=F[c]),String.fromCharCode(l)},B=15,k=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},S={17:2,18:4,21:6,22:8,23:10,19:13,20:15},m={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},b={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(p){p[p.ERROR=0]="ERROR",p[p.TEXT=1]="TEXT",p[p.WARNING=2]="WARNING",p[p.INFO=2]="INFO",p[p.DEBUG=3]="DEBUG",p[p.DATA=3]="DATA"})(w||(w={}));var x=function(){function p(){this.time=null,this.verboseLevel=w.ERROR}var c=p.prototype;return c.log=function(a,T){this.verboseLevel>=a&&K.logger.log(this.time+" ["+a+"] "+T)},p}(),v=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},d=function(){function p(l,a,T,y,h){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=T||!1,this.background=y||"black",this.flash=h||!1}var c=p.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var T=["foreground","underline","italics","background","flash"],y=0;y<T.length;y++){var h=T[y];a.hasOwnProperty(h)&&(this[h]=a[h])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},p}(),o=function(){function p(l,a,T,y,h,D){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new d(a,T,y,h,D)}var c=p.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,T){this.uchar=a,this.penState.copy(T)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},p}(),u=function(){function p(l){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<k;a++)this.chars.push(new o);this.logger=l,this.pos=0,this.currPenState=new d}var c=p.prototype;return c.equals=function(a){for(var T=!0,y=0;y<k;y++)if(!this.chars[y].equals(a.chars[y])){T=!1;break}return T},c.copy=function(a){for(var T=0;T<k;T++)this.chars[T].copy(a.chars[T])},c.isEmpty=function(){for(var a=!0,T=0;T<k;T++)if(!this.chars[T].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},c.moveCursor=function(a){var T=this.pos+a;if(a>1)for(var y=this.pos+1;y<T+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(T)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var T=O(a);if(this.pos>=k){this.logger.log(w.ERROR,"Cannot insert "+a.toString(16)+" ("+T+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(T,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var T;for(T=a;T<k;T++)this.chars[T].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],T=!0,y=0;y<k;y++){var h=this.chars[y].uchar;h!==" "&&(T=!1),a.push(h)}return T?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var T=this.chars[this.pos];T.setPenState(this.currPenState)},p}(),s=function(){function p(l){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new u(l));this.logger=l,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=p.prototype;return c.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},c.equals=function(a){for(var T=!0,y=0;y<B;y++)if(!this.rows[y].equals(a.rows[y])){T=!1;break}return T},c.copy=function(a){for(var T=0;T<B;T++)this.rows[T].copy(a.rows[T])},c.isEmpty=function(){for(var a=!0,T=0;T<B;T++)if(!this.rows[T].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var T=this.rows[this.currRow];T.insertChar(a)},c.setPen=function(a){var T=this.rows[this.currRow];T.setPenStyles(a)},c.moveCursor=function(a){var T=this.rows[this.currRow];T.moveCursor(a)},c.setCursor=function(a){this.logger.log(w.INFO,"setCursor: "+a);var T=this.rows[this.currRow];T.setCursor(a)},c.setPAC=function(a){this.logger.log(w.INFO,"pacData = "+JSON.stringify(a));var T=a.row-1;if(this.nrRollUpRows&&T<this.nrRollUpRows-1&&(T=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==T){for(var y=0;y<B;y++)this.rows[y].clear();var h=this.currRow+1-this.nrRollUpRows,D=this.lastOutputScreen;if(D){var U=D.rows[h].cueStartTime,N=this.logger.time;if(U&&N!==null&&U<N)for(var W=0;W<this.nrRollUpRows;W++)this.rows[T-this.nrRollUpRows+W+1].copy(D.rows[h+W])}}this.currRow=T;var M=this.rows[this.currRow];if(a.indent!==null){var I=a.indent,H=Math.max(I-1,0);M.setCursor(a.indent),a.color=M.chars[H].penState.foreground}var X={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(X)},c.setBkgData=function(a){this.logger.log(w.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(w.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(w.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,T=this.rows.splice(a,1)[0];T.clear(),this.rows.splice(this.currRow,0,T),this.logger.log(w.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var T=[],y="",h=-1,D=0;D<B;D++){var U=this.rows[D].getTextString();U&&(h=D+1,a?T.push("Row "+h+": '"+U+"'"):T.push(U.trim()))}return T.length>0&&(a?y="["+T.join(" | ")+"]":y=T.join(`
`)),y},c.getTextAndFormat=function(){return this.rows},p}(),C=function(){function p(l,a,T){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=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new s(T),this.nonDisplayedMemory=new s(T),this.lastOutputScreen=new s(T),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=T}var c=p.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(w.INFO,"MODE="+a),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=a},c.insertChars=function(a){for(var T=0;T<a.length;T++)this.writeScreen.insertChar(a[T]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(w.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(w.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(w.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(w.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(w.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(w.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(w.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(w.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(w.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(w.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(w.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(w.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(w.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(w.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var T={flash:!1};if(T.underline=a%2===1,T.italics=a>=46,T.italics)T.foreground="white";else{var y=Math.floor(a/2)-16,h=["white","green","blue","cyan","red","yellow","magenta"];T.foreground=h[y]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(T)),this.writeScreen.setPen(T)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var T=this.logger.time;if(T===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=T:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,T,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:T),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},p}(),E=function(){function p(l,a,T){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new x;this.channels=[null,new C(l,a,y),new C(l+1,T,y)],this.cmdHistory=g(),this.logger=y}var c=p.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,T){this.channels[a].setHandler(T)},c.addData=function(a,T){var y,h,D,U=!1;this.logger.time=a;for(var N=0;N<T.length;N+=2){if(h=T[N]&127,D=T[N+1]&127,h===0&&D===0)continue;if(this.logger.log(w.DATA,"["+v([T[N],T[N+1]])+"] -> ("+v([h,D])+")"),y=this.parseCmd(h,D),y||(y=this.parseMidrow(h,D)),y||(y=this.parsePAC(h,D)),y||(y=this.parseBackgroundAttributes(h,D)),!y&&(U=this.parseChars(h,D),U)){var W=this.currentChannel;if(W&&W>0){var M=this.channels[W];M.insertChars(U)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!U&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+v([h,D])+" orig: "+v([T[N],T[N+1]]))}},c.parseCmd=function(a,T){var y=this.cmdHistory,h=(a===20||a===28||a===21||a===29)&&T>=32&&T<=47,D=(a===23||a===31)&&T>=33&&T<=35;if(!(h||D))return!1;if(A(a,T,y))return f(null,null,y),this.logger.log(w.DEBUG,"Repeated command ("+v([a,T])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,N=this.channels[U];return a===20||a===21||a===28||a===29?T===32?N.ccRCL():T===33?N.ccBS():T===34?N.ccAOF():T===35?N.ccAON():T===36?N.ccDER():T===37?N.ccRU(2):T===38?N.ccRU(3):T===39?N.ccRU(4):T===40?N.ccFON():T===41?N.ccRDC():T===42?N.ccTR():T===43?N.ccRTD():T===44?N.ccEDM():T===45?N.ccCR():T===46?N.ccENM():T===47&&N.ccEOC():N.ccTO(T-32),f(a,T,y),this.currentChannel=U,!0},c.parseMidrow=function(a,T){var y=0;if((a===17||a===25)&&T>=32&&T<=47){if(a===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var h=this.channels[y];return h?(h.ccMIDROW(T),this.logger.log(w.DEBUG,"MIDROW ("+v([a,T])+")"),!0):!1}return!1},c.parsePAC=function(a,T){var y,h=this.cmdHistory,D=(a>=17&&a<=23||a>=25&&a<=31)&&T>=64&&T<=127,U=(a===16||a===24)&&T>=64&&T<=95;if(!(D||U))return!1;if(A(a,T,h))return f(null,null,h),!0;var N=a<=23?1:2;T>=64&&T<=95?y=N===1?R[a]:m[a]:y=N===1?S[a]:b[a];var W=this.channels[N];return W?(W.setPAC(this.interpretPAC(y,T)),f(a,T,h),this.currentChannel=N,!0):!1},c.interpretPAC=function(a,T){var y,h={color:null,italics:!1,indent:null,underline:!1,row:a};return T>95?y=T-96:y=T-64,h.underline=(y&1)===1,y<=13?h.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(h.italics=!0,h.color="white"):h.indent=Math.floor((y-16)/2)*4,h},c.parseChars=function(a,T){var y,h=null,D=null;if(a>=25?(y=2,D=a-8):(y=1,D=a),D>=17&&D<=19){var U;D===17?U=T+80:D===18?U=T+112:U=T+144,this.logger.log(w.INFO,"Special char '"+O(U)+"' in channel "+y),h=[U]}else a>=32&&a<=127&&(h=T===0?[a]:[a,T]);if(h){var N=v(h);this.logger.log(w.DEBUG,"Char codes = "+N.join(",")),f(a,T,this.cmdHistory)}return h},c.parseBackgroundAttributes=function(a,T){var y=(a===16||a===24)&&T>=32&&T<=47,h=(a===23||a===31)&&T>=45&&T<=47;if(!(y||h))return!1;var D,U={};a===16||a===24?(D=Math.floor((T-32)/2),U.background=P[D],T%2===1&&(U.background=U.background+"_semi")):T===45?U.background="transparent":(U.foreground="black",T===47&&(U.underline=!0));var N=a<=23?1:2,W=this.channels[N];return W.setBkgData(U),f(a,T,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var T=this.channels[a];T&&T.reset()}this.cmdHistory=g()},c.cueSplitAtTime=function(a){for(var T=0;T<this.channels.length;T++){var y=this.channels[T];y&&y.cueSplitAtTime(a)}},p}();function f(p,c,l){l.a=p,l.b=c}function A(p,c,l){return l.a===p&&l.b===c}function g(){return{a:null,b:null}}z.default=E},"./src/utils/codecs.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isCodecType",function(){return F}),L.d(z,"isCodecSupportedInMp4",function(){return O});var K={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 F(B,k){var R=K[k];return!!R&&R[B.slice(0,4)]===!0}function O(B,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/vttparser.ts"),F=L("./src/utils/webvtt-parser.ts"),O=L("./src/utils/texttrack-utils.ts"),B=/\s/,k={newCue:function(S,m,b,P){for(var w=[],x,v,d,o,u,s=self.VTTCue||self.TextTrackCue,C=0;C<P.rows.length;C++)if(x=P.rows[C],d=!0,o=0,u="",!x.isEmpty()){for(var E=0;E<x.chars.length;E++)B.test(x.chars[E].uchar)&&d?o++:(u+=x.chars[E].uchar,d=!1);x.cueStartTime=m,m===b&&(b+=1e-4),o>=16?o--:o++;var f=Object(K.fixLineBreaks)(u.trim()),A=Object(F.generateCueId)(m,b,f);(!S||!S.cues||!S.cues.getCueById(A))&&(v=new s(m,b,f),v.id=A,v.line=C+1,v.align="left",v.position=10+Math.min(80,Math.floor(o*8/32)*10),w.push(v))}return S&&w.length&&(w.sort(function(g,p){return g.line==="auto"||p.line==="auto"?0:g.line>8&&p.line>8?p.line-g.line:g.line-p.line}),w.forEach(function(g){return Object(O.addCueToTrack)(S,g)})),w}};z.default=k},"./src/utils/discontinuities.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"findFirstFragWithCC",function(){return B}),L.d(z,"shouldAlignOnDiscontinuities",function(){return k}),L.d(z,"findDiscontinuousReferenceFrag",function(){return R}),L.d(z,"adjustSlidingStart",function(){return m}),L.d(z,"alignStream",function(){return b}),L.d(z,"alignPDT",function(){return w}),L.d(z,"alignFragmentByPDTDelta",function(){return x}),L.d(z,"alignMediaPlaylistByPDT",function(){return v});var K=L("./src/polyfills/number.ts"),F=L("./src/utils/logger.ts"),O=L("./src/controller/level-helper.ts");function B(d,o){for(var u=null,s=0,C=d.length;s<C;s++){var E=d[s];if(E&&E.cc===o){u=E;break}}return u}function k(d,o,u){return!!(o.details&&(u.endCC>u.startCC||d&&d.cc<u.startCC))}function R(d,o){var u=d.fragments,s=o.fragments;if(!s.length||!u.length){F.logger.log("No fragments to align");return}var C=B(u,s[0].cc);if(!C||C&&!C.startPTS){F.logger.log("No frag in previous level to align on");return}return C}function S(d,o){if(d){var u=d.start+o;d.start=d.startPTS=u,d.endPTS=u+d.duration}}function m(d,o){for(var u=o.fragments,s=0,C=u.length;s<C;s++)S(u[s],d);o.fragmentHint&&S(o.fragmentHint,d),o.alignedSliding=!0}function b(d,o,u){if(!o)return;P(d,u,o),!u.alignedSliding&&o.details&&w(u,o.details),!u.alignedSliding&&o.details&&!u.skippedSegments&&Object(O.adjustSliding)(o.details,u)}function P(d,o,u){if(k(d,u,o)){var s=R(u.details,o);s&&Object(K.isFiniteNumber)(s.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),m(s.start,o))}}function w(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,s=d.fragments[0].programDateTime,C=(s-u)/1e3+o.fragments[0].start;C&&Object(K.isFiniteNumber)(C)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(s-u)+"ms, sliding:"+C.toFixed(3)+" "+d.url+" "),m(C,d))}function x(d,o){var u=d.programDateTime;if(!u)return;var s=(u-o)/1e3;d.start=d.startPTS=s,d.endPTS=s+d.duration}function v(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,s=o.fragments[0].start,C=u-s*1e3;d.fragments.forEach(function(E){x(E,C)}),d.fragmentHint&&x(d.fragmentHint,C),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/ewma.ts"),F=function(){function O(k,R,S){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=S,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new K.default(k),this.fast_=new K.default(R)}var B=O.prototype;return B.update=function(R,S){var m=this.slow_,b=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new K.default(R,m.getEstimate(),m.getTotalWeight())),this.fast_.halfLife!==S&&(this.fast_=new K.default(S,b.getEstimate(),b.getTotalWeight()))},B.sample=function(R,S){R=Math.max(R,this.minDelayMs_);var m=8*S,b=R/1e3,P=m/b;this.fast_.sample(b,P),this.slow_.sample(b,P)},B.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},O}();z.default=F},"./src/utils/ewma.ts":function(q,z,L){"use strict";L.r(z);var K=function(){function F(B,k,R){k===void 0&&(k=0),R===void 0&&(R=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=k,this.totalWeight_=R}var O=F.prototype;return O.sample=function(k,R){var S=Math.pow(this.alpha_,k);this.estimate_=R*(1-S)+S*this.estimate_,this.totalWeight_+=k},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var k=1-Math.pow(this.alpha_,this.totalWeight_);if(k)return this.estimate_/k}return this.estimate_},F}();z.default=K},"./src/utils/fetch-loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"fetchSupported",function(){return x});var K=L("./src/polyfills/number.ts"),F=L("./src/loader/load-stats.ts"),O=L("./src/demux/chunk-cache.ts");function B(s,C){s.prototype=Object.create(C.prototype),s.prototype.constructor=s,b(s,C)}function k(s){var C=typeof Map=="function"?new Map:void 0;return k=function(f){if(f===null||!m(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(f))return C.get(f);C.set(f,A)}function A(){return R(f,arguments,P(this).constructor)}return A.prototype=Object.create(f.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),b(A,f)},k(s)}function R(s,C,E){return S()?R=Reflect.construct:R=function(A,g,p){var c=[null];c.push.apply(c,g);var l=Function.bind.apply(A,c),a=new l;return p&&b(a,p.prototype),a},R.apply(null,arguments)}function S(){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 m(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function b(s,C){return b=Object.setPrototypeOf||function(f,A){return f.__proto__=A,f},b(s,C)}function P(s){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(E){return E.__proto__||Object.getPrototypeOf(E)},P(s)}function w(){return w=Object.assign||function(s){for(var C=1;C<arguments.length;C++){var E=arguments[C];for(var f in E)Object.prototype.hasOwnProperty.call(E,f)&&(s[f]=E[f])}return s},w.apply(this,arguments)}function x(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var v=function(){function s(E){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=E.fetchSetup||o,this.controller=new self.AbortController,this.stats=new F.LoadStats}var C=s.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(f,A,g){var p=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var l=d(f,this.controller.signal),a=g.onProgress,T=f.responseType==="arraybuffer",y=T?"byteLength":"length";this.context=f,this.config=A,this.callbacks=g,this.request=this.fetchSetup(f,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){p.abortInternal(),g.onTimeout(c,f,p.response)},A.timeout),self.fetch(this.request).then(function(h){if(p.response=p.loader=h,!h.ok){var D=h.status,U=h.statusText;throw new u(U||"fetch, bad network response",D,h)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(h.headers.get("Content-Length")||"0"),a&&Object(K.isFiniteNumber)(A.highWaterMark)?p.loadProgressively(h,c,f,A.highWaterMark,a):T?h.arrayBuffer():h.text()}).then(function(h){var D=p.response;self.clearTimeout(p.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=h[y];var U={url:D.url,data:h};a&&!Object(K.isFiniteNumber)(A.highWaterMark)&&a(c,f,h,D),g.onSuccess(U,c,f,D)}).catch(function(h){if(self.clearTimeout(p.requestTimeout),c.aborted)return;var D=h.code||0;g.onError({code:D,text:h.message},f,h.details)})},C.getCacheAge=function(){var f=null;if(this.response){var A=this.response.headers.get("age");f=A?parseFloat(A):null}return f},C.loadProgressively=function(f,A,g,p,c){p===void 0&&(p=0);var l=new O.default,a=f.body.getReader(),T=function y(){return a.read().then(function(h){if(h.done)return l.dataLength&&c(A,g,l.flush(),f),Promise.resolve(new ArrayBuffer(0));var D=h.value,U=D.length;return A.loaded+=U,U<p||l.dataLength?(l.push(D),l.dataLength>=p&&c(A,g,l.flush(),f)):c(A,g,D,f),y()}).catch(function(){return Promise.reject()})};return T()},s}();function d(s,C){var E={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(w({},s.headers))};return s.rangeEnd&&E.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),E}function o(s,C){return new self.Request(s.url,C)}var u=function(s){B(C,s);function C(E,f,A){var g;return g=s.call(this,E)||this,g.code=void 0,g.details=void 0,g.code=f,g.details=A,g}return C}(k(Error));z.default=v},"./src/utils/imsc1-ttml-parser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"IMSC1_CODEC",function(){return m}),L.d(z,"parseIMSC1",function(){return x});var K=L("./src/utils/mp4-tools.ts"),F=L("./src/utils/vttparser.ts"),O=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),k=L("./src/utils/timescale-conversion.ts"),R=L("./src/utils/webvtt-parser.ts");function S(){return S=Object.assign||function(p){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(p[a]=l[a])}return p},S.apply(this,arguments)}var m="stpp.ttml.im1t",b=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function x(p,c,l,a,T){var y=Object(K.findBox)(new Uint8Array(p),["mdat"]);if(y.length===0){T(new Error("Could not parse IMSC1 mdat"));return}var h=y[0],D=Object(B.utf8ArrayToStr)(new Uint8Array(p,h.start,h.end-h.start)),U=Object(k.toTimescaleFromScale)(c,1,l);try{a(v(D,U))}catch(N){T(N)}}function v(p,c){var l=new DOMParser,a=l.parseFromString(p,"text/xml"),T=a.getElementsByTagName("tt")[0];if(!T)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},h=Object.keys(y).reduce(function(M,I){return M[I]=T.getAttribute("ttp:"+I)||y[I],M},{}),D=T.getAttribute("xml:space")!=="preserve",U=o(d(T,"styling","style")),N=o(d(T,"layout","region")),W=d(T,"body","[begin]");return[].map.call(W,function(M){var I=u(M,D);if(!I||!M.hasAttribute("begin"))return null;var H=f(M.getAttribute("begin"),h),X=f(M.getAttribute("dur"),h),te=f(M.getAttribute("end"),h);if(H===null)throw E(M);if(te===null){if(X===null)throw E(M);te=H+X}var ae=new O.default(H-c,te-c,I);ae.id=Object(R.generateCueId)(ae.startTime,ae.endTime,ae.text);var be=N[M.getAttribute("region")],pe=U[M.getAttribute("style")];ae.position=10,ae.size=80;var ue=s(be,pe),se=ue.textAlign;if(se){var he=w[se];he&&(ae.lineAlign=he),ae.align=se}return S(ae,ue),ae}).filter(function(M){return M!==null})}function d(p,c,l){var a=p.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(p){return p.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function u(p,c){return[].slice.call(p.childNodes).reduce(function(l,a,T){var y;return a.nodeName==="br"&&T?l+`
`:(y=a.childNodes)!==null&&y!==void 0&&y.length?u(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function s(p,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(T,y){var h=C(c,l,y)||C(p,l,y);return h&&(T[y]=h),T},{})}function C(p,c,l){return p.hasAttributeNS(c,l)?p.getAttributeNS(c,l):null}function E(p){return new Error("Could not parse ttml timestamp "+p)}function f(p,c){if(!p)return null;var l=Object(F.parseTimeStamp)(p);return l===null&&(b.test(p)?l=A(p,c):P.test(p)&&(l=g(p,c))),l}function A(p,c){var l=b.exec(p),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function g(p,c){var l=P.exec(p),a=Number(l[1]),T=l[2];switch(T){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"enableLogs",function(){return R}),L.d(z,"logger",function(){return S});var K=function(){},F={trace:K,debug:K,log:K,warn:K,info:K,error:K},O=F;function B(m){var b=self.console[m];return b?b.bind(self.console,"["+m+"] >"):K}function k(m){for(var b=arguments.length,P=new Array(b>1?b-1:0),w=1;w<b;w++)P[w-1]=arguments[w];P.forEach(function(x){O[x]=m[x]?m[x].bind(m):B(x)})}function R(m){if(self.console&&m===!0||typeof m=="object"){k(m,"debug","log","info","warn","error");try{O.log()}catch(b){O=F}}else O=F}var S=O},"./src/utils/mediakeys-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"KeySystems",function(){return K}),L.d(z,"requestMediaKeySystemAccess",function(){return F});var K;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(K||(K={}));var F=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"getMediaSource",function(){return K});function K(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"bin2str",function(){return k}),L.d(z,"readUint16",function(){return R}),L.d(z,"readUint32",function(){return S}),L.d(z,"writeUint32",function(){return m}),L.d(z,"findBox",function(){return b}),L.d(z,"parseSegmentIndex",function(){return P}),L.d(z,"parseInitSegment",function(){return w}),L.d(z,"getStartDTS",function(){return x}),L.d(z,"getDuration",function(){return v}),L.d(z,"computeRawDurationFromSamples",function(){return d}),L.d(z,"offsetStartDTS",function(){return o}),L.d(z,"segmentValidRange",function(){return u}),L.d(z,"appendUint8Array",function(){return s});var K=L("./src/utils/typed-array.ts"),F=L("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,B=[].push;function k(C){return String.fromCharCode.apply(null,C)}function R(C,E){"data"in C&&(E+=C.start,C=C.data);var f=C[E]<<8|C[E+1];return f<0?65536+f:f}function S(C,E){"data"in C&&(E+=C.start,C=C.data);var f=C[E]<<24|C[E+1]<<16|C[E+2]<<8|C[E+3];return f<0?4294967296+f:f}function m(C,E,f){"data"in C&&(E+=C.start,C=C.data),C[E]=f>>24,C[E+1]=f>>16&255,C[E+2]=f>>8&255,C[E+3]=f&255}function b(C,E){var f=[];if(!E.length)return f;var A,g,p;"data"in C?(A=C.data,g=C.start,p=C.end):(A=C,g=0,p=A.byteLength);for(var c=g;c<p;){var l=S(A,c),a=k(A.subarray(c+4,c+8)),T=l>1?c+l:p;if(a===E[0])if(E.length===1)f.push({data:A,start:c+8,end:T});else{var y=b({data:A,start:c+8,end:T},E.slice(1));y.length&&B.apply(f,y)}c=T}return f}function P(C){var E=b(C,["moov"]),f=E[0],A=f?f.end:null,g=b(C,["sidx"]);if(!g||!g[0])return null;var p=[],c=g[0],l=c.data[0],a=l===0?8:16,T=S(c,a);a+=4;var y=0,h=0;l===0?a+=8:a+=16,a+=2;var D=c.end+h,U=R(c,a);a+=2;for(var N=0;N<U;N++){var W=a,M=S(c,W);W+=4;var I=M&2147483647,H=(M&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var X=S(c,W);W+=4,p.push({referenceSize:I,subsegmentDuration:X,info:{duration:X/T,start:D,end:D+I-1}}),D+=I,W+=4,a=W}return{earliestPresentationTime:y,timescale:T,version:l,referencesCount:U,references:p,moovEndOffset:A}}function w(C){for(var E=[],f=b(C,["moov","trak"]),A=0;A<f.length;A++){var g=f[A],p=b(g,["tkhd"])[0];if(p){var c=p.data[p.start],l=c===0?12:20,a=S(p,l),T=b(g,["mdia","mdhd"])[0];if(T){c=T.data[T.start],l=c===0?12:20;var y=S(T,l),h=b(g,["mdia","hdlr"])[0];if(h){var D=k(h.data.subarray(h.start+8,h.start+12)),U={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[D];if(U){var N=b(g,["mdia","minf","stbl","stsd"])[0],W=void 0;N&&(W=k(N.data.subarray(N.start+12,N.start+16))),E[a]={timescale:y,type:U},E[U]={timescale:y,id:a,codec:W}}}}}}var M=b(C,["moov","mvex","trex"]);return M.forEach(function(I){var H=S(I,4),X=E[H];X&&(X.default={duration:S(I,12),flags:S(I,20)})}),E}function x(C,E){return b(E,["moof","traf"]).reduce(function(f,A){var g=b(A,["tfdt"])[0],p=g.data[g.start],c=b(A,["tfhd"]).reduce(function(l,a){var T=S(a,4),y=C[T];if(y){var h=S(g,4);p===1&&(h*=Math.pow(2,32),h+=S(g,8));var D=y.timescale||9e4,U=h/D;if(isFinite(U)&&(l===null||U<l))return U}return l},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function v(C,E){for(var f=0,A=0,g=0,p=b(C,["moof","traf"]),c=0;c<p.length;c++){var l=p[c],a=b(l,["tfhd"])[0],T=S(a,4),y=E[T];if(!y)continue;var h=y.default,D=S(a,0)|(h==null?void 0:h.flags),U=h==null?void 0:h.duration;D&8&&(D&2?U=S(a,12):U=S(a,8));for(var N=y.timescale||9e4,W=b(l,["trun"]),M=0;M<W.length;M++){if(U){var I=S(W[M],4);f=U*I}else f=d(W[M]);y.type===F.ElementaryStreamTypes.VIDEO?A+=f/N:y.type===F.ElementaryStreamTypes.AUDIO&&(g+=f/N)}}if(A===0&&g===0){var H=P(C);if(H!=null&&H.references)return H.references.reduce(function(X,te){return X+te.info.duration||0},0)}return A||g}function d(C){var E=S(C,0),f=8;E&1&&(f+=4),E&4&&(f+=4);for(var A=0,g=S(C,4),p=0;p<g;p++){if(E&256){var c=S(C,f);A+=c,f+=4}E&512&&(f+=4),E&1024&&(f+=4),E&2048&&(f+=4)}return A}function o(C,E,f){b(E,["moof","traf"]).forEach(function(A){b(A,["tfhd"]).forEach(function(g){var p=S(g,4),c=C[p];if(!c)return;var l=c.timescale||9e4;b(A,["tfdt"]).forEach(function(a){var T=a.data[a.start],y=S(a,4);if(T===0)m(a,4,y-f*l);else{y*=Math.pow(2,32),y+=S(a,8),y-=f*l,y=Math.max(y,0);var h=Math.floor(y/(O+1)),D=Math.floor(y%(O+1));m(a,4,h),m(a,8,D)}})})})}function u(C){var E={valid:null,remainder:null},f=b(C,["moof"]);if(f){if(f.length<2)return E.remainder=C,E}else return E;var A=f[f.length-1];return E.valid=Object(K.sliceUint8)(C,0,A.start-8),E.remainder=Object(K.sliceUint8)(C,A.start-8),E}function s(C,E){var f=new Uint8Array(C.length+E.length);return f.set(C),f.set(E,C.length),f}},"./src/utils/output-filter.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function F(B,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=k}var O=F.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(k,R,S){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=R,this.screen=S,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"sendAddTrackEvent",function(){return F}),L.d(z,"addCueToTrack",function(){return O}),L.d(z,"clearCurrentCues",function(){return B}),L.d(z,"removeCuesInRange",function(){return k}),L.d(z,"getCuesInRange",function(){return S});var K=L("./src/utils/logger.ts");function F(m,b){var P;try{P=new Event("addtrack")}catch(w){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=m,b.dispatchEvent(P)}function O(m,b){var P=m.mode;if(P==="disabled"&&(m.mode="hidden"),m.cues&&!m.cues.getCueById(b.id))try{if(m.addCue(b),!m.cues.getCueById(b.id))throw new Error("addCue is failed for: "+b)}catch(x){K.logger.debug("[texttrack-utils]: "+x);var w=new self.TextTrackCue(b.startTime,b.endTime,b.text);w.id=b.id,m.addCue(w)}P==="disabled"&&(m.mode=P)}function B(m){var b=m.mode;if(b==="disabled"&&(m.mode="hidden"),m.cues)for(var P=m.cues.length;P--;)m.removeCue(m.cues[P]);b==="disabled"&&(m.mode=b)}function k(m,b,P){var w=m.mode;if(w==="disabled"&&(m.mode="hidden"),m.cues&&m.cues.length>0)for(var x=S(m.cues,b,P),v=0;v<x.length;v++)m.removeCue(x[v]);w==="disabled"&&(m.mode=w)}function R(m,b){if(b<m[0].startTime)return 0;var P=m.length-1;if(b>m[P].endTime)return-1;for(var w=0,x=P;w<=x;){var v=Math.floor((x+w)/2);if(b<m[v].startTime)x=v-1;else if(b>m[v].startTime&&w<P)w=v+1;else return v}return m[w].startTime-b<b-m[x].startTime?w:x}function S(m,b,P){var w=[],x=R(m,b);if(x>-1)for(var v=x,d=m.length;v<d;v++){var o=m[v];if(o.startTime>=b&&o.endTime<=P)w.push(o);else if(o.startTime>P)return w}return w}},"./src/utils/time-ranges.ts":function(q,z,L){"use strict";L.r(z);var K={toString:function(O){for(var B="",k=O.length,R=0;R<k;R++)B+="["+O.start(R).toFixed(3)+","+O.end(R).toFixed(3)+"]";return B}};z.default=K},"./src/utils/timescale-conversion.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"toTimescaleFromBase",function(){return F}),L.d(z,"toTimescaleFromScale",function(){return O}),L.d(z,"toMsFromMpegTsClock",function(){return B}),L.d(z,"toMpegTsClockFromTimescale",function(){return k});var K=9e4;function F(R,S,m,b){m===void 0&&(m=1),b===void 0&&(b=!1);var P=R*S*m;return b?Math.round(P):P}function O(R,S,m,b){return m===void 0&&(m=1),b===void 0&&(b=!1),F(R,S,1/m,b)}function B(R,S){return S===void 0&&(S=!1),F(R,1e3,1/K,S)}function k(R,S){return S===void 0&&(S=1),F(R,K,1/S)}},"./src/utils/typed-array.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"sliceUint8",function(){return K});function K(F,O,B){return Uint8Array.prototype.slice?F.slice(O,B):new Uint8Array(Array.prototype.slice.call(F,O,B))}},"./src/utils/vttcue.ts":function(q,z,L){"use strict";L.r(z),z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var K=["","lr","rl"],F=["start","middle","end","left","right"];function O(m,b){if(typeof b!="string")return!1;if(!Array.isArray(m))return!1;var P=b.toLowerCase();return~m.indexOf(P)?P:!1}function B(m){return O(K,m)}function k(m){return O(F,m)}function R(m){for(var b=arguments.length,P=new Array(b>1?b-1:0),w=1;w<b;w++)P[w-1]=arguments[w];for(var x=1;x<arguments.length;x++){var v=arguments[x];for(var d in v)m[d]=v[d]}return m}function S(m,b,P){var w=this,x={enumerable:!0};w.hasBeenReset=!1;var v="",d=!1,o=m,u=b,s=P,C=null,E="",f=!0,A="auto",g="start",p=50,c="middle",l=50,a="middle";Object.defineProperty(w,"id",R({},x,{get:function(){return v},set:function(y){v=""+y}})),Object.defineProperty(w,"pauseOnExit",R({},x,{get:function(){return d},set:function(y){d=!!y}})),Object.defineProperty(w,"startTime",R({},x,{get:function(){return o},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");o=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",R({},x,{get:function(){return u},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");u=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",R({},x,{get:function(){return s},set:function(y){s=""+y,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",R({},x,{get:function(){return C},set:function(y){C=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",R({},x,{get:function(){return E},set:function(y){var h=B(y);if(h===!1)throw new SyntaxError("An invalid or illegal string was specified.");E=h,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",R({},x,{get:function(){return f},set:function(y){f=!!y,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",R({},x,{get:function(){return A},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",R({},x,{get:function(){return g},set:function(y){var h=k(y);if(!h)throw new SyntaxError("An invalid or illegal string was specified.");g=h,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",R({},x,{get:function(){return p},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");p=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",R({},x,{get:function(){return c},set:function(y){var h=k(y);if(!h)throw new SyntaxError("An invalid or illegal string was specified.");c=h,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",R({},x,{get:function(){return l},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");l=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",R({},x,{get:function(){return a},set:function(y){var h=k(y);if(!h)throw new SyntaxError("An invalid or illegal string was specified.");a=h,this.hasBeenReset=!0}})),w.displayState=void 0}return S.prototype.getCueAsHTML=function(){var m=self.WebVTT;return m.convertCueToDOMTree(self,this.text)},S}()},"./src/utils/vttparser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"parseTimeStamp",function(){return O}),L.d(z,"fixLineBreaks",function(){return b}),L.d(z,"VTTParser",function(){return P});var K=L("./src/utils/vttcue.ts"),F=function(){function w(){}var x=w.prototype;return x.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},w}();function O(w){function x(d,o,u,s){return(d|0)*3600+(o|0)*60+(u|0)+parseFloat(s||0)}var v=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return v?parseFloat(v[2])>59?x(v[2],v[3],0,v[4]):x(v[1],v[2],v[3],v[4]):null}var B=function(){function w(){this.values=Object.create(null)}var x=w.prototype;return x.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},x.get=function(d,o,u){return u?this.has(d)?this.values[d]:o[u]:this.has(d)?this.values[d]:o},x.has=function(d){return d in this.values},x.alt=function(d,o,u){for(var s=0;s<u.length;++s)if(o===u[s]){this.set(d,o);break}},x.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},x.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var u=parseFloat(o);if(u>=0&&u<=100)return this.set(d,u),!0}return!1},w}();function k(w,x,v,d){var o=d?w.split(d):[w];for(var u in o){if(typeof o[u]!="string")continue;var s=o[u].split(v);if(s.length!==2)continue;var C=s[0],E=s[1];x(C,E)}}var R=new K.default(0,0,""),S=R.align==="middle"?"middle":"center";function m(w,x,v){var d=w;function o(){var C=O(w);if(C===null)throw new Error("Malformed timestamp: "+d);return w=w.replace(/^[^\sa-zA-Z-]+/,""),C}function u(C,E){var f=new B;k(C,function(p,c){var l;switch(p){case"region":for(var a=v.length-1;a>=0;a--)if(v[a].id===c){f.set(p,v[a].region);break}break;case"vertical":f.alt(p,c,["rl","lr"]);break;case"line":l=c.split(","),f.integer(p,l[0]),f.percent(p,l[0])&&f.set("snapToLines",!1),f.alt(p,l[0],["auto"]),l.length===2&&f.alt("lineAlign",l[1],["start",S,"end"]);break;case"position":l=c.split(","),f.percent(p,l[0]),l.length===2&&f.alt("positionAlign",l[1],["start",S,"end","line-left","line-right","auto"]);break;case"size":f.percent(p,c);break;case"align":f.alt(p,c,["start",S,"end","left","right"]);break}},/:/,/\s/),E.region=f.get("region",null),E.vertical=f.get("vertical","");var A=f.get("line","auto");A==="auto"&&R.line===-1&&(A=-1),E.line=A,E.lineAlign=f.get("lineAlign","start"),E.snapToLines=f.get("snapToLines",!0),E.size=f.get("size",100),E.align=f.get("align",S);var g=f.get("position","auto");g==="auto"&&R.position===50&&(g=E.align==="start"||E.align==="left"?0:E.align==="end"||E.align==="right"?100:50),E.position=g}function s(){w=w.replace(/^\s+/,"")}if(s(),x.startTime=o(),s(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);w=w.substr(3),s(),x.endTime=o(),s(),u(w,x)}function b(w){return w.replace(/<br(?: \/)?>/gi,`
`)}var P=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new F,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var x=w.prototype;return x.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function u(){var g=o.buffer,p=0;for(g=b(g);p<g.length&&g[p]!=="\r"&&g[p]!==`
`;)++p;var c=g.substr(0,p);return g[p]==="\r"&&++p,g[p]===`
`&&++p,o.buffer=g.substr(p),c}function s(g){k(g,function(p,c){},/:/)}try{var C="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;C=u();var E=C.match(/^()?WEBVTT([ \t].*)?$/);if(!E||!E[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var f=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;f?f=!1:C=u();switch(o.state){case"HEADER":/:/.test(C)?s(C):C||(o.state="ID");continue;case"NOTE":C||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){o.state="NOTE";break}if(!C)continue;if(o.cue=new K.default(0,0,""),o.state="CUE",C.indexOf("-->")===-1){o.cue.id=C;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{m(C,o.cue,o.regionList)}catch(g){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var A=C.indexOf("-->")!==-1;if(!C||A&&(f=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=C}continue;case"BADCUE":C||(o.state="ID")}}}catch(g){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},x.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"generateCueId",function(){return P}),L.d(z,"parseWebVTT",function(){return x});var K=L("./src/polyfills/number.ts"),F=L("./src/utils/vttparser.ts"),O=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),k=L("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,S=function(d,o,u){return u===void 0&&(u=0),d.substr(u,o.length)===o},m=function(d){var o=parseInt(d.substr(-3)),u=parseInt(d.substr(-6,2)),s=parseInt(d.substr(-9,2)),C=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(K.isFiniteNumber)(o)||!Object(K.isFiniteNumber)(u)||!Object(K.isFiniteNumber)(s)||!Object(K.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*u,o+=60*1e3*s,o+=60*60*1e3*C,o},b=function(d){for(var o=5381,u=d.length;u;)o=o*33^d.charCodeAt(--u);return(o>>>0).toString()};function P(v,d,o){return b(v.toString())+b(d.toString())+b(o)}var w=function(d,o,u){var s=d[o],C=d[s.prevCC];if(!C||!C.new&&s.new){d.ccOffset=d.presentationOffset=s.start,s.new=!1;return}for(;(E=C)!==null&&E!==void 0&&E.new;){var E;d.ccOffset+=s.start-C.start,s.new=!1,s=C,C=d[s.prevCC]}d.presentationOffset=u};function x(v,d,o,u,s,C,E,f){var A=new F.VTTParser,g=Object(O.utf8ArrayToStr)(new Uint8Array(v)).trim().replace(R,`
`).split(`
`),p=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),l="00:00.000",a=0,T=0,y,h=!0,D=!1;A.oncue=function(U){var N=u[s],W=u.ccOffset,M=(a-c)/9e4;if(N!=null&&N.new&&(T!==void 0?W=u.ccOffset=N.start:w(u,s,M)),M&&(W=M-u.presentationOffset),D){var I=U.endTime-U.startTime,H=Object(k.normalizePts)((U.startTime+W-T)*9e4,C*9e4)/9e4;U.startTime=H,U.endTime=H+I}var X=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(X)),U.id||(U.id=P(U.startTime,U.endTime,X)),U.endTime>0&&p.push(U)},A.onparsingerror=function(U){y=U},A.onflush=function(){if(y){f(y);return}E(p)},g.forEach(function(U){if(h)if(S(U,"X-TIMESTAMP-MAP=")){h=!1,D=!0,U.substr(16).split(",").forEach(function(N){S(N,"LOCAL:")?l=N.substr(6):S(N,"MPEGTS:")&&(a=parseInt(N.substr(7)))});try{T=m(l)/1e3}catch(N){D=!1,y=N}return}else U===""&&(h=!1);A.parse(U+`
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/logger.ts"),F=L("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,B=function(){function k(S){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=S?S.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var R=k.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var m=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),m&&(m.onreadystatechange=null,m.onprogress=null,m.readyState!==4&&(this.stats.aborted=!0,m.abort()))},R.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(m,b,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=m,this.config=b,this.callbacks=P,this.retryDelay=b.retryDelay,this.loadInternal()},R.loadInternal=function(){var m=this.config,b=this.context;if(!m)return;var P=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var x=this.xhrSetup;try{if(x)try{x(P,b.url)}catch(o){P.open("GET",b.url,!0),x(P,b.url)}P.readyState||P.open("GET",b.url,!0);var v=this.context.headers;if(v)for(var d in v)P.setRequestHeader(d,v[d])}catch(o){this.callbacks.onError({code:P.status,text:o.message},b,P);return}b.rangeEnd&&P.setRequestHeader("Range","bytes="+b.rangeStart+"-"+(b.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=b.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout),P.send()},R.readystatechange=function(){var m=this.context,b=this.loader,P=this.stats;if(!m||!b)return;var w=b.readyState,x=this.config;if(P.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),w===4){b.onreadystatechange=null,b.onprogress=null;var v=b.status;if(v>=200&&v<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var d,o;if(m.responseType==="arraybuffer"?(d=b.response,o=d.byteLength):(d=b.responseText,o=d.length),P.loaded=P.total=o,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(P,m,d,b),!this.callbacks)return;var s={url:b.responseURL,data:d};this.callbacks.onSuccess(s,P,m,b)}else P.retry>=x.maxRetry||v>=400&&v<499?(K.logger.error(v+" while loading "+m.url),this.callbacks.onError({code:v,text:b.statusText},m,b)):(K.logger.warn(v+" while loading "+m.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,x.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout)},R.loadtimeout=function(){K.logger.warn("timeout while loading "+this.context.url);var m=this.callbacks;m&&(this.abortInternal(),m.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(m){var b=this.stats;b.loaded=m.loaded,m.lengthComputable&&(b.total=m.total)},R.getCacheAge=function(){var m=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var b=this.loader.getResponseHeader("age");m=b?parseFloat(b):null}return m},k}();z.default=B}}).default})},vHTk:function(qe,He,J){qe.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wU8J:function(qe,He){function J(){this.buffer=new Array,this.length=0}J.prototype={get:function(q){var z=Math.floor(q/8);return(this.buffer[z]>>>7-q%8&1)==1},put:function(q,z){for(var L=0;L<z;L++)this.putBit((q>>>z-L-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(q){var z=Math.floor(this.length/8);this.buffer.length<=z&&this.buffer.push(0),q&&(this.buffer[z]|=128>>>this.length%8),this.length++}},qe.exports=J},wzkS:function(qe,He,J){"use strict";J.d(He,"c",function(){return F}),J.d(He,"b",function(){return O}),J.d(He,"d",function(){return B}),J.d(He,"a",function(){return R}),J.d(He,"e",function(){return S});var q=J("9og8"),z=J("WmNS"),L=J.n(z),K=J("ErOA");function F(m){return Object(K.c)("libraries/".concat(m,".json"))}function O(){return Object(K.c)("library_tags.json")}function B(m){return k.apply(this,arguments)}function k(){return k=Object(q.a)(L.a.mark(function m(b){var P;return L.a.wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return x.next=2,Object(K.b)("attachments/".concat(b,".json"));case 2:return P=x.sent,x.abrupt("return",P.status===0);case 4:case"end":return x.stop()}},m)})),k.apply(this,arguments)}function R(m){return Object(K.f)("libraries.json",m)}function S(m,b){return Object(K.g)("libraries/".concat(m,".json"),b)}},y5JW:function(qe,He,J){"use strict";J.d(He,"c",function(){return v}),J.d(He,"a",function(){return d});var q=J("DZo9"),z=J("8z0m"),L=J("+L6B"),K=J("2/Rp"),F=J("9og8"),O=J("miYZ"),B=J("tsqr"),k=J("k1fw"),R=J("oBTY"),S=J("WmNS"),m=J.n(S),b=J("cDcd"),P=J.n(b),w=J("m3rI"),x=J("wzkS"),v="\u3000\u3000";function d(o){var u=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var s=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,s)).toFixed(1)+" "+u[s]}He.b=function(o){var u=o.value,s=u===void 0?[]:u,C=o.action,E=o.onChange,f=o.className,A=o.maxSize,g=A===void 0?150:A,p=o.title,c=p===void 0?"\u6587\u4EF6\u4E0A\u4F20":p,l=o.accept,a=l===void 0?null:l,T={multiple:!1,fileList:s,accept:a,withCredentials:!0,beforeUpload:function(D){var U=D.size/1024/1024;return!0},action:"".concat(w.a.API_SERVER,"/api/attachments.json"),onChange:function(D){var U,N,W=Object(R.a)(D.fileList);if(W=W.map(function(H){return H.name.indexOf(v)===-1&&(H.name="".concat(H.name).concat(v).concat(d(H.size))),Object(k.a)({},H)}),D.file.status==="done"&&((U=D.file)===null||U===void 0||((N=U.response)===null||N===void 0)?void 0:N.status)===-1){var M,I;B.b.error((M=D.file)===null||M===void 0||((I=M.response)===null||I===void 0)?void 0:I.message),E([]);return}E(W)},onRemove:function(){var h=Object(F.a)(m.a.mark(function U(N){var W,M,I;return m.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(W=N.size/1024/1024,!(N.status==="uploading")){X.next=3;break}return X.abrupt("return",!0);case 3:if(W<g){X.next=7;break}return X.abrupt("return",!0);case 7:if(M=N.response?N.response.id:N.uid,!M){X.next=15;break}return X.next=11,Object(x.d)(N.response?N.response.id:N.id);case 11:return I=X.sent,X.abrupt("return",I);case 15:return X.abrupt("return",!0);case 16:case"end":return X.stop()}},U)}));function D(U){return h.apply(this,arguments)}return D}()};function y(h){h.preventDefault(),h.stopPropagation()}return P.a.createElement("div",{className:"single-upload ".concat(f||"")},P.a.createElement(z.a,T,P.a.createElement(K.a,{type:"primary",title:s.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:s.length>0,ghost:!0},c),P.a.createElement("span",{onClick:y,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",g,"M)"," ")))}},yQHh:function(qe,He,J){}}]);